2236{
2238
2240
2242
2244
2250
2251
2252
2258
2264
2266
2270
2271
2273 {
2275
2276
2277 RegisterNetSyncVariableInt( "m_SyncParts01" );
2278 RegisterNetSyncVariableInt( "m_SyncParts02" );
2279 RegisterNetSyncVariableInt( "m_SyncParts03" );
2280 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2281 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2282 RegisterNetSyncVariableBool( "m_HasBase" );
2283
2284
2286
2287 if (ConfigIsExisting("hybridAttachments"))
2288 {
2291 }
2292 if (ConfigIsExisting("mountables"))
2293 {
2296 }
2297
2299 }
2300
2302 {
2303 super.EEDelete(parent);
2304
2306 {
2307 areaDamage.Destroy();
2308 }
2309
2310 }
2311
2313 {
2314 return "disableBaseDamage";
2315 }
2316
2318 {
2319 return true;
2320 }
2321
2323 {
2324 return EInventoryIconVisibility.HIDE_VICINITY;
2325 }
2326
2327
2329 {
2331 {
2332 SetSynchDirty();
2333 }
2334 }
2335
2337 {
2339 super.OnVariablesSynchronized();
2340
2342 }
2343
2345 {
2346
2348
2349
2351
2352
2354 }
2355
2356
2358 {
2359
2360 int offset;
2361 int mask;
2362
2363 if ( part_id >= 1 && part_id <= 31 )
2364 {
2365 offset = part_id - 1;
2366 mask = 1 << offset;
2367
2369 }
2370 else if ( part_id >= 32 && part_id <= 62 )
2371 {
2372 offset = ( part_id % 32 );
2373 mask = 1 << offset;
2374
2376 }
2377 else if ( part_id >= 63 && part_id <= 93 )
2378 {
2379 offset = ( part_id % 63 );
2380 mask = 1 << offset;
2381
2383 }
2384 }
2385
2387 {
2388
2389 int offset;
2390 int mask;
2391
2392 if ( part_id >= 1 && part_id <= 31 )
2393 {
2394 offset = part_id - 1;
2395 mask = 1 << offset;
2396
2398 }
2399 else if ( part_id >= 32 && part_id <= 62 )
2400 {
2401 offset = ( part_id % 32 );
2402 mask = 1 << offset;
2403
2405 }
2406 else if ( part_id >= 63 && part_id <= 93 )
2407 {
2408 offset = ( part_id % 63 );
2409 mask = 1 << offset;
2410
2412 }
2413 }
2414
2416 {
2417
2418 int offset;
2419 int mask;
2420
2421 if ( part_id >= 1 && part_id <= 31 )
2422 {
2423 offset = part_id - 1;
2424 mask = 1 << offset;
2425
2427 {
2428 return true;
2429 }
2430 }
2431 else if ( part_id >= 32 && part_id <= 62 )
2432 {
2433 offset = ( part_id % 32 );
2434 mask = 1 << offset;
2435
2437 {
2438 return true;
2439 }
2440 }
2441 else if ( part_id >= 63 && part_id <= 93 )
2442 {
2443 offset = ( part_id % 63 );
2444 mask = 1 << offset;
2445
2447 {
2448 return true;
2449 }
2450 }
2451
2452 return false;
2453 }
2454
2456 {
2459 }
2460
2462 {
2463
2466 }
2467
2469 {
2471 {
2474
2475 switch( build_action_id )
2476 {
2480 }
2481 }
2482 }
2483
2484
2486 {
2488 bool is_base = part.
IsBase();
2491 if ( is_part_built_sync )
2492 {
2494 {
2498
2499 if (is_base)
2500 {
2503 }
2504 }
2505 }
2506 else
2507 {
2509 {
2513
2514 if (is_base)
2515 {
2518 }
2519 }
2520 }
2521
2522
2524 }
2525
2526
2528 {
2531
2532 for ( int i = 0; i < construction_parts.Count(); ++i )
2533 {
2534 string key = construction_parts.GetKey( i );
2537 }
2538
2539
2541 }
2542
2544 {
2547
2548 for ( int i = 0; i < construction_parts.Count(); ++i )
2549 {
2550 string key = construction_parts.GetKey( i );
2552
2553 if ( value.
GetId() ==
id )
2554 {
2555 return value;
2556 }
2557 }
2558
2559 return NULL;
2560 }
2561
2562
2563
2565 {
2567 }
2568
2570 {
2572 }
2573
2575 {
2576 return true;
2577 }
2578
2580 {
2581 return false;
2582 }
2583
2584
2586 {
2589 {
2591 }
2592
2593 return construction_kit;
2594 }
2595
2597 {
2600 {
2602 }
2603 }
2604
2606 {
2608 }
2609
2611 {
2612 return "";
2613 }
2614
2616 {
2619 }
2620
2621
2623 {
2626 }
2627
2628
2630 {
2631 super.OnStoreSave( ctx );
2632
2633
2637
2639 }
2640
2642 {
2643 if ( !super.OnStoreLoad( ctx, version ) )
2644 return false;
2645
2646
2647
2649 {
2651 return false;
2652 }
2654 {
2656 return false;
2657 }
2659 {
2661 return false;
2662 }
2663
2664
2666 {
2668 return false;
2669 }
2670
2671
2672 return true;
2673 }
2674
2676 {
2677 super.AfterStoreLoad();
2678
2680 {
2682 }
2683 }
2684
2686 {
2687
2689
2690
2693
2694
2696 }
2697
2699 {
2700 super.OnCreatePhysics();
2703 }
2704
2706 {
2708 return;
2709
2710 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2711
2713 return;
2714
2716 string part_name = zone;
2718
2720 {
2721 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2722
2723 if ( construction_part && construction.IsPartConstructed( part_name ) )
2724 {
2726 construction.DestroyConnectedParts(part_name);
2727 }
2728
2729
2730 if ( part_name.
Contains(
"barbed") )
2731 {
2732 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2733 if (barbed_wire)
2734 barbed_wire.SetMountedState( false );
2735 }
2736 }
2737 }
2738
2740 {
2742 {
2744 }
2745
2746 super.EEOnAfterLoad();
2747 }
2748
2750 {
2751 super.EEInit();
2752
2753
2755
2756
2757 #ifdef DEVELOPER
2759 #endif
2760 }
2761
2763 {
2764 super.EEItemAttached( item, slot_name );
2765
2769 }
2770
2772 {
2773 super.EEItemDetached( item, slot_name );
2774
2777 }
2778
2779 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2780 {
2783
2786 }
2787
2788
2790 {
2791 return true;
2792 }
2793
2794
2795
2797 {
2799
2800
2801 if (construtionPart.
IsBase())
2802 {
2804
2805
2807 }
2808
2809
2811
2812
2814
2815
2817
2819
2821
2822
2824
2825
2827 }
2828
2830 {
2831
2833 }
2834
2835
2837 {
2840
2841
2843
2844
2846
2847
2849
2850
2852
2854
2855
2857
2858
2860
2861
2862 if (construtionPart.
IsBase())
2863 {
2864
2866 }
2867
2870 }
2871
2873 {
2874
2876 }
2877
2878
2879 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
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
2922 {
2923 bool process = false;
2924
2925
2929
2930 if (process)
2931 {
2932 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2933 {
2935 return;
2936 }
2937
2939 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2940 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2941
2942
2944 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2945 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2946 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2947 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2948 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2949 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2950 mins = minTmp;
2951 maxs = maxTmp;
2952
2953 maxs[1] = maxs[1] + 0.35;
2954
2956 }
2957 }
2958
2960 {
2963
2964
2966 foreach (
EntityAI entity : foundEntities)
2967 {
2970 }
2971 }
2972
2973
2975 {
2977
2981 }
2982
2984 {
2986
2988 {
2990 }
2991 else
2992 {
2994 }
2995
2997 }
2998
3000 {
3002
3004 foreach (
string slotName : attachmentSlots)
3005 {
3007 }
3008
3009
3012 else
3014
3016 }
3017
3019 {
3020 string slotNameMounted = slot_name + "_Mounted";
3021 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3022
3023 if (attachment)
3024 {
3025 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3026 if (barbedWire && barbedWire.IsMounted())
3028 else
3030
3031 if (is_locked)
3032 {
3033 SetAnimationPhase(slotNameMounted, 0);
3034 SetAnimationPhase(slot_name, 1);
3035 }
3036 else
3037 {
3038 SetAnimationPhase(slotNameMounted, 1);
3039 SetAnimationPhase(slot_name, 0);
3040 }
3041 }
3042 else
3043 {
3044 SetAnimationPhase(slotNameMounted, 1);
3045 SetAnimationPhase(slot_name, 1);
3046
3048 }
3049 }
3050
3051
3053 {
3056
3059
3062
3063 foreach (
string slotName : attachmentSlots)
3064 {
3066 }
3067
3068
3070 {
3073
3075 }
3076 else
3077 {
3080
3082 }
3083
3086 }
3087
3089 {
3090
3092 return;
3093
3094 string slot_name_mounted = slot_name + "_Mounted";
3095 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3096
3097
3099 RemoveProxyPhysics( slot_name_mounted );
3100 RemoveProxyPhysics( slot_name );
3101
3102 if ( attachment )
3103 {
3105 if ( is_locked )
3106 {
3108 AddProxyPhysics( slot_name_mounted );
3109 }
3110 else
3111 {
3113 AddProxyPhysics( slot_name );
3114 }
3115 }
3116 }
3117
3119 {
3120 SetAffectPathgraph( true, false );
3122 }
3123
3125 {
3126 return true;
3127 }
3128
3130 {
3131 return true;
3132 }
3133
3135 {
3136 if ( attachment )
3137 {
3139 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3140
3141 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3142 }
3143
3144 return false;
3145 }
3146
3148 {
3150 }
3151
3152
3154 {
3155 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3156 if (
GetGame().ConfigIsExisting( config_path ) )
3157 {
3159 }
3160 }
3161
3163 {
3164 return true;
3165 }
3166
3168 {
3169 return true;
3170 }
3171
3173 {
3174 return true;
3175 }
3176
3177
3179 {
3181 {
3183 }
3184
3186 }
3187
3189 {
3191 }
3192
3193
3194
3196 {
3197 return super.CanReceiveAttachment(attachment, slotId);
3198 }
3199
3201 {
3202 int attachment_count = GetInventory().AttachmentCount();
3203 if ( attachment_count > 0 )
3204 {
3205 if (
HasBase() && attachment_count == 1 )
3206 {
3207 return false;
3208 }
3209
3210 return true;
3211 }
3212
3213 return false;
3214 }
3215
3217 {
3218 return true;
3219 }
3220
3222 {
3223 return false;
3224 }
3225
3226
3228 {
3229 return false;
3230 }
3231
3233 {
3234 return false;
3235 }
3236
3237
3239 {
3240 return false;
3241 }
3242
3243
3244
3246 {
3247 return true;
3248 }
3249
3251 {
3252 return true;
3253 }
3254
3257 {
3258 return false;
3259 }
3260
3261
3263 {
3264 return true;
3265 }
3266
3267
3269 {
3270 return false;
3271 }
3272
3273
3275 {
3276 return true;
3277 }
3278
3279
3281 {
3282 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3283 {
3284 return false;
3285 }
3286
3287 return true;
3288 }
3289
3291 {
3294
3295 return item;
3296 }
3297
3298
3300 {
3302 {
3303
3305
3306
3309
3311 if ( MemoryPointExists( slot_name + "_min" ) )
3312 {
3313 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3314 }
3315 if ( MemoryPointExists( slot_name + "_max" ) )
3316 {
3317 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3318 }
3319
3320
3323
3324
3327 center = ModelToWorld( center );
3328
3329
3332
3333 areaDamage.SetExtents( extents[0], extents[1] );
3334 areaDamage.SetAreaPosition( center );
3335 areaDamage.SetAreaOrientation( orientation );
3338 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3339 areaDamage.SetAmmoName( "BarbedWireHit" );
3340 areaDamage.Spawn();
3341
3343 }
3344 }
3345
3347 {
3348 if ( angle_deg != 0 )
3349 {
3350
3351 orientation[0] = orientation[0] - angle_deg;
3352
3353
3355 if ( MemoryPointExists( "rotate_axis" ) )
3356 {
3357 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3358 }
3359 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];
3360 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];
3361 center[0] = r_center_x;
3362 center[2] = r_center_z;
3363 }
3364 }
3365
3367 {
3369 {
3372 {
3373 if (areaDamage)
3374 {
3375 areaDamage.Destroy();
3376 }
3377
3379 }
3380 }
3381 }
3382
3384 {
3385 return true;
3386 }
3387
3388
3389
3390
3392 {
3394 }
3395
3397 {
3399 }
3400
3402 {
3404 }
3405
3407 {
3409
3410 switch ( material_type )
3411 {
3417 }
3418
3419 return "";
3420 }
3421
3423 {
3425
3426 switch ( material_type )
3427 {
3433 }
3434
3435 return "";
3436 }
3437
3438
3440 {
3442 {
3443
3445 {
3446 SetHealth(slot_name,"Health",item.GetHealth());
3447 }
3448 }
3449 }
3450
3452 {
3453 return 111;
3454 }
3455
3457 {
3458 super.SetActions();
3459
3463 }
3464
3465
3466
3467
3469 {
3470 }
3471
3474 {
3475 return null;
3476 }
3477
3479 {
3481 }
3482
3484 {
3487
3488 Man p;
3489
3490 #ifdef SERVER
3493 if (players.Count())
3494 p = players[0];
3495 #else
3497 #endif
3498
3500 {
3501 bool excluded = false;
3503 if (excludes)
3504 {
3505 foreach (string exclude : excludes)
3506 {
3508 {
3509 excluded = true;
3510 break;
3511 }
3512 }
3513 }
3514
3515 if (!excluded)
3516 {
3518 }
3519 }
3520
3522 }
3523}
3524
3526{
3527#ifdef BSB_DEBUG
3529#else
3530
3531#endif
3532}
3534{
3535#ifdef BSB_DEBUG_SPAM
3537#else
3538
3539#endif
3540}
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.