2205{
2207
2209
2211
2213
2219
2220
2221
2227
2233
2235
2239
2240
2242 {
2244
2245
2246 RegisterNetSyncVariableInt( "m_SyncParts01" );
2247 RegisterNetSyncVariableInt( "m_SyncParts02" );
2248 RegisterNetSyncVariableInt( "m_SyncParts03" );
2249 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2250 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2251 RegisterNetSyncVariableBool( "m_HasBase" );
2252
2253
2255
2256 if (ConfigIsExisting("hybridAttachments"))
2257 {
2260 }
2261 if (ConfigIsExisting("mountables"))
2262 {
2265 }
2266
2268 }
2269
2271 {
2272 super.EEDelete(parent);
2273
2275 {
2276 areaDamage.Destroy();
2277 }
2278
2279 }
2280
2282 {
2283 return "disableBaseDamage";
2284 }
2285
2287 {
2288 return true;
2289 }
2290
2292 {
2293 return EInventoryIconVisibility.HIDE_VICINITY;
2294 }
2295
2296
2298 {
2300 {
2301 SetSynchDirty();
2302 }
2303 }
2304
2306 {
2308 super.OnVariablesSynchronized();
2309
2311 }
2312
2314 {
2315
2317
2318
2320
2321
2323 }
2324
2325
2327 {
2328
2329 int offset;
2330 int mask;
2331
2332 if ( part_id >= 1 && part_id <= 31 )
2333 {
2334 offset = part_id - 1;
2335 mask = 1 << offset;
2336
2338 }
2339 else if ( part_id >= 32 && part_id <= 62 )
2340 {
2341 offset = ( part_id % 32 );
2342 mask = 1 << offset;
2343
2345 }
2346 else if ( part_id >= 63 && part_id <= 93 )
2347 {
2348 offset = ( part_id % 63 );
2349 mask = 1 << offset;
2350
2352 }
2353 }
2354
2356 {
2357
2358 int offset;
2359 int mask;
2360
2361 if ( part_id >= 1 && part_id <= 31 )
2362 {
2363 offset = part_id - 1;
2364 mask = 1 << offset;
2365
2367 }
2368 else if ( part_id >= 32 && part_id <= 62 )
2369 {
2370 offset = ( part_id % 32 );
2371 mask = 1 << offset;
2372
2374 }
2375 else if ( part_id >= 63 && part_id <= 93 )
2376 {
2377 offset = ( part_id % 63 );
2378 mask = 1 << offset;
2379
2381 }
2382 }
2383
2385 {
2386
2387 int offset;
2388 int mask;
2389
2390 if ( part_id >= 1 && part_id <= 31 )
2391 {
2392 offset = part_id - 1;
2393 mask = 1 << offset;
2394
2396 {
2397 return true;
2398 }
2399 }
2400 else if ( part_id >= 32 && part_id <= 62 )
2401 {
2402 offset = ( part_id % 32 );
2403 mask = 1 << offset;
2404
2406 {
2407 return true;
2408 }
2409 }
2410 else if ( part_id >= 63 && part_id <= 93 )
2411 {
2412 offset = ( part_id % 63 );
2413 mask = 1 << offset;
2414
2416 {
2417 return true;
2418 }
2419 }
2420
2421 return false;
2422 }
2423
2425 {
2428 }
2429
2431 {
2432
2435 }
2436
2438 {
2440 {
2443
2444 switch( build_action_id )
2445 {
2449 }
2450 }
2451 }
2452
2453
2455 {
2457 bool is_base = part.
IsBase();
2460 if ( is_part_built_sync )
2461 {
2463 {
2467
2468 if (is_base)
2469 {
2472 }
2473 }
2474 }
2475 else
2476 {
2478 {
2482
2483 if (is_base)
2484 {
2487 }
2488 }
2489 }
2490
2491
2493 }
2494
2495
2497 {
2500
2501 for ( int i = 0; i < construction_parts.Count(); ++i )
2502 {
2503 string key = construction_parts.GetKey( i );
2506 }
2507
2508
2510 }
2511
2513 {
2516
2517 for ( int i = 0; i < construction_parts.Count(); ++i )
2518 {
2519 string key = construction_parts.GetKey( i );
2521
2522 if ( value.
GetId() ==
id )
2523 {
2524 return value;
2525 }
2526 }
2527
2528 return NULL;
2529 }
2530
2531
2532
2534 {
2536 }
2537
2539 {
2541 }
2542
2544 {
2545 return true;
2546 }
2547
2549 {
2550 return false;
2551 }
2552
2553
2555 {
2558 {
2560 }
2561
2562 return construction_kit;
2563 }
2564
2566 {
2569 {
2571 }
2572 }
2573
2575 {
2577 }
2578
2580 {
2581 return "";
2582 }
2583
2585 {
2588 }
2589
2590
2592 {
2595 }
2596
2597
2599 {
2600 super.OnStoreSave( ctx );
2601
2602
2606
2608 }
2609
2611 {
2612 if ( !super.OnStoreLoad( ctx, version ) )
2613 return false;
2614
2615
2616
2618 {
2620 return false;
2621 }
2623 {
2625 return false;
2626 }
2628 {
2630 return false;
2631 }
2632
2633
2635 {
2637 return false;
2638 }
2639
2640
2641 return true;
2642 }
2643
2645 {
2646 super.AfterStoreLoad();
2647
2649 {
2651 }
2652 }
2653
2655 {
2656
2658
2659
2662
2663
2665 }
2666
2668 {
2669 super.OnCreatePhysics();
2672 }
2673
2675 {
2677 return;
2678
2679 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2680
2682 return;
2683
2685 string part_name = zone;
2687
2689 {
2690 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2691
2692 if ( construction_part && construction.IsPartConstructed( part_name ) )
2693 {
2695 construction.DestroyConnectedParts(part_name);
2696 }
2697
2698
2699 if ( part_name.
Contains(
"barbed") )
2700 {
2701 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2702 if (barbed_wire)
2703 barbed_wire.SetMountedState( false );
2704 }
2705 }
2706 }
2707
2709 {
2711 {
2713 }
2714
2715 super.EEOnAfterLoad();
2716 }
2717
2719 {
2720 super.EEInit();
2721
2722
2724
2725
2726 #ifdef DEVELOPER
2728 #endif
2729 }
2730
2732 {
2733 super.EEItemAttached( item, slot_name );
2734
2738 }
2739
2741 {
2742 super.EEItemDetached( item, slot_name );
2743
2746 }
2747
2748 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2749 {
2752
2755 }
2756
2757
2759 {
2760 return true;
2761 }
2762
2763
2764
2766 {
2768
2769
2770 if (construtionPart.
IsBase())
2771 {
2773
2774
2776 }
2777
2778
2780
2781
2783
2784
2786
2788
2790
2791
2793
2794
2796 }
2797
2799 {
2800
2802 }
2803
2804
2806 {
2809
2810
2812
2813
2815
2816
2818
2819
2821
2823
2824
2826
2827
2829
2830
2831 if (construtionPart.
IsBase())
2832 {
2833
2835 }
2836
2839 }
2840
2842 {
2843
2845 }
2846
2847
2848 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2849 {
2852
2853
2855
2856
2858
2859
2861
2862
2864
2866
2867
2869
2870
2872
2873
2874 if (construtionPart.
IsBase())
2875 {
2876
2878 }
2879
2882 }
2883
2885 {
2886
2888 }
2889
2891 {
2892 bool process = false;
2893
2894
2898
2899 if (process)
2900 {
2901 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2902 {
2904 return;
2905 }
2906
2908 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2909 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2910
2911
2913 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2914 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2915 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2916 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2917 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2918 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2919 mins = minTmp;
2920 maxs = maxTmp;
2921
2922 maxs[1] = maxs[1] + 0.35;
2923
2925 }
2926 }
2927
2929 {
2932
2933
2935 foreach (
EntityAI entity : foundEntities)
2936 {
2939 }
2940 }
2941
2942
2944 {
2946
2950 }
2951
2953 {
2955
2957 {
2959 }
2960 else
2961 {
2963 }
2964
2966 }
2967
2969 {
2971
2973 foreach (
string slotName : attachmentSlots)
2974 {
2976 }
2977
2978
2981 else
2983
2985 }
2986
2988 {
2989 string slotNameMounted = slot_name + "_Mounted";
2990 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2991
2992 if (attachment)
2993 {
2994 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2995 if (barbedWire && barbedWire.IsMounted())
2997 else
2999
3000 if (is_locked)
3001 {
3002 SetAnimationPhase(slotNameMounted, 0);
3003 SetAnimationPhase(slot_name, 1);
3004 }
3005 else
3006 {
3007 SetAnimationPhase(slotNameMounted, 1);
3008 SetAnimationPhase(slot_name, 0);
3009 }
3010 }
3011 else
3012 {
3013 SetAnimationPhase(slotNameMounted, 1);
3014 SetAnimationPhase(slot_name, 1);
3015
3017 }
3018 }
3019
3020
3022 {
3025
3028
3031
3032 foreach (
string slotName : attachmentSlots)
3033 {
3035 }
3036
3037
3039 {
3042
3044 }
3045 else
3046 {
3049
3051 }
3052
3055 }
3056
3058 {
3059
3061 return;
3062
3063 string slot_name_mounted = slot_name + "_Mounted";
3064 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3065
3066
3068 RemoveProxyPhysics( slot_name_mounted );
3069 RemoveProxyPhysics( slot_name );
3070
3071 if ( attachment )
3072 {
3074 if ( is_locked )
3075 {
3077 AddProxyPhysics( slot_name_mounted );
3078 }
3079 else
3080 {
3082 AddProxyPhysics( slot_name );
3083 }
3084 }
3085 }
3086
3088 {
3089 SetAffectPathgraph( true, false );
3091 }
3092
3094 {
3095 return true;
3096 }
3097
3099 {
3100 return true;
3101 }
3102
3104 {
3105 if ( attachment )
3106 {
3108 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3109
3110 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3111 }
3112
3113 return false;
3114 }
3115
3117 {
3119 }
3120
3121
3123 {
3124 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3125 if (
GetGame().ConfigIsExisting( config_path ) )
3126 {
3128 }
3129 }
3130
3132 {
3133 return true;
3134 }
3135
3137 {
3138 return true;
3139 }
3140
3142 {
3143 return true;
3144 }
3145
3146
3148 {
3150 {
3152 }
3153
3155 }
3156
3158 {
3160 }
3161
3162
3163
3165 {
3166 return super.CanReceiveAttachment(attachment, slotId);
3167 }
3168
3170 {
3171 int attachment_count = GetInventory().AttachmentCount();
3172 if ( attachment_count > 0 )
3173 {
3174 if (
HasBase() && attachment_count == 1 )
3175 {
3176 return false;
3177 }
3178
3179 return true;
3180 }
3181
3182 return false;
3183 }
3184
3186 {
3187 return true;
3188 }
3189
3191 {
3192 return false;
3193 }
3194
3195
3197 {
3198 return false;
3199 }
3200
3202 {
3203 return false;
3204 }
3205
3206
3208 {
3209 return false;
3210 }
3211
3212
3213
3215 {
3216 return true;
3217 }
3218
3220 {
3221 return true;
3222 }
3223
3226 {
3227 return false;
3228 }
3229
3230
3232 {
3233 return true;
3234 }
3235
3236
3238 {
3239 return false;
3240 }
3241
3242
3244 {
3245 return true;
3246 }
3247
3248
3250 {
3251 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3252 {
3253 return false;
3254 }
3255
3256 return true;
3257 }
3258
3260 {
3263
3264 return item;
3265 }
3266
3267
3269 {
3271 {
3272
3274
3275
3278
3280 if ( MemoryPointExists( slot_name + "_min" ) )
3281 {
3282 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3283 }
3284 if ( MemoryPointExists( slot_name + "_max" ) )
3285 {
3286 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3287 }
3288
3289
3292
3293
3296 center = ModelToWorld( center );
3297
3298
3301
3302 areaDamage.SetExtents( extents[0], extents[1] );
3303 areaDamage.SetAreaPosition( center );
3304 areaDamage.SetAreaOrientation( orientation );
3307 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3308 areaDamage.SetAmmoName( "BarbedWireHit" );
3309 areaDamage.Spawn();
3310
3312 }
3313 }
3314
3316 {
3317 if ( angle_deg != 0 )
3318 {
3319
3320 orientation[0] = orientation[0] - angle_deg;
3321
3322
3324 if ( MemoryPointExists( "rotate_axis" ) )
3325 {
3326 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3327 }
3328 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];
3329 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];
3330 center[0] = r_center_x;
3331 center[2] = r_center_z;
3332 }
3333 }
3334
3336 {
3338 {
3341 {
3342 if (areaDamage)
3343 {
3344 areaDamage.Destroy();
3345 }
3346
3348 }
3349 }
3350 }
3351
3353 {
3354 return true;
3355 }
3356
3357
3358
3359
3361 {
3363 }
3364
3366 {
3368 }
3369
3371 {
3373 }
3374
3376 {
3378
3379 switch ( material_type )
3380 {
3386 }
3387
3388 return "";
3389 }
3390
3392 {
3394
3395 switch ( material_type )
3396 {
3402 }
3403
3404 return "";
3405 }
3406
3407
3409 {
3411 {
3412
3414 {
3415 SetHealth(slot_name,"Health",item.GetHealth());
3416 }
3417 }
3418 }
3419
3421 {
3422 return 111;
3423 }
3424
3426 {
3427 super.SetActions();
3428
3432 }
3433
3434
3435
3436
3438 {
3439 }
3440
3443 {
3444 return null;
3445 }
3446
3448 {
3450 }
3451
3453 {
3456
3457 Man p;
3458
3459 #ifdef SERVER
3462 if (players.Count())
3463 p = players[0];
3464 #else
3466 #endif
3467
3469 {
3470 bool excluded = false;
3472 if (excludes)
3473 {
3474 foreach (string exclude : excludes)
3475 {
3477 {
3478 excluded = true;
3479 break;
3480 }
3481 }
3482 }
3483
3484 if (!excluded)
3485 {
3487 }
3488 }
3489
3491 }
3492}
3493
3495{
3496#ifdef BSB_DEBUG
3498#else
3499
3500#endif
3501}
3503{
3504#ifdef BSB_DEBUG_SPAM
3506#else
3507
3508#endif
3509}
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.