2526{
2528
2530
2532
2534
2540
2541
2542
2548
2554
2556
2560
2561
2563 {
2565
2566
2567 RegisterNetSyncVariableInt( "m_SyncParts01" );
2568 RegisterNetSyncVariableInt( "m_SyncParts02" );
2569 RegisterNetSyncVariableInt( "m_SyncParts03" );
2570 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2571 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2572 RegisterNetSyncVariableBool( "m_HasBase" );
2573
2574
2576
2577 if (ConfigIsExisting("hybridAttachments"))
2578 {
2581 }
2582 if (ConfigIsExisting("mountables"))
2583 {
2586 }
2587
2589 }
2590
2592 {
2593 super.EEDelete(parent);
2594
2596 {
2597 areaDamage.Destroy();
2598 }
2599
2600 }
2601
2603 {
2604 return "disableBaseDamage";
2605 }
2606
2608 {
2609 return true;
2610 }
2611
2613 {
2614 return EInventoryIconVisibility.HIDE_VICINITY;
2615 }
2616
2617
2619 {
2621 {
2622 SetSynchDirty();
2623 }
2624 }
2625
2627 {
2629 super.OnVariablesSynchronized();
2630
2632 }
2633
2635 {
2636
2638
2639
2641
2642
2644 }
2645
2646
2648 {
2649
2650 int offset;
2651 int mask;
2652
2653 if ( part_id >= 1 && part_id <= 31 )
2654 {
2655 offset = part_id - 1;
2656 mask = 1 << offset;
2657
2659 }
2660 else if ( part_id >= 32 && part_id <= 62 )
2661 {
2662 offset = ( part_id % 32 );
2663 mask = 1 << offset;
2664
2666 }
2667 else if ( part_id >= 63 && part_id <= 93 )
2668 {
2669 offset = ( part_id % 63 );
2670 mask = 1 << offset;
2671
2673 }
2674 }
2675
2677 {
2678
2679 int offset;
2680 int mask;
2681
2682 if ( part_id >= 1 && part_id <= 31 )
2683 {
2684 offset = part_id - 1;
2685 mask = 1 << offset;
2686
2688 }
2689 else if ( part_id >= 32 && part_id <= 62 )
2690 {
2691 offset = ( part_id % 32 );
2692 mask = 1 << offset;
2693
2695 }
2696 else if ( part_id >= 63 && part_id <= 93 )
2697 {
2698 offset = ( part_id % 63 );
2699 mask = 1 << offset;
2700
2702 }
2703 }
2704
2706 {
2707
2708 int offset;
2709 int mask;
2710
2711 if ( part_id >= 1 && part_id <= 31 )
2712 {
2713 offset = part_id - 1;
2714 mask = 1 << offset;
2715
2717 {
2718 return true;
2719 }
2720 }
2721 else if ( part_id >= 32 && part_id <= 62 )
2722 {
2723 offset = ( part_id % 32 );
2724 mask = 1 << offset;
2725
2727 {
2728 return true;
2729 }
2730 }
2731 else if ( part_id >= 63 && part_id <= 93 )
2732 {
2733 offset = ( part_id % 63 );
2734 mask = 1 << offset;
2735
2737 {
2738 return true;
2739 }
2740 }
2741
2742 return false;
2743 }
2744
2746 {
2749 }
2750
2752 {
2753
2756 }
2757
2759 {
2761 {
2764
2765 switch( build_action_id )
2766 {
2770 }
2771 }
2772 }
2773
2774
2776 {
2778 bool is_base = part.
IsBase();
2781 if ( is_part_built_sync )
2782 {
2784 {
2788
2789 if (is_base)
2790 {
2793 }
2794 }
2795 }
2796 else
2797 {
2799 {
2803
2804 if (is_base)
2805 {
2808 }
2809 }
2810 }
2811
2812
2814 }
2815
2816
2818 {
2821
2822 for ( int i = 0; i < construction_parts.Count(); ++i )
2823 {
2824 string key = construction_parts.GetKey( i );
2827 }
2828
2829
2831 }
2832
2834 {
2837
2838 for ( int i = 0; i < construction_parts.Count(); ++i )
2839 {
2840 string key = construction_parts.GetKey( i );
2842
2843 if ( value.
GetId() ==
id )
2844 {
2845 return value;
2846 }
2847 }
2848
2849 return NULL;
2850 }
2851
2852
2853
2855 {
2857 }
2858
2860 {
2862 }
2863
2865 {
2866 return true;
2867 }
2868
2870 {
2871 return false;
2872 }
2873
2874
2876 {
2879 {
2881 }
2882
2883 return construction_kit;
2884 }
2885
2887 {
2890 {
2892 }
2893 }
2894
2896 {
2898 }
2899
2901 {
2902 return "";
2903 }
2904
2906 {
2909 }
2910
2911
2913 {
2916 }
2917
2918
2920 {
2921 super.OnStoreSave( ctx );
2922
2923
2927
2929 }
2930
2932 {
2933 if ( !super.OnStoreLoad( ctx, version ) )
2934 return false;
2935
2936
2937
2939 {
2941 return false;
2942 }
2944 {
2946 return false;
2947 }
2949 {
2951 return false;
2952 }
2953
2954
2956 {
2958 return false;
2959 }
2960
2961
2962 return true;
2963 }
2964
2966 {
2967 super.AfterStoreLoad();
2968
2970 {
2972 }
2973 }
2974
2976 {
2977
2979
2980
2983
2984
2986 }
2987
2989 {
2990 super.OnCreatePhysics();
2993 }
2994
2996 {
2998 return;
2999
3000 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3001
3003 return;
3004
3006 string part_name = zone;
3008
3010 {
3011 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
3012
3013 if ( construction_part && construction.IsPartConstructed( part_name ) )
3014 {
3016 construction.DestroyConnectedParts(part_name);
3017 }
3018
3019
3020 if ( part_name.
Contains(
"barbed") )
3021 {
3022 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3023 if (barbed_wire)
3024 barbed_wire.SetMountedState( false );
3025 }
3026 }
3027 }
3028
3030 {
3032 {
3034 }
3035
3036 super.EEOnAfterLoad();
3037 }
3038
3040 {
3041 super.EEInit();
3042
3043
3045
3046
3047 #ifdef DEVELOPER
3049 #endif
3050 }
3051
3053 {
3054 super.EEItemAttached( item, slot_name );
3055
3059 }
3060
3062 {
3063 super.EEItemDetached( item, slot_name );
3064
3067 }
3068
3069 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3070 {
3073
3076 }
3077
3078
3080 {
3081 return true;
3082 }
3083
3084
3085
3087 {
3089
3090
3091 if (construtionPart.
IsBase())
3092 {
3094
3095
3097 }
3098
3099
3101
3102
3104
3105
3107
3109
3111
3112
3114
3115
3117 }
3118
3120 {
3121
3123 }
3124
3125
3127 {
3130
3131
3133
3134
3136
3137
3139
3140
3142
3144
3145
3147
3148
3150
3151
3152 if (construtionPart.
IsBase())
3153 {
3154
3156 }
3157
3160 }
3161
3163 {
3164
3166 }
3167
3168
3169 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3170 {
3173
3174
3176
3177
3179
3180
3182
3183
3185
3187
3188
3190
3191
3193
3194
3195 if (construtionPart.
IsBase())
3196 {
3197
3199 }
3200
3203 }
3204
3206 {
3207
3209 }
3210
3212 {
3213 bool process = false;
3214
3215
3219
3220 if (process)
3221 {
3222 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3223 {
3225 return;
3226 }
3227
3229 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3230 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3231
3232
3234 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3235 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3236 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3237 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3238 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3239 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3240 mins = minTmp;
3241 maxs = maxTmp;
3242
3243 maxs[1] = maxs[1] + 0.35;
3244
3246 }
3247 }
3248
3250 {
3253
3254
3256 foreach (
EntityAI entity : foundEntities)
3257 {
3260 }
3261 }
3262
3263
3265 {
3267
3271 }
3272
3274 {
3276
3278 {
3280 }
3281 else
3282 {
3284 }
3285
3287 }
3288
3290 {
3292
3294 foreach (
string slotName : attachmentSlots)
3295 {
3297 }
3298
3299
3302 else
3304
3306 }
3307
3309 {
3310 string slotNameMounted = slot_name + "_Mounted";
3311 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3312
3313 if (attachment)
3314 {
3315 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3316 if (barbedWire && barbedWire.IsMounted())
3318 else
3320
3321 if (is_locked)
3322 {
3323 SetAnimationPhase(slotNameMounted, 0);
3324 SetAnimationPhase(slot_name, 1);
3325 }
3326 else
3327 {
3328 SetAnimationPhase(slotNameMounted, 1);
3329 SetAnimationPhase(slot_name, 0);
3330 }
3331 }
3332 else
3333 {
3334 SetAnimationPhase(slotNameMounted, 1);
3335 SetAnimationPhase(slot_name, 1);
3336
3338 }
3339 }
3340
3341
3343 {
3346
3349
3352
3353 foreach (
string slotName : attachmentSlots)
3354 {
3356 }
3357
3358
3360 {
3363
3365 }
3366 else
3367 {
3370
3372 }
3373
3376 }
3377
3379 {
3380
3382 return;
3383
3384 string slot_name_mounted = slot_name + "_Mounted";
3385 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3386
3387
3389 RemoveProxyPhysics( slot_name_mounted );
3390 RemoveProxyPhysics( slot_name );
3391
3392 if ( attachment )
3393 {
3395 if ( is_locked )
3396 {
3398 AddProxyPhysics( slot_name_mounted );
3399 }
3400 else
3401 {
3403 AddProxyPhysics( slot_name );
3404 }
3405 }
3406 }
3407
3409 {
3410 SetAffectPathgraph( true, false );
3412 }
3413
3415 {
3416 return true;
3417 }
3418
3420 {
3421 return true;
3422 }
3423
3425 {
3426 if ( attachment )
3427 {
3429 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3430
3431 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3432 }
3433
3434 return false;
3435 }
3436
3438 {
3440 }
3441
3442
3444 {
3445 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3446 if (
GetGame().ConfigIsExisting( config_path ) )
3447 {
3449 }
3450 }
3451
3453 {
3454 return true;
3455 }
3456
3458 {
3459 return true;
3460 }
3461
3463 {
3464 return true;
3465 }
3466
3467
3469 {
3471 {
3473 }
3474
3476 }
3477
3479 {
3481 }
3482
3483
3484
3486 {
3487 return super.CanReceiveAttachment(attachment, slotId);
3488 }
3489
3491 {
3492 int attachment_count = GetInventory().AttachmentCount();
3493 if ( attachment_count > 0 )
3494 {
3495 if (
HasBase() && attachment_count == 1 )
3496 {
3497 return false;
3498 }
3499
3500 return true;
3501 }
3502
3503 return false;
3504 }
3505
3507 {
3508 return true;
3509 }
3510
3512 {
3513 return false;
3514 }
3515
3516
3518 {
3519 return false;
3520 }
3521
3523 {
3524 return false;
3525 }
3526
3527
3529 {
3530 return false;
3531 }
3532
3533
3534
3536 {
3537 return true;
3538 }
3539
3541 {
3542 return true;
3543 }
3544
3547 {
3548 return false;
3549 }
3550
3551
3553 {
3554 return true;
3555 }
3556
3557
3559 {
3560 return false;
3561 }
3562
3563
3565 {
3566 return true;
3567 }
3568
3569
3571 {
3572 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3573 {
3574 return false;
3575 }
3576
3577 return true;
3578 }
3579
3581 {
3584
3585 return item;
3586 }
3587
3588
3590 {
3592 {
3593
3595
3596
3599
3601 if ( MemoryPointExists( slot_name + "_min" ) )
3602 {
3603 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3604 }
3605 if ( MemoryPointExists( slot_name + "_max" ) )
3606 {
3607 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3608 }
3609
3610
3613
3614
3617 center = ModelToWorld( center );
3618
3619
3622
3623 areaDamage.SetExtents( extents[0], extents[1] );
3624 areaDamage.SetAreaPosition( center );
3625 areaDamage.SetAreaOrientation( orientation );
3628 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3629 areaDamage.SetAmmoName( "BarbedWireHit" );
3630 areaDamage.Spawn();
3631
3633 }
3634 }
3635
3637 {
3638 if ( angle_deg != 0 )
3639 {
3640
3641 orientation[0] = orientation[0] - angle_deg;
3642
3643
3645 if ( MemoryPointExists( "rotate_axis" ) )
3646 {
3647 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3648 }
3649 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];
3650 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];
3651 center[0] = r_center_x;
3652 center[2] = r_center_z;
3653 }
3654 }
3655
3657 {
3659 {
3662 {
3663 if (areaDamage)
3664 {
3665 areaDamage.Destroy();
3666 }
3667
3669 }
3670 }
3671 }
3672
3674 {
3675 return true;
3676 }
3677
3678
3679
3680
3682 {
3684 }
3685
3687 {
3689 }
3690
3692 {
3694 }
3695
3697 {
3699
3700 switch ( material_type )
3701 {
3707 }
3708
3709 return "";
3710 }
3711
3713 {
3715
3716 switch ( material_type )
3717 {
3723 }
3724
3725 return "";
3726 }
3727
3728
3730 {
3732 {
3733
3735 {
3736 SetHealth(slot_name,"Health",item.GetHealth());
3737 }
3738 }
3739 }
3740
3742 {
3743 return 111;
3744 }
3745
3747 {
3748 super.SetActions();
3749
3753 }
3754
3755
3756
3757
3759 {
3760 }
3761
3764 {
3765 return null;
3766 }
3767
3769 {
3771 }
3772
3774 {
3777
3778 Man p;
3779
3780 #ifdef SERVER
3783 if (players.Count())
3784 p = players[0];
3785 #else
3787 #endif
3788
3790 {
3791 bool excluded = false;
3793 if (excludes)
3794 {
3795 foreach (string exclude : excludes)
3796 {
3798 {
3799 excluded = true;
3800 break;
3801 }
3802 }
3803 }
3804
3805 if (!excluded)
3806 {
3808 }
3809 }
3810
3812 }
3813}
3814
3816{
3817#ifdef BSB_DEBUG
3819#else
3820
3821#endif
3822}
3824{
3825#ifdef BSB_DEBUG_SPAM
3827#else
3828
3829#endif
3830}
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.