2454{
2456
2458
2460
2462
2468
2469
2470
2476
2482
2484
2488
2489
2491 {
2493
2494
2495 RegisterNetSyncVariableInt( "m_SyncParts01" );
2496 RegisterNetSyncVariableInt( "m_SyncParts02" );
2497 RegisterNetSyncVariableInt( "m_SyncParts03" );
2498 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2499 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2500 RegisterNetSyncVariableBool( "m_HasBase" );
2501
2502
2504
2505 if (ConfigIsExisting("hybridAttachments"))
2506 {
2509 }
2510 if (ConfigIsExisting("mountables"))
2511 {
2514 }
2515
2517 }
2518
2520 {
2521 super.EEDelete(parent);
2522
2524 {
2525 areaDamage.Destroy();
2526 }
2527
2528 }
2529
2531 {
2532 return "disableBaseDamage";
2533 }
2534
2536 {
2537 return true;
2538 }
2539
2541 {
2542 return EInventoryIconVisibility.HIDE_VICINITY;
2543 }
2544
2545
2547 {
2549 {
2550 SetSynchDirty();
2551 }
2552 }
2553
2555 {
2557 super.OnVariablesSynchronized();
2558
2560 }
2561
2563 {
2564
2566
2567
2569
2570
2572 }
2573
2574
2576 {
2577
2578 int offset;
2579 int mask;
2580
2581 if ( part_id >= 1 && part_id <= 31 )
2582 {
2583 offset = part_id - 1;
2584 mask = 1 << offset;
2585
2587 }
2588 else if ( part_id >= 32 && part_id <= 62 )
2589 {
2590 offset = ( part_id % 32 );
2591 mask = 1 << offset;
2592
2594 }
2595 else if ( part_id >= 63 && part_id <= 93 )
2596 {
2597 offset = ( part_id % 63 );
2598 mask = 1 << offset;
2599
2601 }
2602 }
2603
2605 {
2606
2607 int offset;
2608 int mask;
2609
2610 if ( part_id >= 1 && part_id <= 31 )
2611 {
2612 offset = part_id - 1;
2613 mask = 1 << offset;
2614
2616 }
2617 else if ( part_id >= 32 && part_id <= 62 )
2618 {
2619 offset = ( part_id % 32 );
2620 mask = 1 << offset;
2621
2623 }
2624 else if ( part_id >= 63 && part_id <= 93 )
2625 {
2626 offset = ( part_id % 63 );
2627 mask = 1 << offset;
2628
2630 }
2631 }
2632
2634 {
2635
2636 int offset;
2637 int mask;
2638
2639 if ( part_id >= 1 && part_id <= 31 )
2640 {
2641 offset = part_id - 1;
2642 mask = 1 << offset;
2643
2645 {
2646 return true;
2647 }
2648 }
2649 else if ( part_id >= 32 && part_id <= 62 )
2650 {
2651 offset = ( part_id % 32 );
2652 mask = 1 << offset;
2653
2655 {
2656 return true;
2657 }
2658 }
2659 else if ( part_id >= 63 && part_id <= 93 )
2660 {
2661 offset = ( part_id % 63 );
2662 mask = 1 << offset;
2663
2665 {
2666 return true;
2667 }
2668 }
2669
2670 return false;
2671 }
2672
2674 {
2677 }
2678
2680 {
2681
2684 }
2685
2687 {
2689 {
2692
2693 switch( build_action_id )
2694 {
2698 }
2699 }
2700 }
2701
2702
2704 {
2706 bool is_base = part.
IsBase();
2709 if ( is_part_built_sync )
2710 {
2712 {
2716
2717 if (is_base)
2718 {
2721 }
2722 }
2723 }
2724 else
2725 {
2727 {
2731
2732 if (is_base)
2733 {
2736 }
2737 }
2738 }
2739
2740
2742 }
2743
2744
2746 {
2749
2750 for ( int i = 0; i < construction_parts.Count(); ++i )
2751 {
2752 string key = construction_parts.GetKey( i );
2755 }
2756
2757
2759 }
2760
2762 {
2765
2766 for ( int i = 0; i < construction_parts.Count(); ++i )
2767 {
2768 string key = construction_parts.GetKey( i );
2770
2771 if ( value.
GetId() ==
id )
2772 {
2773 return value;
2774 }
2775 }
2776
2777 return NULL;
2778 }
2779
2780
2781
2783 {
2785 }
2786
2788 {
2790 }
2791
2793 {
2794 return true;
2795 }
2796
2798 {
2799 return false;
2800 }
2801
2802
2804 {
2807 {
2809 }
2810
2811 return construction_kit;
2812 }
2813
2815 {
2818 {
2820 }
2821 }
2822
2824 {
2826 }
2827
2829 {
2830 return "";
2831 }
2832
2834 {
2837 }
2838
2839
2841 {
2844 }
2845
2846
2848 {
2849 super.OnStoreSave( ctx );
2850
2851
2855
2857 }
2858
2860 {
2861 if ( !super.OnStoreLoad( ctx, version ) )
2862 return false;
2863
2864
2865
2867 {
2869 return false;
2870 }
2872 {
2874 return false;
2875 }
2877 {
2879 return false;
2880 }
2881
2882
2884 {
2886 return false;
2887 }
2888
2889
2890 return true;
2891 }
2892
2894 {
2895 super.AfterStoreLoad();
2896
2898 {
2900 }
2901 }
2902
2904 {
2905
2907
2908
2911
2912
2914 }
2915
2917 {
2918 super.OnCreatePhysics();
2921 }
2922
2924 {
2926 return;
2927
2928 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2929
2931 return;
2932
2934 string part_name = zone;
2936
2938 {
2939 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2940
2941 if ( construction_part && construction.IsPartConstructed( part_name ) )
2942 {
2944 construction.DestroyConnectedParts(part_name);
2945 }
2946
2947
2948 if ( part_name.
Contains(
"barbed") )
2949 {
2950 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2951 if (barbed_wire)
2952 barbed_wire.SetMountedState( false );
2953 }
2954 }
2955 }
2956
2958 {
2960 {
2962 }
2963
2964 super.EEOnAfterLoad();
2965 }
2966
2968 {
2969 super.EEInit();
2970
2971
2973
2974
2975 #ifdef DEVELOPER
2977 #endif
2978 }
2979
2981 {
2982 super.EEItemAttached( item, slot_name );
2983
2987 }
2988
2990 {
2991 super.EEItemDetached( item, slot_name );
2992
2995 }
2996
2997 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2998 {
3001
3004 }
3005
3006
3008 {
3009 return true;
3010 }
3011
3012
3013
3015 {
3017
3018
3019 if (construtionPart.
IsBase())
3020 {
3022
3023
3025 }
3026
3027
3029
3030
3032
3033
3035
3037
3039
3040
3042
3043
3045 }
3046
3048 {
3049
3051 }
3052
3053
3055 {
3058
3059
3061
3062
3064
3065
3067
3068
3070
3072
3073
3075
3076
3078
3079
3080 if (construtionPart.
IsBase())
3081 {
3082
3084 }
3085
3088 }
3089
3091 {
3092
3094 }
3095
3096
3097 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
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
3140 {
3141 bool process = false;
3142
3143
3147
3148 if (process)
3149 {
3150 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3151 {
3153 return;
3154 }
3155
3157 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3158 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3159
3160
3162 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3163 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3164 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3165 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3166 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3167 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3168 mins = minTmp;
3169 maxs = maxTmp;
3170
3171 maxs[1] = maxs[1] + 0.35;
3172
3174 }
3175 }
3176
3178 {
3181
3182
3184 foreach (
EntityAI entity : foundEntities)
3185 {
3188 }
3189 }
3190
3191
3193 {
3195
3199 }
3200
3202 {
3204
3206 {
3208 }
3209 else
3210 {
3212 }
3213
3215 }
3216
3218 {
3220
3222 foreach (
string slotName : attachmentSlots)
3223 {
3225 }
3226
3227
3230 else
3232
3234 }
3235
3237 {
3238 string slotNameMounted = slot_name + "_Mounted";
3239 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3240
3241 if (attachment)
3242 {
3243 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3244 if (barbedWire && barbedWire.IsMounted())
3246 else
3248
3249 if (is_locked)
3250 {
3251 SetAnimationPhase(slotNameMounted, 0);
3252 SetAnimationPhase(slot_name, 1);
3253 }
3254 else
3255 {
3256 SetAnimationPhase(slotNameMounted, 1);
3257 SetAnimationPhase(slot_name, 0);
3258 }
3259 }
3260 else
3261 {
3262 SetAnimationPhase(slotNameMounted, 1);
3263 SetAnimationPhase(slot_name, 1);
3264
3266 }
3267 }
3268
3269
3271 {
3274
3277
3280
3281 foreach (
string slotName : attachmentSlots)
3282 {
3284 }
3285
3286
3288 {
3291
3293 }
3294 else
3295 {
3298
3300 }
3301
3304 }
3305
3307 {
3308
3310 return;
3311
3312 string slot_name_mounted = slot_name + "_Mounted";
3313 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3314
3315
3317 RemoveProxyPhysics( slot_name_mounted );
3318 RemoveProxyPhysics( slot_name );
3319
3320 if ( attachment )
3321 {
3323 if ( is_locked )
3324 {
3326 AddProxyPhysics( slot_name_mounted );
3327 }
3328 else
3329 {
3331 AddProxyPhysics( slot_name );
3332 }
3333 }
3334 }
3335
3337 {
3338 SetAffectPathgraph( true, false );
3340 }
3341
3343 {
3344 return true;
3345 }
3346
3348 {
3349 return true;
3350 }
3351
3353 {
3354 if ( attachment )
3355 {
3357 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3358
3359 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3360 }
3361
3362 return false;
3363 }
3364
3366 {
3368 }
3369
3370
3372 {
3373 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3374 if (
GetGame().ConfigIsExisting( config_path ) )
3375 {
3377 }
3378 }
3379
3381 {
3382 return true;
3383 }
3384
3386 {
3387 return true;
3388 }
3389
3391 {
3392 return true;
3393 }
3394
3395
3397 {
3399 {
3401 }
3402
3404 }
3405
3407 {
3409 }
3410
3411
3412
3414 {
3415 return super.CanReceiveAttachment(attachment, slotId);
3416 }
3417
3419 {
3420 int attachment_count = GetInventory().AttachmentCount();
3421 if ( attachment_count > 0 )
3422 {
3423 if (
HasBase() && attachment_count == 1 )
3424 {
3425 return false;
3426 }
3427
3428 return true;
3429 }
3430
3431 return false;
3432 }
3433
3435 {
3436 return true;
3437 }
3438
3440 {
3441 return false;
3442 }
3443
3444
3446 {
3447 return false;
3448 }
3449
3451 {
3452 return false;
3453 }
3454
3455
3457 {
3458 return false;
3459 }
3460
3461
3462
3464 {
3465 return true;
3466 }
3467
3469 {
3470 return true;
3471 }
3472
3475 {
3476 return false;
3477 }
3478
3479
3481 {
3482 return true;
3483 }
3484
3485
3487 {
3488 return false;
3489 }
3490
3491
3493 {
3494 return true;
3495 }
3496
3497
3499 {
3500 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3501 {
3502 return false;
3503 }
3504
3505 return true;
3506 }
3507
3509 {
3512
3513 return item;
3514 }
3515
3516
3518 {
3520 {
3521
3523
3524
3527
3529 if ( MemoryPointExists( slot_name + "_min" ) )
3530 {
3531 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3532 }
3533 if ( MemoryPointExists( slot_name + "_max" ) )
3534 {
3535 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3536 }
3537
3538
3541
3542
3545 center = ModelToWorld( center );
3546
3547
3550
3551 areaDamage.SetExtents( extents[0], extents[1] );
3552 areaDamage.SetAreaPosition( center );
3553 areaDamage.SetAreaOrientation( orientation );
3556 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3557 areaDamage.SetAmmoName( "BarbedWireHit" );
3558 areaDamage.Spawn();
3559
3561 }
3562 }
3563
3565 {
3566 if ( angle_deg != 0 )
3567 {
3568
3569 orientation[0] = orientation[0] - angle_deg;
3570
3571
3573 if ( MemoryPointExists( "rotate_axis" ) )
3574 {
3575 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3576 }
3577 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];
3578 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];
3579 center[0] = r_center_x;
3580 center[2] = r_center_z;
3581 }
3582 }
3583
3585 {
3587 {
3590 {
3591 if (areaDamage)
3592 {
3593 areaDamage.Destroy();
3594 }
3595
3597 }
3598 }
3599 }
3600
3602 {
3603 return true;
3604 }
3605
3606
3607
3608
3610 {
3612 }
3613
3615 {
3617 }
3618
3620 {
3622 }
3623
3625 {
3627
3628 switch ( material_type )
3629 {
3635 }
3636
3637 return "";
3638 }
3639
3641 {
3643
3644 switch ( material_type )
3645 {
3651 }
3652
3653 return "";
3654 }
3655
3656
3658 {
3660 {
3661
3663 {
3664 SetHealth(slot_name,"Health",item.GetHealth());
3665 }
3666 }
3667 }
3668
3670 {
3671 return 111;
3672 }
3673
3675 {
3676 super.SetActions();
3677
3681 }
3682
3683
3684
3685
3687 {
3688 }
3689
3692 {
3693 return null;
3694 }
3695
3697 {
3699 }
3700
3702 {
3705
3706 Man p;
3707
3708 #ifdef SERVER
3711 if (players.Count())
3712 p = players[0];
3713 #else
3715 #endif
3716
3718 {
3719 bool excluded = false;
3721 if (excludes)
3722 {
3723 foreach (string exclude : excludes)
3724 {
3726 {
3727 excluded = true;
3728 break;
3729 }
3730 }
3731 }
3732
3733 if (!excluded)
3734 {
3736 }
3737 }
3738
3740 }
3741}
3742
3744{
3745#ifdef BSB_DEBUG
3747#else
3748
3749#endif
3750}
3752{
3753#ifdef BSB_DEBUG_SPAM
3755#else
3756
3757#endif
3758}
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.