2211{
2213
2215
2217
2219
2225
2226
2227
2233
2239
2241
2245
2246
2248 {
2250
2251
2252 RegisterNetSyncVariableInt( "m_SyncParts01" );
2253 RegisterNetSyncVariableInt( "m_SyncParts02" );
2254 RegisterNetSyncVariableInt( "m_SyncParts03" );
2255 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2256 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2257 RegisterNetSyncVariableBool( "m_HasBase" );
2258
2259
2261
2262 if (ConfigIsExisting("hybridAttachments"))
2263 {
2266 }
2267 if (ConfigIsExisting("mountables"))
2268 {
2271 }
2272
2274 }
2275
2277 {
2278 super.EEDelete(parent);
2279
2281 {
2282 areaDamage.Destroy();
2283 }
2284
2285 }
2286
2288 {
2289 return "disableBaseDamage";
2290 }
2291
2293 {
2294 return true;
2295 }
2296
2298 {
2299 return EInventoryIconVisibility.HIDE_VICINITY;
2300 }
2301
2302
2304 {
2306 {
2307 SetSynchDirty();
2308 }
2309 }
2310
2312 {
2314 super.OnVariablesSynchronized();
2315
2317 }
2318
2320 {
2321
2323
2324
2326
2327
2329 }
2330
2331
2333 {
2334
2335 int offset;
2336 int mask;
2337
2338 if ( part_id >= 1 && part_id <= 31 )
2339 {
2340 offset = part_id - 1;
2341 mask = 1 << offset;
2342
2344 }
2345 else if ( part_id >= 32 && part_id <= 62 )
2346 {
2347 offset = ( part_id % 32 );
2348 mask = 1 << offset;
2349
2351 }
2352 else if ( part_id >= 63 && part_id <= 93 )
2353 {
2354 offset = ( part_id % 63 );
2355 mask = 1 << offset;
2356
2358 }
2359 }
2360
2362 {
2363
2364 int offset;
2365 int mask;
2366
2367 if ( part_id >= 1 && part_id <= 31 )
2368 {
2369 offset = part_id - 1;
2370 mask = 1 << offset;
2371
2373 }
2374 else if ( part_id >= 32 && part_id <= 62 )
2375 {
2376 offset = ( part_id % 32 );
2377 mask = 1 << offset;
2378
2380 }
2381 else if ( part_id >= 63 && part_id <= 93 )
2382 {
2383 offset = ( part_id % 63 );
2384 mask = 1 << offset;
2385
2387 }
2388 }
2389
2391 {
2392
2393 int offset;
2394 int mask;
2395
2396 if ( part_id >= 1 && part_id <= 31 )
2397 {
2398 offset = part_id - 1;
2399 mask = 1 << offset;
2400
2402 {
2403 return true;
2404 }
2405 }
2406 else if ( part_id >= 32 && part_id <= 62 )
2407 {
2408 offset = ( part_id % 32 );
2409 mask = 1 << offset;
2410
2412 {
2413 return true;
2414 }
2415 }
2416 else if ( part_id >= 63 && part_id <= 93 )
2417 {
2418 offset = ( part_id % 63 );
2419 mask = 1 << offset;
2420
2422 {
2423 return true;
2424 }
2425 }
2426
2427 return false;
2428 }
2429
2431 {
2434 }
2435
2437 {
2438
2441 }
2442
2444 {
2446 {
2449
2450 switch( build_action_id )
2451 {
2455 }
2456 }
2457 }
2458
2459
2461 {
2463 bool is_base = part.
IsBase();
2466 if ( is_part_built_sync )
2467 {
2469 {
2473
2474 if (is_base)
2475 {
2478 }
2479 }
2480 }
2481 else
2482 {
2484 {
2488
2489 if (is_base)
2490 {
2493 }
2494 }
2495 }
2496
2497
2499 }
2500
2501
2503 {
2506
2507 for ( int i = 0; i < construction_parts.Count(); ++i )
2508 {
2509 string key = construction_parts.GetKey( i );
2512 }
2513
2514
2516 }
2517
2519 {
2522
2523 for ( int i = 0; i < construction_parts.Count(); ++i )
2524 {
2525 string key = construction_parts.GetKey( i );
2527
2528 if ( value.
GetId() ==
id )
2529 {
2530 return value;
2531 }
2532 }
2533
2534 return NULL;
2535 }
2536
2537
2538
2540 {
2542 }
2543
2545 {
2547 }
2548
2550 {
2551 return true;
2552 }
2553
2555 {
2556 return false;
2557 }
2558
2559
2561 {
2564 {
2566 }
2567
2568 return construction_kit;
2569 }
2570
2572 {
2575 {
2577 }
2578 }
2579
2581 {
2583 }
2584
2586 {
2587 return "";
2588 }
2589
2591 {
2594 }
2595
2596
2598 {
2601 }
2602
2603
2605 {
2606 super.OnStoreSave( ctx );
2607
2608
2612
2614 }
2615
2617 {
2618 if ( !super.OnStoreLoad( ctx, version ) )
2619 return false;
2620
2621
2622
2624 {
2626 return false;
2627 }
2629 {
2631 return false;
2632 }
2634 {
2636 return false;
2637 }
2638
2639
2641 {
2643 return false;
2644 }
2645
2646
2647 return true;
2648 }
2649
2651 {
2652 super.AfterStoreLoad();
2653
2655 {
2657 }
2658 }
2659
2661 {
2662
2664
2665
2668
2669
2671 }
2672
2674 {
2675 super.OnCreatePhysics();
2678 }
2679
2681 {
2683 return;
2684
2685 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2686
2688 return;
2689
2691 string part_name = zone;
2693
2695 {
2696 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2697
2698 if ( construction_part && construction.IsPartConstructed( part_name ) )
2699 {
2701 construction.DestroyConnectedParts(part_name);
2702 }
2703
2704
2705 if ( part_name.
Contains(
"barbed") )
2706 {
2707 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2708 if (barbed_wire)
2709 barbed_wire.SetMountedState( false );
2710 }
2711 }
2712 }
2713
2715 {
2717 {
2719 }
2720
2721 super.EEOnAfterLoad();
2722 }
2723
2725 {
2726 super.EEInit();
2727
2728
2730
2731
2732 #ifdef DEVELOPER
2734 #endif
2735 }
2736
2738 {
2739 super.EEItemAttached( item, slot_name );
2740
2744 }
2745
2747 {
2748 super.EEItemDetached( item, slot_name );
2749
2752 }
2753
2754 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2755 {
2758
2761 }
2762
2763
2765 {
2766 return true;
2767 }
2768
2769
2770
2772 {
2774
2775
2776 if (construtionPart.
IsBase())
2777 {
2779
2780
2782 }
2783
2784
2786
2787
2789
2790
2792
2794
2796
2797
2799
2800
2802 }
2803
2805 {
2806
2808 }
2809
2810
2812 {
2815
2816
2818
2819
2821
2822
2824
2825
2827
2829
2830
2832
2833
2835
2836
2837 if (construtionPart.
IsBase())
2838 {
2839
2841 }
2842
2845 }
2846
2848 {
2849
2851 }
2852
2853
2854 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2855 {
2858
2859
2861
2862
2864
2865
2867
2868
2870
2872
2873
2875
2876
2878
2879
2880 if (construtionPart.
IsBase())
2881 {
2882
2884 }
2885
2888 }
2889
2891 {
2892
2894 }
2895
2897 {
2898 bool process = false;
2899
2900
2904
2905 if (process)
2906 {
2907 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2908 {
2910 return;
2911 }
2912
2914 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2915 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2916
2917
2919 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2920 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2921 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2922 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2923 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2924 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2925 mins = minTmp;
2926 maxs = maxTmp;
2927
2928 maxs[1] = maxs[1] + 0.35;
2929
2931 }
2932 }
2933
2935 {
2938
2939
2941 foreach (
EntityAI entity : foundEntities)
2942 {
2945 }
2946 }
2947
2948
2950 {
2952
2956 }
2957
2959 {
2961
2963 {
2965 }
2966 else
2967 {
2969 }
2970
2972 }
2973
2975 {
2977
2979 foreach (
string slotName : attachmentSlots)
2980 {
2982 }
2983
2984
2987 else
2989
2991 }
2992
2994 {
2995 string slotNameMounted = slot_name + "_Mounted";
2996 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2997
2998 if (attachment)
2999 {
3000 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3001 if (barbedWire && barbedWire.IsMounted())
3003 else
3005
3006 if (is_locked)
3007 {
3008 SetAnimationPhase(slotNameMounted, 0);
3009 SetAnimationPhase(slot_name, 1);
3010 }
3011 else
3012 {
3013 SetAnimationPhase(slotNameMounted, 1);
3014 SetAnimationPhase(slot_name, 0);
3015 }
3016 }
3017 else
3018 {
3019 SetAnimationPhase(slotNameMounted, 1);
3020 SetAnimationPhase(slot_name, 1);
3021
3023 }
3024 }
3025
3026
3028 {
3031
3034
3037
3038 foreach (
string slotName : attachmentSlots)
3039 {
3041 }
3042
3043
3045 {
3048
3050 }
3051 else
3052 {
3055
3057 }
3058
3061 }
3062
3064 {
3065
3067 return;
3068
3069 string slot_name_mounted = slot_name + "_Mounted";
3070 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3071
3072
3074 RemoveProxyPhysics( slot_name_mounted );
3075 RemoveProxyPhysics( slot_name );
3076
3077 if ( attachment )
3078 {
3080 if ( is_locked )
3081 {
3083 AddProxyPhysics( slot_name_mounted );
3084 }
3085 else
3086 {
3088 AddProxyPhysics( slot_name );
3089 }
3090 }
3091 }
3092
3094 {
3095 SetAffectPathgraph( true, false );
3097 }
3098
3100 {
3101 return true;
3102 }
3103
3105 {
3106 return true;
3107 }
3108
3110 {
3111 if ( attachment )
3112 {
3114 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3115
3116 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3117 }
3118
3119 return false;
3120 }
3121
3123 {
3125 }
3126
3127
3129 {
3130 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3131 if (
GetGame().ConfigIsExisting( config_path ) )
3132 {
3134 }
3135 }
3136
3138 {
3139 return true;
3140 }
3141
3143 {
3144 return true;
3145 }
3146
3148 {
3149 return true;
3150 }
3151
3152
3154 {
3156 {
3158 }
3159
3161 }
3162
3164 {
3166 }
3167
3168
3169
3171 {
3172 return super.CanReceiveAttachment(attachment, slotId);
3173 }
3174
3176 {
3177 int attachment_count = GetInventory().AttachmentCount();
3178 if ( attachment_count > 0 )
3179 {
3180 if (
HasBase() && attachment_count == 1 )
3181 {
3182 return false;
3183 }
3184
3185 return true;
3186 }
3187
3188 return false;
3189 }
3190
3192 {
3193 return true;
3194 }
3195
3197 {
3198 return false;
3199 }
3200
3201
3203 {
3204 return false;
3205 }
3206
3208 {
3209 return false;
3210 }
3211
3212
3214 {
3215 return false;
3216 }
3217
3218
3219
3221 {
3222 return true;
3223 }
3224
3226 {
3227 return true;
3228 }
3229
3232 {
3233 return false;
3234 }
3235
3236
3238 {
3239 return true;
3240 }
3241
3242
3244 {
3245 return false;
3246 }
3247
3248
3250 {
3251 return true;
3252 }
3253
3254
3256 {
3257 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3258 {
3259 return false;
3260 }
3261
3262 return true;
3263 }
3264
3266 {
3269
3270 return item;
3271 }
3272
3273
3275 {
3277 {
3278
3280
3281
3284
3286 if ( MemoryPointExists( slot_name + "_min" ) )
3287 {
3288 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3289 }
3290 if ( MemoryPointExists( slot_name + "_max" ) )
3291 {
3292 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3293 }
3294
3295
3298
3299
3302 center = ModelToWorld( center );
3303
3304
3307
3308 areaDamage.SetExtents( extents[0], extents[1] );
3309 areaDamage.SetAreaPosition( center );
3310 areaDamage.SetAreaOrientation( orientation );
3313 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3314 areaDamage.SetAmmoName( "BarbedWireHit" );
3315 areaDamage.Spawn();
3316
3318 }
3319 }
3320
3322 {
3323 if ( angle_deg != 0 )
3324 {
3325
3326 orientation[0] = orientation[0] - angle_deg;
3327
3328
3330 if ( MemoryPointExists( "rotate_axis" ) )
3331 {
3332 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3333 }
3334 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];
3335 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];
3336 center[0] = r_center_x;
3337 center[2] = r_center_z;
3338 }
3339 }
3340
3342 {
3344 {
3347 {
3348 if (areaDamage)
3349 {
3350 areaDamage.Destroy();
3351 }
3352
3354 }
3355 }
3356 }
3357
3359 {
3360 return true;
3361 }
3362
3363
3364
3365
3367 {
3369 }
3370
3372 {
3374 }
3375
3377 {
3379 }
3380
3382 {
3384
3385 switch ( material_type )
3386 {
3392 }
3393
3394 return "";
3395 }
3396
3398 {
3400
3401 switch ( material_type )
3402 {
3408 }
3409
3410 return "";
3411 }
3412
3413
3415 {
3417 {
3418
3420 {
3421 SetHealth(slot_name,"Health",item.GetHealth());
3422 }
3423 }
3424 }
3425
3427 {
3428 return 111;
3429 }
3430
3432 {
3433 super.SetActions();
3434
3438 }
3439
3440
3441
3442
3444 {
3445 }
3446
3449 {
3450 return null;
3451 }
3452
3454 {
3456 }
3457
3459 {
3462
3463 Man p;
3464
3465 #ifdef SERVER
3468 if (players.Count())
3469 p = players[0];
3470 #else
3472 #endif
3473
3475 {
3476 bool excluded = false;
3478 if (excludes)
3479 {
3480 foreach (string exclude : excludes)
3481 {
3483 {
3484 excluded = true;
3485 break;
3486 }
3487 }
3488 }
3489
3490 if (!excluded)
3491 {
3493 }
3494 }
3495
3497 }
3498}
3499
3501{
3502#ifdef BSB_DEBUG
3504#else
3505
3506#endif
3507}
3509{
3510#ifdef BSB_DEBUG_SPAM
3512#else
3513
3514#endif
3515}
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.