2566{
2568
2570
2572
2579
2580
2581
2587
2593
2595
2599
2600
2602 {
2604
2605
2606 RegisterNetSyncVariableInt( "m_SyncParts01" );
2607 RegisterNetSyncVariableInt( "m_SyncParts02" );
2608 RegisterNetSyncVariableInt( "m_SyncParts03" );
2609 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2610 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2611 RegisterNetSyncVariableBool( "m_HasBase" );
2612
2613
2614 ConstructionInit();
2615
2616 if (ConfigIsExisting("hybridAttachments"))
2617 {
2620 }
2621 if (ConfigIsExisting("mountables"))
2622 {
2625 }
2626
2628 SetAllowDamage(true);
2629 }
2630
2632 {
2633 return "disableBaseDamage";
2634 }
2635
2637 {
2638 return true;
2639 }
2640
2642 {
2643 return EInventoryIconVisibility.HIDE_VICINITY;
2644 }
2645
2647 {
2648 super.InitItemSounds();
2649
2653
2658 }
2659
2661 {
2662 return "putDown_FenceKit_SoundSet";
2663 }
2664
2666 {
2667 return "Shelter_Site_Build_Loop_SoundSet";
2668 }
2669
2670
2672 {
2674 {
2675 SetSynchDirty();
2676 }
2677 }
2678
2680 {
2682 super.OnVariablesSynchronized();
2683
2685 }
2686
2688 {
2689
2691
2692
2694
2695
2697 }
2698
2699
2701 {
2702
2703 int offset;
2704 int mask;
2705
2706 if ( part_id >= 1 && part_id <= 31 )
2707 {
2708 offset = part_id - 1;
2709 mask = 1 << offset;
2710
2712 }
2713 else if ( part_id >= 32 && part_id <= 62 )
2714 {
2715 offset = ( part_id % 32 );
2716 mask = 1 << offset;
2717
2719 }
2720 else if ( part_id >= 63 && part_id <= 93 )
2721 {
2722 offset = ( part_id % 63 );
2723 mask = 1 << offset;
2724
2726 }
2727 }
2728
2730 {
2731
2732 int offset;
2733 int mask;
2734
2735 if ( part_id >= 1 && part_id <= 31 )
2736 {
2737 offset = part_id - 1;
2738 mask = 1 << offset;
2739
2741 }
2742 else if ( part_id >= 32 && part_id <= 62 )
2743 {
2744 offset = ( part_id % 32 );
2745 mask = 1 << offset;
2746
2748 }
2749 else if ( part_id >= 63 && part_id <= 93 )
2750 {
2751 offset = ( part_id % 63 );
2752 mask = 1 << offset;
2753
2755 }
2756 }
2757
2759 {
2760
2761 int offset;
2762 int mask;
2763
2764 if ( part_id >= 1 && part_id <= 31 )
2765 {
2766 offset = part_id - 1;
2767 mask = 1 << offset;
2768
2770 {
2771 return true;
2772 }
2773 }
2774 else if ( part_id >= 32 && part_id <= 62 )
2775 {
2776 offset = ( part_id % 32 );
2777 mask = 1 << offset;
2778
2780 {
2781 return true;
2782 }
2783 }
2784 else if ( part_id >= 63 && part_id <= 93 )
2785 {
2786 offset = ( part_id % 63 );
2787 mask = 1 << offset;
2788
2790 {
2791 return true;
2792 }
2793 }
2794
2795 return false;
2796 }
2797
2799 {
2802 }
2803
2805 {
2806
2809 }
2810
2812 {
2814 {
2817
2818 switch( build_action_id )
2819 {
2823 }
2824 }
2825 }
2826
2827
2829 {
2831 bool is_base = part.
IsBase();
2834 if ( is_part_built_sync )
2835 {
2837 {
2841
2842 if (is_base)
2843 {
2846 }
2847 }
2848 }
2849 else
2850 {
2852 {
2856
2857 if (is_base)
2858 {
2861 }
2862 }
2863 }
2864
2865
2867 }
2868
2869
2871 {
2874
2875 for ( int i = 0; i < construction_parts.Count(); ++i )
2876 {
2877 string key = construction_parts.GetKey( i );
2880 }
2881
2882
2884 }
2885
2887 {
2890
2891 for ( int i = 0; i < construction_parts.Count(); ++i )
2892 {
2893 string key = construction_parts.GetKey( i );
2895
2896 if ( value.
GetId() ==
id )
2897 {
2898 return value;
2899 }
2900 }
2901
2902 return NULL;
2903 }
2904
2905
2906
2908 {
2910 }
2911
2913 {
2915 }
2916
2918 {
2919 return true;
2920 }
2921
2923 {
2924 return false;
2925 }
2926
2927
2929 {
2932 {
2934 }
2935
2936 return construction_kit;
2937 }
2938
2940 {
2943 {
2945 }
2946 }
2947
2949 {
2951 }
2952
2954 {
2955 return "";
2956 }
2957
2959 {
2961 g_Game.ObjectDelete( construction_kit );
2962 }
2963
2964
2966 {
2968 g_Game.ObjectDelete(
this );
2969 }
2970
2971
2973 {
2974 super.EEDelete(parent);
2975
2977 {
2978 areaDamage.Destroy();
2979 }
2980
2981 }
2982
2984 {
2985 super.OnStoreSave( ctx );
2986
2987
2991
2993 }
2994
2996 {
2997 if ( !super.OnStoreLoad( ctx, version ) )
2998 return false;
2999
3000
3001
3003 {
3005 return false;
3006 }
3008 {
3010 return false;
3011 }
3013 {
3015 return false;
3016 }
3017
3018
3020 {
3022 return false;
3023 }
3024
3025
3026 return true;
3027 }
3028
3030 {
3031 super.AfterStoreLoad();
3032
3034 {
3036 }
3037 }
3038
3040 {
3041
3043
3044
3047
3048
3050 }
3051
3053 {
3054 super.OnCreatePhysics();
3055
3056 ConstructionInit();
3058 }
3059
3061 {
3063 return;
3064
3065 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3066 }
3067
3069 {
3071 {
3073 }
3074
3075 super.EEOnAfterLoad();
3076 }
3077
3079 {
3080 super.EEItemAttached( item, slot_name );
3081
3085 }
3086
3088 {
3089 super.EEItemDetached( item, slot_name );
3090
3093 }
3094
3095 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3096 {
3099
3102 }
3103
3104
3106 {
3107 return true;
3108 }
3109
3110
3111
3113 {
3115
3116
3117 if (construtionPart.
IsBase())
3118 {
3120
3121
3123 }
3124
3125
3127
3128
3130
3131
3133
3135
3137
3138
3140
3141
3143 }
3144
3146 {
3147
3149 }
3150
3151
3153 {
3156
3157
3159
3160
3162
3163
3165
3166
3168
3170
3171
3173
3174
3176
3177
3178 if (construtionPart.
IsBase())
3179 {
3180
3182 }
3183 }
3184
3186 {
3187
3189 }
3190
3191
3192 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3193 {
3196
3197
3199
3200
3202
3203
3205
3206
3208
3210
3211
3213
3214
3216
3217
3218 if (construtionPart.
IsBase())
3219 {
3220
3222 }
3223 }
3224
3226 {
3227
3229 }
3230
3231
3233 {
3235
3238 }
3239
3241 {
3243
3245 {
3247 }
3248 else
3249 {
3251 }
3252
3254 }
3255
3257 {
3259
3261 foreach (
string slotName : attachmentSlots)
3262 {
3264 }
3265
3266
3269 else
3271
3273 }
3274
3276 {
3277 string slotNameMounted = slot_name + "_Mounted";
3278 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3279
3280 if (attachment)
3281 {
3282 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3283 if (barbedWire && barbedWire.IsMounted())
3285 else
3287
3288 if (is_locked)
3289 {
3290 SetAnimationPhase(slotNameMounted, 0);
3291 SetAnimationPhase(slot_name, 1);
3292 }
3293 else
3294 {
3295 SetAnimationPhase(slotNameMounted, 1);
3296 SetAnimationPhase(slot_name, 0);
3297 }
3298 }
3299 else
3300 {
3301 SetAnimationPhase(slotNameMounted, 1);
3302 SetAnimationPhase(slot_name, 1);
3303
3305 }
3306 }
3307
3308
3310 {
3313
3316
3319
3320 foreach (
string slotName : attachmentSlots)
3321 {
3323 }
3324
3325
3327 {
3330
3332 }
3333 else
3334 {
3337
3339 }
3340
3343 }
3344
3346 {
3347
3349 return;
3350
3351 string slot_name_mounted = slot_name + "_Mounted";
3352 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3353
3354
3356 RemoveProxyPhysics( slot_name_mounted );
3357 RemoveProxyPhysics( slot_name );
3358
3359 if ( attachment )
3360 {
3362 if ( is_locked )
3363 {
3365 AddProxyPhysics( slot_name_mounted );
3366 }
3367 else
3368 {
3370 AddProxyPhysics( slot_name );
3371 }
3372 }
3373 }
3374
3376 {
3377 SetAffectPathgraph( true, false );
3379 }
3380
3382 {
3383 return true;
3384 }
3385
3387 {
3388 return true;
3389 }
3390
3392 {
3393 if ( attachment )
3394 {
3396 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3397
3398 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3399 }
3400
3401 return false;
3402 }
3403
3405 {
3407 }
3408
3409
3411 {
3412 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3413 if (
g_Game.ConfigIsExisting( config_path ) )
3414 {
3415 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3416 }
3417 }
3418
3420 {
3421 return true;
3422 }
3423
3425 {
3426 return true;
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3434
3436 {
3439 }
3440
3442 {
3444 }
3445
3447 {
3449 }
3450
3452 {
3453 int attachment_count = GetInventory().AttachmentCount();
3454 if ( attachment_count > 0 )
3455 {
3456 if (
HasBase() && attachment_count == 1 )
3457 {
3458 return false;
3459 }
3460
3461 return true;
3462 }
3463
3464 return false;
3465 }
3466
3468 {
3469 return true;
3470 }
3471
3473 {
3474 return false;
3475 }
3476
3477
3479 {
3480 return false;
3481 }
3482
3484 {
3485 return false;
3486 }
3487
3488
3490 {
3491 return false;
3492 }
3493
3494
3495
3497 {
3498 return true;
3499 }
3500
3502 {
3503 return true;
3504 }
3505
3508 {
3509 return false;
3510 }
3511
3512
3514 {
3515 return false;
3516 }
3517
3518
3520 {
3521 return true;
3522 }
3523
3524
3526 {
3527 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3528 {
3529 return false;
3530 }
3531
3532 return true;
3533 }
3534
3536 {
3539
3540 return item;
3541 }
3542
3543
3545 {
3547 {
3548
3550
3551
3554
3556 if ( MemoryPointExists( slot_name + "_min" ) )
3557 {
3558 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3559 }
3560 if ( MemoryPointExists( slot_name + "_max" ) )
3561 {
3562 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3563 }
3564
3565
3568
3569
3572 center = ModelToWorld( center );
3573
3574
3577
3578 areaDamage.SetExtents( extents[0], extents[1] );
3579 areaDamage.SetAreaPosition( center );
3583 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3584 areaDamage.SetAmmoName( "BarbedWireHit" );
3585 areaDamage.Spawn();
3586
3588 }
3589 }
3590
3592 {
3593 if ( angle_deg != 0 )
3594 {
3595
3597
3598
3600 if ( MemoryPointExists( "rotate_axis" ) )
3601 {
3602 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3603 }
3604 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];
3605 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];
3606 center[0] = r_center_x;
3607 center[2] = r_center_z;
3608 }
3609 }
3610
3612 {
3614 {
3617 {
3618 if (areaDamage)
3619 {
3620 areaDamage.Destroy();
3621 }
3622
3624 }
3625 }
3626 }
3627
3629 {
3630 return true;
3631 }
3632
3633
3634
3635
3637 {
3639 }
3640
3642 {
3644 }
3645
3647 {
3649 }
3650
3652 {
3654
3655 switch ( material_type )
3656 {
3662 }
3663
3664 return "";
3665 }
3666
3668 {
3670
3671 switch ( material_type )
3672 {
3678 }
3679
3680 return "";
3681 }
3682
3683
3685 {
3687 {
3688
3690 {
3691 SetHealth(slot_name,"Health",item.GetHealth());
3692 }
3693 }
3694 }
3695
3697 {
3698 return 111;
3699 }
3700
3702 {
3703 super.SetActions();
3704
3708 }
3709
3711 {
3713 if (!construction)
3714 return;
3715
3717 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3718 {
3721 {
3723 }
3724 }
3725 }
3726
3728 {
3730 if (!construction)
3731 return;
3732
3734 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3735 {
3738 {
3739 construction.HandleEntityFalling(part.
GetPartName());
3740 }
3741 }
3742 }
3743
3746 {
3748 return;
3749
3752
3753 if (DestroyOnFall())
3754 {
3756 {
3758 }
3759 else
3760 {
3762 {
3764 }
3766 }
3767 }
3768 }
3769
3771 {
3772 if (HasAnyAttachmentsOrCargo())
3773 {
3776 }
3777 }
3778
3779
3780
3781
3782
3785 {
3786 return null;
3787 }
3788
3790 {
3792 }
3793
3795 {
3798
3799 Man p;
3800
3801 #ifdef SERVER
3803 g_Game.GetWorld().GetPlayerList(players);
3804 if (players.Count())
3805 p = players[0];
3806 #else
3808 #endif
3809
3811 {
3812 bool excluded = false;
3814 if (excludes)
3815 {
3816 foreach (string exclude : excludes)
3817 {
3819 {
3820 excluded = true;
3821 break;
3822 }
3823 }
3824 }
3825
3826 if (!excluded)
3827 {
3829 }
3830 }
3831
3833 }
3834
3836
3838 [
Obsolete(
"handled in the Construction component directly")]
3840 {
3841 }
3842
3843 [
Obsolete(
"handled in the Construction component directly")]
3845 {
3846 }
3847
3848 [
Obsolete(
"obsolete debug method")]
3850 {
3851 }
3852}
3853
3855{
3856#ifdef BSB_DEBUG
3858#else
3859
3860#endif
3861}
3863{
3864#ifdef BSB_DEBUG_SPAM
3866#else
3867
3868#endif
3869}
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.