2459{
2461
2463
2465
2467
2473
2474
2475
2481
2487
2489
2493
2494
2496 {
2498
2499
2500 RegisterNetSyncVariableInt( "m_SyncParts01" );
2501 RegisterNetSyncVariableInt( "m_SyncParts02" );
2502 RegisterNetSyncVariableInt( "m_SyncParts03" );
2503 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2504 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2505 RegisterNetSyncVariableBool( "m_HasBase" );
2506
2507
2509
2510 if (ConfigIsExisting("hybridAttachments"))
2511 {
2514 }
2515 if (ConfigIsExisting("mountables"))
2516 {
2519 }
2520
2522 }
2523
2525 {
2526 super.EEDelete(parent);
2527
2529 {
2530 areaDamage.Destroy();
2531 }
2532
2533 }
2534
2536 {
2537 return "disableBaseDamage";
2538 }
2539
2541 {
2542 return true;
2543 }
2544
2546 {
2547 return EInventoryIconVisibility.HIDE_VICINITY;
2548 }
2549
2550
2552 {
2554 {
2555 SetSynchDirty();
2556 }
2557 }
2558
2560 {
2562 super.OnVariablesSynchronized();
2563
2565 }
2566
2568 {
2569
2571
2572
2574
2575
2577 }
2578
2579
2581 {
2582
2583 int offset;
2584 int mask;
2585
2586 if ( part_id >= 1 && part_id <= 31 )
2587 {
2588 offset = part_id - 1;
2589 mask = 1 << offset;
2590
2592 }
2593 else if ( part_id >= 32 && part_id <= 62 )
2594 {
2595 offset = ( part_id % 32 );
2596 mask = 1 << offset;
2597
2599 }
2600 else if ( part_id >= 63 && part_id <= 93 )
2601 {
2602 offset = ( part_id % 63 );
2603 mask = 1 << offset;
2604
2606 }
2607 }
2608
2610 {
2611
2612 int offset;
2613 int mask;
2614
2615 if ( part_id >= 1 && part_id <= 31 )
2616 {
2617 offset = part_id - 1;
2618 mask = 1 << offset;
2619
2621 }
2622 else if ( part_id >= 32 && part_id <= 62 )
2623 {
2624 offset = ( part_id % 32 );
2625 mask = 1 << offset;
2626
2628 }
2629 else if ( part_id >= 63 && part_id <= 93 )
2630 {
2631 offset = ( part_id % 63 );
2632 mask = 1 << offset;
2633
2635 }
2636 }
2637
2639 {
2640
2641 int offset;
2642 int mask;
2643
2644 if ( part_id >= 1 && part_id <= 31 )
2645 {
2646 offset = part_id - 1;
2647 mask = 1 << offset;
2648
2650 {
2651 return true;
2652 }
2653 }
2654 else if ( part_id >= 32 && part_id <= 62 )
2655 {
2656 offset = ( part_id % 32 );
2657 mask = 1 << offset;
2658
2660 {
2661 return true;
2662 }
2663 }
2664 else if ( part_id >= 63 && part_id <= 93 )
2665 {
2666 offset = ( part_id % 63 );
2667 mask = 1 << offset;
2668
2670 {
2671 return true;
2672 }
2673 }
2674
2675 return false;
2676 }
2677
2679 {
2682 }
2683
2685 {
2686
2689 }
2690
2692 {
2694 {
2697
2698 switch( build_action_id )
2699 {
2703 }
2704 }
2705 }
2706
2707
2709 {
2711 bool is_base = part.
IsBase();
2714 if ( is_part_built_sync )
2715 {
2717 {
2721
2722 if (is_base)
2723 {
2726 }
2727 }
2728 }
2729 else
2730 {
2732 {
2736
2737 if (is_base)
2738 {
2741 }
2742 }
2743 }
2744
2745
2747 }
2748
2749
2751 {
2754
2755 for ( int i = 0; i < construction_parts.Count(); ++i )
2756 {
2757 string key = construction_parts.GetKey( i );
2760 }
2761
2762
2764 }
2765
2767 {
2770
2771 for ( int i = 0; i < construction_parts.Count(); ++i )
2772 {
2773 string key = construction_parts.GetKey( i );
2775
2776 if ( value.
GetId() ==
id )
2777 {
2778 return value;
2779 }
2780 }
2781
2782 return NULL;
2783 }
2784
2785
2786
2788 {
2790 }
2791
2793 {
2795 }
2796
2798 {
2799 return true;
2800 }
2801
2803 {
2804 return false;
2805 }
2806
2807
2809 {
2812 {
2814 }
2815
2816 return construction_kit;
2817 }
2818
2820 {
2823 {
2825 }
2826 }
2827
2829 {
2831 }
2832
2834 {
2835 return "";
2836 }
2837
2839 {
2842 }
2843
2844
2846 {
2849 }
2850
2851
2853 {
2854 super.OnStoreSave( ctx );
2855
2856
2860
2862 }
2863
2865 {
2866 if ( !super.OnStoreLoad( ctx, version ) )
2867 return false;
2868
2869
2870
2872 {
2874 return false;
2875 }
2877 {
2879 return false;
2880 }
2882 {
2884 return false;
2885 }
2886
2887
2889 {
2891 return false;
2892 }
2893
2894
2895 return true;
2896 }
2897
2899 {
2900 super.AfterStoreLoad();
2901
2903 {
2905 }
2906 }
2907
2909 {
2910
2912
2913
2916
2917
2919 }
2920
2922 {
2923 super.OnCreatePhysics();
2926 }
2927
2929 {
2931 return;
2932
2933 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2934
2936 return;
2937
2939 string part_name = zone;
2941
2943 {
2944 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2945
2946 if ( construction_part && construction.IsPartConstructed( part_name ) )
2947 {
2949 construction.DestroyConnectedParts(part_name);
2950 }
2951
2952
2953 if ( part_name.
Contains(
"barbed") )
2954 {
2955 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2956 if (barbed_wire)
2957 barbed_wire.SetMountedState( false );
2958 }
2959 }
2960 }
2961
2963 {
2965 {
2967 }
2968
2969 super.EEOnAfterLoad();
2970 }
2971
2973 {
2974 super.EEInit();
2975
2976
2978
2979
2980 #ifdef DEVELOPER
2982 #endif
2983 }
2984
2986 {
2987 super.EEItemAttached( item, slot_name );
2988
2992 }
2993
2995 {
2996 super.EEItemDetached( item, slot_name );
2997
3000 }
3001
3002 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3003 {
3006
3009 }
3010
3011
3013 {
3014 return true;
3015 }
3016
3017
3018
3020 {
3022
3023
3024 if (construtionPart.
IsBase())
3025 {
3027
3028
3030 }
3031
3032
3034
3035
3037
3038
3040
3042
3044
3045
3047
3048
3050 }
3051
3053 {
3054
3056 }
3057
3058
3060 {
3063
3064
3066
3067
3069
3070
3072
3073
3075
3077
3078
3080
3081
3083
3084
3085 if (construtionPart.
IsBase())
3086 {
3087
3089 }
3090
3093 }
3094
3096 {
3097
3099 }
3100
3101
3102 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3103 {
3106
3107
3109
3110
3112
3113
3115
3116
3118
3120
3121
3123
3124
3126
3127
3128 if (construtionPart.
IsBase())
3129 {
3130
3132 }
3133
3136 }
3137
3139 {
3140
3142 }
3143
3145 {
3146 bool process = false;
3147
3148
3152
3153 if (process)
3154 {
3155 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3156 {
3158 return;
3159 }
3160
3162 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3163 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3164
3165
3167 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3168 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3169 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3170 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3171 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3172 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3173 mins = minTmp;
3174 maxs = maxTmp;
3175
3176 maxs[1] = maxs[1] + 0.35;
3177
3179 }
3180 }
3181
3183 {
3186
3187
3189 foreach (
EntityAI entity : foundEntities)
3190 {
3193 }
3194 }
3195
3196
3198 {
3200
3204 }
3205
3207 {
3209
3211 {
3213 }
3214 else
3215 {
3217 }
3218
3220 }
3221
3223 {
3225
3227 foreach (
string slotName : attachmentSlots)
3228 {
3230 }
3231
3232
3235 else
3237
3239 }
3240
3242 {
3243 string slotNameMounted = slot_name + "_Mounted";
3244 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3245
3246 if (attachment)
3247 {
3248 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3249 if (barbedWire && barbedWire.IsMounted())
3251 else
3253
3254 if (is_locked)
3255 {
3256 SetAnimationPhase(slotNameMounted, 0);
3257 SetAnimationPhase(slot_name, 1);
3258 }
3259 else
3260 {
3261 SetAnimationPhase(slotNameMounted, 1);
3262 SetAnimationPhase(slot_name, 0);
3263 }
3264 }
3265 else
3266 {
3267 SetAnimationPhase(slotNameMounted, 1);
3268 SetAnimationPhase(slot_name, 1);
3269
3271 }
3272 }
3273
3274
3276 {
3279
3282
3285
3286 foreach (
string slotName : attachmentSlots)
3287 {
3289 }
3290
3291
3293 {
3296
3298 }
3299 else
3300 {
3303
3305 }
3306
3309 }
3310
3312 {
3313
3315 return;
3316
3317 string slot_name_mounted = slot_name + "_Mounted";
3318 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3319
3320
3322 RemoveProxyPhysics( slot_name_mounted );
3323 RemoveProxyPhysics( slot_name );
3324
3325 if ( attachment )
3326 {
3328 if ( is_locked )
3329 {
3331 AddProxyPhysics( slot_name_mounted );
3332 }
3333 else
3334 {
3336 AddProxyPhysics( slot_name );
3337 }
3338 }
3339 }
3340
3342 {
3343 SetAffectPathgraph( true, false );
3345 }
3346
3348 {
3349 return true;
3350 }
3351
3353 {
3354 return true;
3355 }
3356
3358 {
3359 if ( attachment )
3360 {
3362 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3363
3364 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3365 }
3366
3367 return false;
3368 }
3369
3371 {
3373 }
3374
3375
3377 {
3378 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3379 if (
GetGame().ConfigIsExisting( config_path ) )
3380 {
3382 }
3383 }
3384
3386 {
3387 return true;
3388 }
3389
3391 {
3392 return true;
3393 }
3394
3396 {
3397 return true;
3398 }
3399
3400
3402 {
3404 {
3406 }
3407
3409 }
3410
3412 {
3414 }
3415
3416
3417
3419 {
3420 return super.CanReceiveAttachment(attachment, slotId);
3421 }
3422
3424 {
3425 int attachment_count = GetInventory().AttachmentCount();
3426 if ( attachment_count > 0 )
3427 {
3428 if (
HasBase() && attachment_count == 1 )
3429 {
3430 return false;
3431 }
3432
3433 return true;
3434 }
3435
3436 return false;
3437 }
3438
3440 {
3441 return true;
3442 }
3443
3445 {
3446 return false;
3447 }
3448
3449
3451 {
3452 return false;
3453 }
3454
3456 {
3457 return false;
3458 }
3459
3460
3462 {
3463 return false;
3464 }
3465
3466
3467
3469 {
3470 return true;
3471 }
3472
3474 {
3475 return true;
3476 }
3477
3480 {
3481 return false;
3482 }
3483
3484
3486 {
3487 return true;
3488 }
3489
3490
3492 {
3493 return false;
3494 }
3495
3496
3498 {
3499 return true;
3500 }
3501
3502
3504 {
3505 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3506 {
3507 return false;
3508 }
3509
3510 return true;
3511 }
3512
3514 {
3517
3518 return item;
3519 }
3520
3521
3523 {
3525 {
3526
3528
3529
3532
3534 if ( MemoryPointExists( slot_name + "_min" ) )
3535 {
3536 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3537 }
3538 if ( MemoryPointExists( slot_name + "_max" ) )
3539 {
3540 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3541 }
3542
3543
3546
3547
3550 center = ModelToWorld( center );
3551
3552
3555
3556 areaDamage.SetExtents( extents[0], extents[1] );
3557 areaDamage.SetAreaPosition( center );
3558 areaDamage.SetAreaOrientation( orientation );
3561 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3562 areaDamage.SetAmmoName( "BarbedWireHit" );
3563 areaDamage.Spawn();
3564
3566 }
3567 }
3568
3570 {
3571 if ( angle_deg != 0 )
3572 {
3573
3574 orientation[0] = orientation[0] - angle_deg;
3575
3576
3578 if ( MemoryPointExists( "rotate_axis" ) )
3579 {
3580 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3581 }
3582 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];
3583 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];
3584 center[0] = r_center_x;
3585 center[2] = r_center_z;
3586 }
3587 }
3588
3590 {
3592 {
3595 {
3596 if (areaDamage)
3597 {
3598 areaDamage.Destroy();
3599 }
3600
3602 }
3603 }
3604 }
3605
3607 {
3608 return true;
3609 }
3610
3611
3612
3613
3615 {
3617 }
3618
3620 {
3622 }
3623
3625 {
3627 }
3628
3630 {
3632
3633 switch ( material_type )
3634 {
3640 }
3641
3642 return "";
3643 }
3644
3646 {
3648
3649 switch ( material_type )
3650 {
3656 }
3657
3658 return "";
3659 }
3660
3661
3663 {
3665 {
3666
3668 {
3669 SetHealth(slot_name,"Health",item.GetHealth());
3670 }
3671 }
3672 }
3673
3675 {
3676 return 111;
3677 }
3678
3680 {
3681 super.SetActions();
3682
3686 }
3687
3688
3689
3690
3692 {
3693 }
3694
3697 {
3698 return null;
3699 }
3700
3702 {
3704 }
3705
3707 {
3710
3711 Man p;
3712
3713 #ifdef SERVER
3716 if (players.Count())
3717 p = players[0];
3718 #else
3720 #endif
3721
3723 {
3724 bool excluded = false;
3726 if (excludes)
3727 {
3728 foreach (string exclude : excludes)
3729 {
3731 {
3732 excluded = true;
3733 break;
3734 }
3735 }
3736 }
3737
3738 if (!excluded)
3739 {
3741 }
3742 }
3743
3745 }
3746}
3747
3749{
3750#ifdef BSB_DEBUG
3752#else
3753
3754#endif
3755}
3757{
3758#ifdef BSB_DEBUG_SPAM
3760#else
3761
3762#endif
3763}
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.