2258{
2260
2262
2264
2266
2272
2273
2274
2280
2286
2288
2292
2293
2295 {
2297
2298
2299 RegisterNetSyncVariableInt( "m_SyncParts01" );
2300 RegisterNetSyncVariableInt( "m_SyncParts02" );
2301 RegisterNetSyncVariableInt( "m_SyncParts03" );
2302 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2303 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2304 RegisterNetSyncVariableBool( "m_HasBase" );
2305
2306
2308
2309 if (ConfigIsExisting("hybridAttachments"))
2310 {
2313 }
2314 if (ConfigIsExisting("mountables"))
2315 {
2318 }
2319
2321 }
2322
2324 {
2325 super.EEDelete(parent);
2326
2328 {
2329 areaDamage.Destroy();
2330 }
2331
2332 }
2333
2335 {
2336 return "disableBaseDamage";
2337 }
2338
2340 {
2341 return true;
2342 }
2343
2345 {
2346 return EInventoryIconVisibility.HIDE_VICINITY;
2347 }
2348
2349
2351 {
2353 {
2354 SetSynchDirty();
2355 }
2356 }
2357
2359 {
2361 super.OnVariablesSynchronized();
2362
2364 }
2365
2367 {
2368
2370
2371
2373
2374
2376 }
2377
2378
2380 {
2381
2382 int offset;
2383 int mask;
2384
2385 if ( part_id >= 1 && part_id <= 31 )
2386 {
2387 offset = part_id - 1;
2388 mask = 1 << offset;
2389
2391 }
2392 else if ( part_id >= 32 && part_id <= 62 )
2393 {
2394 offset = ( part_id % 32 );
2395 mask = 1 << offset;
2396
2398 }
2399 else if ( part_id >= 63 && part_id <= 93 )
2400 {
2401 offset = ( part_id % 63 );
2402 mask = 1 << offset;
2403
2405 }
2406 }
2407
2409 {
2410
2411 int offset;
2412 int mask;
2413
2414 if ( part_id >= 1 && part_id <= 31 )
2415 {
2416 offset = part_id - 1;
2417 mask = 1 << offset;
2418
2420 }
2421 else if ( part_id >= 32 && part_id <= 62 )
2422 {
2423 offset = ( part_id % 32 );
2424 mask = 1 << offset;
2425
2427 }
2428 else if ( part_id >= 63 && part_id <= 93 )
2429 {
2430 offset = ( part_id % 63 );
2431 mask = 1 << offset;
2432
2434 }
2435 }
2436
2438 {
2439
2440 int offset;
2441 int mask;
2442
2443 if ( part_id >= 1 && part_id <= 31 )
2444 {
2445 offset = part_id - 1;
2446 mask = 1 << offset;
2447
2449 {
2450 return true;
2451 }
2452 }
2453 else if ( part_id >= 32 && part_id <= 62 )
2454 {
2455 offset = ( part_id % 32 );
2456 mask = 1 << offset;
2457
2459 {
2460 return true;
2461 }
2462 }
2463 else if ( part_id >= 63 && part_id <= 93 )
2464 {
2465 offset = ( part_id % 63 );
2466 mask = 1 << offset;
2467
2469 {
2470 return true;
2471 }
2472 }
2473
2474 return false;
2475 }
2476
2478 {
2481 }
2482
2484 {
2485
2488 }
2489
2491 {
2493 {
2496
2497 switch( build_action_id )
2498 {
2502 }
2503 }
2504 }
2505
2506
2508 {
2510 bool is_base = part.
IsBase();
2513 if ( is_part_built_sync )
2514 {
2516 {
2520
2521 if (is_base)
2522 {
2525 }
2526 }
2527 }
2528 else
2529 {
2531 {
2535
2536 if (is_base)
2537 {
2540 }
2541 }
2542 }
2543
2544
2546 }
2547
2548
2550 {
2553
2554 for ( int i = 0; i < construction_parts.Count(); ++i )
2555 {
2556 string key = construction_parts.GetKey( i );
2559 }
2560
2561
2563 }
2564
2566 {
2569
2570 for ( int i = 0; i < construction_parts.Count(); ++i )
2571 {
2572 string key = construction_parts.GetKey( i );
2574
2575 if ( value.
GetId() ==
id )
2576 {
2577 return value;
2578 }
2579 }
2580
2581 return NULL;
2582 }
2583
2584
2585
2587 {
2589 }
2590
2592 {
2594 }
2595
2597 {
2598 return true;
2599 }
2600
2602 {
2603 return false;
2604 }
2605
2606
2608 {
2611 {
2613 }
2614
2615 return construction_kit;
2616 }
2617
2619 {
2622 {
2624 }
2625 }
2626
2628 {
2630 }
2631
2633 {
2634 return "";
2635 }
2636
2638 {
2641 }
2642
2643
2645 {
2648 }
2649
2650
2652 {
2653 super.OnStoreSave( ctx );
2654
2655
2659
2661 }
2662
2664 {
2665 if ( !super.OnStoreLoad( ctx, version ) )
2666 return false;
2667
2668
2669
2671 {
2673 return false;
2674 }
2676 {
2678 return false;
2679 }
2681 {
2683 return false;
2684 }
2685
2686
2688 {
2690 return false;
2691 }
2692
2693
2694 return true;
2695 }
2696
2698 {
2699 super.AfterStoreLoad();
2700
2702 {
2704 }
2705 }
2706
2708 {
2709
2711
2712
2715
2716
2718 }
2719
2721 {
2722 super.OnCreatePhysics();
2725 }
2726
2728 {
2730 return;
2731
2732 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2733
2735 return;
2736
2738 string part_name = zone;
2740
2742 {
2743 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2744
2745 if ( construction_part && construction.IsPartConstructed( part_name ) )
2746 {
2748 construction.DestroyConnectedParts(part_name);
2749 }
2750
2751
2752 if ( part_name.
Contains(
"barbed") )
2753 {
2754 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2755 if (barbed_wire)
2756 barbed_wire.SetMountedState( false );
2757 }
2758 }
2759 }
2760
2762 {
2764 {
2766 }
2767
2768 super.EEOnAfterLoad();
2769 }
2770
2772 {
2773 super.EEInit();
2774
2775
2777
2778
2779 #ifdef DEVELOPER
2781 #endif
2782 }
2783
2785 {
2786 super.EEItemAttached( item, slot_name );
2787
2791 }
2792
2794 {
2795 super.EEItemDetached( item, slot_name );
2796
2799 }
2800
2801 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2802 {
2805
2808 }
2809
2810
2812 {
2813 return true;
2814 }
2815
2816
2817
2819 {
2821
2822
2823 if (construtionPart.
IsBase())
2824 {
2826
2827
2829 }
2830
2831
2833
2834
2836
2837
2839
2841
2843
2844
2846
2847
2849 }
2850
2852 {
2853
2855 }
2856
2857
2859 {
2862
2863
2865
2866
2868
2869
2871
2872
2874
2876
2877
2879
2880
2882
2883
2884 if (construtionPart.
IsBase())
2885 {
2886
2888 }
2889
2892 }
2893
2895 {
2896
2898 }
2899
2900
2901 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2902 {
2905
2906
2908
2909
2911
2912
2914
2915
2917
2919
2920
2922
2923
2925
2926
2927 if (construtionPart.
IsBase())
2928 {
2929
2931 }
2932
2935 }
2936
2938 {
2939
2941 }
2942
2944 {
2945 bool process = false;
2946
2947
2951
2952 if (process)
2953 {
2954 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2955 {
2957 return;
2958 }
2959
2961 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2962 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2963
2964
2966 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2967 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2968 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2969 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2970 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2971 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2972 mins = minTmp;
2973 maxs = maxTmp;
2974
2975 maxs[1] = maxs[1] + 0.35;
2976
2978 }
2979 }
2980
2982 {
2985
2986
2988 foreach (
EntityAI entity : foundEntities)
2989 {
2992 }
2993 }
2994
2995
2997 {
2999
3003 }
3004
3006 {
3008
3010 {
3012 }
3013 else
3014 {
3016 }
3017
3019 }
3020
3022 {
3024
3026 foreach (
string slotName : attachmentSlots)
3027 {
3029 }
3030
3031
3034 else
3036
3038 }
3039
3041 {
3042 string slotNameMounted = slot_name + "_Mounted";
3043 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3044
3045 if (attachment)
3046 {
3047 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3048 if (barbedWire && barbedWire.IsMounted())
3050 else
3052
3053 if (is_locked)
3054 {
3055 SetAnimationPhase(slotNameMounted, 0);
3056 SetAnimationPhase(slot_name, 1);
3057 }
3058 else
3059 {
3060 SetAnimationPhase(slotNameMounted, 1);
3061 SetAnimationPhase(slot_name, 0);
3062 }
3063 }
3064 else
3065 {
3066 SetAnimationPhase(slotNameMounted, 1);
3067 SetAnimationPhase(slot_name, 1);
3068
3070 }
3071 }
3072
3073
3075 {
3078
3081
3084
3085 foreach (
string slotName : attachmentSlots)
3086 {
3088 }
3089
3090
3092 {
3095
3097 }
3098 else
3099 {
3102
3104 }
3105
3108 }
3109
3111 {
3112
3114 return;
3115
3116 string slot_name_mounted = slot_name + "_Mounted";
3117 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3118
3119
3121 RemoveProxyPhysics( slot_name_mounted );
3122 RemoveProxyPhysics( slot_name );
3123
3124 if ( attachment )
3125 {
3127 if ( is_locked )
3128 {
3130 AddProxyPhysics( slot_name_mounted );
3131 }
3132 else
3133 {
3135 AddProxyPhysics( slot_name );
3136 }
3137 }
3138 }
3139
3141 {
3142 SetAffectPathgraph( true, false );
3144 }
3145
3147 {
3148 return true;
3149 }
3150
3152 {
3153 return true;
3154 }
3155
3157 {
3158 if ( attachment )
3159 {
3161 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3162
3163 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3164 }
3165
3166 return false;
3167 }
3168
3170 {
3172 }
3173
3174
3176 {
3177 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3178 if (
GetGame().ConfigIsExisting( config_path ) )
3179 {
3181 }
3182 }
3183
3185 {
3186 return true;
3187 }
3188
3190 {
3191 return true;
3192 }
3193
3195 {
3196 return true;
3197 }
3198
3199
3201 {
3203 {
3205 }
3206
3208 }
3209
3211 {
3213 }
3214
3215
3216
3218 {
3219 return super.CanReceiveAttachment(attachment, slotId);
3220 }
3221
3223 {
3224 int attachment_count = GetInventory().AttachmentCount();
3225 if ( attachment_count > 0 )
3226 {
3227 if (
HasBase() && attachment_count == 1 )
3228 {
3229 return false;
3230 }
3231
3232 return true;
3233 }
3234
3235 return false;
3236 }
3237
3239 {
3240 return true;
3241 }
3242
3244 {
3245 return false;
3246 }
3247
3248
3250 {
3251 return false;
3252 }
3253
3255 {
3256 return false;
3257 }
3258
3259
3261 {
3262 return false;
3263 }
3264
3265
3266
3268 {
3269 return true;
3270 }
3271
3273 {
3274 return true;
3275 }
3276
3279 {
3280 return false;
3281 }
3282
3283
3285 {
3286 return true;
3287 }
3288
3289
3291 {
3292 return false;
3293 }
3294
3295
3297 {
3298 return true;
3299 }
3300
3301
3303 {
3304 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3305 {
3306 return false;
3307 }
3308
3309 return true;
3310 }
3311
3313 {
3316
3317 return item;
3318 }
3319
3320
3322 {
3324 {
3325
3327
3328
3331
3333 if ( MemoryPointExists( slot_name + "_min" ) )
3334 {
3335 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3336 }
3337 if ( MemoryPointExists( slot_name + "_max" ) )
3338 {
3339 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3340 }
3341
3342
3345
3346
3349 center = ModelToWorld( center );
3350
3351
3354
3355 areaDamage.SetExtents( extents[0], extents[1] );
3356 areaDamage.SetAreaPosition( center );
3357 areaDamage.SetAreaOrientation( orientation );
3360 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3361 areaDamage.SetAmmoName( "BarbedWireHit" );
3362 areaDamage.Spawn();
3363
3365 }
3366 }
3367
3369 {
3370 if ( angle_deg != 0 )
3371 {
3372
3373 orientation[0] = orientation[0] - angle_deg;
3374
3375
3377 if ( MemoryPointExists( "rotate_axis" ) )
3378 {
3379 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3380 }
3381 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];
3382 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];
3383 center[0] = r_center_x;
3384 center[2] = r_center_z;
3385 }
3386 }
3387
3389 {
3391 {
3394 {
3395 if (areaDamage)
3396 {
3397 areaDamage.Destroy();
3398 }
3399
3401 }
3402 }
3403 }
3404
3406 {
3407 return true;
3408 }
3409
3410
3411
3412
3414 {
3416 }
3417
3419 {
3421 }
3422
3424 {
3426 }
3427
3429 {
3431
3432 switch ( material_type )
3433 {
3439 }
3440
3441 return "";
3442 }
3443
3445 {
3447
3448 switch ( material_type )
3449 {
3455 }
3456
3457 return "";
3458 }
3459
3460
3462 {
3464 {
3465
3467 {
3468 SetHealth(slot_name,"Health",item.GetHealth());
3469 }
3470 }
3471 }
3472
3474 {
3475 return 111;
3476 }
3477
3479 {
3480 super.SetActions();
3481
3485 }
3486
3487
3488
3489
3491 {
3492 }
3493
3496 {
3497 return null;
3498 }
3499
3501 {
3503 }
3504
3506 {
3509
3510 Man p;
3511
3512 #ifdef SERVER
3515 if (players.Count())
3516 p = players[0];
3517 #else
3519 #endif
3520
3522 {
3523 bool excluded = false;
3525 if (excludes)
3526 {
3527 foreach (string exclude : excludes)
3528 {
3530 {
3531 excluded = true;
3532 break;
3533 }
3534 }
3535 }
3536
3537 if (!excluded)
3538 {
3540 }
3541 }
3542
3544 }
3545}
3546
3548{
3549#ifdef BSB_DEBUG
3551#else
3552
3553#endif
3554}
3556{
3557#ifdef BSB_DEBUG_SPAM
3559#else
3560
3561#endif
3562}
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.