2326{
2328
2330
2332
2334
2340
2341
2342
2348
2354
2356
2360
2361
2363 {
2365
2366
2367 RegisterNetSyncVariableInt( "m_SyncParts01" );
2368 RegisterNetSyncVariableInt( "m_SyncParts02" );
2369 RegisterNetSyncVariableInt( "m_SyncParts03" );
2370 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2371 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2372 RegisterNetSyncVariableBool( "m_HasBase" );
2373
2374
2376
2377 if (ConfigIsExisting("hybridAttachments"))
2378 {
2381 }
2382 if (ConfigIsExisting("mountables"))
2383 {
2386 }
2387
2389 }
2390
2392 {
2393 super.EEDelete(parent);
2394
2396 {
2397 areaDamage.Destroy();
2398 }
2399
2400 }
2401
2403 {
2404 return "disableBaseDamage";
2405 }
2406
2408 {
2409 return true;
2410 }
2411
2413 {
2414 return EInventoryIconVisibility.HIDE_VICINITY;
2415 }
2416
2417
2419 {
2421 {
2422 SetSynchDirty();
2423 }
2424 }
2425
2427 {
2429 super.OnVariablesSynchronized();
2430
2432 }
2433
2435 {
2436
2438
2439
2441
2442
2444 }
2445
2446
2448 {
2449
2450 int offset;
2451 int mask;
2452
2453 if ( part_id >= 1 && part_id <= 31 )
2454 {
2455 offset = part_id - 1;
2456 mask = 1 << offset;
2457
2459 }
2460 else if ( part_id >= 32 && part_id <= 62 )
2461 {
2462 offset = ( part_id % 32 );
2463 mask = 1 << offset;
2464
2466 }
2467 else if ( part_id >= 63 && part_id <= 93 )
2468 {
2469 offset = ( part_id % 63 );
2470 mask = 1 << offset;
2471
2473 }
2474 }
2475
2477 {
2478
2479 int offset;
2480 int mask;
2481
2482 if ( part_id >= 1 && part_id <= 31 )
2483 {
2484 offset = part_id - 1;
2485 mask = 1 << offset;
2486
2488 }
2489 else if ( part_id >= 32 && part_id <= 62 )
2490 {
2491 offset = ( part_id % 32 );
2492 mask = 1 << offset;
2493
2495 }
2496 else if ( part_id >= 63 && part_id <= 93 )
2497 {
2498 offset = ( part_id % 63 );
2499 mask = 1 << offset;
2500
2502 }
2503 }
2504
2506 {
2507
2508 int offset;
2509 int mask;
2510
2511 if ( part_id >= 1 && part_id <= 31 )
2512 {
2513 offset = part_id - 1;
2514 mask = 1 << offset;
2515
2517 {
2518 return true;
2519 }
2520 }
2521 else if ( part_id >= 32 && part_id <= 62 )
2522 {
2523 offset = ( part_id % 32 );
2524 mask = 1 << offset;
2525
2527 {
2528 return true;
2529 }
2530 }
2531 else if ( part_id >= 63 && part_id <= 93 )
2532 {
2533 offset = ( part_id % 63 );
2534 mask = 1 << offset;
2535
2537 {
2538 return true;
2539 }
2540 }
2541
2542 return false;
2543 }
2544
2546 {
2549 }
2550
2552 {
2553
2556 }
2557
2559 {
2561 {
2564
2565 switch( build_action_id )
2566 {
2570 }
2571 }
2572 }
2573
2574
2576 {
2578 bool is_base = part.
IsBase();
2581 if ( is_part_built_sync )
2582 {
2584 {
2588
2589 if (is_base)
2590 {
2593 }
2594 }
2595 }
2596 else
2597 {
2599 {
2603
2604 if (is_base)
2605 {
2608 }
2609 }
2610 }
2611
2612
2614 }
2615
2616
2618 {
2621
2622 for ( int i = 0; i < construction_parts.Count(); ++i )
2623 {
2624 string key = construction_parts.GetKey( i );
2627 }
2628
2629
2631 }
2632
2634 {
2637
2638 for ( int i = 0; i < construction_parts.Count(); ++i )
2639 {
2640 string key = construction_parts.GetKey( i );
2642
2643 if ( value.
GetId() ==
id )
2644 {
2645 return value;
2646 }
2647 }
2648
2649 return NULL;
2650 }
2651
2652
2653
2655 {
2657 }
2658
2660 {
2662 }
2663
2665 {
2666 return true;
2667 }
2668
2670 {
2671 return false;
2672 }
2673
2674
2676 {
2679 {
2681 }
2682
2683 return construction_kit;
2684 }
2685
2687 {
2690 {
2692 }
2693 }
2694
2696 {
2698 }
2699
2701 {
2702 return "";
2703 }
2704
2706 {
2709 }
2710
2711
2713 {
2716 }
2717
2718
2720 {
2721 super.OnStoreSave( ctx );
2722
2723
2727
2729 }
2730
2732 {
2733 if ( !super.OnStoreLoad( ctx, version ) )
2734 return false;
2735
2736
2737
2739 {
2741 return false;
2742 }
2744 {
2746 return false;
2747 }
2749 {
2751 return false;
2752 }
2753
2754
2756 {
2758 return false;
2759 }
2760
2761
2762 return true;
2763 }
2764
2766 {
2767 super.AfterStoreLoad();
2768
2770 {
2772 }
2773 }
2774
2776 {
2777
2779
2780
2783
2784
2786 }
2787
2789 {
2790 super.OnCreatePhysics();
2793 }
2794
2796 {
2798 return;
2799
2800 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2801
2803 return;
2804
2806 string part_name = zone;
2808
2810 {
2811 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2812
2813 if ( construction_part && construction.IsPartConstructed( part_name ) )
2814 {
2816 construction.DestroyConnectedParts(part_name);
2817 }
2818
2819
2820 if ( part_name.
Contains(
"barbed") )
2821 {
2822 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2823 if (barbed_wire)
2824 barbed_wire.SetMountedState( false );
2825 }
2826 }
2827 }
2828
2830 {
2832 {
2834 }
2835
2836 super.EEOnAfterLoad();
2837 }
2838
2840 {
2841 super.EEInit();
2842
2843
2845
2846
2847 #ifdef DEVELOPER
2849 #endif
2850 }
2851
2853 {
2854 super.EEItemAttached( item, slot_name );
2855
2859 }
2860
2862 {
2863 super.EEItemDetached( item, slot_name );
2864
2867 }
2868
2869 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2870 {
2873
2876 }
2877
2878
2880 {
2881 return true;
2882 }
2883
2884
2885
2887 {
2889
2890
2891 if (construtionPart.
IsBase())
2892 {
2894
2895
2897 }
2898
2899
2901
2902
2904
2905
2907
2909
2911
2912
2914
2915
2917 }
2918
2920 {
2921
2923 }
2924
2925
2927 {
2930
2931
2933
2934
2936
2937
2939
2940
2942
2944
2945
2947
2948
2950
2951
2952 if (construtionPart.
IsBase())
2953 {
2954
2956 }
2957
2960 }
2961
2963 {
2964
2966 }
2967
2968
2969 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2970 {
2973
2974
2976
2977
2979
2980
2982
2983
2985
2987
2988
2990
2991
2993
2994
2995 if (construtionPart.
IsBase())
2996 {
2997
2999 }
3000
3003 }
3004
3006 {
3007
3009 }
3010
3012 {
3013 bool process = false;
3014
3015
3019
3020 if (process)
3021 {
3022 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3023 {
3025 return;
3026 }
3027
3029 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3030 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3031
3032
3034 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3035 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3036 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3037 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3038 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3039 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3040 mins = minTmp;
3041 maxs = maxTmp;
3042
3043 maxs[1] = maxs[1] + 0.35;
3044
3046 }
3047 }
3048
3050 {
3053
3054
3056 foreach (
EntityAI entity : foundEntities)
3057 {
3060 }
3061 }
3062
3063
3065 {
3067
3071 }
3072
3074 {
3076
3078 {
3080 }
3081 else
3082 {
3084 }
3085
3087 }
3088
3090 {
3092
3094 foreach (
string slotName : attachmentSlots)
3095 {
3097 }
3098
3099
3102 else
3104
3106 }
3107
3109 {
3110 string slotNameMounted = slot_name + "_Mounted";
3111 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3112
3113 if (attachment)
3114 {
3115 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3116 if (barbedWire && barbedWire.IsMounted())
3118 else
3120
3121 if (is_locked)
3122 {
3123 SetAnimationPhase(slotNameMounted, 0);
3124 SetAnimationPhase(slot_name, 1);
3125 }
3126 else
3127 {
3128 SetAnimationPhase(slotNameMounted, 1);
3129 SetAnimationPhase(slot_name, 0);
3130 }
3131 }
3132 else
3133 {
3134 SetAnimationPhase(slotNameMounted, 1);
3135 SetAnimationPhase(slot_name, 1);
3136
3138 }
3139 }
3140
3141
3143 {
3146
3149
3152
3153 foreach (
string slotName : attachmentSlots)
3154 {
3156 }
3157
3158
3160 {
3163
3165 }
3166 else
3167 {
3170
3172 }
3173
3176 }
3177
3179 {
3180
3182 return;
3183
3184 string slot_name_mounted = slot_name + "_Mounted";
3185 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3186
3187
3189 RemoveProxyPhysics( slot_name_mounted );
3190 RemoveProxyPhysics( slot_name );
3191
3192 if ( attachment )
3193 {
3195 if ( is_locked )
3196 {
3198 AddProxyPhysics( slot_name_mounted );
3199 }
3200 else
3201 {
3203 AddProxyPhysics( slot_name );
3204 }
3205 }
3206 }
3207
3209 {
3210 SetAffectPathgraph( true, false );
3212 }
3213
3215 {
3216 return true;
3217 }
3218
3220 {
3221 return true;
3222 }
3223
3225 {
3226 if ( attachment )
3227 {
3229 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3230
3231 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3232 }
3233
3234 return false;
3235 }
3236
3238 {
3240 }
3241
3242
3244 {
3245 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3246 if (
GetGame().ConfigIsExisting( config_path ) )
3247 {
3249 }
3250 }
3251
3253 {
3254 return true;
3255 }
3256
3258 {
3259 return true;
3260 }
3261
3263 {
3264 return true;
3265 }
3266
3267
3269 {
3271 {
3273 }
3274
3276 }
3277
3279 {
3281 }
3282
3283
3284
3286 {
3287 return super.CanReceiveAttachment(attachment, slotId);
3288 }
3289
3291 {
3292 int attachment_count = GetInventory().AttachmentCount();
3293 if ( attachment_count > 0 )
3294 {
3295 if (
HasBase() && attachment_count == 1 )
3296 {
3297 return false;
3298 }
3299
3300 return true;
3301 }
3302
3303 return false;
3304 }
3305
3307 {
3308 return true;
3309 }
3310
3312 {
3313 return false;
3314 }
3315
3316
3318 {
3319 return false;
3320 }
3321
3323 {
3324 return false;
3325 }
3326
3327
3329 {
3330 return false;
3331 }
3332
3333
3334
3336 {
3337 return true;
3338 }
3339
3341 {
3342 return true;
3343 }
3344
3347 {
3348 return false;
3349 }
3350
3351
3353 {
3354 return true;
3355 }
3356
3357
3359 {
3360 return false;
3361 }
3362
3363
3365 {
3366 return true;
3367 }
3368
3369
3371 {
3372 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3373 {
3374 return false;
3375 }
3376
3377 return true;
3378 }
3379
3381 {
3384
3385 return item;
3386 }
3387
3388
3390 {
3392 {
3393
3395
3396
3399
3401 if ( MemoryPointExists( slot_name + "_min" ) )
3402 {
3403 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3404 }
3405 if ( MemoryPointExists( slot_name + "_max" ) )
3406 {
3407 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3408 }
3409
3410
3413
3414
3417 center = ModelToWorld( center );
3418
3419
3422
3423 areaDamage.SetExtents( extents[0], extents[1] );
3424 areaDamage.SetAreaPosition( center );
3425 areaDamage.SetAreaOrientation( orientation );
3428 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3429 areaDamage.SetAmmoName( "BarbedWireHit" );
3430 areaDamage.Spawn();
3431
3433 }
3434 }
3435
3437 {
3438 if ( angle_deg != 0 )
3439 {
3440
3441 orientation[0] = orientation[0] - angle_deg;
3442
3443
3445 if ( MemoryPointExists( "rotate_axis" ) )
3446 {
3447 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3448 }
3449 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];
3450 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];
3451 center[0] = r_center_x;
3452 center[2] = r_center_z;
3453 }
3454 }
3455
3457 {
3459 {
3462 {
3463 if (areaDamage)
3464 {
3465 areaDamage.Destroy();
3466 }
3467
3469 }
3470 }
3471 }
3472
3474 {
3475 return true;
3476 }
3477
3478
3479
3480
3482 {
3484 }
3485
3487 {
3489 }
3490
3492 {
3494 }
3495
3497 {
3499
3500 switch ( material_type )
3501 {
3507 }
3508
3509 return "";
3510 }
3511
3513 {
3515
3516 switch ( material_type )
3517 {
3523 }
3524
3525 return "";
3526 }
3527
3528
3530 {
3532 {
3533
3535 {
3536 SetHealth(slot_name,"Health",item.GetHealth());
3537 }
3538 }
3539 }
3540
3542 {
3543 return 111;
3544 }
3545
3547 {
3548 super.SetActions();
3549
3553 }
3554
3555
3556
3557
3559 {
3560 }
3561
3564 {
3565 return null;
3566 }
3567
3569 {
3571 }
3572
3574 {
3577
3578 Man p;
3579
3580 #ifdef SERVER
3583 if (players.Count())
3584 p = players[0];
3585 #else
3587 #endif
3588
3590 {
3591 bool excluded = false;
3593 if (excludes)
3594 {
3595 foreach (string exclude : excludes)
3596 {
3598 {
3599 excluded = true;
3600 break;
3601 }
3602 }
3603 }
3604
3605 if (!excluded)
3606 {
3608 }
3609 }
3610
3612 }
3613}
3614
3616{
3617#ifdef BSB_DEBUG
3619#else
3620
3621#endif
3622}
3624{
3625#ifdef BSB_DEBUG_SPAM
3627#else
3628
3629#endif
3630}
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.