2497{
2499
2501
2503
2505
2511
2512
2513
2519
2525
2527
2531
2532
2534 {
2536
2537
2538 RegisterNetSyncVariableInt( "m_SyncParts01" );
2539 RegisterNetSyncVariableInt( "m_SyncParts02" );
2540 RegisterNetSyncVariableInt( "m_SyncParts03" );
2541 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2542 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2543 RegisterNetSyncVariableBool( "m_HasBase" );
2544
2545
2547
2548 if (ConfigIsExisting("hybridAttachments"))
2549 {
2552 }
2553 if (ConfigIsExisting("mountables"))
2554 {
2557 }
2558
2560 }
2561
2563 {
2564 super.EEDelete(parent);
2565
2567 {
2568 areaDamage.Destroy();
2569 }
2570
2571 }
2572
2574 {
2575 return "disableBaseDamage";
2576 }
2577
2579 {
2580 return true;
2581 }
2582
2584 {
2585 return EInventoryIconVisibility.HIDE_VICINITY;
2586 }
2587
2588
2590 {
2592 {
2593 SetSynchDirty();
2594 }
2595 }
2596
2598 {
2600 super.OnVariablesSynchronized();
2601
2603 }
2604
2606 {
2607
2609
2610
2612
2613
2615 }
2616
2617
2619 {
2620
2621 int offset;
2622 int mask;
2623
2624 if ( part_id >= 1 && part_id <= 31 )
2625 {
2626 offset = part_id - 1;
2627 mask = 1 << offset;
2628
2630 }
2631 else if ( part_id >= 32 && part_id <= 62 )
2632 {
2633 offset = ( part_id % 32 );
2634 mask = 1 << offset;
2635
2637 }
2638 else if ( part_id >= 63 && part_id <= 93 )
2639 {
2640 offset = ( part_id % 63 );
2641 mask = 1 << offset;
2642
2644 }
2645 }
2646
2648 {
2649
2650 int offset;
2651 int mask;
2652
2653 if ( part_id >= 1 && part_id <= 31 )
2654 {
2655 offset = part_id - 1;
2656 mask = 1 << offset;
2657
2659 }
2660 else if ( part_id >= 32 && part_id <= 62 )
2661 {
2662 offset = ( part_id % 32 );
2663 mask = 1 << offset;
2664
2666 }
2667 else if ( part_id >= 63 && part_id <= 93 )
2668 {
2669 offset = ( part_id % 63 );
2670 mask = 1 << offset;
2671
2673 }
2674 }
2675
2677 {
2678
2679 int offset;
2680 int mask;
2681
2682 if ( part_id >= 1 && part_id <= 31 )
2683 {
2684 offset = part_id - 1;
2685 mask = 1 << offset;
2686
2688 {
2689 return true;
2690 }
2691 }
2692 else if ( part_id >= 32 && part_id <= 62 )
2693 {
2694 offset = ( part_id % 32 );
2695 mask = 1 << offset;
2696
2698 {
2699 return true;
2700 }
2701 }
2702 else if ( part_id >= 63 && part_id <= 93 )
2703 {
2704 offset = ( part_id % 63 );
2705 mask = 1 << offset;
2706
2708 {
2709 return true;
2710 }
2711 }
2712
2713 return false;
2714 }
2715
2717 {
2720 }
2721
2723 {
2724
2727 }
2728
2730 {
2732 {
2735
2736 switch( build_action_id )
2737 {
2741 }
2742 }
2743 }
2744
2745
2747 {
2749 bool is_base = part.
IsBase();
2752 if ( is_part_built_sync )
2753 {
2755 {
2759
2760 if (is_base)
2761 {
2764 }
2765 }
2766 }
2767 else
2768 {
2770 {
2774
2775 if (is_base)
2776 {
2779 }
2780 }
2781 }
2782
2783
2785 }
2786
2787
2789 {
2792
2793 for ( int i = 0; i < construction_parts.Count(); ++i )
2794 {
2795 string key = construction_parts.GetKey( i );
2798 }
2799
2800
2802 }
2803
2805 {
2808
2809 for ( int i = 0; i < construction_parts.Count(); ++i )
2810 {
2811 string key = construction_parts.GetKey( i );
2813
2814 if ( value.
GetId() ==
id )
2815 {
2816 return value;
2817 }
2818 }
2819
2820 return NULL;
2821 }
2822
2823
2824
2826 {
2828 }
2829
2831 {
2833 }
2834
2836 {
2837 return true;
2838 }
2839
2841 {
2842 return false;
2843 }
2844
2845
2847 {
2850 {
2852 }
2853
2854 return construction_kit;
2855 }
2856
2858 {
2861 {
2863 }
2864 }
2865
2867 {
2869 }
2870
2872 {
2873 return "";
2874 }
2875
2877 {
2880 }
2881
2882
2884 {
2887 }
2888
2889
2891 {
2892 super.OnStoreSave( ctx );
2893
2894
2898
2900 }
2901
2903 {
2904 if ( !super.OnStoreLoad( ctx, version ) )
2905 return false;
2906
2907
2908
2910 {
2912 return false;
2913 }
2915 {
2917 return false;
2918 }
2920 {
2922 return false;
2923 }
2924
2925
2927 {
2929 return false;
2930 }
2931
2932
2933 return true;
2934 }
2935
2937 {
2938 super.AfterStoreLoad();
2939
2941 {
2943 }
2944 }
2945
2947 {
2948
2950
2951
2954
2955
2957 }
2958
2960 {
2961 super.OnCreatePhysics();
2964 }
2965
2967 {
2969 return;
2970
2971 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2972
2974 return;
2975
2977 string part_name = zone;
2979
2981 {
2982 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2983
2984 if ( construction_part && construction.IsPartConstructed( part_name ) )
2985 {
2987 construction.DestroyConnectedParts(part_name);
2988 }
2989
2990
2991 if ( part_name.
Contains(
"barbed") )
2992 {
2993 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2994 if (barbed_wire)
2995 barbed_wire.SetMountedState( false );
2996 }
2997 }
2998 }
2999
3001 {
3003 {
3005 }
3006
3007 super.EEOnAfterLoad();
3008 }
3009
3011 {
3012 super.EEInit();
3013
3014
3016
3017
3018 #ifdef DEVELOPER
3020 #endif
3021 }
3022
3024 {
3025 super.EEItemAttached( item, slot_name );
3026
3030 }
3031
3033 {
3034 super.EEItemDetached( item, slot_name );
3035
3038 }
3039
3040 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3041 {
3044
3047 }
3048
3049
3051 {
3052 return true;
3053 }
3054
3055
3056
3058 {
3060
3061
3062 if (construtionPart.
IsBase())
3063 {
3065
3066
3068 }
3069
3070
3072
3073
3075
3076
3078
3080
3082
3083
3085
3086
3088 }
3089
3091 {
3092
3094 }
3095
3096
3098 {
3101
3102
3104
3105
3107
3108
3110
3111
3113
3115
3116
3118
3119
3121
3122
3123 if (construtionPart.
IsBase())
3124 {
3125
3127 }
3128
3131 }
3132
3134 {
3135
3137 }
3138
3139
3140 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3141 {
3144
3145
3147
3148
3150
3151
3153
3154
3156
3158
3159
3161
3162
3164
3165
3166 if (construtionPart.
IsBase())
3167 {
3168
3170 }
3171
3174 }
3175
3177 {
3178
3180 }
3181
3183 {
3184 bool process = false;
3185
3186
3190
3191 if (process)
3192 {
3193 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3194 {
3196 return;
3197 }
3198
3200 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3201 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3202
3203
3205 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3206 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3207 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3208 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3209 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3210 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3211 mins = minTmp;
3212 maxs = maxTmp;
3213
3214 maxs[1] = maxs[1] + 0.35;
3215
3217 }
3218 }
3219
3221 {
3224
3225
3227 foreach (
EntityAI entity : foundEntities)
3228 {
3231 }
3232 }
3233
3234
3236 {
3238
3242 }
3243
3245 {
3247
3249 {
3251 }
3252 else
3253 {
3255 }
3256
3258 }
3259
3261 {
3263
3265 foreach (
string slotName : attachmentSlots)
3266 {
3268 }
3269
3270
3273 else
3275
3277 }
3278
3280 {
3281 string slotNameMounted = slot_name + "_Mounted";
3282 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3283
3284 if (attachment)
3285 {
3286 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3287 if (barbedWire && barbedWire.IsMounted())
3289 else
3291
3292 if (is_locked)
3293 {
3294 SetAnimationPhase(slotNameMounted, 0);
3295 SetAnimationPhase(slot_name, 1);
3296 }
3297 else
3298 {
3299 SetAnimationPhase(slotNameMounted, 1);
3300 SetAnimationPhase(slot_name, 0);
3301 }
3302 }
3303 else
3304 {
3305 SetAnimationPhase(slotNameMounted, 1);
3306 SetAnimationPhase(slot_name, 1);
3307
3309 }
3310 }
3311
3312
3314 {
3317
3320
3323
3324 foreach (
string slotName : attachmentSlots)
3325 {
3327 }
3328
3329
3331 {
3334
3336 }
3337 else
3338 {
3341
3343 }
3344
3347 }
3348
3350 {
3351
3353 return;
3354
3355 string slot_name_mounted = slot_name + "_Mounted";
3356 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3357
3358
3360 RemoveProxyPhysics( slot_name_mounted );
3361 RemoveProxyPhysics( slot_name );
3362
3363 if ( attachment )
3364 {
3366 if ( is_locked )
3367 {
3369 AddProxyPhysics( slot_name_mounted );
3370 }
3371 else
3372 {
3374 AddProxyPhysics( slot_name );
3375 }
3376 }
3377 }
3378
3380 {
3381 SetAffectPathgraph( true, false );
3383 }
3384
3386 {
3387 return true;
3388 }
3389
3391 {
3392 return true;
3393 }
3394
3396 {
3397 if ( attachment )
3398 {
3400 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3401
3402 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3403 }
3404
3405 return false;
3406 }
3407
3409 {
3411 }
3412
3413
3415 {
3416 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3417 if (
GetGame().ConfigIsExisting( config_path ) )
3418 {
3420 }
3421 }
3422
3424 {
3425 return true;
3426 }
3427
3429 {
3430 return true;
3431 }
3432
3434 {
3435 return true;
3436 }
3437
3438
3440 {
3442 {
3444 }
3445
3447 }
3448
3450 {
3452 }
3453
3454
3455
3457 {
3458 return super.CanReceiveAttachment(attachment, slotId);
3459 }
3460
3462 {
3463 int attachment_count = GetInventory().AttachmentCount();
3464 if ( attachment_count > 0 )
3465 {
3466 if (
HasBase() && attachment_count == 1 )
3467 {
3468 return false;
3469 }
3470
3471 return true;
3472 }
3473
3474 return false;
3475 }
3476
3478 {
3479 return true;
3480 }
3481
3483 {
3484 return false;
3485 }
3486
3487
3489 {
3490 return false;
3491 }
3492
3494 {
3495 return false;
3496 }
3497
3498
3500 {
3501 return false;
3502 }
3503
3504
3505
3507 {
3508 return true;
3509 }
3510
3512 {
3513 return true;
3514 }
3515
3518 {
3519 return false;
3520 }
3521
3522
3524 {
3525 return true;
3526 }
3527
3528
3530 {
3531 return false;
3532 }
3533
3534
3536 {
3537 return true;
3538 }
3539
3540
3542 {
3543 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3544 {
3545 return false;
3546 }
3547
3548 return true;
3549 }
3550
3552 {
3555
3556 return item;
3557 }
3558
3559
3561 {
3563 {
3564
3566
3567
3570
3572 if ( MemoryPointExists( slot_name + "_min" ) )
3573 {
3574 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3575 }
3576 if ( MemoryPointExists( slot_name + "_max" ) )
3577 {
3578 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3579 }
3580
3581
3584
3585
3588 center = ModelToWorld( center );
3589
3590
3593
3594 areaDamage.SetExtents( extents[0], extents[1] );
3595 areaDamage.SetAreaPosition( center );
3596 areaDamage.SetAreaOrientation( orientation );
3599 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3600 areaDamage.SetAmmoName( "BarbedWireHit" );
3601 areaDamage.Spawn();
3602
3604 }
3605 }
3606
3608 {
3609 if ( angle_deg != 0 )
3610 {
3611
3612 orientation[0] = orientation[0] - angle_deg;
3613
3614
3616 if ( MemoryPointExists( "rotate_axis" ) )
3617 {
3618 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3619 }
3620 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];
3621 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];
3622 center[0] = r_center_x;
3623 center[2] = r_center_z;
3624 }
3625 }
3626
3628 {
3630 {
3633 {
3634 if (areaDamage)
3635 {
3636 areaDamage.Destroy();
3637 }
3638
3640 }
3641 }
3642 }
3643
3645 {
3646 return true;
3647 }
3648
3649
3650
3651
3653 {
3655 }
3656
3658 {
3660 }
3661
3663 {
3665 }
3666
3668 {
3670
3671 switch ( material_type )
3672 {
3678 }
3679
3680 return "";
3681 }
3682
3684 {
3686
3687 switch ( material_type )
3688 {
3694 }
3695
3696 return "";
3697 }
3698
3699
3701 {
3703 {
3704
3706 {
3707 SetHealth(slot_name,"Health",item.GetHealth());
3708 }
3709 }
3710 }
3711
3713 {
3714 return 111;
3715 }
3716
3718 {
3719 super.SetActions();
3720
3724 }
3725
3726
3727
3728
3730 {
3731 }
3732
3735 {
3736 return null;
3737 }
3738
3740 {
3742 }
3743
3745 {
3748
3749 Man p;
3750
3751 #ifdef SERVER
3754 if (players.Count())
3755 p = players[0];
3756 #else
3758 #endif
3759
3761 {
3762 bool excluded = false;
3764 if (excludes)
3765 {
3766 foreach (string exclude : excludes)
3767 {
3769 {
3770 excluded = true;
3771 break;
3772 }
3773 }
3774 }
3775
3776 if (!excluded)
3777 {
3779 }
3780 }
3781
3783 }
3784}
3785
3787{
3788#ifdef BSB_DEBUG
3790#else
3791
3792#endif
3793}
3795{
3796#ifdef BSB_DEBUG_SPAM
3798#else
3799
3800#endif
3801}
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.