2225{
2227
2229
2231
2233
2239
2240
2241
2247
2253
2255
2259
2260
2262 {
2264
2265
2266 RegisterNetSyncVariableInt( "m_SyncParts01" );
2267 RegisterNetSyncVariableInt( "m_SyncParts02" );
2268 RegisterNetSyncVariableInt( "m_SyncParts03" );
2269 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2270 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2271 RegisterNetSyncVariableBool( "m_HasBase" );
2272
2273
2275
2276 if (ConfigIsExisting("hybridAttachments"))
2277 {
2280 }
2281 if (ConfigIsExisting("mountables"))
2282 {
2285 }
2286
2288 }
2289
2291 {
2292 super.EEDelete(parent);
2293
2295 {
2296 areaDamage.Destroy();
2297 }
2298
2299 }
2300
2302 {
2303 return "disableBaseDamage";
2304 }
2305
2307 {
2308 return true;
2309 }
2310
2312 {
2313 return EInventoryIconVisibility.HIDE_VICINITY;
2314 }
2315
2316
2318 {
2320 {
2321 SetSynchDirty();
2322 }
2323 }
2324
2326 {
2328 super.OnVariablesSynchronized();
2329
2331 }
2332
2334 {
2335
2337
2338
2340
2341
2343 }
2344
2345
2347 {
2348
2349 int offset;
2350 int mask;
2351
2352 if ( part_id >= 1 && part_id <= 31 )
2353 {
2354 offset = part_id - 1;
2355 mask = 1 << offset;
2356
2358 }
2359 else if ( part_id >= 32 && part_id <= 62 )
2360 {
2361 offset = ( part_id % 32 );
2362 mask = 1 << offset;
2363
2365 }
2366 else if ( part_id >= 63 && part_id <= 93 )
2367 {
2368 offset = ( part_id % 63 );
2369 mask = 1 << offset;
2370
2372 }
2373 }
2374
2376 {
2377
2378 int offset;
2379 int mask;
2380
2381 if ( part_id >= 1 && part_id <= 31 )
2382 {
2383 offset = part_id - 1;
2384 mask = 1 << offset;
2385
2387 }
2388 else if ( part_id >= 32 && part_id <= 62 )
2389 {
2390 offset = ( part_id % 32 );
2391 mask = 1 << offset;
2392
2394 }
2395 else if ( part_id >= 63 && part_id <= 93 )
2396 {
2397 offset = ( part_id % 63 );
2398 mask = 1 << offset;
2399
2401 }
2402 }
2403
2405 {
2406
2407 int offset;
2408 int mask;
2409
2410 if ( part_id >= 1 && part_id <= 31 )
2411 {
2412 offset = part_id - 1;
2413 mask = 1 << offset;
2414
2416 {
2417 return true;
2418 }
2419 }
2420 else if ( part_id >= 32 && part_id <= 62 )
2421 {
2422 offset = ( part_id % 32 );
2423 mask = 1 << offset;
2424
2426 {
2427 return true;
2428 }
2429 }
2430 else if ( part_id >= 63 && part_id <= 93 )
2431 {
2432 offset = ( part_id % 63 );
2433 mask = 1 << offset;
2434
2436 {
2437 return true;
2438 }
2439 }
2440
2441 return false;
2442 }
2443
2445 {
2448 }
2449
2451 {
2452
2455 }
2456
2458 {
2460 {
2463
2464 switch( build_action_id )
2465 {
2469 }
2470 }
2471 }
2472
2473
2475 {
2477 bool is_base = part.
IsBase();
2480 if ( is_part_built_sync )
2481 {
2483 {
2487
2488 if (is_base)
2489 {
2492 }
2493 }
2494 }
2495 else
2496 {
2498 {
2502
2503 if (is_base)
2504 {
2507 }
2508 }
2509 }
2510
2511
2513 }
2514
2515
2517 {
2520
2521 for ( int i = 0; i < construction_parts.Count(); ++i )
2522 {
2523 string key = construction_parts.GetKey( i );
2526 }
2527
2528
2530 }
2531
2533 {
2536
2537 for ( int i = 0; i < construction_parts.Count(); ++i )
2538 {
2539 string key = construction_parts.GetKey( i );
2541
2542 if ( value.
GetId() ==
id )
2543 {
2544 return value;
2545 }
2546 }
2547
2548 return NULL;
2549 }
2550
2551
2552
2554 {
2556 }
2557
2559 {
2561 }
2562
2564 {
2565 return true;
2566 }
2567
2569 {
2570 return false;
2571 }
2572
2573
2575 {
2578 {
2580 }
2581
2582 return construction_kit;
2583 }
2584
2586 {
2589 {
2591 }
2592 }
2593
2595 {
2597 }
2598
2600 {
2601 return "";
2602 }
2603
2605 {
2608 }
2609
2610
2612 {
2615 }
2616
2617
2619 {
2620 super.OnStoreSave( ctx );
2621
2622
2626
2628 }
2629
2631 {
2632 if ( !super.OnStoreLoad( ctx, version ) )
2633 return false;
2634
2635
2636
2638 {
2640 return false;
2641 }
2643 {
2645 return false;
2646 }
2648 {
2650 return false;
2651 }
2652
2653
2655 {
2657 return false;
2658 }
2659
2660
2661 return true;
2662 }
2663
2665 {
2666 super.AfterStoreLoad();
2667
2669 {
2671 }
2672 }
2673
2675 {
2676
2678
2679
2682
2683
2685 }
2686
2688 {
2689 super.OnCreatePhysics();
2692 }
2693
2695 {
2697 return;
2698
2699 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2700
2702 return;
2703
2705 string part_name = zone;
2707
2709 {
2710 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2711
2712 if ( construction_part && construction.IsPartConstructed( part_name ) )
2713 {
2715 construction.DestroyConnectedParts(part_name);
2716 }
2717
2718
2719 if ( part_name.
Contains(
"barbed") )
2720 {
2721 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2722 if (barbed_wire)
2723 barbed_wire.SetMountedState( false );
2724 }
2725 }
2726 }
2727
2729 {
2731 {
2733 }
2734
2735 super.EEOnAfterLoad();
2736 }
2737
2739 {
2740 super.EEInit();
2741
2742
2744
2745
2746 #ifdef DEVELOPER
2748 #endif
2749 }
2750
2752 {
2753 super.EEItemAttached( item, slot_name );
2754
2758 }
2759
2761 {
2762 super.EEItemDetached( item, slot_name );
2763
2766 }
2767
2768 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2769 {
2772
2775 }
2776
2777
2779 {
2780 return true;
2781 }
2782
2783
2784
2786 {
2788
2789
2790 if (construtionPart.
IsBase())
2791 {
2793
2794
2796 }
2797
2798
2800
2801
2803
2804
2806
2808
2810
2811
2813
2814
2816 }
2817
2819 {
2820
2822 }
2823
2824
2826 {
2829
2830
2832
2833
2835
2836
2838
2839
2841
2843
2844
2846
2847
2849
2850
2851 if (construtionPart.
IsBase())
2852 {
2853
2855 }
2856
2859 }
2860
2862 {
2863
2865 }
2866
2867
2868 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2869 {
2872
2873
2875
2876
2878
2879
2881
2882
2884
2886
2887
2889
2890
2892
2893
2894 if (construtionPart.
IsBase())
2895 {
2896
2898 }
2899
2902 }
2903
2905 {
2906
2908 }
2909
2911 {
2912 bool process = false;
2913
2914
2918
2919 if (process)
2920 {
2921 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2922 {
2924 return;
2925 }
2926
2928 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2929 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2930
2931
2933 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2934 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2935 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2936 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2937 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2938 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2939 mins = minTmp;
2940 maxs = maxTmp;
2941
2942 maxs[1] = maxs[1] + 0.35;
2943
2945 }
2946 }
2947
2949 {
2952
2953
2955 foreach (
EntityAI entity : foundEntities)
2956 {
2959 }
2960 }
2961
2962
2964 {
2966
2970 }
2971
2973 {
2975
2977 {
2979 }
2980 else
2981 {
2983 }
2984
2986 }
2987
2989 {
2991
2993 foreach (
string slotName : attachmentSlots)
2994 {
2996 }
2997
2998
3001 else
3003
3005 }
3006
3008 {
3009 string slotNameMounted = slot_name + "_Mounted";
3010 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3011
3012 if (attachment)
3013 {
3014 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3015 if (barbedWire && barbedWire.IsMounted())
3017 else
3019
3020 if (is_locked)
3021 {
3022 SetAnimationPhase(slotNameMounted, 0);
3023 SetAnimationPhase(slot_name, 1);
3024 }
3025 else
3026 {
3027 SetAnimationPhase(slotNameMounted, 1);
3028 SetAnimationPhase(slot_name, 0);
3029 }
3030 }
3031 else
3032 {
3033 SetAnimationPhase(slotNameMounted, 1);
3034 SetAnimationPhase(slot_name, 1);
3035
3037 }
3038 }
3039
3040
3042 {
3045
3048
3051
3052 foreach (
string slotName : attachmentSlots)
3053 {
3055 }
3056
3057
3059 {
3062
3064 }
3065 else
3066 {
3069
3071 }
3072
3075 }
3076
3078 {
3079
3081 return;
3082
3083 string slot_name_mounted = slot_name + "_Mounted";
3084 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3085
3086
3088 RemoveProxyPhysics( slot_name_mounted );
3089 RemoveProxyPhysics( slot_name );
3090
3091 if ( attachment )
3092 {
3094 if ( is_locked )
3095 {
3097 AddProxyPhysics( slot_name_mounted );
3098 }
3099 else
3100 {
3102 AddProxyPhysics( slot_name );
3103 }
3104 }
3105 }
3106
3108 {
3109 SetAffectPathgraph( true, false );
3111 }
3112
3114 {
3115 return true;
3116 }
3117
3119 {
3120 return true;
3121 }
3122
3124 {
3125 if ( attachment )
3126 {
3128 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3129
3130 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3131 }
3132
3133 return false;
3134 }
3135
3137 {
3139 }
3140
3141
3143 {
3144 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3145 if (
GetGame().ConfigIsExisting( config_path ) )
3146 {
3148 }
3149 }
3150
3152 {
3153 return true;
3154 }
3155
3157 {
3158 return true;
3159 }
3160
3162 {
3163 return true;
3164 }
3165
3166
3168 {
3170 {
3172 }
3173
3175 }
3176
3178 {
3180 }
3181
3182
3183
3185 {
3186 return super.CanReceiveAttachment(attachment, slotId);
3187 }
3188
3190 {
3191 int attachment_count = GetInventory().AttachmentCount();
3192 if ( attachment_count > 0 )
3193 {
3194 if (
HasBase() && attachment_count == 1 )
3195 {
3196 return false;
3197 }
3198
3199 return true;
3200 }
3201
3202 return false;
3203 }
3204
3206 {
3207 return true;
3208 }
3209
3211 {
3212 return false;
3213 }
3214
3215
3217 {
3218 return false;
3219 }
3220
3222 {
3223 return false;
3224 }
3225
3226
3228 {
3229 return false;
3230 }
3231
3232
3233
3235 {
3236 return true;
3237 }
3238
3240 {
3241 return true;
3242 }
3243
3246 {
3247 return false;
3248 }
3249
3250
3252 {
3253 return true;
3254 }
3255
3256
3258 {
3259 return false;
3260 }
3261
3262
3264 {
3265 return true;
3266 }
3267
3268
3270 {
3271 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3272 {
3273 return false;
3274 }
3275
3276 return true;
3277 }
3278
3280 {
3283
3284 return item;
3285 }
3286
3287
3289 {
3291 {
3292
3294
3295
3298
3300 if ( MemoryPointExists( slot_name + "_min" ) )
3301 {
3302 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3303 }
3304 if ( MemoryPointExists( slot_name + "_max" ) )
3305 {
3306 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3307 }
3308
3309
3312
3313
3316 center = ModelToWorld( center );
3317
3318
3321
3322 areaDamage.SetExtents( extents[0], extents[1] );
3323 areaDamage.SetAreaPosition( center );
3324 areaDamage.SetAreaOrientation( orientation );
3327 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3328 areaDamage.SetAmmoName( "BarbedWireHit" );
3329 areaDamage.Spawn();
3330
3332 }
3333 }
3334
3336 {
3337 if ( angle_deg != 0 )
3338 {
3339
3340 orientation[0] = orientation[0] - angle_deg;
3341
3342
3344 if ( MemoryPointExists( "rotate_axis" ) )
3345 {
3346 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3347 }
3348 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];
3349 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];
3350 center[0] = r_center_x;
3351 center[2] = r_center_z;
3352 }
3353 }
3354
3356 {
3358 {
3361 {
3362 if (areaDamage)
3363 {
3364 areaDamage.Destroy();
3365 }
3366
3368 }
3369 }
3370 }
3371
3373 {
3374 return true;
3375 }
3376
3377
3378
3379
3381 {
3383 }
3384
3386 {
3388 }
3389
3391 {
3393 }
3394
3396 {
3398
3399 switch ( material_type )
3400 {
3406 }
3407
3408 return "";
3409 }
3410
3412 {
3414
3415 switch ( material_type )
3416 {
3422 }
3423
3424 return "";
3425 }
3426
3427
3429 {
3431 {
3432
3434 {
3435 SetHealth(slot_name,"Health",item.GetHealth());
3436 }
3437 }
3438 }
3439
3441 {
3442 return 111;
3443 }
3444
3446 {
3447 super.SetActions();
3448
3452 }
3453
3454
3455
3456
3458 {
3459 }
3460
3463 {
3464 return null;
3465 }
3466
3468 {
3470 }
3471
3473 {
3476
3477 Man p;
3478
3479 #ifdef SERVER
3482 if (players.Count())
3483 p = players[0];
3484 #else
3486 #endif
3487
3489 {
3490 bool excluded = false;
3492 if (excludes)
3493 {
3494 foreach (string exclude : excludes)
3495 {
3497 {
3498 excluded = true;
3499 break;
3500 }
3501 }
3502 }
3503
3504 if (!excluded)
3505 {
3507 }
3508 }
3509
3511 }
3512}
3513
3515{
3516#ifdef BSB_DEBUG
3518#else
3519
3520#endif
3521}
3523{
3524#ifdef BSB_DEBUG_SPAM
3526#else
3527
3528#endif
3529}
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.