Excludes certain parts from being built by OnDebugSpawn, uses Contains to compare.
2531{
2533
2535
2537
2539
2545
2546
2547
2553
2559
2561
2565
2566
2568 {
2570
2571
2572 RegisterNetSyncVariableInt( "m_SyncParts01" );
2573 RegisterNetSyncVariableInt( "m_SyncParts02" );
2574 RegisterNetSyncVariableInt( "m_SyncParts03" );
2575 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2576 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2577 RegisterNetSyncVariableBool( "m_HasBase" );
2578
2579
2581
2582 if (ConfigIsExisting("hybridAttachments"))
2583 {
2586 }
2587 if (ConfigIsExisting("mountables"))
2588 {
2591 }
2592
2594 }
2595
2597 {
2598 super.EEDelete(parent);
2599
2601 {
2602 areaDamage.Destroy();
2603 }
2604
2605 }
2606
2608 {
2609 return "disableBaseDamage";
2610 }
2611
2613 {
2614 return true;
2615 }
2616
2618 {
2619 return EInventoryIconVisibility.HIDE_VICINITY;
2620 }
2621
2622
2624 {
2626 {
2627 SetSynchDirty();
2628 }
2629 }
2630
2632 {
2634 super.OnVariablesSynchronized();
2635
2637 }
2638
2640 {
2641
2643
2644
2646
2647
2649 }
2650
2651
2653 {
2654
2655 int offset;
2656 int mask;
2657
2658 if ( part_id >= 1 && part_id <= 31 )
2659 {
2660 offset = part_id - 1;
2661 mask = 1 << offset;
2662
2664 }
2665 else if ( part_id >= 32 && part_id <= 62 )
2666 {
2667 offset = ( part_id % 32 );
2668 mask = 1 << offset;
2669
2671 }
2672 else if ( part_id >= 63 && part_id <= 93 )
2673 {
2674 offset = ( part_id % 63 );
2675 mask = 1 << offset;
2676
2678 }
2679 }
2680
2682 {
2683
2684 int offset;
2685 int mask;
2686
2687 if ( part_id >= 1 && part_id <= 31 )
2688 {
2689 offset = part_id - 1;
2690 mask = 1 << offset;
2691
2693 }
2694 else if ( part_id >= 32 && part_id <= 62 )
2695 {
2696 offset = ( part_id % 32 );
2697 mask = 1 << offset;
2698
2700 }
2701 else if ( part_id >= 63 && part_id <= 93 )
2702 {
2703 offset = ( part_id % 63 );
2704 mask = 1 << offset;
2705
2707 }
2708 }
2709
2711 {
2712
2713 int offset;
2714 int mask;
2715
2716 if ( part_id >= 1 && part_id <= 31 )
2717 {
2718 offset = part_id - 1;
2719 mask = 1 << offset;
2720
2722 {
2723 return true;
2724 }
2725 }
2726 else if ( part_id >= 32 && part_id <= 62 )
2727 {
2728 offset = ( part_id % 32 );
2729 mask = 1 << offset;
2730
2732 {
2733 return true;
2734 }
2735 }
2736 else if ( part_id >= 63 && part_id <= 93 )
2737 {
2738 offset = ( part_id % 63 );
2739 mask = 1 << offset;
2740
2742 {
2743 return true;
2744 }
2745 }
2746
2747 return false;
2748 }
2749
2751 {
2754 }
2755
2757 {
2758
2761 }
2762
2764 {
2766 {
2769
2770 switch( build_action_id )
2771 {
2775 }
2776 }
2777 }
2778
2779
2781 {
2783 bool is_base = part.
IsBase();
2786 if ( is_part_built_sync )
2787 {
2789 {
2793
2794 if (is_base)
2795 {
2798 }
2799 }
2800 }
2801 else
2802 {
2804 {
2808
2809 if (is_base)
2810 {
2813 }
2814 }
2815 }
2816
2817
2819 }
2820
2821
2823 {
2826
2827 for ( int i = 0; i < construction_parts.Count(); ++i )
2828 {
2829 string key = construction_parts.GetKey( i );
2832 }
2833
2834
2836 }
2837
2839 {
2842
2843 for ( int i = 0; i < construction_parts.Count(); ++i )
2844 {
2845 string key = construction_parts.GetKey( i );
2847
2848 if ( value.
GetId() ==
id )
2849 {
2850 return value;
2851 }
2852 }
2853
2854 return NULL;
2855 }
2856
2857
2858
2860 {
2862 }
2863
2865 {
2867 }
2868
2870 {
2871 return true;
2872 }
2873
2875 {
2876 return false;
2877 }
2878
2879
2881 {
2884 {
2886 }
2887
2888 return construction_kit;
2889 }
2890
2892 {
2895 {
2897 }
2898 }
2899
2901 {
2903 }
2904
2906 {
2907 return "";
2908 }
2909
2911 {
2914 }
2915
2916
2918 {
2921 }
2922
2923
2925 {
2926 super.OnStoreSave( ctx );
2927
2928
2932
2934 }
2935
2937 {
2938 if ( !super.OnStoreLoad( ctx, version ) )
2939 return false;
2940
2941
2942
2944 {
2946 return false;
2947 }
2949 {
2951 return false;
2952 }
2954 {
2956 return false;
2957 }
2958
2959
2961 {
2963 return false;
2964 }
2965
2966
2967 return true;
2968 }
2969
2971 {
2972 super.AfterStoreLoad();
2973
2975 {
2977 }
2978 }
2979
2981 {
2982
2984
2985
2988
2989
2991 }
2992
2994 {
2995 super.OnCreatePhysics();
2998 }
2999
3001 {
3003 return;
3004
3005 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
3006
3008 return;
3009
3011 string part_name = zone;
3013
3015 {
3016 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
3017
3018 if ( construction_part && construction.IsPartConstructed( part_name ) )
3019 {
3021 construction.DestroyConnectedParts(part_name);
3022 }
3023
3024
3025 if ( part_name.
Contains(
"barbed") )
3026 {
3027 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
3028 if (barbed_wire)
3029 barbed_wire.SetMountedState( false );
3030 }
3031 }
3032 }
3033
3035 {
3037 {
3039 }
3040
3041 super.EEOnAfterLoad();
3042 }
3043
3045 {
3046 super.EEInit();
3047
3048
3050
3051
3052 #ifdef DEVELOPER
3054 #endif
3055 }
3056
3058 {
3059 super.EEItemAttached( item, slot_name );
3060
3064 }
3065
3067 {
3068 super.EEItemDetached( item, slot_name );
3069
3072 }
3073
3074 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3075 {
3078
3081 }
3082
3083
3085 {
3086 return true;
3087 }
3088
3089
3090
3092 {
3094
3095
3096 if (construtionPart.
IsBase())
3097 {
3099
3100
3102 }
3103
3104
3106
3107
3109
3110
3112
3114
3116
3117
3119
3120
3122 }
3123
3125 {
3126
3128 }
3129
3130
3132 {
3135
3136
3138
3139
3141
3142
3144
3145
3147
3149
3150
3152
3153
3155
3156
3157 if (construtionPart.
IsBase())
3158 {
3159
3161 }
3162
3165 }
3166
3168 {
3169
3171 }
3172
3173
3174 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3175 {
3178
3179
3181
3182
3184
3185
3187
3188
3190
3192
3193
3195
3196
3198
3199
3200 if (construtionPart.
IsBase())
3201 {
3202
3204 }
3205
3208 }
3209
3211 {
3212
3214 }
3215
3217 {
3218 bool process = false;
3219
3220
3224
3225 if (process)
3226 {
3227 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3228 {
3230 return;
3231 }
3232
3234 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3235 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3236
3237
3239 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3240 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3241 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3242 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3243 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3244 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3245 mins = minTmp;
3246 maxs = maxTmp;
3247
3248 maxs[1] = maxs[1] + 0.35;
3249
3251 }
3252 }
3253
3255 {
3258
3259
3261 foreach (
EntityAI entity : foundEntities)
3262 {
3265 }
3266 }
3267
3268
3270 {
3272
3276 }
3277
3279 {
3281
3283 {
3285 }
3286 else
3287 {
3289 }
3290
3292 }
3293
3295 {
3297
3299 foreach (
string slotName : attachmentSlots)
3300 {
3302 }
3303
3304
3307 else
3309
3311 }
3312
3314 {
3315 string slotNameMounted = slot_name + "_Mounted";
3316 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3317
3318 if (attachment)
3319 {
3320 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3321 if (barbedWire && barbedWire.IsMounted())
3323 else
3325
3326 if (is_locked)
3327 {
3328 SetAnimationPhase(slotNameMounted, 0);
3329 SetAnimationPhase(slot_name, 1);
3330 }
3331 else
3332 {
3333 SetAnimationPhase(slotNameMounted, 1);
3334 SetAnimationPhase(slot_name, 0);
3335 }
3336 }
3337 else
3338 {
3339 SetAnimationPhase(slotNameMounted, 1);
3340 SetAnimationPhase(slot_name, 1);
3341
3343 }
3344 }
3345
3346
3348 {
3351
3354
3357
3358 foreach (
string slotName : attachmentSlots)
3359 {
3361 }
3362
3363
3365 {
3368
3370 }
3371 else
3372 {
3375
3377 }
3378
3381 }
3382
3384 {
3385
3387 return;
3388
3389 string slot_name_mounted = slot_name + "_Mounted";
3390 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3391
3392
3394 RemoveProxyPhysics( slot_name_mounted );
3395 RemoveProxyPhysics( slot_name );
3396
3397 if ( attachment )
3398 {
3400 if ( is_locked )
3401 {
3403 AddProxyPhysics( slot_name_mounted );
3404 }
3405 else
3406 {
3408 AddProxyPhysics( slot_name );
3409 }
3410 }
3411 }
3412
3414 {
3415 SetAffectPathgraph( true, false );
3417 }
3418
3420 {
3421 return true;
3422 }
3423
3425 {
3426 return true;
3427 }
3428
3430 {
3431 if ( attachment )
3432 {
3434 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3435
3436 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3437 }
3438
3439 return false;
3440 }
3441
3443 {
3445 }
3446
3447
3449 {
3450 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3451 if (
GetGame().ConfigIsExisting( config_path ) )
3452 {
3454 }
3455 }
3456
3458 {
3459 return true;
3460 }
3461
3463 {
3464 return true;
3465 }
3466
3468 {
3469 return true;
3470 }
3471
3472
3474 {
3476 {
3478 }
3479
3481 }
3482
3484 {
3486 }
3487
3488
3489
3491 {
3492 return super.CanReceiveAttachment(attachment, slotId);
3493 }
3494
3496 {
3497 int attachment_count = GetInventory().AttachmentCount();
3498 if ( attachment_count > 0 )
3499 {
3500 if (
HasBase() && attachment_count == 1 )
3501 {
3502 return false;
3503 }
3504
3505 return true;
3506 }
3507
3508 return false;
3509 }
3510
3512 {
3513 return true;
3514 }
3515
3517 {
3518 return false;
3519 }
3520
3521
3523 {
3524 return false;
3525 }
3526
3528 {
3529 return false;
3530 }
3531
3532
3534 {
3535 return false;
3536 }
3537
3538
3539
3541 {
3542 return true;
3543 }
3544
3546 {
3547 return true;
3548 }
3549
3552 {
3553 return false;
3554 }
3555
3556
3558 {
3559 return true;
3560 }
3561
3562
3564 {
3565 return false;
3566 }
3567
3568
3570 {
3571 return true;
3572 }
3573
3574
3576 {
3577 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3578 {
3579 return false;
3580 }
3581
3582 return true;
3583 }
3584
3586 {
3589
3590 return item;
3591 }
3592
3593
3595 {
3597 {
3598
3600
3601
3604
3606 if ( MemoryPointExists( slot_name + "_min" ) )
3607 {
3608 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3609 }
3610 if ( MemoryPointExists( slot_name + "_max" ) )
3611 {
3612 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3613 }
3614
3615
3618
3619
3622 center = ModelToWorld( center );
3623
3624
3627
3628 areaDamage.SetExtents( extents[0], extents[1] );
3629 areaDamage.SetAreaPosition( center );
3630 areaDamage.SetAreaOrientation( orientation );
3633 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3634 areaDamage.SetAmmoName( "BarbedWireHit" );
3635 areaDamage.Spawn();
3636
3638 }
3639 }
3640
3642 {
3643 if ( angle_deg != 0 )
3644 {
3645
3646 orientation[0] = orientation[0] - angle_deg;
3647
3648
3650 if ( MemoryPointExists( "rotate_axis" ) )
3651 {
3652 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3653 }
3654 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];
3655 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];
3656 center[0] = r_center_x;
3657 center[2] = r_center_z;
3658 }
3659 }
3660
3662 {
3664 {
3667 {
3668 if (areaDamage)
3669 {
3670 areaDamage.Destroy();
3671 }
3672
3674 }
3675 }
3676 }
3677
3679 {
3680 return true;
3681 }
3682
3683
3684
3685
3687 {
3689 }
3690
3692 {
3694 }
3695
3697 {
3699 }
3700
3702 {
3704
3705 switch ( material_type )
3706 {
3712 }
3713
3714 return "";
3715 }
3716
3718 {
3720
3721 switch ( material_type )
3722 {
3728 }
3729
3730 return "";
3731 }
3732
3733
3735 {
3737 {
3738
3740 {
3741 SetHealth(slot_name,"Health",item.GetHealth());
3742 }
3743 }
3744 }
3745
3747 {
3748 return 111;
3749 }
3750
3752 {
3753 super.SetActions();
3754
3758 }
3759
3760
3761
3762
3764 {
3765 }
3766
3769 {
3770 return null;
3771 }
3772
3774 {
3776 }
3777
3779 {
3782
3783 Man p;
3784
3785 #ifdef SERVER
3788 if (players.Count())
3789 p = players[0];
3790 #else
3792 #endif
3793
3795 {
3796 bool excluded = false;
3798 if (excludes)
3799 {
3800 foreach (string exclude : excludes)
3801 {
3803 {
3804 excluded = true;
3805 break;
3806 }
3807 }
3808 }
3809
3810 if (!excluded)
3811 {
3813 }
3814 }
3815
3817 }
3818}
3819
3821{
3822#ifdef BSB_DEBUG
3824#else
3825
3826#endif
3827}
3829{
3830#ifdef BSB_DEBUG_SPAM
3832#else
3833
3834#endif
3835}
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.