2228{
2230
2232
2234
2241
2242
2243
2249
2255
2257
2261
2262
2264 {
2266
2267
2268 RegisterNetSyncVariableInt( "m_SyncParts01" );
2269 RegisterNetSyncVariableInt( "m_SyncParts02" );
2270 RegisterNetSyncVariableInt( "m_SyncParts03" );
2271 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2272 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2273 RegisterNetSyncVariableBool( "m_HasBase" );
2274
2275
2276 ConstructionInit();
2277
2278 if (ConfigIsExisting("hybridAttachments"))
2279 {
2282 }
2283 if (ConfigIsExisting("mountables"))
2284 {
2287 }
2288
2290 SetAllowDamage(true);
2291 }
2292
2294 {
2295 return "disableBaseDamage";
2296 }
2297
2299 {
2300 return true;
2301 }
2302
2304 {
2305 return EInventoryIconVisibility.HIDE_VICINITY;
2306 }
2307
2309 {
2310 super.InitItemSounds();
2311
2315
2320 }
2321
2323 {
2324 return "putDown_FenceKit_SoundSet";
2325 }
2326
2328 {
2329 return "Shelter_Site_Build_Loop_SoundSet";
2330 }
2331
2332
2334 {
2336 {
2337 SetSynchDirty();
2338 }
2339 }
2340
2342 {
2344 super.OnVariablesSynchronized();
2345
2347 }
2348
2350 {
2351
2353
2354
2356
2357
2359 }
2360
2361
2363 {
2364
2365 int offset;
2366 int mask;
2367
2368 if ( part_id >= 1 && part_id <= 31 )
2369 {
2370 offset = part_id - 1;
2371 mask = 1 << offset;
2372
2374 }
2375 else if ( part_id >= 32 && part_id <= 62 )
2376 {
2377 offset = ( part_id % 32 );
2378 mask = 1 << offset;
2379
2381 }
2382 else if ( part_id >= 63 && part_id <= 93 )
2383 {
2384 offset = ( part_id % 63 );
2385 mask = 1 << offset;
2386
2388 }
2389 }
2390
2392 {
2393
2394 int offset;
2395 int mask;
2396
2397 if ( part_id >= 1 && part_id <= 31 )
2398 {
2399 offset = part_id - 1;
2400 mask = 1 << offset;
2401
2403 }
2404 else if ( part_id >= 32 && part_id <= 62 )
2405 {
2406 offset = ( part_id % 32 );
2407 mask = 1 << offset;
2408
2410 }
2411 else if ( part_id >= 63 && part_id <= 93 )
2412 {
2413 offset = ( part_id % 63 );
2414 mask = 1 << offset;
2415
2417 }
2418 }
2419
2421 {
2422
2423 int offset;
2424 int mask;
2425
2426 if ( part_id >= 1 && part_id <= 31 )
2427 {
2428 offset = part_id - 1;
2429 mask = 1 << offset;
2430
2432 {
2433 return true;
2434 }
2435 }
2436 else if ( part_id >= 32 && part_id <= 62 )
2437 {
2438 offset = ( part_id % 32 );
2439 mask = 1 << offset;
2440
2442 {
2443 return true;
2444 }
2445 }
2446 else if ( part_id >= 63 && part_id <= 93 )
2447 {
2448 offset = ( part_id % 63 );
2449 mask = 1 << offset;
2450
2452 {
2453 return true;
2454 }
2455 }
2456
2457 return false;
2458 }
2459
2461 {
2464 }
2465
2467 {
2468
2471 }
2472
2474 {
2476 {
2479
2480 switch( build_action_id )
2481 {
2485 }
2486 }
2487 }
2488
2489
2491 {
2493 bool is_base = part.
IsBase();
2496 if ( is_part_built_sync )
2497 {
2499 {
2503
2504 if (is_base)
2505 {
2508 }
2509 }
2510 }
2511 else
2512 {
2514 {
2518
2519 if (is_base)
2520 {
2523 }
2524 }
2525 }
2526
2527
2529 }
2530
2531
2533 {
2536
2537 for ( int i = 0; i < construction_parts.Count(); ++i )
2538 {
2539 string key = construction_parts.GetKey( i );
2542 }
2543
2544
2546 }
2547
2549 {
2552
2553 for ( int i = 0; i < construction_parts.Count(); ++i )
2554 {
2555 string key = construction_parts.GetKey( i );
2557
2558 if ( value.
GetId() ==
id )
2559 {
2560 return value;
2561 }
2562 }
2563
2564 return NULL;
2565 }
2566
2567
2568
2570 {
2572 }
2573
2575 {
2577 }
2578
2580 {
2581 return true;
2582 }
2583
2585 {
2586 return false;
2587 }
2588
2589
2591 {
2594 {
2596 }
2597
2598 return construction_kit;
2599 }
2600
2602 {
2605 {
2607 }
2608 }
2609
2611 {
2613 }
2614
2616 {
2617 return "";
2618 }
2619
2621 {
2623 g_Game.ObjectDelete( construction_kit );
2624 }
2625
2626
2628 {
2630 g_Game.ObjectDelete(
this );
2631 }
2632
2633
2635 {
2636 super.EEDelete(parent);
2637
2639 {
2640 areaDamage.Destroy();
2641 }
2642
2643 }
2644
2646 {
2647 super.OnStoreSave( ctx );
2648
2649
2653
2655 }
2656
2658 {
2659 if ( !super.OnStoreLoad( ctx, version ) )
2660 return false;
2661
2662
2663
2665 {
2667 return false;
2668 }
2670 {
2672 return false;
2673 }
2675 {
2677 return false;
2678 }
2679
2680
2682 {
2684 return false;
2685 }
2686
2687
2688 return true;
2689 }
2690
2692 {
2693 super.AfterStoreLoad();
2694
2696 {
2698 }
2699 }
2700
2702 {
2703
2705
2706
2709
2710
2712 }
2713
2715 {
2716 super.OnCreatePhysics();
2717
2718 ConstructionInit();
2720 }
2721
2723 {
2725 return;
2726
2727 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2728 }
2729
2731 {
2733 {
2735 }
2736
2737 super.EEOnAfterLoad();
2738 }
2739
2741 {
2742 super.EEItemAttached( item, slot_name );
2743
2747 }
2748
2750 {
2751 super.EEItemDetached( item, slot_name );
2752
2755 }
2756
2757 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2758 {
2761
2764 }
2765
2766
2768 {
2769 return true;
2770 }
2771
2772
2773
2775 {
2777
2778
2779 if (construtionPart.
IsBase())
2780 {
2782
2783
2785 }
2786
2787
2789
2790
2792
2793
2795
2797
2799
2800
2802
2803
2805 }
2806
2808 {
2809
2811 }
2812
2813
2815 {
2818
2819
2821
2822
2824
2825
2827
2828
2830
2832
2833
2835
2836
2838
2839
2840 if (construtionPart.
IsBase())
2841 {
2842
2844 }
2845 }
2846
2848 {
2849
2851 }
2852
2853
2854 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2855 {
2858
2859
2861
2862
2864
2865
2867
2868
2870
2872
2873
2875
2876
2878
2879
2880 if (construtionPart.
IsBase())
2881 {
2882
2884 }
2885 }
2886
2888 {
2889
2891 }
2892
2893
2895 {
2897
2900 }
2901
2903 {
2905
2907 {
2909 }
2910 else
2911 {
2913 }
2914
2916 }
2917
2919 {
2921
2923 foreach (
string slotName : attachmentSlots)
2924 {
2926 }
2927
2928
2931 else
2933
2935 }
2936
2938 {
2939 string slotNameMounted = slot_name + "_Mounted";
2940 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2941
2942 if (attachment)
2943 {
2944 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2945 if (barbedWire && barbedWire.IsMounted())
2947 else
2949
2950 if (is_locked)
2951 {
2952 SetAnimationPhase(slotNameMounted, 0);
2953 SetAnimationPhase(slot_name, 1);
2954 }
2955 else
2956 {
2957 SetAnimationPhase(slotNameMounted, 1);
2958 SetAnimationPhase(slot_name, 0);
2959 }
2960 }
2961 else
2962 {
2963 SetAnimationPhase(slotNameMounted, 1);
2964 SetAnimationPhase(slot_name, 1);
2965
2967 }
2968 }
2969
2970
2972 {
2975
2978
2981
2982 foreach (
string slotName : attachmentSlots)
2983 {
2985 }
2986
2987
2989 {
2992
2994 }
2995 else
2996 {
2999
3001 }
3002
3005 }
3006
3008 {
3009
3011 return;
3012
3013 string slot_name_mounted = slot_name + "_Mounted";
3014 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3015
3016
3018 RemoveProxyPhysics( slot_name_mounted );
3019 RemoveProxyPhysics( slot_name );
3020
3021 if ( attachment )
3022 {
3024 if ( is_locked )
3025 {
3027 AddProxyPhysics( slot_name_mounted );
3028 }
3029 else
3030 {
3032 AddProxyPhysics( slot_name );
3033 }
3034 }
3035 }
3036
3038 {
3039 SetAffectPathgraph( true, false );
3041 }
3042
3044 {
3045 return true;
3046 }
3047
3049 {
3050 return true;
3051 }
3052
3054 {
3055 if ( attachment )
3056 {
3058 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3059
3060 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3061 }
3062
3063 return false;
3064 }
3065
3067 {
3069 }
3070
3071
3073 {
3074 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3075 if (
g_Game.ConfigIsExisting( config_path ) )
3076 {
3077 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3078 }
3079 }
3080
3082 {
3083 return true;
3084 }
3085
3087 {
3088 return true;
3089 }
3090
3092 {
3093 return true;
3094 }
3095
3096
3098 {
3101 }
3102
3104 {
3106 }
3107
3109 {
3111 }
3112
3114 {
3115 int attachment_count = GetInventory().AttachmentCount();
3116 if ( attachment_count > 0 )
3117 {
3118 if (
HasBase() && attachment_count == 1 )
3119 {
3120 return false;
3121 }
3122
3123 return true;
3124 }
3125
3126 return false;
3127 }
3128
3130 {
3131 return true;
3132 }
3133
3135 {
3136 return false;
3137 }
3138
3139
3141 {
3142 return false;
3143 }
3144
3146 {
3147 return false;
3148 }
3149
3150
3152 {
3153 return false;
3154 }
3155
3156
3157
3159 {
3160 return true;
3161 }
3162
3164 {
3165 return true;
3166 }
3167
3170 {
3171 return false;
3172 }
3173
3174
3176 {
3177 return false;
3178 }
3179
3180
3182 {
3183 return true;
3184 }
3185
3186
3188 {
3189 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3190 {
3191 return false;
3192 }
3193
3194 return true;
3195 }
3196
3198 {
3201
3202 return item;
3203 }
3204
3205
3207 {
3209 {
3210
3212
3213
3216
3218 if ( MemoryPointExists( slot_name + "_min" ) )
3219 {
3220 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3221 }
3222 if ( MemoryPointExists( slot_name + "_max" ) )
3223 {
3224 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3225 }
3226
3227
3230
3231
3234 center = ModelToWorld( center );
3235
3236
3239
3240 areaDamage.SetExtents( extents[0], extents[1] );
3241 areaDamage.SetAreaPosition( center );
3245 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3246 areaDamage.SetAmmoName( "BarbedWireHit" );
3247 areaDamage.Spawn();
3248
3250 }
3251 }
3252
3254 {
3255 if ( angle_deg != 0 )
3256 {
3257
3259
3260
3262 if ( MemoryPointExists( "rotate_axis" ) )
3263 {
3264 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3265 }
3266 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];
3267 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];
3268 center[0] = r_center_x;
3269 center[2] = r_center_z;
3270 }
3271 }
3272
3274 {
3276 {
3279 {
3280 if (areaDamage)
3281 {
3282 areaDamage.Destroy();
3283 }
3284
3286 }
3287 }
3288 }
3289
3291 {
3292 return true;
3293 }
3294
3295
3296
3297
3299 {
3301 }
3302
3304 {
3306 }
3307
3309 {
3311 }
3312
3314 {
3316
3317 switch ( material_type )
3318 {
3324 }
3325
3326 return "";
3327 }
3328
3330 {
3332
3333 switch ( material_type )
3334 {
3340 }
3341
3342 return "";
3343 }
3344
3345
3347 {
3349 {
3350
3352 {
3353 SetHealth(slot_name,"Health",item.GetHealth());
3354 }
3355 }
3356 }
3357
3359 {
3360 return 111;
3361 }
3362
3364 {
3365 super.SetActions();
3366
3370 }
3371
3373 {
3375 if (!construction)
3376 return;
3377
3379 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3380 {
3383 {
3385 }
3386 }
3387 }
3388
3390 {
3392 if (!construction)
3393 return;
3394
3396 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3397 {
3400 {
3401 construction.HandleEntityFalling(part.
GetPartName());
3402 }
3403 }
3404 }
3405
3408 {
3410 return;
3411
3414
3415 if (DestroyOnFall())
3416 {
3418 {
3420 }
3421 else
3422 {
3424 {
3426 }
3428 }
3429 }
3430 }
3431
3433 {
3434 if (HasAnyAttachmentsOrCargo())
3435 {
3438 }
3439 }
3440
3441
3442
3443
3444
3447 {
3448 return null;
3449 }
3450
3452 {
3454 }
3455
3457 {
3460
3461 Man p;
3462
3463 #ifdef SERVER
3465 g_Game.GetWorld().GetPlayerList(players);
3466 if (players.Count())
3467 p = players[0];
3468 #else
3470 #endif
3471
3473 {
3474 bool excluded = false;
3476 if (excludes)
3477 {
3478 foreach (string exclude : excludes)
3479 {
3481 {
3482 excluded = true;
3483 break;
3484 }
3485 }
3486 }
3487
3488 if (!excluded)
3489 {
3491 }
3492 }
3493
3495 }
3496
3498
3500 [
Obsolete(
"handled in the Construction component directly")]
3502 {
3503 }
3504
3505 [
Obsolete(
"handled in the Construction component directly")]
3507 {
3508 }
3509
3510 [
Obsolete(
"obsolete debug method")]
3512 {
3513 }
3514}
3515
3517{
3518#ifdef BSB_DEBUG
3520#else
3521
3522#endif
3523}
3525{
3526#ifdef BSB_DEBUG_SPAM
3528#else
3529
3530#endif
3531}
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.