2536{
2538
2540
2542
2544
2550
2551
2552
2558
2564
2566
2570
2571
2573 {
2575
2576
2577 RegisterNetSyncVariableInt( "m_SyncParts01" );
2578 RegisterNetSyncVariableInt( "m_SyncParts02" );
2579 RegisterNetSyncVariableInt( "m_SyncParts03" );
2580 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2581 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2582 RegisterNetSyncVariableBool( "m_HasBase" );
2583
2584
2586
2587 if (ConfigIsExisting("hybridAttachments"))
2588 {
2591 }
2592 if (ConfigIsExisting("mountables"))
2593 {
2596 }
2597
2599 }
2600
2602 {
2603 super.EEDelete(parent);
2604
2606 {
2607 areaDamage.Destroy();
2608 }
2609
2610 }
2611
2613 {
2614 return "disableBaseDamage";
2615 }
2616
2618 {
2619 return true;
2620 }
2621
2623 {
2624 return EInventoryIconVisibility.HIDE_VICINITY;
2625 }
2626
2627
2629 {
2631 {
2632 SetSynchDirty();
2633 }
2634 }
2635
2637 {
2639 super.OnVariablesSynchronized();
2640
2642 }
2643
2645 {
2646
2648
2649
2651
2652
2654 }
2655
2656
2658 {
2659
2660 int offset;
2661 int mask;
2662
2663 if ( part_id >= 1 && part_id <= 31 )
2664 {
2665 offset = part_id - 1;
2666 mask = 1 << offset;
2667
2669 }
2670 else if ( part_id >= 32 && part_id <= 62 )
2671 {
2672 offset = ( part_id % 32 );
2673 mask = 1 << offset;
2674
2676 }
2677 else if ( part_id >= 63 && part_id <= 93 )
2678 {
2679 offset = ( part_id % 63 );
2680 mask = 1 << offset;
2681
2683 }
2684 }
2685
2687 {
2688
2689 int offset;
2690 int mask;
2691
2692 if ( part_id >= 1 && part_id <= 31 )
2693 {
2694 offset = part_id - 1;
2695 mask = 1 << offset;
2696
2698 }
2699 else if ( part_id >= 32 && part_id <= 62 )
2700 {
2701 offset = ( part_id % 32 );
2702 mask = 1 << offset;
2703
2705 }
2706 else if ( part_id >= 63 && part_id <= 93 )
2707 {
2708 offset = ( part_id % 63 );
2709 mask = 1 << offset;
2710
2712 }
2713 }
2714
2716 {
2717
2718 int offset;
2719 int mask;
2720
2721 if ( part_id >= 1 && part_id <= 31 )
2722 {
2723 offset = part_id - 1;
2724 mask = 1 << offset;
2725
2727 {
2728 return true;
2729 }
2730 }
2731 else if ( part_id >= 32 && part_id <= 62 )
2732 {
2733 offset = ( part_id % 32 );
2734 mask = 1 << offset;
2735
2737 {
2738 return true;
2739 }
2740 }
2741 else if ( part_id >= 63 && part_id <= 93 )
2742 {
2743 offset = ( part_id % 63 );
2744 mask = 1 << offset;
2745
2747 {
2748 return true;
2749 }
2750 }
2751
2752 return false;
2753 }
2754
2756 {
2759 }
2760
2762 {
2763
2766 }
2767
2769 {
2771 {
2774
2775 switch( build_action_id )
2776 {
2780 }
2781 }
2782 }
2783
2784
2786 {
2788 bool is_base = part.
IsBase();
2791 if ( is_part_built_sync )
2792 {
2794 {
2798
2799 if (is_base)
2800 {
2803 }
2804 }
2805 }
2806 else
2807 {
2809 {
2813
2814 if (is_base)
2815 {
2818 }
2819 }
2820 }
2821
2822
2824 }
2825
2826
2828 {
2831
2832 for ( int i = 0; i < construction_parts.Count(); ++i )
2833 {
2834 string key = construction_parts.GetKey( i );
2837 }
2838
2839
2841 }
2842
2844 {
2847
2848 for ( int i = 0; i < construction_parts.Count(); ++i )
2849 {
2850 string key = construction_parts.GetKey( i );
2852
2853 if ( value.
GetId() ==
id )
2854 {
2855 return value;
2856 }
2857 }
2858
2859 return NULL;
2860 }
2861
2862
2863
2865 {
2867 }
2868
2870 {
2872 }
2873
2875 {
2876 return true;
2877 }
2878
2880 {
2881 return false;
2882 }
2883
2884
2886 {
2889 {
2891 }
2892
2893 return construction_kit;
2894 }
2895
2897 {
2900 {
2902 }
2903 }
2904
2906 {
2908 }
2909
2911 {
2912 return "";
2913 }
2914
2916 {
2919 }
2920
2921
2923 {
2926 }
2927
2928
2930 {
2931 super.OnStoreSave( ctx );
2932
2933
2937
2939 }
2940
2942 {
2943 if ( !super.OnStoreLoad( ctx, version ) )
2944 return false;
2945
2946
2947
2949 {
2951 return false;
2952 }
2954 {
2956 return false;
2957 }
2959 {
2961 return false;
2962 }
2963
2964
2966 {
2968 return false;
2969 }
2970
2971
2972 return true;
2973 }
2974
2976 {
2977 super.AfterStoreLoad();
2978
2980 {
2982 }
2983 }
2984
2986 {
2987
2989
2990
2993
2994
2996 }
2997
2999 {
3000 super.OnCreatePhysics();
3003 }
3004
3006 {
3008 return;
3009
3010 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3011
3013 return;
3014
3016 string part_name = zone;
3018
3020 {
3021 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
3022
3023 if ( construction_part && construction.IsPartConstructed( part_name ) )
3024 {
3026 construction.DestroyConnectedParts(part_name);
3027 }
3028
3029
3030 if ( part_name.
Contains(
"barbed") )
3031 {
3032 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3033 if (barbed_wire)
3034 barbed_wire.SetMountedState( false );
3035 }
3036 }
3037 }
3038
3040 {
3042 {
3044 }
3045
3046 super.EEOnAfterLoad();
3047 }
3048
3050 {
3051 super.EEInit();
3052
3053
3055
3056
3057 #ifdef DEVELOPER
3059 #endif
3060 }
3061
3063 {
3064 super.EEItemAttached( item, slot_name );
3065
3069 }
3070
3072 {
3073 super.EEItemDetached( item, slot_name );
3074
3077 }
3078
3079 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3080 {
3083
3086 }
3087
3088
3090 {
3091 return true;
3092 }
3093
3094
3095
3097 {
3099
3100
3101 if (construtionPart.
IsBase())
3102 {
3104
3105
3107 }
3108
3109
3111
3112
3114
3115
3117
3119
3121
3122
3124
3125
3127 }
3128
3130 {
3131
3133 }
3134
3135
3137 {
3140
3141
3143
3144
3146
3147
3149
3150
3152
3154
3155
3157
3158
3160
3161
3162 if (construtionPart.
IsBase())
3163 {
3164
3166 }
3167
3170 }
3171
3173 {
3174
3176 }
3177
3178
3179 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3180 {
3183
3184
3186
3187
3189
3190
3192
3193
3195
3197
3198
3200
3201
3203
3204
3205 if (construtionPart.
IsBase())
3206 {
3207
3209 }
3210
3213 }
3214
3216 {
3217
3219 }
3220
3222 {
3223 bool process = false;
3224
3225
3229
3230 if (process)
3231 {
3232 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3233 {
3235 return;
3236 }
3237
3239 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3240 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3241
3242
3244 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3245 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3246 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3247 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3248 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3249 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3250 mins = minTmp;
3251 maxs = maxTmp;
3252
3253 maxs[1] = maxs[1] + 0.35;
3254
3256 }
3257 }
3258
3260 {
3263
3264
3266 foreach (
EntityAI entity : foundEntities)
3267 {
3270 }
3271 }
3272
3273
3275 {
3277
3281 }
3282
3284 {
3286
3288 {
3290 }
3291 else
3292 {
3294 }
3295
3297 }
3298
3300 {
3302
3304 foreach (
string slotName : attachmentSlots)
3305 {
3307 }
3308
3309
3312 else
3314
3316 }
3317
3319 {
3320 string slotNameMounted = slot_name + "_Mounted";
3321 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3322
3323 if (attachment)
3324 {
3325 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3326 if (barbedWire && barbedWire.IsMounted())
3328 else
3330
3331 if (is_locked)
3332 {
3333 SetAnimationPhase(slotNameMounted, 0);
3334 SetAnimationPhase(slot_name, 1);
3335 }
3336 else
3337 {
3338 SetAnimationPhase(slotNameMounted, 1);
3339 SetAnimationPhase(slot_name, 0);
3340 }
3341 }
3342 else
3343 {
3344 SetAnimationPhase(slotNameMounted, 1);
3345 SetAnimationPhase(slot_name, 1);
3346
3348 }
3349 }
3350
3351
3353 {
3356
3359
3362
3363 foreach (
string slotName : attachmentSlots)
3364 {
3366 }
3367
3368
3370 {
3373
3375 }
3376 else
3377 {
3380
3382 }
3383
3386 }
3387
3389 {
3390
3392 return;
3393
3394 string slot_name_mounted = slot_name + "_Mounted";
3395 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3396
3397
3399 RemoveProxyPhysics( slot_name_mounted );
3400 RemoveProxyPhysics( slot_name );
3401
3402 if ( attachment )
3403 {
3405 if ( is_locked )
3406 {
3408 AddProxyPhysics( slot_name_mounted );
3409 }
3410 else
3411 {
3413 AddProxyPhysics( slot_name );
3414 }
3415 }
3416 }
3417
3419 {
3420 SetAffectPathgraph( true, false );
3422 }
3423
3425 {
3426 return true;
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3435 {
3436 if ( attachment )
3437 {
3439 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3440
3441 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3442 }
3443
3444 return false;
3445 }
3446
3448 {
3450 }
3451
3452
3454 {
3455 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3456 if (
GetGame().ConfigIsExisting( config_path ) )
3457 {
3459 }
3460 }
3461
3463 {
3464 return true;
3465 }
3466
3468 {
3469 return true;
3470 }
3471
3473 {
3474 return true;
3475 }
3476
3477
3479 {
3481 {
3483 }
3484
3486 }
3487
3489 {
3491 }
3492
3493
3494
3496 {
3497 return super.CanReceiveAttachment(attachment, slotId);
3498 }
3499
3501 {
3502 int attachment_count = GetInventory().AttachmentCount();
3503 if ( attachment_count > 0 )
3504 {
3505 if (
HasBase() && attachment_count == 1 )
3506 {
3507 return false;
3508 }
3509
3510 return true;
3511 }
3512
3513 return false;
3514 }
3515
3517 {
3518 return true;
3519 }
3520
3522 {
3523 return false;
3524 }
3525
3526
3528 {
3529 return false;
3530 }
3531
3533 {
3534 return false;
3535 }
3536
3537
3539 {
3540 return false;
3541 }
3542
3543
3544
3546 {
3547 return true;
3548 }
3549
3551 {
3552 return true;
3553 }
3554
3557 {
3558 return false;
3559 }
3560
3561
3563 {
3564 return true;
3565 }
3566
3567
3569 {
3570 return false;
3571 }
3572
3573
3575 {
3576 return true;
3577 }
3578
3579
3581 {
3582 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3583 {
3584 return false;
3585 }
3586
3587 return true;
3588 }
3589
3591 {
3594
3595 return item;
3596 }
3597
3598
3600 {
3602 {
3603
3605
3606
3609
3611 if ( MemoryPointExists( slot_name + "_min" ) )
3612 {
3613 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3614 }
3615 if ( MemoryPointExists( slot_name + "_max" ) )
3616 {
3617 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3618 }
3619
3620
3623
3624
3627 center = ModelToWorld( center );
3628
3629
3632
3633 areaDamage.SetExtents( extents[0], extents[1] );
3634 areaDamage.SetAreaPosition( center );
3635 areaDamage.SetAreaOrientation( orientation );
3638 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3639 areaDamage.SetAmmoName( "BarbedWireHit" );
3640 areaDamage.Spawn();
3641
3643 }
3644 }
3645
3647 {
3648 if ( angle_deg != 0 )
3649 {
3650
3651 orientation[0] = orientation[0] - angle_deg;
3652
3653
3655 if ( MemoryPointExists( "rotate_axis" ) )
3656 {
3657 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3658 }
3659 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];
3660 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];
3661 center[0] = r_center_x;
3662 center[2] = r_center_z;
3663 }
3664 }
3665
3667 {
3669 {
3672 {
3673 if (areaDamage)
3674 {
3675 areaDamage.Destroy();
3676 }
3677
3679 }
3680 }
3681 }
3682
3684 {
3685 return true;
3686 }
3687
3688
3689
3690
3692 {
3694 }
3695
3697 {
3699 }
3700
3702 {
3704 }
3705
3707 {
3709
3710 switch ( material_type )
3711 {
3717 }
3718
3719 return "";
3720 }
3721
3723 {
3725
3726 switch ( material_type )
3727 {
3733 }
3734
3735 return "";
3736 }
3737
3738
3740 {
3742 {
3743
3745 {
3746 SetHealth(slot_name,"Health",item.GetHealth());
3747 }
3748 }
3749 }
3750
3752 {
3753 return 111;
3754 }
3755
3757 {
3758 super.SetActions();
3759
3763 }
3764
3765
3766
3767
3769 {
3770 }
3771
3774 {
3775 return null;
3776 }
3777
3779 {
3781 }
3782
3784 {
3787
3788 Man p;
3789
3790 #ifdef SERVER
3793 if (players.Count())
3794 p = players[0];
3795 #else
3797 #endif
3798
3800 {
3801 bool excluded = false;
3803 if (excludes)
3804 {
3805 foreach (string exclude : excludes)
3806 {
3808 {
3809 excluded = true;
3810 break;
3811 }
3812 }
3813 }
3814
3815 if (!excluded)
3816 {
3818 }
3819 }
3820
3822 }
3823}
3824
3826{
3827#ifdef BSB_DEBUG
3829#else
3830
3831#endif
3832}
3834{
3835#ifdef BSB_DEBUG_SPAM
3837#else
3838
3839#endif
3840}
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
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 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()
void RegisterPartForSync(int part_id)
const string SOUND_DISMANTLE_METAL
override bool CanReceiveAttachment(EntityAI attachment, int slotId)
void SetPartsAfterStoreLoad()
void DestroyConstruction()
ref array< string > m_HybridAttachments
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()
ref Construction m_Construction
bool IsFacingCamera(string selection)
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 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)
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
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
override bool CanPutIntoHands(EntityAI parent)
bool IsPartBuildInSyncData(int part_id)
override bool CanRemoveFromCargo(EntityAI parent)
const string SOUND_DISMANTLE_WOOD_STAIRS
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
void Construction(BaseBuildingBase parent)
void DayZPlayerUtils()
cannot be instantiated
bool m_FixDamageSystemInit
override void SetLoopInterval(float time)
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
proto native World GetWorld()
override ScriptCallQueue GetCallQueue(int call_category)
proto native void ConfigGetTextArray(string path, out TStringArray values)
Get array of strings from config on path.
proto native DayZPlayer GetPlayer()
proto native void ObjectDelete(Object obj)
Super root of all classes in Enforce script.
static void Log(string message=LOG_DEFAULT, string plugin=LOG_DEFAULT, string author=LOG_DEFAULT, string label=LOG_DEFAULT, string entity=LOG_DEFAULT)
Prints debug message with normal prio.
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
override bool CanUseConstruction()
static bool IsBaseBuildingLogEnable()
proto void CallLater(func fn, int delay=0, bool repeat=false, void param1=NULL, void param2=NULL, void param3=NULL, void param4=NULL, void param5=NULL, void param6=NULL, void param7=NULL, void param8=NULL, void param9=NULL)
adds call into the queue with given parameters and arguments (arguments are held in memory until the ...
proto bool Write(void value_out)
proto bool Read(void value_in)
proto native void GetPlayerList(out array< Man > players)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
proto native CGame GetGame()
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
static proto float Max(float x, float y)
Returns bigger of two given values.
static proto float Min(float x, float y)
Returns smaller of two given values.
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
class JsonUndergroundAreaTriggerData GetPosition
bool Contains(string sample)
Returns true if sample is substring of string.
proto int ToLower()
Changes string to lowercase. Returns length.