2216{
2218
2220
2222
2229
2230
2231
2237
2243
2245
2249
2250
2252 {
2254
2255
2256 RegisterNetSyncVariableInt( "m_SyncParts01" );
2257 RegisterNetSyncVariableInt( "m_SyncParts02" );
2258 RegisterNetSyncVariableInt( "m_SyncParts03" );
2259 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2260 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2261 RegisterNetSyncVariableBool( "m_HasBase" );
2262
2263
2264 ConstructionInit();
2265
2266 if (ConfigIsExisting("hybridAttachments"))
2267 {
2270 }
2271 if (ConfigIsExisting("mountables"))
2272 {
2275 }
2276
2278 SetAllowDamage(true);
2279 }
2280
2282 {
2283 return "disableBaseDamage";
2284 }
2285
2287 {
2288 return true;
2289 }
2290
2292 {
2293 return EInventoryIconVisibility.HIDE_VICINITY;
2294 }
2295
2297 {
2298 super.InitItemSounds();
2299
2303
2308 }
2309
2311 {
2312 return "putDown_FenceKit_SoundSet";
2313 }
2314
2316 {
2317 return "Shelter_Site_Build_Loop_SoundSet";
2318 }
2319
2320
2322 {
2324 {
2325 SetSynchDirty();
2326 }
2327 }
2328
2330 {
2332 super.OnVariablesSynchronized();
2333
2335 }
2336
2338 {
2339
2341
2342
2344
2345
2347 }
2348
2349
2351 {
2352
2353 int offset;
2354 int mask;
2355
2356 if ( part_id >= 1 && part_id <= 31 )
2357 {
2358 offset = part_id - 1;
2359 mask = 1 << offset;
2360
2362 }
2363 else if ( part_id >= 32 && part_id <= 62 )
2364 {
2365 offset = ( part_id % 32 );
2366 mask = 1 << offset;
2367
2369 }
2370 else if ( part_id >= 63 && part_id <= 93 )
2371 {
2372 offset = ( part_id % 63 );
2373 mask = 1 << offset;
2374
2376 }
2377 }
2378
2380 {
2381
2382 int offset;
2383 int mask;
2384
2385 if ( part_id >= 1 && part_id <= 31 )
2386 {
2387 offset = part_id - 1;
2388 mask = 1 << offset;
2389
2391 }
2392 else if ( part_id >= 32 && part_id <= 62 )
2393 {
2394 offset = ( part_id % 32 );
2395 mask = 1 << offset;
2396
2398 }
2399 else if ( part_id >= 63 && part_id <= 93 )
2400 {
2401 offset = ( part_id % 63 );
2402 mask = 1 << offset;
2403
2405 }
2406 }
2407
2409 {
2410
2411 int offset;
2412 int mask;
2413
2414 if ( part_id >= 1 && part_id <= 31 )
2415 {
2416 offset = part_id - 1;
2417 mask = 1 << offset;
2418
2420 {
2421 return true;
2422 }
2423 }
2424 else if ( part_id >= 32 && part_id <= 62 )
2425 {
2426 offset = ( part_id % 32 );
2427 mask = 1 << offset;
2428
2430 {
2431 return true;
2432 }
2433 }
2434 else if ( part_id >= 63 && part_id <= 93 )
2435 {
2436 offset = ( part_id % 63 );
2437 mask = 1 << offset;
2438
2440 {
2441 return true;
2442 }
2443 }
2444
2445 return false;
2446 }
2447
2449 {
2452 }
2453
2455 {
2456
2459 }
2460
2462 {
2464 {
2467
2468 switch( build_action_id )
2469 {
2473 }
2474 }
2475 }
2476
2477
2479 {
2481 bool is_base = part.
IsBase();
2484 if ( is_part_built_sync )
2485 {
2487 {
2491
2492 if (is_base)
2493 {
2496 }
2497 }
2498 }
2499 else
2500 {
2502 {
2506
2507 if (is_base)
2508 {
2511 }
2512 }
2513 }
2514
2515
2517 }
2518
2519
2521 {
2524
2525 for ( int i = 0; i < construction_parts.Count(); ++i )
2526 {
2527 string key = construction_parts.GetKey( i );
2530 }
2531
2532
2534 }
2535
2537 {
2540
2541 for ( int i = 0; i < construction_parts.Count(); ++i )
2542 {
2543 string key = construction_parts.GetKey( i );
2545
2546 if ( value.
GetId() ==
id )
2547 {
2548 return value;
2549 }
2550 }
2551
2552 return NULL;
2553 }
2554
2555
2556
2558 {
2560 }
2561
2563 {
2565 }
2566
2568 {
2569 return true;
2570 }
2571
2573 {
2574 return false;
2575 }
2576
2577
2579 {
2582 {
2584 }
2585
2586 return construction_kit;
2587 }
2588
2590 {
2593 {
2595 }
2596 }
2597
2599 {
2601 }
2602
2604 {
2605 return "";
2606 }
2607
2609 {
2611 g_Game.ObjectDelete( construction_kit );
2612 }
2613
2614
2616 {
2618 g_Game.ObjectDelete(
this );
2619 }
2620
2621
2623 {
2624 super.EEDelete(parent);
2625
2627 {
2628 areaDamage.Destroy();
2629 }
2630
2631 }
2632
2634 {
2635 super.OnStoreSave( ctx );
2636
2637
2641
2643 }
2644
2646 {
2647 if ( !super.OnStoreLoad( ctx, version ) )
2648 return false;
2649
2650
2651
2653 {
2655 return false;
2656 }
2658 {
2660 return false;
2661 }
2663 {
2665 return false;
2666 }
2667
2668
2670 {
2672 return false;
2673 }
2674
2675
2676 return true;
2677 }
2678
2680 {
2681 super.AfterStoreLoad();
2682
2684 {
2686 }
2687 }
2688
2690 {
2691
2693
2694
2697
2698
2700 }
2701
2703 {
2704 super.OnCreatePhysics();
2705
2706 ConstructionInit();
2708 }
2709
2711 {
2713 return;
2714
2715 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2716 }
2717
2719 {
2721 {
2723 }
2724
2725 super.EEOnAfterLoad();
2726 }
2727
2729 {
2730 super.EEItemAttached( item, slot_name );
2731
2735 }
2736
2738 {
2739 super.EEItemDetached( item, slot_name );
2740
2743 }
2744
2745 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2746 {
2749
2752 }
2753
2754
2756 {
2757 return true;
2758 }
2759
2760
2761
2763 {
2765
2766
2767 if (construtionPart.
IsBase())
2768 {
2770
2771
2773 }
2774
2775
2777
2778
2780
2781
2783
2785
2787
2788
2790
2791
2793 }
2794
2796 {
2797
2799 }
2800
2801
2803 {
2806
2807
2809
2810
2812
2813
2815
2816
2818
2820
2821
2823
2824
2826
2827
2828 if (construtionPart.
IsBase())
2829 {
2830
2832 }
2833 }
2834
2836 {
2837
2839 }
2840
2841
2842 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2843 {
2846
2847
2849
2850
2852
2853
2855
2856
2858
2860
2861
2863
2864
2866
2867
2868 if (construtionPart.
IsBase())
2869 {
2870
2872 }
2873 }
2874
2876 {
2877
2879 }
2880
2881
2883 {
2885
2888 }
2889
2891 {
2893
2895 {
2897 }
2898 else
2899 {
2901 }
2902
2904 }
2905
2907 {
2909
2911 foreach (
string slotName : attachmentSlots)
2912 {
2914 }
2915
2916
2919 else
2921
2923 }
2924
2926 {
2927 string slotNameMounted = slot_name + "_Mounted";
2928 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2929
2930 if (attachment)
2931 {
2932 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2933 if (barbedWire && barbedWire.IsMounted())
2935 else
2937
2938 if (is_locked)
2939 {
2940 SetAnimationPhase(slotNameMounted, 0);
2941 SetAnimationPhase(slot_name, 1);
2942 }
2943 else
2944 {
2945 SetAnimationPhase(slotNameMounted, 1);
2946 SetAnimationPhase(slot_name, 0);
2947 }
2948 }
2949 else
2950 {
2951 SetAnimationPhase(slotNameMounted, 1);
2952 SetAnimationPhase(slot_name, 1);
2953
2955 }
2956 }
2957
2958
2960 {
2963
2966
2969
2970 foreach (
string slotName : attachmentSlots)
2971 {
2973 }
2974
2975
2977 {
2980
2982 }
2983 else
2984 {
2987
2989 }
2990
2993 }
2994
2996 {
2997
2999 return;
3000
3001 string slot_name_mounted = slot_name + "_Mounted";
3002 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3003
3004
3006 RemoveProxyPhysics( slot_name_mounted );
3007 RemoveProxyPhysics( slot_name );
3008
3009 if ( attachment )
3010 {
3012 if ( is_locked )
3013 {
3015 AddProxyPhysics( slot_name_mounted );
3016 }
3017 else
3018 {
3020 AddProxyPhysics( slot_name );
3021 }
3022 }
3023 }
3024
3026 {
3027 SetAffectPathgraph( true, false );
3029 }
3030
3032 {
3033 return true;
3034 }
3035
3037 {
3038 return true;
3039 }
3040
3042 {
3043 if ( attachment )
3044 {
3046 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3047
3048 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3049 }
3050
3051 return false;
3052 }
3053
3055 {
3057 }
3058
3059
3061 {
3062 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3063 if (
g_Game.ConfigIsExisting( config_path ) )
3064 {
3065 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3066 }
3067 }
3068
3070 {
3071 return true;
3072 }
3073
3075 {
3076 return true;
3077 }
3078
3080 {
3081 return true;
3082 }
3083
3084
3086 {
3089 }
3090
3092 {
3094 }
3095
3097 {
3099 }
3100
3102 {
3103 int attachment_count = GetInventory().AttachmentCount();
3104 if ( attachment_count > 0 )
3105 {
3106 if (
HasBase() && attachment_count == 1 )
3107 {
3108 return false;
3109 }
3110
3111 return true;
3112 }
3113
3114 return false;
3115 }
3116
3118 {
3119 return true;
3120 }
3121
3123 {
3124 return false;
3125 }
3126
3127
3129 {
3130 return false;
3131 }
3132
3134 {
3135 return false;
3136 }
3137
3138
3140 {
3141 return false;
3142 }
3143
3144
3145
3147 {
3148 return true;
3149 }
3150
3152 {
3153 return true;
3154 }
3155
3158 {
3159 return false;
3160 }
3161
3162
3164 {
3165 return false;
3166 }
3167
3168
3170 {
3171 return true;
3172 }
3173
3174
3176 {
3177 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3178 {
3179 return false;
3180 }
3181
3182 return true;
3183 }
3184
3186 {
3189
3190 return item;
3191 }
3192
3193
3195 {
3197 {
3198
3200
3201
3204
3206 if ( MemoryPointExists( slot_name + "_min" ) )
3207 {
3208 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3209 }
3210 if ( MemoryPointExists( slot_name + "_max" ) )
3211 {
3212 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3213 }
3214
3215
3218
3219
3222 center = ModelToWorld( center );
3223
3224
3227
3228 areaDamage.SetExtents( extents[0], extents[1] );
3229 areaDamage.SetAreaPosition( center );
3233 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3234 areaDamage.SetAmmoName( "BarbedWireHit" );
3235 areaDamage.Spawn();
3236
3238 }
3239 }
3240
3242 {
3243 if ( angle_deg != 0 )
3244 {
3245
3247
3248
3250 if ( MemoryPointExists( "rotate_axis" ) )
3251 {
3252 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3253 }
3254 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];
3255 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];
3256 center[0] = r_center_x;
3257 center[2] = r_center_z;
3258 }
3259 }
3260
3262 {
3264 {
3267 {
3268 if (areaDamage)
3269 {
3270 areaDamage.Destroy();
3271 }
3272
3274 }
3275 }
3276 }
3277
3279 {
3280 return true;
3281 }
3282
3283
3284
3285
3287 {
3289 }
3290
3292 {
3294 }
3295
3297 {
3299 }
3300
3302 {
3304
3305 switch ( material_type )
3306 {
3312 }
3313
3314 return "";
3315 }
3316
3318 {
3320
3321 switch ( material_type )
3322 {
3328 }
3329
3330 return "";
3331 }
3332
3333
3335 {
3337 {
3338
3340 {
3341 SetHealth(slot_name,"Health",item.GetHealth());
3342 }
3343 }
3344 }
3345
3347 {
3348 return 111;
3349 }
3350
3352 {
3353 super.SetActions();
3354
3358 }
3359
3361 {
3363 if (!construction)
3364 return;
3365
3367 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3368 {
3371 {
3373 }
3374 }
3375 }
3376
3378 {
3380 if (!construction)
3381 return;
3382
3384 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3385 {
3388 {
3389 construction.HandleEntityFalling(part.
GetPartName());
3390 }
3391 }
3392 }
3393
3396 {
3398 return;
3399
3402
3403 if (DestroyOnFall())
3404 {
3406 {
3408 }
3409 else
3410 {
3412 {
3414 }
3416 }
3417 }
3418 }
3419
3421 {
3422 if (HasAnyAttachmentsOrCargo())
3423 {
3426 }
3427 }
3428
3429
3430
3431
3432
3435 {
3436 return null;
3437 }
3438
3440 {
3442 }
3443
3445 {
3448
3449 Man p;
3450
3451 #ifdef SERVER
3453 g_Game.GetWorld().GetPlayerList(players);
3454 if (players.Count())
3455 p = players[0];
3456 #else
3458 #endif
3459
3461 {
3462 bool excluded = false;
3464 if (excludes)
3465 {
3466 foreach (string exclude : excludes)
3467 {
3469 {
3470 excluded = true;
3471 break;
3472 }
3473 }
3474 }
3475
3476 if (!excluded)
3477 {
3479 }
3480 }
3481
3483 }
3484
3486
3488 [
Obsolete(
"handled in the Construction component directly")]
3490 {
3491 }
3492
3493 [
Obsolete(
"handled in the Construction component directly")]
3495 {
3496 }
3497
3498 [
Obsolete(
"obsolete debug method")]
3500 {
3501 }
3502}
3503
3505{
3506#ifdef BSB_DEBUG
3508#else
3509
3510#endif
3511}
3513{
3514#ifdef BSB_DEBUG_SPAM
3516#else
3517
3518#endif
3519}
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.