2424{
2426
2428
2430
2432
2438
2439
2440
2446
2452
2454
2458
2459
2461 {
2463
2464
2465 RegisterNetSyncVariableInt( "m_SyncParts01" );
2466 RegisterNetSyncVariableInt( "m_SyncParts02" );
2467 RegisterNetSyncVariableInt( "m_SyncParts03" );
2468 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2469 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2470 RegisterNetSyncVariableBool( "m_HasBase" );
2471
2472
2474
2475 if (ConfigIsExisting("hybridAttachments"))
2476 {
2479 }
2480 if (ConfigIsExisting("mountables"))
2481 {
2484 }
2485
2487 }
2488
2490 {
2491 super.EEDelete(parent);
2492
2494 {
2495 areaDamage.Destroy();
2496 }
2497
2498 }
2499
2501 {
2502 return "disableBaseDamage";
2503 }
2504
2506 {
2507 return true;
2508 }
2509
2511 {
2512 return EInventoryIconVisibility.HIDE_VICINITY;
2513 }
2514
2515
2517 {
2519 {
2520 SetSynchDirty();
2521 }
2522 }
2523
2525 {
2527 super.OnVariablesSynchronized();
2528
2530 }
2531
2533 {
2534
2536
2537
2539
2540
2542 }
2543
2544
2546 {
2547
2548 int offset;
2549 int mask;
2550
2551 if ( part_id >= 1 && part_id <= 31 )
2552 {
2553 offset = part_id - 1;
2554 mask = 1 << offset;
2555
2557 }
2558 else if ( part_id >= 32 && part_id <= 62 )
2559 {
2560 offset = ( part_id % 32 );
2561 mask = 1 << offset;
2562
2564 }
2565 else if ( part_id >= 63 && part_id <= 93 )
2566 {
2567 offset = ( part_id % 63 );
2568 mask = 1 << offset;
2569
2571 }
2572 }
2573
2575 {
2576
2577 int offset;
2578 int mask;
2579
2580 if ( part_id >= 1 && part_id <= 31 )
2581 {
2582 offset = part_id - 1;
2583 mask = 1 << offset;
2584
2586 }
2587 else if ( part_id >= 32 && part_id <= 62 )
2588 {
2589 offset = ( part_id % 32 );
2590 mask = 1 << offset;
2591
2593 }
2594 else if ( part_id >= 63 && part_id <= 93 )
2595 {
2596 offset = ( part_id % 63 );
2597 mask = 1 << offset;
2598
2600 }
2601 }
2602
2604 {
2605
2606 int offset;
2607 int mask;
2608
2609 if ( part_id >= 1 && part_id <= 31 )
2610 {
2611 offset = part_id - 1;
2612 mask = 1 << offset;
2613
2615 {
2616 return true;
2617 }
2618 }
2619 else if ( part_id >= 32 && part_id <= 62 )
2620 {
2621 offset = ( part_id % 32 );
2622 mask = 1 << offset;
2623
2625 {
2626 return true;
2627 }
2628 }
2629 else if ( part_id >= 63 && part_id <= 93 )
2630 {
2631 offset = ( part_id % 63 );
2632 mask = 1 << offset;
2633
2635 {
2636 return true;
2637 }
2638 }
2639
2640 return false;
2641 }
2642
2644 {
2647 }
2648
2650 {
2651
2654 }
2655
2657 {
2659 {
2662
2663 switch( build_action_id )
2664 {
2668 }
2669 }
2670 }
2671
2672
2674 {
2676 bool is_base = part.
IsBase();
2679 if ( is_part_built_sync )
2680 {
2682 {
2686
2687 if (is_base)
2688 {
2691 }
2692 }
2693 }
2694 else
2695 {
2697 {
2701
2702 if (is_base)
2703 {
2706 }
2707 }
2708 }
2709
2710
2712 }
2713
2714
2716 {
2719
2720 for ( int i = 0; i < construction_parts.Count(); ++i )
2721 {
2722 string key = construction_parts.GetKey( i );
2725 }
2726
2727
2729 }
2730
2732 {
2735
2736 for ( int i = 0; i < construction_parts.Count(); ++i )
2737 {
2738 string key = construction_parts.GetKey( i );
2740
2741 if ( value.
GetId() ==
id )
2742 {
2743 return value;
2744 }
2745 }
2746
2747 return NULL;
2748 }
2749
2750
2751
2753 {
2755 }
2756
2758 {
2760 }
2761
2763 {
2764 return true;
2765 }
2766
2768 {
2769 return false;
2770 }
2771
2772
2774 {
2777 {
2779 }
2780
2781 return construction_kit;
2782 }
2783
2785 {
2788 {
2790 }
2791 }
2792
2794 {
2796 }
2797
2799 {
2800 return "";
2801 }
2802
2804 {
2807 }
2808
2809
2811 {
2814 }
2815
2816
2818 {
2819 super.OnStoreSave( ctx );
2820
2821
2825
2827 }
2828
2830 {
2831 if ( !super.OnStoreLoad( ctx, version ) )
2832 return false;
2833
2834
2835
2837 {
2839 return false;
2840 }
2842 {
2844 return false;
2845 }
2847 {
2849 return false;
2850 }
2851
2852
2854 {
2856 return false;
2857 }
2858
2859
2860 return true;
2861 }
2862
2864 {
2865 super.AfterStoreLoad();
2866
2868 {
2870 }
2871 }
2872
2874 {
2875
2877
2878
2881
2882
2884 }
2885
2887 {
2888 super.OnCreatePhysics();
2891 }
2892
2894 {
2896 return;
2897
2898 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2899
2901 return;
2902
2904 string part_name = zone;
2906
2908 {
2909 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2910
2911 if ( construction_part && construction.IsPartConstructed( part_name ) )
2912 {
2914 construction.DestroyConnectedParts(part_name);
2915 }
2916
2917
2918 if ( part_name.
Contains(
"barbed") )
2919 {
2920 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2921 if (barbed_wire)
2922 barbed_wire.SetMountedState( false );
2923 }
2924 }
2925 }
2926
2928 {
2930 {
2932 }
2933
2934 super.EEOnAfterLoad();
2935 }
2936
2938 {
2939 super.EEInit();
2940
2941
2943
2944
2945 #ifdef DEVELOPER
2947 #endif
2948 }
2949
2951 {
2952 super.EEItemAttached( item, slot_name );
2953
2957 }
2958
2960 {
2961 super.EEItemDetached( item, slot_name );
2962
2965 }
2966
2967 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2968 {
2971
2974 }
2975
2976
2978 {
2979 return true;
2980 }
2981
2982
2983
2985 {
2987
2988
2989 if (construtionPart.
IsBase())
2990 {
2992
2993
2995 }
2996
2997
2999
3000
3002
3003
3005
3007
3009
3010
3012
3013
3015 }
3016
3018 {
3019
3021 }
3022
3023
3025 {
3028
3029
3031
3032
3034
3035
3037
3038
3040
3042
3043
3045
3046
3048
3049
3050 if (construtionPart.
IsBase())
3051 {
3052
3054 }
3055
3058 }
3059
3061 {
3062
3064 }
3065
3066
3067 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3068 {
3071
3072
3074
3075
3077
3078
3080
3081
3083
3085
3086
3088
3089
3091
3092
3093 if (construtionPart.
IsBase())
3094 {
3095
3097 }
3098
3101 }
3102
3104 {
3105
3107 }
3108
3110 {
3111 bool process = false;
3112
3113
3117
3118 if (process)
3119 {
3120 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3121 {
3123 return;
3124 }
3125
3127 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3128 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3129
3130
3132 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3133 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3134 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3135 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3136 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3137 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3138 mins = minTmp;
3139 maxs = maxTmp;
3140
3141 maxs[1] = maxs[1] + 0.35;
3142
3144 }
3145 }
3146
3148 {
3151
3152
3154 foreach (
EntityAI entity : foundEntities)
3155 {
3158 }
3159 }
3160
3161
3163 {
3165
3169 }
3170
3172 {
3174
3176 {
3178 }
3179 else
3180 {
3182 }
3183
3185 }
3186
3188 {
3190
3192 foreach (
string slotName : attachmentSlots)
3193 {
3195 }
3196
3197
3200 else
3202
3204 }
3205
3207 {
3208 string slotNameMounted = slot_name + "_Mounted";
3209 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3210
3211 if (attachment)
3212 {
3213 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3214 if (barbedWire && barbedWire.IsMounted())
3216 else
3218
3219 if (is_locked)
3220 {
3221 SetAnimationPhase(slotNameMounted, 0);
3222 SetAnimationPhase(slot_name, 1);
3223 }
3224 else
3225 {
3226 SetAnimationPhase(slotNameMounted, 1);
3227 SetAnimationPhase(slot_name, 0);
3228 }
3229 }
3230 else
3231 {
3232 SetAnimationPhase(slotNameMounted, 1);
3233 SetAnimationPhase(slot_name, 1);
3234
3236 }
3237 }
3238
3239
3241 {
3244
3247
3250
3251 foreach (
string slotName : attachmentSlots)
3252 {
3254 }
3255
3256
3258 {
3261
3263 }
3264 else
3265 {
3268
3270 }
3271
3274 }
3275
3277 {
3278
3280 return;
3281
3282 string slot_name_mounted = slot_name + "_Mounted";
3283 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3284
3285
3287 RemoveProxyPhysics( slot_name_mounted );
3288 RemoveProxyPhysics( slot_name );
3289
3290 if ( attachment )
3291 {
3293 if ( is_locked )
3294 {
3296 AddProxyPhysics( slot_name_mounted );
3297 }
3298 else
3299 {
3301 AddProxyPhysics( slot_name );
3302 }
3303 }
3304 }
3305
3307 {
3308 SetAffectPathgraph( true, false );
3310 }
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return true;
3320 }
3321
3323 {
3324 if ( attachment )
3325 {
3327 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3328
3329 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3330 }
3331
3332 return false;
3333 }
3334
3336 {
3338 }
3339
3340
3342 {
3343 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3344 if (
GetGame().ConfigIsExisting( config_path ) )
3345 {
3347 }
3348 }
3349
3351 {
3352 return true;
3353 }
3354
3356 {
3357 return true;
3358 }
3359
3361 {
3362 return true;
3363 }
3364
3365
3367 {
3369 {
3371 }
3372
3374 }
3375
3377 {
3379 }
3380
3381
3382
3384 {
3385 return super.CanReceiveAttachment(attachment, slotId);
3386 }
3387
3389 {
3390 int attachment_count = GetInventory().AttachmentCount();
3391 if ( attachment_count > 0 )
3392 {
3393 if (
HasBase() && attachment_count == 1 )
3394 {
3395 return false;
3396 }
3397
3398 return true;
3399 }
3400
3401 return false;
3402 }
3403
3405 {
3406 return true;
3407 }
3408
3410 {
3411 return false;
3412 }
3413
3414
3416 {
3417 return false;
3418 }
3419
3421 {
3422 return false;
3423 }
3424
3425
3427 {
3428 return false;
3429 }
3430
3431
3432
3434 {
3435 return true;
3436 }
3437
3439 {
3440 return true;
3441 }
3442
3445 {
3446 return false;
3447 }
3448
3449
3451 {
3452 return true;
3453 }
3454
3455
3457 {
3458 return false;
3459 }
3460
3461
3463 {
3464 return true;
3465 }
3466
3467
3469 {
3470 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3471 {
3472 return false;
3473 }
3474
3475 return true;
3476 }
3477
3479 {
3482
3483 return item;
3484 }
3485
3486
3488 {
3490 {
3491
3493
3494
3497
3499 if ( MemoryPointExists( slot_name + "_min" ) )
3500 {
3501 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3502 }
3503 if ( MemoryPointExists( slot_name + "_max" ) )
3504 {
3505 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3506 }
3507
3508
3511
3512
3515 center = ModelToWorld( center );
3516
3517
3520
3521 areaDamage.SetExtents( extents[0], extents[1] );
3522 areaDamage.SetAreaPosition( center );
3523 areaDamage.SetAreaOrientation( orientation );
3526 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3527 areaDamage.SetAmmoName( "BarbedWireHit" );
3528 areaDamage.Spawn();
3529
3531 }
3532 }
3533
3535 {
3536 if ( angle_deg != 0 )
3537 {
3538
3539 orientation[0] = orientation[0] - angle_deg;
3540
3541
3543 if ( MemoryPointExists( "rotate_axis" ) )
3544 {
3545 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3546 }
3547 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];
3548 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];
3549 center[0] = r_center_x;
3550 center[2] = r_center_z;
3551 }
3552 }
3553
3555 {
3557 {
3560 {
3561 if (areaDamage)
3562 {
3563 areaDamage.Destroy();
3564 }
3565
3567 }
3568 }
3569 }
3570
3572 {
3573 return true;
3574 }
3575
3576
3577
3578
3580 {
3582 }
3583
3585 {
3587 }
3588
3590 {
3592 }
3593
3595 {
3597
3598 switch ( material_type )
3599 {
3605 }
3606
3607 return "";
3608 }
3609
3611 {
3613
3614 switch ( material_type )
3615 {
3621 }
3622
3623 return "";
3624 }
3625
3626
3628 {
3630 {
3631
3633 {
3634 SetHealth(slot_name,"Health",item.GetHealth());
3635 }
3636 }
3637 }
3638
3640 {
3641 return 111;
3642 }
3643
3645 {
3646 super.SetActions();
3647
3651 }
3652
3653
3654
3655
3657 {
3658 }
3659
3662 {
3663 return null;
3664 }
3665
3667 {
3669 }
3670
3672 {
3675
3676 Man p;
3677
3678 #ifdef SERVER
3681 if (players.Count())
3682 p = players[0];
3683 #else
3685 #endif
3686
3688 {
3689 bool excluded = false;
3691 if (excludes)
3692 {
3693 foreach (string exclude : excludes)
3694 {
3696 {
3697 excluded = true;
3698 break;
3699 }
3700 }
3701 }
3702
3703 if (!excluded)
3704 {
3706 }
3707 }
3708
3710 }
3711}
3712
3714{
3715#ifdef BSB_DEBUG
3717#else
3718
3719#endif
3720}
3722{
3723#ifdef BSB_DEBUG_SPAM
3725#else
3726
3727#endif
3728}
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.