2404{
2406
2408
2410
2412
2418
2419
2420
2426
2432
2434
2438
2439
2441 {
2443
2444
2445 RegisterNetSyncVariableInt( "m_SyncParts01" );
2446 RegisterNetSyncVariableInt( "m_SyncParts02" );
2447 RegisterNetSyncVariableInt( "m_SyncParts03" );
2448 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2449 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2450 RegisterNetSyncVariableBool( "m_HasBase" );
2451
2452
2454
2455 if (ConfigIsExisting("hybridAttachments"))
2456 {
2459 }
2460 if (ConfigIsExisting("mountables"))
2461 {
2464 }
2465
2467 }
2468
2470 {
2471 super.EEDelete(parent);
2472
2474 {
2475 areaDamage.Destroy();
2476 }
2477
2478 }
2479
2481 {
2482 return "disableBaseDamage";
2483 }
2484
2486 {
2487 return true;
2488 }
2489
2491 {
2492 return EInventoryIconVisibility.HIDE_VICINITY;
2493 }
2494
2495
2497 {
2499 {
2500 SetSynchDirty();
2501 }
2502 }
2503
2505 {
2507 super.OnVariablesSynchronized();
2508
2510 }
2511
2513 {
2514
2516
2517
2519
2520
2522 }
2523
2524
2526 {
2527
2528 int offset;
2529 int mask;
2530
2531 if ( part_id >= 1 && part_id <= 31 )
2532 {
2533 offset = part_id - 1;
2534 mask = 1 << offset;
2535
2537 }
2538 else if ( part_id >= 32 && part_id <= 62 )
2539 {
2540 offset = ( part_id % 32 );
2541 mask = 1 << offset;
2542
2544 }
2545 else if ( part_id >= 63 && part_id <= 93 )
2546 {
2547 offset = ( part_id % 63 );
2548 mask = 1 << offset;
2549
2551 }
2552 }
2553
2555 {
2556
2557 int offset;
2558 int mask;
2559
2560 if ( part_id >= 1 && part_id <= 31 )
2561 {
2562 offset = part_id - 1;
2563 mask = 1 << offset;
2564
2566 }
2567 else if ( part_id >= 32 && part_id <= 62 )
2568 {
2569 offset = ( part_id % 32 );
2570 mask = 1 << offset;
2571
2573 }
2574 else if ( part_id >= 63 && part_id <= 93 )
2575 {
2576 offset = ( part_id % 63 );
2577 mask = 1 << offset;
2578
2580 }
2581 }
2582
2584 {
2585
2586 int offset;
2587 int mask;
2588
2589 if ( part_id >= 1 && part_id <= 31 )
2590 {
2591 offset = part_id - 1;
2592 mask = 1 << offset;
2593
2595 {
2596 return true;
2597 }
2598 }
2599 else if ( part_id >= 32 && part_id <= 62 )
2600 {
2601 offset = ( part_id % 32 );
2602 mask = 1 << offset;
2603
2605 {
2606 return true;
2607 }
2608 }
2609 else if ( part_id >= 63 && part_id <= 93 )
2610 {
2611 offset = ( part_id % 63 );
2612 mask = 1 << offset;
2613
2615 {
2616 return true;
2617 }
2618 }
2619
2620 return false;
2621 }
2622
2624 {
2627 }
2628
2630 {
2631
2634 }
2635
2637 {
2639 {
2642
2643 switch( build_action_id )
2644 {
2648 }
2649 }
2650 }
2651
2652
2654 {
2656 bool is_base = part.
IsBase();
2659 if ( is_part_built_sync )
2660 {
2662 {
2666
2667 if (is_base)
2668 {
2671 }
2672 }
2673 }
2674 else
2675 {
2677 {
2681
2682 if (is_base)
2683 {
2686 }
2687 }
2688 }
2689
2690
2692 }
2693
2694
2696 {
2699
2700 for ( int i = 0; i < construction_parts.Count(); ++i )
2701 {
2702 string key = construction_parts.GetKey( i );
2705 }
2706
2707
2709 }
2710
2712 {
2715
2716 for ( int i = 0; i < construction_parts.Count(); ++i )
2717 {
2718 string key = construction_parts.GetKey( i );
2720
2721 if ( value.
GetId() ==
id )
2722 {
2723 return value;
2724 }
2725 }
2726
2727 return NULL;
2728 }
2729
2730
2731
2733 {
2735 }
2736
2738 {
2740 }
2741
2743 {
2744 return true;
2745 }
2746
2748 {
2749 return false;
2750 }
2751
2752
2754 {
2757 {
2759 }
2760
2761 return construction_kit;
2762 }
2763
2765 {
2768 {
2770 }
2771 }
2772
2774 {
2776 }
2777
2779 {
2780 return "";
2781 }
2782
2784 {
2787 }
2788
2789
2791 {
2794 }
2795
2796
2798 {
2799 super.OnStoreSave( ctx );
2800
2801
2805
2807 }
2808
2810 {
2811 if ( !super.OnStoreLoad( ctx, version ) )
2812 return false;
2813
2814
2815
2817 {
2819 return false;
2820 }
2822 {
2824 return false;
2825 }
2827 {
2829 return false;
2830 }
2831
2832
2834 {
2836 return false;
2837 }
2838
2839
2840 return true;
2841 }
2842
2844 {
2845 super.AfterStoreLoad();
2846
2848 {
2850 }
2851 }
2852
2854 {
2855
2857
2858
2861
2862
2864 }
2865
2867 {
2868 super.OnCreatePhysics();
2871 }
2872
2874 {
2876 return;
2877
2878 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2879
2881 return;
2882
2884 string part_name = zone;
2886
2888 {
2889 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2890
2891 if ( construction_part && construction.IsPartConstructed( part_name ) )
2892 {
2894 construction.DestroyConnectedParts(part_name);
2895 }
2896
2897
2898 if ( part_name.
Contains(
"barbed") )
2899 {
2900 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2901 if (barbed_wire)
2902 barbed_wire.SetMountedState( false );
2903 }
2904 }
2905 }
2906
2908 {
2910 {
2912 }
2913
2914 super.EEOnAfterLoad();
2915 }
2916
2918 {
2919 super.EEInit();
2920
2921
2923
2924
2925 #ifdef DEVELOPER
2927 #endif
2928 }
2929
2931 {
2932 super.EEItemAttached( item, slot_name );
2933
2937 }
2938
2940 {
2941 super.EEItemDetached( item, slot_name );
2942
2945 }
2946
2947 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2948 {
2951
2954 }
2955
2956
2958 {
2959 return true;
2960 }
2961
2962
2963
2965 {
2967
2968
2969 if (construtionPart.
IsBase())
2970 {
2972
2973
2975 }
2976
2977
2979
2980
2982
2983
2985
2987
2989
2990
2992
2993
2995 }
2996
2998 {
2999
3001 }
3002
3003
3005 {
3008
3009
3011
3012
3014
3015
3017
3018
3020
3022
3023
3025
3026
3028
3029
3030 if (construtionPart.
IsBase())
3031 {
3032
3034 }
3035
3038 }
3039
3041 {
3042
3044 }
3045
3046
3047 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3048 {
3051
3052
3054
3055
3057
3058
3060
3061
3063
3065
3066
3068
3069
3071
3072
3073 if (construtionPart.
IsBase())
3074 {
3075
3077 }
3078
3081 }
3082
3084 {
3085
3087 }
3088
3090 {
3091 bool process = false;
3092
3093
3097
3098 if (process)
3099 {
3100 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3101 {
3103 return;
3104 }
3105
3107 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3108 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3109
3110
3112 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3113 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3114 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3115 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3116 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3117 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3118 mins = minTmp;
3119 maxs = maxTmp;
3120
3121 maxs[1] = maxs[1] + 0.35;
3122
3124 }
3125 }
3126
3128 {
3131
3132
3134 foreach (
EntityAI entity : foundEntities)
3135 {
3138 }
3139 }
3140
3141
3143 {
3145
3149 }
3150
3152 {
3154
3156 {
3158 }
3159 else
3160 {
3162 }
3163
3165 }
3166
3168 {
3170
3172 foreach (
string slotName : attachmentSlots)
3173 {
3175 }
3176
3177
3180 else
3182
3184 }
3185
3187 {
3188 string slotNameMounted = slot_name + "_Mounted";
3189 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3190
3191 if (attachment)
3192 {
3193 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3194 if (barbedWire && barbedWire.IsMounted())
3196 else
3198
3199 if (is_locked)
3200 {
3201 SetAnimationPhase(slotNameMounted, 0);
3202 SetAnimationPhase(slot_name, 1);
3203 }
3204 else
3205 {
3206 SetAnimationPhase(slotNameMounted, 1);
3207 SetAnimationPhase(slot_name, 0);
3208 }
3209 }
3210 else
3211 {
3212 SetAnimationPhase(slotNameMounted, 1);
3213 SetAnimationPhase(slot_name, 1);
3214
3216 }
3217 }
3218
3219
3221 {
3224
3227
3230
3231 foreach (
string slotName : attachmentSlots)
3232 {
3234 }
3235
3236
3238 {
3241
3243 }
3244 else
3245 {
3248
3250 }
3251
3254 }
3255
3257 {
3258
3260 return;
3261
3262 string slot_name_mounted = slot_name + "_Mounted";
3263 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3264
3265
3267 RemoveProxyPhysics( slot_name_mounted );
3268 RemoveProxyPhysics( slot_name );
3269
3270 if ( attachment )
3271 {
3273 if ( is_locked )
3274 {
3276 AddProxyPhysics( slot_name_mounted );
3277 }
3278 else
3279 {
3281 AddProxyPhysics( slot_name );
3282 }
3283 }
3284 }
3285
3287 {
3288 SetAffectPathgraph( true, false );
3290 }
3291
3293 {
3294 return true;
3295 }
3296
3298 {
3299 return true;
3300 }
3301
3303 {
3304 if ( attachment )
3305 {
3307 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3308
3309 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3310 }
3311
3312 return false;
3313 }
3314
3316 {
3318 }
3319
3320
3322 {
3323 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3324 if (
GetGame().ConfigIsExisting( config_path ) )
3325 {
3327 }
3328 }
3329
3331 {
3332 return true;
3333 }
3334
3336 {
3337 return true;
3338 }
3339
3341 {
3342 return true;
3343 }
3344
3345
3347 {
3349 {
3351 }
3352
3354 }
3355
3357 {
3359 }
3360
3361
3362
3364 {
3365 return super.CanReceiveAttachment(attachment, slotId);
3366 }
3367
3369 {
3370 int attachment_count = GetInventory().AttachmentCount();
3371 if ( attachment_count > 0 )
3372 {
3373 if (
HasBase() && attachment_count == 1 )
3374 {
3375 return false;
3376 }
3377
3378 return true;
3379 }
3380
3381 return false;
3382 }
3383
3385 {
3386 return true;
3387 }
3388
3390 {
3391 return false;
3392 }
3393
3394
3396 {
3397 return false;
3398 }
3399
3401 {
3402 return false;
3403 }
3404
3405
3407 {
3408 return false;
3409 }
3410
3411
3412
3414 {
3415 return true;
3416 }
3417
3419 {
3420 return true;
3421 }
3422
3425 {
3426 return false;
3427 }
3428
3429
3431 {
3432 return true;
3433 }
3434
3435
3437 {
3438 return false;
3439 }
3440
3441
3443 {
3444 return true;
3445 }
3446
3447
3449 {
3450 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3451 {
3452 return false;
3453 }
3454
3455 return true;
3456 }
3457
3459 {
3462
3463 return item;
3464 }
3465
3466
3468 {
3470 {
3471
3473
3474
3477
3479 if ( MemoryPointExists( slot_name + "_min" ) )
3480 {
3481 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3482 }
3483 if ( MemoryPointExists( slot_name + "_max" ) )
3484 {
3485 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3486 }
3487
3488
3491
3492
3495 center = ModelToWorld( center );
3496
3497
3500
3501 areaDamage.SetExtents( extents[0], extents[1] );
3502 areaDamage.SetAreaPosition( center );
3503 areaDamage.SetAreaOrientation( orientation );
3506 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3507 areaDamage.SetAmmoName( "BarbedWireHit" );
3508 areaDamage.Spawn();
3509
3511 }
3512 }
3513
3515 {
3516 if ( angle_deg != 0 )
3517 {
3518
3519 orientation[0] = orientation[0] - angle_deg;
3520
3521
3523 if ( MemoryPointExists( "rotate_axis" ) )
3524 {
3525 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3526 }
3527 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];
3528 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];
3529 center[0] = r_center_x;
3530 center[2] = r_center_z;
3531 }
3532 }
3533
3535 {
3537 {
3540 {
3541 if (areaDamage)
3542 {
3543 areaDamage.Destroy();
3544 }
3545
3547 }
3548 }
3549 }
3550
3552 {
3553 return true;
3554 }
3555
3556
3557
3558
3560 {
3562 }
3563
3565 {
3567 }
3568
3570 {
3572 }
3573
3575 {
3577
3578 switch ( material_type )
3579 {
3585 }
3586
3587 return "";
3588 }
3589
3591 {
3593
3594 switch ( material_type )
3595 {
3601 }
3602
3603 return "";
3604 }
3605
3606
3608 {
3610 {
3611
3613 {
3614 SetHealth(slot_name,"Health",item.GetHealth());
3615 }
3616 }
3617 }
3618
3620 {
3621 return 111;
3622 }
3623
3625 {
3626 super.SetActions();
3627
3631 }
3632
3633
3634
3635
3637 {
3638 }
3639
3642 {
3643 return null;
3644 }
3645
3647 {
3649 }
3650
3652 {
3655
3656 Man p;
3657
3658 #ifdef SERVER
3661 if (players.Count())
3662 p = players[0];
3663 #else
3665 #endif
3666
3668 {
3669 bool excluded = false;
3671 if (excludes)
3672 {
3673 foreach (string exclude : excludes)
3674 {
3676 {
3677 excluded = true;
3678 break;
3679 }
3680 }
3681 }
3682
3683 if (!excluded)
3684 {
3686 }
3687 }
3688
3690 }
3691}
3692
3694{
3695#ifdef BSB_DEBUG
3697#else
3698
3699#endif
3700}
3702{
3703#ifdef BSB_DEBUG_SPAM
3705#else
3706
3707#endif
3708}
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.