Some buildings can only be built from outside.
2314{
2316
2318
2320
2322
2328
2329
2330
2336
2342
2344
2348
2349
2351 {
2353
2354
2355 RegisterNetSyncVariableInt( "m_SyncParts01" );
2356 RegisterNetSyncVariableInt( "m_SyncParts02" );
2357 RegisterNetSyncVariableInt( "m_SyncParts03" );
2358 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2359 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2360 RegisterNetSyncVariableBool( "m_HasBase" );
2361
2362
2364
2365 if (ConfigIsExisting("hybridAttachments"))
2366 {
2369 }
2370 if (ConfigIsExisting("mountables"))
2371 {
2374 }
2375
2377 }
2378
2380 {
2381 super.EEDelete(parent);
2382
2384 {
2385 areaDamage.Destroy();
2386 }
2387
2388 }
2389
2391 {
2392 return "disableBaseDamage";
2393 }
2394
2396 {
2397 return true;
2398 }
2399
2401 {
2402 return EInventoryIconVisibility.HIDE_VICINITY;
2403 }
2404
2405
2407 {
2409 {
2410 SetSynchDirty();
2411 }
2412 }
2413
2415 {
2417 super.OnVariablesSynchronized();
2418
2420 }
2421
2423 {
2424
2426
2427
2429
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 else if ( part_id >= 32 && part_id <= 62 )
2478 {
2479 offset = ( part_id % 32 );
2480 mask = 1 << offset;
2481
2483 }
2484 else if ( part_id >= 63 && part_id <= 93 )
2485 {
2486 offset = ( part_id % 63 );
2487 mask = 1 << offset;
2488
2490 }
2491 }
2492
2494 {
2495
2496 int offset;
2497 int mask;
2498
2499 if ( part_id >= 1 && part_id <= 31 )
2500 {
2501 offset = part_id - 1;
2502 mask = 1 << offset;
2503
2505 {
2506 return true;
2507 }
2508 }
2509 else if ( part_id >= 32 && part_id <= 62 )
2510 {
2511 offset = ( part_id % 32 );
2512 mask = 1 << offset;
2513
2515 {
2516 return true;
2517 }
2518 }
2519 else if ( part_id >= 63 && part_id <= 93 )
2520 {
2521 offset = ( part_id % 63 );
2522 mask = 1 << offset;
2523
2525 {
2526 return true;
2527 }
2528 }
2529
2530 return false;
2531 }
2532
2534 {
2537 }
2538
2540 {
2541
2544 }
2545
2547 {
2549 {
2552
2553 switch( build_action_id )
2554 {
2558 }
2559 }
2560 }
2561
2562
2564 {
2566 bool is_base = part.
IsBase();
2569 if ( is_part_built_sync )
2570 {
2572 {
2576
2577 if (is_base)
2578 {
2581 }
2582 }
2583 }
2584 else
2585 {
2587 {
2591
2592 if (is_base)
2593 {
2596 }
2597 }
2598 }
2599
2600
2602 }
2603
2604
2606 {
2609
2610 for ( int i = 0; i < construction_parts.Count(); ++i )
2611 {
2612 string key = construction_parts.GetKey( i );
2615 }
2616
2617
2619 }
2620
2622 {
2625
2626 for ( int i = 0; i < construction_parts.Count(); ++i )
2627 {
2628 string key = construction_parts.GetKey( i );
2630
2631 if ( value.
GetId() ==
id )
2632 {
2633 return value;
2634 }
2635 }
2636
2637 return NULL;
2638 }
2639
2640
2641
2643 {
2645 }
2646
2648 {
2650 }
2651
2653 {
2654 return true;
2655 }
2656
2658 {
2659 return false;
2660 }
2661
2662
2664 {
2667 {
2669 }
2670
2671 return construction_kit;
2672 }
2673
2675 {
2678 {
2680 }
2681 }
2682
2684 {
2686 }
2687
2689 {
2690 return "";
2691 }
2692
2694 {
2697 }
2698
2699
2701 {
2704 }
2705
2706
2708 {
2709 super.OnStoreSave( ctx );
2710
2711
2715
2717 }
2718
2720 {
2721 if ( !super.OnStoreLoad( ctx, version ) )
2722 return false;
2723
2724
2725
2727 {
2729 return false;
2730 }
2732 {
2734 return false;
2735 }
2737 {
2739 return false;
2740 }
2741
2742
2744 {
2746 return false;
2747 }
2748
2749
2750 return true;
2751 }
2752
2754 {
2755 super.AfterStoreLoad();
2756
2758 {
2760 }
2761 }
2762
2764 {
2765
2767
2768
2771
2772
2774 }
2775
2777 {
2778 super.OnCreatePhysics();
2781 }
2782
2784 {
2786 return;
2787
2788 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2789
2791 return;
2792
2794 string part_name = zone;
2796
2798 {
2799 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2800
2801 if ( construction_part && construction.IsPartConstructed( part_name ) )
2802 {
2804 construction.DestroyConnectedParts(part_name);
2805 }
2806
2807
2808 if ( part_name.
Contains(
"barbed") )
2809 {
2810 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2811 if (barbed_wire)
2812 barbed_wire.SetMountedState( false );
2813 }
2814 }
2815 }
2816
2818 {
2820 {
2822 }
2823
2824 super.EEOnAfterLoad();
2825 }
2826
2828 {
2829 super.EEInit();
2830
2831
2833
2834
2835 #ifdef DEVELOPER
2837 #endif
2838 }
2839
2841 {
2842 super.EEItemAttached( item, slot_name );
2843
2847 }
2848
2850 {
2851 super.EEItemDetached( item, slot_name );
2852
2855 }
2856
2857 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2858 {
2861
2864 }
2865
2866
2868 {
2869 return true;
2870 }
2871
2872
2873
2875 {
2877
2878
2879 if (construtionPart.
IsBase())
2880 {
2882
2883
2885 }
2886
2887
2889
2890
2892
2893
2895
2897
2899
2900
2902
2903
2905 }
2906
2908 {
2909
2911 }
2912
2913
2915 {
2918
2919
2921
2922
2924
2925
2927
2928
2930
2932
2933
2935
2936
2938
2939
2940 if (construtionPart.
IsBase())
2941 {
2942
2944 }
2945
2948 }
2949
2951 {
2952
2954 }
2955
2956
2957 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2958 {
2961
2962
2964
2965
2967
2968
2970
2971
2973
2975
2976
2978
2979
2981
2982
2983 if (construtionPart.
IsBase())
2984 {
2985
2987 }
2988
2991 }
2992
2994 {
2995
2997 }
2998
3000 {
3001 bool process = false;
3002
3003
3007
3008 if (process)
3009 {
3010 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
3011 {
3013 return;
3014 }
3015
3017 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
3018 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
3019
3020
3022 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
3023 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
3024 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
3025 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
3026 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
3027 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
3028 mins = minTmp;
3029 maxs = maxTmp;
3030
3031 maxs[1] = maxs[1] + 0.35;
3032
3034 }
3035 }
3036
3038 {
3041
3042
3044 foreach (
EntityAI entity : foundEntities)
3045 {
3048 }
3049 }
3050
3051
3053 {
3055
3059 }
3060
3062 {
3064
3066 {
3068 }
3069 else
3070 {
3072 }
3073
3075 }
3076
3078 {
3080
3082 foreach (
string slotName : attachmentSlots)
3083 {
3085 }
3086
3087
3090 else
3092
3094 }
3095
3097 {
3098 string slotNameMounted = slot_name + "_Mounted";
3099 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3100
3101 if (attachment)
3102 {
3103 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3104 if (barbedWire && barbedWire.IsMounted())
3106 else
3108
3109 if (is_locked)
3110 {
3111 SetAnimationPhase(slotNameMounted, 0);
3112 SetAnimationPhase(slot_name, 1);
3113 }
3114 else
3115 {
3116 SetAnimationPhase(slotNameMounted, 1);
3117 SetAnimationPhase(slot_name, 0);
3118 }
3119 }
3120 else
3121 {
3122 SetAnimationPhase(slotNameMounted, 1);
3123 SetAnimationPhase(slot_name, 1);
3124
3126 }
3127 }
3128
3129
3131 {
3134
3137
3140
3141 foreach (
string slotName : attachmentSlots)
3142 {
3144 }
3145
3146
3148 {
3151
3153 }
3154 else
3155 {
3158
3160 }
3161
3164 }
3165
3167 {
3168
3170 return;
3171
3172 string slot_name_mounted = slot_name + "_Mounted";
3173 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3174
3175
3177 RemoveProxyPhysics( slot_name_mounted );
3178 RemoveProxyPhysics( slot_name );
3179
3180 if ( attachment )
3181 {
3183 if ( is_locked )
3184 {
3186 AddProxyPhysics( slot_name_mounted );
3187 }
3188 else
3189 {
3191 AddProxyPhysics( slot_name );
3192 }
3193 }
3194 }
3195
3197 {
3198 SetAffectPathgraph( true, false );
3200 }
3201
3203 {
3204 return true;
3205 }
3206
3208 {
3209 return true;
3210 }
3211
3213 {
3214 if ( attachment )
3215 {
3217 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3218
3219 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3220 }
3221
3222 return false;
3223 }
3224
3226 {
3228 }
3229
3230
3232 {
3233 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3234 if (
GetGame().ConfigIsExisting( config_path ) )
3235 {
3237 }
3238 }
3239
3241 {
3242 return true;
3243 }
3244
3246 {
3247 return true;
3248 }
3249
3251 {
3252 return true;
3253 }
3254
3255
3257 {
3259 {
3261 }
3262
3264 }
3265
3267 {
3269 }
3270
3271
3272
3274 {
3275 return super.CanReceiveAttachment(attachment, slotId);
3276 }
3277
3279 {
3280 int attachment_count = GetInventory().AttachmentCount();
3281 if ( attachment_count > 0 )
3282 {
3283 if (
HasBase() && attachment_count == 1 )
3284 {
3285 return false;
3286 }
3287
3288 return true;
3289 }
3290
3291 return false;
3292 }
3293
3295 {
3296 return true;
3297 }
3298
3300 {
3301 return false;
3302 }
3303
3304
3306 {
3307 return false;
3308 }
3309
3311 {
3312 return false;
3313 }
3314
3315
3317 {
3318 return false;
3319 }
3320
3321
3322
3324 {
3325 return true;
3326 }
3327
3329 {
3330 return true;
3331 }
3332
3335 {
3336 return false;
3337 }
3338
3339
3341 {
3342 return true;
3343 }
3344
3345
3347 {
3348 return false;
3349 }
3350
3351
3353 {
3354 return true;
3355 }
3356
3357
3359 {
3360 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3361 {
3362 return false;
3363 }
3364
3365 return true;
3366 }
3367
3369 {
3372
3373 return item;
3374 }
3375
3376
3378 {
3380 {
3381
3383
3384
3387
3389 if ( MemoryPointExists( slot_name + "_min" ) )
3390 {
3391 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3392 }
3393 if ( MemoryPointExists( slot_name + "_max" ) )
3394 {
3395 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3396 }
3397
3398
3401
3402
3405 center = ModelToWorld( center );
3406
3407
3410
3411 areaDamage.SetExtents( extents[0], extents[1] );
3412 areaDamage.SetAreaPosition( center );
3413 areaDamage.SetAreaOrientation( orientation );
3416 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3417 areaDamage.SetAmmoName( "BarbedWireHit" );
3418 areaDamage.Spawn();
3419
3421 }
3422 }
3423
3425 {
3426 if ( angle_deg != 0 )
3427 {
3428
3429 orientation[0] = orientation[0] - angle_deg;
3430
3431
3433 if ( MemoryPointExists( "rotate_axis" ) )
3434 {
3435 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3436 }
3437 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];
3438 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];
3439 center[0] = r_center_x;
3440 center[2] = r_center_z;
3441 }
3442 }
3443
3445 {
3447 {
3450 {
3451 if (areaDamage)
3452 {
3453 areaDamage.Destroy();
3454 }
3455
3457 }
3458 }
3459 }
3460
3462 {
3463 return true;
3464 }
3465
3466
3467
3468
3470 {
3472 }
3473
3475 {
3477 }
3478
3480 {
3482 }
3483
3485 {
3487
3488 switch ( material_type )
3489 {
3495 }
3496
3497 return "";
3498 }
3499
3501 {
3503
3504 switch ( material_type )
3505 {
3511 }
3512
3513 return "";
3514 }
3515
3516
3518 {
3520 {
3521
3523 {
3524 SetHealth(slot_name,"Health",item.GetHealth());
3525 }
3526 }
3527 }
3528
3530 {
3531 return 111;
3532 }
3533
3535 {
3536 super.SetActions();
3537
3541 }
3542
3543
3544
3545
3547 {
3548 }
3549
3552 {
3553 return null;
3554 }
3555
3557 {
3559 }
3560
3562 {
3565
3566 Man p;
3567
3568 #ifdef SERVER
3571 if (players.Count())
3572 p = players[0];
3573 #else
3575 #endif
3576
3578 {
3579 bool excluded = false;
3581 if (excludes)
3582 {
3583 foreach (string exclude : excludes)
3584 {
3586 {
3587 excluded = true;
3588 break;
3589 }
3590 }
3591 }
3592
3593 if (!excluded)
3594 {
3596 }
3597 }
3598
3600 }
3601}
3602
3604{
3605#ifdef BSB_DEBUG
3607#else
3608
3609#endif
3610}
3612{
3613#ifdef BSB_DEBUG_SPAM
3615#else
3616
3617#endif
3618}
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.