Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
2511{
2513
2515
2517
2524
2525
2526
2532
2538
2540
2544
2545
2547 {
2549
2550
2551 RegisterNetSyncVariableInt( "m_SyncParts01" );
2552 RegisterNetSyncVariableInt( "m_SyncParts02" );
2553 RegisterNetSyncVariableInt( "m_SyncParts03" );
2554 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2555 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2556 RegisterNetSyncVariableBool( "m_HasBase" );
2557
2558
2559 ConstructionInit();
2560
2561 if (ConfigIsExisting("hybridAttachments"))
2562 {
2565 }
2566 if (ConfigIsExisting("mountables"))
2567 {
2570 }
2571
2573 SetAllowDamage(true);
2574 }
2575
2577 {
2578 return "disableBaseDamage";
2579 }
2580
2582 {
2583 return true;
2584 }
2585
2587 {
2588 return EInventoryIconVisibility.HIDE_VICINITY;
2589 }
2590
2592 {
2593 super.InitItemSounds();
2594
2598
2603 }
2604
2606 {
2607 return "putDown_FenceKit_SoundSet";
2608 }
2609
2611 {
2612 return "Shelter_Site_Build_Loop_SoundSet";
2613 }
2614
2615
2617 {
2619 {
2620 SetSynchDirty();
2621 }
2622 }
2623
2625 {
2627 super.OnVariablesSynchronized();
2628
2630 }
2631
2633 {
2634
2636
2637
2639
2640
2642 }
2643
2644
2646 {
2647
2648 int offset;
2649 int mask;
2650
2651 if ( part_id >= 1 && part_id <= 31 )
2652 {
2653 offset = part_id - 1;
2654 mask = 1 << offset;
2655
2657 }
2658 else if ( part_id >= 32 && part_id <= 62 )
2659 {
2660 offset = ( part_id % 32 );
2661 mask = 1 << offset;
2662
2664 }
2665 else if ( part_id >= 63 && part_id <= 93 )
2666 {
2667 offset = ( part_id % 63 );
2668 mask = 1 << offset;
2669
2671 }
2672 }
2673
2675 {
2676
2677 int offset;
2678 int mask;
2679
2680 if ( part_id >= 1 && part_id <= 31 )
2681 {
2682 offset = part_id - 1;
2683 mask = 1 << offset;
2684
2686 }
2687 else if ( part_id >= 32 && part_id <= 62 )
2688 {
2689 offset = ( part_id % 32 );
2690 mask = 1 << offset;
2691
2693 }
2694 else if ( part_id >= 63 && part_id <= 93 )
2695 {
2696 offset = ( part_id % 63 );
2697 mask = 1 << offset;
2698
2700 }
2701 }
2702
2704 {
2705
2706 int offset;
2707 int mask;
2708
2709 if ( part_id >= 1 && part_id <= 31 )
2710 {
2711 offset = part_id - 1;
2712 mask = 1 << offset;
2713
2715 {
2716 return true;
2717 }
2718 }
2719 else if ( part_id >= 32 && part_id <= 62 )
2720 {
2721 offset = ( part_id % 32 );
2722 mask = 1 << offset;
2723
2725 {
2726 return true;
2727 }
2728 }
2729 else if ( part_id >= 63 && part_id <= 93 )
2730 {
2731 offset = ( part_id % 63 );
2732 mask = 1 << offset;
2733
2735 {
2736 return true;
2737 }
2738 }
2739
2740 return false;
2741 }
2742
2744 {
2747 }
2748
2750 {
2751
2754 }
2755
2757 {
2759 {
2762
2763 switch( build_action_id )
2764 {
2768 }
2769 }
2770 }
2771
2772
2774 {
2776 bool is_base = part.
IsBase();
2779 if ( is_part_built_sync )
2780 {
2782 {
2786
2787 if (is_base)
2788 {
2791 }
2792 }
2793 }
2794 else
2795 {
2797 {
2801
2802 if (is_base)
2803 {
2806 }
2807 }
2808 }
2809
2810
2812 }
2813
2814
2816 {
2819
2820 for ( int i = 0; i < construction_parts.Count(); ++i )
2821 {
2822 string key = construction_parts.GetKey( i );
2825 }
2826
2827
2829 }
2830
2832 {
2835
2836 for ( int i = 0; i < construction_parts.Count(); ++i )
2837 {
2838 string key = construction_parts.GetKey( i );
2840
2841 if ( value.
GetId() ==
id )
2842 {
2843 return value;
2844 }
2845 }
2846
2847 return NULL;
2848 }
2849
2850
2851
2853 {
2855 }
2856
2858 {
2860 }
2861
2863 {
2864 return true;
2865 }
2866
2868 {
2869 return false;
2870 }
2871
2872
2874 {
2877 {
2879 }
2880
2881 return construction_kit;
2882 }
2883
2885 {
2888 {
2890 }
2891 }
2892
2894 {
2896 }
2897
2899 {
2900 return "";
2901 }
2902
2904 {
2906 g_Game.ObjectDelete( construction_kit );
2907 }
2908
2909
2911 {
2913 g_Game.ObjectDelete(
this );
2914 }
2915
2916
2918 {
2919 super.EEDelete(parent);
2920
2922 {
2923 areaDamage.Destroy();
2924 }
2925
2926 }
2927
2929 {
2930 super.OnStoreSave( ctx );
2931
2932
2936
2938 }
2939
2941 {
2942 if ( !super.OnStoreLoad( ctx, version ) )
2943 return false;
2944
2945
2946
2948 {
2950 return false;
2951 }
2953 {
2955 return false;
2956 }
2958 {
2960 return false;
2961 }
2962
2963
2965 {
2967 return false;
2968 }
2969
2970
2971 return true;
2972 }
2973
2975 {
2976 super.AfterStoreLoad();
2977
2979 {
2981 }
2982 }
2983
2985 {
2986
2988
2989
2992
2993
2995 }
2996
2998 {
2999 super.OnCreatePhysics();
3000
3001 ConstructionInit();
3003 }
3004
3006 {
3008 return;
3009
3010 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3011 }
3012
3014 {
3016 {
3018 }
3019
3020 super.EEOnAfterLoad();
3021 }
3022
3024 {
3025 super.EEItemAttached( item, slot_name );
3026
3030 }
3031
3033 {
3034 super.EEItemDetached( item, slot_name );
3035
3038 }
3039
3040 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3041 {
3044
3047 }
3048
3049
3051 {
3052 return true;
3053 }
3054
3055
3056
3058 {
3060
3061
3062 if (construtionPart.
IsBase())
3063 {
3065
3066
3068 }
3069
3070
3072
3073
3075
3076
3078
3080
3082
3083
3085
3086
3088 }
3089
3091 {
3092
3094 }
3095
3096
3098 {
3101
3102
3104
3105
3107
3108
3110
3111
3113
3115
3116
3118
3119
3121
3122
3123 if (construtionPart.
IsBase())
3124 {
3125
3127 }
3128 }
3129
3131 {
3132
3134 }
3135
3136
3137 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3138 {
3141
3142
3144
3145
3147
3148
3150
3151
3153
3155
3156
3158
3159
3161
3162
3163 if (construtionPart.
IsBase())
3164 {
3165
3167 }
3168 }
3169
3171 {
3172
3174 }
3175
3176
3178 {
3180
3183 }
3184
3186 {
3188
3190 {
3192 }
3193 else
3194 {
3196 }
3197
3199 }
3200
3202 {
3204
3206 foreach (
string slotName : attachmentSlots)
3207 {
3209 }
3210
3211
3214 else
3216
3218 }
3219
3221 {
3222 string slotNameMounted = slot_name + "_Mounted";
3223 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3224
3225 if (attachment)
3226 {
3227 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3228 if (barbedWire && barbedWire.IsMounted())
3230 else
3232
3233 if (is_locked)
3234 {
3235 SetAnimationPhase(slotNameMounted, 0);
3236 SetAnimationPhase(slot_name, 1);
3237 }
3238 else
3239 {
3240 SetAnimationPhase(slotNameMounted, 1);
3241 SetAnimationPhase(slot_name, 0);
3242 }
3243 }
3244 else
3245 {
3246 SetAnimationPhase(slotNameMounted, 1);
3247 SetAnimationPhase(slot_name, 1);
3248
3250 }
3251 }
3252
3253
3255 {
3258
3261
3264
3265 foreach (
string slotName : attachmentSlots)
3266 {
3268 }
3269
3270
3272 {
3275
3277 }
3278 else
3279 {
3282
3284 }
3285
3288 }
3289
3291 {
3292
3294 return;
3295
3296 string slot_name_mounted = slot_name + "_Mounted";
3297 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3298
3299
3301 RemoveProxyPhysics( slot_name_mounted );
3302 RemoveProxyPhysics( slot_name );
3303
3304 if ( attachment )
3305 {
3307 if ( is_locked )
3308 {
3310 AddProxyPhysics( slot_name_mounted );
3311 }
3312 else
3313 {
3315 AddProxyPhysics( slot_name );
3316 }
3317 }
3318 }
3319
3321 {
3322 SetAffectPathgraph( true, false );
3324 }
3325
3327 {
3328 return true;
3329 }
3330
3332 {
3333 return true;
3334 }
3335
3337 {
3338 if ( attachment )
3339 {
3341 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3342
3343 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3344 }
3345
3346 return false;
3347 }
3348
3350 {
3352 }
3353
3354
3356 {
3357 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3358 if (
g_Game.ConfigIsExisting( config_path ) )
3359 {
3360 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3361 }
3362 }
3363
3365 {
3366 return true;
3367 }
3368
3370 {
3371 return true;
3372 }
3373
3375 {
3376 return true;
3377 }
3378
3379
3381 {
3384 }
3385
3387 {
3389 }
3390
3392 {
3394 }
3395
3397 {
3398 int attachment_count = GetInventory().AttachmentCount();
3399 if ( attachment_count > 0 )
3400 {
3401 if (
HasBase() && attachment_count == 1 )
3402 {
3403 return false;
3404 }
3405
3406 return true;
3407 }
3408
3409 return false;
3410 }
3411
3413 {
3414 return true;
3415 }
3416
3418 {
3419 return false;
3420 }
3421
3422
3424 {
3425 return false;
3426 }
3427
3429 {
3430 return false;
3431 }
3432
3433
3435 {
3436 return false;
3437 }
3438
3439
3440
3442 {
3443 return true;
3444 }
3445
3447 {
3448 return true;
3449 }
3450
3453 {
3454 return false;
3455 }
3456
3457
3459 {
3460 return false;
3461 }
3462
3463
3465 {
3466 return true;
3467 }
3468
3469
3471 {
3472 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3473 {
3474 return false;
3475 }
3476
3477 return true;
3478 }
3479
3481 {
3484
3485 return item;
3486 }
3487
3488
3490 {
3492 {
3493
3495
3496
3499
3501 if ( MemoryPointExists( slot_name + "_min" ) )
3502 {
3503 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3504 }
3505 if ( MemoryPointExists( slot_name + "_max" ) )
3506 {
3507 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3508 }
3509
3510
3513
3514
3517 center = ModelToWorld( center );
3518
3519
3522
3523 areaDamage.SetExtents( extents[0], extents[1] );
3524 areaDamage.SetAreaPosition( center );
3528 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3529 areaDamage.SetAmmoName( "BarbedWireHit" );
3530 areaDamage.Spawn();
3531
3533 }
3534 }
3535
3537 {
3538 if ( angle_deg != 0 )
3539 {
3540
3542
3543
3545 if ( MemoryPointExists( "rotate_axis" ) )
3546 {
3547 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3548 }
3549 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];
3550 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];
3551 center[0] = r_center_x;
3552 center[2] = r_center_z;
3553 }
3554 }
3555
3557 {
3559 {
3562 {
3563 if (areaDamage)
3564 {
3565 areaDamage.Destroy();
3566 }
3567
3569 }
3570 }
3571 }
3572
3574 {
3575 return true;
3576 }
3577
3578
3579
3580
3582 {
3584 }
3585
3587 {
3589 }
3590
3592 {
3594 }
3595
3597 {
3599
3600 switch ( material_type )
3601 {
3607 }
3608
3609 return "";
3610 }
3611
3613 {
3615
3616 switch ( material_type )
3617 {
3623 }
3624
3625 return "";
3626 }
3627
3628
3630 {
3632 {
3633
3635 {
3636 SetHealth(slot_name,"Health",item.GetHealth());
3637 }
3638 }
3639 }
3640
3642 {
3643 return 111;
3644 }
3645
3647 {
3648 super.SetActions();
3649
3653 }
3654
3656 {
3658 if (!construction)
3659 return;
3660
3662 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3663 {
3666 {
3668 }
3669 }
3670 }
3671
3673 {
3675 if (!construction)
3676 return;
3677
3679 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3680 {
3683 {
3684 construction.HandleEntityFalling(part.
GetPartName());
3685 }
3686 }
3687 }
3688
3691 {
3693 return;
3694
3697
3698 if (DestroyOnFall())
3699 {
3701 {
3703 }
3704 else
3705 {
3707 {
3709 }
3711 }
3712 }
3713 }
3714
3716 {
3717 if (HasAnyAttachmentsOrCargo())
3718 {
3721 }
3722 }
3723
3724
3725
3726
3727
3730 {
3731 return null;
3732 }
3733
3735 {
3737 }
3738
3740 {
3743
3744 Man p;
3745
3746 #ifdef SERVER
3748 g_Game.GetWorld().GetPlayerList(players);
3749 if (players.Count())
3750 p = players[0];
3751 #else
3753 #endif
3754
3756 {
3757 bool excluded = false;
3759 if (excludes)
3760 {
3761 foreach (string exclude : excludes)
3762 {
3764 {
3765 excluded = true;
3766 break;
3767 }
3768 }
3769 }
3770
3771 if (!excluded)
3772 {
3774 }
3775 }
3776
3778 }
3779
3781
3783 [
Obsolete(
"handled in the Construction component directly")]
3785 {
3786 }
3787
3788 [
Obsolete(
"handled in the Construction component directly")]
3790 {
3791 }
3792
3793 [
Obsolete(
"obsolete debug method")]
3795 {
3796 }
3797}
3798
3800{
3801#ifdef BSB_DEBUG
3803#else
3804
3805#endif
3806}
3808{
3809#ifdef BSB_DEBUG_SPAM
3811#else
3812
3813#endif
3814}
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.