2320{
2322
2324
2326
2328
2334
2335
2336
2342
2348
2350
2354
2355
2357 {
2359
2360
2361 RegisterNetSyncVariableInt( "m_SyncParts01" );
2362 RegisterNetSyncVariableInt( "m_SyncParts02" );
2363 RegisterNetSyncVariableInt( "m_SyncParts03" );
2364 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2365 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2366 RegisterNetSyncVariableBool( "m_HasBase" );
2367
2368
2370
2371 if (ConfigIsExisting("hybridAttachments"))
2372 {
2375 }
2376 if (ConfigIsExisting("mountables"))
2377 {
2380 }
2381
2383 }
2384
2386 {
2387 super.EEDelete(parent);
2388
2390 {
2391 areaDamage.Destroy();
2392 }
2393
2394 }
2395
2397 {
2398 return "disableBaseDamage";
2399 }
2400
2402 {
2403 return true;
2404 }
2405
2407 {
2408 return EInventoryIconVisibility.HIDE_VICINITY;
2409 }
2410
2411
2413 {
2415 {
2416 SetSynchDirty();
2417 }
2418 }
2419
2421 {
2423 super.OnVariablesSynchronized();
2424
2426 }
2427
2429 {
2430
2432
2433
2435
2436
2438 }
2439
2440
2442 {
2443
2444 int offset;
2445 int mask;
2446
2447 if ( part_id >= 1 && part_id <= 31 )
2448 {
2449 offset = part_id - 1;
2450 mask = 1 << offset;
2451
2453 }
2454 else if ( part_id >= 32 && part_id <= 62 )
2455 {
2456 offset = ( part_id % 32 );
2457 mask = 1 << offset;
2458
2460 }
2461 else if ( part_id >= 63 && part_id <= 93 )
2462 {
2463 offset = ( part_id % 63 );
2464 mask = 1 << offset;
2465
2467 }
2468 }
2469
2471 {
2472
2473 int offset;
2474 int mask;
2475
2476 if ( part_id >= 1 && part_id <= 31 )
2477 {
2478 offset = part_id - 1;
2479 mask = 1 << offset;
2480
2482 }
2483 else if ( part_id >= 32 && part_id <= 62 )
2484 {
2485 offset = ( part_id % 32 );
2486 mask = 1 << offset;
2487
2489 }
2490 else if ( part_id >= 63 && part_id <= 93 )
2491 {
2492 offset = ( part_id % 63 );
2493 mask = 1 << offset;
2494
2496 }
2497 }
2498
2500 {
2501
2502 int offset;
2503 int mask;
2504
2505 if ( part_id >= 1 && part_id <= 31 )
2506 {
2507 offset = part_id - 1;
2508 mask = 1 << offset;
2509
2511 {
2512 return true;
2513 }
2514 }
2515 else if ( part_id >= 32 && part_id <= 62 )
2516 {
2517 offset = ( part_id % 32 );
2518 mask = 1 << offset;
2519
2521 {
2522 return true;
2523 }
2524 }
2525 else if ( part_id >= 63 && part_id <= 93 )
2526 {
2527 offset = ( part_id % 63 );
2528 mask = 1 << offset;
2529
2531 {
2532 return true;
2533 }
2534 }
2535
2536 return false;
2537 }
2538
2540 {
2543 }
2544
2546 {
2547
2550 }
2551
2553 {
2555 {
2558
2559 switch( build_action_id )
2560 {
2564 }
2565 }
2566 }
2567
2568
2570 {
2572 bool is_base = part.
IsBase();
2575 if ( is_part_built_sync )
2576 {
2578 {
2582
2583 if (is_base)
2584 {
2587 }
2588 }
2589 }
2590 else
2591 {
2593 {
2597
2598 if (is_base)
2599 {
2602 }
2603 }
2604 }
2605
2606
2608 }
2609
2610
2612 {
2615
2616 for ( int i = 0; i < construction_parts.Count(); ++i )
2617 {
2618 string key = construction_parts.GetKey( i );
2621 }
2622
2623
2625 }
2626
2628 {
2631
2632 for ( int i = 0; i < construction_parts.Count(); ++i )
2633 {
2634 string key = construction_parts.GetKey( i );
2636
2637 if ( value.
GetId() ==
id )
2638 {
2639 return value;
2640 }
2641 }
2642
2643 return NULL;
2644 }
2645
2646
2647
2649 {
2651 }
2652
2654 {
2656 }
2657
2659 {
2660 return true;
2661 }
2662
2664 {
2665 return false;
2666 }
2667
2668
2670 {
2673 {
2675 }
2676
2677 return construction_kit;
2678 }
2679
2681 {
2684 {
2686 }
2687 }
2688
2690 {
2692 }
2693
2695 {
2696 return "";
2697 }
2698
2700 {
2703 }
2704
2705
2707 {
2710 }
2711
2712
2714 {
2715 super.OnStoreSave( ctx );
2716
2717
2721
2723 }
2724
2726 {
2727 if ( !super.OnStoreLoad( ctx, version ) )
2728 return false;
2729
2730
2731
2733 {
2735 return false;
2736 }
2738 {
2740 return false;
2741 }
2743 {
2745 return false;
2746 }
2747
2748
2750 {
2752 return false;
2753 }
2754
2755
2756 return true;
2757 }
2758
2760 {
2761 super.AfterStoreLoad();
2762
2764 {
2766 }
2767 }
2768
2770 {
2771
2773
2774
2777
2778
2780 }
2781
2783 {
2784 super.OnCreatePhysics();
2787 }
2788
2790 {
2792 return;
2793
2794 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2795
2797 return;
2798
2800 string part_name = zone;
2802
2804 {
2805 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2806
2807 if ( construction_part && construction.IsPartConstructed( part_name ) )
2808 {
2810 construction.DestroyConnectedParts(part_name);
2811 }
2812
2813
2814 if ( part_name.
Contains(
"barbed") )
2815 {
2816 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2817 if (barbed_wire)
2818 barbed_wire.SetMountedState( false );
2819 }
2820 }
2821 }
2822
2824 {
2826 {
2828 }
2829
2830 super.EEOnAfterLoad();
2831 }
2832
2834 {
2835 super.EEInit();
2836
2837
2839
2840
2841 #ifdef DEVELOPER
2843 #endif
2844 }
2845
2847 {
2848 super.EEItemAttached( item, slot_name );
2849
2853 }
2854
2856 {
2857 super.EEItemDetached( item, slot_name );
2858
2861 }
2862
2863 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2864 {
2867
2870 }
2871
2872
2874 {
2875 return true;
2876 }
2877
2878
2879
2881 {
2883
2884
2885 if (construtionPart.
IsBase())
2886 {
2888
2889
2891 }
2892
2893
2895
2896
2898
2899
2901
2903
2905
2906
2908
2909
2911 }
2912
2914 {
2915
2917 }
2918
2919
2921 {
2924
2925
2927
2928
2930
2931
2933
2934
2936
2938
2939
2941
2942
2944
2945
2946 if (construtionPart.
IsBase())
2947 {
2948
2950 }
2951
2954 }
2955
2957 {
2958
2960 }
2961
2962
2963 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2964 {
2967
2968
2970
2971
2973
2974
2976
2977
2979
2981
2982
2984
2985
2987
2988
2989 if (construtionPart.
IsBase())
2990 {
2991
2993 }
2994
2997 }
2998
3000 {
3001
3003 }
3004
3006 {
3007 bool process = false;
3008
3009
3013
3014 if (process)
3015 {
3016 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3017 {
3019 return;
3020 }
3021
3023 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3024 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3025
3026
3028 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3029 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3030 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3031 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3032 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3033 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3034 mins = minTmp;
3035 maxs = maxTmp;
3036
3037 maxs[1] = maxs[1] + 0.35;
3038
3040 }
3041 }
3042
3044 {
3047
3048
3050 foreach (
EntityAI entity : foundEntities)
3051 {
3054 }
3055 }
3056
3057
3059 {
3061
3065 }
3066
3068 {
3070
3072 {
3074 }
3075 else
3076 {
3078 }
3079
3081 }
3082
3084 {
3086
3088 foreach (
string slotName : attachmentSlots)
3089 {
3091 }
3092
3093
3096 else
3098
3100 }
3101
3103 {
3104 string slotNameMounted = slot_name + "_Mounted";
3105 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3106
3107 if (attachment)
3108 {
3109 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3110 if (barbedWire && barbedWire.IsMounted())
3112 else
3114
3115 if (is_locked)
3116 {
3117 SetAnimationPhase(slotNameMounted, 0);
3118 SetAnimationPhase(slot_name, 1);
3119 }
3120 else
3121 {
3122 SetAnimationPhase(slotNameMounted, 1);
3123 SetAnimationPhase(slot_name, 0);
3124 }
3125 }
3126 else
3127 {
3128 SetAnimationPhase(slotNameMounted, 1);
3129 SetAnimationPhase(slot_name, 1);
3130
3132 }
3133 }
3134
3135
3137 {
3140
3143
3146
3147 foreach (
string slotName : attachmentSlots)
3148 {
3150 }
3151
3152
3154 {
3157
3159 }
3160 else
3161 {
3164
3166 }
3167
3170 }
3171
3173 {
3174
3176 return;
3177
3178 string slot_name_mounted = slot_name + "_Mounted";
3179 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3180
3181
3183 RemoveProxyPhysics( slot_name_mounted );
3184 RemoveProxyPhysics( slot_name );
3185
3186 if ( attachment )
3187 {
3189 if ( is_locked )
3190 {
3192 AddProxyPhysics( slot_name_mounted );
3193 }
3194 else
3195 {
3197 AddProxyPhysics( slot_name );
3198 }
3199 }
3200 }
3201
3203 {
3204 SetAffectPathgraph( true, false );
3206 }
3207
3209 {
3210 return true;
3211 }
3212
3214 {
3215 return true;
3216 }
3217
3219 {
3220 if ( attachment )
3221 {
3223 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3224
3225 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3226 }
3227
3228 return false;
3229 }
3230
3232 {
3234 }
3235
3236
3238 {
3239 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3240 if (
GetGame().ConfigIsExisting( config_path ) )
3241 {
3243 }
3244 }
3245
3247 {
3248 return true;
3249 }
3250
3252 {
3253 return true;
3254 }
3255
3257 {
3258 return true;
3259 }
3260
3261
3263 {
3265 {
3267 }
3268
3270 }
3271
3273 {
3275 }
3276
3277
3278
3280 {
3281 return super.CanReceiveAttachment(attachment, slotId);
3282 }
3283
3285 {
3286 int attachment_count = GetInventory().AttachmentCount();
3287 if ( attachment_count > 0 )
3288 {
3289 if (
HasBase() && attachment_count == 1 )
3290 {
3291 return false;
3292 }
3293
3294 return true;
3295 }
3296
3297 return false;
3298 }
3299
3301 {
3302 return true;
3303 }
3304
3306 {
3307 return false;
3308 }
3309
3310
3312 {
3313 return false;
3314 }
3315
3317 {
3318 return false;
3319 }
3320
3321
3323 {
3324 return false;
3325 }
3326
3327
3328
3330 {
3331 return true;
3332 }
3333
3335 {
3336 return true;
3337 }
3338
3341 {
3342 return false;
3343 }
3344
3345
3347 {
3348 return true;
3349 }
3350
3351
3353 {
3354 return false;
3355 }
3356
3357
3359 {
3360 return true;
3361 }
3362
3363
3365 {
3366 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3367 {
3368 return false;
3369 }
3370
3371 return true;
3372 }
3373
3375 {
3378
3379 return item;
3380 }
3381
3382
3384 {
3386 {
3387
3389
3390
3393
3395 if ( MemoryPointExists( slot_name + "_min" ) )
3396 {
3397 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3398 }
3399 if ( MemoryPointExists( slot_name + "_max" ) )
3400 {
3401 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3402 }
3403
3404
3407
3408
3411 center = ModelToWorld( center );
3412
3413
3416
3417 areaDamage.SetExtents( extents[0], extents[1] );
3418 areaDamage.SetAreaPosition( center );
3419 areaDamage.SetAreaOrientation( orientation );
3422 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3423 areaDamage.SetAmmoName( "BarbedWireHit" );
3424 areaDamage.Spawn();
3425
3427 }
3428 }
3429
3431 {
3432 if ( angle_deg != 0 )
3433 {
3434
3435 orientation[0] = orientation[0] - angle_deg;
3436
3437
3439 if ( MemoryPointExists( "rotate_axis" ) )
3440 {
3441 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3442 }
3443 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];
3444 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];
3445 center[0] = r_center_x;
3446 center[2] = r_center_z;
3447 }
3448 }
3449
3451 {
3453 {
3456 {
3457 if (areaDamage)
3458 {
3459 areaDamage.Destroy();
3460 }
3461
3463 }
3464 }
3465 }
3466
3468 {
3469 return true;
3470 }
3471
3472
3473
3474
3476 {
3478 }
3479
3481 {
3483 }
3484
3486 {
3488 }
3489
3491 {
3493
3494 switch ( material_type )
3495 {
3501 }
3502
3503 return "";
3504 }
3505
3507 {
3509
3510 switch ( material_type )
3511 {
3517 }
3518
3519 return "";
3520 }
3521
3522
3524 {
3526 {
3527
3529 {
3530 SetHealth(slot_name,"Health",item.GetHealth());
3531 }
3532 }
3533 }
3534
3536 {
3537 return 111;
3538 }
3539
3541 {
3542 super.SetActions();
3543
3547 }
3548
3549
3550
3551
3553 {
3554 }
3555
3558 {
3559 return null;
3560 }
3561
3563 {
3565 }
3566
3568 {
3571
3572 Man p;
3573
3574 #ifdef SERVER
3577 if (players.Count())
3578 p = players[0];
3579 #else
3581 #endif
3582
3584 {
3585 bool excluded = false;
3587 if (excludes)
3588 {
3589 foreach (string exclude : excludes)
3590 {
3592 {
3593 excluded = true;
3594 break;
3595 }
3596 }
3597 }
3598
3599 if (!excluded)
3600 {
3602 }
3603 }
3604
3606 }
3607}
3608
3610{
3611#ifdef BSB_DEBUG
3613#else
3614
3615#endif
3616}
3618{
3619#ifdef BSB_DEBUG_SPAM
3621#else
3622
3623#endif
3624}
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.