2357{
2359
2361
2363
2365
2371
2372
2373
2379
2385
2387
2391
2392
2394 {
2396
2397
2398 RegisterNetSyncVariableInt( "m_SyncParts01" );
2399 RegisterNetSyncVariableInt( "m_SyncParts02" );
2400 RegisterNetSyncVariableInt( "m_SyncParts03" );
2401 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2402 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2403 RegisterNetSyncVariableBool( "m_HasBase" );
2404
2405
2407
2408 if (ConfigIsExisting("hybridAttachments"))
2409 {
2412 }
2413 if (ConfigIsExisting("mountables"))
2414 {
2417 }
2418
2420 }
2421
2423 {
2424 super.EEDelete(parent);
2425
2427 {
2428 areaDamage.Destroy();
2429 }
2430
2431 }
2432
2434 {
2435 return "disableBaseDamage";
2436 }
2437
2439 {
2440 return true;
2441 }
2442
2444 {
2445 return EInventoryIconVisibility.HIDE_VICINITY;
2446 }
2447
2448
2450 {
2452 {
2453 SetSynchDirty();
2454 }
2455 }
2456
2458 {
2460 super.OnVariablesSynchronized();
2461
2463 }
2464
2466 {
2467
2469
2470
2472
2473
2475 }
2476
2477
2479 {
2480
2481 int offset;
2482 int mask;
2483
2484 if ( part_id >= 1 && part_id <= 31 )
2485 {
2486 offset = part_id - 1;
2487 mask = 1 << offset;
2488
2490 }
2491 else if ( part_id >= 32 && part_id <= 62 )
2492 {
2493 offset = ( part_id % 32 );
2494 mask = 1 << offset;
2495
2497 }
2498 else if ( part_id >= 63 && part_id <= 93 )
2499 {
2500 offset = ( part_id % 63 );
2501 mask = 1 << offset;
2502
2504 }
2505 }
2506
2508 {
2509
2510 int offset;
2511 int mask;
2512
2513 if ( part_id >= 1 && part_id <= 31 )
2514 {
2515 offset = part_id - 1;
2516 mask = 1 << offset;
2517
2519 }
2520 else if ( part_id >= 32 && part_id <= 62 )
2521 {
2522 offset = ( part_id % 32 );
2523 mask = 1 << offset;
2524
2526 }
2527 else if ( part_id >= 63 && part_id <= 93 )
2528 {
2529 offset = ( part_id % 63 );
2530 mask = 1 << offset;
2531
2533 }
2534 }
2535
2537 {
2538
2539 int offset;
2540 int mask;
2541
2542 if ( part_id >= 1 && part_id <= 31 )
2543 {
2544 offset = part_id - 1;
2545 mask = 1 << offset;
2546
2548 {
2549 return true;
2550 }
2551 }
2552 else if ( part_id >= 32 && part_id <= 62 )
2553 {
2554 offset = ( part_id % 32 );
2555 mask = 1 << offset;
2556
2558 {
2559 return true;
2560 }
2561 }
2562 else if ( part_id >= 63 && part_id <= 93 )
2563 {
2564 offset = ( part_id % 63 );
2565 mask = 1 << offset;
2566
2568 {
2569 return true;
2570 }
2571 }
2572
2573 return false;
2574 }
2575
2577 {
2580 }
2581
2583 {
2584
2587 }
2588
2590 {
2592 {
2595
2596 switch( build_action_id )
2597 {
2601 }
2602 }
2603 }
2604
2605
2607 {
2609 bool is_base = part.
IsBase();
2612 if ( is_part_built_sync )
2613 {
2615 {
2619
2620 if (is_base)
2621 {
2624 }
2625 }
2626 }
2627 else
2628 {
2630 {
2634
2635 if (is_base)
2636 {
2639 }
2640 }
2641 }
2642
2643
2645 }
2646
2647
2649 {
2652
2653 for ( int i = 0; i < construction_parts.Count(); ++i )
2654 {
2655 string key = construction_parts.GetKey( i );
2658 }
2659
2660
2662 }
2663
2665 {
2668
2669 for ( int i = 0; i < construction_parts.Count(); ++i )
2670 {
2671 string key = construction_parts.GetKey( i );
2673
2674 if ( value.
GetId() ==
id )
2675 {
2676 return value;
2677 }
2678 }
2679
2680 return NULL;
2681 }
2682
2683
2684
2686 {
2688 }
2689
2691 {
2693 }
2694
2696 {
2697 return true;
2698 }
2699
2701 {
2702 return false;
2703 }
2704
2705
2707 {
2710 {
2712 }
2713
2714 return construction_kit;
2715 }
2716
2718 {
2721 {
2723 }
2724 }
2725
2727 {
2729 }
2730
2732 {
2733 return "";
2734 }
2735
2737 {
2740 }
2741
2742
2744 {
2747 }
2748
2749
2751 {
2752 super.OnStoreSave( ctx );
2753
2754
2758
2760 }
2761
2763 {
2764 if ( !super.OnStoreLoad( ctx, version ) )
2765 return false;
2766
2767
2768
2770 {
2772 return false;
2773 }
2775 {
2777 return false;
2778 }
2780 {
2782 return false;
2783 }
2784
2785
2787 {
2789 return false;
2790 }
2791
2792
2793 return true;
2794 }
2795
2797 {
2798 super.AfterStoreLoad();
2799
2801 {
2803 }
2804 }
2805
2807 {
2808
2810
2811
2814
2815
2817 }
2818
2820 {
2821 super.OnCreatePhysics();
2824 }
2825
2827 {
2829 return;
2830
2831 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2832
2834 return;
2835
2837 string part_name = zone;
2839
2841 {
2842 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2843
2844 if ( construction_part && construction.IsPartConstructed( part_name ) )
2845 {
2847 construction.DestroyConnectedParts(part_name);
2848 }
2849
2850
2851 if ( part_name.
Contains(
"barbed") )
2852 {
2853 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2854 if (barbed_wire)
2855 barbed_wire.SetMountedState( false );
2856 }
2857 }
2858 }
2859
2861 {
2863 {
2865 }
2866
2867 super.EEOnAfterLoad();
2868 }
2869
2871 {
2872 super.EEInit();
2873
2874
2876
2877
2878 #ifdef DEVELOPER
2880 #endif
2881 }
2882
2884 {
2885 super.EEItemAttached( item, slot_name );
2886
2890 }
2891
2893 {
2894 super.EEItemDetached( item, slot_name );
2895
2898 }
2899
2900 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2901 {
2904
2907 }
2908
2909
2911 {
2912 return true;
2913 }
2914
2915
2916
2918 {
2920
2921
2922 if (construtionPart.
IsBase())
2923 {
2925
2926
2928 }
2929
2930
2932
2933
2935
2936
2938
2940
2942
2943
2945
2946
2948 }
2949
2951 {
2952
2954 }
2955
2956
2958 {
2961
2962
2964
2965
2967
2968
2970
2971
2973
2975
2976
2978
2979
2981
2982
2983 if (construtionPart.
IsBase())
2984 {
2985
2987 }
2988
2991 }
2992
2994 {
2995
2997 }
2998
2999
3000 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3001 {
3004
3005
3007
3008
3010
3011
3013
3014
3016
3018
3019
3021
3022
3024
3025
3026 if (construtionPart.
IsBase())
3027 {
3028
3030 }
3031
3034 }
3035
3037 {
3038
3040 }
3041
3043 {
3044 bool process = false;
3045
3046
3050
3051 if (process)
3052 {
3053 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3054 {
3056 return;
3057 }
3058
3060 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3061 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3062
3063
3065 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3066 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3067 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3068 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3069 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3070 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3071 mins = minTmp;
3072 maxs = maxTmp;
3073
3074 maxs[1] = maxs[1] + 0.35;
3075
3077 }
3078 }
3079
3081 {
3084
3085
3087 foreach (
EntityAI entity : foundEntities)
3088 {
3091 }
3092 }
3093
3094
3096 {
3098
3102 }
3103
3105 {
3107
3109 {
3111 }
3112 else
3113 {
3115 }
3116
3118 }
3119
3121 {
3123
3125 foreach (
string slotName : attachmentSlots)
3126 {
3128 }
3129
3130
3133 else
3135
3137 }
3138
3140 {
3141 string slotNameMounted = slot_name + "_Mounted";
3142 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3143
3144 if (attachment)
3145 {
3146 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3147 if (barbedWire && barbedWire.IsMounted())
3149 else
3151
3152 if (is_locked)
3153 {
3154 SetAnimationPhase(slotNameMounted, 0);
3155 SetAnimationPhase(slot_name, 1);
3156 }
3157 else
3158 {
3159 SetAnimationPhase(slotNameMounted, 1);
3160 SetAnimationPhase(slot_name, 0);
3161 }
3162 }
3163 else
3164 {
3165 SetAnimationPhase(slotNameMounted, 1);
3166 SetAnimationPhase(slot_name, 1);
3167
3169 }
3170 }
3171
3172
3174 {
3177
3180
3183
3184 foreach (
string slotName : attachmentSlots)
3185 {
3187 }
3188
3189
3191 {
3194
3196 }
3197 else
3198 {
3201
3203 }
3204
3207 }
3208
3210 {
3211
3213 return;
3214
3215 string slot_name_mounted = slot_name + "_Mounted";
3216 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3217
3218
3220 RemoveProxyPhysics( slot_name_mounted );
3221 RemoveProxyPhysics( slot_name );
3222
3223 if ( attachment )
3224 {
3226 if ( is_locked )
3227 {
3229 AddProxyPhysics( slot_name_mounted );
3230 }
3231 else
3232 {
3234 AddProxyPhysics( slot_name );
3235 }
3236 }
3237 }
3238
3240 {
3241 SetAffectPathgraph( true, false );
3243 }
3244
3246 {
3247 return true;
3248 }
3249
3251 {
3252 return true;
3253 }
3254
3256 {
3257 if ( attachment )
3258 {
3260 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3261
3262 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3263 }
3264
3265 return false;
3266 }
3267
3269 {
3271 }
3272
3273
3275 {
3276 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3277 if (
GetGame().ConfigIsExisting( config_path ) )
3278 {
3280 }
3281 }
3282
3284 {
3285 return true;
3286 }
3287
3289 {
3290 return true;
3291 }
3292
3294 {
3295 return true;
3296 }
3297
3298
3300 {
3302 {
3304 }
3305
3307 }
3308
3310 {
3312 }
3313
3314
3315
3317 {
3318 return super.CanReceiveAttachment(attachment, slotId);
3319 }
3320
3322 {
3323 int attachment_count = GetInventory().AttachmentCount();
3324 if ( attachment_count > 0 )
3325 {
3326 if (
HasBase() && attachment_count == 1 )
3327 {
3328 return false;
3329 }
3330
3331 return true;
3332 }
3333
3334 return false;
3335 }
3336
3338 {
3339 return true;
3340 }
3341
3343 {
3344 return false;
3345 }
3346
3347
3349 {
3350 return false;
3351 }
3352
3354 {
3355 return false;
3356 }
3357
3358
3360 {
3361 return false;
3362 }
3363
3364
3365
3367 {
3368 return true;
3369 }
3370
3372 {
3373 return true;
3374 }
3375
3378 {
3379 return false;
3380 }
3381
3382
3384 {
3385 return true;
3386 }
3387
3388
3390 {
3391 return false;
3392 }
3393
3394
3396 {
3397 return true;
3398 }
3399
3400
3402 {
3403 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3404 {
3405 return false;
3406 }
3407
3408 return true;
3409 }
3410
3412 {
3415
3416 return item;
3417 }
3418
3419
3421 {
3423 {
3424
3426
3427
3430
3432 if ( MemoryPointExists( slot_name + "_min" ) )
3433 {
3434 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3435 }
3436 if ( MemoryPointExists( slot_name + "_max" ) )
3437 {
3438 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3439 }
3440
3441
3444
3445
3448 center = ModelToWorld( center );
3449
3450
3453
3454 areaDamage.SetExtents( extents[0], extents[1] );
3455 areaDamage.SetAreaPosition( center );
3456 areaDamage.SetAreaOrientation( orientation );
3459 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3460 areaDamage.SetAmmoName( "BarbedWireHit" );
3461 areaDamage.Spawn();
3462
3464 }
3465 }
3466
3468 {
3469 if ( angle_deg != 0 )
3470 {
3471
3472 orientation[0] = orientation[0] - angle_deg;
3473
3474
3476 if ( MemoryPointExists( "rotate_axis" ) )
3477 {
3478 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3479 }
3480 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];
3481 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];
3482 center[0] = r_center_x;
3483 center[2] = r_center_z;
3484 }
3485 }
3486
3488 {
3490 {
3493 {
3494 if (areaDamage)
3495 {
3496 areaDamage.Destroy();
3497 }
3498
3500 }
3501 }
3502 }
3503
3505 {
3506 return true;
3507 }
3508
3509
3510
3511
3513 {
3515 }
3516
3518 {
3520 }
3521
3523 {
3525 }
3526
3528 {
3530
3531 switch ( material_type )
3532 {
3538 }
3539
3540 return "";
3541 }
3542
3544 {
3546
3547 switch ( material_type )
3548 {
3554 }
3555
3556 return "";
3557 }
3558
3559
3561 {
3563 {
3564
3566 {
3567 SetHealth(slot_name,"Health",item.GetHealth());
3568 }
3569 }
3570 }
3571
3573 {
3574 return 111;
3575 }
3576
3578 {
3579 super.SetActions();
3580
3584 }
3585
3586
3587
3588
3590 {
3591 }
3592
3595 {
3596 return null;
3597 }
3598
3600 {
3602 }
3603
3605 {
3608
3609 Man p;
3610
3611 #ifdef SERVER
3614 if (players.Count())
3615 p = players[0];
3616 #else
3618 #endif
3619
3621 {
3622 bool excluded = false;
3624 if (excludes)
3625 {
3626 foreach (string exclude : excludes)
3627 {
3629 {
3630 excluded = true;
3631 break;
3632 }
3633 }
3634 }
3635
3636 if (!excluded)
3637 {
3639 }
3640 }
3641
3643 }
3644}
3645
3647{
3648#ifdef BSB_DEBUG
3650#else
3651
3652#endif
3653}
3655{
3656#ifdef BSB_DEBUG_SPAM
3658#else
3659
3660#endif
3661}
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.