2223{
2225
2227
2229
2236
2237
2238
2244
2250
2252
2256
2257
2259 {
2261
2262
2263 RegisterNetSyncVariableInt( "m_SyncParts01" );
2264 RegisterNetSyncVariableInt( "m_SyncParts02" );
2265 RegisterNetSyncVariableInt( "m_SyncParts03" );
2266 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2267 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2268 RegisterNetSyncVariableBool( "m_HasBase" );
2269
2270
2271 ConstructionInit();
2272
2273 if (ConfigIsExisting("hybridAttachments"))
2274 {
2277 }
2278 if (ConfigIsExisting("mountables"))
2279 {
2282 }
2283
2285 SetAllowDamage(true);
2286 }
2287
2289 {
2290 return "disableBaseDamage";
2291 }
2292
2294 {
2295 return true;
2296 }
2297
2299 {
2300 return EInventoryIconVisibility.HIDE_VICINITY;
2301 }
2302
2304 {
2305 super.InitItemSounds();
2306
2310
2315 }
2316
2318 {
2319 return "putDown_FenceKit_SoundSet";
2320 }
2321
2323 {
2324 return "Shelter_Site_Build_Loop_SoundSet";
2325 }
2326
2327
2329 {
2331 {
2332 SetSynchDirty();
2333 }
2334 }
2335
2337 {
2339 super.OnVariablesSynchronized();
2340
2342 }
2343
2345 {
2346
2348
2349
2351
2352
2354 }
2355
2356
2358 {
2359
2360 int offset;
2361 int mask;
2362
2363 if ( part_id >= 1 && part_id <= 31 )
2364 {
2365 offset = part_id - 1;
2366 mask = 1 << offset;
2367
2369 }
2370 else if ( part_id >= 32 && part_id <= 62 )
2371 {
2372 offset = ( part_id % 32 );
2373 mask = 1 << offset;
2374
2376 }
2377 else if ( part_id >= 63 && part_id <= 93 )
2378 {
2379 offset = ( part_id % 63 );
2380 mask = 1 << offset;
2381
2383 }
2384 }
2385
2387 {
2388
2389 int offset;
2390 int mask;
2391
2392 if ( part_id >= 1 && part_id <= 31 )
2393 {
2394 offset = part_id - 1;
2395 mask = 1 << offset;
2396
2398 }
2399 else if ( part_id >= 32 && part_id <= 62 )
2400 {
2401 offset = ( part_id % 32 );
2402 mask = 1 << offset;
2403
2405 }
2406 else if ( part_id >= 63 && part_id <= 93 )
2407 {
2408 offset = ( part_id % 63 );
2409 mask = 1 << offset;
2410
2412 }
2413 }
2414
2416 {
2417
2418 int offset;
2419 int mask;
2420
2421 if ( part_id >= 1 && part_id <= 31 )
2422 {
2423 offset = part_id - 1;
2424 mask = 1 << offset;
2425
2427 {
2428 return true;
2429 }
2430 }
2431 else if ( part_id >= 32 && part_id <= 62 )
2432 {
2433 offset = ( part_id % 32 );
2434 mask = 1 << offset;
2435
2437 {
2438 return true;
2439 }
2440 }
2441 else if ( part_id >= 63 && part_id <= 93 )
2442 {
2443 offset = ( part_id % 63 );
2444 mask = 1 << offset;
2445
2447 {
2448 return true;
2449 }
2450 }
2451
2452 return false;
2453 }
2454
2456 {
2459 }
2460
2462 {
2463
2466 }
2467
2469 {
2471 {
2474
2475 switch( build_action_id )
2476 {
2480 }
2481 }
2482 }
2483
2484
2486 {
2488 bool is_base = part.
IsBase();
2491 if ( is_part_built_sync )
2492 {
2494 {
2498
2499 if (is_base)
2500 {
2503 }
2504 }
2505 }
2506 else
2507 {
2509 {
2513
2514 if (is_base)
2515 {
2518 }
2519 }
2520 }
2521
2522
2524 }
2525
2526
2528 {
2531
2532 for ( int i = 0; i < construction_parts.Count(); ++i )
2533 {
2534 string key = construction_parts.GetKey( i );
2537 }
2538
2539
2541 }
2542
2544 {
2547
2548 for ( int i = 0; i < construction_parts.Count(); ++i )
2549 {
2550 string key = construction_parts.GetKey( i );
2552
2553 if ( value.
GetId() ==
id )
2554 {
2555 return value;
2556 }
2557 }
2558
2559 return NULL;
2560 }
2561
2562
2563
2565 {
2567 }
2568
2570 {
2572 }
2573
2575 {
2576 return true;
2577 }
2578
2580 {
2581 return false;
2582 }
2583
2584
2586 {
2589 {
2591 }
2592
2593 return construction_kit;
2594 }
2595
2597 {
2600 {
2602 }
2603 }
2604
2606 {
2608 }
2609
2611 {
2612 return "";
2613 }
2614
2616 {
2618 g_Game.ObjectDelete( construction_kit );
2619 }
2620
2621
2623 {
2625 g_Game.ObjectDelete(
this );
2626 }
2627
2628
2630 {
2631 super.EEDelete(parent);
2632
2634 {
2635 areaDamage.Destroy();
2636 }
2637
2638 }
2639
2641 {
2642 super.OnStoreSave( ctx );
2643
2644
2648
2650 }
2651
2653 {
2654 if ( !super.OnStoreLoad( ctx, version ) )
2655 return false;
2656
2657
2658
2660 {
2662 return false;
2663 }
2665 {
2667 return false;
2668 }
2670 {
2672 return false;
2673 }
2674
2675
2677 {
2679 return false;
2680 }
2681
2682
2683 return true;
2684 }
2685
2687 {
2688 super.AfterStoreLoad();
2689
2691 {
2693 }
2694 }
2695
2697 {
2698
2700
2701
2704
2705
2707 }
2708
2710 {
2711 super.OnCreatePhysics();
2712
2713 ConstructionInit();
2715 }
2716
2718 {
2720 return;
2721
2722 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2723 }
2724
2726 {
2728 {
2730 }
2731
2732 super.EEOnAfterLoad();
2733 }
2734
2736 {
2737 super.EEItemAttached( item, slot_name );
2738
2742 }
2743
2745 {
2746 super.EEItemDetached( item, slot_name );
2747
2750 }
2751
2752 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2753 {
2756
2759 }
2760
2761
2763 {
2764 return true;
2765 }
2766
2767
2768
2770 {
2772
2773
2774 if (construtionPart.
IsBase())
2775 {
2777
2778
2780 }
2781
2782
2784
2785
2787
2788
2790
2792
2794
2795
2797
2798
2800 }
2801
2803 {
2804
2806 }
2807
2808
2810 {
2813
2814
2816
2817
2819
2820
2822
2823
2825
2827
2828
2830
2831
2833
2834
2835 if (construtionPart.
IsBase())
2836 {
2837
2839 }
2840 }
2841
2843 {
2844
2846 }
2847
2848
2849 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2850 {
2853
2854
2856
2857
2859
2860
2862
2863
2865
2867
2868
2870
2871
2873
2874
2875 if (construtionPart.
IsBase())
2876 {
2877
2879 }
2880 }
2881
2883 {
2884
2886 }
2887
2888
2890 {
2892
2895 }
2896
2898 {
2900
2902 {
2904 }
2905 else
2906 {
2908 }
2909
2911 }
2912
2914 {
2916
2918 foreach (
string slotName : attachmentSlots)
2919 {
2921 }
2922
2923
2926 else
2928
2930 }
2931
2933 {
2934 string slotNameMounted = slot_name + "_Mounted";
2935 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2936
2937 if (attachment)
2938 {
2939 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2940 if (barbedWire && barbedWire.IsMounted())
2942 else
2944
2945 if (is_locked)
2946 {
2947 SetAnimationPhase(slotNameMounted, 0);
2948 SetAnimationPhase(slot_name, 1);
2949 }
2950 else
2951 {
2952 SetAnimationPhase(slotNameMounted, 1);
2953 SetAnimationPhase(slot_name, 0);
2954 }
2955 }
2956 else
2957 {
2958 SetAnimationPhase(slotNameMounted, 1);
2959 SetAnimationPhase(slot_name, 1);
2960
2962 }
2963 }
2964
2965
2967 {
2970
2973
2976
2977 foreach (
string slotName : attachmentSlots)
2978 {
2980 }
2981
2982
2984 {
2987
2989 }
2990 else
2991 {
2994
2996 }
2997
3000 }
3001
3003 {
3004
3006 return;
3007
3008 string slot_name_mounted = slot_name + "_Mounted";
3009 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3010
3011
3013 RemoveProxyPhysics( slot_name_mounted );
3014 RemoveProxyPhysics( slot_name );
3015
3016 if ( attachment )
3017 {
3019 if ( is_locked )
3020 {
3022 AddProxyPhysics( slot_name_mounted );
3023 }
3024 else
3025 {
3027 AddProxyPhysics( slot_name );
3028 }
3029 }
3030 }
3031
3033 {
3034 SetAffectPathgraph( true, false );
3036 }
3037
3039 {
3040 return true;
3041 }
3042
3044 {
3045 return true;
3046 }
3047
3049 {
3050 if ( attachment )
3051 {
3053 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3054
3055 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3056 }
3057
3058 return false;
3059 }
3060
3062 {
3064 }
3065
3066
3068 {
3069 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3070 if (
g_Game.ConfigIsExisting( config_path ) )
3071 {
3072 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3073 }
3074 }
3075
3077 {
3078 return true;
3079 }
3080
3082 {
3083 return true;
3084 }
3085
3087 {
3088 return true;
3089 }
3090
3091
3093 {
3096 }
3097
3099 {
3101 }
3102
3104 {
3106 }
3107
3109 {
3110 int attachment_count = GetInventory().AttachmentCount();
3111 if ( attachment_count > 0 )
3112 {
3113 if (
HasBase() && attachment_count == 1 )
3114 {
3115 return false;
3116 }
3117
3118 return true;
3119 }
3120
3121 return false;
3122 }
3123
3125 {
3126 return true;
3127 }
3128
3130 {
3131 return false;
3132 }
3133
3134
3136 {
3137 return false;
3138 }
3139
3141 {
3142 return false;
3143 }
3144
3145
3147 {
3148 return false;
3149 }
3150
3151
3152
3154 {
3155 return true;
3156 }
3157
3159 {
3160 return true;
3161 }
3162
3165 {
3166 return false;
3167 }
3168
3169
3171 {
3172 return false;
3173 }
3174
3175
3177 {
3178 return true;
3179 }
3180
3181
3183 {
3184 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3185 {
3186 return false;
3187 }
3188
3189 return true;
3190 }
3191
3193 {
3196
3197 return item;
3198 }
3199
3200
3202 {
3204 {
3205
3207
3208
3211
3213 if ( MemoryPointExists( slot_name + "_min" ) )
3214 {
3215 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3216 }
3217 if ( MemoryPointExists( slot_name + "_max" ) )
3218 {
3219 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3220 }
3221
3222
3225
3226
3229 center = ModelToWorld( center );
3230
3231
3234
3235 areaDamage.SetExtents( extents[0], extents[1] );
3236 areaDamage.SetAreaPosition( center );
3240 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3241 areaDamage.SetAmmoName( "BarbedWireHit" );
3242 areaDamage.Spawn();
3243
3245 }
3246 }
3247
3249 {
3250 if ( angle_deg != 0 )
3251 {
3252
3254
3255
3257 if ( MemoryPointExists( "rotate_axis" ) )
3258 {
3259 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3260 }
3261 float r_center_x = (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) - (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[0];
3262 float r_center_z = (
Math.
Sin( angle_deg *
Math.
DEG2RAD ) * ( center[0] - rotate_axis[0] ) ) + (
Math.
Cos( angle_deg *
Math.
DEG2RAD ) * ( center[2] - rotate_axis[2] ) ) + rotate_axis[2];
3263 center[0] = r_center_x;
3264 center[2] = r_center_z;
3265 }
3266 }
3267
3269 {
3271 {
3274 {
3275 if (areaDamage)
3276 {
3277 areaDamage.Destroy();
3278 }
3279
3281 }
3282 }
3283 }
3284
3286 {
3287 return true;
3288 }
3289
3290
3291
3292
3294 {
3296 }
3297
3299 {
3301 }
3302
3304 {
3306 }
3307
3309 {
3311
3312 switch ( material_type )
3313 {
3319 }
3320
3321 return "";
3322 }
3323
3325 {
3327
3328 switch ( material_type )
3329 {
3335 }
3336
3337 return "";
3338 }
3339
3340
3342 {
3344 {
3345
3347 {
3348 SetHealth(slot_name,"Health",item.GetHealth());
3349 }
3350 }
3351 }
3352
3354 {
3355 return 111;
3356 }
3357
3359 {
3360 super.SetActions();
3361
3365 }
3366
3368 {
3370 if (!construction)
3371 return;
3372
3374 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3375 {
3378 {
3380 }
3381 }
3382 }
3383
3385 {
3387 if (!construction)
3388 return;
3389
3391 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3392 {
3395 {
3396 construction.HandleEntityFalling(part.
GetPartName());
3397 }
3398 }
3399 }
3400
3403 {
3405 return;
3406
3409
3410 if (DestroyOnFall())
3411 {
3413 {
3415 }
3416 else
3417 {
3419 {
3421 }
3423 }
3424 }
3425 }
3426
3428 {
3429 if (HasAnyAttachmentsOrCargo())
3430 {
3433 }
3434 }
3435
3436
3437
3438
3439
3442 {
3443 return null;
3444 }
3445
3447 {
3449 }
3450
3452 {
3455
3456 Man p;
3457
3458 #ifdef SERVER
3460 g_Game.GetWorld().GetPlayerList(players);
3461 if (players.Count())
3462 p = players[0];
3463 #else
3465 #endif
3466
3468 {
3469 bool excluded = false;
3471 if (excludes)
3472 {
3473 foreach (string exclude : excludes)
3474 {
3476 {
3477 excluded = true;
3478 break;
3479 }
3480 }
3481 }
3482
3483 if (!excluded)
3484 {
3486 }
3487 }
3488
3490 }
3491
3493
3495 [
Obsolete(
"handled in the Construction component directly")]
3497 {
3498 }
3499
3500 [
Obsolete(
"handled in the Construction component directly")]
3502 {
3503 }
3504
3505 [
Obsolete(
"obsolete debug method")]
3507 {
3508 }
3509}
3510
3512{
3513#ifdef BSB_DEBUG
3515#else
3516
3517#endif
3518}
3520{
3521#ifdef BSB_DEBUG_SPAM
3523#else
3524
3525#endif
3526}
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
ref ConstructionBasic m_Construction
void AddAction(typename actionName)
void RemoveAction(typename actionName)
void AreaDamageManager(EntityAI parent)
void OnPartDismantledClient(string part_name, int action_id)
const string ANIMATION_DEPLOYED
override int GetHideIconMask()
override void OnStoreSave(ParamsWriteContext ctx)
void SetActionFromSyncData()
bool CheckMemoryPointVerticalDistance(float max_dist, string selection, PlayerBase player)
override void OnDebugSpawn()
array< string > OnDebugSpawnBuildExcludes()
Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
void DropAttachmentAndCargoItems()
void SoundDestroyStart(string part_name)
const string SOUND_BUILD_WOOD_LOG
void SoundBuildStart(string part_name)
void UpdateAttachmentVisuals(string slot_name, bool is_locked)
void CalcDamageAreaRotation(float angle_deg, out vector center, out vector orientation)
override bool CanObstruct()
bool HasAttachmentsBesidesBase()
override void InitItemSounds()
void RegisterPartForSync(int part_id)
ConstructionBasic CreateConstructionComponent()
const string SOUND_DISMANTLE_METAL
void SetPartsAfterStoreLoad()
void DestroyConstruction()
ref array< string > m_HybridAttachments
override string GetFoldSoundset()
string GetDismantleSoundByMaterial(string part_name)
bool IsAttachmentSlotLocked(EntityAI attachment)
override bool IsFacingPlayer(PlayerBase player, string selection)
void OnPartBuiltClient(string part_name, int action_id)
bool HasProperDistance(string selection, PlayerBase player)
override void OnCreatePhysics()
void OnPartBuiltServer(notnull Man player, string part_name, int action_id)
void RegisterActionForSync(int part_id, int action_id)
const string SOUND_BUILD_WOOD_PLANK
void SetPartsFromSyncData()
ref array< string > m_Mountables
const string SOUND_BUILD_WIRE
void ResetActionSyncData()
override string GetInvulnerabilityTypeString()
void OnPartDismantledServer(notnull Man player, string part_name, int action_id)
void CheckForHybridAttachments(EntityAI item, string slot_name)
override void EEOnAfterLoad()
override void EEItemDetached(EntityAI item, string slot_name)
vector GetKitSpawnPosition()
override void OnItemFallRebuilding()
@Note for modders: This method and is subject to change!
bool CheckSlotVerticalDistance(int slot_id, PlayerBase player)
void GetAttachmentSlots(EntityAI entity, out array< string > attachment_slots)
override bool IsDeployable()
void OnPartDestroyedClient(string part_name, int action_id)
void UnregisterPartForSync(int part_id)
void bsbDebugSpam(string s)
override void OnVariablesSynchronized()
bool PerformRoofCheckForBase(string partName, PlayerBase player, out bool result)
Construction GetConstruction()
void SoundDismantleStart(string part_name)
ConstructionPart GetConstructionPartById(int id)
string GetConstructionKitType()
bool CheckLevelVerticalDistance(float max_dist, string selection, PlayerBase player)
void OnPartDestroyedServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
bool CanFoldBaseBuildingObject()
override int GetDamageSystemVersionChange()
const string SOUND_DISMANTLE_WOOD_PLANK
override void EEItemAttached(EntityAI item, string slot_name)
const string SOUND_DISMANTLE_WOOD_LOG
class BaseBuildingBase extends ItemBase bsbDebugPrint(string s)
const string SOUND_BUILD_WOOD_STAIRS
ItemBase FoldBaseBuildingObject()
override ConstructionBasic GetConstructionBasic()
override bool CanPutInCargo(EntityAI parent)
override bool CanUseConstruction()
override void AfterStoreLoad()
void SetPartFromSyncData(ConstructionPart part)
override void EEHealthLevelChanged(int oldLevel, int newLevel, string zone)
override bool IgnoreOutOfReachCondition()
override bool OnStoreLoad(ParamsReadContext ctx, int version)
override bool ShowZonesHealth()
void UpdateAttachmentPhysics(string slot_name, bool is_locked)
void HandleFallingForConstructedParts()
override bool IsPlayerInside(PlayerBase player, string selection)
string GetBuildSoundByMaterial(string part_name)
ItemBase CreateConstructionKit()
const string SOUND_DISMANTLE_WIRE
bool MustBeBuiltFromOutside()
Some buildings can only be built from outside.
override bool IsTakeable()
float m_ConstructionKitHealth
override void EEDelete(EntityAI parent)
override void SetActions()
void HandleItemFalling(ConstructionPart part)
void DestroyConstructionKit(ItemBase construction_kit)
void CreateConstructionKitInHands(notnull PlayerBase player)
void ItemFall(vector min, vector max)
override bool CanUseConstructionBuild()
void OnSynchronizedClient()
void SynchronizeBaseState()
override bool IsIgnoredByConstruction()
ref map< string, ref AreaDamageManager > m_DamageTriggers
void SetBaseState(bool has_base)
const string SOUND_BUILD_METAL
override string GetLoopFoldSoundset()
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
override bool CanPutIntoHands(EntityAI parent)
bool IsPartBuildInSyncData(int part_id)
override bool CanRemoveFromCargo(EntityAI parent)
void DestroyConstructedParts()
const string SOUND_DISMANTLE_WOOD_STAIRS
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
ConstructionMaterialType
used to guide action sound selection, mostly. Could be also used for particles and stuff,...
string GetLoopFoldSoundset()
ItemSoundHandler GetItemSoundHandler()
bool m_FixDamageSystemInit
void ItemSoundHandler(ItemBase parent)
override void SetLoopInterval(float time)
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
static bool GetDisableRefundMaterialsOnFall()
static bool GetDisableDropAttachmentsOnFall()
static bool GetDisableItemFalling()
override void DestroyPartServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
just declared for module 3 use
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
Wrapper class for managing sound through SEffectManager.
proto native int GetSlot()
returns slot id if current type is Attachment
static proto native int GetSlotIdFromString(string slot_name)
converts string to slot_id
static proto native owned string GetSlotName(int id)
converts slot_id to string
provides access to slot configuration
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
void Obsolete(string msg="")
static proto float Cos(float angle)
Returns cosinus of angle in radians.
static proto float Sin(float angle)
Returns sinus of angle in radians.
static const float DEG2RAD
vector GetPosition()
Get the world position of the Effect.
bool Contains(string sample)
Returns true if sample is substring of string.