2394{
2396
2398
2400
2407
2408
2409
2415
2421
2423
2427
2428
2430 {
2432
2433
2434 RegisterNetSyncVariableInt( "m_SyncParts01" );
2435 RegisterNetSyncVariableInt( "m_SyncParts02" );
2436 RegisterNetSyncVariableInt( "m_SyncParts03" );
2437 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2438 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2439 RegisterNetSyncVariableBool( "m_HasBase" );
2440
2441
2442 ConstructionInit();
2443
2444 if (ConfigIsExisting("hybridAttachments"))
2445 {
2448 }
2449 if (ConfigIsExisting("mountables"))
2450 {
2453 }
2454
2456 SetAllowDamage(true);
2457 }
2458
2460 {
2461 return "disableBaseDamage";
2462 }
2463
2465 {
2466 return true;
2467 }
2468
2470 {
2471 return EInventoryIconVisibility.HIDE_VICINITY;
2472 }
2473
2475 {
2476 super.InitItemSounds();
2477
2481
2486 }
2487
2489 {
2490 return "putDown_FenceKit_SoundSet";
2491 }
2492
2494 {
2495 return "Shelter_Site_Build_Loop_SoundSet";
2496 }
2497
2498
2500 {
2502 {
2503 SetSynchDirty();
2504 }
2505 }
2506
2508 {
2510 super.OnVariablesSynchronized();
2511
2513 }
2514
2516 {
2517
2519
2520
2522
2523
2525 }
2526
2527
2529 {
2530
2531 int offset;
2532 int mask;
2533
2534 if ( part_id >= 1 && part_id <= 31 )
2535 {
2536 offset = part_id - 1;
2537 mask = 1 << offset;
2538
2540 }
2541 else if ( part_id >= 32 && part_id <= 62 )
2542 {
2543 offset = ( part_id % 32 );
2544 mask = 1 << offset;
2545
2547 }
2548 else if ( part_id >= 63 && part_id <= 93 )
2549 {
2550 offset = ( part_id % 63 );
2551 mask = 1 << offset;
2552
2554 }
2555 }
2556
2558 {
2559
2560 int offset;
2561 int mask;
2562
2563 if ( part_id >= 1 && part_id <= 31 )
2564 {
2565 offset = part_id - 1;
2566 mask = 1 << offset;
2567
2569 }
2570 else if ( part_id >= 32 && part_id <= 62 )
2571 {
2572 offset = ( part_id % 32 );
2573 mask = 1 << offset;
2574
2576 }
2577 else if ( part_id >= 63 && part_id <= 93 )
2578 {
2579 offset = ( part_id % 63 );
2580 mask = 1 << offset;
2581
2583 }
2584 }
2585
2587 {
2588
2589 int offset;
2590 int mask;
2591
2592 if ( part_id >= 1 && part_id <= 31 )
2593 {
2594 offset = part_id - 1;
2595 mask = 1 << offset;
2596
2598 {
2599 return true;
2600 }
2601 }
2602 else if ( part_id >= 32 && part_id <= 62 )
2603 {
2604 offset = ( part_id % 32 );
2605 mask = 1 << offset;
2606
2608 {
2609 return true;
2610 }
2611 }
2612 else if ( part_id >= 63 && part_id <= 93 )
2613 {
2614 offset = ( part_id % 63 );
2615 mask = 1 << offset;
2616
2618 {
2619 return true;
2620 }
2621 }
2622
2623 return false;
2624 }
2625
2627 {
2630 }
2631
2633 {
2634
2637 }
2638
2640 {
2642 {
2645
2646 switch( build_action_id )
2647 {
2651 }
2652 }
2653 }
2654
2655
2657 {
2659 bool is_base = part.
IsBase();
2662 if ( is_part_built_sync )
2663 {
2665 {
2669
2670 if (is_base)
2671 {
2674 }
2675 }
2676 }
2677 else
2678 {
2680 {
2684
2685 if (is_base)
2686 {
2689 }
2690 }
2691 }
2692
2693
2695 }
2696
2697
2699 {
2702
2703 for ( int i = 0; i < construction_parts.Count(); ++i )
2704 {
2705 string key = construction_parts.GetKey( i );
2708 }
2709
2710
2712 }
2713
2715 {
2718
2719 for ( int i = 0; i < construction_parts.Count(); ++i )
2720 {
2721 string key = construction_parts.GetKey( i );
2723
2724 if ( value.
GetId() ==
id )
2725 {
2726 return value;
2727 }
2728 }
2729
2730 return NULL;
2731 }
2732
2733
2734
2736 {
2738 }
2739
2741 {
2743 }
2744
2746 {
2747 return true;
2748 }
2749
2751 {
2752 return false;
2753 }
2754
2755
2757 {
2760 {
2762 }
2763
2764 return construction_kit;
2765 }
2766
2768 {
2771 {
2773 }
2774 }
2775
2777 {
2779 }
2780
2782 {
2783 return "";
2784 }
2785
2787 {
2789 g_Game.ObjectDelete( construction_kit );
2790 }
2791
2792
2794 {
2796 g_Game.ObjectDelete(
this );
2797 }
2798
2799
2801 {
2802 super.EEDelete(parent);
2803
2805 {
2806 areaDamage.Destroy();
2807 }
2808
2809 }
2810
2812 {
2813 super.OnStoreSave( ctx );
2814
2815
2819
2821 }
2822
2824 {
2825 if ( !super.OnStoreLoad( ctx, version ) )
2826 return false;
2827
2828
2829
2831 {
2833 return false;
2834 }
2836 {
2838 return false;
2839 }
2841 {
2843 return false;
2844 }
2845
2846
2848 {
2850 return false;
2851 }
2852
2853
2854 return true;
2855 }
2856
2858 {
2859 super.AfterStoreLoad();
2860
2862 {
2864 }
2865 }
2866
2868 {
2869
2871
2872
2875
2876
2878 }
2879
2881 {
2882 super.OnCreatePhysics();
2883
2884 ConstructionInit();
2886 }
2887
2889 {
2891 return;
2892
2893 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2894 }
2895
2897 {
2899 {
2901 }
2902
2903 super.EEOnAfterLoad();
2904 }
2905
2907 {
2908 super.EEItemAttached( item, slot_name );
2909
2913 }
2914
2916 {
2917 super.EEItemDetached( item, slot_name );
2918
2921 }
2922
2923 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2924 {
2927
2930 }
2931
2932
2934 {
2935 return true;
2936 }
2937
2938
2939
2941 {
2943
2944
2945 if (construtionPart.
IsBase())
2946 {
2948
2949
2951 }
2952
2953
2955
2956
2958
2959
2961
2963
2965
2966
2968
2969
2971 }
2972
2974 {
2975
2977 }
2978
2979
2981 {
2984
2985
2987
2988
2990
2991
2993
2994
2996
2998
2999
3001
3002
3004
3005
3006 if (construtionPart.
IsBase())
3007 {
3008
3010 }
3011 }
3012
3014 {
3015
3017 }
3018
3019
3020 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3021 {
3024
3025
3027
3028
3030
3031
3033
3034
3036
3038
3039
3041
3042
3044
3045
3046 if (construtionPart.
IsBase())
3047 {
3048
3050 }
3051 }
3052
3054 {
3055
3057 }
3058
3059
3061 {
3063
3066 }
3067
3069 {
3071
3073 {
3075 }
3076 else
3077 {
3079 }
3080
3082 }
3083
3085 {
3087
3089 foreach (
string slotName : attachmentSlots)
3090 {
3092 }
3093
3094
3097 else
3099
3101 }
3102
3104 {
3105 string slotNameMounted = slot_name + "_Mounted";
3106 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3107
3108 if (attachment)
3109 {
3110 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3111 if (barbedWire && barbedWire.IsMounted())
3113 else
3115
3116 if (is_locked)
3117 {
3118 SetAnimationPhase(slotNameMounted, 0);
3119 SetAnimationPhase(slot_name, 1);
3120 }
3121 else
3122 {
3123 SetAnimationPhase(slotNameMounted, 1);
3124 SetAnimationPhase(slot_name, 0);
3125 }
3126 }
3127 else
3128 {
3129 SetAnimationPhase(slotNameMounted, 1);
3130 SetAnimationPhase(slot_name, 1);
3131
3133 }
3134 }
3135
3136
3138 {
3141
3144
3147
3148 foreach (
string slotName : attachmentSlots)
3149 {
3151 }
3152
3153
3155 {
3158
3160 }
3161 else
3162 {
3165
3167 }
3168
3171 }
3172
3174 {
3175
3177 return;
3178
3179 string slot_name_mounted = slot_name + "_Mounted";
3180 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3181
3182
3184 RemoveProxyPhysics( slot_name_mounted );
3185 RemoveProxyPhysics( slot_name );
3186
3187 if ( attachment )
3188 {
3190 if ( is_locked )
3191 {
3193 AddProxyPhysics( slot_name_mounted );
3194 }
3195 else
3196 {
3198 AddProxyPhysics( slot_name );
3199 }
3200 }
3201 }
3202
3204 {
3205 SetAffectPathgraph( true, false );
3207 }
3208
3210 {
3211 return true;
3212 }
3213
3215 {
3216 return true;
3217 }
3218
3220 {
3221 if ( attachment )
3222 {
3224 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3225
3226 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3227 }
3228
3229 return false;
3230 }
3231
3233 {
3235 }
3236
3237
3239 {
3240 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3241 if (
g_Game.ConfigIsExisting( config_path ) )
3242 {
3243 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3244 }
3245 }
3246
3248 {
3249 return true;
3250 }
3251
3253 {
3254 return true;
3255 }
3256
3258 {
3259 return true;
3260 }
3261
3262
3264 {
3267 }
3268
3270 {
3272 }
3273
3275 {
3277 }
3278
3280 {
3281 int attachment_count = GetInventory().AttachmentCount();
3282 if ( attachment_count > 0 )
3283 {
3284 if (
HasBase() && attachment_count == 1 )
3285 {
3286 return false;
3287 }
3288
3289 return true;
3290 }
3291
3292 return false;
3293 }
3294
3296 {
3297 return true;
3298 }
3299
3301 {
3302 return false;
3303 }
3304
3305
3307 {
3308 return false;
3309 }
3310
3312 {
3313 return false;
3314 }
3315
3316
3318 {
3319 return false;
3320 }
3321
3322
3323
3325 {
3326 return true;
3327 }
3328
3330 {
3331 return true;
3332 }
3333
3336 {
3337 return false;
3338 }
3339
3340
3342 {
3343 return false;
3344 }
3345
3346
3348 {
3349 return true;
3350 }
3351
3352
3354 {
3355 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3356 {
3357 return false;
3358 }
3359
3360 return true;
3361 }
3362
3364 {
3367
3368 return item;
3369 }
3370
3371
3373 {
3375 {
3376
3378
3379
3382
3384 if ( MemoryPointExists( slot_name + "_min" ) )
3385 {
3386 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3387 }
3388 if ( MemoryPointExists( slot_name + "_max" ) )
3389 {
3390 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3391 }
3392
3393
3396
3397
3400 center = ModelToWorld( center );
3401
3402
3405
3406 areaDamage.SetExtents( extents[0], extents[1] );
3407 areaDamage.SetAreaPosition( center );
3411 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3412 areaDamage.SetAmmoName( "BarbedWireHit" );
3413 areaDamage.Spawn();
3414
3416 }
3417 }
3418
3420 {
3421 if ( angle_deg != 0 )
3422 {
3423
3425
3426
3428 if ( MemoryPointExists( "rotate_axis" ) )
3429 {
3430 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3431 }
3432 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];
3433 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];
3434 center[0] = r_center_x;
3435 center[2] = r_center_z;
3436 }
3437 }
3438
3440 {
3442 {
3445 {
3446 if (areaDamage)
3447 {
3448 areaDamage.Destroy();
3449 }
3450
3452 }
3453 }
3454 }
3455
3457 {
3458 return true;
3459 }
3460
3461
3462
3463
3465 {
3467 }
3468
3470 {
3472 }
3473
3475 {
3477 }
3478
3480 {
3482
3483 switch ( material_type )
3484 {
3490 }
3491
3492 return "";
3493 }
3494
3496 {
3498
3499 switch ( material_type )
3500 {
3506 }
3507
3508 return "";
3509 }
3510
3511
3513 {
3515 {
3516
3518 {
3519 SetHealth(slot_name,"Health",item.GetHealth());
3520 }
3521 }
3522 }
3523
3525 {
3526 return 111;
3527 }
3528
3530 {
3531 super.SetActions();
3532
3536 }
3537
3539 {
3541 if (!construction)
3542 return;
3543
3545 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3546 {
3549 {
3551 }
3552 }
3553 }
3554
3556 {
3558 if (!construction)
3559 return;
3560
3562 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3563 {
3566 {
3567 construction.HandleEntityFalling(part.
GetPartName());
3568 }
3569 }
3570 }
3571
3574 {
3576 return;
3577
3580
3581 if (DestroyOnFall())
3582 {
3584 {
3586 }
3587 else
3588 {
3590 {
3592 }
3594 }
3595 }
3596 }
3597
3599 {
3600 if (HasAnyAttachmentsOrCargo())
3601 {
3604 }
3605 }
3606
3607
3608
3609
3610
3613 {
3614 return null;
3615 }
3616
3618 {
3620 }
3621
3623 {
3626
3627 Man p;
3628
3629 #ifdef SERVER
3631 g_Game.GetWorld().GetPlayerList(players);
3632 if (players.Count())
3633 p = players[0];
3634 #else
3636 #endif
3637
3639 {
3640 bool excluded = false;
3642 if (excludes)
3643 {
3644 foreach (string exclude : excludes)
3645 {
3647 {
3648 excluded = true;
3649 break;
3650 }
3651 }
3652 }
3653
3654 if (!excluded)
3655 {
3657 }
3658 }
3659
3661 }
3662
3664
3666 [
Obsolete(
"handled in the Construction component directly")]
3668 {
3669 }
3670
3671 [
Obsolete(
"handled in the Construction component directly")]
3673 {
3674 }
3675
3676 [
Obsolete(
"obsolete debug method")]
3678 {
3679 }
3680}
3681
3683{
3684#ifdef BSB_DEBUG
3686#else
3687
3688#endif
3689}
3691{
3692#ifdef BSB_DEBUG_SPAM
3694#else
3695
3696#endif
3697}
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.