2348{
2350
2352
2354
2356
2362
2363
2364
2370
2376
2378
2382
2383
2385 {
2387
2388
2389 RegisterNetSyncVariableInt( "m_SyncParts01" );
2390 RegisterNetSyncVariableInt( "m_SyncParts02" );
2391 RegisterNetSyncVariableInt( "m_SyncParts03" );
2392 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2393 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2394 RegisterNetSyncVariableBool( "m_HasBase" );
2395
2396
2398
2399 if (ConfigIsExisting("hybridAttachments"))
2400 {
2403 }
2404 if (ConfigIsExisting("mountables"))
2405 {
2408 }
2409
2411 }
2412
2414 {
2415 super.EEDelete(parent);
2416
2418 {
2419 areaDamage.Destroy();
2420 }
2421
2422 }
2423
2425 {
2426 return "disableBaseDamage";
2427 }
2428
2430 {
2431 return true;
2432 }
2433
2435 {
2436 return EInventoryIconVisibility.HIDE_VICINITY;
2437 }
2438
2439
2441 {
2443 {
2444 SetSynchDirty();
2445 }
2446 }
2447
2449 {
2451 super.OnVariablesSynchronized();
2452
2454 }
2455
2457 {
2458
2460
2461
2463
2464
2466 }
2467
2468
2470 {
2471
2472 int offset;
2473 int mask;
2474
2475 if ( part_id >= 1 && part_id <= 31 )
2476 {
2477 offset = part_id - 1;
2478 mask = 1 << offset;
2479
2481 }
2482 else if ( part_id >= 32 && part_id <= 62 )
2483 {
2484 offset = ( part_id % 32 );
2485 mask = 1 << offset;
2486
2488 }
2489 else if ( part_id >= 63 && part_id <= 93 )
2490 {
2491 offset = ( part_id % 63 );
2492 mask = 1 << offset;
2493
2495 }
2496 }
2497
2499 {
2500
2501 int offset;
2502 int mask;
2503
2504 if ( part_id >= 1 && part_id <= 31 )
2505 {
2506 offset = part_id - 1;
2507 mask = 1 << offset;
2508
2510 }
2511 else if ( part_id >= 32 && part_id <= 62 )
2512 {
2513 offset = ( part_id % 32 );
2514 mask = 1 << offset;
2515
2517 }
2518 else if ( part_id >= 63 && part_id <= 93 )
2519 {
2520 offset = ( part_id % 63 );
2521 mask = 1 << offset;
2522
2524 }
2525 }
2526
2528 {
2529
2530 int offset;
2531 int mask;
2532
2533 if ( part_id >= 1 && part_id <= 31 )
2534 {
2535 offset = part_id - 1;
2536 mask = 1 << offset;
2537
2539 {
2540 return true;
2541 }
2542 }
2543 else if ( part_id >= 32 && part_id <= 62 )
2544 {
2545 offset = ( part_id % 32 );
2546 mask = 1 << offset;
2547
2549 {
2550 return true;
2551 }
2552 }
2553 else if ( part_id >= 63 && part_id <= 93 )
2554 {
2555 offset = ( part_id % 63 );
2556 mask = 1 << offset;
2557
2559 {
2560 return true;
2561 }
2562 }
2563
2564 return false;
2565 }
2566
2568 {
2571 }
2572
2574 {
2575
2578 }
2579
2581 {
2583 {
2586
2587 switch( build_action_id )
2588 {
2592 }
2593 }
2594 }
2595
2596
2598 {
2600 bool is_base = part.
IsBase();
2603 if ( is_part_built_sync )
2604 {
2606 {
2610
2611 if (is_base)
2612 {
2615 }
2616 }
2617 }
2618 else
2619 {
2621 {
2625
2626 if (is_base)
2627 {
2630 }
2631 }
2632 }
2633
2634
2636 }
2637
2638
2640 {
2643
2644 for ( int i = 0; i < construction_parts.Count(); ++i )
2645 {
2646 string key = construction_parts.GetKey( i );
2649 }
2650
2651
2653 }
2654
2656 {
2659
2660 for ( int i = 0; i < construction_parts.Count(); ++i )
2661 {
2662 string key = construction_parts.GetKey( i );
2664
2665 if ( value.
GetId() ==
id )
2666 {
2667 return value;
2668 }
2669 }
2670
2671 return NULL;
2672 }
2673
2674
2675
2677 {
2679 }
2680
2682 {
2684 }
2685
2687 {
2688 return true;
2689 }
2690
2692 {
2693 return false;
2694 }
2695
2696
2698 {
2701 {
2703 }
2704
2705 return construction_kit;
2706 }
2707
2709 {
2712 {
2714 }
2715 }
2716
2718 {
2720 }
2721
2723 {
2724 return "";
2725 }
2726
2728 {
2731 }
2732
2733
2735 {
2738 }
2739
2740
2742 {
2743 super.OnStoreSave( ctx );
2744
2745
2749
2751 }
2752
2754 {
2755 if ( !super.OnStoreLoad( ctx, version ) )
2756 return false;
2757
2758
2759
2761 {
2763 return false;
2764 }
2766 {
2768 return false;
2769 }
2771 {
2773 return false;
2774 }
2775
2776
2778 {
2780 return false;
2781 }
2782
2783
2784 return true;
2785 }
2786
2788 {
2789 super.AfterStoreLoad();
2790
2792 {
2794 }
2795 }
2796
2798 {
2799
2801
2802
2805
2806
2808 }
2809
2811 {
2812 super.OnCreatePhysics();
2815 }
2816
2818 {
2820 return;
2821
2822 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2823
2825 return;
2826
2828 string part_name = zone;
2830
2832 {
2833 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2834
2835 if ( construction_part && construction.IsPartConstructed( part_name ) )
2836 {
2838 construction.DestroyConnectedParts(part_name);
2839 }
2840
2841
2842 if ( part_name.
Contains(
"barbed") )
2843 {
2844 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2845 if (barbed_wire)
2846 barbed_wire.SetMountedState( false );
2847 }
2848 }
2849 }
2850
2852 {
2854 {
2856 }
2857
2858 super.EEOnAfterLoad();
2859 }
2860
2862 {
2863 super.EEInit();
2864
2865
2867
2868
2869 #ifdef DEVELOPER
2871 #endif
2872 }
2873
2875 {
2876 super.EEItemAttached( item, slot_name );
2877
2881 }
2882
2884 {
2885 super.EEItemDetached( item, slot_name );
2886
2889 }
2890
2891 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2892 {
2895
2898 }
2899
2900
2902 {
2903 return true;
2904 }
2905
2906
2907
2909 {
2911
2912
2913 if (construtionPart.
IsBase())
2914 {
2916
2917
2919 }
2920
2921
2923
2924
2926
2927
2929
2931
2933
2934
2936
2937
2939 }
2940
2942 {
2943
2945 }
2946
2947
2949 {
2952
2953
2955
2956
2958
2959
2961
2962
2964
2966
2967
2969
2970
2972
2973
2974 if (construtionPart.
IsBase())
2975 {
2976
2978 }
2979
2982 }
2983
2985 {
2986
2988 }
2989
2990
2991 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2992 {
2995
2996
2998
2999
3001
3002
3004
3005
3007
3009
3010
3012
3013
3015
3016
3017 if (construtionPart.
IsBase())
3018 {
3019
3021 }
3022
3025 }
3026
3028 {
3029
3031 }
3032
3034 {
3035 bool process = false;
3036
3037
3041
3042 if (process)
3043 {
3044 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3045 {
3047 return;
3048 }
3049
3051 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3052 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3053
3054
3056 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3057 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3058 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3059 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3060 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3061 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3062 mins = minTmp;
3063 maxs = maxTmp;
3064
3065 maxs[1] = maxs[1] + 0.35;
3066
3068 }
3069 }
3070
3072 {
3075
3076
3078 foreach (
EntityAI entity : foundEntities)
3079 {
3082 }
3083 }
3084
3085
3087 {
3089
3093 }
3094
3096 {
3098
3100 {
3102 }
3103 else
3104 {
3106 }
3107
3109 }
3110
3112 {
3114
3116 foreach (
string slotName : attachmentSlots)
3117 {
3119 }
3120
3121
3124 else
3126
3128 }
3129
3131 {
3132 string slotNameMounted = slot_name + "_Mounted";
3133 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3134
3135 if (attachment)
3136 {
3137 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3138 if (barbedWire && barbedWire.IsMounted())
3140 else
3142
3143 if (is_locked)
3144 {
3145 SetAnimationPhase(slotNameMounted, 0);
3146 SetAnimationPhase(slot_name, 1);
3147 }
3148 else
3149 {
3150 SetAnimationPhase(slotNameMounted, 1);
3151 SetAnimationPhase(slot_name, 0);
3152 }
3153 }
3154 else
3155 {
3156 SetAnimationPhase(slotNameMounted, 1);
3157 SetAnimationPhase(slot_name, 1);
3158
3160 }
3161 }
3162
3163
3165 {
3168
3171
3174
3175 foreach (
string slotName : attachmentSlots)
3176 {
3178 }
3179
3180
3182 {
3185
3187 }
3188 else
3189 {
3192
3194 }
3195
3198 }
3199
3201 {
3202
3204 return;
3205
3206 string slot_name_mounted = slot_name + "_Mounted";
3207 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3208
3209
3211 RemoveProxyPhysics( slot_name_mounted );
3212 RemoveProxyPhysics( slot_name );
3213
3214 if ( attachment )
3215 {
3217 if ( is_locked )
3218 {
3220 AddProxyPhysics( slot_name_mounted );
3221 }
3222 else
3223 {
3225 AddProxyPhysics( slot_name );
3226 }
3227 }
3228 }
3229
3231 {
3232 SetAffectPathgraph( true, false );
3234 }
3235
3237 {
3238 return true;
3239 }
3240
3242 {
3243 return true;
3244 }
3245
3247 {
3248 if ( attachment )
3249 {
3251 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3252
3253 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3254 }
3255
3256 return false;
3257 }
3258
3260 {
3262 }
3263
3264
3266 {
3267 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3268 if (
GetGame().ConfigIsExisting( config_path ) )
3269 {
3271 }
3272 }
3273
3275 {
3276 return true;
3277 }
3278
3280 {
3281 return true;
3282 }
3283
3285 {
3286 return true;
3287 }
3288
3289
3291 {
3293 {
3295 }
3296
3298 }
3299
3301 {
3303 }
3304
3305
3306
3308 {
3309 return super.CanReceiveAttachment(attachment, slotId);
3310 }
3311
3313 {
3314 int attachment_count = GetInventory().AttachmentCount();
3315 if ( attachment_count > 0 )
3316 {
3317 if (
HasBase() && attachment_count == 1 )
3318 {
3319 return false;
3320 }
3321
3322 return true;
3323 }
3324
3325 return false;
3326 }
3327
3329 {
3330 return true;
3331 }
3332
3334 {
3335 return false;
3336 }
3337
3338
3340 {
3341 return false;
3342 }
3343
3345 {
3346 return false;
3347 }
3348
3349
3351 {
3352 return false;
3353 }
3354
3355
3356
3358 {
3359 return true;
3360 }
3361
3363 {
3364 return true;
3365 }
3366
3369 {
3370 return false;
3371 }
3372
3373
3375 {
3376 return true;
3377 }
3378
3379
3381 {
3382 return false;
3383 }
3384
3385
3387 {
3388 return true;
3389 }
3390
3391
3393 {
3394 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3395 {
3396 return false;
3397 }
3398
3399 return true;
3400 }
3401
3403 {
3406
3407 return item;
3408 }
3409
3410
3412 {
3414 {
3415
3417
3418
3421
3423 if ( MemoryPointExists( slot_name + "_min" ) )
3424 {
3425 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3426 }
3427 if ( MemoryPointExists( slot_name + "_max" ) )
3428 {
3429 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3430 }
3431
3432
3435
3436
3439 center = ModelToWorld( center );
3440
3441
3444
3445 areaDamage.SetExtents( extents[0], extents[1] );
3446 areaDamage.SetAreaPosition( center );
3447 areaDamage.SetAreaOrientation( orientation );
3450 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3451 areaDamage.SetAmmoName( "BarbedWireHit" );
3452 areaDamage.Spawn();
3453
3455 }
3456 }
3457
3459 {
3460 if ( angle_deg != 0 )
3461 {
3462
3463 orientation[0] = orientation[0] - angle_deg;
3464
3465
3467 if ( MemoryPointExists( "rotate_axis" ) )
3468 {
3469 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3470 }
3471 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];
3472 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];
3473 center[0] = r_center_x;
3474 center[2] = r_center_z;
3475 }
3476 }
3477
3479 {
3481 {
3484 {
3485 if (areaDamage)
3486 {
3487 areaDamage.Destroy();
3488 }
3489
3491 }
3492 }
3493 }
3494
3496 {
3497 return true;
3498 }
3499
3500
3501
3502
3504 {
3506 }
3507
3509 {
3511 }
3512
3514 {
3516 }
3517
3519 {
3521
3522 switch ( material_type )
3523 {
3529 }
3530
3531 return "";
3532 }
3533
3535 {
3537
3538 switch ( material_type )
3539 {
3545 }
3546
3547 return "";
3548 }
3549
3550
3552 {
3554 {
3555
3557 {
3558 SetHealth(slot_name,"Health",item.GetHealth());
3559 }
3560 }
3561 }
3562
3564 {
3565 return 111;
3566 }
3567
3569 {
3570 super.SetActions();
3571
3575 }
3576
3577
3578
3579
3581 {
3582 }
3583
3586 {
3587 return null;
3588 }
3589
3591 {
3593 }
3594
3596 {
3599
3600 Man p;
3601
3602 #ifdef SERVER
3605 if (players.Count())
3606 p = players[0];
3607 #else
3609 #endif
3610
3612 {
3613 bool excluded = false;
3615 if (excludes)
3616 {
3617 foreach (string exclude : excludes)
3618 {
3620 {
3621 excluded = true;
3622 break;
3623 }
3624 }
3625 }
3626
3627 if (!excluded)
3628 {
3630 }
3631 }
3632
3634 }
3635}
3636
3638{
3639#ifdef BSB_DEBUG
3641#else
3642
3643#endif
3644}
3646{
3647#ifdef BSB_DEBUG_SPAM
3649#else
3650
3651#endif
3652}
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.