2516{
2518
2520
2522
2529
2530
2531
2537
2543
2545
2549
2550
2552 {
2554
2555
2556 RegisterNetSyncVariableInt( "m_SyncParts01" );
2557 RegisterNetSyncVariableInt( "m_SyncParts02" );
2558 RegisterNetSyncVariableInt( "m_SyncParts03" );
2559 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2560 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2561 RegisterNetSyncVariableBool( "m_HasBase" );
2562
2563
2564 ConstructionInit();
2565
2566 if (ConfigIsExisting("hybridAttachments"))
2567 {
2570 }
2571 if (ConfigIsExisting("mountables"))
2572 {
2575 }
2576
2578 SetAllowDamage(true);
2579 }
2580
2582 {
2583 return "disableBaseDamage";
2584 }
2585
2587 {
2588 return true;
2589 }
2590
2592 {
2593 return EInventoryIconVisibility.HIDE_VICINITY;
2594 }
2595
2597 {
2598 super.InitItemSounds();
2599
2603
2608 }
2609
2611 {
2612 return "putDown_FenceKit_SoundSet";
2613 }
2614
2616 {
2617 return "Shelter_Site_Build_Loop_SoundSet";
2618 }
2619
2620
2622 {
2624 {
2625 SetSynchDirty();
2626 }
2627 }
2628
2630 {
2632 super.OnVariablesSynchronized();
2633
2635 }
2636
2638 {
2639
2641
2642
2644
2645
2647 }
2648
2649
2651 {
2652
2653 int offset;
2654 int mask;
2655
2656 if ( part_id >= 1 && part_id <= 31 )
2657 {
2658 offset = part_id - 1;
2659 mask = 1 << offset;
2660
2662 }
2663 else if ( part_id >= 32 && part_id <= 62 )
2664 {
2665 offset = ( part_id % 32 );
2666 mask = 1 << offset;
2667
2669 }
2670 else if ( part_id >= 63 && part_id <= 93 )
2671 {
2672 offset = ( part_id % 63 );
2673 mask = 1 << offset;
2674
2676 }
2677 }
2678
2680 {
2681
2682 int offset;
2683 int mask;
2684
2685 if ( part_id >= 1 && part_id <= 31 )
2686 {
2687 offset = part_id - 1;
2688 mask = 1 << offset;
2689
2691 }
2692 else if ( part_id >= 32 && part_id <= 62 )
2693 {
2694 offset = ( part_id % 32 );
2695 mask = 1 << offset;
2696
2698 }
2699 else if ( part_id >= 63 && part_id <= 93 )
2700 {
2701 offset = ( part_id % 63 );
2702 mask = 1 << offset;
2703
2705 }
2706 }
2707
2709 {
2710
2711 int offset;
2712 int mask;
2713
2714 if ( part_id >= 1 && part_id <= 31 )
2715 {
2716 offset = part_id - 1;
2717 mask = 1 << offset;
2718
2720 {
2721 return true;
2722 }
2723 }
2724 else if ( part_id >= 32 && part_id <= 62 )
2725 {
2726 offset = ( part_id % 32 );
2727 mask = 1 << offset;
2728
2730 {
2731 return true;
2732 }
2733 }
2734 else if ( part_id >= 63 && part_id <= 93 )
2735 {
2736 offset = ( part_id % 63 );
2737 mask = 1 << offset;
2738
2740 {
2741 return true;
2742 }
2743 }
2744
2745 return false;
2746 }
2747
2749 {
2752 }
2753
2755 {
2756
2759 }
2760
2762 {
2764 {
2767
2768 switch( build_action_id )
2769 {
2773 }
2774 }
2775 }
2776
2777
2779 {
2781 bool is_base = part.
IsBase();
2784 if ( is_part_built_sync )
2785 {
2787 {
2791
2792 if (is_base)
2793 {
2796 }
2797 }
2798 }
2799 else
2800 {
2802 {
2806
2807 if (is_base)
2808 {
2811 }
2812 }
2813 }
2814
2815
2817 }
2818
2819
2821 {
2824
2825 for ( int i = 0; i < construction_parts.Count(); ++i )
2826 {
2827 string key = construction_parts.GetKey( i );
2830 }
2831
2832
2834 }
2835
2837 {
2840
2841 for ( int i = 0; i < construction_parts.Count(); ++i )
2842 {
2843 string key = construction_parts.GetKey( i );
2845
2846 if ( value.
GetId() ==
id )
2847 {
2848 return value;
2849 }
2850 }
2851
2852 return NULL;
2853 }
2854
2855
2856
2858 {
2860 }
2861
2863 {
2865 }
2866
2868 {
2869 return true;
2870 }
2871
2873 {
2874 return false;
2875 }
2876
2877
2879 {
2882 {
2884 }
2885
2886 return construction_kit;
2887 }
2888
2890 {
2893 {
2895 }
2896 }
2897
2899 {
2901 }
2902
2904 {
2905 return "";
2906 }
2907
2909 {
2911 g_Game.ObjectDelete( construction_kit );
2912 }
2913
2914
2916 {
2918 g_Game.ObjectDelete(
this );
2919 }
2920
2921
2923 {
2924 super.EEDelete(parent);
2925
2927 {
2928 areaDamage.Destroy();
2929 }
2930
2931 }
2932
2934 {
2935 super.OnStoreSave( ctx );
2936
2937
2941
2943 }
2944
2946 {
2947 if ( !super.OnStoreLoad( ctx, version ) )
2948 return false;
2949
2950
2951
2953 {
2955 return false;
2956 }
2958 {
2960 return false;
2961 }
2963 {
2965 return false;
2966 }
2967
2968
2970 {
2972 return false;
2973 }
2974
2975
2976 return true;
2977 }
2978
2980 {
2981 super.AfterStoreLoad();
2982
2984 {
2986 }
2987 }
2988
2990 {
2991
2993
2994
2997
2998
3000 }
3001
3003 {
3004 super.OnCreatePhysics();
3005
3006 ConstructionInit();
3008 }
3009
3011 {
3013 return;
3014
3015 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3016 }
3017
3019 {
3021 {
3023 }
3024
3025 super.EEOnAfterLoad();
3026 }
3027
3029 {
3030 super.EEItemAttached( item, slot_name );
3031
3035 }
3036
3038 {
3039 super.EEItemDetached( item, slot_name );
3040
3043 }
3044
3045 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3046 {
3049
3052 }
3053
3054
3056 {
3057 return true;
3058 }
3059
3060
3061
3063 {
3065
3066
3067 if (construtionPart.
IsBase())
3068 {
3070
3071
3073 }
3074
3075
3077
3078
3080
3081
3083
3085
3087
3088
3090
3091
3093 }
3094
3096 {
3097
3099 }
3100
3101
3103 {
3106
3107
3109
3110
3112
3113
3115
3116
3118
3120
3121
3123
3124
3126
3127
3128 if (construtionPart.
IsBase())
3129 {
3130
3132 }
3133 }
3134
3136 {
3137
3139 }
3140
3141
3142 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3143 {
3146
3147
3149
3150
3152
3153
3155
3156
3158
3160
3161
3163
3164
3166
3167
3168 if (construtionPart.
IsBase())
3169 {
3170
3172 }
3173 }
3174
3176 {
3177
3179 }
3180
3181
3183 {
3185
3188 }
3189
3191 {
3193
3195 {
3197 }
3198 else
3199 {
3201 }
3202
3204 }
3205
3207 {
3209
3211 foreach (
string slotName : attachmentSlots)
3212 {
3214 }
3215
3216
3219 else
3221
3223 }
3224
3226 {
3227 string slotNameMounted = slot_name + "_Mounted";
3228 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3229
3230 if (attachment)
3231 {
3232 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3233 if (barbedWire && barbedWire.IsMounted())
3235 else
3237
3238 if (is_locked)
3239 {
3240 SetAnimationPhase(slotNameMounted, 0);
3241 SetAnimationPhase(slot_name, 1);
3242 }
3243 else
3244 {
3245 SetAnimationPhase(slotNameMounted, 1);
3246 SetAnimationPhase(slot_name, 0);
3247 }
3248 }
3249 else
3250 {
3251 SetAnimationPhase(slotNameMounted, 1);
3252 SetAnimationPhase(slot_name, 1);
3253
3255 }
3256 }
3257
3258
3260 {
3263
3266
3269
3270 foreach (
string slotName : attachmentSlots)
3271 {
3273 }
3274
3275
3277 {
3280
3282 }
3283 else
3284 {
3287
3289 }
3290
3293 }
3294
3296 {
3297
3299 return;
3300
3301 string slot_name_mounted = slot_name + "_Mounted";
3302 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3303
3304
3306 RemoveProxyPhysics( slot_name_mounted );
3307 RemoveProxyPhysics( slot_name );
3308
3309 if ( attachment )
3310 {
3312 if ( is_locked )
3313 {
3315 AddProxyPhysics( slot_name_mounted );
3316 }
3317 else
3318 {
3320 AddProxyPhysics( slot_name );
3321 }
3322 }
3323 }
3324
3326 {
3327 SetAffectPathgraph( true, false );
3329 }
3330
3332 {
3333 return true;
3334 }
3335
3337 {
3338 return true;
3339 }
3340
3342 {
3343 if ( attachment )
3344 {
3346 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3347
3348 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3349 }
3350
3351 return false;
3352 }
3353
3355 {
3357 }
3358
3359
3361 {
3362 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3363 if (
g_Game.ConfigIsExisting( config_path ) )
3364 {
3365 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3366 }
3367 }
3368
3370 {
3371 return true;
3372 }
3373
3375 {
3376 return true;
3377 }
3378
3380 {
3381 return true;
3382 }
3383
3384
3386 {
3389 }
3390
3392 {
3394 }
3395
3397 {
3399 }
3400
3402 {
3403 int attachment_count = GetInventory().AttachmentCount();
3404 if ( attachment_count > 0 )
3405 {
3406 if (
HasBase() && attachment_count == 1 )
3407 {
3408 return false;
3409 }
3410
3411 return true;
3412 }
3413
3414 return false;
3415 }
3416
3418 {
3419 return true;
3420 }
3421
3423 {
3424 return false;
3425 }
3426
3427
3429 {
3430 return false;
3431 }
3432
3434 {
3435 return false;
3436 }
3437
3438
3440 {
3441 return false;
3442 }
3443
3444
3445
3447 {
3448 return true;
3449 }
3450
3452 {
3453 return true;
3454 }
3455
3458 {
3459 return false;
3460 }
3461
3462
3464 {
3465 return false;
3466 }
3467
3468
3470 {
3471 return true;
3472 }
3473
3474
3476 {
3477 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3478 {
3479 return false;
3480 }
3481
3482 return true;
3483 }
3484
3486 {
3489
3490 return item;
3491 }
3492
3493
3495 {
3497 {
3498
3500
3501
3504
3506 if ( MemoryPointExists( slot_name + "_min" ) )
3507 {
3508 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3509 }
3510 if ( MemoryPointExists( slot_name + "_max" ) )
3511 {
3512 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3513 }
3514
3515
3518
3519
3522 center = ModelToWorld( center );
3523
3524
3527
3528 areaDamage.SetExtents( extents[0], extents[1] );
3529 areaDamage.SetAreaPosition( center );
3533 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3534 areaDamage.SetAmmoName( "BarbedWireHit" );
3535 areaDamage.Spawn();
3536
3538 }
3539 }
3540
3542 {
3543 if ( angle_deg != 0 )
3544 {
3545
3547
3548
3550 if ( MemoryPointExists( "rotate_axis" ) )
3551 {
3552 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3553 }
3554 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];
3555 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];
3556 center[0] = r_center_x;
3557 center[2] = r_center_z;
3558 }
3559 }
3560
3562 {
3564 {
3567 {
3568 if (areaDamage)
3569 {
3570 areaDamage.Destroy();
3571 }
3572
3574 }
3575 }
3576 }
3577
3579 {
3580 return true;
3581 }
3582
3583
3584
3585
3587 {
3589 }
3590
3592 {
3594 }
3595
3597 {
3599 }
3600
3602 {
3604
3605 switch ( material_type )
3606 {
3612 }
3613
3614 return "";
3615 }
3616
3618 {
3620
3621 switch ( material_type )
3622 {
3628 }
3629
3630 return "";
3631 }
3632
3633
3635 {
3637 {
3638
3640 {
3641 SetHealth(slot_name,"Health",item.GetHealth());
3642 }
3643 }
3644 }
3645
3647 {
3648 return 111;
3649 }
3650
3652 {
3653 super.SetActions();
3654
3658 }
3659
3661 {
3663 if (!construction)
3664 return;
3665
3667 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3668 {
3671 {
3673 }
3674 }
3675 }
3676
3678 {
3680 if (!construction)
3681 return;
3682
3684 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3685 {
3688 {
3689 construction.HandleEntityFalling(part.
GetPartName());
3690 }
3691 }
3692 }
3693
3696 {
3698 return;
3699
3702
3703 if (DestroyOnFall())
3704 {
3706 {
3708 }
3709 else
3710 {
3712 {
3714 }
3716 }
3717 }
3718 }
3719
3721 {
3722 if (HasAnyAttachmentsOrCargo())
3723 {
3726 }
3727 }
3728
3729
3730
3731
3732
3735 {
3736 return null;
3737 }
3738
3740 {
3742 }
3743
3745 {
3748
3749 Man p;
3750
3751 #ifdef SERVER
3753 g_Game.GetWorld().GetPlayerList(players);
3754 if (players.Count())
3755 p = players[0];
3756 #else
3758 #endif
3759
3761 {
3762 bool excluded = false;
3764 if (excludes)
3765 {
3766 foreach (string exclude : excludes)
3767 {
3769 {
3770 excluded = true;
3771 break;
3772 }
3773 }
3774 }
3775
3776 if (!excluded)
3777 {
3779 }
3780 }
3781
3783 }
3784
3786
3788 [
Obsolete(
"handled in the Construction component directly")]
3790 {
3791 }
3792
3793 [
Obsolete(
"handled in the Construction component directly")]
3795 {
3796 }
3797
3798 [
Obsolete(
"obsolete debug method")]
3800 {
3801 }
3802}
3803
3805{
3806#ifdef BSB_DEBUG
3808#else
3809
3810#endif
3811}
3813{
3814#ifdef BSB_DEBUG_SPAM
3816#else
3817
3818#endif
3819}
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.