2464{
2466
2468
2470
2472
2478
2479
2480
2486
2492
2494
2498
2499
2501 {
2503
2504
2505 RegisterNetSyncVariableInt( "m_SyncParts01" );
2506 RegisterNetSyncVariableInt( "m_SyncParts02" );
2507 RegisterNetSyncVariableInt( "m_SyncParts03" );
2508 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2509 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2510 RegisterNetSyncVariableBool( "m_HasBase" );
2511
2512
2514
2515 if (ConfigIsExisting("hybridAttachments"))
2516 {
2519 }
2520 if (ConfigIsExisting("mountables"))
2521 {
2524 }
2525
2527 }
2528
2530 {
2531 super.EEDelete(parent);
2532
2534 {
2535 areaDamage.Destroy();
2536 }
2537
2538 }
2539
2541 {
2542 return "disableBaseDamage";
2543 }
2544
2546 {
2547 return true;
2548 }
2549
2551 {
2552 return EInventoryIconVisibility.HIDE_VICINITY;
2553 }
2554
2555
2557 {
2559 {
2560 SetSynchDirty();
2561 }
2562 }
2563
2565 {
2567 super.OnVariablesSynchronized();
2568
2570 }
2571
2573 {
2574
2576
2577
2579
2580
2582 }
2583
2584
2586 {
2587
2588 int offset;
2589 int mask;
2590
2591 if ( part_id >= 1 && part_id <= 31 )
2592 {
2593 offset = part_id - 1;
2594 mask = 1 << offset;
2595
2597 }
2598 else if ( part_id >= 32 && part_id <= 62 )
2599 {
2600 offset = ( part_id % 32 );
2601 mask = 1 << offset;
2602
2604 }
2605 else if ( part_id >= 63 && part_id <= 93 )
2606 {
2607 offset = ( part_id % 63 );
2608 mask = 1 << offset;
2609
2611 }
2612 }
2613
2615 {
2616
2617 int offset;
2618 int mask;
2619
2620 if ( part_id >= 1 && part_id <= 31 )
2621 {
2622 offset = part_id - 1;
2623 mask = 1 << offset;
2624
2626 }
2627 else if ( part_id >= 32 && part_id <= 62 )
2628 {
2629 offset = ( part_id % 32 );
2630 mask = 1 << offset;
2631
2633 }
2634 else if ( part_id >= 63 && part_id <= 93 )
2635 {
2636 offset = ( part_id % 63 );
2637 mask = 1 << offset;
2638
2640 }
2641 }
2642
2644 {
2645
2646 int offset;
2647 int mask;
2648
2649 if ( part_id >= 1 && part_id <= 31 )
2650 {
2651 offset = part_id - 1;
2652 mask = 1 << offset;
2653
2655 {
2656 return true;
2657 }
2658 }
2659 else if ( part_id >= 32 && part_id <= 62 )
2660 {
2661 offset = ( part_id % 32 );
2662 mask = 1 << offset;
2663
2665 {
2666 return true;
2667 }
2668 }
2669 else if ( part_id >= 63 && part_id <= 93 )
2670 {
2671 offset = ( part_id % 63 );
2672 mask = 1 << offset;
2673
2675 {
2676 return true;
2677 }
2678 }
2679
2680 return false;
2681 }
2682
2684 {
2687 }
2688
2690 {
2691
2694 }
2695
2697 {
2699 {
2702
2703 switch( build_action_id )
2704 {
2708 }
2709 }
2710 }
2711
2712
2714 {
2716 bool is_base = part.
IsBase();
2719 if ( is_part_built_sync )
2720 {
2722 {
2726
2727 if (is_base)
2728 {
2731 }
2732 }
2733 }
2734 else
2735 {
2737 {
2741
2742 if (is_base)
2743 {
2746 }
2747 }
2748 }
2749
2750
2752 }
2753
2754
2756 {
2759
2760 for ( int i = 0; i < construction_parts.Count(); ++i )
2761 {
2762 string key = construction_parts.GetKey( i );
2765 }
2766
2767
2769 }
2770
2772 {
2775
2776 for ( int i = 0; i < construction_parts.Count(); ++i )
2777 {
2778 string key = construction_parts.GetKey( i );
2780
2781 if ( value.
GetId() ==
id )
2782 {
2783 return value;
2784 }
2785 }
2786
2787 return NULL;
2788 }
2789
2790
2791
2793 {
2795 }
2796
2798 {
2800 }
2801
2803 {
2804 return true;
2805 }
2806
2808 {
2809 return false;
2810 }
2811
2812
2814 {
2817 {
2819 }
2820
2821 return construction_kit;
2822 }
2823
2825 {
2828 {
2830 }
2831 }
2832
2834 {
2836 }
2837
2839 {
2840 return "";
2841 }
2842
2844 {
2847 }
2848
2849
2851 {
2854 }
2855
2856
2858 {
2859 super.OnStoreSave( ctx );
2860
2861
2865
2867 }
2868
2870 {
2871 if ( !super.OnStoreLoad( ctx, version ) )
2872 return false;
2873
2874
2875
2877 {
2879 return false;
2880 }
2882 {
2884 return false;
2885 }
2887 {
2889 return false;
2890 }
2891
2892
2894 {
2896 return false;
2897 }
2898
2899
2900 return true;
2901 }
2902
2904 {
2905 super.AfterStoreLoad();
2906
2908 {
2910 }
2911 }
2912
2914 {
2915
2917
2918
2921
2922
2924 }
2925
2927 {
2928 super.OnCreatePhysics();
2931 }
2932
2934 {
2936 return;
2937
2938 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2939
2941 return;
2942
2944 string part_name = zone;
2946
2948 {
2949 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2950
2951 if ( construction_part && construction.IsPartConstructed( part_name ) )
2952 {
2954 construction.DestroyConnectedParts(part_name);
2955 }
2956
2957
2958 if ( part_name.
Contains(
"barbed") )
2959 {
2960 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2961 if (barbed_wire)
2962 barbed_wire.SetMountedState( false );
2963 }
2964 }
2965 }
2966
2968 {
2970 {
2972 }
2973
2974 super.EEOnAfterLoad();
2975 }
2976
2978 {
2979 super.EEInit();
2980
2981
2983
2984
2985 #ifdef DEVELOPER
2987 #endif
2988 }
2989
2991 {
2992 super.EEItemAttached( item, slot_name );
2993
2997 }
2998
3000 {
3001 super.EEItemDetached( item, slot_name );
3002
3005 }
3006
3007 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3008 {
3011
3014 }
3015
3016
3018 {
3019 return true;
3020 }
3021
3022
3023
3025 {
3027
3028
3029 if (construtionPart.
IsBase())
3030 {
3032
3033
3035 }
3036
3037
3039
3040
3042
3043
3045
3047
3049
3050
3052
3053
3055 }
3056
3058 {
3059
3061 }
3062
3063
3065 {
3068
3069
3071
3072
3074
3075
3077
3078
3080
3082
3083
3085
3086
3088
3089
3090 if (construtionPart.
IsBase())
3091 {
3092
3094 }
3095
3098 }
3099
3101 {
3102
3104 }
3105
3106
3107 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3108 {
3111
3112
3114
3115
3117
3118
3120
3121
3123
3125
3126
3128
3129
3131
3132
3133 if (construtionPart.
IsBase())
3134 {
3135
3137 }
3138
3141 }
3142
3144 {
3145
3147 }
3148
3150 {
3151 bool process = false;
3152
3153
3157
3158 if (process)
3159 {
3160 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3161 {
3163 return;
3164 }
3165
3167 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3168 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3169
3170
3172 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3173 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3174 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3175 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3176 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3177 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3178 mins = minTmp;
3179 maxs = maxTmp;
3180
3181 maxs[1] = maxs[1] + 0.35;
3182
3184 }
3185 }
3186
3188 {
3191
3192
3194 foreach (
EntityAI entity : foundEntities)
3195 {
3198 }
3199 }
3200
3201
3203 {
3205
3209 }
3210
3212 {
3214
3216 {
3218 }
3219 else
3220 {
3222 }
3223
3225 }
3226
3228 {
3230
3232 foreach (
string slotName : attachmentSlots)
3233 {
3235 }
3236
3237
3240 else
3242
3244 }
3245
3247 {
3248 string slotNameMounted = slot_name + "_Mounted";
3249 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3250
3251 if (attachment)
3252 {
3253 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3254 if (barbedWire && barbedWire.IsMounted())
3256 else
3258
3259 if (is_locked)
3260 {
3261 SetAnimationPhase(slotNameMounted, 0);
3262 SetAnimationPhase(slot_name, 1);
3263 }
3264 else
3265 {
3266 SetAnimationPhase(slotNameMounted, 1);
3267 SetAnimationPhase(slot_name, 0);
3268 }
3269 }
3270 else
3271 {
3272 SetAnimationPhase(slotNameMounted, 1);
3273 SetAnimationPhase(slot_name, 1);
3274
3276 }
3277 }
3278
3279
3281 {
3284
3287
3290
3291 foreach (
string slotName : attachmentSlots)
3292 {
3294 }
3295
3296
3298 {
3301
3303 }
3304 else
3305 {
3308
3310 }
3311
3314 }
3315
3317 {
3318
3320 return;
3321
3322 string slot_name_mounted = slot_name + "_Mounted";
3323 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3324
3325
3327 RemoveProxyPhysics( slot_name_mounted );
3328 RemoveProxyPhysics( slot_name );
3329
3330 if ( attachment )
3331 {
3333 if ( is_locked )
3334 {
3336 AddProxyPhysics( slot_name_mounted );
3337 }
3338 else
3339 {
3341 AddProxyPhysics( slot_name );
3342 }
3343 }
3344 }
3345
3347 {
3348 SetAffectPathgraph( true, false );
3350 }
3351
3353 {
3354 return true;
3355 }
3356
3358 {
3359 return true;
3360 }
3361
3363 {
3364 if ( attachment )
3365 {
3367 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3368
3369 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3370 }
3371
3372 return false;
3373 }
3374
3376 {
3378 }
3379
3380
3382 {
3383 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3384 if (
GetGame().ConfigIsExisting( config_path ) )
3385 {
3387 }
3388 }
3389
3391 {
3392 return true;
3393 }
3394
3396 {
3397 return true;
3398 }
3399
3401 {
3402 return true;
3403 }
3404
3405
3407 {
3409 {
3411 }
3412
3414 }
3415
3417 {
3419 }
3420
3421
3422
3424 {
3425 return super.CanReceiveAttachment(attachment, slotId);
3426 }
3427
3429 {
3430 int attachment_count = GetInventory().AttachmentCount();
3431 if ( attachment_count > 0 )
3432 {
3433 if (
HasBase() && attachment_count == 1 )
3434 {
3435 return false;
3436 }
3437
3438 return true;
3439 }
3440
3441 return false;
3442 }
3443
3445 {
3446 return true;
3447 }
3448
3450 {
3451 return false;
3452 }
3453
3454
3456 {
3457 return false;
3458 }
3459
3461 {
3462 return false;
3463 }
3464
3465
3467 {
3468 return false;
3469 }
3470
3471
3472
3474 {
3475 return true;
3476 }
3477
3479 {
3480 return true;
3481 }
3482
3485 {
3486 return false;
3487 }
3488
3489
3491 {
3492 return true;
3493 }
3494
3495
3497 {
3498 return false;
3499 }
3500
3501
3503 {
3504 return true;
3505 }
3506
3507
3509 {
3510 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3511 {
3512 return false;
3513 }
3514
3515 return true;
3516 }
3517
3519 {
3522
3523 return item;
3524 }
3525
3526
3528 {
3530 {
3531
3533
3534
3537
3539 if ( MemoryPointExists( slot_name + "_min" ) )
3540 {
3541 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3542 }
3543 if ( MemoryPointExists( slot_name + "_max" ) )
3544 {
3545 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3546 }
3547
3548
3551
3552
3555 center = ModelToWorld( center );
3556
3557
3560
3561 areaDamage.SetExtents( extents[0], extents[1] );
3562 areaDamage.SetAreaPosition( center );
3563 areaDamage.SetAreaOrientation( orientation );
3566 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3567 areaDamage.SetAmmoName( "BarbedWireHit" );
3568 areaDamage.Spawn();
3569
3571 }
3572 }
3573
3575 {
3576 if ( angle_deg != 0 )
3577 {
3578
3579 orientation[0] = orientation[0] - angle_deg;
3580
3581
3583 if ( MemoryPointExists( "rotate_axis" ) )
3584 {
3585 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3586 }
3587 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];
3588 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];
3589 center[0] = r_center_x;
3590 center[2] = r_center_z;
3591 }
3592 }
3593
3595 {
3597 {
3600 {
3601 if (areaDamage)
3602 {
3603 areaDamage.Destroy();
3604 }
3605
3607 }
3608 }
3609 }
3610
3612 {
3613 return true;
3614 }
3615
3616
3617
3618
3620 {
3622 }
3623
3625 {
3627 }
3628
3630 {
3632 }
3633
3635 {
3637
3638 switch ( material_type )
3639 {
3645 }
3646
3647 return "";
3648 }
3649
3651 {
3653
3654 switch ( material_type )
3655 {
3661 }
3662
3663 return "";
3664 }
3665
3666
3668 {
3670 {
3671
3673 {
3674 SetHealth(slot_name,"Health",item.GetHealth());
3675 }
3676 }
3677 }
3678
3680 {
3681 return 111;
3682 }
3683
3685 {
3686 super.SetActions();
3687
3691 }
3692
3693
3694
3695
3697 {
3698 }
3699
3702 {
3703 return null;
3704 }
3705
3707 {
3709 }
3710
3712 {
3715
3716 Man p;
3717
3718 #ifdef SERVER
3721 if (players.Count())
3722 p = players[0];
3723 #else
3725 #endif
3726
3728 {
3729 bool excluded = false;
3731 if (excludes)
3732 {
3733 foreach (string exclude : excludes)
3734 {
3736 {
3737 excluded = true;
3738 break;
3739 }
3740 }
3741 }
3742
3743 if (!excluded)
3744 {
3746 }
3747 }
3748
3750 }
3751}
3752
3754{
3755#ifdef BSB_DEBUG
3757#else
3758
3759#endif
3760}
3762{
3763#ifdef BSB_DEBUG_SPAM
3765#else
3766
3767#endif
3768}
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.