2338{
2340
2342
2344
2346
2352
2353
2354
2360
2366
2368
2372
2373
2375 {
2377
2378
2379 RegisterNetSyncVariableInt( "m_SyncParts01" );
2380 RegisterNetSyncVariableInt( "m_SyncParts02" );
2381 RegisterNetSyncVariableInt( "m_SyncParts03" );
2382 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2383 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2384 RegisterNetSyncVariableBool( "m_HasBase" );
2385
2386
2388
2389 if (ConfigIsExisting("hybridAttachments"))
2390 {
2393 }
2394 if (ConfigIsExisting("mountables"))
2395 {
2398 }
2399
2401 }
2402
2404 {
2405 super.EEDelete(parent);
2406
2408 {
2409 areaDamage.Destroy();
2410 }
2411
2412 }
2413
2415 {
2416 return "disableBaseDamage";
2417 }
2418
2420 {
2421 return true;
2422 }
2423
2425 {
2426 return EInventoryIconVisibility.HIDE_VICINITY;
2427 }
2428
2429
2431 {
2433 {
2434 SetSynchDirty();
2435 }
2436 }
2437
2439 {
2441 super.OnVariablesSynchronized();
2442
2444 }
2445
2447 {
2448
2450
2451
2453
2454
2456 }
2457
2458
2460 {
2461
2462 int offset;
2463 int mask;
2464
2465 if ( part_id >= 1 && part_id <= 31 )
2466 {
2467 offset = part_id - 1;
2468 mask = 1 << offset;
2469
2471 }
2472 else if ( part_id >= 32 && part_id <= 62 )
2473 {
2474 offset = ( part_id % 32 );
2475 mask = 1 << offset;
2476
2478 }
2479 else if ( part_id >= 63 && part_id <= 93 )
2480 {
2481 offset = ( part_id % 63 );
2482 mask = 1 << offset;
2483
2485 }
2486 }
2487
2489 {
2490
2491 int offset;
2492 int mask;
2493
2494 if ( part_id >= 1 && part_id <= 31 )
2495 {
2496 offset = part_id - 1;
2497 mask = 1 << offset;
2498
2500 }
2501 else if ( part_id >= 32 && part_id <= 62 )
2502 {
2503 offset = ( part_id % 32 );
2504 mask = 1 << offset;
2505
2507 }
2508 else if ( part_id >= 63 && part_id <= 93 )
2509 {
2510 offset = ( part_id % 63 );
2511 mask = 1 << offset;
2512
2514 }
2515 }
2516
2518 {
2519
2520 int offset;
2521 int mask;
2522
2523 if ( part_id >= 1 && part_id <= 31 )
2524 {
2525 offset = part_id - 1;
2526 mask = 1 << offset;
2527
2529 {
2530 return true;
2531 }
2532 }
2533 else if ( part_id >= 32 && part_id <= 62 )
2534 {
2535 offset = ( part_id % 32 );
2536 mask = 1 << offset;
2537
2539 {
2540 return true;
2541 }
2542 }
2543 else if ( part_id >= 63 && part_id <= 93 )
2544 {
2545 offset = ( part_id % 63 );
2546 mask = 1 << offset;
2547
2549 {
2550 return true;
2551 }
2552 }
2553
2554 return false;
2555 }
2556
2558 {
2561 }
2562
2564 {
2565
2568 }
2569
2571 {
2573 {
2576
2577 switch( build_action_id )
2578 {
2582 }
2583 }
2584 }
2585
2586
2588 {
2590 bool is_base = part.
IsBase();
2593 if ( is_part_built_sync )
2594 {
2596 {
2600
2601 if (is_base)
2602 {
2605 }
2606 }
2607 }
2608 else
2609 {
2611 {
2615
2616 if (is_base)
2617 {
2620 }
2621 }
2622 }
2623
2624
2626 }
2627
2628
2630 {
2633
2634 for ( int i = 0; i < construction_parts.Count(); ++i )
2635 {
2636 string key = construction_parts.GetKey( i );
2639 }
2640
2641
2643 }
2644
2646 {
2649
2650 for ( int i = 0; i < construction_parts.Count(); ++i )
2651 {
2652 string key = construction_parts.GetKey( i );
2654
2655 if ( value.
GetId() ==
id )
2656 {
2657 return value;
2658 }
2659 }
2660
2661 return NULL;
2662 }
2663
2664
2665
2667 {
2669 }
2670
2672 {
2674 }
2675
2677 {
2678 return true;
2679 }
2680
2682 {
2683 return false;
2684 }
2685
2686
2688 {
2691 {
2693 }
2694
2695 return construction_kit;
2696 }
2697
2699 {
2702 {
2704 }
2705 }
2706
2708 {
2710 }
2711
2713 {
2714 return "";
2715 }
2716
2718 {
2721 }
2722
2723
2725 {
2728 }
2729
2730
2732 {
2733 super.OnStoreSave( ctx );
2734
2735
2739
2741 }
2742
2744 {
2745 if ( !super.OnStoreLoad( ctx, version ) )
2746 return false;
2747
2748
2749
2751 {
2753 return false;
2754 }
2756 {
2758 return false;
2759 }
2761 {
2763 return false;
2764 }
2765
2766
2768 {
2770 return false;
2771 }
2772
2773
2774 return true;
2775 }
2776
2778 {
2779 super.AfterStoreLoad();
2780
2782 {
2784 }
2785 }
2786
2788 {
2789
2791
2792
2795
2796
2798 }
2799
2801 {
2802 super.OnCreatePhysics();
2805 }
2806
2808 {
2810 return;
2811
2812 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2813
2815 return;
2816
2818 string part_name = zone;
2820
2822 {
2823 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2824
2825 if ( construction_part && construction.IsPartConstructed( part_name ) )
2826 {
2828 construction.DestroyConnectedParts(part_name);
2829 }
2830
2831
2832 if ( part_name.
Contains(
"barbed") )
2833 {
2834 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2835 if (barbed_wire)
2836 barbed_wire.SetMountedState( false );
2837 }
2838 }
2839 }
2840
2842 {
2844 {
2846 }
2847
2848 super.EEOnAfterLoad();
2849 }
2850
2852 {
2853 super.EEInit();
2854
2855
2857
2858
2859 #ifdef DEVELOPER
2861 #endif
2862 }
2863
2865 {
2866 super.EEItemAttached( item, slot_name );
2867
2871 }
2872
2874 {
2875 super.EEItemDetached( item, slot_name );
2876
2879 }
2880
2881 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2882 {
2885
2888 }
2889
2890
2892 {
2893 return true;
2894 }
2895
2896
2897
2899 {
2901
2902
2903 if (construtionPart.
IsBase())
2904 {
2906
2907
2909 }
2910
2911
2913
2914
2916
2917
2919
2921
2923
2924
2926
2927
2929 }
2930
2932 {
2933
2935 }
2936
2937
2939 {
2942
2943
2945
2946
2948
2949
2951
2952
2954
2956
2957
2959
2960
2962
2963
2964 if (construtionPart.
IsBase())
2965 {
2966
2968 }
2969
2972 }
2973
2975 {
2976
2978 }
2979
2980
2981 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2982 {
2985
2986
2988
2989
2991
2992
2994
2995
2997
2999
3000
3002
3003
3005
3006
3007 if (construtionPart.
IsBase())
3008 {
3009
3011 }
3012
3015 }
3016
3018 {
3019
3021 }
3022
3024 {
3025 bool process = false;
3026
3027
3031
3032 if (process)
3033 {
3034 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3035 {
3037 return;
3038 }
3039
3041 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3042 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3043
3044
3046 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3047 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3048 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3049 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3050 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3051 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3052 mins = minTmp;
3053 maxs = maxTmp;
3054
3055 maxs[1] = maxs[1] + 0.35;
3056
3058 }
3059 }
3060
3062 {
3065
3066
3068 foreach (
EntityAI entity : foundEntities)
3069 {
3072 }
3073 }
3074
3075
3077 {
3079
3083 }
3084
3086 {
3088
3090 {
3092 }
3093 else
3094 {
3096 }
3097
3099 }
3100
3102 {
3104
3106 foreach (
string slotName : attachmentSlots)
3107 {
3109 }
3110
3111
3114 else
3116
3118 }
3119
3121 {
3122 string slotNameMounted = slot_name + "_Mounted";
3123 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3124
3125 if (attachment)
3126 {
3127 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3128 if (barbedWire && barbedWire.IsMounted())
3130 else
3132
3133 if (is_locked)
3134 {
3135 SetAnimationPhase(slotNameMounted, 0);
3136 SetAnimationPhase(slot_name, 1);
3137 }
3138 else
3139 {
3140 SetAnimationPhase(slotNameMounted, 1);
3141 SetAnimationPhase(slot_name, 0);
3142 }
3143 }
3144 else
3145 {
3146 SetAnimationPhase(slotNameMounted, 1);
3147 SetAnimationPhase(slot_name, 1);
3148
3150 }
3151 }
3152
3153
3155 {
3158
3161
3164
3165 foreach (
string slotName : attachmentSlots)
3166 {
3168 }
3169
3170
3172 {
3175
3177 }
3178 else
3179 {
3182
3184 }
3185
3188 }
3189
3191 {
3192
3194 return;
3195
3196 string slot_name_mounted = slot_name + "_Mounted";
3197 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3198
3199
3201 RemoveProxyPhysics( slot_name_mounted );
3202 RemoveProxyPhysics( slot_name );
3203
3204 if ( attachment )
3205 {
3207 if ( is_locked )
3208 {
3210 AddProxyPhysics( slot_name_mounted );
3211 }
3212 else
3213 {
3215 AddProxyPhysics( slot_name );
3216 }
3217 }
3218 }
3219
3221 {
3222 SetAffectPathgraph( true, false );
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3232 {
3233 return true;
3234 }
3235
3237 {
3238 if ( attachment )
3239 {
3241 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3242
3243 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3244 }
3245
3246 return false;
3247 }
3248
3250 {
3252 }
3253
3254
3256 {
3257 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3258 if (
GetGame().ConfigIsExisting( config_path ) )
3259 {
3261 }
3262 }
3263
3265 {
3266 return true;
3267 }
3268
3270 {
3271 return true;
3272 }
3273
3275 {
3276 return true;
3277 }
3278
3279
3281 {
3283 {
3285 }
3286
3288 }
3289
3291 {
3293 }
3294
3295
3296
3298 {
3299 return super.CanReceiveAttachment(attachment, slotId);
3300 }
3301
3303 {
3304 int attachment_count = GetInventory().AttachmentCount();
3305 if ( attachment_count > 0 )
3306 {
3307 if (
HasBase() && attachment_count == 1 )
3308 {
3309 return false;
3310 }
3311
3312 return true;
3313 }
3314
3315 return false;
3316 }
3317
3319 {
3320 return true;
3321 }
3322
3324 {
3325 return false;
3326 }
3327
3328
3330 {
3331 return false;
3332 }
3333
3335 {
3336 return false;
3337 }
3338
3339
3341 {
3342 return false;
3343 }
3344
3345
3346
3348 {
3349 return true;
3350 }
3351
3353 {
3354 return true;
3355 }
3356
3359 {
3360 return false;
3361 }
3362
3363
3365 {
3366 return true;
3367 }
3368
3369
3371 {
3372 return false;
3373 }
3374
3375
3377 {
3378 return true;
3379 }
3380
3381
3383 {
3384 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3385 {
3386 return false;
3387 }
3388
3389 return true;
3390 }
3391
3393 {
3396
3397 return item;
3398 }
3399
3400
3402 {
3404 {
3405
3407
3408
3411
3413 if ( MemoryPointExists( slot_name + "_min" ) )
3414 {
3415 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3416 }
3417 if ( MemoryPointExists( slot_name + "_max" ) )
3418 {
3419 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3420 }
3421
3422
3425
3426
3429 center = ModelToWorld( center );
3430
3431
3434
3435 areaDamage.SetExtents( extents[0], extents[1] );
3436 areaDamage.SetAreaPosition( center );
3437 areaDamage.SetAreaOrientation( orientation );
3440 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3441 areaDamage.SetAmmoName( "BarbedWireHit" );
3442 areaDamage.Spawn();
3443
3445 }
3446 }
3447
3449 {
3450 if ( angle_deg != 0 )
3451 {
3452
3453 orientation[0] = orientation[0] - angle_deg;
3454
3455
3457 if ( MemoryPointExists( "rotate_axis" ) )
3458 {
3459 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3460 }
3461 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];
3462 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];
3463 center[0] = r_center_x;
3464 center[2] = r_center_z;
3465 }
3466 }
3467
3469 {
3471 {
3474 {
3475 if (areaDamage)
3476 {
3477 areaDamage.Destroy();
3478 }
3479
3481 }
3482 }
3483 }
3484
3486 {
3487 return true;
3488 }
3489
3490
3491
3492
3494 {
3496 }
3497
3499 {
3501 }
3502
3504 {
3506 }
3507
3509 {
3511
3512 switch ( material_type )
3513 {
3519 }
3520
3521 return "";
3522 }
3523
3525 {
3527
3528 switch ( material_type )
3529 {
3535 }
3536
3537 return "";
3538 }
3539
3540
3542 {
3544 {
3545
3547 {
3548 SetHealth(slot_name,"Health",item.GetHealth());
3549 }
3550 }
3551 }
3552
3554 {
3555 return 111;
3556 }
3557
3559 {
3560 super.SetActions();
3561
3565 }
3566
3567
3568
3569
3571 {
3572 }
3573
3576 {
3577 return null;
3578 }
3579
3581 {
3583 }
3584
3586 {
3589
3590 Man p;
3591
3592 #ifdef SERVER
3595 if (players.Count())
3596 p = players[0];
3597 #else
3599 #endif
3600
3602 {
3603 bool excluded = false;
3605 if (excludes)
3606 {
3607 foreach (string exclude : excludes)
3608 {
3610 {
3611 excluded = true;
3612 break;
3613 }
3614 }
3615 }
3616
3617 if (!excluded)
3618 {
3620 }
3621 }
3622
3624 }
3625}
3626
3628{
3629#ifdef BSB_DEBUG
3631#else
3632
3633#endif
3634}
3636{
3637#ifdef BSB_DEBUG_SPAM
3639#else
3640
3641#endif
3642}
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.