2338{
2340
2342
2344
2351
2352
2353
2359
2365
2367
2371
2372
2374 {
2376
2377
2378 RegisterNetSyncVariableInt( "m_SyncParts01" );
2379 RegisterNetSyncVariableInt( "m_SyncParts02" );
2380 RegisterNetSyncVariableInt( "m_SyncParts03" );
2381 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2382 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2383 RegisterNetSyncVariableBool( "m_HasBase" );
2384
2385
2386 ConstructionInit();
2387
2388 if (ConfigIsExisting("hybridAttachments"))
2389 {
2392 }
2393 if (ConfigIsExisting("mountables"))
2394 {
2397 }
2398
2400 SetAllowDamage(true);
2401 }
2402
2404 {
2405 return "disableBaseDamage";
2406 }
2407
2409 {
2410 return true;
2411 }
2412
2414 {
2415 return EInventoryIconVisibility.HIDE_VICINITY;
2416 }
2417
2419 {
2420 super.InitItemSounds();
2421
2425
2430 }
2431
2433 {
2434 return "putDown_FenceKit_SoundSet";
2435 }
2436
2438 {
2439 return "Shelter_Site_Build_Loop_SoundSet";
2440 }
2441
2442
2444 {
2446 {
2447 SetSynchDirty();
2448 }
2449 }
2450
2452 {
2454 super.OnVariablesSynchronized();
2455
2457 }
2458
2460 {
2461
2463
2464
2466
2467
2469 }
2470
2471
2473 {
2474
2475 int offset;
2476 int mask;
2477
2478 if ( part_id >= 1 && part_id <= 31 )
2479 {
2480 offset = part_id - 1;
2481 mask = 1 << offset;
2482
2484 }
2485 else if ( part_id >= 32 && part_id <= 62 )
2486 {
2487 offset = ( part_id % 32 );
2488 mask = 1 << offset;
2489
2491 }
2492 else if ( part_id >= 63 && part_id <= 93 )
2493 {
2494 offset = ( part_id % 63 );
2495 mask = 1 << offset;
2496
2498 }
2499 }
2500
2502 {
2503
2504 int offset;
2505 int mask;
2506
2507 if ( part_id >= 1 && part_id <= 31 )
2508 {
2509 offset = part_id - 1;
2510 mask = 1 << offset;
2511
2513 }
2514 else if ( part_id >= 32 && part_id <= 62 )
2515 {
2516 offset = ( part_id % 32 );
2517 mask = 1 << offset;
2518
2520 }
2521 else if ( part_id >= 63 && part_id <= 93 )
2522 {
2523 offset = ( part_id % 63 );
2524 mask = 1 << offset;
2525
2527 }
2528 }
2529
2531 {
2532
2533 int offset;
2534 int mask;
2535
2536 if ( part_id >= 1 && part_id <= 31 )
2537 {
2538 offset = part_id - 1;
2539 mask = 1 << offset;
2540
2542 {
2543 return true;
2544 }
2545 }
2546 else if ( part_id >= 32 && part_id <= 62 )
2547 {
2548 offset = ( part_id % 32 );
2549 mask = 1 << offset;
2550
2552 {
2553 return true;
2554 }
2555 }
2556 else if ( part_id >= 63 && part_id <= 93 )
2557 {
2558 offset = ( part_id % 63 );
2559 mask = 1 << offset;
2560
2562 {
2563 return true;
2564 }
2565 }
2566
2567 return false;
2568 }
2569
2571 {
2574 }
2575
2577 {
2578
2581 }
2582
2584 {
2586 {
2589
2590 switch( build_action_id )
2591 {
2595 }
2596 }
2597 }
2598
2599
2601 {
2603 bool is_base = part.
IsBase();
2606 if ( is_part_built_sync )
2607 {
2609 {
2613
2614 if (is_base)
2615 {
2618 }
2619 }
2620 }
2621 else
2622 {
2624 {
2628
2629 if (is_base)
2630 {
2633 }
2634 }
2635 }
2636
2637
2639 }
2640
2641
2643 {
2646
2647 for ( int i = 0; i < construction_parts.Count(); ++i )
2648 {
2649 string key = construction_parts.GetKey( i );
2652 }
2653
2654
2656 }
2657
2659 {
2662
2663 for ( int i = 0; i < construction_parts.Count(); ++i )
2664 {
2665 string key = construction_parts.GetKey( i );
2667
2668 if ( value.
GetId() ==
id )
2669 {
2670 return value;
2671 }
2672 }
2673
2674 return NULL;
2675 }
2676
2677
2678
2680 {
2682 }
2683
2685 {
2687 }
2688
2690 {
2691 return true;
2692 }
2693
2695 {
2696 return false;
2697 }
2698
2699
2701 {
2704 {
2706 }
2707
2708 return construction_kit;
2709 }
2710
2712 {
2715 {
2717 }
2718 }
2719
2721 {
2723 }
2724
2726 {
2727 return "";
2728 }
2729
2731 {
2733 g_Game.ObjectDelete( construction_kit );
2734 }
2735
2736
2738 {
2740 g_Game.ObjectDelete(
this );
2741 }
2742
2743
2745 {
2746 super.EEDelete(parent);
2747
2749 {
2750 areaDamage.Destroy();
2751 }
2752
2753 }
2754
2756 {
2757 super.OnStoreSave( ctx );
2758
2759
2763
2765 }
2766
2768 {
2769 if ( !super.OnStoreLoad( ctx, version ) )
2770 return false;
2771
2772
2773
2775 {
2777 return false;
2778 }
2780 {
2782 return false;
2783 }
2785 {
2787 return false;
2788 }
2789
2790
2792 {
2794 return false;
2795 }
2796
2797
2798 return true;
2799 }
2800
2802 {
2803 super.AfterStoreLoad();
2804
2806 {
2808 }
2809 }
2810
2812 {
2813
2815
2816
2819
2820
2822 }
2823
2825 {
2826 super.OnCreatePhysics();
2827
2828 ConstructionInit();
2830 }
2831
2833 {
2835 return;
2836
2837 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2838 }
2839
2841 {
2843 {
2845 }
2846
2847 super.EEOnAfterLoad();
2848 }
2849
2851 {
2852 super.EEItemAttached( item, slot_name );
2853
2857 }
2858
2860 {
2861 super.EEItemDetached( item, slot_name );
2862
2865 }
2866
2867 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2868 {
2871
2874 }
2875
2876
2878 {
2879 return true;
2880 }
2881
2882
2883
2885 {
2887
2888
2889 if (construtionPart.
IsBase())
2890 {
2892
2893
2895 }
2896
2897
2899
2900
2902
2903
2905
2907
2909
2910
2912
2913
2915 }
2916
2918 {
2919
2921 }
2922
2923
2925 {
2928
2929
2931
2932
2934
2935
2937
2938
2940
2942
2943
2945
2946
2948
2949
2950 if (construtionPart.
IsBase())
2951 {
2952
2954 }
2955 }
2956
2958 {
2959
2961 }
2962
2963
2964 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2965 {
2968
2969
2971
2972
2974
2975
2977
2978
2980
2982
2983
2985
2986
2988
2989
2990 if (construtionPart.
IsBase())
2991 {
2992
2994 }
2995 }
2996
2998 {
2999
3001 }
3002
3003
3005 {
3007
3010 }
3011
3013 {
3015
3017 {
3019 }
3020 else
3021 {
3023 }
3024
3026 }
3027
3029 {
3031
3033 foreach (
string slotName : attachmentSlots)
3034 {
3036 }
3037
3038
3041 else
3043
3045 }
3046
3048 {
3049 string slotNameMounted = slot_name + "_Mounted";
3050 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3051
3052 if (attachment)
3053 {
3054 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3055 if (barbedWire && barbedWire.IsMounted())
3057 else
3059
3060 if (is_locked)
3061 {
3062 SetAnimationPhase(slotNameMounted, 0);
3063 SetAnimationPhase(slot_name, 1);
3064 }
3065 else
3066 {
3067 SetAnimationPhase(slotNameMounted, 1);
3068 SetAnimationPhase(slot_name, 0);
3069 }
3070 }
3071 else
3072 {
3073 SetAnimationPhase(slotNameMounted, 1);
3074 SetAnimationPhase(slot_name, 1);
3075
3077 }
3078 }
3079
3080
3082 {
3085
3088
3091
3092 foreach (
string slotName : attachmentSlots)
3093 {
3095 }
3096
3097
3099 {
3102
3104 }
3105 else
3106 {
3109
3111 }
3112
3115 }
3116
3118 {
3119
3121 return;
3122
3123 string slot_name_mounted = slot_name + "_Mounted";
3124 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3125
3126
3128 RemoveProxyPhysics( slot_name_mounted );
3129 RemoveProxyPhysics( slot_name );
3130
3131 if ( attachment )
3132 {
3134 if ( is_locked )
3135 {
3137 AddProxyPhysics( slot_name_mounted );
3138 }
3139 else
3140 {
3142 AddProxyPhysics( slot_name );
3143 }
3144 }
3145 }
3146
3148 {
3149 SetAffectPathgraph( true, false );
3151 }
3152
3154 {
3155 return true;
3156 }
3157
3159 {
3160 return true;
3161 }
3162
3164 {
3165 if ( attachment )
3166 {
3168 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3169
3170 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3171 }
3172
3173 return false;
3174 }
3175
3177 {
3179 }
3180
3181
3183 {
3184 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3185 if (
g_Game.ConfigIsExisting( config_path ) )
3186 {
3187 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3188 }
3189 }
3190
3192 {
3193 return true;
3194 }
3195
3197 {
3198 return true;
3199 }
3200
3202 {
3203 return true;
3204 }
3205
3206
3208 {
3211 }
3212
3214 {
3216 }
3217
3219 {
3221 }
3222
3224 {
3225 int attachment_count = GetInventory().AttachmentCount();
3226 if ( attachment_count > 0 )
3227 {
3228 if (
HasBase() && attachment_count == 1 )
3229 {
3230 return false;
3231 }
3232
3233 return true;
3234 }
3235
3236 return false;
3237 }
3238
3240 {
3241 return true;
3242 }
3243
3245 {
3246 return false;
3247 }
3248
3249
3251 {
3252 return false;
3253 }
3254
3256 {
3257 return false;
3258 }
3259
3260
3262 {
3263 return false;
3264 }
3265
3266
3267
3269 {
3270 return true;
3271 }
3272
3274 {
3275 return true;
3276 }
3277
3280 {
3281 return false;
3282 }
3283
3284
3286 {
3287 return false;
3288 }
3289
3290
3292 {
3293 return true;
3294 }
3295
3296
3298 {
3299 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3300 {
3301 return false;
3302 }
3303
3304 return true;
3305 }
3306
3308 {
3311
3312 return item;
3313 }
3314
3315
3317 {
3319 {
3320
3322
3323
3326
3328 if ( MemoryPointExists( slot_name + "_min" ) )
3329 {
3330 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3331 }
3332 if ( MemoryPointExists( slot_name + "_max" ) )
3333 {
3334 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3335 }
3336
3337
3340
3341
3344 center = ModelToWorld( center );
3345
3346
3349
3350 areaDamage.SetExtents( extents[0], extents[1] );
3351 areaDamage.SetAreaPosition( center );
3355 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3356 areaDamage.SetAmmoName( "BarbedWireHit" );
3357 areaDamage.Spawn();
3358
3360 }
3361 }
3362
3364 {
3365 if ( angle_deg != 0 )
3366 {
3367
3369
3370
3372 if ( MemoryPointExists( "rotate_axis" ) )
3373 {
3374 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3375 }
3376 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];
3377 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];
3378 center[0] = r_center_x;
3379 center[2] = r_center_z;
3380 }
3381 }
3382
3384 {
3386 {
3389 {
3390 if (areaDamage)
3391 {
3392 areaDamage.Destroy();
3393 }
3394
3396 }
3397 }
3398 }
3399
3401 {
3402 return true;
3403 }
3404
3405
3406
3407
3409 {
3411 }
3412
3414 {
3416 }
3417
3419 {
3421 }
3422
3424 {
3426
3427 switch ( material_type )
3428 {
3434 }
3435
3436 return "";
3437 }
3438
3440 {
3442
3443 switch ( material_type )
3444 {
3450 }
3451
3452 return "";
3453 }
3454
3455
3457 {
3459 {
3460
3462 {
3463 SetHealth(slot_name,"Health",item.GetHealth());
3464 }
3465 }
3466 }
3467
3469 {
3470 return 111;
3471 }
3472
3474 {
3475 super.SetActions();
3476
3480 }
3481
3483 {
3485 if (!construction)
3486 return;
3487
3489 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3490 {
3493 {
3495 }
3496 }
3497 }
3498
3500 {
3502 if (!construction)
3503 return;
3504
3506 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3507 {
3510 {
3511 construction.HandleEntityFalling(part.
GetPartName());
3512 }
3513 }
3514 }
3515
3518 {
3520 return;
3521
3524
3525 if (DestroyOnFall())
3526 {
3528 {
3530 }
3531 else
3532 {
3534 {
3536 }
3538 }
3539 }
3540 }
3541
3543 {
3544 if (HasAnyAttachmentsOrCargo())
3545 {
3548 }
3549 }
3550
3551
3552
3553
3554
3557 {
3558 return null;
3559 }
3560
3562 {
3564 }
3565
3567 {
3570
3571 Man p;
3572
3573 #ifdef SERVER
3575 g_Game.GetWorld().GetPlayerList(players);
3576 if (players.Count())
3577 p = players[0];
3578 #else
3580 #endif
3581
3583 {
3584 bool excluded = false;
3586 if (excludes)
3587 {
3588 foreach (string exclude : excludes)
3589 {
3591 {
3592 excluded = true;
3593 break;
3594 }
3595 }
3596 }
3597
3598 if (!excluded)
3599 {
3601 }
3602 }
3603
3605 }
3606
3608
3610 [
Obsolete(
"handled in the Construction component directly")]
3612 {
3613 }
3614
3615 [
Obsolete(
"handled in the Construction component directly")]
3617 {
3618 }
3619
3620 [
Obsolete(
"obsolete debug method")]
3622 {
3623 }
3624}
3625
3627{
3628#ifdef BSB_DEBUG
3630#else
3631
3632#endif
3633}
3635{
3636#ifdef BSB_DEBUG_SPAM
3638#else
3639
3640#endif
3641}
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.