2146{
2148
2150
2152
2154
2160
2161
2162
2168
2174
2176
2180
2181
2183 {
2185
2186
2187 RegisterNetSyncVariableInt( "m_SyncParts01" );
2188 RegisterNetSyncVariableInt( "m_SyncParts02" );
2189 RegisterNetSyncVariableInt( "m_SyncParts03" );
2190 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2191 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2192 RegisterNetSyncVariableBool( "m_HasBase" );
2193
2194
2196
2197 if (ConfigIsExisting("hybridAttachments"))
2198 {
2201 }
2202 if (ConfigIsExisting("mountables"))
2203 {
2206 }
2207
2209 }
2210
2212 {
2213 super.EEDelete(parent);
2214
2216 {
2217 areaDamage.Destroy();
2218 }
2219
2220 }
2221
2223 {
2224 return "disableBaseDamage";
2225 }
2226
2228 {
2229 return true;
2230 }
2231
2233 {
2234 return EInventoryIconVisibility.HIDE_VICINITY;
2235 }
2236
2237
2239 {
2241 {
2242 SetSynchDirty();
2243 }
2244 }
2245
2247 {
2249 super.OnVariablesSynchronized();
2250
2252 }
2253
2255 {
2256
2258
2259
2261
2262
2264 }
2265
2266
2268 {
2269
2270 int offset;
2271 int mask;
2272
2273 if ( part_id >= 1 && part_id <= 31 )
2274 {
2275 offset = part_id - 1;
2276 mask = 1 << offset;
2277
2279 }
2280 else if ( part_id >= 32 && part_id <= 62 )
2281 {
2282 offset = ( part_id % 32 );
2283 mask = 1 << offset;
2284
2286 }
2287 else if ( part_id >= 63 && part_id <= 93 )
2288 {
2289 offset = ( part_id % 63 );
2290 mask = 1 << offset;
2291
2293 }
2294 }
2295
2297 {
2298
2299 int offset;
2300 int mask;
2301
2302 if ( part_id >= 1 && part_id <= 31 )
2303 {
2304 offset = part_id - 1;
2305 mask = 1 << offset;
2306
2308 }
2309 else if ( part_id >= 32 && part_id <= 62 )
2310 {
2311 offset = ( part_id % 32 );
2312 mask = 1 << offset;
2313
2315 }
2316 else if ( part_id >= 63 && part_id <= 93 )
2317 {
2318 offset = ( part_id % 63 );
2319 mask = 1 << offset;
2320
2322 }
2323 }
2324
2326 {
2327
2328 int offset;
2329 int mask;
2330
2331 if ( part_id >= 1 && part_id <= 31 )
2332 {
2333 offset = part_id - 1;
2334 mask = 1 << offset;
2335
2337 {
2338 return true;
2339 }
2340 }
2341 else if ( part_id >= 32 && part_id <= 62 )
2342 {
2343 offset = ( part_id % 32 );
2344 mask = 1 << offset;
2345
2347 {
2348 return true;
2349 }
2350 }
2351 else if ( part_id >= 63 && part_id <= 93 )
2352 {
2353 offset = ( part_id % 63 );
2354 mask = 1 << offset;
2355
2357 {
2358 return true;
2359 }
2360 }
2361
2362 return false;
2363 }
2364
2366 {
2369 }
2370
2372 {
2373
2376 }
2377
2379 {
2381 {
2384
2385 switch( build_action_id )
2386 {
2390 }
2391 }
2392 }
2393
2394
2396 {
2398 bool is_base = part.
IsBase();
2401 if ( is_part_built_sync )
2402 {
2404 {
2408
2409 if (is_base)
2410 {
2413 }
2414 }
2415 }
2416 else
2417 {
2419 {
2423
2424 if (is_base)
2425 {
2428 }
2429 }
2430 }
2431
2432
2434 }
2435
2436
2438 {
2441
2442 for ( int i = 0; i < construction_parts.Count(); ++i )
2443 {
2444 string key = construction_parts.GetKey( i );
2447 }
2448
2449
2451 }
2452
2454 {
2457
2458 for ( int i = 0; i < construction_parts.Count(); ++i )
2459 {
2460 string key = construction_parts.GetKey( i );
2462
2463 if ( value.
GetId() ==
id )
2464 {
2465 return value;
2466 }
2467 }
2468
2469 return NULL;
2470 }
2471
2472
2473
2475 {
2477 }
2478
2480 {
2482 }
2483
2485 {
2486 return true;
2487 }
2488
2490 {
2491 return false;
2492 }
2493
2494
2496 {
2499 {
2501 }
2502
2503 return construction_kit;
2504 }
2505
2507 {
2510 {
2512 }
2513 }
2514
2516 {
2518 }
2519
2521 {
2522 return "";
2523 }
2524
2526 {
2529 }
2530
2531
2533 {
2536 }
2537
2538
2540 {
2541 super.OnStoreSave( ctx );
2542
2543
2547
2549 }
2550
2552 {
2553 if ( !super.OnStoreLoad( ctx, version ) )
2554 return false;
2555
2556
2557
2559 {
2561 return false;
2562 }
2564 {
2566 return false;
2567 }
2569 {
2571 return false;
2572 }
2573
2574
2576 {
2578 return false;
2579 }
2580
2581
2582 return true;
2583 }
2584
2586 {
2587 super.AfterStoreLoad();
2588
2590 {
2592 }
2593 }
2594
2596 {
2597
2599
2600
2603
2604
2606 }
2607
2609 {
2610 super.OnCreatePhysics();
2613 }
2614
2616 {
2618 return;
2619
2620 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2621
2623 return;
2624
2626 string part_name = zone;
2628
2630 {
2631 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2632
2633 if ( construction_part && construction.IsPartConstructed( part_name ) )
2634 {
2636 construction.DestroyConnectedParts(part_name);
2637 }
2638
2639
2640 if ( part_name.
Contains(
"barbed") )
2641 {
2642 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2643 if (barbed_wire)
2644 barbed_wire.SetMountedState( false );
2645 }
2646 }
2647 }
2648
2650 {
2652 {
2654 }
2655
2656 super.EEOnAfterLoad();
2657 }
2658
2660 {
2661 super.EEInit();
2662
2663
2665
2666
2667 #ifdef DEVELOPER
2669 #endif
2670 }
2671
2673 {
2674 super.EEItemAttached( item, slot_name );
2675
2679 }
2680
2682 {
2683 super.EEItemDetached( item, slot_name );
2684
2687 }
2688
2689 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2690 {
2693
2696 }
2697
2698
2700 {
2701 return true;
2702 }
2703
2704
2705
2707 {
2709
2710
2711 if (construtionPart.
IsBase())
2712 {
2714
2715
2717 }
2718
2719
2721
2722
2724
2725
2727
2729
2731
2732
2734
2735
2737 }
2738
2740 {
2741
2743 }
2744
2745
2747 {
2750
2751
2753
2754
2756
2757
2759
2760
2762
2764
2765
2767
2768
2770
2771
2772 if (construtionPart.
IsBase())
2773 {
2774
2776 }
2777
2780 }
2781
2783 {
2784
2786 }
2787
2788
2789 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2790 {
2793
2794
2796
2797
2799
2800
2802
2803
2805
2807
2808
2810
2811
2813
2814
2815 if (construtionPart.
IsBase())
2816 {
2817
2819 }
2820
2823 }
2824
2826 {
2827
2829 }
2830
2832 {
2833 bool process = false;
2834
2835
2839
2840 if (process)
2841 {
2842 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2843 {
2845 return;
2846 }
2847
2849 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2850 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2851
2852
2854 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2855 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2856 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2857 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2858 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2859 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2860 mins = minTmp;
2861 maxs = maxTmp;
2862
2863 maxs[1] = maxs[1] + 0.35;
2864
2866 }
2867 }
2868
2870 {
2873
2874
2876 foreach (
EntityAI entity : foundEntities)
2877 {
2880 }
2881 }
2882
2883
2885 {
2887
2891 }
2892
2894 {
2896
2898 {
2900 }
2901 else
2902 {
2904 }
2905
2907 }
2908
2910 {
2912
2914 foreach (
string slotName : attachmentSlots)
2915 {
2917 }
2918
2919
2922 else
2924
2926 }
2927
2929 {
2930 string slotNameMounted = slot_name + "_Mounted";
2931 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2932
2933 if (attachment)
2934 {
2935 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2936 if (barbedWire && barbedWire.IsMounted())
2938 else
2940
2941 if (is_locked)
2942 {
2943 SetAnimationPhase(slotNameMounted, 0);
2944 SetAnimationPhase(slot_name, 1);
2945 }
2946 else
2947 {
2948 SetAnimationPhase(slotNameMounted, 1);
2949 SetAnimationPhase(slot_name, 0);
2950 }
2951 }
2952 else
2953 {
2954 SetAnimationPhase(slotNameMounted, 1);
2955 SetAnimationPhase(slot_name, 1);
2956
2958 }
2959 }
2960
2961
2963 {
2966
2969
2972
2973 foreach (
string slotName : attachmentSlots)
2974 {
2976 }
2977
2978
2980 {
2983
2985 }
2986 else
2987 {
2990
2992 }
2993
2996 }
2997
2999 {
3000
3002 return;
3003
3004 string slot_name_mounted = slot_name + "_Mounted";
3005 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3006
3007
3009 RemoveProxyPhysics( slot_name_mounted );
3010 RemoveProxyPhysics( slot_name );
3011
3012 if ( attachment )
3013 {
3015 if ( is_locked )
3016 {
3018 AddProxyPhysics( slot_name_mounted );
3019 }
3020 else
3021 {
3023 AddProxyPhysics( slot_name );
3024 }
3025 }
3026 }
3027
3029 {
3030 SetAffectPathgraph( true, false );
3032 }
3033
3035 {
3036 return true;
3037 }
3038
3040 {
3041 return true;
3042 }
3043
3045 {
3046 if ( attachment )
3047 {
3049 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3050
3051 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3052 }
3053
3054 return false;
3055 }
3056
3058 {
3060 }
3061
3062
3064 {
3065 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3066 if (
GetGame().ConfigIsExisting( config_path ) )
3067 {
3069 }
3070 }
3071
3073 {
3074 return true;
3075 }
3076
3078 {
3079 return true;
3080 }
3081
3083 {
3084 return true;
3085 }
3086
3087
3089 {
3091 {
3093 }
3094
3096 }
3097
3099 {
3101 }
3102
3103
3104
3106 {
3107 return super.CanReceiveAttachment(attachment, slotId);
3108 }
3109
3111 {
3112 int attachment_count = GetInventory().AttachmentCount();
3113 if ( attachment_count > 0 )
3114 {
3115 if (
HasBase() && attachment_count == 1 )
3116 {
3117 return false;
3118 }
3119
3120 return true;
3121 }
3122
3123 return false;
3124 }
3125
3127 {
3128 return true;
3129 }
3130
3132 {
3133 return false;
3134 }
3135
3136
3138 {
3139 return false;
3140 }
3141
3143 {
3144 return false;
3145 }
3146
3147
3149 {
3150 return false;
3151 }
3152
3153
3154
3156 {
3157 return true;
3158 }
3159
3161 {
3162 return true;
3163 }
3164
3167 {
3168 return false;
3169 }
3170
3171
3173 {
3174 return true;
3175 }
3176
3177
3179 {
3180 return false;
3181 }
3182
3183
3185 {
3186 return true;
3187 }
3188
3189
3191 {
3192 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3193 {
3194 return false;
3195 }
3196
3197 return true;
3198 }
3199
3201 {
3204
3205 return item;
3206 }
3207
3208
3210 {
3212 {
3213
3215
3216
3219
3221 if ( MemoryPointExists( slot_name + "_min" ) )
3222 {
3223 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3224 }
3225 if ( MemoryPointExists( slot_name + "_max" ) )
3226 {
3227 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3228 }
3229
3230
3233
3234
3237 center = ModelToWorld( center );
3238
3239
3242
3243 areaDamage.SetExtents( extents[0], extents[1] );
3244 areaDamage.SetAreaPosition( center );
3245 areaDamage.SetAreaOrientation( orientation );
3248 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3249 areaDamage.SetAmmoName( "BarbedWireHit" );
3250 areaDamage.Spawn();
3251
3253 }
3254 }
3255
3257 {
3258 if ( angle_deg != 0 )
3259 {
3260
3261 orientation[0] = orientation[0] - angle_deg;
3262
3263
3265 if ( MemoryPointExists( "rotate_axis" ) )
3266 {
3267 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3268 }
3269 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];
3270 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];
3271 center[0] = r_center_x;
3272 center[2] = r_center_z;
3273 }
3274 }
3275
3277 {
3279 {
3282 {
3283 if (areaDamage)
3284 {
3285 areaDamage.Destroy();
3286 }
3287
3289 }
3290 }
3291 }
3292
3294 {
3295 return true;
3296 }
3297
3298
3299
3300
3302 {
3304 }
3305
3307 {
3309 }
3310
3312 {
3314 }
3315
3317 {
3319
3320 switch ( material_type )
3321 {
3327 }
3328
3329 return "";
3330 }
3331
3333 {
3335
3336 switch ( material_type )
3337 {
3343 }
3344
3345 return "";
3346 }
3347
3348
3350 {
3352 {
3353
3355 {
3356 SetHealth(slot_name,"Health",item.GetHealth());
3357 }
3358 }
3359 }
3360
3362 {
3363 return 111;
3364 }
3365
3367 {
3368 super.SetActions();
3369
3373 }
3374
3375
3376
3377
3379 {
3380 }
3381
3384 {
3385 return null;
3386 }
3387
3389 {
3391 }
3392
3394 {
3397
3398 Man p;
3399
3400 #ifdef SERVER
3403 if (players.Count())
3404 p = players[0];
3405 #else
3407 #endif
3408
3410 {
3411 bool excluded = false;
3413 if (excludes)
3414 {
3415 foreach (string exclude : excludes)
3416 {
3418 {
3419 excluded = true;
3420 break;
3421 }
3422 }
3423 }
3424
3425 if (!excluded)
3426 {
3428 }
3429 }
3430
3432 }
3433}
3434
3436{
3437#ifdef BSB_DEBUG
3439#else
3440
3441#endif
3442}
3444{
3445#ifdef BSB_DEBUG_SPAM
3447#else
3448
3449#endif
3450}
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.