2192{
2194
2196
2198
2200
2206
2207
2208
2214
2220
2222
2226
2227
2229 {
2231
2232
2233 RegisterNetSyncVariableInt( "m_SyncParts01" );
2234 RegisterNetSyncVariableInt( "m_SyncParts02" );
2235 RegisterNetSyncVariableInt( "m_SyncParts03" );
2236 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2237 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2238 RegisterNetSyncVariableBool( "m_HasBase" );
2239
2240
2242
2243 if (ConfigIsExisting("hybridAttachments"))
2244 {
2247 }
2248 if (ConfigIsExisting("mountables"))
2249 {
2252 }
2253
2255 }
2256
2258 {
2259 super.EEDelete(parent);
2260
2262 {
2263 areaDamage.Destroy();
2264 }
2265
2266 }
2267
2269 {
2270 return "disableBaseDamage";
2271 }
2272
2274 {
2275 return true;
2276 }
2277
2279 {
2280 return EInventoryIconVisibility.HIDE_VICINITY;
2281 }
2282
2283
2285 {
2287 {
2288 SetSynchDirty();
2289 }
2290 }
2291
2293 {
2295 super.OnVariablesSynchronized();
2296
2298 }
2299
2301 {
2302
2304
2305
2307
2308
2310 }
2311
2312
2314 {
2315
2316 int offset;
2317 int mask;
2318
2319 if ( part_id >= 1 && part_id <= 31 )
2320 {
2321 offset = part_id - 1;
2322 mask = 1 << offset;
2323
2325 }
2326 else if ( part_id >= 32 && part_id <= 62 )
2327 {
2328 offset = ( part_id % 32 );
2329 mask = 1 << offset;
2330
2332 }
2333 else if ( part_id >= 63 && part_id <= 93 )
2334 {
2335 offset = ( part_id % 63 );
2336 mask = 1 << offset;
2337
2339 }
2340 }
2341
2343 {
2344
2345 int offset;
2346 int mask;
2347
2348 if ( part_id >= 1 && part_id <= 31 )
2349 {
2350 offset = part_id - 1;
2351 mask = 1 << offset;
2352
2354 }
2355 else if ( part_id >= 32 && part_id <= 62 )
2356 {
2357 offset = ( part_id % 32 );
2358 mask = 1 << offset;
2359
2361 }
2362 else if ( part_id >= 63 && part_id <= 93 )
2363 {
2364 offset = ( part_id % 63 );
2365 mask = 1 << offset;
2366
2368 }
2369 }
2370
2372 {
2373
2374 int offset;
2375 int mask;
2376
2377 if ( part_id >= 1 && part_id <= 31 )
2378 {
2379 offset = part_id - 1;
2380 mask = 1 << offset;
2381
2383 {
2384 return true;
2385 }
2386 }
2387 else if ( part_id >= 32 && part_id <= 62 )
2388 {
2389 offset = ( part_id % 32 );
2390 mask = 1 << offset;
2391
2393 {
2394 return true;
2395 }
2396 }
2397 else if ( part_id >= 63 && part_id <= 93 )
2398 {
2399 offset = ( part_id % 63 );
2400 mask = 1 << offset;
2401
2403 {
2404 return true;
2405 }
2406 }
2407
2408 return false;
2409 }
2410
2412 {
2415 }
2416
2418 {
2419
2422 }
2423
2425 {
2427 {
2430
2431 switch( build_action_id )
2432 {
2436 }
2437 }
2438 }
2439
2440
2442 {
2444 bool is_base = part.
IsBase();
2447 if ( is_part_built_sync )
2448 {
2450 {
2454
2455 if (is_base)
2456 {
2459 }
2460 }
2461 }
2462 else
2463 {
2465 {
2469
2470 if (is_base)
2471 {
2474 }
2475 }
2476 }
2477
2478
2480 }
2481
2482
2484 {
2487
2488 for ( int i = 0; i < construction_parts.Count(); ++i )
2489 {
2490 string key = construction_parts.GetKey( i );
2493 }
2494
2495
2497 }
2498
2500 {
2503
2504 for ( int i = 0; i < construction_parts.Count(); ++i )
2505 {
2506 string key = construction_parts.GetKey( i );
2508
2509 if ( value.
GetId() ==
id )
2510 {
2511 return value;
2512 }
2513 }
2514
2515 return NULL;
2516 }
2517
2518
2519
2521 {
2523 }
2524
2526 {
2528 }
2529
2531 {
2532 return true;
2533 }
2534
2536 {
2537 return false;
2538 }
2539
2540
2542 {
2545 {
2547 }
2548
2549 return construction_kit;
2550 }
2551
2553 {
2556 {
2558 }
2559 }
2560
2562 {
2564 }
2565
2567 {
2568 return "";
2569 }
2570
2572 {
2575 }
2576
2577
2579 {
2582 }
2583
2584
2586 {
2587 super.OnStoreSave( ctx );
2588
2589
2593
2595 }
2596
2598 {
2599 if ( !super.OnStoreLoad( ctx, version ) )
2600 return false;
2601
2602
2603
2605 {
2607 return false;
2608 }
2610 {
2612 return false;
2613 }
2615 {
2617 return false;
2618 }
2619
2620
2622 {
2624 return false;
2625 }
2626
2627
2628 return true;
2629 }
2630
2632 {
2633 super.AfterStoreLoad();
2634
2636 {
2638 }
2639 }
2640
2642 {
2643
2645
2646
2649
2650
2652 }
2653
2655 {
2656 super.OnCreatePhysics();
2659 }
2660
2662 {
2664 return;
2665
2666 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2667
2669 return;
2670
2672 string part_name = zone;
2674
2676 {
2677 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2678
2679 if ( construction_part && construction.IsPartConstructed( part_name ) )
2680 {
2682 construction.DestroyConnectedParts(part_name);
2683 }
2684
2685
2686 if ( part_name.
Contains(
"barbed") )
2687 {
2688 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2689 if (barbed_wire)
2690 barbed_wire.SetMountedState( false );
2691 }
2692 }
2693 }
2694
2696 {
2698 {
2700 }
2701
2702 super.EEOnAfterLoad();
2703 }
2704
2706 {
2707 super.EEInit();
2708
2709
2711
2712
2713 #ifdef DEVELOPER
2715 #endif
2716 }
2717
2719 {
2720 super.EEItemAttached( item, slot_name );
2721
2725 }
2726
2728 {
2729 super.EEItemDetached( item, slot_name );
2730
2733 }
2734
2735 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2736 {
2739
2742 }
2743
2744
2746 {
2747 return true;
2748 }
2749
2750
2751
2753 {
2755
2756
2757 if (construtionPart.
IsBase())
2758 {
2760
2761
2763 }
2764
2765
2767
2768
2770
2771
2773
2775
2777
2778
2780
2781
2783 }
2784
2786 {
2787
2789 }
2790
2791
2793 {
2796
2797
2799
2800
2802
2803
2805
2806
2808
2810
2811
2813
2814
2816
2817
2818 if (construtionPart.
IsBase())
2819 {
2820
2822 }
2823
2826 }
2827
2829 {
2830
2832 }
2833
2834
2835 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2836 {
2839
2840
2842
2843
2845
2846
2848
2849
2851
2853
2854
2856
2857
2859
2860
2861 if (construtionPart.
IsBase())
2862 {
2863
2865 }
2866
2869 }
2870
2872 {
2873
2875 }
2876
2878 {
2879 bool process = false;
2880
2881
2885
2886 if (process)
2887 {
2888 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2889 {
2891 return;
2892 }
2893
2895 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2896 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2897
2898
2900 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2901 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2902 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2903 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2904 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2905 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2906 mins = minTmp;
2907 maxs = maxTmp;
2908
2909 maxs[1] = maxs[1] + 0.35;
2910
2912 }
2913 }
2914
2916 {
2919
2920
2922 foreach (
EntityAI entity : foundEntities)
2923 {
2926 }
2927 }
2928
2929
2931 {
2933
2937 }
2938
2940 {
2942
2944 {
2946 }
2947 else
2948 {
2950 }
2951
2953 }
2954
2956 {
2958
2960 foreach (
string slotName : attachmentSlots)
2961 {
2963 }
2964
2965
2968 else
2970
2972 }
2973
2975 {
2976 string slotNameMounted = slot_name + "_Mounted";
2977 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2978
2979 if (attachment)
2980 {
2981 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2982 if (barbedWire && barbedWire.IsMounted())
2984 else
2986
2987 if (is_locked)
2988 {
2989 SetAnimationPhase(slotNameMounted, 0);
2990 SetAnimationPhase(slot_name, 1);
2991 }
2992 else
2993 {
2994 SetAnimationPhase(slotNameMounted, 1);
2995 SetAnimationPhase(slot_name, 0);
2996 }
2997 }
2998 else
2999 {
3000 SetAnimationPhase(slotNameMounted, 1);
3001 SetAnimationPhase(slot_name, 1);
3002
3004 }
3005 }
3006
3007
3009 {
3012
3015
3018
3019 foreach (
string slotName : attachmentSlots)
3020 {
3022 }
3023
3024
3026 {
3029
3031 }
3032 else
3033 {
3036
3038 }
3039
3042 }
3043
3045 {
3046
3048 return;
3049
3050 string slot_name_mounted = slot_name + "_Mounted";
3051 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3052
3053
3055 RemoveProxyPhysics( slot_name_mounted );
3056 RemoveProxyPhysics( slot_name );
3057
3058 if ( attachment )
3059 {
3061 if ( is_locked )
3062 {
3064 AddProxyPhysics( slot_name_mounted );
3065 }
3066 else
3067 {
3069 AddProxyPhysics( slot_name );
3070 }
3071 }
3072 }
3073
3075 {
3076 SetAffectPathgraph( true, false );
3078 }
3079
3081 {
3082 return true;
3083 }
3084
3086 {
3087 return true;
3088 }
3089
3091 {
3092 if ( attachment )
3093 {
3095 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3096
3097 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3098 }
3099
3100 return false;
3101 }
3102
3104 {
3106 }
3107
3108
3110 {
3111 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3112 if (
GetGame().ConfigIsExisting( config_path ) )
3113 {
3115 }
3116 }
3117
3119 {
3120 return true;
3121 }
3122
3124 {
3125 return true;
3126 }
3127
3129 {
3130 return true;
3131 }
3132
3133
3135 {
3137 {
3139 }
3140
3142 }
3143
3145 {
3147 }
3148
3149
3150
3152 {
3153 return super.CanReceiveAttachment(attachment, slotId);
3154 }
3155
3157 {
3158 int attachment_count = GetInventory().AttachmentCount();
3159 if ( attachment_count > 0 )
3160 {
3161 if (
HasBase() && attachment_count == 1 )
3162 {
3163 return false;
3164 }
3165
3166 return true;
3167 }
3168
3169 return false;
3170 }
3171
3173 {
3174 return true;
3175 }
3176
3178 {
3179 return false;
3180 }
3181
3182
3184 {
3185 return false;
3186 }
3187
3189 {
3190 return false;
3191 }
3192
3193
3195 {
3196 return false;
3197 }
3198
3199
3200
3202 {
3203 return true;
3204 }
3205
3207 {
3208 return true;
3209 }
3210
3213 {
3214 return false;
3215 }
3216
3217
3219 {
3220 return true;
3221 }
3222
3223
3225 {
3226 return false;
3227 }
3228
3229
3231 {
3232 return true;
3233 }
3234
3235
3237 {
3238 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3239 {
3240 return false;
3241 }
3242
3243 return true;
3244 }
3245
3247 {
3250
3251 return item;
3252 }
3253
3254
3256 {
3258 {
3259
3261
3262
3265
3267 if ( MemoryPointExists( slot_name + "_min" ) )
3268 {
3269 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3270 }
3271 if ( MemoryPointExists( slot_name + "_max" ) )
3272 {
3273 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3274 }
3275
3276
3279
3280
3283 center = ModelToWorld( center );
3284
3285
3288
3289 areaDamage.SetExtents( extents[0], extents[1] );
3290 areaDamage.SetAreaPosition( center );
3291 areaDamage.SetAreaOrientation( orientation );
3294 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3295 areaDamage.SetAmmoName( "BarbedWireHit" );
3296 areaDamage.Spawn();
3297
3299 }
3300 }
3301
3303 {
3304 if ( angle_deg != 0 )
3305 {
3306
3307 orientation[0] = orientation[0] - angle_deg;
3308
3309
3311 if ( MemoryPointExists( "rotate_axis" ) )
3312 {
3313 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3314 }
3315 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];
3316 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];
3317 center[0] = r_center_x;
3318 center[2] = r_center_z;
3319 }
3320 }
3321
3323 {
3325 {
3328 {
3329 if (areaDamage)
3330 {
3331 areaDamage.Destroy();
3332 }
3333
3335 }
3336 }
3337 }
3338
3340 {
3341 return true;
3342 }
3343
3344
3345
3346
3348 {
3350 }
3351
3353 {
3355 }
3356
3358 {
3360 }
3361
3363 {
3365
3366 switch ( material_type )
3367 {
3373 }
3374
3375 return "";
3376 }
3377
3379 {
3381
3382 switch ( material_type )
3383 {
3389 }
3390
3391 return "";
3392 }
3393
3394
3396 {
3398 {
3399
3401 {
3402 SetHealth(slot_name,"Health",item.GetHealth());
3403 }
3404 }
3405 }
3406
3408 {
3409 return 111;
3410 }
3411
3413 {
3414 super.SetActions();
3415
3419 }
3420
3421
3422
3423
3425 {
3426 }
3427
3430 {
3431 return null;
3432 }
3433
3435 {
3437 }
3438
3440 {
3443
3444 Man p;
3445
3446 #ifdef SERVER
3449 if (players.Count())
3450 p = players[0];
3451 #else
3453 #endif
3454
3456 {
3457 bool excluded = false;
3459 if (excludes)
3460 {
3461 foreach (string exclude : excludes)
3462 {
3464 {
3465 excluded = true;
3466 break;
3467 }
3468 }
3469 }
3470
3471 if (!excluded)
3472 {
3474 }
3475 }
3476
3478 }
3479}
3480
3482{
3483#ifdef BSB_DEBUG
3485#else
3486
3487#endif
3488}
3490{
3491#ifdef BSB_DEBUG_SPAM
3493#else
3494
3495#endif
3496}
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.