2253{
2255
2257
2259
2261
2267
2268
2269
2275
2281
2283
2287
2288
2290 {
2292
2293
2294 RegisterNetSyncVariableInt( "m_SyncParts01" );
2295 RegisterNetSyncVariableInt( "m_SyncParts02" );
2296 RegisterNetSyncVariableInt( "m_SyncParts03" );
2297 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2298 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2299 RegisterNetSyncVariableBool( "m_HasBase" );
2300
2301
2303
2304 if (ConfigIsExisting("hybridAttachments"))
2305 {
2308 }
2309 if (ConfigIsExisting("mountables"))
2310 {
2313 }
2314
2316 }
2317
2319 {
2320 super.EEDelete(parent);
2321
2323 {
2324 areaDamage.Destroy();
2325 }
2326
2327 }
2328
2330 {
2331 return "disableBaseDamage";
2332 }
2333
2335 {
2336 return true;
2337 }
2338
2340 {
2341 return EInventoryIconVisibility.HIDE_VICINITY;
2342 }
2343
2344
2346 {
2348 {
2349 SetSynchDirty();
2350 }
2351 }
2352
2354 {
2356 super.OnVariablesSynchronized();
2357
2359 }
2360
2362 {
2363
2365
2366
2368
2369
2371 }
2372
2373
2375 {
2376
2377 int offset;
2378 int mask;
2379
2380 if ( part_id >= 1 && part_id <= 31 )
2381 {
2382 offset = part_id - 1;
2383 mask = 1 << offset;
2384
2386 }
2387 else if ( part_id >= 32 && part_id <= 62 )
2388 {
2389 offset = ( part_id % 32 );
2390 mask = 1 << offset;
2391
2393 }
2394 else if ( part_id >= 63 && part_id <= 93 )
2395 {
2396 offset = ( part_id % 63 );
2397 mask = 1 << offset;
2398
2400 }
2401 }
2402
2404 {
2405
2406 int offset;
2407 int mask;
2408
2409 if ( part_id >= 1 && part_id <= 31 )
2410 {
2411 offset = part_id - 1;
2412 mask = 1 << offset;
2413
2415 }
2416 else if ( part_id >= 32 && part_id <= 62 )
2417 {
2418 offset = ( part_id % 32 );
2419 mask = 1 << offset;
2420
2422 }
2423 else if ( part_id >= 63 && part_id <= 93 )
2424 {
2425 offset = ( part_id % 63 );
2426 mask = 1 << offset;
2427
2429 }
2430 }
2431
2433 {
2434
2435 int offset;
2436 int mask;
2437
2438 if ( part_id >= 1 && part_id <= 31 )
2439 {
2440 offset = part_id - 1;
2441 mask = 1 << offset;
2442
2444 {
2445 return true;
2446 }
2447 }
2448 else if ( part_id >= 32 && part_id <= 62 )
2449 {
2450 offset = ( part_id % 32 );
2451 mask = 1 << offset;
2452
2454 {
2455 return true;
2456 }
2457 }
2458 else if ( part_id >= 63 && part_id <= 93 )
2459 {
2460 offset = ( part_id % 63 );
2461 mask = 1 << offset;
2462
2464 {
2465 return true;
2466 }
2467 }
2468
2469 return false;
2470 }
2471
2473 {
2476 }
2477
2479 {
2480
2483 }
2484
2486 {
2488 {
2491
2492 switch( build_action_id )
2493 {
2497 }
2498 }
2499 }
2500
2501
2503 {
2505 bool is_base = part.
IsBase();
2508 if ( is_part_built_sync )
2509 {
2511 {
2515
2516 if (is_base)
2517 {
2520 }
2521 }
2522 }
2523 else
2524 {
2526 {
2530
2531 if (is_base)
2532 {
2535 }
2536 }
2537 }
2538
2539
2541 }
2542
2543
2545 {
2548
2549 for ( int i = 0; i < construction_parts.Count(); ++i )
2550 {
2551 string key = construction_parts.GetKey( i );
2554 }
2555
2556
2558 }
2559
2561 {
2564
2565 for ( int i = 0; i < construction_parts.Count(); ++i )
2566 {
2567 string key = construction_parts.GetKey( i );
2569
2570 if ( value.
GetId() ==
id )
2571 {
2572 return value;
2573 }
2574 }
2575
2576 return NULL;
2577 }
2578
2579
2580
2582 {
2584 }
2585
2587 {
2589 }
2590
2592 {
2593 return true;
2594 }
2595
2597 {
2598 return false;
2599 }
2600
2601
2603 {
2606 {
2608 }
2609
2610 return construction_kit;
2611 }
2612
2614 {
2617 {
2619 }
2620 }
2621
2623 {
2625 }
2626
2628 {
2629 return "";
2630 }
2631
2633 {
2636 }
2637
2638
2640 {
2643 }
2644
2645
2647 {
2648 super.OnStoreSave( ctx );
2649
2650
2654
2656 }
2657
2659 {
2660 if ( !super.OnStoreLoad( ctx, version ) )
2661 return false;
2662
2663
2664
2666 {
2668 return false;
2669 }
2671 {
2673 return false;
2674 }
2676 {
2678 return false;
2679 }
2680
2681
2683 {
2685 return false;
2686 }
2687
2688
2689 return true;
2690 }
2691
2693 {
2694 super.AfterStoreLoad();
2695
2697 {
2699 }
2700 }
2701
2703 {
2704
2706
2707
2710
2711
2713 }
2714
2716 {
2717 super.OnCreatePhysics();
2720 }
2721
2723 {
2725 return;
2726
2727 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2728
2730 return;
2731
2733 string part_name = zone;
2735
2737 {
2738 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2739
2740 if ( construction_part && construction.IsPartConstructed( part_name ) )
2741 {
2743 construction.DestroyConnectedParts(part_name);
2744 }
2745
2746
2747 if ( part_name.
Contains(
"barbed") )
2748 {
2749 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2750 if (barbed_wire)
2751 barbed_wire.SetMountedState( false );
2752 }
2753 }
2754 }
2755
2757 {
2759 {
2761 }
2762
2763 super.EEOnAfterLoad();
2764 }
2765
2767 {
2768 super.EEInit();
2769
2770
2772
2773
2774 #ifdef DEVELOPER
2776 #endif
2777 }
2778
2780 {
2781 super.EEItemAttached( item, slot_name );
2782
2786 }
2787
2789 {
2790 super.EEItemDetached( item, slot_name );
2791
2794 }
2795
2796 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2797 {
2800
2803 }
2804
2805
2807 {
2808 return true;
2809 }
2810
2811
2812
2814 {
2816
2817
2818 if (construtionPart.
IsBase())
2819 {
2821
2822
2824 }
2825
2826
2828
2829
2831
2832
2834
2836
2838
2839
2841
2842
2844 }
2845
2847 {
2848
2850 }
2851
2852
2854 {
2857
2858
2860
2861
2863
2864
2866
2867
2869
2871
2872
2874
2875
2877
2878
2879 if (construtionPart.
IsBase())
2880 {
2881
2883 }
2884
2887 }
2888
2890 {
2891
2893 }
2894
2895
2896 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2897 {
2900
2901
2903
2904
2906
2907
2909
2910
2912
2914
2915
2917
2918
2920
2921
2922 if (construtionPart.
IsBase())
2923 {
2924
2926 }
2927
2930 }
2931
2933 {
2934
2936 }
2937
2939 {
2940 bool process = false;
2941
2942
2946
2947 if (process)
2948 {
2949 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2950 {
2952 return;
2953 }
2954
2956 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2957 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2958
2959
2961 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2962 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2963 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2964 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2965 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2966 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2967 mins = minTmp;
2968 maxs = maxTmp;
2969
2970 maxs[1] = maxs[1] + 0.35;
2971
2973 }
2974 }
2975
2977 {
2980
2981
2983 foreach (
EntityAI entity : foundEntities)
2984 {
2987 }
2988 }
2989
2990
2992 {
2994
2998 }
2999
3001 {
3003
3005 {
3007 }
3008 else
3009 {
3011 }
3012
3014 }
3015
3017 {
3019
3021 foreach (
string slotName : attachmentSlots)
3022 {
3024 }
3025
3026
3029 else
3031
3033 }
3034
3036 {
3037 string slotNameMounted = slot_name + "_Mounted";
3038 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3039
3040 if (attachment)
3041 {
3042 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3043 if (barbedWire && barbedWire.IsMounted())
3045 else
3047
3048 if (is_locked)
3049 {
3050 SetAnimationPhase(slotNameMounted, 0);
3051 SetAnimationPhase(slot_name, 1);
3052 }
3053 else
3054 {
3055 SetAnimationPhase(slotNameMounted, 1);
3056 SetAnimationPhase(slot_name, 0);
3057 }
3058 }
3059 else
3060 {
3061 SetAnimationPhase(slotNameMounted, 1);
3062 SetAnimationPhase(slot_name, 1);
3063
3065 }
3066 }
3067
3068
3070 {
3073
3076
3079
3080 foreach (
string slotName : attachmentSlots)
3081 {
3083 }
3084
3085
3087 {
3090
3092 }
3093 else
3094 {
3097
3099 }
3100
3103 }
3104
3106 {
3107
3109 return;
3110
3111 string slot_name_mounted = slot_name + "_Mounted";
3112 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3113
3114
3116 RemoveProxyPhysics( slot_name_mounted );
3117 RemoveProxyPhysics( slot_name );
3118
3119 if ( attachment )
3120 {
3122 if ( is_locked )
3123 {
3125 AddProxyPhysics( slot_name_mounted );
3126 }
3127 else
3128 {
3130 AddProxyPhysics( slot_name );
3131 }
3132 }
3133 }
3134
3136 {
3137 SetAffectPathgraph( true, false );
3139 }
3140
3142 {
3143 return true;
3144 }
3145
3147 {
3148 return true;
3149 }
3150
3152 {
3153 if ( attachment )
3154 {
3156 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3157
3158 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3159 }
3160
3161 return false;
3162 }
3163
3165 {
3167 }
3168
3169
3171 {
3172 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3173 if (
GetGame().ConfigIsExisting( config_path ) )
3174 {
3176 }
3177 }
3178
3180 {
3181 return true;
3182 }
3183
3185 {
3186 return true;
3187 }
3188
3190 {
3191 return true;
3192 }
3193
3194
3196 {
3198 {
3200 }
3201
3203 }
3204
3206 {
3208 }
3209
3210
3211
3213 {
3214 return super.CanReceiveAttachment(attachment, slotId);
3215 }
3216
3218 {
3219 int attachment_count = GetInventory().AttachmentCount();
3220 if ( attachment_count > 0 )
3221 {
3222 if (
HasBase() && attachment_count == 1 )
3223 {
3224 return false;
3225 }
3226
3227 return true;
3228 }
3229
3230 return false;
3231 }
3232
3234 {
3235 return true;
3236 }
3237
3239 {
3240 return false;
3241 }
3242
3243
3245 {
3246 return false;
3247 }
3248
3250 {
3251 return false;
3252 }
3253
3254
3256 {
3257 return false;
3258 }
3259
3260
3261
3263 {
3264 return true;
3265 }
3266
3268 {
3269 return true;
3270 }
3271
3274 {
3275 return false;
3276 }
3277
3278
3280 {
3281 return true;
3282 }
3283
3284
3286 {
3287 return false;
3288 }
3289
3290
3292 {
3293 return true;
3294 }
3295
3296
3298 {
3299 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3300 {
3301 return false;
3302 }
3303
3304 return true;
3305 }
3306
3308 {
3311
3312 return item;
3313 }
3314
3315
3317 {
3319 {
3320
3322
3323
3326
3328 if ( MemoryPointExists( slot_name + "_min" ) )
3329 {
3330 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3331 }
3332 if ( MemoryPointExists( slot_name + "_max" ) )
3333 {
3334 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3335 }
3336
3337
3340
3341
3344 center = ModelToWorld( center );
3345
3346
3349
3350 areaDamage.SetExtents( extents[0], extents[1] );
3351 areaDamage.SetAreaPosition( center );
3352 areaDamage.SetAreaOrientation( orientation );
3355 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3356 areaDamage.SetAmmoName( "BarbedWireHit" );
3357 areaDamage.Spawn();
3358
3360 }
3361 }
3362
3364 {
3365 if ( angle_deg != 0 )
3366 {
3367
3368 orientation[0] = orientation[0] - angle_deg;
3369
3370
3372 if ( MemoryPointExists( "rotate_axis" ) )
3373 {
3374 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3375 }
3376 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];
3377 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];
3378 center[0] = r_center_x;
3379 center[2] = r_center_z;
3380 }
3381 }
3382
3384 {
3386 {
3389 {
3390 if (areaDamage)
3391 {
3392 areaDamage.Destroy();
3393 }
3394
3396 }
3397 }
3398 }
3399
3401 {
3402 return true;
3403 }
3404
3405
3406
3407
3409 {
3411 }
3412
3414 {
3416 }
3417
3419 {
3421 }
3422
3424 {
3426
3427 switch ( material_type )
3428 {
3434 }
3435
3436 return "";
3437 }
3438
3440 {
3442
3443 switch ( material_type )
3444 {
3450 }
3451
3452 return "";
3453 }
3454
3455
3457 {
3459 {
3460
3462 {
3463 SetHealth(slot_name,"Health",item.GetHealth());
3464 }
3465 }
3466 }
3467
3469 {
3470 return 111;
3471 }
3472
3474 {
3475 super.SetActions();
3476
3480 }
3481
3482
3483
3484
3486 {
3487 }
3488
3491 {
3492 return null;
3493 }
3494
3496 {
3498 }
3499
3501 {
3504
3505 Man p;
3506
3507 #ifdef SERVER
3510 if (players.Count())
3511 p = players[0];
3512 #else
3514 #endif
3515
3517 {
3518 bool excluded = false;
3520 if (excludes)
3521 {
3522 foreach (string exclude : excludes)
3523 {
3525 {
3526 excluded = true;
3527 break;
3528 }
3529 }
3530 }
3531
3532 if (!excluded)
3533 {
3535 }
3536 }
3537
3539 }
3540}
3541
3543{
3544#ifdef BSB_DEBUG
3546#else
3547
3548#endif
3549}
3551{
3552#ifdef BSB_DEBUG_SPAM
3554#else
3555
3556#endif
3557}
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.