2303{
2305
2307
2309
2311
2317
2318
2319
2325
2331
2333
2337
2338
2340 {
2342
2343
2344 RegisterNetSyncVariableInt( "m_SyncParts01" );
2345 RegisterNetSyncVariableInt( "m_SyncParts02" );
2346 RegisterNetSyncVariableInt( "m_SyncParts03" );
2347 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2348 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2349 RegisterNetSyncVariableBool( "m_HasBase" );
2350
2351
2353
2354 if (ConfigIsExisting("hybridAttachments"))
2355 {
2358 }
2359 if (ConfigIsExisting("mountables"))
2360 {
2363 }
2364
2366 }
2367
2369 {
2370 super.EEDelete(parent);
2371
2373 {
2374 areaDamage.Destroy();
2375 }
2376
2377 }
2378
2380 {
2381 return "disableBaseDamage";
2382 }
2383
2385 {
2386 return true;
2387 }
2388
2390 {
2391 return EInventoryIconVisibility.HIDE_VICINITY;
2392 }
2393
2394
2396 {
2398 {
2399 SetSynchDirty();
2400 }
2401 }
2402
2404 {
2406 super.OnVariablesSynchronized();
2407
2409 }
2410
2412 {
2413
2415
2416
2418
2419
2421 }
2422
2423
2425 {
2426
2427 int offset;
2428 int mask;
2429
2430 if ( part_id >= 1 && part_id <= 31 )
2431 {
2432 offset = part_id - 1;
2433 mask = 1 << offset;
2434
2436 }
2437 else if ( part_id >= 32 && part_id <= 62 )
2438 {
2439 offset = ( part_id % 32 );
2440 mask = 1 << offset;
2441
2443 }
2444 else if ( part_id >= 63 && part_id <= 93 )
2445 {
2446 offset = ( part_id % 63 );
2447 mask = 1 << offset;
2448
2450 }
2451 }
2452
2454 {
2455
2456 int offset;
2457 int mask;
2458
2459 if ( part_id >= 1 && part_id <= 31 )
2460 {
2461 offset = part_id - 1;
2462 mask = 1 << offset;
2463
2465 }
2466 else if ( part_id >= 32 && part_id <= 62 )
2467 {
2468 offset = ( part_id % 32 );
2469 mask = 1 << offset;
2470
2472 }
2473 else if ( part_id >= 63 && part_id <= 93 )
2474 {
2475 offset = ( part_id % 63 );
2476 mask = 1 << offset;
2477
2479 }
2480 }
2481
2483 {
2484
2485 int offset;
2486 int mask;
2487
2488 if ( part_id >= 1 && part_id <= 31 )
2489 {
2490 offset = part_id - 1;
2491 mask = 1 << offset;
2492
2494 {
2495 return true;
2496 }
2497 }
2498 else if ( part_id >= 32 && part_id <= 62 )
2499 {
2500 offset = ( part_id % 32 );
2501 mask = 1 << offset;
2502
2504 {
2505 return true;
2506 }
2507 }
2508 else if ( part_id >= 63 && part_id <= 93 )
2509 {
2510 offset = ( part_id % 63 );
2511 mask = 1 << offset;
2512
2514 {
2515 return true;
2516 }
2517 }
2518
2519 return false;
2520 }
2521
2523 {
2526 }
2527
2529 {
2530
2533 }
2534
2536 {
2538 {
2541
2542 switch( build_action_id )
2543 {
2547 }
2548 }
2549 }
2550
2551
2553 {
2555 bool is_base = part.
IsBase();
2558 if ( is_part_built_sync )
2559 {
2561 {
2565
2566 if (is_base)
2567 {
2570 }
2571 }
2572 }
2573 else
2574 {
2576 {
2580
2581 if (is_base)
2582 {
2585 }
2586 }
2587 }
2588
2589
2591 }
2592
2593
2595 {
2598
2599 for ( int i = 0; i < construction_parts.Count(); ++i )
2600 {
2601 string key = construction_parts.GetKey( i );
2604 }
2605
2606
2608 }
2609
2611 {
2614
2615 for ( int i = 0; i < construction_parts.Count(); ++i )
2616 {
2617 string key = construction_parts.GetKey( i );
2619
2620 if ( value.
GetId() ==
id )
2621 {
2622 return value;
2623 }
2624 }
2625
2626 return NULL;
2627 }
2628
2629
2630
2632 {
2634 }
2635
2637 {
2639 }
2640
2642 {
2643 return true;
2644 }
2645
2647 {
2648 return false;
2649 }
2650
2651
2653 {
2656 {
2658 }
2659
2660 return construction_kit;
2661 }
2662
2664 {
2667 {
2669 }
2670 }
2671
2673 {
2675 }
2676
2678 {
2679 return "";
2680 }
2681
2683 {
2686 }
2687
2688
2690 {
2693 }
2694
2695
2697 {
2698 super.OnStoreSave( ctx );
2699
2700
2704
2706 }
2707
2709 {
2710 if ( !super.OnStoreLoad( ctx, version ) )
2711 return false;
2712
2713
2714
2716 {
2718 return false;
2719 }
2721 {
2723 return false;
2724 }
2726 {
2728 return false;
2729 }
2730
2731
2733 {
2735 return false;
2736 }
2737
2738
2739 return true;
2740 }
2741
2743 {
2744 super.AfterStoreLoad();
2745
2747 {
2749 }
2750 }
2751
2753 {
2754
2756
2757
2760
2761
2763 }
2764
2766 {
2767 super.OnCreatePhysics();
2770 }
2771
2773 {
2775 return;
2776
2777 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2778
2780 return;
2781
2783 string part_name = zone;
2785
2787 {
2788 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2789
2790 if ( construction_part && construction.IsPartConstructed( part_name ) )
2791 {
2793 construction.DestroyConnectedParts(part_name);
2794 }
2795
2796
2797 if ( part_name.
Contains(
"barbed") )
2798 {
2799 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2800 if (barbed_wire)
2801 barbed_wire.SetMountedState( false );
2802 }
2803 }
2804 }
2805
2807 {
2809 {
2811 }
2812
2813 super.EEOnAfterLoad();
2814 }
2815
2817 {
2818 super.EEInit();
2819
2820
2822
2823
2824 #ifdef DEVELOPER
2826 #endif
2827 }
2828
2830 {
2831 super.EEItemAttached( item, slot_name );
2832
2836 }
2837
2839 {
2840 super.EEItemDetached( item, slot_name );
2841
2844 }
2845
2846 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2847 {
2850
2853 }
2854
2855
2857 {
2858 return true;
2859 }
2860
2861
2862
2864 {
2866
2867
2868 if (construtionPart.
IsBase())
2869 {
2871
2872
2874 }
2875
2876
2878
2879
2881
2882
2884
2886
2888
2889
2891
2892
2894 }
2895
2897 {
2898
2900 }
2901
2902
2904 {
2907
2908
2910
2911
2913
2914
2916
2917
2919
2921
2922
2924
2925
2927
2928
2929 if (construtionPart.
IsBase())
2930 {
2931
2933 }
2934
2937 }
2938
2940 {
2941
2943 }
2944
2945
2946 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2947 {
2950
2951
2953
2954
2956
2957
2959
2960
2962
2964
2965
2967
2968
2970
2971
2972 if (construtionPart.
IsBase())
2973 {
2974
2976 }
2977
2980 }
2981
2983 {
2984
2986 }
2987
2989 {
2990 bool process = false;
2991
2992
2996
2997 if (process)
2998 {
2999 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3000 {
3002 return;
3003 }
3004
3006 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3007 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3008
3009
3011 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3012 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3013 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3014 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3015 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3016 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3017 mins = minTmp;
3018 maxs = maxTmp;
3019
3020 maxs[1] = maxs[1] + 0.35;
3021
3023 }
3024 }
3025
3027 {
3030
3031
3033 foreach (
EntityAI entity : foundEntities)
3034 {
3037 }
3038 }
3039
3040
3042 {
3044
3048 }
3049
3051 {
3053
3055 {
3057 }
3058 else
3059 {
3061 }
3062
3064 }
3065
3067 {
3069
3071 foreach (
string slotName : attachmentSlots)
3072 {
3074 }
3075
3076
3079 else
3081
3083 }
3084
3086 {
3087 string slotNameMounted = slot_name + "_Mounted";
3088 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3089
3090 if (attachment)
3091 {
3092 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3093 if (barbedWire && barbedWire.IsMounted())
3095 else
3097
3098 if (is_locked)
3099 {
3100 SetAnimationPhase(slotNameMounted, 0);
3101 SetAnimationPhase(slot_name, 1);
3102 }
3103 else
3104 {
3105 SetAnimationPhase(slotNameMounted, 1);
3106 SetAnimationPhase(slot_name, 0);
3107 }
3108 }
3109 else
3110 {
3111 SetAnimationPhase(slotNameMounted, 1);
3112 SetAnimationPhase(slot_name, 1);
3113
3115 }
3116 }
3117
3118
3120 {
3123
3126
3129
3130 foreach (
string slotName : attachmentSlots)
3131 {
3133 }
3134
3135
3137 {
3140
3142 }
3143 else
3144 {
3147
3149 }
3150
3153 }
3154
3156 {
3157
3159 return;
3160
3161 string slot_name_mounted = slot_name + "_Mounted";
3162 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3163
3164
3166 RemoveProxyPhysics( slot_name_mounted );
3167 RemoveProxyPhysics( slot_name );
3168
3169 if ( attachment )
3170 {
3172 if ( is_locked )
3173 {
3175 AddProxyPhysics( slot_name_mounted );
3176 }
3177 else
3178 {
3180 AddProxyPhysics( slot_name );
3181 }
3182 }
3183 }
3184
3186 {
3187 SetAffectPathgraph( true, false );
3189 }
3190
3192 {
3193 return true;
3194 }
3195
3197 {
3198 return true;
3199 }
3200
3202 {
3203 if ( attachment )
3204 {
3206 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3207
3208 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3209 }
3210
3211 return false;
3212 }
3213
3215 {
3217 }
3218
3219
3221 {
3222 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3223 if (
GetGame().ConfigIsExisting( config_path ) )
3224 {
3226 }
3227 }
3228
3230 {
3231 return true;
3232 }
3233
3235 {
3236 return true;
3237 }
3238
3240 {
3241 return true;
3242 }
3243
3244
3246 {
3248 {
3250 }
3251
3253 }
3254
3256 {
3258 }
3259
3260
3261
3263 {
3264 return super.CanReceiveAttachment(attachment, slotId);
3265 }
3266
3268 {
3269 int attachment_count = GetInventory().AttachmentCount();
3270 if ( attachment_count > 0 )
3271 {
3272 if (
HasBase() && attachment_count == 1 )
3273 {
3274 return false;
3275 }
3276
3277 return true;
3278 }
3279
3280 return false;
3281 }
3282
3284 {
3285 return true;
3286 }
3287
3289 {
3290 return false;
3291 }
3292
3293
3295 {
3296 return false;
3297 }
3298
3300 {
3301 return false;
3302 }
3303
3304
3306 {
3307 return false;
3308 }
3309
3310
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return true;
3320 }
3321
3324 {
3325 return false;
3326 }
3327
3328
3330 {
3331 return true;
3332 }
3333
3334
3336 {
3337 return false;
3338 }
3339
3340
3342 {
3343 return true;
3344 }
3345
3346
3348 {
3349 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3350 {
3351 return false;
3352 }
3353
3354 return true;
3355 }
3356
3358 {
3361
3362 return item;
3363 }
3364
3365
3367 {
3369 {
3370
3372
3373
3376
3378 if ( MemoryPointExists( slot_name + "_min" ) )
3379 {
3380 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3381 }
3382 if ( MemoryPointExists( slot_name + "_max" ) )
3383 {
3384 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3385 }
3386
3387
3390
3391
3394 center = ModelToWorld( center );
3395
3396
3399
3400 areaDamage.SetExtents( extents[0], extents[1] );
3401 areaDamage.SetAreaPosition( center );
3402 areaDamage.SetAreaOrientation( orientation );
3405 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3406 areaDamage.SetAmmoName( "BarbedWireHit" );
3407 areaDamage.Spawn();
3408
3410 }
3411 }
3412
3414 {
3415 if ( angle_deg != 0 )
3416 {
3417
3418 orientation[0] = orientation[0] - angle_deg;
3419
3420
3422 if ( MemoryPointExists( "rotate_axis" ) )
3423 {
3424 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3425 }
3426 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];
3427 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];
3428 center[0] = r_center_x;
3429 center[2] = r_center_z;
3430 }
3431 }
3432
3434 {
3436 {
3439 {
3440 if (areaDamage)
3441 {
3442 areaDamage.Destroy();
3443 }
3444
3446 }
3447 }
3448 }
3449
3451 {
3452 return true;
3453 }
3454
3455
3456
3457
3459 {
3461 }
3462
3464 {
3466 }
3467
3469 {
3471 }
3472
3474 {
3476
3477 switch ( material_type )
3478 {
3484 }
3485
3486 return "";
3487 }
3488
3490 {
3492
3493 switch ( material_type )
3494 {
3500 }
3501
3502 return "";
3503 }
3504
3505
3507 {
3509 {
3510
3512 {
3513 SetHealth(slot_name,"Health",item.GetHealth());
3514 }
3515 }
3516 }
3517
3519 {
3520 return 111;
3521 }
3522
3524 {
3525 super.SetActions();
3526
3530 }
3531
3532
3533
3534
3536 {
3537 }
3538
3541 {
3542 return null;
3543 }
3544
3546 {
3548 }
3549
3551 {
3554
3555 Man p;
3556
3557 #ifdef SERVER
3560 if (players.Count())
3561 p = players[0];
3562 #else
3564 #endif
3565
3567 {
3568 bool excluded = false;
3570 if (excludes)
3571 {
3572 foreach (string exclude : excludes)
3573 {
3575 {
3576 excluded = true;
3577 break;
3578 }
3579 }
3580 }
3581
3582 if (!excluded)
3583 {
3585 }
3586 }
3587
3589 }
3590}
3591
3593{
3594#ifdef BSB_DEBUG
3596#else
3597
3598#endif
3599}
3601{
3602#ifdef BSB_DEBUG_SPAM
3604#else
3605
3606#endif
3607}
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.