2509{
2511
2513
2515
2517
2523
2524
2525
2531
2537
2539
2543
2544
2546 {
2548
2549
2550 RegisterNetSyncVariableInt( "m_SyncParts01" );
2551 RegisterNetSyncVariableInt( "m_SyncParts02" );
2552 RegisterNetSyncVariableInt( "m_SyncParts03" );
2553 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2554 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2555 RegisterNetSyncVariableBool( "m_HasBase" );
2556
2557
2559
2560 if (ConfigIsExisting("hybridAttachments"))
2561 {
2564 }
2565 if (ConfigIsExisting("mountables"))
2566 {
2569 }
2570
2572 }
2573
2575 {
2576 super.EEDelete(parent);
2577
2579 {
2580 areaDamage.Destroy();
2581 }
2582
2583 }
2584
2586 {
2587 return "disableBaseDamage";
2588 }
2589
2591 {
2592 return true;
2593 }
2594
2596 {
2597 return EInventoryIconVisibility.HIDE_VICINITY;
2598 }
2599
2600
2602 {
2604 {
2605 SetSynchDirty();
2606 }
2607 }
2608
2610 {
2612 super.OnVariablesSynchronized();
2613
2615 }
2616
2618 {
2619
2621
2622
2624
2625
2627 }
2628
2629
2631 {
2632
2633 int offset;
2634 int mask;
2635
2636 if ( part_id >= 1 && part_id <= 31 )
2637 {
2638 offset = part_id - 1;
2639 mask = 1 << offset;
2640
2642 }
2643 else if ( part_id >= 32 && part_id <= 62 )
2644 {
2645 offset = ( part_id % 32 );
2646 mask = 1 << offset;
2647
2649 }
2650 else if ( part_id >= 63 && part_id <= 93 )
2651 {
2652 offset = ( part_id % 63 );
2653 mask = 1 << offset;
2654
2656 }
2657 }
2658
2660 {
2661
2662 int offset;
2663 int mask;
2664
2665 if ( part_id >= 1 && part_id <= 31 )
2666 {
2667 offset = part_id - 1;
2668 mask = 1 << offset;
2669
2671 }
2672 else if ( part_id >= 32 && part_id <= 62 )
2673 {
2674 offset = ( part_id % 32 );
2675 mask = 1 << offset;
2676
2678 }
2679 else if ( part_id >= 63 && part_id <= 93 )
2680 {
2681 offset = ( part_id % 63 );
2682 mask = 1 << offset;
2683
2685 }
2686 }
2687
2689 {
2690
2691 int offset;
2692 int mask;
2693
2694 if ( part_id >= 1 && part_id <= 31 )
2695 {
2696 offset = part_id - 1;
2697 mask = 1 << offset;
2698
2700 {
2701 return true;
2702 }
2703 }
2704 else if ( part_id >= 32 && part_id <= 62 )
2705 {
2706 offset = ( part_id % 32 );
2707 mask = 1 << offset;
2708
2710 {
2711 return true;
2712 }
2713 }
2714 else if ( part_id >= 63 && part_id <= 93 )
2715 {
2716 offset = ( part_id % 63 );
2717 mask = 1 << offset;
2718
2720 {
2721 return true;
2722 }
2723 }
2724
2725 return false;
2726 }
2727
2729 {
2732 }
2733
2735 {
2736
2739 }
2740
2742 {
2744 {
2747
2748 switch( build_action_id )
2749 {
2753 }
2754 }
2755 }
2756
2757
2759 {
2761 bool is_base = part.
IsBase();
2764 if ( is_part_built_sync )
2765 {
2767 {
2771
2772 if (is_base)
2773 {
2776 }
2777 }
2778 }
2779 else
2780 {
2782 {
2786
2787 if (is_base)
2788 {
2791 }
2792 }
2793 }
2794
2795
2797 }
2798
2799
2801 {
2804
2805 for ( int i = 0; i < construction_parts.Count(); ++i )
2806 {
2807 string key = construction_parts.GetKey( i );
2810 }
2811
2812
2814 }
2815
2817 {
2820
2821 for ( int i = 0; i < construction_parts.Count(); ++i )
2822 {
2823 string key = construction_parts.GetKey( i );
2825
2826 if ( value.
GetId() ==
id )
2827 {
2828 return value;
2829 }
2830 }
2831
2832 return NULL;
2833 }
2834
2835
2836
2838 {
2840 }
2841
2843 {
2845 }
2846
2848 {
2849 return true;
2850 }
2851
2853 {
2854 return false;
2855 }
2856
2857
2859 {
2862 {
2864 }
2865
2866 return construction_kit;
2867 }
2868
2870 {
2873 {
2875 }
2876 }
2877
2879 {
2881 }
2882
2884 {
2885 return "";
2886 }
2887
2889 {
2892 }
2893
2894
2896 {
2899 }
2900
2901
2903 {
2904 super.OnStoreSave( ctx );
2905
2906
2910
2912 }
2913
2915 {
2916 if ( !super.OnStoreLoad( ctx, version ) )
2917 return false;
2918
2919
2920
2922 {
2924 return false;
2925 }
2927 {
2929 return false;
2930 }
2932 {
2934 return false;
2935 }
2936
2937
2939 {
2941 return false;
2942 }
2943
2944
2945 return true;
2946 }
2947
2949 {
2950 super.AfterStoreLoad();
2951
2953 {
2955 }
2956 }
2957
2959 {
2960
2962
2963
2966
2967
2969 }
2970
2972 {
2973 super.OnCreatePhysics();
2976 }
2977
2979 {
2981 return;
2982
2983 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2984
2986 return;
2987
2989 string part_name = zone;
2991
2993 {
2994 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2995
2996 if ( construction_part && construction.IsPartConstructed( part_name ) )
2997 {
2999 construction.DestroyConnectedParts(part_name);
3000 }
3001
3002
3003 if ( part_name.
Contains(
"barbed") )
3004 {
3005 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3006 if (barbed_wire)
3007 barbed_wire.SetMountedState( false );
3008 }
3009 }
3010 }
3011
3013 {
3015 {
3017 }
3018
3019 super.EEOnAfterLoad();
3020 }
3021
3023 {
3024 super.EEInit();
3025
3026
3028
3029
3030 #ifdef DEVELOPER
3032 #endif
3033 }
3034
3036 {
3037 super.EEItemAttached( item, slot_name );
3038
3042 }
3043
3045 {
3046 super.EEItemDetached( item, slot_name );
3047
3050 }
3051
3052 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3053 {
3056
3059 }
3060
3061
3063 {
3064 return true;
3065 }
3066
3067
3068
3070 {
3072
3073
3074 if (construtionPart.
IsBase())
3075 {
3077
3078
3080 }
3081
3082
3084
3085
3087
3088
3090
3092
3094
3095
3097
3098
3100 }
3101
3103 {
3104
3106 }
3107
3108
3110 {
3113
3114
3116
3117
3119
3120
3122
3123
3125
3127
3128
3130
3131
3133
3134
3135 if (construtionPart.
IsBase())
3136 {
3137
3139 }
3140
3143 }
3144
3146 {
3147
3149 }
3150
3151
3152 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3153 {
3156
3157
3159
3160
3162
3163
3165
3166
3168
3170
3171
3173
3174
3176
3177
3178 if (construtionPart.
IsBase())
3179 {
3180
3182 }
3183
3186 }
3187
3189 {
3190
3192 }
3193
3195 {
3196 bool process = false;
3197
3198
3202
3203 if (process)
3204 {
3205 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3206 {
3208 return;
3209 }
3210
3212 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3213 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3214
3215
3217 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3218 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3219 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3220 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3221 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3222 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3223 mins = minTmp;
3224 maxs = maxTmp;
3225
3226 maxs[1] = maxs[1] + 0.35;
3227
3229 }
3230 }
3231
3233 {
3236
3237
3239 foreach (
EntityAI entity : foundEntities)
3240 {
3243 }
3244 }
3245
3246
3248 {
3250
3254 }
3255
3257 {
3259
3261 {
3263 }
3264 else
3265 {
3267 }
3268
3270 }
3271
3273 {
3275
3277 foreach (
string slotName : attachmentSlots)
3278 {
3280 }
3281
3282
3285 else
3287
3289 }
3290
3292 {
3293 string slotNameMounted = slot_name + "_Mounted";
3294 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3295
3296 if (attachment)
3297 {
3298 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3299 if (barbedWire && barbedWire.IsMounted())
3301 else
3303
3304 if (is_locked)
3305 {
3306 SetAnimationPhase(slotNameMounted, 0);
3307 SetAnimationPhase(slot_name, 1);
3308 }
3309 else
3310 {
3311 SetAnimationPhase(slotNameMounted, 1);
3312 SetAnimationPhase(slot_name, 0);
3313 }
3314 }
3315 else
3316 {
3317 SetAnimationPhase(slotNameMounted, 1);
3318 SetAnimationPhase(slot_name, 1);
3319
3321 }
3322 }
3323
3324
3326 {
3329
3332
3335
3336 foreach (
string slotName : attachmentSlots)
3337 {
3339 }
3340
3341
3343 {
3346
3348 }
3349 else
3350 {
3353
3355 }
3356
3359 }
3360
3362 {
3363
3365 return;
3366
3367 string slot_name_mounted = slot_name + "_Mounted";
3368 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3369
3370
3372 RemoveProxyPhysics( slot_name_mounted );
3373 RemoveProxyPhysics( slot_name );
3374
3375 if ( attachment )
3376 {
3378 if ( is_locked )
3379 {
3381 AddProxyPhysics( slot_name_mounted );
3382 }
3383 else
3384 {
3386 AddProxyPhysics( slot_name );
3387 }
3388 }
3389 }
3390
3392 {
3393 SetAffectPathgraph( true, false );
3395 }
3396
3398 {
3399 return true;
3400 }
3401
3403 {
3404 return true;
3405 }
3406
3408 {
3409 if ( attachment )
3410 {
3412 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3413
3414 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3415 }
3416
3417 return false;
3418 }
3419
3421 {
3423 }
3424
3425
3427 {
3428 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3429 if (
GetGame().ConfigIsExisting( config_path ) )
3430 {
3432 }
3433 }
3434
3436 {
3437 return true;
3438 }
3439
3441 {
3442 return true;
3443 }
3444
3446 {
3447 return true;
3448 }
3449
3450
3452 {
3454 {
3456 }
3457
3459 }
3460
3462 {
3464 }
3465
3466
3467
3469 {
3470 return super.CanReceiveAttachment(attachment, slotId);
3471 }
3472
3474 {
3475 int attachment_count = GetInventory().AttachmentCount();
3476 if ( attachment_count > 0 )
3477 {
3478 if (
HasBase() && attachment_count == 1 )
3479 {
3480 return false;
3481 }
3482
3483 return true;
3484 }
3485
3486 return false;
3487 }
3488
3490 {
3491 return true;
3492 }
3493
3495 {
3496 return false;
3497 }
3498
3499
3501 {
3502 return false;
3503 }
3504
3506 {
3507 return false;
3508 }
3509
3510
3512 {
3513 return false;
3514 }
3515
3516
3517
3519 {
3520 return true;
3521 }
3522
3524 {
3525 return true;
3526 }
3527
3530 {
3531 return false;
3532 }
3533
3534
3536 {
3537 return true;
3538 }
3539
3540
3542 {
3543 return false;
3544 }
3545
3546
3548 {
3549 return true;
3550 }
3551
3552
3554 {
3555 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3556 {
3557 return false;
3558 }
3559
3560 return true;
3561 }
3562
3564 {
3567
3568 return item;
3569 }
3570
3571
3573 {
3575 {
3576
3578
3579
3582
3584 if ( MemoryPointExists( slot_name + "_min" ) )
3585 {
3586 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3587 }
3588 if ( MemoryPointExists( slot_name + "_max" ) )
3589 {
3590 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3591 }
3592
3593
3596
3597
3600 center = ModelToWorld( center );
3601
3602
3605
3606 areaDamage.SetExtents( extents[0], extents[1] );
3607 areaDamage.SetAreaPosition( center );
3608 areaDamage.SetAreaOrientation( orientation );
3611 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3612 areaDamage.SetAmmoName( "BarbedWireHit" );
3613 areaDamage.Spawn();
3614
3616 }
3617 }
3618
3620 {
3621 if ( angle_deg != 0 )
3622 {
3623
3624 orientation[0] = orientation[0] - angle_deg;
3625
3626
3628 if ( MemoryPointExists( "rotate_axis" ) )
3629 {
3630 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3631 }
3632 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];
3633 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];
3634 center[0] = r_center_x;
3635 center[2] = r_center_z;
3636 }
3637 }
3638
3640 {
3642 {
3645 {
3646 if (areaDamage)
3647 {
3648 areaDamage.Destroy();
3649 }
3650
3652 }
3653 }
3654 }
3655
3657 {
3658 return true;
3659 }
3660
3661
3662
3663
3665 {
3667 }
3668
3670 {
3672 }
3673
3675 {
3677 }
3678
3680 {
3682
3683 switch ( material_type )
3684 {
3690 }
3691
3692 return "";
3693 }
3694
3696 {
3698
3699 switch ( material_type )
3700 {
3706 }
3707
3708 return "";
3709 }
3710
3711
3713 {
3715 {
3716
3718 {
3719 SetHealth(slot_name,"Health",item.GetHealth());
3720 }
3721 }
3722 }
3723
3725 {
3726 return 111;
3727 }
3728
3730 {
3731 super.SetActions();
3732
3736 }
3737
3738
3739
3740
3742 {
3743 }
3744
3747 {
3748 return null;
3749 }
3750
3752 {
3754 }
3755
3757 {
3760
3761 Man p;
3762
3763 #ifdef SERVER
3766 if (players.Count())
3767 p = players[0];
3768 #else
3770 #endif
3771
3773 {
3774 bool excluded = false;
3776 if (excludes)
3777 {
3778 foreach (string exclude : excludes)
3779 {
3781 {
3782 excluded = true;
3783 break;
3784 }
3785 }
3786 }
3787
3788 if (!excluded)
3789 {
3791 }
3792 }
3793
3795 }
3796}
3797
3799{
3800#ifdef BSB_DEBUG
3802#else
3803
3804#endif
3805}
3807{
3808#ifdef BSB_DEBUG_SPAM
3810#else
3811
3812#endif
3813}
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.