2187{
2189
2191
2193
2195
2201
2202
2203
2209
2215
2217
2221
2222
2224 {
2226
2227
2228 RegisterNetSyncVariableInt( "m_SyncParts01" );
2229 RegisterNetSyncVariableInt( "m_SyncParts02" );
2230 RegisterNetSyncVariableInt( "m_SyncParts03" );
2231 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2232 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2233 RegisterNetSyncVariableBool( "m_HasBase" );
2234
2235
2237
2238 if (ConfigIsExisting("hybridAttachments"))
2239 {
2242 }
2243 if (ConfigIsExisting("mountables"))
2244 {
2247 }
2248
2250 }
2251
2253 {
2254 super.EEDelete(parent);
2255
2257 {
2258 areaDamage.Destroy();
2259 }
2260
2261 }
2262
2264 {
2265 return "disableBaseDamage";
2266 }
2267
2269 {
2270 return true;
2271 }
2272
2274 {
2275 return EInventoryIconVisibility.HIDE_VICINITY;
2276 }
2277
2278
2280 {
2282 {
2283 SetSynchDirty();
2284 }
2285 }
2286
2288 {
2290 super.OnVariablesSynchronized();
2291
2293 }
2294
2296 {
2297
2299
2300
2302
2303
2305 }
2306
2307
2309 {
2310
2311 int offset;
2312 int mask;
2313
2314 if ( part_id >= 1 && part_id <= 31 )
2315 {
2316 offset = part_id - 1;
2317 mask = 1 << offset;
2318
2320 }
2321 else if ( part_id >= 32 && part_id <= 62 )
2322 {
2323 offset = ( part_id % 32 );
2324 mask = 1 << offset;
2325
2327 }
2328 else if ( part_id >= 63 && part_id <= 93 )
2329 {
2330 offset = ( part_id % 63 );
2331 mask = 1 << offset;
2332
2334 }
2335 }
2336
2338 {
2339
2340 int offset;
2341 int mask;
2342
2343 if ( part_id >= 1 && part_id <= 31 )
2344 {
2345 offset = part_id - 1;
2346 mask = 1 << offset;
2347
2349 }
2350 else if ( part_id >= 32 && part_id <= 62 )
2351 {
2352 offset = ( part_id % 32 );
2353 mask = 1 << offset;
2354
2356 }
2357 else if ( part_id >= 63 && part_id <= 93 )
2358 {
2359 offset = ( part_id % 63 );
2360 mask = 1 << offset;
2361
2363 }
2364 }
2365
2367 {
2368
2369 int offset;
2370 int mask;
2371
2372 if ( part_id >= 1 && part_id <= 31 )
2373 {
2374 offset = part_id - 1;
2375 mask = 1 << offset;
2376
2378 {
2379 return true;
2380 }
2381 }
2382 else if ( part_id >= 32 && part_id <= 62 )
2383 {
2384 offset = ( part_id % 32 );
2385 mask = 1 << offset;
2386
2388 {
2389 return true;
2390 }
2391 }
2392 else if ( part_id >= 63 && part_id <= 93 )
2393 {
2394 offset = ( part_id % 63 );
2395 mask = 1 << offset;
2396
2398 {
2399 return true;
2400 }
2401 }
2402
2403 return false;
2404 }
2405
2407 {
2410 }
2411
2413 {
2414
2417 }
2418
2420 {
2422 {
2425
2426 switch( build_action_id )
2427 {
2431 }
2432 }
2433 }
2434
2435
2437 {
2439 bool is_base = part.
IsBase();
2442 if ( is_part_built_sync )
2443 {
2445 {
2449
2450 if (is_base)
2451 {
2454 }
2455 }
2456 }
2457 else
2458 {
2460 {
2464
2465 if (is_base)
2466 {
2469 }
2470 }
2471 }
2472
2473
2475 }
2476
2477
2479 {
2482
2483 for ( int i = 0; i < construction_parts.Count(); ++i )
2484 {
2485 string key = construction_parts.GetKey( i );
2488 }
2489
2490
2492 }
2493
2495 {
2498
2499 for ( int i = 0; i < construction_parts.Count(); ++i )
2500 {
2501 string key = construction_parts.GetKey( i );
2503
2504 if ( value.
GetId() ==
id )
2505 {
2506 return value;
2507 }
2508 }
2509
2510 return NULL;
2511 }
2512
2513
2514
2516 {
2518 }
2519
2521 {
2523 }
2524
2526 {
2527 return true;
2528 }
2529
2531 {
2532 return false;
2533 }
2534
2535
2537 {
2540 {
2542 }
2543
2544 return construction_kit;
2545 }
2546
2548 {
2551 {
2553 }
2554 }
2555
2557 {
2559 }
2560
2562 {
2563 return "";
2564 }
2565
2567 {
2570 }
2571
2572
2574 {
2577 }
2578
2579
2581 {
2582 super.OnStoreSave( ctx );
2583
2584
2588
2590 }
2591
2593 {
2594 if ( !super.OnStoreLoad( ctx, version ) )
2595 return false;
2596
2597
2598
2600 {
2602 return false;
2603 }
2605 {
2607 return false;
2608 }
2610 {
2612 return false;
2613 }
2614
2615
2617 {
2619 return false;
2620 }
2621
2622
2623 return true;
2624 }
2625
2627 {
2628 super.AfterStoreLoad();
2629
2631 {
2633 }
2634 }
2635
2637 {
2638
2640
2641
2644
2645
2647 }
2648
2650 {
2651 super.OnCreatePhysics();
2654 }
2655
2657 {
2659 return;
2660
2661 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2662
2664 return;
2665
2667 string part_name = zone;
2669
2671 {
2672 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2673
2674 if ( construction_part && construction.IsPartConstructed( part_name ) )
2675 {
2677 construction.DestroyConnectedParts(part_name);
2678 }
2679
2680
2681 if ( part_name.
Contains(
"barbed") )
2682 {
2683 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2684 if (barbed_wire)
2685 barbed_wire.SetMountedState( false );
2686 }
2687 }
2688 }
2689
2691 {
2693 {
2695 }
2696
2697 super.EEOnAfterLoad();
2698 }
2699
2701 {
2702 super.EEInit();
2703
2704
2706
2707
2708 #ifdef DEVELOPER
2710 #endif
2711 }
2712
2714 {
2715 super.EEItemAttached( item, slot_name );
2716
2720 }
2721
2723 {
2724 super.EEItemDetached( item, slot_name );
2725
2728 }
2729
2730 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2731 {
2734
2737 }
2738
2739
2741 {
2742 return true;
2743 }
2744
2745
2746
2748 {
2750
2751
2752 if (construtionPart.
IsBase())
2753 {
2755
2756
2758 }
2759
2760
2762
2763
2765
2766
2768
2770
2772
2773
2775
2776
2778 }
2779
2781 {
2782
2784 }
2785
2786
2788 {
2791
2792
2794
2795
2797
2798
2800
2801
2803
2805
2806
2808
2809
2811
2812
2813 if (construtionPart.
IsBase())
2814 {
2815
2817 }
2818
2821 }
2822
2824 {
2825
2827 }
2828
2829
2830 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2831 {
2834
2835
2837
2838
2840
2841
2843
2844
2846
2848
2849
2851
2852
2854
2855
2856 if (construtionPart.
IsBase())
2857 {
2858
2860 }
2861
2864 }
2865
2867 {
2868
2870 }
2871
2873 {
2874 bool process = false;
2875
2876
2880
2881 if (process)
2882 {
2883 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2884 {
2886 return;
2887 }
2888
2890 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2891 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2892
2893
2895 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2896 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2897 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2898 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2899 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2900 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2901 mins = minTmp;
2902 maxs = maxTmp;
2903
2904 maxs[1] = maxs[1] + 0.35;
2905
2907 }
2908 }
2909
2911 {
2914
2915
2917 foreach (
EntityAI entity : foundEntities)
2918 {
2921 }
2922 }
2923
2924
2926 {
2928
2932 }
2933
2935 {
2937
2939 {
2941 }
2942 else
2943 {
2945 }
2946
2948 }
2949
2951 {
2953
2955 foreach (
string slotName : attachmentSlots)
2956 {
2958 }
2959
2960
2963 else
2965
2967 }
2968
2970 {
2971 string slotNameMounted = slot_name + "_Mounted";
2972 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2973
2974 if (attachment)
2975 {
2976 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2977 if (barbedWire && barbedWire.IsMounted())
2979 else
2981
2982 if (is_locked)
2983 {
2984 SetAnimationPhase(slotNameMounted, 0);
2985 SetAnimationPhase(slot_name, 1);
2986 }
2987 else
2988 {
2989 SetAnimationPhase(slotNameMounted, 1);
2990 SetAnimationPhase(slot_name, 0);
2991 }
2992 }
2993 else
2994 {
2995 SetAnimationPhase(slotNameMounted, 1);
2996 SetAnimationPhase(slot_name, 1);
2997
2999 }
3000 }
3001
3002
3004 {
3007
3010
3013
3014 foreach (
string slotName : attachmentSlots)
3015 {
3017 }
3018
3019
3021 {
3024
3026 }
3027 else
3028 {
3031
3033 }
3034
3037 }
3038
3040 {
3041
3043 return;
3044
3045 string slot_name_mounted = slot_name + "_Mounted";
3046 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3047
3048
3050 RemoveProxyPhysics( slot_name_mounted );
3051 RemoveProxyPhysics( slot_name );
3052
3053 if ( attachment )
3054 {
3056 if ( is_locked )
3057 {
3059 AddProxyPhysics( slot_name_mounted );
3060 }
3061 else
3062 {
3064 AddProxyPhysics( slot_name );
3065 }
3066 }
3067 }
3068
3070 {
3071 SetAffectPathgraph( true, false );
3073 }
3074
3076 {
3077 return true;
3078 }
3079
3081 {
3082 return true;
3083 }
3084
3086 {
3087 if ( attachment )
3088 {
3090 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3091
3092 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3093 }
3094
3095 return false;
3096 }
3097
3099 {
3101 }
3102
3103
3105 {
3106 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3107 if (
GetGame().ConfigIsExisting( config_path ) )
3108 {
3110 }
3111 }
3112
3114 {
3115 return true;
3116 }
3117
3119 {
3120 return true;
3121 }
3122
3124 {
3125 return true;
3126 }
3127
3128
3130 {
3132 {
3134 }
3135
3137 }
3138
3140 {
3142 }
3143
3144
3145
3147 {
3148 return super.CanReceiveAttachment(attachment, slotId);
3149 }
3150
3152 {
3153 int attachment_count = GetInventory().AttachmentCount();
3154 if ( attachment_count > 0 )
3155 {
3156 if (
HasBase() && attachment_count == 1 )
3157 {
3158 return false;
3159 }
3160
3161 return true;
3162 }
3163
3164 return false;
3165 }
3166
3168 {
3169 return true;
3170 }
3171
3173 {
3174 return false;
3175 }
3176
3177
3179 {
3180 return false;
3181 }
3182
3184 {
3185 return false;
3186 }
3187
3188
3190 {
3191 return false;
3192 }
3193
3194
3195
3197 {
3198 return true;
3199 }
3200
3202 {
3203 return true;
3204 }
3205
3208 {
3209 return false;
3210 }
3211
3212
3214 {
3215 return true;
3216 }
3217
3218
3220 {
3221 return false;
3222 }
3223
3224
3226 {
3227 return true;
3228 }
3229
3230
3232 {
3233 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3234 {
3235 return false;
3236 }
3237
3238 return true;
3239 }
3240
3242 {
3245
3246 return item;
3247 }
3248
3249
3251 {
3253 {
3254
3256
3257
3260
3262 if ( MemoryPointExists( slot_name + "_min" ) )
3263 {
3264 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3265 }
3266 if ( MemoryPointExists( slot_name + "_max" ) )
3267 {
3268 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3269 }
3270
3271
3274
3275
3278 center = ModelToWorld( center );
3279
3280
3283
3284 areaDamage.SetExtents( extents[0], extents[1] );
3285 areaDamage.SetAreaPosition( center );
3286 areaDamage.SetAreaOrientation( orientation );
3289 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3290 areaDamage.SetAmmoName( "BarbedWireHit" );
3291 areaDamage.Spawn();
3292
3294 }
3295 }
3296
3298 {
3299 if ( angle_deg != 0 )
3300 {
3301
3302 orientation[0] = orientation[0] - angle_deg;
3303
3304
3306 if ( MemoryPointExists( "rotate_axis" ) )
3307 {
3308 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3309 }
3310 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];
3311 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];
3312 center[0] = r_center_x;
3313 center[2] = r_center_z;
3314 }
3315 }
3316
3318 {
3320 {
3323 {
3324 if (areaDamage)
3325 {
3326 areaDamage.Destroy();
3327 }
3328
3330 }
3331 }
3332 }
3333
3335 {
3336 return true;
3337 }
3338
3339
3340
3341
3343 {
3345 }
3346
3348 {
3350 }
3351
3353 {
3355 }
3356
3358 {
3360
3361 switch ( material_type )
3362 {
3368 }
3369
3370 return "";
3371 }
3372
3374 {
3376
3377 switch ( material_type )
3378 {
3384 }
3385
3386 return "";
3387 }
3388
3389
3391 {
3393 {
3394
3396 {
3397 SetHealth(slot_name,"Health",item.GetHealth());
3398 }
3399 }
3400 }
3401
3403 {
3404 return 111;
3405 }
3406
3408 {
3409 super.SetActions();
3410
3414 }
3415
3416
3417
3418
3420 {
3421 }
3422
3425 {
3426 return null;
3427 }
3428
3430 {
3432 }
3433
3435 {
3438
3439 Man p;
3440
3441 #ifdef SERVER
3444 if (players.Count())
3445 p = players[0];
3446 #else
3448 #endif
3449
3451 {
3452 bool excluded = false;
3454 if (excludes)
3455 {
3456 foreach (string exclude : excludes)
3457 {
3459 {
3460 excluded = true;
3461 break;
3462 }
3463 }
3464 }
3465
3466 if (!excluded)
3467 {
3469 }
3470 }
3471
3473 }
3474}
3475
3477{
3478#ifdef BSB_DEBUG
3480#else
3481
3482#endif
3483}
3485{
3486#ifdef BSB_DEBUG_SPAM
3488#else
3489
3490#endif
3491}
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.