2285{
2287
2289
2291
2293
2299
2300
2301
2307
2313
2315
2319
2320
2322 {
2324
2325
2326 RegisterNetSyncVariableInt( "m_SyncParts01" );
2327 RegisterNetSyncVariableInt( "m_SyncParts02" );
2328 RegisterNetSyncVariableInt( "m_SyncParts03" );
2329 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2330 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2331 RegisterNetSyncVariableBool( "m_HasBase" );
2332
2333
2335
2336 if (ConfigIsExisting("hybridAttachments"))
2337 {
2340 }
2341 if (ConfigIsExisting("mountables"))
2342 {
2345 }
2346
2348 }
2349
2351 {
2352 super.EEDelete(parent);
2353
2355 {
2356 areaDamage.Destroy();
2357 }
2358
2359 }
2360
2362 {
2363 return "disableBaseDamage";
2364 }
2365
2367 {
2368 return true;
2369 }
2370
2372 {
2373 return EInventoryIconVisibility.HIDE_VICINITY;
2374 }
2375
2376
2378 {
2380 {
2381 SetSynchDirty();
2382 }
2383 }
2384
2386 {
2388 super.OnVariablesSynchronized();
2389
2391 }
2392
2394 {
2395
2397
2398
2400
2401
2403 }
2404
2405
2407 {
2408
2409 int offset;
2410 int mask;
2411
2412 if ( part_id >= 1 && part_id <= 31 )
2413 {
2414 offset = part_id - 1;
2415 mask = 1 << offset;
2416
2418 }
2419 else if ( part_id >= 32 && part_id <= 62 )
2420 {
2421 offset = ( part_id % 32 );
2422 mask = 1 << offset;
2423
2425 }
2426 else if ( part_id >= 63 && part_id <= 93 )
2427 {
2428 offset = ( part_id % 63 );
2429 mask = 1 << offset;
2430
2432 }
2433 }
2434
2436 {
2437
2438 int offset;
2439 int mask;
2440
2441 if ( part_id >= 1 && part_id <= 31 )
2442 {
2443 offset = part_id - 1;
2444 mask = 1 << offset;
2445
2447 }
2448 else if ( part_id >= 32 && part_id <= 62 )
2449 {
2450 offset = ( part_id % 32 );
2451 mask = 1 << offset;
2452
2454 }
2455 else if ( part_id >= 63 && part_id <= 93 )
2456 {
2457 offset = ( part_id % 63 );
2458 mask = 1 << offset;
2459
2461 }
2462 }
2463
2465 {
2466
2467 int offset;
2468 int mask;
2469
2470 if ( part_id >= 1 && part_id <= 31 )
2471 {
2472 offset = part_id - 1;
2473 mask = 1 << offset;
2474
2476 {
2477 return true;
2478 }
2479 }
2480 else if ( part_id >= 32 && part_id <= 62 )
2481 {
2482 offset = ( part_id % 32 );
2483 mask = 1 << offset;
2484
2486 {
2487 return true;
2488 }
2489 }
2490 else if ( part_id >= 63 && part_id <= 93 )
2491 {
2492 offset = ( part_id % 63 );
2493 mask = 1 << offset;
2494
2496 {
2497 return true;
2498 }
2499 }
2500
2501 return false;
2502 }
2503
2505 {
2508 }
2509
2511 {
2512
2515 }
2516
2518 {
2520 {
2523
2524 switch( build_action_id )
2525 {
2529 }
2530 }
2531 }
2532
2533
2535 {
2537 bool is_base = part.
IsBase();
2540 if ( is_part_built_sync )
2541 {
2543 {
2547
2548 if (is_base)
2549 {
2552 }
2553 }
2554 }
2555 else
2556 {
2558 {
2562
2563 if (is_base)
2564 {
2567 }
2568 }
2569 }
2570
2571
2573 }
2574
2575
2577 {
2580
2581 for ( int i = 0; i < construction_parts.Count(); ++i )
2582 {
2583 string key = construction_parts.GetKey( i );
2586 }
2587
2588
2590 }
2591
2593 {
2596
2597 for ( int i = 0; i < construction_parts.Count(); ++i )
2598 {
2599 string key = construction_parts.GetKey( i );
2601
2602 if ( value.
GetId() ==
id )
2603 {
2604 return value;
2605 }
2606 }
2607
2608 return NULL;
2609 }
2610
2611
2612
2614 {
2616 }
2617
2619 {
2621 }
2622
2624 {
2625 return true;
2626 }
2627
2629 {
2630 return false;
2631 }
2632
2633
2635 {
2638 {
2640 }
2641
2642 return construction_kit;
2643 }
2644
2646 {
2649 {
2651 }
2652 }
2653
2655 {
2657 }
2658
2660 {
2661 return "";
2662 }
2663
2665 {
2668 }
2669
2670
2672 {
2675 }
2676
2677
2679 {
2680 super.OnStoreSave( ctx );
2681
2682
2686
2688 }
2689
2691 {
2692 if ( !super.OnStoreLoad( ctx, version ) )
2693 return false;
2694
2695
2696
2698 {
2700 return false;
2701 }
2703 {
2705 return false;
2706 }
2708 {
2710 return false;
2711 }
2712
2713
2715 {
2717 return false;
2718 }
2719
2720
2721 return true;
2722 }
2723
2725 {
2726 super.AfterStoreLoad();
2727
2729 {
2731 }
2732 }
2733
2735 {
2736
2738
2739
2742
2743
2745 }
2746
2748 {
2749 super.OnCreatePhysics();
2752 }
2753
2755 {
2757 return;
2758
2759 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2760
2762 return;
2763
2765 string part_name = zone;
2767
2769 {
2770 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2771
2772 if ( construction_part && construction.IsPartConstructed( part_name ) )
2773 {
2775 construction.DestroyConnectedParts(part_name);
2776 }
2777
2778
2779 if ( part_name.
Contains(
"barbed") )
2780 {
2781 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2782 if (barbed_wire)
2783 barbed_wire.SetMountedState( false );
2784 }
2785 }
2786 }
2787
2789 {
2791 {
2793 }
2794
2795 super.EEOnAfterLoad();
2796 }
2797
2799 {
2800 super.EEInit();
2801
2802
2804
2805
2806 #ifdef DEVELOPER
2808 #endif
2809 }
2810
2812 {
2813 super.EEItemAttached( item, slot_name );
2814
2818 }
2819
2821 {
2822 super.EEItemDetached( item, slot_name );
2823
2826 }
2827
2828 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2829 {
2832
2835 }
2836
2837
2839 {
2840 return true;
2841 }
2842
2843
2844
2846 {
2848
2849
2850 if (construtionPart.
IsBase())
2851 {
2853
2854
2856 }
2857
2858
2860
2861
2863
2864
2866
2868
2870
2871
2873
2874
2876 }
2877
2879 {
2880
2882 }
2883
2884
2886 {
2889
2890
2892
2893
2895
2896
2898
2899
2901
2903
2904
2906
2907
2909
2910
2911 if (construtionPart.
IsBase())
2912 {
2913
2915 }
2916
2919 }
2920
2922 {
2923
2925 }
2926
2927
2928 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2929 {
2932
2933
2935
2936
2938
2939
2941
2942
2944
2946
2947
2949
2950
2952
2953
2954 if (construtionPart.
IsBase())
2955 {
2956
2958 }
2959
2962 }
2963
2965 {
2966
2968 }
2969
2971 {
2972 bool process = false;
2973
2974
2978
2979 if (process)
2980 {
2981 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2982 {
2984 return;
2985 }
2986
2988 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2989 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2990
2991
2993 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2994 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2995 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2996 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2997 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2998 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2999 mins = minTmp;
3000 maxs = maxTmp;
3001
3002 maxs[1] = maxs[1] + 0.35;
3003
3005 }
3006 }
3007
3009 {
3012
3013
3015 foreach (
EntityAI entity : foundEntities)
3016 {
3019 }
3020 }
3021
3022
3024 {
3026
3030 }
3031
3033 {
3035
3037 {
3039 }
3040 else
3041 {
3043 }
3044
3046 }
3047
3049 {
3051
3053 foreach (
string slotName : attachmentSlots)
3054 {
3056 }
3057
3058
3061 else
3063
3065 }
3066
3068 {
3069 string slotNameMounted = slot_name + "_Mounted";
3070 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3071
3072 if (attachment)
3073 {
3074 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3075 if (barbedWire && barbedWire.IsMounted())
3077 else
3079
3080 if (is_locked)
3081 {
3082 SetAnimationPhase(slotNameMounted, 0);
3083 SetAnimationPhase(slot_name, 1);
3084 }
3085 else
3086 {
3087 SetAnimationPhase(slotNameMounted, 1);
3088 SetAnimationPhase(slot_name, 0);
3089 }
3090 }
3091 else
3092 {
3093 SetAnimationPhase(slotNameMounted, 1);
3094 SetAnimationPhase(slot_name, 1);
3095
3097 }
3098 }
3099
3100
3102 {
3105
3108
3111
3112 foreach (
string slotName : attachmentSlots)
3113 {
3115 }
3116
3117
3119 {
3122
3124 }
3125 else
3126 {
3129
3131 }
3132
3135 }
3136
3138 {
3139
3141 return;
3142
3143 string slot_name_mounted = slot_name + "_Mounted";
3144 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3145
3146
3148 RemoveProxyPhysics( slot_name_mounted );
3149 RemoveProxyPhysics( slot_name );
3150
3151 if ( attachment )
3152 {
3154 if ( is_locked )
3155 {
3157 AddProxyPhysics( slot_name_mounted );
3158 }
3159 else
3160 {
3162 AddProxyPhysics( slot_name );
3163 }
3164 }
3165 }
3166
3168 {
3169 SetAffectPathgraph( true, false );
3171 }
3172
3174 {
3175 return true;
3176 }
3177
3179 {
3180 return true;
3181 }
3182
3184 {
3185 if ( attachment )
3186 {
3188 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3189
3190 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3191 }
3192
3193 return false;
3194 }
3195
3197 {
3199 }
3200
3201
3203 {
3204 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3205 if (
GetGame().ConfigIsExisting( config_path ) )
3206 {
3208 }
3209 }
3210
3212 {
3213 return true;
3214 }
3215
3217 {
3218 return true;
3219 }
3220
3222 {
3223 return true;
3224 }
3225
3226
3228 {
3230 {
3232 }
3233
3235 }
3236
3238 {
3240 }
3241
3242
3243
3245 {
3246 return super.CanReceiveAttachment(attachment, slotId);
3247 }
3248
3250 {
3251 int attachment_count = GetInventory().AttachmentCount();
3252 if ( attachment_count > 0 )
3253 {
3254 if (
HasBase() && attachment_count == 1 )
3255 {
3256 return false;
3257 }
3258
3259 return true;
3260 }
3261
3262 return false;
3263 }
3264
3266 {
3267 return true;
3268 }
3269
3271 {
3272 return false;
3273 }
3274
3275
3277 {
3278 return false;
3279 }
3280
3282 {
3283 return false;
3284 }
3285
3286
3288 {
3289 return false;
3290 }
3291
3292
3293
3295 {
3296 return true;
3297 }
3298
3300 {
3301 return true;
3302 }
3303
3306 {
3307 return false;
3308 }
3309
3310
3312 {
3313 return true;
3314 }
3315
3316
3318 {
3319 return false;
3320 }
3321
3322
3324 {
3325 return true;
3326 }
3327
3328
3330 {
3331 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3332 {
3333 return false;
3334 }
3335
3336 return true;
3337 }
3338
3340 {
3343
3344 return item;
3345 }
3346
3347
3349 {
3351 {
3352
3354
3355
3358
3360 if ( MemoryPointExists( slot_name + "_min" ) )
3361 {
3362 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3363 }
3364 if ( MemoryPointExists( slot_name + "_max" ) )
3365 {
3366 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3367 }
3368
3369
3372
3373
3376 center = ModelToWorld( center );
3377
3378
3381
3382 areaDamage.SetExtents( extents[0], extents[1] );
3383 areaDamage.SetAreaPosition( center );
3384 areaDamage.SetAreaOrientation( orientation );
3387 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3388 areaDamage.SetAmmoName( "BarbedWireHit" );
3389 areaDamage.Spawn();
3390
3392 }
3393 }
3394
3396 {
3397 if ( angle_deg != 0 )
3398 {
3399
3400 orientation[0] = orientation[0] - angle_deg;
3401
3402
3404 if ( MemoryPointExists( "rotate_axis" ) )
3405 {
3406 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3407 }
3408 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];
3409 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];
3410 center[0] = r_center_x;
3411 center[2] = r_center_z;
3412 }
3413 }
3414
3416 {
3418 {
3421 {
3422 if (areaDamage)
3423 {
3424 areaDamage.Destroy();
3425 }
3426
3428 }
3429 }
3430 }
3431
3433 {
3434 return true;
3435 }
3436
3437
3438
3439
3441 {
3443 }
3444
3446 {
3448 }
3449
3451 {
3453 }
3454
3456 {
3458
3459 switch ( material_type )
3460 {
3466 }
3467
3468 return "";
3469 }
3470
3472 {
3474
3475 switch ( material_type )
3476 {
3482 }
3483
3484 return "";
3485 }
3486
3487
3489 {
3491 {
3492
3494 {
3495 SetHealth(slot_name,"Health",item.GetHealth());
3496 }
3497 }
3498 }
3499
3501 {
3502 return 111;
3503 }
3504
3506 {
3507 super.SetActions();
3508
3512 }
3513
3514
3515
3516
3518 {
3519 }
3520
3523 {
3524 return null;
3525 }
3526
3528 {
3530 }
3531
3533 {
3536
3537 Man p;
3538
3539 #ifdef SERVER
3542 if (players.Count())
3543 p = players[0];
3544 #else
3546 #endif
3547
3549 {
3550 bool excluded = false;
3552 if (excludes)
3553 {
3554 foreach (string exclude : excludes)
3555 {
3557 {
3558 excluded = true;
3559 break;
3560 }
3561 }
3562 }
3563
3564 if (!excluded)
3565 {
3567 }
3568 }
3569
3571 }
3572}
3573
3575{
3576#ifdef BSB_DEBUG
3578#else
3579
3580#endif
3581}
3583{
3584#ifdef BSB_DEBUG_SPAM
3586#else
3587
3588#endif
3589}
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.