2230{
2232
2234
2236
2238
2244
2245
2246
2252
2258
2260
2264
2265
2267 {
2269
2270
2271 RegisterNetSyncVariableInt( "m_SyncParts01" );
2272 RegisterNetSyncVariableInt( "m_SyncParts02" );
2273 RegisterNetSyncVariableInt( "m_SyncParts03" );
2274 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2275 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2276 RegisterNetSyncVariableBool( "m_HasBase" );
2277
2278
2280
2281 if (ConfigIsExisting("hybridAttachments"))
2282 {
2285 }
2286 if (ConfigIsExisting("mountables"))
2287 {
2290 }
2291
2293 }
2294
2296 {
2297 super.EEDelete(parent);
2298
2300 {
2301 areaDamage.Destroy();
2302 }
2303
2304 }
2305
2307 {
2308 return "disableBaseDamage";
2309 }
2310
2312 {
2313 return true;
2314 }
2315
2317 {
2318 return EInventoryIconVisibility.HIDE_VICINITY;
2319 }
2320
2321
2323 {
2325 {
2326 SetSynchDirty();
2327 }
2328 }
2329
2331 {
2333 super.OnVariablesSynchronized();
2334
2336 }
2337
2339 {
2340
2342
2343
2345
2346
2348 }
2349
2350
2352 {
2353
2354 int offset;
2355 int mask;
2356
2357 if ( part_id >= 1 && part_id <= 31 )
2358 {
2359 offset = part_id - 1;
2360 mask = 1 << offset;
2361
2363 }
2364 else if ( part_id >= 32 && part_id <= 62 )
2365 {
2366 offset = ( part_id % 32 );
2367 mask = 1 << offset;
2368
2370 }
2371 else if ( part_id >= 63 && part_id <= 93 )
2372 {
2373 offset = ( part_id % 63 );
2374 mask = 1 << offset;
2375
2377 }
2378 }
2379
2381 {
2382
2383 int offset;
2384 int mask;
2385
2386 if ( part_id >= 1 && part_id <= 31 )
2387 {
2388 offset = part_id - 1;
2389 mask = 1 << offset;
2390
2392 }
2393 else if ( part_id >= 32 && part_id <= 62 )
2394 {
2395 offset = ( part_id % 32 );
2396 mask = 1 << offset;
2397
2399 }
2400 else if ( part_id >= 63 && part_id <= 93 )
2401 {
2402 offset = ( part_id % 63 );
2403 mask = 1 << offset;
2404
2406 }
2407 }
2408
2410 {
2411
2412 int offset;
2413 int mask;
2414
2415 if ( part_id >= 1 && part_id <= 31 )
2416 {
2417 offset = part_id - 1;
2418 mask = 1 << offset;
2419
2421 {
2422 return true;
2423 }
2424 }
2425 else if ( part_id >= 32 && part_id <= 62 )
2426 {
2427 offset = ( part_id % 32 );
2428 mask = 1 << offset;
2429
2431 {
2432 return true;
2433 }
2434 }
2435 else if ( part_id >= 63 && part_id <= 93 )
2436 {
2437 offset = ( part_id % 63 );
2438 mask = 1 << offset;
2439
2441 {
2442 return true;
2443 }
2444 }
2445
2446 return false;
2447 }
2448
2450 {
2453 }
2454
2456 {
2457
2460 }
2461
2463 {
2465 {
2468
2469 switch( build_action_id )
2470 {
2474 }
2475 }
2476 }
2477
2478
2480 {
2482 bool is_base = part.
IsBase();
2485 if ( is_part_built_sync )
2486 {
2488 {
2492
2493 if (is_base)
2494 {
2497 }
2498 }
2499 }
2500 else
2501 {
2503 {
2507
2508 if (is_base)
2509 {
2512 }
2513 }
2514 }
2515
2516
2518 }
2519
2520
2522 {
2525
2526 for ( int i = 0; i < construction_parts.Count(); ++i )
2527 {
2528 string key = construction_parts.GetKey( i );
2531 }
2532
2533
2535 }
2536
2538 {
2541
2542 for ( int i = 0; i < construction_parts.Count(); ++i )
2543 {
2544 string key = construction_parts.GetKey( i );
2546
2547 if ( value.
GetId() ==
id )
2548 {
2549 return value;
2550 }
2551 }
2552
2553 return NULL;
2554 }
2555
2556
2557
2559 {
2561 }
2562
2564 {
2566 }
2567
2569 {
2570 return true;
2571 }
2572
2574 {
2575 return false;
2576 }
2577
2578
2580 {
2583 {
2585 }
2586
2587 return construction_kit;
2588 }
2589
2591 {
2594 {
2596 }
2597 }
2598
2600 {
2602 }
2603
2605 {
2606 return "";
2607 }
2608
2610 {
2613 }
2614
2615
2617 {
2620 }
2621
2622
2624 {
2625 super.OnStoreSave( ctx );
2626
2627
2631
2633 }
2634
2636 {
2637 if ( !super.OnStoreLoad( ctx, version ) )
2638 return false;
2639
2640
2641
2643 {
2645 return false;
2646 }
2648 {
2650 return false;
2651 }
2653 {
2655 return false;
2656 }
2657
2658
2660 {
2662 return false;
2663 }
2664
2665
2666 return true;
2667 }
2668
2670 {
2671 super.AfterStoreLoad();
2672
2674 {
2676 }
2677 }
2678
2680 {
2681
2683
2684
2687
2688
2690 }
2691
2693 {
2694 super.OnCreatePhysics();
2697 }
2698
2700 {
2702 return;
2703
2704 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2705
2707 return;
2708
2710 string part_name = zone;
2712
2714 {
2715 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2716
2717 if ( construction_part && construction.IsPartConstructed( part_name ) )
2718 {
2720 construction.DestroyConnectedParts(part_name);
2721 }
2722
2723
2724 if ( part_name.
Contains(
"barbed") )
2725 {
2726 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2727 if (barbed_wire)
2728 barbed_wire.SetMountedState( false );
2729 }
2730 }
2731 }
2732
2734 {
2736 {
2738 }
2739
2740 super.EEOnAfterLoad();
2741 }
2742
2744 {
2745 super.EEInit();
2746
2747
2749
2750
2751 #ifdef DEVELOPER
2753 #endif
2754 }
2755
2757 {
2758 super.EEItemAttached( item, slot_name );
2759
2763 }
2764
2766 {
2767 super.EEItemDetached( item, slot_name );
2768
2771 }
2772
2773 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2774 {
2777
2780 }
2781
2782
2784 {
2785 return true;
2786 }
2787
2788
2789
2791 {
2793
2794
2795 if (construtionPart.
IsBase())
2796 {
2798
2799
2801 }
2802
2803
2805
2806
2808
2809
2811
2813
2815
2816
2818
2819
2821 }
2822
2824 {
2825
2827 }
2828
2829
2831 {
2834
2835
2837
2838
2840
2841
2843
2844
2846
2848
2849
2851
2852
2854
2855
2856 if (construtionPart.
IsBase())
2857 {
2858
2860 }
2861
2864 }
2865
2867 {
2868
2870 }
2871
2872
2873 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2874 {
2877
2878
2880
2881
2883
2884
2886
2887
2889
2891
2892
2894
2895
2897
2898
2899 if (construtionPart.
IsBase())
2900 {
2901
2903 }
2904
2907 }
2908
2910 {
2911
2913 }
2914
2916 {
2917 bool process = false;
2918
2919
2923
2924 if (process)
2925 {
2926 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2927 {
2929 return;
2930 }
2931
2933 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2934 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2935
2936
2938 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2939 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2940 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2941 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2942 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2943 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2944 mins = minTmp;
2945 maxs = maxTmp;
2946
2947 maxs[1] = maxs[1] + 0.35;
2948
2950 }
2951 }
2952
2954 {
2957
2958
2960 foreach (
EntityAI entity : foundEntities)
2961 {
2964 }
2965 }
2966
2967
2969 {
2971
2975 }
2976
2978 {
2980
2982 {
2984 }
2985 else
2986 {
2988 }
2989
2991 }
2992
2994 {
2996
2998 foreach (
string slotName : attachmentSlots)
2999 {
3001 }
3002
3003
3006 else
3008
3010 }
3011
3013 {
3014 string slotNameMounted = slot_name + "_Mounted";
3015 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3016
3017 if (attachment)
3018 {
3019 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3020 if (barbedWire && barbedWire.IsMounted())
3022 else
3024
3025 if (is_locked)
3026 {
3027 SetAnimationPhase(slotNameMounted, 0);
3028 SetAnimationPhase(slot_name, 1);
3029 }
3030 else
3031 {
3032 SetAnimationPhase(slotNameMounted, 1);
3033 SetAnimationPhase(slot_name, 0);
3034 }
3035 }
3036 else
3037 {
3038 SetAnimationPhase(slotNameMounted, 1);
3039 SetAnimationPhase(slot_name, 1);
3040
3042 }
3043 }
3044
3045
3047 {
3050
3053
3056
3057 foreach (
string slotName : attachmentSlots)
3058 {
3060 }
3061
3062
3064 {
3067
3069 }
3070 else
3071 {
3074
3076 }
3077
3080 }
3081
3083 {
3084
3086 return;
3087
3088 string slot_name_mounted = slot_name + "_Mounted";
3089 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3090
3091
3093 RemoveProxyPhysics( slot_name_mounted );
3094 RemoveProxyPhysics( slot_name );
3095
3096 if ( attachment )
3097 {
3099 if ( is_locked )
3100 {
3102 AddProxyPhysics( slot_name_mounted );
3103 }
3104 else
3105 {
3107 AddProxyPhysics( slot_name );
3108 }
3109 }
3110 }
3111
3113 {
3114 SetAffectPathgraph( true, false );
3116 }
3117
3119 {
3120 return true;
3121 }
3122
3124 {
3125 return true;
3126 }
3127
3129 {
3130 if ( attachment )
3131 {
3133 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3134
3135 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3136 }
3137
3138 return false;
3139 }
3140
3142 {
3144 }
3145
3146
3148 {
3149 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3150 if (
GetGame().ConfigIsExisting( config_path ) )
3151 {
3153 }
3154 }
3155
3157 {
3158 return true;
3159 }
3160
3162 {
3163 return true;
3164 }
3165
3167 {
3168 return true;
3169 }
3170
3171
3173 {
3175 {
3177 }
3178
3180 }
3181
3183 {
3185 }
3186
3187
3188
3190 {
3191 return super.CanReceiveAttachment(attachment, slotId);
3192 }
3193
3195 {
3196 int attachment_count = GetInventory().AttachmentCount();
3197 if ( attachment_count > 0 )
3198 {
3199 if (
HasBase() && attachment_count == 1 )
3200 {
3201 return false;
3202 }
3203
3204 return true;
3205 }
3206
3207 return false;
3208 }
3209
3211 {
3212 return true;
3213 }
3214
3216 {
3217 return false;
3218 }
3219
3220
3222 {
3223 return false;
3224 }
3225
3227 {
3228 return false;
3229 }
3230
3231
3233 {
3234 return false;
3235 }
3236
3237
3238
3240 {
3241 return true;
3242 }
3243
3245 {
3246 return true;
3247 }
3248
3251 {
3252 return false;
3253 }
3254
3255
3257 {
3258 return true;
3259 }
3260
3261
3263 {
3264 return false;
3265 }
3266
3267
3269 {
3270 return true;
3271 }
3272
3273
3275 {
3276 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3277 {
3278 return false;
3279 }
3280
3281 return true;
3282 }
3283
3285 {
3288
3289 return item;
3290 }
3291
3292
3294 {
3296 {
3297
3299
3300
3303
3305 if ( MemoryPointExists( slot_name + "_min" ) )
3306 {
3307 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3308 }
3309 if ( MemoryPointExists( slot_name + "_max" ) )
3310 {
3311 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3312 }
3313
3314
3317
3318
3321 center = ModelToWorld( center );
3322
3323
3326
3327 areaDamage.SetExtents( extents[0], extents[1] );
3328 areaDamage.SetAreaPosition( center );
3329 areaDamage.SetAreaOrientation( orientation );
3332 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3333 areaDamage.SetAmmoName( "BarbedWireHit" );
3334 areaDamage.Spawn();
3335
3337 }
3338 }
3339
3341 {
3342 if ( angle_deg != 0 )
3343 {
3344
3345 orientation[0] = orientation[0] - angle_deg;
3346
3347
3349 if ( MemoryPointExists( "rotate_axis" ) )
3350 {
3351 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3352 }
3353 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];
3354 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];
3355 center[0] = r_center_x;
3356 center[2] = r_center_z;
3357 }
3358 }
3359
3361 {
3363 {
3366 {
3367 if (areaDamage)
3368 {
3369 areaDamage.Destroy();
3370 }
3371
3373 }
3374 }
3375 }
3376
3378 {
3379 return true;
3380 }
3381
3382
3383
3384
3386 {
3388 }
3389
3391 {
3393 }
3394
3396 {
3398 }
3399
3401 {
3403
3404 switch ( material_type )
3405 {
3411 }
3412
3413 return "";
3414 }
3415
3417 {
3419
3420 switch ( material_type )
3421 {
3427 }
3428
3429 return "";
3430 }
3431
3432
3434 {
3436 {
3437
3439 {
3440 SetHealth(slot_name,"Health",item.GetHealth());
3441 }
3442 }
3443 }
3444
3446 {
3447 return 111;
3448 }
3449
3451 {
3452 super.SetActions();
3453
3457 }
3458
3459
3460
3461
3463 {
3464 }
3465
3468 {
3469 return null;
3470 }
3471
3473 {
3475 }
3476
3478 {
3481
3482 Man p;
3483
3484 #ifdef SERVER
3487 if (players.Count())
3488 p = players[0];
3489 #else
3491 #endif
3492
3494 {
3495 bool excluded = false;
3497 if (excludes)
3498 {
3499 foreach (string exclude : excludes)
3500 {
3502 {
3503 excluded = true;
3504 break;
3505 }
3506 }
3507 }
3508
3509 if (!excluded)
3510 {
3512 }
3513 }
3514
3516 }
3517}
3518
3520{
3521#ifdef BSB_DEBUG
3523#else
3524
3525#endif
3526}
3528{
3529#ifdef BSB_DEBUG_SPAM
3531#else
3532
3533#endif
3534}
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.