2571{
2573
2575
2577
2584
2585
2586
2592
2598
2600
2604
2605
2607 {
2609
2610
2611 RegisterNetSyncVariableInt( "m_SyncParts01" );
2612 RegisterNetSyncVariableInt( "m_SyncParts02" );
2613 RegisterNetSyncVariableInt( "m_SyncParts03" );
2614 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2615 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2616 RegisterNetSyncVariableBool( "m_HasBase" );
2617
2618
2619 ConstructionInit();
2620
2621 if (ConfigIsExisting("hybridAttachments"))
2622 {
2625 }
2626 if (ConfigIsExisting("mountables"))
2627 {
2630 }
2631
2633 SetAllowDamage(true);
2634 }
2635
2637 {
2638 return "disableBaseDamage";
2639 }
2640
2642 {
2643 return true;
2644 }
2645
2647 {
2648 return EInventoryIconVisibility.HIDE_VICINITY;
2649 }
2650
2652 {
2653 super.InitItemSounds();
2654
2658
2663 }
2664
2666 {
2667 return "putDown_FenceKit_SoundSet";
2668 }
2669
2671 {
2672 return "Shelter_Site_Build_Loop_SoundSet";
2673 }
2674
2675
2677 {
2679 {
2680 SetSynchDirty();
2681 }
2682 }
2683
2685 {
2687 super.OnVariablesSynchronized();
2688
2690 }
2691
2693 {
2694
2696
2697
2699
2700
2702 }
2703
2704
2706 {
2707
2708 int offset;
2709 int mask;
2710
2711 if ( part_id >= 1 && part_id <= 31 )
2712 {
2713 offset = part_id - 1;
2714 mask = 1 << offset;
2715
2717 }
2718 else if ( part_id >= 32 && part_id <= 62 )
2719 {
2720 offset = ( part_id % 32 );
2721 mask = 1 << offset;
2722
2724 }
2725 else if ( part_id >= 63 && part_id <= 93 )
2726 {
2727 offset = ( part_id % 63 );
2728 mask = 1 << offset;
2729
2731 }
2732 }
2733
2735 {
2736
2737 int offset;
2738 int mask;
2739
2740 if ( part_id >= 1 && part_id <= 31 )
2741 {
2742 offset = part_id - 1;
2743 mask = 1 << offset;
2744
2746 }
2747 else if ( part_id >= 32 && part_id <= 62 )
2748 {
2749 offset = ( part_id % 32 );
2750 mask = 1 << offset;
2751
2753 }
2754 else if ( part_id >= 63 && part_id <= 93 )
2755 {
2756 offset = ( part_id % 63 );
2757 mask = 1 << offset;
2758
2760 }
2761 }
2762
2764 {
2765
2766 int offset;
2767 int mask;
2768
2769 if ( part_id >= 1 && part_id <= 31 )
2770 {
2771 offset = part_id - 1;
2772 mask = 1 << offset;
2773
2775 {
2776 return true;
2777 }
2778 }
2779 else if ( part_id >= 32 && part_id <= 62 )
2780 {
2781 offset = ( part_id % 32 );
2782 mask = 1 << offset;
2783
2785 {
2786 return true;
2787 }
2788 }
2789 else if ( part_id >= 63 && part_id <= 93 )
2790 {
2791 offset = ( part_id % 63 );
2792 mask = 1 << offset;
2793
2795 {
2796 return true;
2797 }
2798 }
2799
2800 return false;
2801 }
2802
2804 {
2807 }
2808
2810 {
2811
2814 }
2815
2817 {
2819 {
2822
2823 switch( build_action_id )
2824 {
2828 }
2829 }
2830 }
2831
2832
2834 {
2836 bool is_base = part.
IsBase();
2839 if ( is_part_built_sync )
2840 {
2842 {
2846
2847 if (is_base)
2848 {
2851 }
2852 }
2853 }
2854 else
2855 {
2857 {
2861
2862 if (is_base)
2863 {
2866 }
2867 }
2868 }
2869
2870
2872 }
2873
2874
2876 {
2879
2880 for ( int i = 0; i < construction_parts.Count(); ++i )
2881 {
2882 string key = construction_parts.GetKey( i );
2885 }
2886
2887
2889 }
2890
2892 {
2895
2896 for ( int i = 0; i < construction_parts.Count(); ++i )
2897 {
2898 string key = construction_parts.GetKey( i );
2900
2901 if ( value.
GetId() ==
id )
2902 {
2903 return value;
2904 }
2905 }
2906
2907 return NULL;
2908 }
2909
2910
2911
2913 {
2915 }
2916
2918 {
2920 }
2921
2923 {
2924 return true;
2925 }
2926
2928 {
2929 return false;
2930 }
2931
2932
2934 {
2937 {
2939 }
2940
2941 return construction_kit;
2942 }
2943
2945 {
2948 {
2950 }
2951 }
2952
2954 {
2956 }
2957
2959 {
2960 return "";
2961 }
2962
2964 {
2966 g_Game.ObjectDelete( construction_kit );
2967 }
2968
2969
2971 {
2973 g_Game.ObjectDelete(
this );
2974 }
2975
2976
2978 {
2979 super.EEDelete(parent);
2980
2982 {
2983 areaDamage.Destroy();
2984 }
2985
2986 }
2987
2989 {
2990 super.OnStoreSave( ctx );
2991
2992
2996
2998 }
2999
3001 {
3002 if ( !super.OnStoreLoad( ctx, version ) )
3003 return false;
3004
3005
3006
3008 {
3010 return false;
3011 }
3013 {
3015 return false;
3016 }
3018 {
3020 return false;
3021 }
3022
3023
3025 {
3027 return false;
3028 }
3029
3030
3031 return true;
3032 }
3033
3035 {
3036 super.AfterStoreLoad();
3037
3039 {
3041 }
3042 }
3043
3045 {
3046
3048
3049
3052
3053
3055 }
3056
3058 {
3059 super.OnCreatePhysics();
3060
3061 ConstructionInit();
3063 }
3064
3066 {
3068 return;
3069
3070 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3071 }
3072
3074 {
3076 {
3078 }
3079
3080 super.EEOnAfterLoad();
3081 }
3082
3084 {
3085 super.EEItemAttached( item, slot_name );
3086
3090 }
3091
3093 {
3094 super.EEItemDetached( item, slot_name );
3095
3098 }
3099
3100 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3101 {
3104
3107 }
3108
3109
3111 {
3112 return true;
3113 }
3114
3115
3116
3118 {
3120
3121
3122 if (construtionPart.
IsBase())
3123 {
3125
3126
3128 }
3129
3130
3132
3133
3135
3136
3138
3140
3142
3143
3145
3146
3148 }
3149
3151 {
3152
3154 }
3155
3156
3158 {
3161
3162
3164
3165
3167
3168
3170
3171
3173
3175
3176
3178
3179
3181
3182
3183 if (construtionPart.
IsBase())
3184 {
3185
3187 }
3188 }
3189
3191 {
3192
3194 }
3195
3196
3197 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3198 {
3201
3202
3204
3205
3207
3208
3210
3211
3213
3215
3216
3218
3219
3221
3222
3223 if (construtionPart.
IsBase())
3224 {
3225
3227 }
3228 }
3229
3231 {
3232
3234 }
3235
3236
3238 {
3240
3243 }
3244
3246 {
3248
3250 {
3252 }
3253 else
3254 {
3256 }
3257
3259 }
3260
3262 {
3264
3266 foreach (
string slotName : attachmentSlots)
3267 {
3269 }
3270
3271
3274 else
3276
3278 }
3279
3281 {
3282 string slotNameMounted = slot_name + "_Mounted";
3283 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3284
3285 if (attachment)
3286 {
3287 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3288 if (barbedWire && barbedWire.IsMounted())
3290 else
3292
3293 if (is_locked)
3294 {
3295 SetAnimationPhase(slotNameMounted, 0);
3296 SetAnimationPhase(slot_name, 1);
3297 }
3298 else
3299 {
3300 SetAnimationPhase(slotNameMounted, 1);
3301 SetAnimationPhase(slot_name, 0);
3302 }
3303 }
3304 else
3305 {
3306 SetAnimationPhase(slotNameMounted, 1);
3307 SetAnimationPhase(slot_name, 1);
3308
3310 }
3311 }
3312
3313
3315 {
3318
3321
3324
3325 foreach (
string slotName : attachmentSlots)
3326 {
3328 }
3329
3330
3332 {
3335
3337 }
3338 else
3339 {
3342
3344 }
3345
3348 }
3349
3351 {
3352
3354 return;
3355
3356 string slot_name_mounted = slot_name + "_Mounted";
3357 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3358
3359
3361 RemoveProxyPhysics( slot_name_mounted );
3362 RemoveProxyPhysics( slot_name );
3363
3364 if ( attachment )
3365 {
3367 if ( is_locked )
3368 {
3370 AddProxyPhysics( slot_name_mounted );
3371 }
3372 else
3373 {
3375 AddProxyPhysics( slot_name );
3376 }
3377 }
3378 }
3379
3381 {
3382 SetAffectPathgraph( true, false );
3384 }
3385
3387 {
3388 return true;
3389 }
3390
3392 {
3393 return true;
3394 }
3395
3397 {
3398 if ( attachment )
3399 {
3401 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3402
3403 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3404 }
3405
3406 return false;
3407 }
3408
3410 {
3412 }
3413
3414
3416 {
3417 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3418 if (
g_Game.ConfigIsExisting( config_path ) )
3419 {
3420 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3421 }
3422 }
3423
3425 {
3426 return true;
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3435 {
3436 return true;
3437 }
3438
3439
3441 {
3444 }
3445
3447 {
3449 }
3450
3452 {
3454 }
3455
3457 {
3458 int attachment_count = GetInventory().AttachmentCount();
3459 if ( attachment_count > 0 )
3460 {
3461 if (
HasBase() && attachment_count == 1 )
3462 {
3463 return false;
3464 }
3465
3466 return true;
3467 }
3468
3469 return false;
3470 }
3471
3473 {
3474 return true;
3475 }
3476
3478 {
3479 return false;
3480 }
3481
3482
3484 {
3485 return false;
3486 }
3487
3489 {
3490 return false;
3491 }
3492
3493
3495 {
3496 return false;
3497 }
3498
3499
3500
3502 {
3503 return true;
3504 }
3505
3507 {
3508 return true;
3509 }
3510
3513 {
3514 return false;
3515 }
3516
3517
3519 {
3520 return false;
3521 }
3522
3523
3525 {
3526 return true;
3527 }
3528
3529
3531 {
3532 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3533 {
3534 return false;
3535 }
3536
3537 return true;
3538 }
3539
3541 {
3544
3545 return item;
3546 }
3547
3548
3550 {
3552 {
3553
3555
3556
3559
3561 if ( MemoryPointExists( slot_name + "_min" ) )
3562 {
3563 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3564 }
3565 if ( MemoryPointExists( slot_name + "_max" ) )
3566 {
3567 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3568 }
3569
3570
3573
3574
3577 center = ModelToWorld( center );
3578
3579
3582
3583 areaDamage.SetExtents( extents[0], extents[1] );
3584 areaDamage.SetAreaPosition( center );
3588 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3589 areaDamage.SetAmmoName( "BarbedWireHit" );
3590 areaDamage.Spawn();
3591
3593 }
3594 }
3595
3597 {
3598 if ( angle_deg != 0 )
3599 {
3600
3602
3603
3605 if ( MemoryPointExists( "rotate_axis" ) )
3606 {
3607 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3608 }
3609 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];
3610 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];
3611 center[0] = r_center_x;
3612 center[2] = r_center_z;
3613 }
3614 }
3615
3617 {
3619 {
3622 {
3623 if (areaDamage)
3624 {
3625 areaDamage.Destroy();
3626 }
3627
3629 }
3630 }
3631 }
3632
3634 {
3635 return true;
3636 }
3637
3638
3639
3640
3642 {
3644 }
3645
3647 {
3649 }
3650
3652 {
3654 }
3655
3657 {
3659
3660 switch ( material_type )
3661 {
3667 }
3668
3669 return "";
3670 }
3671
3673 {
3675
3676 switch ( material_type )
3677 {
3683 }
3684
3685 return "";
3686 }
3687
3688
3690 {
3692 {
3693
3695 {
3696 SetHealth(slot_name,"Health",item.GetHealth());
3697 }
3698 }
3699 }
3700
3702 {
3703 return 111;
3704 }
3705
3707 {
3708 super.SetActions();
3709
3713 }
3714
3716 {
3718 if (!construction)
3719 return;
3720
3722 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3723 {
3726 {
3728 }
3729 }
3730 }
3731
3733 {
3735 if (!construction)
3736 return;
3737
3739 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3740 {
3743 {
3744 construction.HandleEntityFalling(part.
GetPartName());
3745 }
3746 }
3747 }
3748
3751 {
3753 return;
3754
3757
3758 if (DestroyOnFall())
3759 {
3761 {
3763 }
3764 else
3765 {
3767 {
3769 }
3771 }
3772 }
3773 }
3774
3776 {
3777 if (HasAnyAttachmentsOrCargo())
3778 {
3781 }
3782 }
3783
3784
3785
3786
3787
3790 {
3791 return null;
3792 }
3793
3795 {
3797 }
3798
3800 {
3803
3804 Man p;
3805
3806 #ifdef SERVER
3808 g_Game.GetWorld().GetPlayerList(players);
3809 if (players.Count())
3810 p = players[0];
3811 #else
3813 #endif
3814
3816 {
3817 bool excluded = false;
3819 if (excludes)
3820 {
3821 foreach (string exclude : excludes)
3822 {
3824 {
3825 excluded = true;
3826 break;
3827 }
3828 }
3829 }
3830
3831 if (!excluded)
3832 {
3834 }
3835 }
3836
3838 }
3839
3841
3843 [
Obsolete(
"handled in the Construction component directly")]
3845 {
3846 }
3847
3848 [
Obsolete(
"handled in the Construction component directly")]
3850 {
3851 }
3852
3853 [
Obsolete(
"obsolete debug method")]
3855 {
3856 }
3857}
3858
3860{
3861#ifdef BSB_DEBUG
3863#else
3864
3865#endif
3866}
3868{
3869#ifdef BSB_DEBUG_SPAM
3871#else
3872
3873#endif
3874}
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.