2541{
2543
2545
2547
2549
2555
2556
2557
2563
2569
2571
2575
2576
2578 {
2580
2581
2582 RegisterNetSyncVariableInt( "m_SyncParts01" );
2583 RegisterNetSyncVariableInt( "m_SyncParts02" );
2584 RegisterNetSyncVariableInt( "m_SyncParts03" );
2585 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2586 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2587 RegisterNetSyncVariableBool( "m_HasBase" );
2588
2589
2591
2592 if (ConfigIsExisting("hybridAttachments"))
2593 {
2596 }
2597 if (ConfigIsExisting("mountables"))
2598 {
2601 }
2602
2604 }
2605
2607 {
2608 super.EEDelete(parent);
2609
2611 {
2612 areaDamage.Destroy();
2613 }
2614
2615 }
2616
2618 {
2619 return "disableBaseDamage";
2620 }
2621
2623 {
2624 return true;
2625 }
2626
2628 {
2629 return EInventoryIconVisibility.HIDE_VICINITY;
2630 }
2631
2632
2634 {
2636 {
2637 SetSynchDirty();
2638 }
2639 }
2640
2642 {
2644 super.OnVariablesSynchronized();
2645
2647 }
2648
2650 {
2651
2653
2654
2656
2657
2659 }
2660
2661
2663 {
2664
2665 int offset;
2666 int mask;
2667
2668 if ( part_id >= 1 && part_id <= 31 )
2669 {
2670 offset = part_id - 1;
2671 mask = 1 << offset;
2672
2674 }
2675 else if ( part_id >= 32 && part_id <= 62 )
2676 {
2677 offset = ( part_id % 32 );
2678 mask = 1 << offset;
2679
2681 }
2682 else if ( part_id >= 63 && part_id <= 93 )
2683 {
2684 offset = ( part_id % 63 );
2685 mask = 1 << offset;
2686
2688 }
2689 }
2690
2692 {
2693
2694 int offset;
2695 int mask;
2696
2697 if ( part_id >= 1 && part_id <= 31 )
2698 {
2699 offset = part_id - 1;
2700 mask = 1 << offset;
2701
2703 }
2704 else if ( part_id >= 32 && part_id <= 62 )
2705 {
2706 offset = ( part_id % 32 );
2707 mask = 1 << offset;
2708
2710 }
2711 else if ( part_id >= 63 && part_id <= 93 )
2712 {
2713 offset = ( part_id % 63 );
2714 mask = 1 << offset;
2715
2717 }
2718 }
2719
2721 {
2722
2723 int offset;
2724 int mask;
2725
2726 if ( part_id >= 1 && part_id <= 31 )
2727 {
2728 offset = part_id - 1;
2729 mask = 1 << offset;
2730
2732 {
2733 return true;
2734 }
2735 }
2736 else if ( part_id >= 32 && part_id <= 62 )
2737 {
2738 offset = ( part_id % 32 );
2739 mask = 1 << offset;
2740
2742 {
2743 return true;
2744 }
2745 }
2746 else if ( part_id >= 63 && part_id <= 93 )
2747 {
2748 offset = ( part_id % 63 );
2749 mask = 1 << offset;
2750
2752 {
2753 return true;
2754 }
2755 }
2756
2757 return false;
2758 }
2759
2761 {
2764 }
2765
2767 {
2768
2771 }
2772
2774 {
2776 {
2779
2780 switch( build_action_id )
2781 {
2785 }
2786 }
2787 }
2788
2789
2791 {
2793 bool is_base = part.
IsBase();
2796 if ( is_part_built_sync )
2797 {
2799 {
2803
2804 if (is_base)
2805 {
2808 }
2809 }
2810 }
2811 else
2812 {
2814 {
2818
2819 if (is_base)
2820 {
2823 }
2824 }
2825 }
2826
2827
2829 }
2830
2831
2833 {
2836
2837 for ( int i = 0; i < construction_parts.Count(); ++i )
2838 {
2839 string key = construction_parts.GetKey( i );
2842 }
2843
2844
2846 }
2847
2849 {
2852
2853 for ( int i = 0; i < construction_parts.Count(); ++i )
2854 {
2855 string key = construction_parts.GetKey( i );
2857
2858 if ( value.
GetId() ==
id )
2859 {
2860 return value;
2861 }
2862 }
2863
2864 return NULL;
2865 }
2866
2867
2868
2870 {
2872 }
2873
2875 {
2877 }
2878
2880 {
2881 return true;
2882 }
2883
2885 {
2886 return false;
2887 }
2888
2889
2891 {
2894 {
2896 }
2897
2898 return construction_kit;
2899 }
2900
2902 {
2905 {
2907 }
2908 }
2909
2911 {
2913 }
2914
2916 {
2917 return "";
2918 }
2919
2921 {
2924 }
2925
2926
2928 {
2931 }
2932
2933
2935 {
2936 super.OnStoreSave( ctx );
2937
2938
2942
2944 }
2945
2947 {
2948 if ( !super.OnStoreLoad( ctx, version ) )
2949 return false;
2950
2951
2952
2954 {
2956 return false;
2957 }
2959 {
2961 return false;
2962 }
2964 {
2966 return false;
2967 }
2968
2969
2971 {
2973 return false;
2974 }
2975
2976
2977 return true;
2978 }
2979
2981 {
2982 super.AfterStoreLoad();
2983
2985 {
2987 }
2988 }
2989
2991 {
2992
2994
2995
2998
2999
3001 }
3002
3004 {
3005 super.OnCreatePhysics();
3008 }
3009
3011 {
3013 return;
3014
3015 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3016
3018 return;
3019
3021 string part_name = zone;
3023
3025 {
3026 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
3027
3028 if ( construction_part && construction.IsPartConstructed( part_name ) )
3029 {
3031 construction.DestroyConnectedParts(part_name);
3032 }
3033
3034
3035 if ( part_name.
Contains(
"barbed") )
3036 {
3037 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3038 if (barbed_wire)
3039 barbed_wire.SetMountedState( false );
3040 }
3041 }
3042 }
3043
3045 {
3047 {
3049 }
3050
3051 super.EEOnAfterLoad();
3052 }
3053
3055 {
3056 super.EEInit();
3057
3058
3060
3061
3062 #ifdef DEVELOPER
3064 #endif
3065 }
3066
3068 {
3069 super.EEItemAttached( item, slot_name );
3070
3074 }
3075
3077 {
3078 super.EEItemDetached( item, slot_name );
3079
3082 }
3083
3084 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3085 {
3088
3091 }
3092
3093
3095 {
3096 return true;
3097 }
3098
3099
3100
3102 {
3104
3105
3106 if (construtionPart.
IsBase())
3107 {
3109
3110
3112 }
3113
3114
3116
3117
3119
3120
3122
3124
3126
3127
3129
3130
3132 }
3133
3135 {
3136
3138 }
3139
3140
3142 {
3145
3146
3148
3149
3151
3152
3154
3155
3157
3159
3160
3162
3163
3165
3166
3167 if (construtionPart.
IsBase())
3168 {
3169
3171 }
3172
3175 }
3176
3178 {
3179
3181 }
3182
3183
3184 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3185 {
3188
3189
3191
3192
3194
3195
3197
3198
3200
3202
3203
3205
3206
3208
3209
3210 if (construtionPart.
IsBase())
3211 {
3212
3214 }
3215
3218 }
3219
3221 {
3222
3224 }
3225
3227 {
3228 bool process = false;
3229
3230
3234
3235 if (process)
3236 {
3237 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3238 {
3240 return;
3241 }
3242
3244 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3245 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3246
3247
3249 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3250 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3251 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3252 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3253 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3254 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3255 mins = minTmp;
3256 maxs = maxTmp;
3257
3258 maxs[1] = maxs[1] + 0.35;
3259
3261 }
3262 }
3263
3265 {
3268
3269
3271 foreach (
EntityAI entity : foundEntities)
3272 {
3275 }
3276 }
3277
3278
3280 {
3282
3286 }
3287
3289 {
3291
3293 {
3295 }
3296 else
3297 {
3299 }
3300
3302 }
3303
3305 {
3307
3309 foreach (
string slotName : attachmentSlots)
3310 {
3312 }
3313
3314
3317 else
3319
3321 }
3322
3324 {
3325 string slotNameMounted = slot_name + "_Mounted";
3326 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3327
3328 if (attachment)
3329 {
3330 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3331 if (barbedWire && barbedWire.IsMounted())
3333 else
3335
3336 if (is_locked)
3337 {
3338 SetAnimationPhase(slotNameMounted, 0);
3339 SetAnimationPhase(slot_name, 1);
3340 }
3341 else
3342 {
3343 SetAnimationPhase(slotNameMounted, 1);
3344 SetAnimationPhase(slot_name, 0);
3345 }
3346 }
3347 else
3348 {
3349 SetAnimationPhase(slotNameMounted, 1);
3350 SetAnimationPhase(slot_name, 1);
3351
3353 }
3354 }
3355
3356
3358 {
3361
3364
3367
3368 foreach (
string slotName : attachmentSlots)
3369 {
3371 }
3372
3373
3375 {
3378
3380 }
3381 else
3382 {
3385
3387 }
3388
3391 }
3392
3394 {
3395
3397 return;
3398
3399 string slot_name_mounted = slot_name + "_Mounted";
3400 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3401
3402
3404 RemoveProxyPhysics( slot_name_mounted );
3405 RemoveProxyPhysics( slot_name );
3406
3407 if ( attachment )
3408 {
3410 if ( is_locked )
3411 {
3413 AddProxyPhysics( slot_name_mounted );
3414 }
3415 else
3416 {
3418 AddProxyPhysics( slot_name );
3419 }
3420 }
3421 }
3422
3424 {
3425 SetAffectPathgraph( true, false );
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3435 {
3436 return true;
3437 }
3438
3440 {
3441 if ( attachment )
3442 {
3444 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3445
3446 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3447 }
3448
3449 return false;
3450 }
3451
3453 {
3455 }
3456
3457
3459 {
3460 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3461 if (
GetGame().ConfigIsExisting( config_path ) )
3462 {
3464 }
3465 }
3466
3468 {
3469 return true;
3470 }
3471
3473 {
3474 return true;
3475 }
3476
3478 {
3479 return true;
3480 }
3481
3482
3484 {
3486 {
3488 }
3489
3491 }
3492
3494 {
3496 }
3497
3498
3499
3501 {
3502 return super.CanReceiveAttachment(attachment, slotId);
3503 }
3504
3506 {
3507 int attachment_count = GetInventory().AttachmentCount();
3508 if ( attachment_count > 0 )
3509 {
3510 if (
HasBase() && attachment_count == 1 )
3511 {
3512 return false;
3513 }
3514
3515 return true;
3516 }
3517
3518 return false;
3519 }
3520
3522 {
3523 return true;
3524 }
3525
3527 {
3528 return false;
3529 }
3530
3531
3533 {
3534 return false;
3535 }
3536
3538 {
3539 return false;
3540 }
3541
3542
3544 {
3545 return false;
3546 }
3547
3548
3549
3551 {
3552 return true;
3553 }
3554
3556 {
3557 return true;
3558 }
3559
3562 {
3563 return false;
3564 }
3565
3566
3568 {
3569 return true;
3570 }
3571
3572
3574 {
3575 return false;
3576 }
3577
3578
3580 {
3581 return true;
3582 }
3583
3584
3586 {
3587 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3588 {
3589 return false;
3590 }
3591
3592 return true;
3593 }
3594
3596 {
3599
3600 return item;
3601 }
3602
3603
3605 {
3607 {
3608
3610
3611
3614
3616 if ( MemoryPointExists( slot_name + "_min" ) )
3617 {
3618 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3619 }
3620 if ( MemoryPointExists( slot_name + "_max" ) )
3621 {
3622 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3623 }
3624
3625
3628
3629
3632 center = ModelToWorld( center );
3633
3634
3637
3638 areaDamage.SetExtents( extents[0], extents[1] );
3639 areaDamage.SetAreaPosition( center );
3640 areaDamage.SetAreaOrientation( orientation );
3643 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3644 areaDamage.SetAmmoName( "BarbedWireHit" );
3645 areaDamage.Spawn();
3646
3648 }
3649 }
3650
3652 {
3653 if ( angle_deg != 0 )
3654 {
3655
3656 orientation[0] = orientation[0] - angle_deg;
3657
3658
3660 if ( MemoryPointExists( "rotate_axis" ) )
3661 {
3662 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3663 }
3664 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];
3665 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];
3666 center[0] = r_center_x;
3667 center[2] = r_center_z;
3668 }
3669 }
3670
3672 {
3674 {
3677 {
3678 if (areaDamage)
3679 {
3680 areaDamage.Destroy();
3681 }
3682
3684 }
3685 }
3686 }
3687
3689 {
3690 return true;
3691 }
3692
3693
3694
3695
3697 {
3699 }
3700
3702 {
3704 }
3705
3707 {
3709 }
3710
3712 {
3714
3715 switch ( material_type )
3716 {
3722 }
3723
3724 return "";
3725 }
3726
3728 {
3730
3731 switch ( material_type )
3732 {
3738 }
3739
3740 return "";
3741 }
3742
3743
3745 {
3747 {
3748
3750 {
3751 SetHealth(slot_name,"Health",item.GetHealth());
3752 }
3753 }
3754 }
3755
3757 {
3758 return 111;
3759 }
3760
3762 {
3763 super.SetActions();
3764
3768 }
3769
3770
3771
3772
3774 {
3775 }
3776
3779 {
3780 return null;
3781 }
3782
3784 {
3786 }
3787
3789 {
3792
3793 Man p;
3794
3795 #ifdef SERVER
3798 if (players.Count())
3799 p = players[0];
3800 #else
3802 #endif
3803
3805 {
3806 bool excluded = false;
3808 if (excludes)
3809 {
3810 foreach (string exclude : excludes)
3811 {
3813 {
3814 excluded = true;
3815 break;
3816 }
3817 }
3818 }
3819
3820 if (!excluded)
3821 {
3823 }
3824 }
3825
3827 }
3828}
3829
3831{
3832#ifdef BSB_DEBUG
3834#else
3835
3836#endif
3837}
3839{
3840#ifdef BSB_DEBUG_SPAM
3842#else
3843
3844#endif
3845}
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.