2308{
2310
2312
2314
2316
2322
2323
2324
2330
2336
2338
2342
2343
2345 {
2347
2348
2349 RegisterNetSyncVariableInt( "m_SyncParts01" );
2350 RegisterNetSyncVariableInt( "m_SyncParts02" );
2351 RegisterNetSyncVariableInt( "m_SyncParts03" );
2352 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2353 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2354 RegisterNetSyncVariableBool( "m_HasBase" );
2355
2356
2358
2359 if (ConfigIsExisting("hybridAttachments"))
2360 {
2363 }
2364 if (ConfigIsExisting("mountables"))
2365 {
2368 }
2369
2371 }
2372
2374 {
2375 super.EEDelete(parent);
2376
2378 {
2379 areaDamage.Destroy();
2380 }
2381
2382 }
2383
2385 {
2386 return "disableBaseDamage";
2387 }
2388
2390 {
2391 return true;
2392 }
2393
2395 {
2396 return EInventoryIconVisibility.HIDE_VICINITY;
2397 }
2398
2399
2401 {
2403 {
2404 SetSynchDirty();
2405 }
2406 }
2407
2409 {
2411 super.OnVariablesSynchronized();
2412
2414 }
2415
2417 {
2418
2420
2421
2423
2424
2426 }
2427
2428
2430 {
2431
2432 int offset;
2433 int mask;
2434
2435 if ( part_id >= 1 && part_id <= 31 )
2436 {
2437 offset = part_id - 1;
2438 mask = 1 << offset;
2439
2441 }
2442 else if ( part_id >= 32 && part_id <= 62 )
2443 {
2444 offset = ( part_id % 32 );
2445 mask = 1 << offset;
2446
2448 }
2449 else if ( part_id >= 63 && part_id <= 93 )
2450 {
2451 offset = ( part_id % 63 );
2452 mask = 1 << offset;
2453
2455 }
2456 }
2457
2459 {
2460
2461 int offset;
2462 int mask;
2463
2464 if ( part_id >= 1 && part_id <= 31 )
2465 {
2466 offset = part_id - 1;
2467 mask = 1 << offset;
2468
2470 }
2471 else if ( part_id >= 32 && part_id <= 62 )
2472 {
2473 offset = ( part_id % 32 );
2474 mask = 1 << offset;
2475
2477 }
2478 else if ( part_id >= 63 && part_id <= 93 )
2479 {
2480 offset = ( part_id % 63 );
2481 mask = 1 << offset;
2482
2484 }
2485 }
2486
2488 {
2489
2490 int offset;
2491 int mask;
2492
2493 if ( part_id >= 1 && part_id <= 31 )
2494 {
2495 offset = part_id - 1;
2496 mask = 1 << offset;
2497
2499 {
2500 return true;
2501 }
2502 }
2503 else if ( part_id >= 32 && part_id <= 62 )
2504 {
2505 offset = ( part_id % 32 );
2506 mask = 1 << offset;
2507
2509 {
2510 return true;
2511 }
2512 }
2513 else if ( part_id >= 63 && part_id <= 93 )
2514 {
2515 offset = ( part_id % 63 );
2516 mask = 1 << offset;
2517
2519 {
2520 return true;
2521 }
2522 }
2523
2524 return false;
2525 }
2526
2528 {
2531 }
2532
2534 {
2535
2538 }
2539
2541 {
2543 {
2546
2547 switch( build_action_id )
2548 {
2552 }
2553 }
2554 }
2555
2556
2558 {
2560 bool is_base = part.
IsBase();
2563 if ( is_part_built_sync )
2564 {
2566 {
2570
2571 if (is_base)
2572 {
2575 }
2576 }
2577 }
2578 else
2579 {
2581 {
2585
2586 if (is_base)
2587 {
2590 }
2591 }
2592 }
2593
2594
2596 }
2597
2598
2600 {
2603
2604 for ( int i = 0; i < construction_parts.Count(); ++i )
2605 {
2606 string key = construction_parts.GetKey( i );
2609 }
2610
2611
2613 }
2614
2616 {
2619
2620 for ( int i = 0; i < construction_parts.Count(); ++i )
2621 {
2622 string key = construction_parts.GetKey( i );
2624
2625 if ( value.
GetId() ==
id )
2626 {
2627 return value;
2628 }
2629 }
2630
2631 return NULL;
2632 }
2633
2634
2635
2637 {
2639 }
2640
2642 {
2644 }
2645
2647 {
2648 return true;
2649 }
2650
2652 {
2653 return false;
2654 }
2655
2656
2658 {
2661 {
2663 }
2664
2665 return construction_kit;
2666 }
2667
2669 {
2672 {
2674 }
2675 }
2676
2678 {
2680 }
2681
2683 {
2684 return "";
2685 }
2686
2688 {
2691 }
2692
2693
2695 {
2698 }
2699
2700
2702 {
2703 super.OnStoreSave( ctx );
2704
2705
2709
2711 }
2712
2714 {
2715 if ( !super.OnStoreLoad( ctx, version ) )
2716 return false;
2717
2718
2719
2721 {
2723 return false;
2724 }
2726 {
2728 return false;
2729 }
2731 {
2733 return false;
2734 }
2735
2736
2738 {
2740 return false;
2741 }
2742
2743
2744 return true;
2745 }
2746
2748 {
2749 super.AfterStoreLoad();
2750
2752 {
2754 }
2755 }
2756
2758 {
2759
2761
2762
2765
2766
2768 }
2769
2771 {
2772 super.OnCreatePhysics();
2775 }
2776
2778 {
2780 return;
2781
2782 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2783
2785 return;
2786
2788 string part_name = zone;
2790
2792 {
2793 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2794
2795 if ( construction_part && construction.IsPartConstructed( part_name ) )
2796 {
2798 construction.DestroyConnectedParts(part_name);
2799 }
2800
2801
2802 if ( part_name.
Contains(
"barbed") )
2803 {
2804 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2805 if (barbed_wire)
2806 barbed_wire.SetMountedState( false );
2807 }
2808 }
2809 }
2810
2812 {
2814 {
2816 }
2817
2818 super.EEOnAfterLoad();
2819 }
2820
2822 {
2823 super.EEInit();
2824
2825
2827
2828
2829 #ifdef DEVELOPER
2831 #endif
2832 }
2833
2835 {
2836 super.EEItemAttached( item, slot_name );
2837
2841 }
2842
2844 {
2845 super.EEItemDetached( item, slot_name );
2846
2849 }
2850
2851 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2852 {
2855
2858 }
2859
2860
2862 {
2863 return true;
2864 }
2865
2866
2867
2869 {
2871
2872
2873 if (construtionPart.
IsBase())
2874 {
2876
2877
2879 }
2880
2881
2883
2884
2886
2887
2889
2891
2893
2894
2896
2897
2899 }
2900
2902 {
2903
2905 }
2906
2907
2909 {
2912
2913
2915
2916
2918
2919
2921
2922
2924
2926
2927
2929
2930
2932
2933
2934 if (construtionPart.
IsBase())
2935 {
2936
2938 }
2939
2942 }
2943
2945 {
2946
2948 }
2949
2950
2951 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2952 {
2955
2956
2958
2959
2961
2962
2964
2965
2967
2969
2970
2972
2973
2975
2976
2977 if (construtionPart.
IsBase())
2978 {
2979
2981 }
2982
2985 }
2986
2988 {
2989
2991 }
2992
2994 {
2995 bool process = false;
2996
2997
3001
3002 if (process)
3003 {
3004 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3005 {
3007 return;
3008 }
3009
3011 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3012 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3013
3014
3016 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3017 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3018 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3019 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3020 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3021 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3022 mins = minTmp;
3023 maxs = maxTmp;
3024
3025 maxs[1] = maxs[1] + 0.35;
3026
3028 }
3029 }
3030
3032 {
3035
3036
3038 foreach (
EntityAI entity : foundEntities)
3039 {
3042 }
3043 }
3044
3045
3047 {
3049
3053 }
3054
3056 {
3058
3060 {
3062 }
3063 else
3064 {
3066 }
3067
3069 }
3070
3072 {
3074
3076 foreach (
string slotName : attachmentSlots)
3077 {
3079 }
3080
3081
3084 else
3086
3088 }
3089
3091 {
3092 string slotNameMounted = slot_name + "_Mounted";
3093 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3094
3095 if (attachment)
3096 {
3097 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3098 if (barbedWire && barbedWire.IsMounted())
3100 else
3102
3103 if (is_locked)
3104 {
3105 SetAnimationPhase(slotNameMounted, 0);
3106 SetAnimationPhase(slot_name, 1);
3107 }
3108 else
3109 {
3110 SetAnimationPhase(slotNameMounted, 1);
3111 SetAnimationPhase(slot_name, 0);
3112 }
3113 }
3114 else
3115 {
3116 SetAnimationPhase(slotNameMounted, 1);
3117 SetAnimationPhase(slot_name, 1);
3118
3120 }
3121 }
3122
3123
3125 {
3128
3131
3134
3135 foreach (
string slotName : attachmentSlots)
3136 {
3138 }
3139
3140
3142 {
3145
3147 }
3148 else
3149 {
3152
3154 }
3155
3158 }
3159
3161 {
3162
3164 return;
3165
3166 string slot_name_mounted = slot_name + "_Mounted";
3167 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3168
3169
3171 RemoveProxyPhysics( slot_name_mounted );
3172 RemoveProxyPhysics( slot_name );
3173
3174 if ( attachment )
3175 {
3177 if ( is_locked )
3178 {
3180 AddProxyPhysics( slot_name_mounted );
3181 }
3182 else
3183 {
3185 AddProxyPhysics( slot_name );
3186 }
3187 }
3188 }
3189
3191 {
3192 SetAffectPathgraph( true, false );
3194 }
3195
3197 {
3198 return true;
3199 }
3200
3202 {
3203 return true;
3204 }
3205
3207 {
3208 if ( attachment )
3209 {
3211 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3212
3213 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3214 }
3215
3216 return false;
3217 }
3218
3220 {
3222 }
3223
3224
3226 {
3227 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3228 if (
GetGame().ConfigIsExisting( config_path ) )
3229 {
3231 }
3232 }
3233
3235 {
3236 return true;
3237 }
3238
3240 {
3241 return true;
3242 }
3243
3245 {
3246 return true;
3247 }
3248
3249
3251 {
3253 {
3255 }
3256
3258 }
3259
3261 {
3263 }
3264
3265
3266
3268 {
3269 return super.CanReceiveAttachment(attachment, slotId);
3270 }
3271
3273 {
3274 int attachment_count = GetInventory().AttachmentCount();
3275 if ( attachment_count > 0 )
3276 {
3277 if (
HasBase() && attachment_count == 1 )
3278 {
3279 return false;
3280 }
3281
3282 return true;
3283 }
3284
3285 return false;
3286 }
3287
3289 {
3290 return true;
3291 }
3292
3294 {
3295 return false;
3296 }
3297
3298
3300 {
3301 return false;
3302 }
3303
3305 {
3306 return false;
3307 }
3308
3309
3311 {
3312 return false;
3313 }
3314
3315
3316
3318 {
3319 return true;
3320 }
3321
3323 {
3324 return true;
3325 }
3326
3329 {
3330 return false;
3331 }
3332
3333
3335 {
3336 return true;
3337 }
3338
3339
3341 {
3342 return false;
3343 }
3344
3345
3347 {
3348 return true;
3349 }
3350
3351
3353 {
3354 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3355 {
3356 return false;
3357 }
3358
3359 return true;
3360 }
3361
3363 {
3366
3367 return item;
3368 }
3369
3370
3372 {
3374 {
3375
3377
3378
3381
3383 if ( MemoryPointExists( slot_name + "_min" ) )
3384 {
3385 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3386 }
3387 if ( MemoryPointExists( slot_name + "_max" ) )
3388 {
3389 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3390 }
3391
3392
3395
3396
3399 center = ModelToWorld( center );
3400
3401
3404
3405 areaDamage.SetExtents( extents[0], extents[1] );
3406 areaDamage.SetAreaPosition( center );
3407 areaDamage.SetAreaOrientation( orientation );
3410 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3411 areaDamage.SetAmmoName( "BarbedWireHit" );
3412 areaDamage.Spawn();
3413
3415 }
3416 }
3417
3419 {
3420 if ( angle_deg != 0 )
3421 {
3422
3423 orientation[0] = orientation[0] - angle_deg;
3424
3425
3427 if ( MemoryPointExists( "rotate_axis" ) )
3428 {
3429 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3430 }
3431 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];
3432 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];
3433 center[0] = r_center_x;
3434 center[2] = r_center_z;
3435 }
3436 }
3437
3439 {
3441 {
3444 {
3445 if (areaDamage)
3446 {
3447 areaDamage.Destroy();
3448 }
3449
3451 }
3452 }
3453 }
3454
3456 {
3457 return true;
3458 }
3459
3460
3461
3462
3464 {
3466 }
3467
3469 {
3471 }
3472
3474 {
3476 }
3477
3479 {
3481
3482 switch ( material_type )
3483 {
3489 }
3490
3491 return "";
3492 }
3493
3495 {
3497
3498 switch ( material_type )
3499 {
3505 }
3506
3507 return "";
3508 }
3509
3510
3512 {
3514 {
3515
3517 {
3518 SetHealth(slot_name,"Health",item.GetHealth());
3519 }
3520 }
3521 }
3522
3524 {
3525 return 111;
3526 }
3527
3529 {
3530 super.SetActions();
3531
3535 }
3536
3537
3538
3539
3541 {
3542 }
3543
3546 {
3547 return null;
3548 }
3549
3551 {
3553 }
3554
3556 {
3559
3560 Man p;
3561
3562 #ifdef SERVER
3565 if (players.Count())
3566 p = players[0];
3567 #else
3569 #endif
3570
3572 {
3573 bool excluded = false;
3575 if (excludes)
3576 {
3577 foreach (string exclude : excludes)
3578 {
3580 {
3581 excluded = true;
3582 break;
3583 }
3584 }
3585 }
3586
3587 if (!excluded)
3588 {
3590 }
3591 }
3592
3594 }
3595}
3596
3598{
3599#ifdef BSB_DEBUG
3601#else
3602
3603#endif
3604}
3606{
3607#ifdef BSB_DEBUG_SPAM
3609#else
3610
3611#endif
3612}
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.