2576{
2578
2580
2582
2589
2590
2591
2597
2603
2605
2609
2610
2612 {
2614
2615
2616 RegisterNetSyncVariableInt( "m_SyncParts01" );
2617 RegisterNetSyncVariableInt( "m_SyncParts02" );
2618 RegisterNetSyncVariableInt( "m_SyncParts03" );
2619 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2620 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2621 RegisterNetSyncVariableBool( "m_HasBase" );
2622
2623
2624 ConstructionInit();
2625
2626 if (ConfigIsExisting("hybridAttachments"))
2627 {
2630 }
2631 if (ConfigIsExisting("mountables"))
2632 {
2635 }
2636
2638 SetAllowDamage(true);
2639 }
2640
2642 {
2643 return "disableBaseDamage";
2644 }
2645
2647 {
2648 return true;
2649 }
2650
2652 {
2653 return EInventoryIconVisibility.HIDE_VICINITY;
2654 }
2655
2657 {
2658 super.InitItemSounds();
2659
2663
2668 }
2669
2671 {
2672 return "putDown_FenceKit_SoundSet";
2673 }
2674
2676 {
2677 return "Shelter_Site_Build_Loop_SoundSet";
2678 }
2679
2680
2682 {
2684 {
2685 SetSynchDirty();
2686 }
2687 }
2688
2690 {
2692 super.OnVariablesSynchronized();
2693
2695 }
2696
2698 {
2699
2701
2702
2704
2705
2707 }
2708
2709
2711 {
2712
2713 int offset;
2714 int mask;
2715
2716 if ( part_id >= 1 && part_id <= 31 )
2717 {
2718 offset = part_id - 1;
2719 mask = 1 << offset;
2720
2722 }
2723 else if ( part_id >= 32 && part_id <= 62 )
2724 {
2725 offset = ( part_id % 32 );
2726 mask = 1 << offset;
2727
2729 }
2730 else if ( part_id >= 63 && part_id <= 93 )
2731 {
2732 offset = ( part_id % 63 );
2733 mask = 1 << offset;
2734
2736 }
2737 }
2738
2740 {
2741
2742 int offset;
2743 int mask;
2744
2745 if ( part_id >= 1 && part_id <= 31 )
2746 {
2747 offset = part_id - 1;
2748 mask = 1 << offset;
2749
2751 }
2752 else if ( part_id >= 32 && part_id <= 62 )
2753 {
2754 offset = ( part_id % 32 );
2755 mask = 1 << offset;
2756
2758 }
2759 else if ( part_id >= 63 && part_id <= 93 )
2760 {
2761 offset = ( part_id % 63 );
2762 mask = 1 << offset;
2763
2765 }
2766 }
2767
2769 {
2770
2771 int offset;
2772 int mask;
2773
2774 if ( part_id >= 1 && part_id <= 31 )
2775 {
2776 offset = part_id - 1;
2777 mask = 1 << offset;
2778
2780 {
2781 return true;
2782 }
2783 }
2784 else if ( part_id >= 32 && part_id <= 62 )
2785 {
2786 offset = ( part_id % 32 );
2787 mask = 1 << offset;
2788
2790 {
2791 return true;
2792 }
2793 }
2794 else if ( part_id >= 63 && part_id <= 93 )
2795 {
2796 offset = ( part_id % 63 );
2797 mask = 1 << offset;
2798
2800 {
2801 return true;
2802 }
2803 }
2804
2805 return false;
2806 }
2807
2809 {
2812 }
2813
2815 {
2816
2819 }
2820
2822 {
2824 {
2827
2828 switch( build_action_id )
2829 {
2833 }
2834 }
2835 }
2836
2837
2839 {
2841 bool is_base = part.
IsBase();
2844 if ( is_part_built_sync )
2845 {
2847 {
2851
2852 if (is_base)
2853 {
2856 }
2857 }
2858 }
2859 else
2860 {
2862 {
2866
2867 if (is_base)
2868 {
2871 }
2872 }
2873 }
2874
2875
2877 }
2878
2879
2881 {
2884
2885 for ( int i = 0; i < construction_parts.Count(); ++i )
2886 {
2887 string key = construction_parts.GetKey( i );
2890 }
2891
2892
2894 }
2895
2897 {
2900
2901 for ( int i = 0; i < construction_parts.Count(); ++i )
2902 {
2903 string key = construction_parts.GetKey( i );
2905
2906 if ( value.
GetId() ==
id )
2907 {
2908 return value;
2909 }
2910 }
2911
2912 return NULL;
2913 }
2914
2915
2916
2918 {
2920 }
2921
2923 {
2925 }
2926
2928 {
2929 return true;
2930 }
2931
2933 {
2934 return false;
2935 }
2936
2937
2939 {
2942 {
2944 }
2945
2946 return construction_kit;
2947 }
2948
2950 {
2953 {
2955 }
2956 }
2957
2959 {
2961 }
2962
2964 {
2965 return "";
2966 }
2967
2969 {
2971 g_Game.ObjectDelete( construction_kit );
2972 }
2973
2974
2976 {
2978 g_Game.ObjectDelete(
this );
2979 }
2980
2981
2983 {
2984 super.EEDelete(parent);
2985
2987 {
2988 areaDamage.Destroy();
2989 }
2990
2991 }
2992
2994 {
2995 super.OnStoreSave( ctx );
2996
2997
3001
3003 }
3004
3006 {
3007 if ( !super.OnStoreLoad( ctx, version ) )
3008 return false;
3009
3010
3011
3013 {
3015 return false;
3016 }
3018 {
3020 return false;
3021 }
3023 {
3025 return false;
3026 }
3027
3028
3030 {
3032 return false;
3033 }
3034
3035
3036 return true;
3037 }
3038
3040 {
3041 super.AfterStoreLoad();
3042
3044 {
3046 }
3047 }
3048
3050 {
3051
3053
3054
3057
3058
3060 }
3061
3063 {
3064 super.OnCreatePhysics();
3065
3066 ConstructionInit();
3068 }
3069
3071 {
3073 return;
3074
3075 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3076 }
3077
3079 {
3081 {
3083 }
3084
3085 super.EEOnAfterLoad();
3086 }
3087
3089 {
3090 super.EEItemAttached( item, slot_name );
3091
3095 }
3096
3098 {
3099 super.EEItemDetached( item, slot_name );
3100
3103 }
3104
3105 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3106 {
3109
3112 }
3113
3114
3116 {
3117 return true;
3118 }
3119
3120
3121
3123 {
3125
3126
3127 if (construtionPart.
IsBase())
3128 {
3130
3131
3133 }
3134
3135
3137
3138
3140
3141
3143
3145
3147
3148
3150
3151
3153 }
3154
3156 {
3157
3159 }
3160
3161
3163 {
3166
3167
3169
3170
3172
3173
3175
3176
3178
3180
3181
3183
3184
3186
3187
3188 if (construtionPart.
IsBase())
3189 {
3190
3192 }
3193 }
3194
3196 {
3197
3199 }
3200
3201
3202 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3203 {
3206
3207
3209
3210
3212
3213
3215
3216
3218
3220
3221
3223
3224
3226
3227
3228 if (construtionPart.
IsBase())
3229 {
3230
3232 }
3233 }
3234
3236 {
3237
3239 }
3240
3241
3243 {
3245
3248 }
3249
3251 {
3253
3255 {
3257 }
3258 else
3259 {
3261 }
3262
3264 }
3265
3267 {
3269
3271 foreach (
string slotName : attachmentSlots)
3272 {
3274 }
3275
3276
3279 else
3281
3283 }
3284
3286 {
3287 string slotNameMounted = slot_name + "_Mounted";
3288 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3289
3290 if (attachment)
3291 {
3292 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3293 if (barbedWire && barbedWire.IsMounted())
3295 else
3297
3298 if (is_locked)
3299 {
3300 SetAnimationPhase(slotNameMounted, 0);
3301 SetAnimationPhase(slot_name, 1);
3302 }
3303 else
3304 {
3305 SetAnimationPhase(slotNameMounted, 1);
3306 SetAnimationPhase(slot_name, 0);
3307 }
3308 }
3309 else
3310 {
3311 SetAnimationPhase(slotNameMounted, 1);
3312 SetAnimationPhase(slot_name, 1);
3313
3315 }
3316 }
3317
3318
3320 {
3323
3326
3329
3330 foreach (
string slotName : attachmentSlots)
3331 {
3333 }
3334
3335
3337 {
3340
3342 }
3343 else
3344 {
3347
3349 }
3350
3353 }
3354
3356 {
3357
3359 return;
3360
3361 string slot_name_mounted = slot_name + "_Mounted";
3362 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3363
3364
3366 RemoveProxyPhysics( slot_name_mounted );
3367 RemoveProxyPhysics( slot_name );
3368
3369 if ( attachment )
3370 {
3372 if ( is_locked )
3373 {
3375 AddProxyPhysics( slot_name_mounted );
3376 }
3377 else
3378 {
3380 AddProxyPhysics( slot_name );
3381 }
3382 }
3383 }
3384
3386 {
3387 SetAffectPathgraph( true, false );
3389 }
3390
3392 {
3393 return true;
3394 }
3395
3397 {
3398 return true;
3399 }
3400
3402 {
3403 if ( attachment )
3404 {
3406 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3407
3408 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3409 }
3410
3411 return false;
3412 }
3413
3415 {
3417 }
3418
3419
3421 {
3422 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3423 if (
g_Game.ConfigIsExisting( config_path ) )
3424 {
3425 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3426 }
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3435 {
3436 return true;
3437 }
3438
3440 {
3441 return true;
3442 }
3443
3444
3446 {
3449 }
3450
3452 {
3454 }
3455
3457 {
3459 }
3460
3462 {
3463 int attachment_count = GetInventory().AttachmentCount();
3464 if ( attachment_count > 0 )
3465 {
3466 if (
HasBase() && attachment_count == 1 )
3467 {
3468 return false;
3469 }
3470
3471 return true;
3472 }
3473
3474 return false;
3475 }
3476
3478 {
3479 return true;
3480 }
3481
3483 {
3484 return false;
3485 }
3486
3487
3489 {
3490 return false;
3491 }
3492
3494 {
3495 return false;
3496 }
3497
3498
3500 {
3501 return false;
3502 }
3503
3504
3505
3507 {
3508 return true;
3509 }
3510
3512 {
3513 return true;
3514 }
3515
3518 {
3519 return false;
3520 }
3521
3522
3524 {
3525 return false;
3526 }
3527
3528
3530 {
3531 return true;
3532 }
3533
3534
3536 {
3537 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3538 {
3539 return false;
3540 }
3541
3542 return true;
3543 }
3544
3546 {
3549
3550 return item;
3551 }
3552
3553
3555 {
3557 {
3558
3560
3561
3564
3566 if ( MemoryPointExists( slot_name + "_min" ) )
3567 {
3568 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3569 }
3570 if ( MemoryPointExists( slot_name + "_max" ) )
3571 {
3572 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3573 }
3574
3575
3578
3579
3582 center = ModelToWorld( center );
3583
3584
3587
3588 areaDamage.SetExtents( extents[0], extents[1] );
3589 areaDamage.SetAreaPosition( center );
3593 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3594 areaDamage.SetAmmoName( "BarbedWireHit" );
3595 areaDamage.Spawn();
3596
3598 }
3599 }
3600
3602 {
3603 if ( angle_deg != 0 )
3604 {
3605
3607
3608
3610 if ( MemoryPointExists( "rotate_axis" ) )
3611 {
3612 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3613 }
3614 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];
3615 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];
3616 center[0] = r_center_x;
3617 center[2] = r_center_z;
3618 }
3619 }
3620
3622 {
3624 {
3627 {
3628 if (areaDamage)
3629 {
3630 areaDamage.Destroy();
3631 }
3632
3634 }
3635 }
3636 }
3637
3639 {
3640 return true;
3641 }
3642
3643
3644
3645
3647 {
3649 }
3650
3652 {
3654 }
3655
3657 {
3659 }
3660
3662 {
3664
3665 switch ( material_type )
3666 {
3672 }
3673
3674 return "";
3675 }
3676
3678 {
3680
3681 switch ( material_type )
3682 {
3688 }
3689
3690 return "";
3691 }
3692
3693
3695 {
3697 {
3698
3700 {
3701 SetHealth(slot_name,"Health",item.GetHealth());
3702 }
3703 }
3704 }
3705
3707 {
3708 return 111;
3709 }
3710
3712 {
3713 super.SetActions();
3714
3718 }
3719
3721 {
3723 if (!construction)
3724 return;
3725
3727 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3728 {
3731 {
3733 }
3734 }
3735 }
3736
3738 {
3740 if (!construction)
3741 return;
3742
3744 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3745 {
3748 {
3749 construction.HandleEntityFalling(part.
GetPartName());
3750 }
3751 }
3752 }
3753
3756 {
3758 return;
3759
3762
3763 if (DestroyOnFall())
3764 {
3766 {
3768 }
3769 else
3770 {
3772 {
3774 }
3776 }
3777 }
3778 }
3779
3781 {
3782 if (HasAnyAttachmentsOrCargo())
3783 {
3786 }
3787 }
3788
3789
3790
3791
3792
3795 {
3796 return null;
3797 }
3798
3800 {
3802 }
3803
3805 {
3808
3809 Man p;
3810
3811 #ifdef SERVER
3813 g_Game.GetWorld().GetPlayerList(players);
3814 if (players.Count())
3815 p = players[0];
3816 #else
3818 #endif
3819
3821 {
3822 bool excluded = false;
3824 if (excludes)
3825 {
3826 foreach (string exclude : excludes)
3827 {
3829 {
3830 excluded = true;
3831 break;
3832 }
3833 }
3834 }
3835
3836 if (!excluded)
3837 {
3839 }
3840 }
3841
3843 }
3844
3846
3848 [
Obsolete(
"handled in the Construction component directly")]
3850 {
3851 }
3852
3853 [
Obsolete(
"handled in the Construction component directly")]
3855 {
3856 }
3857
3858 [
Obsolete(
"obsolete debug method")]
3860 {
3861 }
3862}
3863
3865{
3866#ifdef BSB_DEBUG
3868#else
3869
3870#endif
3871}
3873{
3874#ifdef BSB_DEBUG_SPAM
3876#else
3877
3878#endif
3879}
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.