2296{
2298
2300
2302
2304
2310
2311
2312
2318
2324
2326
2330
2331
2333 {
2335
2336
2337 RegisterNetSyncVariableInt( "m_SyncParts01" );
2338 RegisterNetSyncVariableInt( "m_SyncParts02" );
2339 RegisterNetSyncVariableInt( "m_SyncParts03" );
2340 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2341 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2342 RegisterNetSyncVariableBool( "m_HasBase" );
2343
2344
2346
2347 if (ConfigIsExisting("hybridAttachments"))
2348 {
2351 }
2352 if (ConfigIsExisting("mountables"))
2353 {
2356 }
2357
2359 }
2360
2362 {
2363 super.EEDelete(parent);
2364
2366 {
2367 areaDamage.Destroy();
2368 }
2369
2370 }
2371
2373 {
2374 return "disableBaseDamage";
2375 }
2376
2378 {
2379 return true;
2380 }
2381
2383 {
2384 return EInventoryIconVisibility.HIDE_VICINITY;
2385 }
2386
2387
2389 {
2391 {
2392 SetSynchDirty();
2393 }
2394 }
2395
2397 {
2399 super.OnVariablesSynchronized();
2400
2402 }
2403
2405 {
2406
2408
2409
2411
2412
2414 }
2415
2416
2418 {
2419
2420 int offset;
2421 int mask;
2422
2423 if ( part_id >= 1 && part_id <= 31 )
2424 {
2425 offset = part_id - 1;
2426 mask = 1 << offset;
2427
2429 }
2430 else if ( part_id >= 32 && part_id <= 62 )
2431 {
2432 offset = ( part_id % 32 );
2433 mask = 1 << offset;
2434
2436 }
2437 else if ( part_id >= 63 && part_id <= 93 )
2438 {
2439 offset = ( part_id % 63 );
2440 mask = 1 << offset;
2441
2443 }
2444 }
2445
2447 {
2448
2449 int offset;
2450 int mask;
2451
2452 if ( part_id >= 1 && part_id <= 31 )
2453 {
2454 offset = part_id - 1;
2455 mask = 1 << offset;
2456
2458 }
2459 else if ( part_id >= 32 && part_id <= 62 )
2460 {
2461 offset = ( part_id % 32 );
2462 mask = 1 << offset;
2463
2465 }
2466 else if ( part_id >= 63 && part_id <= 93 )
2467 {
2468 offset = ( part_id % 63 );
2469 mask = 1 << offset;
2470
2472 }
2473 }
2474
2476 {
2477
2478 int offset;
2479 int mask;
2480
2481 if ( part_id >= 1 && part_id <= 31 )
2482 {
2483 offset = part_id - 1;
2484 mask = 1 << offset;
2485
2487 {
2488 return true;
2489 }
2490 }
2491 else if ( part_id >= 32 && part_id <= 62 )
2492 {
2493 offset = ( part_id % 32 );
2494 mask = 1 << offset;
2495
2497 {
2498 return true;
2499 }
2500 }
2501 else if ( part_id >= 63 && part_id <= 93 )
2502 {
2503 offset = ( part_id % 63 );
2504 mask = 1 << offset;
2505
2507 {
2508 return true;
2509 }
2510 }
2511
2512 return false;
2513 }
2514
2516 {
2519 }
2520
2522 {
2523
2526 }
2527
2529 {
2531 {
2534
2535 switch( build_action_id )
2536 {
2540 }
2541 }
2542 }
2543
2544
2546 {
2548 bool is_base = part.
IsBase();
2551 if ( is_part_built_sync )
2552 {
2554 {
2558
2559 if (is_base)
2560 {
2563 }
2564 }
2565 }
2566 else
2567 {
2569 {
2573
2574 if (is_base)
2575 {
2578 }
2579 }
2580 }
2581
2582
2584 }
2585
2586
2588 {
2591
2592 for ( int i = 0; i < construction_parts.Count(); ++i )
2593 {
2594 string key = construction_parts.GetKey( i );
2597 }
2598
2599
2601 }
2602
2604 {
2607
2608 for ( int i = 0; i < construction_parts.Count(); ++i )
2609 {
2610 string key = construction_parts.GetKey( i );
2612
2613 if ( value.
GetId() ==
id )
2614 {
2615 return value;
2616 }
2617 }
2618
2619 return NULL;
2620 }
2621
2622
2623
2625 {
2627 }
2628
2630 {
2632 }
2633
2635 {
2636 return true;
2637 }
2638
2640 {
2641 return false;
2642 }
2643
2644
2646 {
2649 {
2651 }
2652
2653 return construction_kit;
2654 }
2655
2657 {
2660 {
2662 }
2663 }
2664
2666 {
2668 }
2669
2671 {
2672 return "";
2673 }
2674
2676 {
2679 }
2680
2681
2683 {
2686 }
2687
2688
2690 {
2691 super.OnStoreSave( ctx );
2692
2693
2697
2699 }
2700
2702 {
2703 if ( !super.OnStoreLoad( ctx, version ) )
2704 return false;
2705
2706
2707
2709 {
2711 return false;
2712 }
2714 {
2716 return false;
2717 }
2719 {
2721 return false;
2722 }
2723
2724
2726 {
2728 return false;
2729 }
2730
2731
2732 return true;
2733 }
2734
2736 {
2737 super.AfterStoreLoad();
2738
2740 {
2742 }
2743 }
2744
2746 {
2747
2749
2750
2753
2754
2756 }
2757
2759 {
2760 super.OnCreatePhysics();
2763 }
2764
2766 {
2768 return;
2769
2770 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2771
2773 return;
2774
2776 string part_name = zone;
2778
2780 {
2781 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2782
2783 if ( construction_part && construction.IsPartConstructed( part_name ) )
2784 {
2786 construction.DestroyConnectedParts(part_name);
2787 }
2788
2789
2790 if ( part_name.
Contains(
"barbed") )
2791 {
2792 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2793 if (barbed_wire)
2794 barbed_wire.SetMountedState( false );
2795 }
2796 }
2797 }
2798
2800 {
2802 {
2804 }
2805
2806 super.EEOnAfterLoad();
2807 }
2808
2810 {
2811 super.EEInit();
2812
2813
2815
2816
2817 #ifdef DEVELOPER
2819 #endif
2820 }
2821
2823 {
2824 super.EEItemAttached( item, slot_name );
2825
2829 }
2830
2832 {
2833 super.EEItemDetached( item, slot_name );
2834
2837 }
2838
2839 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2840 {
2843
2846 }
2847
2848
2850 {
2851 return true;
2852 }
2853
2854
2855
2857 {
2859
2860
2861 if (construtionPart.
IsBase())
2862 {
2864
2865
2867 }
2868
2869
2871
2872
2874
2875
2877
2879
2881
2882
2884
2885
2887 }
2888
2890 {
2891
2893 }
2894
2895
2897 {
2900
2901
2903
2904
2906
2907
2909
2910
2912
2914
2915
2917
2918
2920
2921
2922 if (construtionPart.
IsBase())
2923 {
2924
2926 }
2927
2930 }
2931
2933 {
2934
2936 }
2937
2938
2939 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2940 {
2943
2944
2946
2947
2949
2950
2952
2953
2955
2957
2958
2960
2961
2963
2964
2965 if (construtionPart.
IsBase())
2966 {
2967
2969 }
2970
2973 }
2974
2976 {
2977
2979 }
2980
2982 {
2983 bool process = false;
2984
2985
2989
2990 if (process)
2991 {
2992 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2993 {
2995 return;
2996 }
2997
2999 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3000 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3001
3002
3004 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3005 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3006 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3007 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3008 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3009 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3010 mins = minTmp;
3011 maxs = maxTmp;
3012
3013 maxs[1] = maxs[1] + 0.35;
3014
3016 }
3017 }
3018
3020 {
3023
3024
3026 foreach (
EntityAI entity : foundEntities)
3027 {
3030 }
3031 }
3032
3033
3035 {
3037
3041 }
3042
3044 {
3046
3048 {
3050 }
3051 else
3052 {
3054 }
3055
3057 }
3058
3060 {
3062
3064 foreach (
string slotName : attachmentSlots)
3065 {
3067 }
3068
3069
3072 else
3074
3076 }
3077
3079 {
3080 string slotNameMounted = slot_name + "_Mounted";
3081 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3082
3083 if (attachment)
3084 {
3085 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3086 if (barbedWire && barbedWire.IsMounted())
3088 else
3090
3091 if (is_locked)
3092 {
3093 SetAnimationPhase(slotNameMounted, 0);
3094 SetAnimationPhase(slot_name, 1);
3095 }
3096 else
3097 {
3098 SetAnimationPhase(slotNameMounted, 1);
3099 SetAnimationPhase(slot_name, 0);
3100 }
3101 }
3102 else
3103 {
3104 SetAnimationPhase(slotNameMounted, 1);
3105 SetAnimationPhase(slot_name, 1);
3106
3108 }
3109 }
3110
3111
3113 {
3116
3119
3122
3123 foreach (
string slotName : attachmentSlots)
3124 {
3126 }
3127
3128
3130 {
3133
3135 }
3136 else
3137 {
3140
3142 }
3143
3146 }
3147
3149 {
3150
3152 return;
3153
3154 string slot_name_mounted = slot_name + "_Mounted";
3155 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3156
3157
3159 RemoveProxyPhysics( slot_name_mounted );
3160 RemoveProxyPhysics( slot_name );
3161
3162 if ( attachment )
3163 {
3165 if ( is_locked )
3166 {
3168 AddProxyPhysics( slot_name_mounted );
3169 }
3170 else
3171 {
3173 AddProxyPhysics( slot_name );
3174 }
3175 }
3176 }
3177
3179 {
3180 SetAffectPathgraph( true, false );
3182 }
3183
3185 {
3186 return true;
3187 }
3188
3190 {
3191 return true;
3192 }
3193
3195 {
3196 if ( attachment )
3197 {
3199 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3200
3201 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3202 }
3203
3204 return false;
3205 }
3206
3208 {
3210 }
3211
3212
3214 {
3215 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3216 if (
GetGame().ConfigIsExisting( config_path ) )
3217 {
3219 }
3220 }
3221
3223 {
3224 return true;
3225 }
3226
3228 {
3229 return true;
3230 }
3231
3233 {
3234 return true;
3235 }
3236
3237
3239 {
3241 {
3243 }
3244
3246 }
3247
3249 {
3251 }
3252
3253
3254
3256 {
3257 return super.CanReceiveAttachment(attachment, slotId);
3258 }
3259
3261 {
3262 int attachment_count = GetInventory().AttachmentCount();
3263 if ( attachment_count > 0 )
3264 {
3265 if (
HasBase() && attachment_count == 1 )
3266 {
3267 return false;
3268 }
3269
3270 return true;
3271 }
3272
3273 return false;
3274 }
3275
3277 {
3278 return true;
3279 }
3280
3282 {
3283 return false;
3284 }
3285
3286
3288 {
3289 return false;
3290 }
3291
3293 {
3294 return false;
3295 }
3296
3297
3299 {
3300 return false;
3301 }
3302
3303
3304
3306 {
3307 return true;
3308 }
3309
3311 {
3312 return true;
3313 }
3314
3317 {
3318 return false;
3319 }
3320
3321
3323 {
3324 return true;
3325 }
3326
3327
3329 {
3330 return false;
3331 }
3332
3333
3335 {
3336 return true;
3337 }
3338
3339
3341 {
3342 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3343 {
3344 return false;
3345 }
3346
3347 return true;
3348 }
3349
3351 {
3354
3355 return item;
3356 }
3357
3358
3360 {
3362 {
3363
3365
3366
3369
3371 if ( MemoryPointExists( slot_name + "_min" ) )
3372 {
3373 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3374 }
3375 if ( MemoryPointExists( slot_name + "_max" ) )
3376 {
3377 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3378 }
3379
3380
3383
3384
3387 center = ModelToWorld( center );
3388
3389
3392
3393 areaDamage.SetExtents( extents[0], extents[1] );
3394 areaDamage.SetAreaPosition( center );
3395 areaDamage.SetAreaOrientation( orientation );
3398 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3399 areaDamage.SetAmmoName( "BarbedWireHit" );
3400 areaDamage.Spawn();
3401
3403 }
3404 }
3405
3407 {
3408 if ( angle_deg != 0 )
3409 {
3410
3411 orientation[0] = orientation[0] - angle_deg;
3412
3413
3415 if ( MemoryPointExists( "rotate_axis" ) )
3416 {
3417 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3418 }
3419 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];
3420 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];
3421 center[0] = r_center_x;
3422 center[2] = r_center_z;
3423 }
3424 }
3425
3427 {
3429 {
3432 {
3433 if (areaDamage)
3434 {
3435 areaDamage.Destroy();
3436 }
3437
3439 }
3440 }
3441 }
3442
3444 {
3445 return true;
3446 }
3447
3448
3449
3450
3452 {
3454 }
3455
3457 {
3459 }
3460
3462 {
3464 }
3465
3467 {
3469
3470 switch ( material_type )
3471 {
3477 }
3478
3479 return "";
3480 }
3481
3483 {
3485
3486 switch ( material_type )
3487 {
3493 }
3494
3495 return "";
3496 }
3497
3498
3500 {
3502 {
3503
3505 {
3506 SetHealth(slot_name,"Health",item.GetHealth());
3507 }
3508 }
3509 }
3510
3512 {
3513 return 111;
3514 }
3515
3517 {
3518 super.SetActions();
3519
3523 }
3524
3525
3526
3527
3529 {
3530 }
3531
3534 {
3535 return null;
3536 }
3537
3539 {
3541 }
3542
3544 {
3547
3548 Man p;
3549
3550 #ifdef SERVER
3553 if (players.Count())
3554 p = players[0];
3555 #else
3557 #endif
3558
3560 {
3561 bool excluded = false;
3563 if (excludes)
3564 {
3565 foreach (string exclude : excludes)
3566 {
3568 {
3569 excluded = true;
3570 break;
3571 }
3572 }
3573 }
3574
3575 if (!excluded)
3576 {
3578 }
3579 }
3580
3582 }
3583}
3584
3586{
3587#ifdef BSB_DEBUG
3589#else
3590
3591#endif
3592}
3594{
3595#ifdef BSB_DEBUG_SPAM
3597#else
3598
3599#endif
3600}
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.