2246{
2248
2250
2252
2254
2260
2261
2262
2268
2274
2276
2280
2281
2283 {
2285
2286
2287 RegisterNetSyncVariableInt( "m_SyncParts01" );
2288 RegisterNetSyncVariableInt( "m_SyncParts02" );
2289 RegisterNetSyncVariableInt( "m_SyncParts03" );
2290 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2291 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2292 RegisterNetSyncVariableBool( "m_HasBase" );
2293
2294
2296
2297 if (ConfigIsExisting("hybridAttachments"))
2298 {
2301 }
2302 if (ConfigIsExisting("mountables"))
2303 {
2306 }
2307
2309 }
2310
2312 {
2313 super.EEDelete(parent);
2314
2316 {
2317 areaDamage.Destroy();
2318 }
2319
2320 }
2321
2323 {
2324 return "disableBaseDamage";
2325 }
2326
2328 {
2329 return true;
2330 }
2331
2333 {
2334 return EInventoryIconVisibility.HIDE_VICINITY;
2335 }
2336
2337
2339 {
2341 {
2342 SetSynchDirty();
2343 }
2344 }
2345
2347 {
2349 super.OnVariablesSynchronized();
2350
2352 }
2353
2355 {
2356
2358
2359
2361
2362
2364 }
2365
2366
2368 {
2369
2370 int offset;
2371 int mask;
2372
2373 if ( part_id >= 1 && part_id <= 31 )
2374 {
2375 offset = part_id - 1;
2376 mask = 1 << offset;
2377
2379 }
2380 else if ( part_id >= 32 && part_id <= 62 )
2381 {
2382 offset = ( part_id % 32 );
2383 mask = 1 << offset;
2384
2386 }
2387 else if ( part_id >= 63 && part_id <= 93 )
2388 {
2389 offset = ( part_id % 63 );
2390 mask = 1 << offset;
2391
2393 }
2394 }
2395
2397 {
2398
2399 int offset;
2400 int mask;
2401
2402 if ( part_id >= 1 && part_id <= 31 )
2403 {
2404 offset = part_id - 1;
2405 mask = 1 << offset;
2406
2408 }
2409 else if ( part_id >= 32 && part_id <= 62 )
2410 {
2411 offset = ( part_id % 32 );
2412 mask = 1 << offset;
2413
2415 }
2416 else if ( part_id >= 63 && part_id <= 93 )
2417 {
2418 offset = ( part_id % 63 );
2419 mask = 1 << offset;
2420
2422 }
2423 }
2424
2426 {
2427
2428 int offset;
2429 int mask;
2430
2431 if ( part_id >= 1 && part_id <= 31 )
2432 {
2433 offset = part_id - 1;
2434 mask = 1 << offset;
2435
2437 {
2438 return true;
2439 }
2440 }
2441 else if ( part_id >= 32 && part_id <= 62 )
2442 {
2443 offset = ( part_id % 32 );
2444 mask = 1 << offset;
2445
2447 {
2448 return true;
2449 }
2450 }
2451 else if ( part_id >= 63 && part_id <= 93 )
2452 {
2453 offset = ( part_id % 63 );
2454 mask = 1 << offset;
2455
2457 {
2458 return true;
2459 }
2460 }
2461
2462 return false;
2463 }
2464
2466 {
2469 }
2470
2472 {
2473
2476 }
2477
2479 {
2481 {
2484
2485 switch( build_action_id )
2486 {
2490 }
2491 }
2492 }
2493
2494
2496 {
2498 bool is_base = part.
IsBase();
2501 if ( is_part_built_sync )
2502 {
2504 {
2508
2509 if (is_base)
2510 {
2513 }
2514 }
2515 }
2516 else
2517 {
2519 {
2523
2524 if (is_base)
2525 {
2528 }
2529 }
2530 }
2531
2532
2534 }
2535
2536
2538 {
2541
2542 for ( int i = 0; i < construction_parts.Count(); ++i )
2543 {
2544 string key = construction_parts.GetKey( i );
2547 }
2548
2549
2551 }
2552
2554 {
2557
2558 for ( int i = 0; i < construction_parts.Count(); ++i )
2559 {
2560 string key = construction_parts.GetKey( i );
2562
2563 if ( value.
GetId() ==
id )
2564 {
2565 return value;
2566 }
2567 }
2568
2569 return NULL;
2570 }
2571
2572
2573
2575 {
2577 }
2578
2580 {
2582 }
2583
2585 {
2586 return true;
2587 }
2588
2590 {
2591 return false;
2592 }
2593
2594
2596 {
2599 {
2601 }
2602
2603 return construction_kit;
2604 }
2605
2607 {
2610 {
2612 }
2613 }
2614
2616 {
2618 }
2619
2621 {
2622 return "";
2623 }
2624
2626 {
2629 }
2630
2631
2633 {
2636 }
2637
2638
2640 {
2641 super.OnStoreSave( ctx );
2642
2643
2647
2649 }
2650
2652 {
2653 if ( !super.OnStoreLoad( ctx, version ) )
2654 return false;
2655
2656
2657
2659 {
2661 return false;
2662 }
2664 {
2666 return false;
2667 }
2669 {
2671 return false;
2672 }
2673
2674
2676 {
2678 return false;
2679 }
2680
2681
2682 return true;
2683 }
2684
2686 {
2687 super.AfterStoreLoad();
2688
2690 {
2692 }
2693 }
2694
2696 {
2697
2699
2700
2703
2704
2706 }
2707
2709 {
2710 super.OnCreatePhysics();
2713 }
2714
2716 {
2718 return;
2719
2720 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2721
2723 return;
2724
2726 string part_name = zone;
2728
2730 {
2731 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2732
2733 if ( construction_part && construction.IsPartConstructed( part_name ) )
2734 {
2736 construction.DestroyConnectedParts(part_name);
2737 }
2738
2739
2740 if ( part_name.
Contains(
"barbed") )
2741 {
2742 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2743 if (barbed_wire)
2744 barbed_wire.SetMountedState( false );
2745 }
2746 }
2747 }
2748
2750 {
2752 {
2754 }
2755
2756 super.EEOnAfterLoad();
2757 }
2758
2760 {
2761 super.EEInit();
2762
2763
2765
2766
2767 #ifdef DEVELOPER
2769 #endif
2770 }
2771
2773 {
2774 super.EEItemAttached( item, slot_name );
2775
2779 }
2780
2782 {
2783 super.EEItemDetached( item, slot_name );
2784
2787 }
2788
2789 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2790 {
2793
2796 }
2797
2798
2800 {
2801 return true;
2802 }
2803
2804
2805
2807 {
2809
2810
2811 if (construtionPart.
IsBase())
2812 {
2814
2815
2817 }
2818
2819
2821
2822
2824
2825
2827
2829
2831
2832
2834
2835
2837 }
2838
2840 {
2841
2843 }
2844
2845
2847 {
2850
2851
2853
2854
2856
2857
2859
2860
2862
2864
2865
2867
2868
2870
2871
2872 if (construtionPart.
IsBase())
2873 {
2874
2876 }
2877
2880 }
2881
2883 {
2884
2886 }
2887
2888
2889 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2890 {
2893
2894
2896
2897
2899
2900
2902
2903
2905
2907
2908
2910
2911
2913
2914
2915 if (construtionPart.
IsBase())
2916 {
2917
2919 }
2920
2923 }
2924
2926 {
2927
2929 }
2930
2932 {
2933 bool process = false;
2934
2935
2939
2940 if (process)
2941 {
2942 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2943 {
2945 return;
2946 }
2947
2949 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2950 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2951
2952
2954 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2955 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2956 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2957 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2958 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2959 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2960 mins = minTmp;
2961 maxs = maxTmp;
2962
2963 maxs[1] = maxs[1] + 0.35;
2964
2966 }
2967 }
2968
2970 {
2973
2974
2976 foreach (
EntityAI entity : foundEntities)
2977 {
2980 }
2981 }
2982
2983
2985 {
2987
2991 }
2992
2994 {
2996
2998 {
3000 }
3001 else
3002 {
3004 }
3005
3007 }
3008
3010 {
3012
3014 foreach (
string slotName : attachmentSlots)
3015 {
3017 }
3018
3019
3022 else
3024
3026 }
3027
3029 {
3030 string slotNameMounted = slot_name + "_Mounted";
3031 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3032
3033 if (attachment)
3034 {
3035 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3036 if (barbedWire && barbedWire.IsMounted())
3038 else
3040
3041 if (is_locked)
3042 {
3043 SetAnimationPhase(slotNameMounted, 0);
3044 SetAnimationPhase(slot_name, 1);
3045 }
3046 else
3047 {
3048 SetAnimationPhase(slotNameMounted, 1);
3049 SetAnimationPhase(slot_name, 0);
3050 }
3051 }
3052 else
3053 {
3054 SetAnimationPhase(slotNameMounted, 1);
3055 SetAnimationPhase(slot_name, 1);
3056
3058 }
3059 }
3060
3061
3063 {
3066
3069
3072
3073 foreach (
string slotName : attachmentSlots)
3074 {
3076 }
3077
3078
3080 {
3083
3085 }
3086 else
3087 {
3090
3092 }
3093
3096 }
3097
3099 {
3100
3102 return;
3103
3104 string slot_name_mounted = slot_name + "_Mounted";
3105 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3106
3107
3109 RemoveProxyPhysics( slot_name_mounted );
3110 RemoveProxyPhysics( slot_name );
3111
3112 if ( attachment )
3113 {
3115 if ( is_locked )
3116 {
3118 AddProxyPhysics( slot_name_mounted );
3119 }
3120 else
3121 {
3123 AddProxyPhysics( slot_name );
3124 }
3125 }
3126 }
3127
3129 {
3130 SetAffectPathgraph( true, false );
3132 }
3133
3135 {
3136 return true;
3137 }
3138
3140 {
3141 return true;
3142 }
3143
3145 {
3146 if ( attachment )
3147 {
3149 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3150
3151 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3152 }
3153
3154 return false;
3155 }
3156
3158 {
3160 }
3161
3162
3164 {
3165 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3166 if (
GetGame().ConfigIsExisting( config_path ) )
3167 {
3169 }
3170 }
3171
3173 {
3174 return true;
3175 }
3176
3178 {
3179 return true;
3180 }
3181
3183 {
3184 return true;
3185 }
3186
3187
3189 {
3191 {
3193 }
3194
3196 }
3197
3199 {
3201 }
3202
3203
3204
3206 {
3207 return super.CanReceiveAttachment(attachment, slotId);
3208 }
3209
3211 {
3212 int attachment_count = GetInventory().AttachmentCount();
3213 if ( attachment_count > 0 )
3214 {
3215 if (
HasBase() && attachment_count == 1 )
3216 {
3217 return false;
3218 }
3219
3220 return true;
3221 }
3222
3223 return false;
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3232 {
3233 return false;
3234 }
3235
3236
3238 {
3239 return false;
3240 }
3241
3243 {
3244 return false;
3245 }
3246
3247
3249 {
3250 return false;
3251 }
3252
3253
3254
3256 {
3257 return true;
3258 }
3259
3261 {
3262 return true;
3263 }
3264
3267 {
3268 return false;
3269 }
3270
3271
3273 {
3274 return true;
3275 }
3276
3277
3279 {
3280 return false;
3281 }
3282
3283
3285 {
3286 return true;
3287 }
3288
3289
3291 {
3292 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3293 {
3294 return false;
3295 }
3296
3297 return true;
3298 }
3299
3301 {
3304
3305 return item;
3306 }
3307
3308
3310 {
3312 {
3313
3315
3316
3319
3321 if ( MemoryPointExists( slot_name + "_min" ) )
3322 {
3323 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3324 }
3325 if ( MemoryPointExists( slot_name + "_max" ) )
3326 {
3327 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3328 }
3329
3330
3333
3334
3337 center = ModelToWorld( center );
3338
3339
3342
3343 areaDamage.SetExtents( extents[0], extents[1] );
3344 areaDamage.SetAreaPosition( center );
3345 areaDamage.SetAreaOrientation( orientation );
3348 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3349 areaDamage.SetAmmoName( "BarbedWireHit" );
3350 areaDamage.Spawn();
3351
3353 }
3354 }
3355
3357 {
3358 if ( angle_deg != 0 )
3359 {
3360
3361 orientation[0] = orientation[0] - angle_deg;
3362
3363
3365 if ( MemoryPointExists( "rotate_axis" ) )
3366 {
3367 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3368 }
3369 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];
3370 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];
3371 center[0] = r_center_x;
3372 center[2] = r_center_z;
3373 }
3374 }
3375
3377 {
3379 {
3382 {
3383 if (areaDamage)
3384 {
3385 areaDamage.Destroy();
3386 }
3387
3389 }
3390 }
3391 }
3392
3394 {
3395 return true;
3396 }
3397
3398
3399
3400
3402 {
3404 }
3405
3407 {
3409 }
3410
3412 {
3414 }
3415
3417 {
3419
3420 switch ( material_type )
3421 {
3427 }
3428
3429 return "";
3430 }
3431
3433 {
3435
3436 switch ( material_type )
3437 {
3443 }
3444
3445 return "";
3446 }
3447
3448
3450 {
3452 {
3453
3455 {
3456 SetHealth(slot_name,"Health",item.GetHealth());
3457 }
3458 }
3459 }
3460
3462 {
3463 return 111;
3464 }
3465
3467 {
3468 super.SetActions();
3469
3473 }
3474
3475
3476
3477
3479 {
3480 }
3481
3484 {
3485 return null;
3486 }
3487
3489 {
3491 }
3492
3494 {
3497
3498 Man p;
3499
3500 #ifdef SERVER
3503 if (players.Count())
3504 p = players[0];
3505 #else
3507 #endif
3508
3510 {
3511 bool excluded = false;
3513 if (excludes)
3514 {
3515 foreach (string exclude : excludes)
3516 {
3518 {
3519 excluded = true;
3520 break;
3521 }
3522 }
3523 }
3524
3525 if (!excluded)
3526 {
3528 }
3529 }
3530
3532 }
3533}
3534
3536{
3537#ifdef BSB_DEBUG
3539#else
3540
3541#endif
3542}
3544{
3545#ifdef BSB_DEBUG_SPAM
3547#else
3548
3549#endif
3550}
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.