2279{
2281
2283
2285
2287
2293
2294
2295
2301
2307
2309
2313
2314
2316 {
2318
2319
2320 RegisterNetSyncVariableInt( "m_SyncParts01" );
2321 RegisterNetSyncVariableInt( "m_SyncParts02" );
2322 RegisterNetSyncVariableInt( "m_SyncParts03" );
2323 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2324 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2325 RegisterNetSyncVariableBool( "m_HasBase" );
2326
2327
2329
2330 if (ConfigIsExisting("hybridAttachments"))
2331 {
2334 }
2335 if (ConfigIsExisting("mountables"))
2336 {
2339 }
2340
2342 }
2343
2345 {
2346 super.EEDelete(parent);
2347
2349 {
2350 areaDamage.Destroy();
2351 }
2352
2353 }
2354
2356 {
2357 return "disableBaseDamage";
2358 }
2359
2361 {
2362 return true;
2363 }
2364
2366 {
2367 return EInventoryIconVisibility.HIDE_VICINITY;
2368 }
2369
2370
2372 {
2374 {
2375 SetSynchDirty();
2376 }
2377 }
2378
2380 {
2382 super.OnVariablesSynchronized();
2383
2385 }
2386
2388 {
2389
2391
2392
2394
2395
2397 }
2398
2399
2401 {
2402
2403 int offset;
2404 int mask;
2405
2406 if ( part_id >= 1 && part_id <= 31 )
2407 {
2408 offset = part_id - 1;
2409 mask = 1 << offset;
2410
2412 }
2413 else if ( part_id >= 32 && part_id <= 62 )
2414 {
2415 offset = ( part_id % 32 );
2416 mask = 1 << offset;
2417
2419 }
2420 else if ( part_id >= 63 && part_id <= 93 )
2421 {
2422 offset = ( part_id % 63 );
2423 mask = 1 << offset;
2424
2426 }
2427 }
2428
2430 {
2431
2432 int offset;
2433 int mask;
2434
2435 if ( part_id >= 1 && part_id <= 31 )
2436 {
2437 offset = part_id - 1;
2438 mask = 1 << offset;
2439
2441 }
2442 else if ( part_id >= 32 && part_id <= 62 )
2443 {
2444 offset = ( part_id % 32 );
2445 mask = 1 << offset;
2446
2448 }
2449 else if ( part_id >= 63 && part_id <= 93 )
2450 {
2451 offset = ( part_id % 63 );
2452 mask = 1 << offset;
2453
2455 }
2456 }
2457
2459 {
2460
2461 int offset;
2462 int mask;
2463
2464 if ( part_id >= 1 && part_id <= 31 )
2465 {
2466 offset = part_id - 1;
2467 mask = 1 << offset;
2468
2470 {
2471 return true;
2472 }
2473 }
2474 else if ( part_id >= 32 && part_id <= 62 )
2475 {
2476 offset = ( part_id % 32 );
2477 mask = 1 << offset;
2478
2480 {
2481 return true;
2482 }
2483 }
2484 else if ( part_id >= 63 && part_id <= 93 )
2485 {
2486 offset = ( part_id % 63 );
2487 mask = 1 << offset;
2488
2490 {
2491 return true;
2492 }
2493 }
2494
2495 return false;
2496 }
2497
2499 {
2502 }
2503
2505 {
2506
2509 }
2510
2512 {
2514 {
2517
2518 switch( build_action_id )
2519 {
2523 }
2524 }
2525 }
2526
2527
2529 {
2531 bool is_base = part.
IsBase();
2534 if ( is_part_built_sync )
2535 {
2537 {
2541
2542 if (is_base)
2543 {
2546 }
2547 }
2548 }
2549 else
2550 {
2552 {
2556
2557 if (is_base)
2558 {
2561 }
2562 }
2563 }
2564
2565
2567 }
2568
2569
2571 {
2574
2575 for ( int i = 0; i < construction_parts.Count(); ++i )
2576 {
2577 string key = construction_parts.GetKey( i );
2580 }
2581
2582
2584 }
2585
2587 {
2590
2591 for ( int i = 0; i < construction_parts.Count(); ++i )
2592 {
2593 string key = construction_parts.GetKey( i );
2595
2596 if ( value.
GetId() ==
id )
2597 {
2598 return value;
2599 }
2600 }
2601
2602 return NULL;
2603 }
2604
2605
2606
2608 {
2610 }
2611
2613 {
2615 }
2616
2618 {
2619 return true;
2620 }
2621
2623 {
2624 return false;
2625 }
2626
2627
2629 {
2632 {
2634 }
2635
2636 return construction_kit;
2637 }
2638
2640 {
2643 {
2645 }
2646 }
2647
2649 {
2651 }
2652
2654 {
2655 return "";
2656 }
2657
2659 {
2662 }
2663
2664
2666 {
2669 }
2670
2671
2673 {
2674 super.OnStoreSave( ctx );
2675
2676
2680
2682 }
2683
2685 {
2686 if ( !super.OnStoreLoad( ctx, version ) )
2687 return false;
2688
2689
2690
2692 {
2694 return false;
2695 }
2697 {
2699 return false;
2700 }
2702 {
2704 return false;
2705 }
2706
2707
2709 {
2711 return false;
2712 }
2713
2714
2715 return true;
2716 }
2717
2719 {
2720 super.AfterStoreLoad();
2721
2723 {
2725 }
2726 }
2727
2729 {
2730
2732
2733
2736
2737
2739 }
2740
2742 {
2743 super.OnCreatePhysics();
2746 }
2747
2749 {
2751 return;
2752
2753 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2754
2756 return;
2757
2759 string part_name = zone;
2761
2763 {
2764 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2765
2766 if ( construction_part && construction.IsPartConstructed( part_name ) )
2767 {
2769 construction.DestroyConnectedParts(part_name);
2770 }
2771
2772
2773 if ( part_name.
Contains(
"barbed") )
2774 {
2775 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2776 if (barbed_wire)
2777 barbed_wire.SetMountedState( false );
2778 }
2779 }
2780 }
2781
2783 {
2785 {
2787 }
2788
2789 super.EEOnAfterLoad();
2790 }
2791
2793 {
2794 super.EEInit();
2795
2796
2798
2799
2800 #ifdef DEVELOPER
2802 #endif
2803 }
2804
2806 {
2807 super.EEItemAttached( item, slot_name );
2808
2812 }
2813
2815 {
2816 super.EEItemDetached( item, slot_name );
2817
2820 }
2821
2822 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2823 {
2826
2829 }
2830
2831
2833 {
2834 return true;
2835 }
2836
2837
2838
2840 {
2842
2843
2844 if (construtionPart.
IsBase())
2845 {
2847
2848
2850 }
2851
2852
2854
2855
2857
2858
2860
2862
2864
2865
2867
2868
2870 }
2871
2873 {
2874
2876 }
2877
2878
2880 {
2883
2884
2886
2887
2889
2890
2892
2893
2895
2897
2898
2900
2901
2903
2904
2905 if (construtionPart.
IsBase())
2906 {
2907
2909 }
2910
2913 }
2914
2916 {
2917
2919 }
2920
2921
2922 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2923 {
2926
2927
2929
2930
2932
2933
2935
2936
2938
2940
2941
2943
2944
2946
2947
2948 if (construtionPart.
IsBase())
2949 {
2950
2952 }
2953
2956 }
2957
2959 {
2960
2962 }
2963
2965 {
2966 bool process = false;
2967
2968
2972
2973 if (process)
2974 {
2975 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2976 {
2978 return;
2979 }
2980
2982 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2983 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2984
2985
2987 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2988 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2989 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2990 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2991 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2992 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2993 mins = minTmp;
2994 maxs = maxTmp;
2995
2996 maxs[1] = maxs[1] + 0.35;
2997
2999 }
3000 }
3001
3003 {
3006
3007
3009 foreach (
EntityAI entity : foundEntities)
3010 {
3013 }
3014 }
3015
3016
3018 {
3020
3024 }
3025
3027 {
3029
3031 {
3033 }
3034 else
3035 {
3037 }
3038
3040 }
3041
3043 {
3045
3047 foreach (
string slotName : attachmentSlots)
3048 {
3050 }
3051
3052
3055 else
3057
3059 }
3060
3062 {
3063 string slotNameMounted = slot_name + "_Mounted";
3064 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3065
3066 if (attachment)
3067 {
3068 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3069 if (barbedWire && barbedWire.IsMounted())
3071 else
3073
3074 if (is_locked)
3075 {
3076 SetAnimationPhase(slotNameMounted, 0);
3077 SetAnimationPhase(slot_name, 1);
3078 }
3079 else
3080 {
3081 SetAnimationPhase(slotNameMounted, 1);
3082 SetAnimationPhase(slot_name, 0);
3083 }
3084 }
3085 else
3086 {
3087 SetAnimationPhase(slotNameMounted, 1);
3088 SetAnimationPhase(slot_name, 1);
3089
3091 }
3092 }
3093
3094
3096 {
3099
3102
3105
3106 foreach (
string slotName : attachmentSlots)
3107 {
3109 }
3110
3111
3113 {
3116
3118 }
3119 else
3120 {
3123
3125 }
3126
3129 }
3130
3132 {
3133
3135 return;
3136
3137 string slot_name_mounted = slot_name + "_Mounted";
3138 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3139
3140
3142 RemoveProxyPhysics( slot_name_mounted );
3143 RemoveProxyPhysics( slot_name );
3144
3145 if ( attachment )
3146 {
3148 if ( is_locked )
3149 {
3151 AddProxyPhysics( slot_name_mounted );
3152 }
3153 else
3154 {
3156 AddProxyPhysics( slot_name );
3157 }
3158 }
3159 }
3160
3162 {
3163 SetAffectPathgraph( true, false );
3165 }
3166
3168 {
3169 return true;
3170 }
3171
3173 {
3174 return true;
3175 }
3176
3178 {
3179 if ( attachment )
3180 {
3182 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3183
3184 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3185 }
3186
3187 return false;
3188 }
3189
3191 {
3193 }
3194
3195
3197 {
3198 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3199 if (
GetGame().ConfigIsExisting( config_path ) )
3200 {
3202 }
3203 }
3204
3206 {
3207 return true;
3208 }
3209
3211 {
3212 return true;
3213 }
3214
3216 {
3217 return true;
3218 }
3219
3220
3222 {
3224 {
3226 }
3227
3229 }
3230
3232 {
3234 }
3235
3236
3237
3239 {
3240 return super.CanReceiveAttachment(attachment, slotId);
3241 }
3242
3244 {
3245 int attachment_count = GetInventory().AttachmentCount();
3246 if ( attachment_count > 0 )
3247 {
3248 if (
HasBase() && attachment_count == 1 )
3249 {
3250 return false;
3251 }
3252
3253 return true;
3254 }
3255
3256 return false;
3257 }
3258
3260 {
3261 return true;
3262 }
3263
3265 {
3266 return false;
3267 }
3268
3269
3271 {
3272 return false;
3273 }
3274
3276 {
3277 return false;
3278 }
3279
3280
3282 {
3283 return false;
3284 }
3285
3286
3287
3289 {
3290 return true;
3291 }
3292
3294 {
3295 return true;
3296 }
3297
3300 {
3301 return false;
3302 }
3303
3304
3306 {
3307 return true;
3308 }
3309
3310
3312 {
3313 return false;
3314 }
3315
3316
3318 {
3319 return true;
3320 }
3321
3322
3324 {
3325 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3326 {
3327 return false;
3328 }
3329
3330 return true;
3331 }
3332
3334 {
3337
3338 return item;
3339 }
3340
3341
3343 {
3345 {
3346
3348
3349
3352
3354 if ( MemoryPointExists( slot_name + "_min" ) )
3355 {
3356 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3357 }
3358 if ( MemoryPointExists( slot_name + "_max" ) )
3359 {
3360 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3361 }
3362
3363
3366
3367
3370 center = ModelToWorld( center );
3371
3372
3375
3376 areaDamage.SetExtents( extents[0], extents[1] );
3377 areaDamage.SetAreaPosition( center );
3378 areaDamage.SetAreaOrientation( orientation );
3381 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3382 areaDamage.SetAmmoName( "BarbedWireHit" );
3383 areaDamage.Spawn();
3384
3386 }
3387 }
3388
3390 {
3391 if ( angle_deg != 0 )
3392 {
3393
3394 orientation[0] = orientation[0] - angle_deg;
3395
3396
3398 if ( MemoryPointExists( "rotate_axis" ) )
3399 {
3400 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3401 }
3402 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];
3403 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];
3404 center[0] = r_center_x;
3405 center[2] = r_center_z;
3406 }
3407 }
3408
3410 {
3412 {
3415 {
3416 if (areaDamage)
3417 {
3418 areaDamage.Destroy();
3419 }
3420
3422 }
3423 }
3424 }
3425
3427 {
3428 return true;
3429 }
3430
3431
3432
3433
3435 {
3437 }
3438
3440 {
3442 }
3443
3445 {
3447 }
3448
3450 {
3452
3453 switch ( material_type )
3454 {
3460 }
3461
3462 return "";
3463 }
3464
3466 {
3468
3469 switch ( material_type )
3470 {
3476 }
3477
3478 return "";
3479 }
3480
3481
3483 {
3485 {
3486
3488 {
3489 SetHealth(slot_name,"Health",item.GetHealth());
3490 }
3491 }
3492 }
3493
3495 {
3496 return 111;
3497 }
3498
3500 {
3501 super.SetActions();
3502
3506 }
3507
3508
3509
3510
3512 {
3513 }
3514
3517 {
3518 return null;
3519 }
3520
3522 {
3524 }
3525
3527 {
3530
3531 Man p;
3532
3533 #ifdef SERVER
3536 if (players.Count())
3537 p = players[0];
3538 #else
3540 #endif
3541
3543 {
3544 bool excluded = false;
3546 if (excludes)
3547 {
3548 foreach (string exclude : excludes)
3549 {
3551 {
3552 excluded = true;
3553 break;
3554 }
3555 }
3556 }
3557
3558 if (!excluded)
3559 {
3561 }
3562 }
3563
3565 }
3566}
3567
3569{
3570#ifdef BSB_DEBUG
3572#else
3573
3574#endif
3575}
3577{
3578#ifdef BSB_DEBUG_SPAM
3580#else
3581
3582#endif
3583}
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.