2182{
2184
2186
2188
2190
2196
2197
2198
2204
2210
2212
2216
2217
2219 {
2221
2222
2223 RegisterNetSyncVariableInt( "m_SyncParts01" );
2224 RegisterNetSyncVariableInt( "m_SyncParts02" );
2225 RegisterNetSyncVariableInt( "m_SyncParts03" );
2226 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2227 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2228 RegisterNetSyncVariableBool( "m_HasBase" );
2229
2230
2232
2233 if (ConfigIsExisting("hybridAttachments"))
2234 {
2237 }
2238 if (ConfigIsExisting("mountables"))
2239 {
2242 }
2243
2245 }
2246
2248 {
2249 super.EEDelete(parent);
2250
2252 {
2253 areaDamage.Destroy();
2254 }
2255
2256 }
2257
2259 {
2260 return "disableBaseDamage";
2261 }
2262
2264 {
2265 return true;
2266 }
2267
2269 {
2270 return EInventoryIconVisibility.HIDE_VICINITY;
2271 }
2272
2273
2275 {
2277 {
2278 SetSynchDirty();
2279 }
2280 }
2281
2283 {
2285 super.OnVariablesSynchronized();
2286
2288 }
2289
2291 {
2292
2294
2295
2297
2298
2300 }
2301
2302
2304 {
2305
2306 int offset;
2307 int mask;
2308
2309 if ( part_id >= 1 && part_id <= 31 )
2310 {
2311 offset = part_id - 1;
2312 mask = 1 << offset;
2313
2315 }
2316 else if ( part_id >= 32 && part_id <= 62 )
2317 {
2318 offset = ( part_id % 32 );
2319 mask = 1 << offset;
2320
2322 }
2323 else if ( part_id >= 63 && part_id <= 93 )
2324 {
2325 offset = ( part_id % 63 );
2326 mask = 1 << offset;
2327
2329 }
2330 }
2331
2333 {
2334
2335 int offset;
2336 int mask;
2337
2338 if ( part_id >= 1 && part_id <= 31 )
2339 {
2340 offset = part_id - 1;
2341 mask = 1 << offset;
2342
2344 }
2345 else if ( part_id >= 32 && part_id <= 62 )
2346 {
2347 offset = ( part_id % 32 );
2348 mask = 1 << offset;
2349
2351 }
2352 else if ( part_id >= 63 && part_id <= 93 )
2353 {
2354 offset = ( part_id % 63 );
2355 mask = 1 << offset;
2356
2358 }
2359 }
2360
2362 {
2363
2364 int offset;
2365 int mask;
2366
2367 if ( part_id >= 1 && part_id <= 31 )
2368 {
2369 offset = part_id - 1;
2370 mask = 1 << offset;
2371
2373 {
2374 return true;
2375 }
2376 }
2377 else if ( part_id >= 32 && part_id <= 62 )
2378 {
2379 offset = ( part_id % 32 );
2380 mask = 1 << offset;
2381
2383 {
2384 return true;
2385 }
2386 }
2387 else if ( part_id >= 63 && part_id <= 93 )
2388 {
2389 offset = ( part_id % 63 );
2390 mask = 1 << offset;
2391
2393 {
2394 return true;
2395 }
2396 }
2397
2398 return false;
2399 }
2400
2402 {
2405 }
2406
2408 {
2409
2412 }
2413
2415 {
2417 {
2420
2421 switch( build_action_id )
2422 {
2426 }
2427 }
2428 }
2429
2430
2432 {
2434 bool is_base = part.
IsBase();
2437 if ( is_part_built_sync )
2438 {
2440 {
2444
2445 if (is_base)
2446 {
2449 }
2450 }
2451 }
2452 else
2453 {
2455 {
2459
2460 if (is_base)
2461 {
2464 }
2465 }
2466 }
2467
2468
2470 }
2471
2472
2474 {
2477
2478 for ( int i = 0; i < construction_parts.Count(); ++i )
2479 {
2480 string key = construction_parts.GetKey( i );
2483 }
2484
2485
2487 }
2488
2490 {
2493
2494 for ( int i = 0; i < construction_parts.Count(); ++i )
2495 {
2496 string key = construction_parts.GetKey( i );
2498
2499 if ( value.
GetId() ==
id )
2500 {
2501 return value;
2502 }
2503 }
2504
2505 return NULL;
2506 }
2507
2508
2509
2511 {
2513 }
2514
2516 {
2518 }
2519
2521 {
2522 return true;
2523 }
2524
2526 {
2527 return false;
2528 }
2529
2530
2532 {
2535 {
2537 }
2538
2539 return construction_kit;
2540 }
2541
2543 {
2546 {
2548 }
2549 }
2550
2552 {
2554 }
2555
2557 {
2558 return "";
2559 }
2560
2562 {
2565 }
2566
2567
2569 {
2572 }
2573
2574
2576 {
2577 super.OnStoreSave( ctx );
2578
2579
2583
2585 }
2586
2588 {
2589 if ( !super.OnStoreLoad( ctx, version ) )
2590 return false;
2591
2592
2593
2595 {
2597 return false;
2598 }
2600 {
2602 return false;
2603 }
2605 {
2607 return false;
2608 }
2609
2610
2612 {
2614 return false;
2615 }
2616
2617
2618 return true;
2619 }
2620
2622 {
2623 super.AfterStoreLoad();
2624
2626 {
2628 }
2629 }
2630
2632 {
2633
2635
2636
2639
2640
2642 }
2643
2645 {
2646 super.OnCreatePhysics();
2649 }
2650
2652 {
2654 return;
2655
2656 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2657
2659 return;
2660
2662 string part_name = zone;
2664
2666 {
2667 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2668
2669 if ( construction_part && construction.IsPartConstructed( part_name ) )
2670 {
2672 construction.DestroyConnectedParts(part_name);
2673 }
2674
2675
2676 if ( part_name.
Contains(
"barbed") )
2677 {
2678 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2679 if (barbed_wire)
2680 barbed_wire.SetMountedState( false );
2681 }
2682 }
2683 }
2684
2686 {
2688 {
2690 }
2691
2692 super.EEOnAfterLoad();
2693 }
2694
2696 {
2697 super.EEInit();
2698
2699
2701
2702
2703 #ifdef DEVELOPER
2705 #endif
2706 }
2707
2709 {
2710 super.EEItemAttached( item, slot_name );
2711
2715 }
2716
2718 {
2719 super.EEItemDetached( item, slot_name );
2720
2723 }
2724
2725 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2726 {
2729
2732 }
2733
2734
2736 {
2737 return true;
2738 }
2739
2740
2741
2743 {
2745
2746
2747 if (construtionPart.
IsBase())
2748 {
2750
2751
2753 }
2754
2755
2757
2758
2760
2761
2763
2765
2767
2768
2770
2771
2773 }
2774
2776 {
2777
2779 }
2780
2781
2783 {
2786
2787
2789
2790
2792
2793
2795
2796
2798
2800
2801
2803
2804
2806
2807
2808 if (construtionPart.
IsBase())
2809 {
2810
2812 }
2813
2816 }
2817
2819 {
2820
2822 }
2823
2824
2825 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2826 {
2829
2830
2832
2833
2835
2836
2838
2839
2841
2843
2844
2846
2847
2849
2850
2851 if (construtionPart.
IsBase())
2852 {
2853
2855 }
2856
2859 }
2860
2862 {
2863
2865 }
2866
2868 {
2869 bool process = false;
2870
2871
2875
2876 if (process)
2877 {
2878 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2879 {
2881 return;
2882 }
2883
2885 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2886 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2887
2888
2890 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2891 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2892 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2893 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2894 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2895 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2896 mins = minTmp;
2897 maxs = maxTmp;
2898
2899 maxs[1] = maxs[1] + 0.35;
2900
2902 }
2903 }
2904
2906 {
2909
2910
2912 foreach (
EntityAI entity : foundEntities)
2913 {
2916 }
2917 }
2918
2919
2921 {
2923
2927 }
2928
2930 {
2932
2934 {
2936 }
2937 else
2938 {
2940 }
2941
2943 }
2944
2946 {
2948
2950 foreach (
string slotName : attachmentSlots)
2951 {
2953 }
2954
2955
2958 else
2960
2962 }
2963
2965 {
2966 string slotNameMounted = slot_name + "_Mounted";
2967 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2968
2969 if (attachment)
2970 {
2971 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2972 if (barbedWire && barbedWire.IsMounted())
2974 else
2976
2977 if (is_locked)
2978 {
2979 SetAnimationPhase(slotNameMounted, 0);
2980 SetAnimationPhase(slot_name, 1);
2981 }
2982 else
2983 {
2984 SetAnimationPhase(slotNameMounted, 1);
2985 SetAnimationPhase(slot_name, 0);
2986 }
2987 }
2988 else
2989 {
2990 SetAnimationPhase(slotNameMounted, 1);
2991 SetAnimationPhase(slot_name, 1);
2992
2994 }
2995 }
2996
2997
2999 {
3002
3005
3008
3009 foreach (
string slotName : attachmentSlots)
3010 {
3012 }
3013
3014
3016 {
3019
3021 }
3022 else
3023 {
3026
3028 }
3029
3032 }
3033
3035 {
3036
3038 return;
3039
3040 string slot_name_mounted = slot_name + "_Mounted";
3041 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3042
3043
3045 RemoveProxyPhysics( slot_name_mounted );
3046 RemoveProxyPhysics( slot_name );
3047
3048 if ( attachment )
3049 {
3051 if ( is_locked )
3052 {
3054 AddProxyPhysics( slot_name_mounted );
3055 }
3056 else
3057 {
3059 AddProxyPhysics( slot_name );
3060 }
3061 }
3062 }
3063
3065 {
3066 SetAffectPathgraph( true, false );
3068 }
3069
3071 {
3072 return true;
3073 }
3074
3076 {
3077 return true;
3078 }
3079
3081 {
3082 if ( attachment )
3083 {
3085 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3086
3087 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3088 }
3089
3090 return false;
3091 }
3092
3094 {
3096 }
3097
3098
3100 {
3101 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3102 if (
GetGame().ConfigIsExisting( config_path ) )
3103 {
3105 }
3106 }
3107
3109 {
3110 return true;
3111 }
3112
3114 {
3115 return true;
3116 }
3117
3119 {
3120 return true;
3121 }
3122
3123
3125 {
3127 {
3129 }
3130
3132 }
3133
3135 {
3137 }
3138
3139
3140
3142 {
3143 return super.CanReceiveAttachment(attachment, slotId);
3144 }
3145
3147 {
3148 int attachment_count = GetInventory().AttachmentCount();
3149 if ( attachment_count > 0 )
3150 {
3151 if (
HasBase() && attachment_count == 1 )
3152 {
3153 return false;
3154 }
3155
3156 return true;
3157 }
3158
3159 return false;
3160 }
3161
3163 {
3164 return true;
3165 }
3166
3168 {
3169 return false;
3170 }
3171
3172
3174 {
3175 return false;
3176 }
3177
3179 {
3180 return false;
3181 }
3182
3183
3185 {
3186 return false;
3187 }
3188
3189
3190
3192 {
3193 return true;
3194 }
3195
3197 {
3198 return true;
3199 }
3200
3203 {
3204 return false;
3205 }
3206
3207
3209 {
3210 return true;
3211 }
3212
3213
3215 {
3216 return false;
3217 }
3218
3219
3221 {
3222 return true;
3223 }
3224
3225
3227 {
3228 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3229 {
3230 return false;
3231 }
3232
3233 return true;
3234 }
3235
3237 {
3240
3241 return item;
3242 }
3243
3244
3246 {
3248 {
3249
3251
3252
3255
3257 if ( MemoryPointExists( slot_name + "_min" ) )
3258 {
3259 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3260 }
3261 if ( MemoryPointExists( slot_name + "_max" ) )
3262 {
3263 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3264 }
3265
3266
3269
3270
3273 center = ModelToWorld( center );
3274
3275
3278
3279 areaDamage.SetExtents( extents[0], extents[1] );
3280 areaDamage.SetAreaPosition( center );
3281 areaDamage.SetAreaOrientation( orientation );
3284 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3285 areaDamage.SetAmmoName( "BarbedWireHit" );
3286 areaDamage.Spawn();
3287
3289 }
3290 }
3291
3293 {
3294 if ( angle_deg != 0 )
3295 {
3296
3297 orientation[0] = orientation[0] - angle_deg;
3298
3299
3301 if ( MemoryPointExists( "rotate_axis" ) )
3302 {
3303 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3304 }
3305 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];
3306 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];
3307 center[0] = r_center_x;
3308 center[2] = r_center_z;
3309 }
3310 }
3311
3313 {
3315 {
3318 {
3319 if (areaDamage)
3320 {
3321 areaDamage.Destroy();
3322 }
3323
3325 }
3326 }
3327 }
3328
3330 {
3331 return true;
3332 }
3333
3334
3335
3336
3338 {
3340 }
3341
3343 {
3345 }
3346
3348 {
3350 }
3351
3353 {
3355
3356 switch ( material_type )
3357 {
3363 }
3364
3365 return "";
3366 }
3367
3369 {
3371
3372 switch ( material_type )
3373 {
3379 }
3380
3381 return "";
3382 }
3383
3384
3386 {
3388 {
3389
3391 {
3392 SetHealth(slot_name,"Health",item.GetHealth());
3393 }
3394 }
3395 }
3396
3398 {
3399 return 111;
3400 }
3401
3403 {
3404 super.SetActions();
3405
3409 }
3410
3411
3412
3413
3415 {
3416 }
3417
3420 {
3421 return null;
3422 }
3423
3425 {
3427 }
3428
3430 {
3433
3434 Man p;
3435
3436 #ifdef SERVER
3439 if (players.Count())
3440 p = players[0];
3441 #else
3443 #endif
3444
3446 {
3447 bool excluded = false;
3449 if (excludes)
3450 {
3451 foreach (string exclude : excludes)
3452 {
3454 {
3455 excluded = true;
3456 break;
3457 }
3458 }
3459 }
3460
3461 if (!excluded)
3462 {
3464 }
3465 }
3466
3468 }
3469}
3470
3472{
3473#ifdef BSB_DEBUG
3475#else
3476
3477#endif
3478}
3480{
3481#ifdef BSB_DEBUG_SPAM
3483#else
3484
3485#endif
3486}
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.