2514{
2516
2518
2520
2522
2528
2529
2530
2536
2542
2544
2548
2549
2551 {
2553
2554
2555 RegisterNetSyncVariableInt( "m_SyncParts01" );
2556 RegisterNetSyncVariableInt( "m_SyncParts02" );
2557 RegisterNetSyncVariableInt( "m_SyncParts03" );
2558 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2559 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2560 RegisterNetSyncVariableBool( "m_HasBase" );
2561
2562
2564
2565 if (ConfigIsExisting("hybridAttachments"))
2566 {
2569 }
2570 if (ConfigIsExisting("mountables"))
2571 {
2574 }
2575
2577 }
2578
2580 {
2581 super.EEDelete(parent);
2582
2584 {
2585 areaDamage.Destroy();
2586 }
2587
2588 }
2589
2591 {
2592 return "disableBaseDamage";
2593 }
2594
2596 {
2597 return true;
2598 }
2599
2601 {
2602 return EInventoryIconVisibility.HIDE_VICINITY;
2603 }
2604
2605
2607 {
2609 {
2610 SetSynchDirty();
2611 }
2612 }
2613
2615 {
2617 super.OnVariablesSynchronized();
2618
2620 }
2621
2623 {
2624
2626
2627
2629
2630
2632 }
2633
2634
2636 {
2637
2638 int offset;
2639 int mask;
2640
2641 if ( part_id >= 1 && part_id <= 31 )
2642 {
2643 offset = part_id - 1;
2644 mask = 1 << offset;
2645
2647 }
2648 else if ( part_id >= 32 && part_id <= 62 )
2649 {
2650 offset = ( part_id % 32 );
2651 mask = 1 << offset;
2652
2654 }
2655 else if ( part_id >= 63 && part_id <= 93 )
2656 {
2657 offset = ( part_id % 63 );
2658 mask = 1 << offset;
2659
2661 }
2662 }
2663
2665 {
2666
2667 int offset;
2668 int mask;
2669
2670 if ( part_id >= 1 && part_id <= 31 )
2671 {
2672 offset = part_id - 1;
2673 mask = 1 << offset;
2674
2676 }
2677 else if ( part_id >= 32 && part_id <= 62 )
2678 {
2679 offset = ( part_id % 32 );
2680 mask = 1 << offset;
2681
2683 }
2684 else if ( part_id >= 63 && part_id <= 93 )
2685 {
2686 offset = ( part_id % 63 );
2687 mask = 1 << offset;
2688
2690 }
2691 }
2692
2694 {
2695
2696 int offset;
2697 int mask;
2698
2699 if ( part_id >= 1 && part_id <= 31 )
2700 {
2701 offset = part_id - 1;
2702 mask = 1 << offset;
2703
2705 {
2706 return true;
2707 }
2708 }
2709 else if ( part_id >= 32 && part_id <= 62 )
2710 {
2711 offset = ( part_id % 32 );
2712 mask = 1 << offset;
2713
2715 {
2716 return true;
2717 }
2718 }
2719 else if ( part_id >= 63 && part_id <= 93 )
2720 {
2721 offset = ( part_id % 63 );
2722 mask = 1 << offset;
2723
2725 {
2726 return true;
2727 }
2728 }
2729
2730 return false;
2731 }
2732
2734 {
2737 }
2738
2740 {
2741
2744 }
2745
2747 {
2749 {
2752
2753 switch( build_action_id )
2754 {
2758 }
2759 }
2760 }
2761
2762
2764 {
2766 bool is_base = part.
IsBase();
2769 if ( is_part_built_sync )
2770 {
2772 {
2776
2777 if (is_base)
2778 {
2781 }
2782 }
2783 }
2784 else
2785 {
2787 {
2791
2792 if (is_base)
2793 {
2796 }
2797 }
2798 }
2799
2800
2802 }
2803
2804
2806 {
2809
2810 for ( int i = 0; i < construction_parts.Count(); ++i )
2811 {
2812 string key = construction_parts.GetKey( i );
2815 }
2816
2817
2819 }
2820
2822 {
2825
2826 for ( int i = 0; i < construction_parts.Count(); ++i )
2827 {
2828 string key = construction_parts.GetKey( i );
2830
2831 if ( value.
GetId() ==
id )
2832 {
2833 return value;
2834 }
2835 }
2836
2837 return NULL;
2838 }
2839
2840
2841
2843 {
2845 }
2846
2848 {
2850 }
2851
2853 {
2854 return true;
2855 }
2856
2858 {
2859 return false;
2860 }
2861
2862
2864 {
2867 {
2869 }
2870
2871 return construction_kit;
2872 }
2873
2875 {
2878 {
2880 }
2881 }
2882
2884 {
2886 }
2887
2889 {
2890 return "";
2891 }
2892
2894 {
2897 }
2898
2899
2901 {
2904 }
2905
2906
2908 {
2909 super.OnStoreSave( ctx );
2910
2911
2915
2917 }
2918
2920 {
2921 if ( !super.OnStoreLoad( ctx, version ) )
2922 return false;
2923
2924
2925
2927 {
2929 return false;
2930 }
2932 {
2934 return false;
2935 }
2937 {
2939 return false;
2940 }
2941
2942
2944 {
2946 return false;
2947 }
2948
2949
2950 return true;
2951 }
2952
2954 {
2955 super.AfterStoreLoad();
2956
2958 {
2960 }
2961 }
2962
2964 {
2965
2967
2968
2971
2972
2974 }
2975
2977 {
2978 super.OnCreatePhysics();
2981 }
2982
2984 {
2986 return;
2987
2988 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2989
2991 return;
2992
2994 string part_name = zone;
2996
2998 {
2999 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
3000
3001 if ( construction_part && construction.IsPartConstructed( part_name ) )
3002 {
3004 construction.DestroyConnectedParts(part_name);
3005 }
3006
3007
3008 if ( part_name.
Contains(
"barbed") )
3009 {
3010 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3011 if (barbed_wire)
3012 barbed_wire.SetMountedState( false );
3013 }
3014 }
3015 }
3016
3018 {
3020 {
3022 }
3023
3024 super.EEOnAfterLoad();
3025 }
3026
3028 {
3029 super.EEInit();
3030
3031
3033
3034
3035 #ifdef DEVELOPER
3037 #endif
3038 }
3039
3041 {
3042 super.EEItemAttached( item, slot_name );
3043
3047 }
3048
3050 {
3051 super.EEItemDetached( item, slot_name );
3052
3055 }
3056
3057 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3058 {
3061
3064 }
3065
3066
3068 {
3069 return true;
3070 }
3071
3072
3073
3075 {
3077
3078
3079 if (construtionPart.
IsBase())
3080 {
3082
3083
3085 }
3086
3087
3089
3090
3092
3093
3095
3097
3099
3100
3102
3103
3105 }
3106
3108 {
3109
3111 }
3112
3113
3115 {
3118
3119
3121
3122
3124
3125
3127
3128
3130
3132
3133
3135
3136
3138
3139
3140 if (construtionPart.
IsBase())
3141 {
3142
3144 }
3145
3148 }
3149
3151 {
3152
3154 }
3155
3156
3157 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3158 {
3161
3162
3164
3165
3167
3168
3170
3171
3173
3175
3176
3178
3179
3181
3182
3183 if (construtionPart.
IsBase())
3184 {
3185
3187 }
3188
3191 }
3192
3194 {
3195
3197 }
3198
3200 {
3201 bool process = false;
3202
3203
3207
3208 if (process)
3209 {
3210 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3211 {
3213 return;
3214 }
3215
3217 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3218 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3219
3220
3222 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3223 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3224 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3225 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3226 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3227 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3228 mins = minTmp;
3229 maxs = maxTmp;
3230
3231 maxs[1] = maxs[1] + 0.35;
3232
3234 }
3235 }
3236
3238 {
3241
3242
3244 foreach (
EntityAI entity : foundEntities)
3245 {
3248 }
3249 }
3250
3251
3253 {
3255
3259 }
3260
3262 {
3264
3266 {
3268 }
3269 else
3270 {
3272 }
3273
3275 }
3276
3278 {
3280
3282 foreach (
string slotName : attachmentSlots)
3283 {
3285 }
3286
3287
3290 else
3292
3294 }
3295
3297 {
3298 string slotNameMounted = slot_name + "_Mounted";
3299 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3300
3301 if (attachment)
3302 {
3303 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3304 if (barbedWire && barbedWire.IsMounted())
3306 else
3308
3309 if (is_locked)
3310 {
3311 SetAnimationPhase(slotNameMounted, 0);
3312 SetAnimationPhase(slot_name, 1);
3313 }
3314 else
3315 {
3316 SetAnimationPhase(slotNameMounted, 1);
3317 SetAnimationPhase(slot_name, 0);
3318 }
3319 }
3320 else
3321 {
3322 SetAnimationPhase(slotNameMounted, 1);
3323 SetAnimationPhase(slot_name, 1);
3324
3326 }
3327 }
3328
3329
3331 {
3334
3337
3340
3341 foreach (
string slotName : attachmentSlots)
3342 {
3344 }
3345
3346
3348 {
3351
3353 }
3354 else
3355 {
3358
3360 }
3361
3364 }
3365
3367 {
3368
3370 return;
3371
3372 string slot_name_mounted = slot_name + "_Mounted";
3373 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3374
3375
3377 RemoveProxyPhysics( slot_name_mounted );
3378 RemoveProxyPhysics( slot_name );
3379
3380 if ( attachment )
3381 {
3383 if ( is_locked )
3384 {
3386 AddProxyPhysics( slot_name_mounted );
3387 }
3388 else
3389 {
3391 AddProxyPhysics( slot_name );
3392 }
3393 }
3394 }
3395
3397 {
3398 SetAffectPathgraph( true, false );
3400 }
3401
3403 {
3404 return true;
3405 }
3406
3408 {
3409 return true;
3410 }
3411
3413 {
3414 if ( attachment )
3415 {
3417 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3418
3419 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3420 }
3421
3422 return false;
3423 }
3424
3426 {
3428 }
3429
3430
3432 {
3433 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3434 if (
GetGame().ConfigIsExisting( config_path ) )
3435 {
3437 }
3438 }
3439
3441 {
3442 return true;
3443 }
3444
3446 {
3447 return true;
3448 }
3449
3451 {
3452 return true;
3453 }
3454
3455
3457 {
3459 {
3461 }
3462
3464 }
3465
3467 {
3469 }
3470
3471
3472
3474 {
3475 return super.CanReceiveAttachment(attachment, slotId);
3476 }
3477
3479 {
3480 int attachment_count = GetInventory().AttachmentCount();
3481 if ( attachment_count > 0 )
3482 {
3483 if (
HasBase() && attachment_count == 1 )
3484 {
3485 return false;
3486 }
3487
3488 return true;
3489 }
3490
3491 return false;
3492 }
3493
3495 {
3496 return true;
3497 }
3498
3500 {
3501 return false;
3502 }
3503
3504
3506 {
3507 return false;
3508 }
3509
3511 {
3512 return false;
3513 }
3514
3515
3517 {
3518 return false;
3519 }
3520
3521
3522
3524 {
3525 return true;
3526 }
3527
3529 {
3530 return true;
3531 }
3532
3535 {
3536 return false;
3537 }
3538
3539
3541 {
3542 return true;
3543 }
3544
3545
3547 {
3548 return false;
3549 }
3550
3551
3553 {
3554 return true;
3555 }
3556
3557
3559 {
3560 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3561 {
3562 return false;
3563 }
3564
3565 return true;
3566 }
3567
3569 {
3572
3573 return item;
3574 }
3575
3576
3578 {
3580 {
3581
3583
3584
3587
3589 if ( MemoryPointExists( slot_name + "_min" ) )
3590 {
3591 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3592 }
3593 if ( MemoryPointExists( slot_name + "_max" ) )
3594 {
3595 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3596 }
3597
3598
3601
3602
3605 center = ModelToWorld( center );
3606
3607
3610
3611 areaDamage.SetExtents( extents[0], extents[1] );
3612 areaDamage.SetAreaPosition( center );
3613 areaDamage.SetAreaOrientation( orientation );
3616 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3617 areaDamage.SetAmmoName( "BarbedWireHit" );
3618 areaDamage.Spawn();
3619
3621 }
3622 }
3623
3625 {
3626 if ( angle_deg != 0 )
3627 {
3628
3629 orientation[0] = orientation[0] - angle_deg;
3630
3631
3633 if ( MemoryPointExists( "rotate_axis" ) )
3634 {
3635 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3636 }
3637 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];
3638 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];
3639 center[0] = r_center_x;
3640 center[2] = r_center_z;
3641 }
3642 }
3643
3645 {
3647 {
3650 {
3651 if (areaDamage)
3652 {
3653 areaDamage.Destroy();
3654 }
3655
3657 }
3658 }
3659 }
3660
3662 {
3663 return true;
3664 }
3665
3666
3667
3668
3670 {
3672 }
3673
3675 {
3677 }
3678
3680 {
3682 }
3683
3685 {
3687
3688 switch ( material_type )
3689 {
3695 }
3696
3697 return "";
3698 }
3699
3701 {
3703
3704 switch ( material_type )
3705 {
3711 }
3712
3713 return "";
3714 }
3715
3716
3718 {
3720 {
3721
3723 {
3724 SetHealth(slot_name,"Health",item.GetHealth());
3725 }
3726 }
3727 }
3728
3730 {
3731 return 111;
3732 }
3733
3735 {
3736 super.SetActions();
3737
3741 }
3742
3743
3744
3745
3747 {
3748 }
3749
3752 {
3753 return null;
3754 }
3755
3757 {
3759 }
3760
3762 {
3765
3766 Man p;
3767
3768 #ifdef SERVER
3771 if (players.Count())
3772 p = players[0];
3773 #else
3775 #endif
3776
3778 {
3779 bool excluded = false;
3781 if (excludes)
3782 {
3783 foreach (string exclude : excludes)
3784 {
3786 {
3787 excluded = true;
3788 break;
3789 }
3790 }
3791 }
3792
3793 if (!excluded)
3794 {
3796 }
3797 }
3798
3800 }
3801}
3802
3804{
3805#ifdef BSB_DEBUG
3807#else
3808
3809#endif
3810}
3812{
3813#ifdef BSB_DEBUG_SPAM
3815#else
3816
3817#endif
3818}
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.