2274{
2276
2278
2280
2282
2288
2289
2290
2296
2302
2304
2308
2309
2311 {
2313
2314
2315 RegisterNetSyncVariableInt( "m_SyncParts01" );
2316 RegisterNetSyncVariableInt( "m_SyncParts02" );
2317 RegisterNetSyncVariableInt( "m_SyncParts03" );
2318 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2319 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2320 RegisterNetSyncVariableBool( "m_HasBase" );
2321
2322
2324
2325 if (ConfigIsExisting("hybridAttachments"))
2326 {
2329 }
2330 if (ConfigIsExisting("mountables"))
2331 {
2334 }
2335
2337 }
2338
2340 {
2341 super.EEDelete(parent);
2342
2344 {
2345 areaDamage.Destroy();
2346 }
2347
2348 }
2349
2351 {
2352 return "disableBaseDamage";
2353 }
2354
2356 {
2357 return true;
2358 }
2359
2361 {
2362 return EInventoryIconVisibility.HIDE_VICINITY;
2363 }
2364
2365
2367 {
2369 {
2370 SetSynchDirty();
2371 }
2372 }
2373
2375 {
2377 super.OnVariablesSynchronized();
2378
2380 }
2381
2383 {
2384
2386
2387
2389
2390
2392 }
2393
2394
2396 {
2397
2398 int offset;
2399 int mask;
2400
2401 if ( part_id >= 1 && part_id <= 31 )
2402 {
2403 offset = part_id - 1;
2404 mask = 1 << offset;
2405
2407 }
2408 else if ( part_id >= 32 && part_id <= 62 )
2409 {
2410 offset = ( part_id % 32 );
2411 mask = 1 << offset;
2412
2414 }
2415 else if ( part_id >= 63 && part_id <= 93 )
2416 {
2417 offset = ( part_id % 63 );
2418 mask = 1 << offset;
2419
2421 }
2422 }
2423
2425 {
2426
2427 int offset;
2428 int mask;
2429
2430 if ( part_id >= 1 && part_id <= 31 )
2431 {
2432 offset = part_id - 1;
2433 mask = 1 << offset;
2434
2436 }
2437 else if ( part_id >= 32 && part_id <= 62 )
2438 {
2439 offset = ( part_id % 32 );
2440 mask = 1 << offset;
2441
2443 }
2444 else if ( part_id >= 63 && part_id <= 93 )
2445 {
2446 offset = ( part_id % 63 );
2447 mask = 1 << offset;
2448
2450 }
2451 }
2452
2454 {
2455
2456 int offset;
2457 int mask;
2458
2459 if ( part_id >= 1 && part_id <= 31 )
2460 {
2461 offset = part_id - 1;
2462 mask = 1 << offset;
2463
2465 {
2466 return true;
2467 }
2468 }
2469 else if ( part_id >= 32 && part_id <= 62 )
2470 {
2471 offset = ( part_id % 32 );
2472 mask = 1 << offset;
2473
2475 {
2476 return true;
2477 }
2478 }
2479 else if ( part_id >= 63 && part_id <= 93 )
2480 {
2481 offset = ( part_id % 63 );
2482 mask = 1 << offset;
2483
2485 {
2486 return true;
2487 }
2488 }
2489
2490 return false;
2491 }
2492
2494 {
2497 }
2498
2500 {
2501
2504 }
2505
2507 {
2509 {
2512
2513 switch( build_action_id )
2514 {
2518 }
2519 }
2520 }
2521
2522
2524 {
2526 bool is_base = part.
IsBase();
2529 if ( is_part_built_sync )
2530 {
2532 {
2536
2537 if (is_base)
2538 {
2541 }
2542 }
2543 }
2544 else
2545 {
2547 {
2551
2552 if (is_base)
2553 {
2556 }
2557 }
2558 }
2559
2560
2562 }
2563
2564
2566 {
2569
2570 for ( int i = 0; i < construction_parts.Count(); ++i )
2571 {
2572 string key = construction_parts.GetKey( i );
2575 }
2576
2577
2579 }
2580
2582 {
2585
2586 for ( int i = 0; i < construction_parts.Count(); ++i )
2587 {
2588 string key = construction_parts.GetKey( i );
2590
2591 if ( value.
GetId() ==
id )
2592 {
2593 return value;
2594 }
2595 }
2596
2597 return NULL;
2598 }
2599
2600
2601
2603 {
2605 }
2606
2608 {
2610 }
2611
2613 {
2614 return true;
2615 }
2616
2618 {
2619 return false;
2620 }
2621
2622
2624 {
2627 {
2629 }
2630
2631 return construction_kit;
2632 }
2633
2635 {
2638 {
2640 }
2641 }
2642
2644 {
2646 }
2647
2649 {
2650 return "";
2651 }
2652
2654 {
2657 }
2658
2659
2661 {
2664 }
2665
2666
2668 {
2669 super.OnStoreSave( ctx );
2670
2671
2675
2677 }
2678
2680 {
2681 if ( !super.OnStoreLoad( ctx, version ) )
2682 return false;
2683
2684
2685
2687 {
2689 return false;
2690 }
2692 {
2694 return false;
2695 }
2697 {
2699 return false;
2700 }
2701
2702
2704 {
2706 return false;
2707 }
2708
2709
2710 return true;
2711 }
2712
2714 {
2715 super.AfterStoreLoad();
2716
2718 {
2720 }
2721 }
2722
2724 {
2725
2727
2728
2731
2732
2734 }
2735
2737 {
2738 super.OnCreatePhysics();
2741 }
2742
2744 {
2746 return;
2747
2748 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2749
2751 return;
2752
2754 string part_name = zone;
2756
2758 {
2759 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2760
2761 if ( construction_part && construction.IsPartConstructed( part_name ) )
2762 {
2764 construction.DestroyConnectedParts(part_name);
2765 }
2766
2767
2768 if ( part_name.
Contains(
"barbed") )
2769 {
2770 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2771 if (barbed_wire)
2772 barbed_wire.SetMountedState( false );
2773 }
2774 }
2775 }
2776
2778 {
2780 {
2782 }
2783
2784 super.EEOnAfterLoad();
2785 }
2786
2788 {
2789 super.EEInit();
2790
2791
2793
2794
2795 #ifdef DEVELOPER
2797 #endif
2798 }
2799
2801 {
2802 super.EEItemAttached( item, slot_name );
2803
2807 }
2808
2810 {
2811 super.EEItemDetached( item, slot_name );
2812
2815 }
2816
2817 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2818 {
2821
2824 }
2825
2826
2828 {
2829 return true;
2830 }
2831
2832
2833
2835 {
2837
2838
2839 if (construtionPart.
IsBase())
2840 {
2842
2843
2845 }
2846
2847
2849
2850
2852
2853
2855
2857
2859
2860
2862
2863
2865 }
2866
2868 {
2869
2871 }
2872
2873
2875 {
2878
2879
2881
2882
2884
2885
2887
2888
2890
2892
2893
2895
2896
2898
2899
2900 if (construtionPart.
IsBase())
2901 {
2902
2904 }
2905
2908 }
2909
2911 {
2912
2914 }
2915
2916
2917 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2918 {
2921
2922
2924
2925
2927
2928
2930
2931
2933
2935
2936
2938
2939
2941
2942
2943 if (construtionPart.
IsBase())
2944 {
2945
2947 }
2948
2951 }
2952
2954 {
2955
2957 }
2958
2960 {
2961 bool process = false;
2962
2963
2967
2968 if (process)
2969 {
2970 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2971 {
2973 return;
2974 }
2975
2977 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2978 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2979
2980
2982 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2983 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2984 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2985 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2986 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2987 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2988 mins = minTmp;
2989 maxs = maxTmp;
2990
2991 maxs[1] = maxs[1] + 0.35;
2992
2994 }
2995 }
2996
2998 {
3001
3002
3004 foreach (
EntityAI entity : foundEntities)
3005 {
3008 }
3009 }
3010
3011
3013 {
3015
3019 }
3020
3022 {
3024
3026 {
3028 }
3029 else
3030 {
3032 }
3033
3035 }
3036
3038 {
3040
3042 foreach (
string slotName : attachmentSlots)
3043 {
3045 }
3046
3047
3050 else
3052
3054 }
3055
3057 {
3058 string slotNameMounted = slot_name + "_Mounted";
3059 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3060
3061 if (attachment)
3062 {
3063 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3064 if (barbedWire && barbedWire.IsMounted())
3066 else
3068
3069 if (is_locked)
3070 {
3071 SetAnimationPhase(slotNameMounted, 0);
3072 SetAnimationPhase(slot_name, 1);
3073 }
3074 else
3075 {
3076 SetAnimationPhase(slotNameMounted, 1);
3077 SetAnimationPhase(slot_name, 0);
3078 }
3079 }
3080 else
3081 {
3082 SetAnimationPhase(slotNameMounted, 1);
3083 SetAnimationPhase(slot_name, 1);
3084
3086 }
3087 }
3088
3089
3091 {
3094
3097
3100
3101 foreach (
string slotName : attachmentSlots)
3102 {
3104 }
3105
3106
3108 {
3111
3113 }
3114 else
3115 {
3118
3120 }
3121
3124 }
3125
3127 {
3128
3130 return;
3131
3132 string slot_name_mounted = slot_name + "_Mounted";
3133 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3134
3135
3137 RemoveProxyPhysics( slot_name_mounted );
3138 RemoveProxyPhysics( slot_name );
3139
3140 if ( attachment )
3141 {
3143 if ( is_locked )
3144 {
3146 AddProxyPhysics( slot_name_mounted );
3147 }
3148 else
3149 {
3151 AddProxyPhysics( slot_name );
3152 }
3153 }
3154 }
3155
3157 {
3158 SetAffectPathgraph( true, false );
3160 }
3161
3163 {
3164 return true;
3165 }
3166
3168 {
3169 return true;
3170 }
3171
3173 {
3174 if ( attachment )
3175 {
3177 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3178
3179 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3180 }
3181
3182 return false;
3183 }
3184
3186 {
3188 }
3189
3190
3192 {
3193 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3194 if (
GetGame().ConfigIsExisting( config_path ) )
3195 {
3197 }
3198 }
3199
3201 {
3202 return true;
3203 }
3204
3206 {
3207 return true;
3208 }
3209
3211 {
3212 return true;
3213 }
3214
3215
3217 {
3219 {
3221 }
3222
3224 }
3225
3227 {
3229 }
3230
3231
3232
3234 {
3235 return super.CanReceiveAttachment(attachment, slotId);
3236 }
3237
3239 {
3240 int attachment_count = GetInventory().AttachmentCount();
3241 if ( attachment_count > 0 )
3242 {
3243 if (
HasBase() && attachment_count == 1 )
3244 {
3245 return false;
3246 }
3247
3248 return true;
3249 }
3250
3251 return false;
3252 }
3253
3255 {
3256 return true;
3257 }
3258
3260 {
3261 return false;
3262 }
3263
3264
3266 {
3267 return false;
3268 }
3269
3271 {
3272 return false;
3273 }
3274
3275
3277 {
3278 return false;
3279 }
3280
3281
3282
3284 {
3285 return true;
3286 }
3287
3289 {
3290 return true;
3291 }
3292
3295 {
3296 return false;
3297 }
3298
3299
3301 {
3302 return true;
3303 }
3304
3305
3307 {
3308 return false;
3309 }
3310
3311
3313 {
3314 return true;
3315 }
3316
3317
3319 {
3320 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3321 {
3322 return false;
3323 }
3324
3325 return true;
3326 }
3327
3329 {
3332
3333 return item;
3334 }
3335
3336
3338 {
3340 {
3341
3343
3344
3347
3349 if ( MemoryPointExists( slot_name + "_min" ) )
3350 {
3351 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3352 }
3353 if ( MemoryPointExists( slot_name + "_max" ) )
3354 {
3355 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3356 }
3357
3358
3361
3362
3365 center = ModelToWorld( center );
3366
3367
3370
3371 areaDamage.SetExtents( extents[0], extents[1] );
3372 areaDamage.SetAreaPosition( center );
3373 areaDamage.SetAreaOrientation( orientation );
3376 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3377 areaDamage.SetAmmoName( "BarbedWireHit" );
3378 areaDamage.Spawn();
3379
3381 }
3382 }
3383
3385 {
3386 if ( angle_deg != 0 )
3387 {
3388
3389 orientation[0] = orientation[0] - angle_deg;
3390
3391
3393 if ( MemoryPointExists( "rotate_axis" ) )
3394 {
3395 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3396 }
3397 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];
3398 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];
3399 center[0] = r_center_x;
3400 center[2] = r_center_z;
3401 }
3402 }
3403
3405 {
3407 {
3410 {
3411 if (areaDamage)
3412 {
3413 areaDamage.Destroy();
3414 }
3415
3417 }
3418 }
3419 }
3420
3422 {
3423 return true;
3424 }
3425
3426
3427
3428
3430 {
3432 }
3433
3435 {
3437 }
3438
3440 {
3442 }
3443
3445 {
3447
3448 switch ( material_type )
3449 {
3455 }
3456
3457 return "";
3458 }
3459
3461 {
3463
3464 switch ( material_type )
3465 {
3471 }
3472
3473 return "";
3474 }
3475
3476
3478 {
3480 {
3481
3483 {
3484 SetHealth(slot_name,"Health",item.GetHealth());
3485 }
3486 }
3487 }
3488
3490 {
3491 return 111;
3492 }
3493
3495 {
3496 super.SetActions();
3497
3501 }
3502
3503
3504
3505
3507 {
3508 }
3509
3512 {
3513 return null;
3514 }
3515
3517 {
3519 }
3520
3522 {
3525
3526 Man p;
3527
3528 #ifdef SERVER
3531 if (players.Count())
3532 p = players[0];
3533 #else
3535 #endif
3536
3538 {
3539 bool excluded = false;
3541 if (excludes)
3542 {
3543 foreach (string exclude : excludes)
3544 {
3546 {
3547 excluded = true;
3548 break;
3549 }
3550 }
3551 }
3552
3553 if (!excluded)
3554 {
3556 }
3557 }
3558
3560 }
3561}
3562
3564{
3565#ifdef BSB_DEBUG
3567#else
3568
3569#endif
3570}
3572{
3573#ifdef BSB_DEBUG_SPAM
3575#else
3576
3577#endif
3578}
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.