2290{
2292
2294
2296
2298
2304
2305
2306
2312
2318
2320
2324
2325
2327 {
2329
2330
2331 RegisterNetSyncVariableInt( "m_SyncParts01" );
2332 RegisterNetSyncVariableInt( "m_SyncParts02" );
2333 RegisterNetSyncVariableInt( "m_SyncParts03" );
2334 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2335 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2336 RegisterNetSyncVariableBool( "m_HasBase" );
2337
2338
2340
2341 if (ConfigIsExisting("hybridAttachments"))
2342 {
2345 }
2346 if (ConfigIsExisting("mountables"))
2347 {
2350 }
2351
2353 }
2354
2356 {
2357 super.EEDelete(parent);
2358
2360 {
2361 areaDamage.Destroy();
2362 }
2363
2364 }
2365
2367 {
2368 return "disableBaseDamage";
2369 }
2370
2372 {
2373 return true;
2374 }
2375
2377 {
2378 return EInventoryIconVisibility.HIDE_VICINITY;
2379 }
2380
2381
2383 {
2385 {
2386 SetSynchDirty();
2387 }
2388 }
2389
2391 {
2393 super.OnVariablesSynchronized();
2394
2396 }
2397
2399 {
2400
2402
2403
2405
2406
2408 }
2409
2410
2412 {
2413
2414 int offset;
2415 int mask;
2416
2417 if ( part_id >= 1 && part_id <= 31 )
2418 {
2419 offset = part_id - 1;
2420 mask = 1 << offset;
2421
2423 }
2424 else if ( part_id >= 32 && part_id <= 62 )
2425 {
2426 offset = ( part_id % 32 );
2427 mask = 1 << offset;
2428
2430 }
2431 else if ( part_id >= 63 && part_id <= 93 )
2432 {
2433 offset = ( part_id % 63 );
2434 mask = 1 << offset;
2435
2437 }
2438 }
2439
2441 {
2442
2443 int offset;
2444 int mask;
2445
2446 if ( part_id >= 1 && part_id <= 31 )
2447 {
2448 offset = part_id - 1;
2449 mask = 1 << offset;
2450
2452 }
2453 else if ( part_id >= 32 && part_id <= 62 )
2454 {
2455 offset = ( part_id % 32 );
2456 mask = 1 << offset;
2457
2459 }
2460 else if ( part_id >= 63 && part_id <= 93 )
2461 {
2462 offset = ( part_id % 63 );
2463 mask = 1 << offset;
2464
2466 }
2467 }
2468
2470 {
2471
2472 int offset;
2473 int mask;
2474
2475 if ( part_id >= 1 && part_id <= 31 )
2476 {
2477 offset = part_id - 1;
2478 mask = 1 << offset;
2479
2481 {
2482 return true;
2483 }
2484 }
2485 else if ( part_id >= 32 && part_id <= 62 )
2486 {
2487 offset = ( part_id % 32 );
2488 mask = 1 << offset;
2489
2491 {
2492 return true;
2493 }
2494 }
2495 else if ( part_id >= 63 && part_id <= 93 )
2496 {
2497 offset = ( part_id % 63 );
2498 mask = 1 << offset;
2499
2501 {
2502 return true;
2503 }
2504 }
2505
2506 return false;
2507 }
2508
2510 {
2513 }
2514
2516 {
2517
2520 }
2521
2523 {
2525 {
2528
2529 switch( build_action_id )
2530 {
2534 }
2535 }
2536 }
2537
2538
2540 {
2542 bool is_base = part.
IsBase();
2545 if ( is_part_built_sync )
2546 {
2548 {
2552
2553 if (is_base)
2554 {
2557 }
2558 }
2559 }
2560 else
2561 {
2563 {
2567
2568 if (is_base)
2569 {
2572 }
2573 }
2574 }
2575
2576
2578 }
2579
2580
2582 {
2585
2586 for ( int i = 0; i < construction_parts.Count(); ++i )
2587 {
2588 string key = construction_parts.GetKey( i );
2591 }
2592
2593
2595 }
2596
2598 {
2601
2602 for ( int i = 0; i < construction_parts.Count(); ++i )
2603 {
2604 string key = construction_parts.GetKey( i );
2606
2607 if ( value.
GetId() ==
id )
2608 {
2609 return value;
2610 }
2611 }
2612
2613 return NULL;
2614 }
2615
2616
2617
2619 {
2621 }
2622
2624 {
2626 }
2627
2629 {
2630 return true;
2631 }
2632
2634 {
2635 return false;
2636 }
2637
2638
2640 {
2643 {
2645 }
2646
2647 return construction_kit;
2648 }
2649
2651 {
2654 {
2656 }
2657 }
2658
2660 {
2662 }
2663
2665 {
2666 return "";
2667 }
2668
2670 {
2673 }
2674
2675
2677 {
2680 }
2681
2682
2684 {
2685 super.OnStoreSave( ctx );
2686
2687
2691
2693 }
2694
2696 {
2697 if ( !super.OnStoreLoad( ctx, version ) )
2698 return false;
2699
2700
2701
2703 {
2705 return false;
2706 }
2708 {
2710 return false;
2711 }
2713 {
2715 return false;
2716 }
2717
2718
2720 {
2722 return false;
2723 }
2724
2725
2726 return true;
2727 }
2728
2730 {
2731 super.AfterStoreLoad();
2732
2734 {
2736 }
2737 }
2738
2740 {
2741
2743
2744
2747
2748
2750 }
2751
2753 {
2754 super.OnCreatePhysics();
2757 }
2758
2760 {
2762 return;
2763
2764 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2765
2767 return;
2768
2770 string part_name = zone;
2772
2774 {
2775 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2776
2777 if ( construction_part && construction.IsPartConstructed( part_name ) )
2778 {
2780 construction.DestroyConnectedParts(part_name);
2781 }
2782
2783
2784 if ( part_name.
Contains(
"barbed") )
2785 {
2786 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2787 if (barbed_wire)
2788 barbed_wire.SetMountedState( false );
2789 }
2790 }
2791 }
2792
2794 {
2796 {
2798 }
2799
2800 super.EEOnAfterLoad();
2801 }
2802
2804 {
2805 super.EEInit();
2806
2807
2809
2810
2811 #ifdef DEVELOPER
2813 #endif
2814 }
2815
2817 {
2818 super.EEItemAttached( item, slot_name );
2819
2823 }
2824
2826 {
2827 super.EEItemDetached( item, slot_name );
2828
2831 }
2832
2833 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2834 {
2837
2840 }
2841
2842
2844 {
2845 return true;
2846 }
2847
2848
2849
2851 {
2853
2854
2855 if (construtionPart.
IsBase())
2856 {
2858
2859
2861 }
2862
2863
2865
2866
2868
2869
2871
2873
2875
2876
2878
2879
2881 }
2882
2884 {
2885
2887 }
2888
2889
2891 {
2894
2895
2897
2898
2900
2901
2903
2904
2906
2908
2909
2911
2912
2914
2915
2916 if (construtionPart.
IsBase())
2917 {
2918
2920 }
2921
2924 }
2925
2927 {
2928
2930 }
2931
2932
2933 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2934 {
2937
2938
2940
2941
2943
2944
2946
2947
2949
2951
2952
2954
2955
2957
2958
2959 if (construtionPart.
IsBase())
2960 {
2961
2963 }
2964
2967 }
2968
2970 {
2971
2973 }
2974
2976 {
2977 bool process = false;
2978
2979
2983
2984 if (process)
2985 {
2986 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2987 {
2989 return;
2990 }
2991
2993 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2994 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2995
2996
2998 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2999 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3000 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3001 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3002 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3003 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3004 mins = minTmp;
3005 maxs = maxTmp;
3006
3007 maxs[1] = maxs[1] + 0.35;
3008
3010 }
3011 }
3012
3014 {
3017
3018
3020 foreach (
EntityAI entity : foundEntities)
3021 {
3024 }
3025 }
3026
3027
3029 {
3031
3035 }
3036
3038 {
3040
3042 {
3044 }
3045 else
3046 {
3048 }
3049
3051 }
3052
3054 {
3056
3058 foreach (
string slotName : attachmentSlots)
3059 {
3061 }
3062
3063
3066 else
3068
3070 }
3071
3073 {
3074 string slotNameMounted = slot_name + "_Mounted";
3075 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3076
3077 if (attachment)
3078 {
3079 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3080 if (barbedWire && barbedWire.IsMounted())
3082 else
3084
3085 if (is_locked)
3086 {
3087 SetAnimationPhase(slotNameMounted, 0);
3088 SetAnimationPhase(slot_name, 1);
3089 }
3090 else
3091 {
3092 SetAnimationPhase(slotNameMounted, 1);
3093 SetAnimationPhase(slot_name, 0);
3094 }
3095 }
3096 else
3097 {
3098 SetAnimationPhase(slotNameMounted, 1);
3099 SetAnimationPhase(slot_name, 1);
3100
3102 }
3103 }
3104
3105
3107 {
3110
3113
3116
3117 foreach (
string slotName : attachmentSlots)
3118 {
3120 }
3121
3122
3124 {
3127
3129 }
3130 else
3131 {
3134
3136 }
3137
3140 }
3141
3143 {
3144
3146 return;
3147
3148 string slot_name_mounted = slot_name + "_Mounted";
3149 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3150
3151
3153 RemoveProxyPhysics( slot_name_mounted );
3154 RemoveProxyPhysics( slot_name );
3155
3156 if ( attachment )
3157 {
3159 if ( is_locked )
3160 {
3162 AddProxyPhysics( slot_name_mounted );
3163 }
3164 else
3165 {
3167 AddProxyPhysics( slot_name );
3168 }
3169 }
3170 }
3171
3173 {
3174 SetAffectPathgraph( true, false );
3176 }
3177
3179 {
3180 return true;
3181 }
3182
3184 {
3185 return true;
3186 }
3187
3189 {
3190 if ( attachment )
3191 {
3193 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3194
3195 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3196 }
3197
3198 return false;
3199 }
3200
3202 {
3204 }
3205
3206
3208 {
3209 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3210 if (
GetGame().ConfigIsExisting( config_path ) )
3211 {
3213 }
3214 }
3215
3217 {
3218 return true;
3219 }
3220
3222 {
3223 return true;
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3231
3233 {
3235 {
3237 }
3238
3240 }
3241
3243 {
3245 }
3246
3247
3248
3250 {
3251 return super.CanReceiveAttachment(attachment, slotId);
3252 }
3253
3255 {
3256 int attachment_count = GetInventory().AttachmentCount();
3257 if ( attachment_count > 0 )
3258 {
3259 if (
HasBase() && attachment_count == 1 )
3260 {
3261 return false;
3262 }
3263
3264 return true;
3265 }
3266
3267 return false;
3268 }
3269
3271 {
3272 return true;
3273 }
3274
3276 {
3277 return false;
3278 }
3279
3280
3282 {
3283 return false;
3284 }
3285
3287 {
3288 return false;
3289 }
3290
3291
3293 {
3294 return false;
3295 }
3296
3297
3298
3300 {
3301 return true;
3302 }
3303
3305 {
3306 return true;
3307 }
3308
3311 {
3312 return false;
3313 }
3314
3315
3317 {
3318 return true;
3319 }
3320
3321
3323 {
3324 return false;
3325 }
3326
3327
3329 {
3330 return true;
3331 }
3332
3333
3335 {
3336 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3337 {
3338 return false;
3339 }
3340
3341 return true;
3342 }
3343
3345 {
3348
3349 return item;
3350 }
3351
3352
3354 {
3356 {
3357
3359
3360
3363
3365 if ( MemoryPointExists( slot_name + "_min" ) )
3366 {
3367 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3368 }
3369 if ( MemoryPointExists( slot_name + "_max" ) )
3370 {
3371 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3372 }
3373
3374
3377
3378
3381 center = ModelToWorld( center );
3382
3383
3386
3387 areaDamage.SetExtents( extents[0], extents[1] );
3388 areaDamage.SetAreaPosition( center );
3389 areaDamage.SetAreaOrientation( orientation );
3392 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3393 areaDamage.SetAmmoName( "BarbedWireHit" );
3394 areaDamage.Spawn();
3395
3397 }
3398 }
3399
3401 {
3402 if ( angle_deg != 0 )
3403 {
3404
3405 orientation[0] = orientation[0] - angle_deg;
3406
3407
3409 if ( MemoryPointExists( "rotate_axis" ) )
3410 {
3411 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3412 }
3413 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];
3414 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];
3415 center[0] = r_center_x;
3416 center[2] = r_center_z;
3417 }
3418 }
3419
3421 {
3423 {
3426 {
3427 if (areaDamage)
3428 {
3429 areaDamage.Destroy();
3430 }
3431
3433 }
3434 }
3435 }
3436
3438 {
3439 return true;
3440 }
3441
3442
3443
3444
3446 {
3448 }
3449
3451 {
3453 }
3454
3456 {
3458 }
3459
3461 {
3463
3464 switch ( material_type )
3465 {
3471 }
3472
3473 return "";
3474 }
3475
3477 {
3479
3480 switch ( material_type )
3481 {
3487 }
3488
3489 return "";
3490 }
3491
3492
3494 {
3496 {
3497
3499 {
3500 SetHealth(slot_name,"Health",item.GetHealth());
3501 }
3502 }
3503 }
3504
3506 {
3507 return 111;
3508 }
3509
3511 {
3512 super.SetActions();
3513
3517 }
3518
3519
3520
3521
3523 {
3524 }
3525
3528 {
3529 return null;
3530 }
3531
3533 {
3535 }
3536
3538 {
3541
3542 Man p;
3543
3544 #ifdef SERVER
3547 if (players.Count())
3548 p = players[0];
3549 #else
3551 #endif
3552
3554 {
3555 bool excluded = false;
3557 if (excludes)
3558 {
3559 foreach (string exclude : excludes)
3560 {
3562 {
3563 excluded = true;
3564 break;
3565 }
3566 }
3567 }
3568
3569 if (!excluded)
3570 {
3572 }
3573 }
3574
3576 }
3577}
3578
3580{
3581#ifdef BSB_DEBUG
3583#else
3584
3585#endif
3586}
3588{
3589#ifdef BSB_DEBUG_SPAM
3591#else
3592
3593#endif
3594}
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.