2449{
2451
2453
2455
2457
2463
2464
2465
2471
2477
2479
2483
2484
2486 {
2488
2489
2490 RegisterNetSyncVariableInt( "m_SyncParts01" );
2491 RegisterNetSyncVariableInt( "m_SyncParts02" );
2492 RegisterNetSyncVariableInt( "m_SyncParts03" );
2493 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2494 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2495 RegisterNetSyncVariableBool( "m_HasBase" );
2496
2497
2499
2500 if (ConfigIsExisting("hybridAttachments"))
2501 {
2504 }
2505 if (ConfigIsExisting("mountables"))
2506 {
2509 }
2510
2512 }
2513
2515 {
2516 super.EEDelete(parent);
2517
2519 {
2520 areaDamage.Destroy();
2521 }
2522
2523 }
2524
2526 {
2527 return "disableBaseDamage";
2528 }
2529
2531 {
2532 return true;
2533 }
2534
2536 {
2537 return EInventoryIconVisibility.HIDE_VICINITY;
2538 }
2539
2540
2542 {
2544 {
2545 SetSynchDirty();
2546 }
2547 }
2548
2550 {
2552 super.OnVariablesSynchronized();
2553
2555 }
2556
2558 {
2559
2561
2562
2564
2565
2567 }
2568
2569
2571 {
2572
2573 int offset;
2574 int mask;
2575
2576 if ( part_id >= 1 && part_id <= 31 )
2577 {
2578 offset = part_id - 1;
2579 mask = 1 << offset;
2580
2582 }
2583 else if ( part_id >= 32 && part_id <= 62 )
2584 {
2585 offset = ( part_id % 32 );
2586 mask = 1 << offset;
2587
2589 }
2590 else if ( part_id >= 63 && part_id <= 93 )
2591 {
2592 offset = ( part_id % 63 );
2593 mask = 1 << offset;
2594
2596 }
2597 }
2598
2600 {
2601
2602 int offset;
2603 int mask;
2604
2605 if ( part_id >= 1 && part_id <= 31 )
2606 {
2607 offset = part_id - 1;
2608 mask = 1 << offset;
2609
2611 }
2612 else if ( part_id >= 32 && part_id <= 62 )
2613 {
2614 offset = ( part_id % 32 );
2615 mask = 1 << offset;
2616
2618 }
2619 else if ( part_id >= 63 && part_id <= 93 )
2620 {
2621 offset = ( part_id % 63 );
2622 mask = 1 << offset;
2623
2625 }
2626 }
2627
2629 {
2630
2631 int offset;
2632 int mask;
2633
2634 if ( part_id >= 1 && part_id <= 31 )
2635 {
2636 offset = part_id - 1;
2637 mask = 1 << offset;
2638
2640 {
2641 return true;
2642 }
2643 }
2644 else if ( part_id >= 32 && part_id <= 62 )
2645 {
2646 offset = ( part_id % 32 );
2647 mask = 1 << offset;
2648
2650 {
2651 return true;
2652 }
2653 }
2654 else if ( part_id >= 63 && part_id <= 93 )
2655 {
2656 offset = ( part_id % 63 );
2657 mask = 1 << offset;
2658
2660 {
2661 return true;
2662 }
2663 }
2664
2665 return false;
2666 }
2667
2669 {
2672 }
2673
2675 {
2676
2679 }
2680
2682 {
2684 {
2687
2688 switch( build_action_id )
2689 {
2693 }
2694 }
2695 }
2696
2697
2699 {
2701 bool is_base = part.
IsBase();
2704 if ( is_part_built_sync )
2705 {
2707 {
2711
2712 if (is_base)
2713 {
2716 }
2717 }
2718 }
2719 else
2720 {
2722 {
2726
2727 if (is_base)
2728 {
2731 }
2732 }
2733 }
2734
2735
2737 }
2738
2739
2741 {
2744
2745 for ( int i = 0; i < construction_parts.Count(); ++i )
2746 {
2747 string key = construction_parts.GetKey( i );
2750 }
2751
2752
2754 }
2755
2757 {
2760
2761 for ( int i = 0; i < construction_parts.Count(); ++i )
2762 {
2763 string key = construction_parts.GetKey( i );
2765
2766 if ( value.
GetId() ==
id )
2767 {
2768 return value;
2769 }
2770 }
2771
2772 return NULL;
2773 }
2774
2775
2776
2778 {
2780 }
2781
2783 {
2785 }
2786
2788 {
2789 return true;
2790 }
2791
2793 {
2794 return false;
2795 }
2796
2797
2799 {
2802 {
2804 }
2805
2806 return construction_kit;
2807 }
2808
2810 {
2813 {
2815 }
2816 }
2817
2819 {
2821 }
2822
2824 {
2825 return "";
2826 }
2827
2829 {
2832 }
2833
2834
2836 {
2839 }
2840
2841
2843 {
2844 super.OnStoreSave( ctx );
2845
2846
2850
2852 }
2853
2855 {
2856 if ( !super.OnStoreLoad( ctx, version ) )
2857 return false;
2858
2859
2860
2862 {
2864 return false;
2865 }
2867 {
2869 return false;
2870 }
2872 {
2874 return false;
2875 }
2876
2877
2879 {
2881 return false;
2882 }
2883
2884
2885 return true;
2886 }
2887
2889 {
2890 super.AfterStoreLoad();
2891
2893 {
2895 }
2896 }
2897
2899 {
2900
2902
2903
2906
2907
2909 }
2910
2912 {
2913 super.OnCreatePhysics();
2916 }
2917
2919 {
2921 return;
2922
2923 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2924
2926 return;
2927
2929 string part_name = zone;
2931
2933 {
2934 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2935
2936 if ( construction_part && construction.IsPartConstructed( part_name ) )
2937 {
2939 construction.DestroyConnectedParts(part_name);
2940 }
2941
2942
2943 if ( part_name.
Contains(
"barbed") )
2944 {
2945 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2946 if (barbed_wire)
2947 barbed_wire.SetMountedState( false );
2948 }
2949 }
2950 }
2951
2953 {
2955 {
2957 }
2958
2959 super.EEOnAfterLoad();
2960 }
2961
2963 {
2964 super.EEInit();
2965
2966
2968
2969
2970 #ifdef DEVELOPER
2972 #endif
2973 }
2974
2976 {
2977 super.EEItemAttached( item, slot_name );
2978
2982 }
2983
2985 {
2986 super.EEItemDetached( item, slot_name );
2987
2990 }
2991
2992 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2993 {
2996
2999 }
3000
3001
3003 {
3004 return true;
3005 }
3006
3007
3008
3010 {
3012
3013
3014 if (construtionPart.
IsBase())
3015 {
3017
3018
3020 }
3021
3022
3024
3025
3027
3028
3030
3032
3034
3035
3037
3038
3040 }
3041
3043 {
3044
3046 }
3047
3048
3050 {
3053
3054
3056
3057
3059
3060
3062
3063
3065
3067
3068
3070
3071
3073
3074
3075 if (construtionPart.
IsBase())
3076 {
3077
3079 }
3080
3083 }
3084
3086 {
3087
3089 }
3090
3091
3092 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3093 {
3096
3097
3099
3100
3102
3103
3105
3106
3108
3110
3111
3113
3114
3116
3117
3118 if (construtionPart.
IsBase())
3119 {
3120
3122 }
3123
3126 }
3127
3129 {
3130
3132 }
3133
3135 {
3136 bool process = false;
3137
3138
3142
3143 if (process)
3144 {
3145 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3146 {
3148 return;
3149 }
3150
3152 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3153 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3154
3155
3157 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3158 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3159 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3160 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3161 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3162 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3163 mins = minTmp;
3164 maxs = maxTmp;
3165
3166 maxs[1] = maxs[1] + 0.35;
3167
3169 }
3170 }
3171
3173 {
3176
3177
3179 foreach (
EntityAI entity : foundEntities)
3180 {
3183 }
3184 }
3185
3186
3188 {
3190
3194 }
3195
3197 {
3199
3201 {
3203 }
3204 else
3205 {
3207 }
3208
3210 }
3211
3213 {
3215
3217 foreach (
string slotName : attachmentSlots)
3218 {
3220 }
3221
3222
3225 else
3227
3229 }
3230
3232 {
3233 string slotNameMounted = slot_name + "_Mounted";
3234 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3235
3236 if (attachment)
3237 {
3238 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3239 if (barbedWire && barbedWire.IsMounted())
3241 else
3243
3244 if (is_locked)
3245 {
3246 SetAnimationPhase(slotNameMounted, 0);
3247 SetAnimationPhase(slot_name, 1);
3248 }
3249 else
3250 {
3251 SetAnimationPhase(slotNameMounted, 1);
3252 SetAnimationPhase(slot_name, 0);
3253 }
3254 }
3255 else
3256 {
3257 SetAnimationPhase(slotNameMounted, 1);
3258 SetAnimationPhase(slot_name, 1);
3259
3261 }
3262 }
3263
3264
3266 {
3269
3272
3275
3276 foreach (
string slotName : attachmentSlots)
3277 {
3279 }
3280
3281
3283 {
3286
3288 }
3289 else
3290 {
3293
3295 }
3296
3299 }
3300
3302 {
3303
3305 return;
3306
3307 string slot_name_mounted = slot_name + "_Mounted";
3308 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3309
3310
3312 RemoveProxyPhysics( slot_name_mounted );
3313 RemoveProxyPhysics( slot_name );
3314
3315 if ( attachment )
3316 {
3318 if ( is_locked )
3319 {
3321 AddProxyPhysics( slot_name_mounted );
3322 }
3323 else
3324 {
3326 AddProxyPhysics( slot_name );
3327 }
3328 }
3329 }
3330
3332 {
3333 SetAffectPathgraph( true, false );
3335 }
3336
3338 {
3339 return true;
3340 }
3341
3343 {
3344 return true;
3345 }
3346
3348 {
3349 if ( attachment )
3350 {
3352 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3353
3354 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3355 }
3356
3357 return false;
3358 }
3359
3361 {
3363 }
3364
3365
3367 {
3368 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3369 if (
GetGame().ConfigIsExisting( config_path ) )
3370 {
3372 }
3373 }
3374
3376 {
3377 return true;
3378 }
3379
3381 {
3382 return true;
3383 }
3384
3386 {
3387 return true;
3388 }
3389
3390
3392 {
3394 {
3396 }
3397
3399 }
3400
3402 {
3404 }
3405
3406
3407
3409 {
3410 return super.CanReceiveAttachment(attachment, slotId);
3411 }
3412
3414 {
3415 int attachment_count = GetInventory().AttachmentCount();
3416 if ( attachment_count > 0 )
3417 {
3418 if (
HasBase() && attachment_count == 1 )
3419 {
3420 return false;
3421 }
3422
3423 return true;
3424 }
3425
3426 return false;
3427 }
3428
3430 {
3431 return true;
3432 }
3433
3435 {
3436 return false;
3437 }
3438
3439
3441 {
3442 return false;
3443 }
3444
3446 {
3447 return false;
3448 }
3449
3450
3452 {
3453 return false;
3454 }
3455
3456
3457
3459 {
3460 return true;
3461 }
3462
3464 {
3465 return true;
3466 }
3467
3470 {
3471 return false;
3472 }
3473
3474
3476 {
3477 return true;
3478 }
3479
3480
3482 {
3483 return false;
3484 }
3485
3486
3488 {
3489 return true;
3490 }
3491
3492
3494 {
3495 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3496 {
3497 return false;
3498 }
3499
3500 return true;
3501 }
3502
3504 {
3507
3508 return item;
3509 }
3510
3511
3513 {
3515 {
3516
3518
3519
3522
3524 if ( MemoryPointExists( slot_name + "_min" ) )
3525 {
3526 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3527 }
3528 if ( MemoryPointExists( slot_name + "_max" ) )
3529 {
3530 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3531 }
3532
3533
3536
3537
3540 center = ModelToWorld( center );
3541
3542
3545
3546 areaDamage.SetExtents( extents[0], extents[1] );
3547 areaDamage.SetAreaPosition( center );
3548 areaDamage.SetAreaOrientation( orientation );
3551 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3552 areaDamage.SetAmmoName( "BarbedWireHit" );
3553 areaDamage.Spawn();
3554
3556 }
3557 }
3558
3560 {
3561 if ( angle_deg != 0 )
3562 {
3563
3564 orientation[0] = orientation[0] - angle_deg;
3565
3566
3568 if ( MemoryPointExists( "rotate_axis" ) )
3569 {
3570 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3571 }
3572 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];
3573 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];
3574 center[0] = r_center_x;
3575 center[2] = r_center_z;
3576 }
3577 }
3578
3580 {
3582 {
3585 {
3586 if (areaDamage)
3587 {
3588 areaDamage.Destroy();
3589 }
3590
3592 }
3593 }
3594 }
3595
3597 {
3598 return true;
3599 }
3600
3601
3602
3603
3605 {
3607 }
3608
3610 {
3612 }
3613
3615 {
3617 }
3618
3620 {
3622
3623 switch ( material_type )
3624 {
3630 }
3631
3632 return "";
3633 }
3634
3636 {
3638
3639 switch ( material_type )
3640 {
3646 }
3647
3648 return "";
3649 }
3650
3651
3653 {
3655 {
3656
3658 {
3659 SetHealth(slot_name,"Health",item.GetHealth());
3660 }
3661 }
3662 }
3663
3665 {
3666 return 111;
3667 }
3668
3670 {
3671 super.SetActions();
3672
3676 }
3677
3678
3679
3680
3682 {
3683 }
3684
3687 {
3688 return null;
3689 }
3690
3692 {
3694 }
3695
3697 {
3700
3701 Man p;
3702
3703 #ifdef SERVER
3706 if (players.Count())
3707 p = players[0];
3708 #else
3710 #endif
3711
3713 {
3714 bool excluded = false;
3716 if (excludes)
3717 {
3718 foreach (string exclude : excludes)
3719 {
3721 {
3722 excluded = true;
3723 break;
3724 }
3725 }
3726 }
3727
3728 if (!excluded)
3729 {
3731 }
3732 }
3733
3735 }
3736}
3737
3739{
3740#ifdef BSB_DEBUG
3742#else
3743
3744#endif
3745}
3747{
3748#ifdef BSB_DEBUG_SPAM
3750#else
3751
3752#endif
3753}
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.