2480{
2482
2484
2486
2488
2494
2495
2496
2502
2508
2510
2514
2515
2517 {
2519
2520
2521 RegisterNetSyncVariableInt( "m_SyncParts01" );
2522 RegisterNetSyncVariableInt( "m_SyncParts02" );
2523 RegisterNetSyncVariableInt( "m_SyncParts03" );
2524 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2525 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2526 RegisterNetSyncVariableBool( "m_HasBase" );
2527
2528
2530
2531 if (ConfigIsExisting("hybridAttachments"))
2532 {
2535 }
2536 if (ConfigIsExisting("mountables"))
2537 {
2540 }
2541
2543 }
2544
2546 {
2547 super.EEDelete(parent);
2548
2550 {
2551 areaDamage.Destroy();
2552 }
2553
2554 }
2555
2557 {
2558 return "disableBaseDamage";
2559 }
2560
2562 {
2563 return true;
2564 }
2565
2567 {
2568 return EInventoryIconVisibility.HIDE_VICINITY;
2569 }
2570
2571
2573 {
2575 {
2576 SetSynchDirty();
2577 }
2578 }
2579
2581 {
2583 super.OnVariablesSynchronized();
2584
2586 }
2587
2589 {
2590
2592
2593
2595
2596
2598 }
2599
2600
2602 {
2603
2604 int offset;
2605 int mask;
2606
2607 if ( part_id >= 1 && part_id <= 31 )
2608 {
2609 offset = part_id - 1;
2610 mask = 1 << offset;
2611
2613 }
2614 else if ( part_id >= 32 && part_id <= 62 )
2615 {
2616 offset = ( part_id % 32 );
2617 mask = 1 << offset;
2618
2620 }
2621 else if ( part_id >= 63 && part_id <= 93 )
2622 {
2623 offset = ( part_id % 63 );
2624 mask = 1 << offset;
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 return true;
2673 }
2674 }
2675 else if ( part_id >= 32 && part_id <= 62 )
2676 {
2677 offset = ( part_id % 32 );
2678 mask = 1 << offset;
2679
2681 {
2682 return true;
2683 }
2684 }
2685 else if ( part_id >= 63 && part_id <= 93 )
2686 {
2687 offset = ( part_id % 63 );
2688 mask = 1 << offset;
2689
2691 {
2692 return true;
2693 }
2694 }
2695
2696 return false;
2697 }
2698
2700 {
2703 }
2704
2706 {
2707
2710 }
2711
2713 {
2715 {
2718
2719 switch( build_action_id )
2720 {
2724 }
2725 }
2726 }
2727
2728
2730 {
2732 bool is_base = part.
IsBase();
2735 if ( is_part_built_sync )
2736 {
2738 {
2742
2743 if (is_base)
2744 {
2747 }
2748 }
2749 }
2750 else
2751 {
2753 {
2757
2758 if (is_base)
2759 {
2762 }
2763 }
2764 }
2765
2766
2768 }
2769
2770
2772 {
2775
2776 for ( int i = 0; i < construction_parts.Count(); ++i )
2777 {
2778 string key = construction_parts.GetKey( i );
2781 }
2782
2783
2785 }
2786
2788 {
2791
2792 for ( int i = 0; i < construction_parts.Count(); ++i )
2793 {
2794 string key = construction_parts.GetKey( i );
2796
2797 if ( value.
GetId() ==
id )
2798 {
2799 return value;
2800 }
2801 }
2802
2803 return NULL;
2804 }
2805
2806
2807
2809 {
2811 }
2812
2814 {
2816 }
2817
2819 {
2820 return true;
2821 }
2822
2824 {
2825 return false;
2826 }
2827
2828
2830 {
2833 {
2835 }
2836
2837 return construction_kit;
2838 }
2839
2841 {
2844 {
2846 }
2847 }
2848
2850 {
2852 }
2853
2855 {
2856 return "";
2857 }
2858
2860 {
2863 }
2864
2865
2867 {
2870 }
2871
2872
2874 {
2875 super.OnStoreSave( ctx );
2876
2877
2881
2883 }
2884
2886 {
2887 if ( !super.OnStoreLoad( ctx, version ) )
2888 return false;
2889
2890
2891
2893 {
2895 return false;
2896 }
2898 {
2900 return false;
2901 }
2903 {
2905 return false;
2906 }
2907
2908
2910 {
2912 return false;
2913 }
2914
2915
2916 return true;
2917 }
2918
2920 {
2921 super.AfterStoreLoad();
2922
2924 {
2926 }
2927 }
2928
2930 {
2931
2933
2934
2937
2938
2940 }
2941
2943 {
2944 super.OnCreatePhysics();
2947 }
2948
2950 {
2952 return;
2953
2954 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2955
2957 return;
2958
2960 string part_name = zone;
2962
2964 {
2965 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2966
2967 if ( construction_part && construction.IsPartConstructed( part_name ) )
2968 {
2970 construction.DestroyConnectedParts(part_name);
2971 }
2972
2973
2974 if ( part_name.
Contains(
"barbed") )
2975 {
2976 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2977 if (barbed_wire)
2978 barbed_wire.SetMountedState( false );
2979 }
2980 }
2981 }
2982
2984 {
2986 {
2988 }
2989
2990 super.EEOnAfterLoad();
2991 }
2992
2994 {
2995 super.EEInit();
2996
2997
2999
3000
3001 #ifdef DEVELOPER
3003 #endif
3004 }
3005
3007 {
3008 super.EEItemAttached( item, slot_name );
3009
3013 }
3014
3016 {
3017 super.EEItemDetached( item, slot_name );
3018
3021 }
3022
3023 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3024 {
3027
3030 }
3031
3032
3034 {
3035 return true;
3036 }
3037
3038
3039
3041 {
3043
3044
3045 if (construtionPart.
IsBase())
3046 {
3048
3049
3051 }
3052
3053
3055
3056
3058
3059
3061
3063
3065
3066
3068
3069
3071 }
3072
3074 {
3075
3077 }
3078
3079
3081 {
3084
3085
3087
3088
3090
3091
3093
3094
3096
3098
3099
3101
3102
3104
3105
3106 if (construtionPart.
IsBase())
3107 {
3108
3110 }
3111
3114 }
3115
3117 {
3118
3120 }
3121
3122
3123 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3124 {
3127
3128
3130
3131
3133
3134
3136
3137
3139
3141
3142
3144
3145
3147
3148
3149 if (construtionPart.
IsBase())
3150 {
3151
3153 }
3154
3157 }
3158
3160 {
3161
3163 }
3164
3166 {
3167 bool process = false;
3168
3169
3173
3174 if (process)
3175 {
3176 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3177 {
3179 return;
3180 }
3181
3183 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3184 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3185
3186
3188 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3189 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3190 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3191 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3192 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3193 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3194 mins = minTmp;
3195 maxs = maxTmp;
3196
3197 maxs[1] = maxs[1] + 0.35;
3198
3200 }
3201 }
3202
3204 {
3207
3208
3210 foreach (
EntityAI entity : foundEntities)
3211 {
3214 }
3215 }
3216
3217
3219 {
3221
3225 }
3226
3228 {
3230
3232 {
3234 }
3235 else
3236 {
3238 }
3239
3241 }
3242
3244 {
3246
3248 foreach (
string slotName : attachmentSlots)
3249 {
3251 }
3252
3253
3256 else
3258
3260 }
3261
3263 {
3264 string slotNameMounted = slot_name + "_Mounted";
3265 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3266
3267 if (attachment)
3268 {
3269 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3270 if (barbedWire && barbedWire.IsMounted())
3272 else
3274
3275 if (is_locked)
3276 {
3277 SetAnimationPhase(slotNameMounted, 0);
3278 SetAnimationPhase(slot_name, 1);
3279 }
3280 else
3281 {
3282 SetAnimationPhase(slotNameMounted, 1);
3283 SetAnimationPhase(slot_name, 0);
3284 }
3285 }
3286 else
3287 {
3288 SetAnimationPhase(slotNameMounted, 1);
3289 SetAnimationPhase(slot_name, 1);
3290
3292 }
3293 }
3294
3295
3297 {
3300
3303
3306
3307 foreach (
string slotName : attachmentSlots)
3308 {
3310 }
3311
3312
3314 {
3317
3319 }
3320 else
3321 {
3324
3326 }
3327
3330 }
3331
3333 {
3334
3336 return;
3337
3338 string slot_name_mounted = slot_name + "_Mounted";
3339 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3340
3341
3343 RemoveProxyPhysics( slot_name_mounted );
3344 RemoveProxyPhysics( slot_name );
3345
3346 if ( attachment )
3347 {
3349 if ( is_locked )
3350 {
3352 AddProxyPhysics( slot_name_mounted );
3353 }
3354 else
3355 {
3357 AddProxyPhysics( slot_name );
3358 }
3359 }
3360 }
3361
3363 {
3364 SetAffectPathgraph( true, false );
3366 }
3367
3369 {
3370 return true;
3371 }
3372
3374 {
3375 return true;
3376 }
3377
3379 {
3380 if ( attachment )
3381 {
3383 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3384
3385 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3386 }
3387
3388 return false;
3389 }
3390
3392 {
3394 }
3395
3396
3398 {
3399 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3400 if (
GetGame().ConfigIsExisting( config_path ) )
3401 {
3403 }
3404 }
3405
3407 {
3408 return true;
3409 }
3410
3412 {
3413 return true;
3414 }
3415
3417 {
3418 return true;
3419 }
3420
3421
3423 {
3425 {
3427 }
3428
3430 }
3431
3433 {
3435 }
3436
3437
3438
3440 {
3441 return super.CanReceiveAttachment(attachment, slotId);
3442 }
3443
3445 {
3446 int attachment_count = GetInventory().AttachmentCount();
3447 if ( attachment_count > 0 )
3448 {
3449 if (
HasBase() && attachment_count == 1 )
3450 {
3451 return false;
3452 }
3453
3454 return true;
3455 }
3456
3457 return false;
3458 }
3459
3461 {
3462 return true;
3463 }
3464
3466 {
3467 return false;
3468 }
3469
3470
3472 {
3473 return false;
3474 }
3475
3477 {
3478 return false;
3479 }
3480
3481
3483 {
3484 return false;
3485 }
3486
3487
3488
3490 {
3491 return true;
3492 }
3493
3495 {
3496 return true;
3497 }
3498
3501 {
3502 return false;
3503 }
3504
3505
3507 {
3508 return true;
3509 }
3510
3511
3513 {
3514 return false;
3515 }
3516
3517
3519 {
3520 return true;
3521 }
3522
3523
3525 {
3526 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3527 {
3528 return false;
3529 }
3530
3531 return true;
3532 }
3533
3535 {
3538
3539 return item;
3540 }
3541
3542
3544 {
3546 {
3547
3549
3550
3553
3555 if ( MemoryPointExists( slot_name + "_min" ) )
3556 {
3557 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3558 }
3559 if ( MemoryPointExists( slot_name + "_max" ) )
3560 {
3561 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3562 }
3563
3564
3567
3568
3571 center = ModelToWorld( center );
3572
3573
3576
3577 areaDamage.SetExtents( extents[0], extents[1] );
3578 areaDamage.SetAreaPosition( center );
3579 areaDamage.SetAreaOrientation( orientation );
3582 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3583 areaDamage.SetAmmoName( "BarbedWireHit" );
3584 areaDamage.Spawn();
3585
3587 }
3588 }
3589
3591 {
3592 if ( angle_deg != 0 )
3593 {
3594
3595 orientation[0] = orientation[0] - angle_deg;
3596
3597
3599 if ( MemoryPointExists( "rotate_axis" ) )
3600 {
3601 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3602 }
3603 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];
3604 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];
3605 center[0] = r_center_x;
3606 center[2] = r_center_z;
3607 }
3608 }
3609
3611 {
3613 {
3616 {
3617 if (areaDamage)
3618 {
3619 areaDamage.Destroy();
3620 }
3621
3623 }
3624 }
3625 }
3626
3628 {
3629 return true;
3630 }
3631
3632
3633
3634
3636 {
3638 }
3639
3641 {
3643 }
3644
3646 {
3648 }
3649
3651 {
3653
3654 switch ( material_type )
3655 {
3661 }
3662
3663 return "";
3664 }
3665
3667 {
3669
3670 switch ( material_type )
3671 {
3677 }
3678
3679 return "";
3680 }
3681
3682
3684 {
3686 {
3687
3689 {
3690 SetHealth(slot_name,"Health",item.GetHealth());
3691 }
3692 }
3693 }
3694
3696 {
3697 return 111;
3698 }
3699
3701 {
3702 super.SetActions();
3703
3707 }
3708
3709
3710
3711
3713 {
3714 }
3715
3718 {
3719 return null;
3720 }
3721
3723 {
3725 }
3726
3728 {
3731
3732 Man p;
3733
3734 #ifdef SERVER
3737 if (players.Count())
3738 p = players[0];
3739 #else
3741 #endif
3742
3744 {
3745 bool excluded = false;
3747 if (excludes)
3748 {
3749 foreach (string exclude : excludes)
3750 {
3752 {
3753 excluded = true;
3754 break;
3755 }
3756 }
3757 }
3758
3759 if (!excluded)
3760 {
3762 }
3763 }
3764
3766 }
3767}
3768
3770{
3771#ifdef BSB_DEBUG
3773#else
3774
3775#endif
3776}
3778{
3779#ifdef BSB_DEBUG_SPAM
3781#else
3782
3783#endif
3784}
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.