2441{
2443
2445
2447
2449
2455
2456
2457
2463
2469
2471
2475
2476
2478 {
2480
2481
2482 RegisterNetSyncVariableInt( "m_SyncParts01" );
2483 RegisterNetSyncVariableInt( "m_SyncParts02" );
2484 RegisterNetSyncVariableInt( "m_SyncParts03" );
2485 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2486 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2487 RegisterNetSyncVariableBool( "m_HasBase" );
2488
2489
2491
2492 if (ConfigIsExisting("hybridAttachments"))
2493 {
2496 }
2497 if (ConfigIsExisting("mountables"))
2498 {
2501 }
2502
2504 }
2505
2507 {
2508 super.EEDelete(parent);
2509
2511 {
2512 areaDamage.Destroy();
2513 }
2514
2515 }
2516
2518 {
2519 return "disableBaseDamage";
2520 }
2521
2523 {
2524 return true;
2525 }
2526
2528 {
2529 return EInventoryIconVisibility.HIDE_VICINITY;
2530 }
2531
2532
2534 {
2536 {
2537 SetSynchDirty();
2538 }
2539 }
2540
2542 {
2544 super.OnVariablesSynchronized();
2545
2547 }
2548
2550 {
2551
2553
2554
2556
2557
2559 }
2560
2561
2563 {
2564
2565 int offset;
2566 int mask;
2567
2568 if ( part_id >= 1 && part_id <= 31 )
2569 {
2570 offset = part_id - 1;
2571 mask = 1 << offset;
2572
2574 }
2575 else if ( part_id >= 32 && part_id <= 62 )
2576 {
2577 offset = ( part_id % 32 );
2578 mask = 1 << offset;
2579
2581 }
2582 else if ( part_id >= 63 && part_id <= 93 )
2583 {
2584 offset = ( part_id % 63 );
2585 mask = 1 << offset;
2586
2588 }
2589 }
2590
2592 {
2593
2594 int offset;
2595 int mask;
2596
2597 if ( part_id >= 1 && part_id <= 31 )
2598 {
2599 offset = part_id - 1;
2600 mask = 1 << offset;
2601
2603 }
2604 else if ( part_id >= 32 && part_id <= 62 )
2605 {
2606 offset = ( part_id % 32 );
2607 mask = 1 << offset;
2608
2610 }
2611 else if ( part_id >= 63 && part_id <= 93 )
2612 {
2613 offset = ( part_id % 63 );
2614 mask = 1 << offset;
2615
2617 }
2618 }
2619
2621 {
2622
2623 int offset;
2624 int mask;
2625
2626 if ( part_id >= 1 && part_id <= 31 )
2627 {
2628 offset = part_id - 1;
2629 mask = 1 << offset;
2630
2632 {
2633 return true;
2634 }
2635 }
2636 else if ( part_id >= 32 && part_id <= 62 )
2637 {
2638 offset = ( part_id % 32 );
2639 mask = 1 << offset;
2640
2642 {
2643 return true;
2644 }
2645 }
2646 else if ( part_id >= 63 && part_id <= 93 )
2647 {
2648 offset = ( part_id % 63 );
2649 mask = 1 << offset;
2650
2652 {
2653 return true;
2654 }
2655 }
2656
2657 return false;
2658 }
2659
2661 {
2664 }
2665
2667 {
2668
2671 }
2672
2674 {
2676 {
2679
2680 switch( build_action_id )
2681 {
2685 }
2686 }
2687 }
2688
2689
2691 {
2693 bool is_base = part.
IsBase();
2696 if ( is_part_built_sync )
2697 {
2699 {
2703
2704 if (is_base)
2705 {
2708 }
2709 }
2710 }
2711 else
2712 {
2714 {
2718
2719 if (is_base)
2720 {
2723 }
2724 }
2725 }
2726
2727
2729 }
2730
2731
2733 {
2736
2737 for ( int i = 0; i < construction_parts.Count(); ++i )
2738 {
2739 string key = construction_parts.GetKey( i );
2742 }
2743
2744
2746 }
2747
2749 {
2752
2753 for ( int i = 0; i < construction_parts.Count(); ++i )
2754 {
2755 string key = construction_parts.GetKey( i );
2757
2758 if ( value.
GetId() ==
id )
2759 {
2760 return value;
2761 }
2762 }
2763
2764 return NULL;
2765 }
2766
2767
2768
2770 {
2772 }
2773
2775 {
2777 }
2778
2780 {
2781 return true;
2782 }
2783
2785 {
2786 return false;
2787 }
2788
2789
2791 {
2794 {
2796 }
2797
2798 return construction_kit;
2799 }
2800
2802 {
2805 {
2807 }
2808 }
2809
2811 {
2813 }
2814
2816 {
2817 return "";
2818 }
2819
2821 {
2824 }
2825
2826
2828 {
2831 }
2832
2833
2835 {
2836 super.OnStoreSave( ctx );
2837
2838
2842
2844 }
2845
2847 {
2848 if ( !super.OnStoreLoad( ctx, version ) )
2849 return false;
2850
2851
2852
2854 {
2856 return false;
2857 }
2859 {
2861 return false;
2862 }
2864 {
2866 return false;
2867 }
2868
2869
2871 {
2873 return false;
2874 }
2875
2876
2877 return true;
2878 }
2879
2881 {
2882 super.AfterStoreLoad();
2883
2885 {
2887 }
2888 }
2889
2891 {
2892
2894
2895
2898
2899
2901 }
2902
2904 {
2905 super.OnCreatePhysics();
2908 }
2909
2911 {
2913 return;
2914
2915 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2916
2918 return;
2919
2921 string part_name = zone;
2923
2925 {
2926 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2927
2928 if ( construction_part && construction.IsPartConstructed( part_name ) )
2929 {
2931 construction.DestroyConnectedParts(part_name);
2932 }
2933
2934
2935 if ( part_name.
Contains(
"barbed") )
2936 {
2937 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2938 if (barbed_wire)
2939 barbed_wire.SetMountedState( false );
2940 }
2941 }
2942 }
2943
2945 {
2947 {
2949 }
2950
2951 super.EEOnAfterLoad();
2952 }
2953
2955 {
2956 super.EEInit();
2957
2958
2960
2961
2962 #ifdef DEVELOPER
2964 #endif
2965 }
2966
2968 {
2969 super.EEItemAttached( item, slot_name );
2970
2974 }
2975
2977 {
2978 super.EEItemDetached( item, slot_name );
2979
2982 }
2983
2984 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2985 {
2988
2991 }
2992
2993
2995 {
2996 return true;
2997 }
2998
2999
3000
3002 {
3004
3005
3006 if (construtionPart.
IsBase())
3007 {
3009
3010
3012 }
3013
3014
3016
3017
3019
3020
3022
3024
3026
3027
3029
3030
3032 }
3033
3035 {
3036
3038 }
3039
3040
3042 {
3045
3046
3048
3049
3051
3052
3054
3055
3057
3059
3060
3062
3063
3065
3066
3067 if (construtionPart.
IsBase())
3068 {
3069
3071 }
3072
3075 }
3076
3078 {
3079
3081 }
3082
3083
3084 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3085 {
3088
3089
3091
3092
3094
3095
3097
3098
3100
3102
3103
3105
3106
3108
3109
3110 if (construtionPart.
IsBase())
3111 {
3112
3114 }
3115
3118 }
3119
3121 {
3122
3124 }
3125
3127 {
3128 bool process = false;
3129
3130
3134
3135 if (process)
3136 {
3137 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3138 {
3140 return;
3141 }
3142
3144 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3145 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3146
3147
3149 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3150 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3151 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3152 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3153 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3154 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3155 mins = minTmp;
3156 maxs = maxTmp;
3157
3158 maxs[1] = maxs[1] + 0.35;
3159
3161 }
3162 }
3163
3165 {
3168
3169
3171 foreach (
EntityAI entity : foundEntities)
3172 {
3175 }
3176 }
3177
3178
3180 {
3182
3186 }
3187
3189 {
3191
3193 {
3195 }
3196 else
3197 {
3199 }
3200
3202 }
3203
3205 {
3207
3209 foreach (
string slotName : attachmentSlots)
3210 {
3212 }
3213
3214
3217 else
3219
3221 }
3222
3224 {
3225 string slotNameMounted = slot_name + "_Mounted";
3226 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3227
3228 if (attachment)
3229 {
3230 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3231 if (barbedWire && barbedWire.IsMounted())
3233 else
3235
3236 if (is_locked)
3237 {
3238 SetAnimationPhase(slotNameMounted, 0);
3239 SetAnimationPhase(slot_name, 1);
3240 }
3241 else
3242 {
3243 SetAnimationPhase(slotNameMounted, 1);
3244 SetAnimationPhase(slot_name, 0);
3245 }
3246 }
3247 else
3248 {
3249 SetAnimationPhase(slotNameMounted, 1);
3250 SetAnimationPhase(slot_name, 1);
3251
3253 }
3254 }
3255
3256
3258 {
3261
3264
3267
3268 foreach (
string slotName : attachmentSlots)
3269 {
3271 }
3272
3273
3275 {
3278
3280 }
3281 else
3282 {
3285
3287 }
3288
3291 }
3292
3294 {
3295
3297 return;
3298
3299 string slot_name_mounted = slot_name + "_Mounted";
3300 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3301
3302
3304 RemoveProxyPhysics( slot_name_mounted );
3305 RemoveProxyPhysics( slot_name );
3306
3307 if ( attachment )
3308 {
3310 if ( is_locked )
3311 {
3313 AddProxyPhysics( slot_name_mounted );
3314 }
3315 else
3316 {
3318 AddProxyPhysics( slot_name );
3319 }
3320 }
3321 }
3322
3324 {
3325 SetAffectPathgraph( true, false );
3327 }
3328
3330 {
3331 return true;
3332 }
3333
3335 {
3336 return true;
3337 }
3338
3340 {
3341 if ( attachment )
3342 {
3344 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3345
3346 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3347 }
3348
3349 return false;
3350 }
3351
3353 {
3355 }
3356
3357
3359 {
3360 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3361 if (
GetGame().ConfigIsExisting( config_path ) )
3362 {
3364 }
3365 }
3366
3368 {
3369 return true;
3370 }
3371
3373 {
3374 return true;
3375 }
3376
3378 {
3379 return true;
3380 }
3381
3382
3384 {
3386 {
3388 }
3389
3391 }
3392
3394 {
3396 }
3397
3398
3399
3401 {
3402 return super.CanReceiveAttachment(attachment, slotId);
3403 }
3404
3406 {
3407 int attachment_count = GetInventory().AttachmentCount();
3408 if ( attachment_count > 0 )
3409 {
3410 if (
HasBase() && attachment_count == 1 )
3411 {
3412 return false;
3413 }
3414
3415 return true;
3416 }
3417
3418 return false;
3419 }
3420
3422 {
3423 return true;
3424 }
3425
3427 {
3428 return false;
3429 }
3430
3431
3433 {
3434 return false;
3435 }
3436
3438 {
3439 return false;
3440 }
3441
3442
3444 {
3445 return false;
3446 }
3447
3448
3449
3451 {
3452 return true;
3453 }
3454
3456 {
3457 return true;
3458 }
3459
3462 {
3463 return false;
3464 }
3465
3466
3468 {
3469 return true;
3470 }
3471
3472
3474 {
3475 return false;
3476 }
3477
3478
3480 {
3481 return true;
3482 }
3483
3484
3486 {
3487 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3488 {
3489 return false;
3490 }
3491
3492 return true;
3493 }
3494
3496 {
3499
3500 return item;
3501 }
3502
3503
3505 {
3507 {
3508
3510
3511
3514
3516 if ( MemoryPointExists( slot_name + "_min" ) )
3517 {
3518 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3519 }
3520 if ( MemoryPointExists( slot_name + "_max" ) )
3521 {
3522 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3523 }
3524
3525
3528
3529
3532 center = ModelToWorld( center );
3533
3534
3537
3538 areaDamage.SetExtents( extents[0], extents[1] );
3539 areaDamage.SetAreaPosition( center );
3540 areaDamage.SetAreaOrientation( orientation );
3543 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3544 areaDamage.SetAmmoName( "BarbedWireHit" );
3545 areaDamage.Spawn();
3546
3548 }
3549 }
3550
3552 {
3553 if ( angle_deg != 0 )
3554 {
3555
3556 orientation[0] = orientation[0] - angle_deg;
3557
3558
3560 if ( MemoryPointExists( "rotate_axis" ) )
3561 {
3562 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3563 }
3564 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];
3565 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];
3566 center[0] = r_center_x;
3567 center[2] = r_center_z;
3568 }
3569 }
3570
3572 {
3574 {
3577 {
3578 if (areaDamage)
3579 {
3580 areaDamage.Destroy();
3581 }
3582
3584 }
3585 }
3586 }
3587
3589 {
3590 return true;
3591 }
3592
3593
3594
3595
3597 {
3599 }
3600
3602 {
3604 }
3605
3607 {
3609 }
3610
3612 {
3614
3615 switch ( material_type )
3616 {
3622 }
3623
3624 return "";
3625 }
3626
3628 {
3630
3631 switch ( material_type )
3632 {
3638 }
3639
3640 return "";
3641 }
3642
3643
3645 {
3647 {
3648
3650 {
3651 SetHealth(slot_name,"Health",item.GetHealth());
3652 }
3653 }
3654 }
3655
3657 {
3658 return 111;
3659 }
3660
3662 {
3663 super.SetActions();
3664
3668 }
3669
3670
3671
3672
3674 {
3675 }
3676
3679 {
3680 return null;
3681 }
3682
3684 {
3686 }
3687
3689 {
3692
3693 Man p;
3694
3695 #ifdef SERVER
3698 if (players.Count())
3699 p = players[0];
3700 #else
3702 #endif
3703
3705 {
3706 bool excluded = false;
3708 if (excludes)
3709 {
3710 foreach (string exclude : excludes)
3711 {
3713 {
3714 excluded = true;
3715 break;
3716 }
3717 }
3718 }
3719
3720 if (!excluded)
3721 {
3723 }
3724 }
3725
3727 }
3728}
3729
3731{
3732#ifdef BSB_DEBUG
3734#else
3735
3736#endif
3737}
3739{
3740#ifdef BSB_DEBUG_SPAM
3742#else
3743
3744#endif
3745}
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.