2332{
2334
2336
2338
2340
2346
2347
2348
2354
2360
2362
2366
2367
2369 {
2371
2372
2373 RegisterNetSyncVariableInt( "m_SyncParts01" );
2374 RegisterNetSyncVariableInt( "m_SyncParts02" );
2375 RegisterNetSyncVariableInt( "m_SyncParts03" );
2376 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2377 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2378 RegisterNetSyncVariableBool( "m_HasBase" );
2379
2380
2382
2383 if (ConfigIsExisting("hybridAttachments"))
2384 {
2387 }
2388 if (ConfigIsExisting("mountables"))
2389 {
2392 }
2393
2395 }
2396
2398 {
2399 super.EEDelete(parent);
2400
2402 {
2403 areaDamage.Destroy();
2404 }
2405
2406 }
2407
2409 {
2410 return "disableBaseDamage";
2411 }
2412
2414 {
2415 return true;
2416 }
2417
2419 {
2420 return EInventoryIconVisibility.HIDE_VICINITY;
2421 }
2422
2423
2425 {
2427 {
2428 SetSynchDirty();
2429 }
2430 }
2431
2433 {
2435 super.OnVariablesSynchronized();
2436
2438 }
2439
2441 {
2442
2444
2445
2447
2448
2450 }
2451
2452
2454 {
2455
2456 int offset;
2457 int mask;
2458
2459 if ( part_id >= 1 && part_id <= 31 )
2460 {
2461 offset = part_id - 1;
2462 mask = 1 << offset;
2463
2465 }
2466 else if ( part_id >= 32 && part_id <= 62 )
2467 {
2468 offset = ( part_id % 32 );
2469 mask = 1 << offset;
2470
2472 }
2473 else if ( part_id >= 63 && part_id <= 93 )
2474 {
2475 offset = ( part_id % 63 );
2476 mask = 1 << offset;
2477
2479 }
2480 }
2481
2483 {
2484
2485 int offset;
2486 int mask;
2487
2488 if ( part_id >= 1 && part_id <= 31 )
2489 {
2490 offset = part_id - 1;
2491 mask = 1 << offset;
2492
2494 }
2495 else if ( part_id >= 32 && part_id <= 62 )
2496 {
2497 offset = ( part_id % 32 );
2498 mask = 1 << offset;
2499
2501 }
2502 else if ( part_id >= 63 && part_id <= 93 )
2503 {
2504 offset = ( part_id % 63 );
2505 mask = 1 << offset;
2506
2508 }
2509 }
2510
2512 {
2513
2514 int offset;
2515 int mask;
2516
2517 if ( part_id >= 1 && part_id <= 31 )
2518 {
2519 offset = part_id - 1;
2520 mask = 1 << offset;
2521
2523 {
2524 return true;
2525 }
2526 }
2527 else if ( part_id >= 32 && part_id <= 62 )
2528 {
2529 offset = ( part_id % 32 );
2530 mask = 1 << offset;
2531
2533 {
2534 return true;
2535 }
2536 }
2537 else if ( part_id >= 63 && part_id <= 93 )
2538 {
2539 offset = ( part_id % 63 );
2540 mask = 1 << offset;
2541
2543 {
2544 return true;
2545 }
2546 }
2547
2548 return false;
2549 }
2550
2552 {
2555 }
2556
2558 {
2559
2562 }
2563
2565 {
2567 {
2570
2571 switch( build_action_id )
2572 {
2576 }
2577 }
2578 }
2579
2580
2582 {
2584 bool is_base = part.
IsBase();
2587 if ( is_part_built_sync )
2588 {
2590 {
2594
2595 if (is_base)
2596 {
2599 }
2600 }
2601 }
2602 else
2603 {
2605 {
2609
2610 if (is_base)
2611 {
2614 }
2615 }
2616 }
2617
2618
2620 }
2621
2622
2624 {
2627
2628 for ( int i = 0; i < construction_parts.Count(); ++i )
2629 {
2630 string key = construction_parts.GetKey( i );
2633 }
2634
2635
2637 }
2638
2640 {
2643
2644 for ( int i = 0; i < construction_parts.Count(); ++i )
2645 {
2646 string key = construction_parts.GetKey( i );
2648
2649 if ( value.
GetId() ==
id )
2650 {
2651 return value;
2652 }
2653 }
2654
2655 return NULL;
2656 }
2657
2658
2659
2661 {
2663 }
2664
2666 {
2668 }
2669
2671 {
2672 return true;
2673 }
2674
2676 {
2677 return false;
2678 }
2679
2680
2682 {
2685 {
2687 }
2688
2689 return construction_kit;
2690 }
2691
2693 {
2696 {
2698 }
2699 }
2700
2702 {
2704 }
2705
2707 {
2708 return "";
2709 }
2710
2712 {
2715 }
2716
2717
2719 {
2722 }
2723
2724
2726 {
2727 super.OnStoreSave( ctx );
2728
2729
2733
2735 }
2736
2738 {
2739 if ( !super.OnStoreLoad( ctx, version ) )
2740 return false;
2741
2742
2743
2745 {
2747 return false;
2748 }
2750 {
2752 return false;
2753 }
2755 {
2757 return false;
2758 }
2759
2760
2762 {
2764 return false;
2765 }
2766
2767
2768 return true;
2769 }
2770
2772 {
2773 super.AfterStoreLoad();
2774
2776 {
2778 }
2779 }
2780
2782 {
2783
2785
2786
2789
2790
2792 }
2793
2795 {
2796 super.OnCreatePhysics();
2799 }
2800
2802 {
2804 return;
2805
2806 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2807
2809 return;
2810
2812 string part_name = zone;
2814
2816 {
2817 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2818
2819 if ( construction_part && construction.IsPartConstructed( part_name ) )
2820 {
2822 construction.DestroyConnectedParts(part_name);
2823 }
2824
2825
2826 if ( part_name.
Contains(
"barbed") )
2827 {
2828 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2829 if (barbed_wire)
2830 barbed_wire.SetMountedState( false );
2831 }
2832 }
2833 }
2834
2836 {
2838 {
2840 }
2841
2842 super.EEOnAfterLoad();
2843 }
2844
2846 {
2847 super.EEInit();
2848
2849
2851
2852
2853 #ifdef DEVELOPER
2855 #endif
2856 }
2857
2859 {
2860 super.EEItemAttached( item, slot_name );
2861
2865 }
2866
2868 {
2869 super.EEItemDetached( item, slot_name );
2870
2873 }
2874
2875 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2876 {
2879
2882 }
2883
2884
2886 {
2887 return true;
2888 }
2889
2890
2891
2893 {
2895
2896
2897 if (construtionPart.
IsBase())
2898 {
2900
2901
2903 }
2904
2905
2907
2908
2910
2911
2913
2915
2917
2918
2920
2921
2923 }
2924
2926 {
2927
2929 }
2930
2931
2933 {
2936
2937
2939
2940
2942
2943
2945
2946
2948
2950
2951
2953
2954
2956
2957
2958 if (construtionPart.
IsBase())
2959 {
2960
2962 }
2963
2966 }
2967
2969 {
2970
2972 }
2973
2974
2975 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2976 {
2979
2980
2982
2983
2985
2986
2988
2989
2991
2993
2994
2996
2997
2999
3000
3001 if (construtionPart.
IsBase())
3002 {
3003
3005 }
3006
3009 }
3010
3012 {
3013
3015 }
3016
3018 {
3019 bool process = false;
3020
3021
3025
3026 if (process)
3027 {
3028 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3029 {
3031 return;
3032 }
3033
3035 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3036 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3037
3038
3040 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3041 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3042 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3043 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3044 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3045 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3046 mins = minTmp;
3047 maxs = maxTmp;
3048
3049 maxs[1] = maxs[1] + 0.35;
3050
3052 }
3053 }
3054
3056 {
3059
3060
3062 foreach (
EntityAI entity : foundEntities)
3063 {
3066 }
3067 }
3068
3069
3071 {
3073
3077 }
3078
3080 {
3082
3084 {
3086 }
3087 else
3088 {
3090 }
3091
3093 }
3094
3096 {
3098
3100 foreach (
string slotName : attachmentSlots)
3101 {
3103 }
3104
3105
3108 else
3110
3112 }
3113
3115 {
3116 string slotNameMounted = slot_name + "_Mounted";
3117 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3118
3119 if (attachment)
3120 {
3121 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3122 if (barbedWire && barbedWire.IsMounted())
3124 else
3126
3127 if (is_locked)
3128 {
3129 SetAnimationPhase(slotNameMounted, 0);
3130 SetAnimationPhase(slot_name, 1);
3131 }
3132 else
3133 {
3134 SetAnimationPhase(slotNameMounted, 1);
3135 SetAnimationPhase(slot_name, 0);
3136 }
3137 }
3138 else
3139 {
3140 SetAnimationPhase(slotNameMounted, 1);
3141 SetAnimationPhase(slot_name, 1);
3142
3144 }
3145 }
3146
3147
3149 {
3152
3155
3158
3159 foreach (
string slotName : attachmentSlots)
3160 {
3162 }
3163
3164
3166 {
3169
3171 }
3172 else
3173 {
3176
3178 }
3179
3182 }
3183
3185 {
3186
3188 return;
3189
3190 string slot_name_mounted = slot_name + "_Mounted";
3191 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3192
3193
3195 RemoveProxyPhysics( slot_name_mounted );
3196 RemoveProxyPhysics( slot_name );
3197
3198 if ( attachment )
3199 {
3201 if ( is_locked )
3202 {
3204 AddProxyPhysics( slot_name_mounted );
3205 }
3206 else
3207 {
3209 AddProxyPhysics( slot_name );
3210 }
3211 }
3212 }
3213
3215 {
3216 SetAffectPathgraph( true, false );
3218 }
3219
3221 {
3222 return true;
3223 }
3224
3226 {
3227 return true;
3228 }
3229
3231 {
3232 if ( attachment )
3233 {
3235 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3236
3237 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3238 }
3239
3240 return false;
3241 }
3242
3244 {
3246 }
3247
3248
3250 {
3251 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3252 if (
GetGame().ConfigIsExisting( config_path ) )
3253 {
3255 }
3256 }
3257
3259 {
3260 return true;
3261 }
3262
3264 {
3265 return true;
3266 }
3267
3269 {
3270 return true;
3271 }
3272
3273
3275 {
3277 {
3279 }
3280
3282 }
3283
3285 {
3287 }
3288
3289
3290
3292 {
3293 return super.CanReceiveAttachment(attachment, slotId);
3294 }
3295
3297 {
3298 int attachment_count = GetInventory().AttachmentCount();
3299 if ( attachment_count > 0 )
3300 {
3301 if (
HasBase() && attachment_count == 1 )
3302 {
3303 return false;
3304 }
3305
3306 return true;
3307 }
3308
3309 return false;
3310 }
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return false;
3320 }
3321
3322
3324 {
3325 return false;
3326 }
3327
3329 {
3330 return false;
3331 }
3332
3333
3335 {
3336 return false;
3337 }
3338
3339
3340
3342 {
3343 return true;
3344 }
3345
3347 {
3348 return true;
3349 }
3350
3353 {
3354 return false;
3355 }
3356
3357
3359 {
3360 return true;
3361 }
3362
3363
3365 {
3366 return false;
3367 }
3368
3369
3371 {
3372 return true;
3373 }
3374
3375
3377 {
3378 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3379 {
3380 return false;
3381 }
3382
3383 return true;
3384 }
3385
3387 {
3390
3391 return item;
3392 }
3393
3394
3396 {
3398 {
3399
3401
3402
3405
3407 if ( MemoryPointExists( slot_name + "_min" ) )
3408 {
3409 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3410 }
3411 if ( MemoryPointExists( slot_name + "_max" ) )
3412 {
3413 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3414 }
3415
3416
3419
3420
3423 center = ModelToWorld( center );
3424
3425
3428
3429 areaDamage.SetExtents( extents[0], extents[1] );
3430 areaDamage.SetAreaPosition( center );
3431 areaDamage.SetAreaOrientation( orientation );
3434 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3435 areaDamage.SetAmmoName( "BarbedWireHit" );
3436 areaDamage.Spawn();
3437
3439 }
3440 }
3441
3443 {
3444 if ( angle_deg != 0 )
3445 {
3446
3447 orientation[0] = orientation[0] - angle_deg;
3448
3449
3451 if ( MemoryPointExists( "rotate_axis" ) )
3452 {
3453 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3454 }
3455 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];
3456 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];
3457 center[0] = r_center_x;
3458 center[2] = r_center_z;
3459 }
3460 }
3461
3463 {
3465 {
3468 {
3469 if (areaDamage)
3470 {
3471 areaDamage.Destroy();
3472 }
3473
3475 }
3476 }
3477 }
3478
3480 {
3481 return true;
3482 }
3483
3484
3485
3486
3488 {
3490 }
3491
3493 {
3495 }
3496
3498 {
3500 }
3501
3503 {
3505
3506 switch ( material_type )
3507 {
3513 }
3514
3515 return "";
3516 }
3517
3519 {
3521
3522 switch ( material_type )
3523 {
3529 }
3530
3531 return "";
3532 }
3533
3534
3536 {
3538 {
3539
3541 {
3542 SetHealth(slot_name,"Health",item.GetHealth());
3543 }
3544 }
3545 }
3546
3548 {
3549 return 111;
3550 }
3551
3553 {
3554 super.SetActions();
3555
3559 }
3560
3561
3562
3563
3565 {
3566 }
3567
3570 {
3571 return null;
3572 }
3573
3575 {
3577 }
3578
3580 {
3583
3584 Man p;
3585
3586 #ifdef SERVER
3589 if (players.Count())
3590 p = players[0];
3591 #else
3593 #endif
3594
3596 {
3597 bool excluded = false;
3599 if (excludes)
3600 {
3601 foreach (string exclude : excludes)
3602 {
3604 {
3605 excluded = true;
3606 break;
3607 }
3608 }
3609 }
3610
3611 if (!excluded)
3612 {
3614 }
3615 }
3616
3618 }
3619}
3620
3622{
3623#ifdef BSB_DEBUG
3625#else
3626
3627#endif
3628}
3630{
3631#ifdef BSB_DEBUG_SPAM
3633#else
3634
3635#endif
3636}
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.