2176{
2178
2180
2182
2184
2190
2191
2192
2198
2204
2206
2210
2211
2213 {
2215
2216
2217 RegisterNetSyncVariableInt( "m_SyncParts01" );
2218 RegisterNetSyncVariableInt( "m_SyncParts02" );
2219 RegisterNetSyncVariableInt( "m_SyncParts03" );
2220 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2221 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2222 RegisterNetSyncVariableBool( "m_HasBase" );
2223
2224
2226
2227 if (ConfigIsExisting("hybridAttachments"))
2228 {
2231 }
2232 if (ConfigIsExisting("mountables"))
2233 {
2236 }
2237
2239 }
2240
2242 {
2243 super.EEDelete(parent);
2244
2246 {
2247 areaDamage.Destroy();
2248 }
2249
2250 }
2251
2253 {
2254 return "disableBaseDamage";
2255 }
2256
2258 {
2259 return true;
2260 }
2261
2263 {
2264 return EInventoryIconVisibility.HIDE_VICINITY;
2265 }
2266
2267
2269 {
2271 {
2272 SetSynchDirty();
2273 }
2274 }
2275
2277 {
2279 super.OnVariablesSynchronized();
2280
2282 }
2283
2285 {
2286
2288
2289
2291
2292
2294 }
2295
2296
2298 {
2299
2300 int offset;
2301 int mask;
2302
2303 if ( part_id >= 1 && part_id <= 31 )
2304 {
2305 offset = part_id - 1;
2306 mask = 1 << offset;
2307
2309 }
2310 else if ( part_id >= 32 && part_id <= 62 )
2311 {
2312 offset = ( part_id % 32 );
2313 mask = 1 << offset;
2314
2316 }
2317 else if ( part_id >= 63 && part_id <= 93 )
2318 {
2319 offset = ( part_id % 63 );
2320 mask = 1 << offset;
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 return true;
2369 }
2370 }
2371 else if ( part_id >= 32 && part_id <= 62 )
2372 {
2373 offset = ( part_id % 32 );
2374 mask = 1 << offset;
2375
2377 {
2378 return true;
2379 }
2380 }
2381 else if ( part_id >= 63 && part_id <= 93 )
2382 {
2383 offset = ( part_id % 63 );
2384 mask = 1 << offset;
2385
2387 {
2388 return true;
2389 }
2390 }
2391
2392 return false;
2393 }
2394
2396 {
2399 }
2400
2402 {
2403
2406 }
2407
2409 {
2411 {
2414
2415 switch( build_action_id )
2416 {
2420 }
2421 }
2422 }
2423
2424
2426 {
2428 bool is_base = part.
IsBase();
2431 if ( is_part_built_sync )
2432 {
2434 {
2438
2439 if (is_base)
2440 {
2443 }
2444 }
2445 }
2446 else
2447 {
2449 {
2453
2454 if (is_base)
2455 {
2458 }
2459 }
2460 }
2461
2462
2464 }
2465
2466
2468 {
2471
2472 for ( int i = 0; i < construction_parts.Count(); ++i )
2473 {
2474 string key = construction_parts.GetKey( i );
2477 }
2478
2479
2481 }
2482
2484 {
2487
2488 for ( int i = 0; i < construction_parts.Count(); ++i )
2489 {
2490 string key = construction_parts.GetKey( i );
2492
2493 if ( value.
GetId() ==
id )
2494 {
2495 return value;
2496 }
2497 }
2498
2499 return NULL;
2500 }
2501
2502
2503
2505 {
2507 }
2508
2510 {
2512 }
2513
2515 {
2516 return true;
2517 }
2518
2520 {
2521 return false;
2522 }
2523
2524
2526 {
2529 {
2531 }
2532
2533 return construction_kit;
2534 }
2535
2537 {
2540 {
2542 }
2543 }
2544
2546 {
2548 }
2549
2551 {
2552 return "";
2553 }
2554
2556 {
2559 }
2560
2561
2563 {
2566 }
2567
2568
2570 {
2571 super.OnStoreSave( ctx );
2572
2573
2577
2579 }
2580
2582 {
2583 if ( !super.OnStoreLoad( ctx, version ) )
2584 return false;
2585
2586
2587
2589 {
2591 return false;
2592 }
2594 {
2596 return false;
2597 }
2599 {
2601 return false;
2602 }
2603
2604
2606 {
2608 return false;
2609 }
2610
2611
2612 return true;
2613 }
2614
2616 {
2617 super.AfterStoreLoad();
2618
2620 {
2622 }
2623 }
2624
2626 {
2627
2629
2630
2633
2634
2636 }
2637
2639 {
2640 super.OnCreatePhysics();
2643 }
2644
2646 {
2648 return;
2649
2650 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2651
2653 return;
2654
2656 string part_name = zone;
2658
2660 {
2661 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2662
2663 if ( construction_part && construction.IsPartConstructed( part_name ) )
2664 {
2666 construction.DestroyConnectedParts(part_name);
2667 }
2668
2669
2670 if ( part_name.
Contains(
"barbed") )
2671 {
2672 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2673 if (barbed_wire)
2674 barbed_wire.SetMountedState( false );
2675 }
2676 }
2677 }
2678
2680 {
2682 {
2684 }
2685
2686 super.EEOnAfterLoad();
2687 }
2688
2690 {
2691 super.EEInit();
2692
2693
2695
2696
2697 #ifdef DEVELOPER
2699 #endif
2700 }
2701
2703 {
2704 super.EEItemAttached( item, slot_name );
2705
2709 }
2710
2712 {
2713 super.EEItemDetached( item, slot_name );
2714
2717 }
2718
2719 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2720 {
2723
2726 }
2727
2728
2730 {
2731 return true;
2732 }
2733
2734
2735
2737 {
2739
2740
2741 if (construtionPart.
IsBase())
2742 {
2744
2745
2747 }
2748
2749
2751
2752
2754
2755
2757
2759
2761
2762
2764
2765
2767 }
2768
2770 {
2771
2773 }
2774
2775
2777 {
2780
2781
2783
2784
2786
2787
2789
2790
2792
2794
2795
2797
2798
2800
2801
2802 if (construtionPart.
IsBase())
2803 {
2804
2806 }
2807
2810 }
2811
2813 {
2814
2816 }
2817
2818
2819 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2820 {
2823
2824
2826
2827
2829
2830
2832
2833
2835
2837
2838
2840
2841
2843
2844
2845 if (construtionPart.
IsBase())
2846 {
2847
2849 }
2850
2853 }
2854
2856 {
2857
2859 }
2860
2862 {
2863 bool process = false;
2864
2865
2869
2870 if (process)
2871 {
2872 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2873 {
2875 return;
2876 }
2877
2879 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2880 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2881
2882
2884 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2885 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2886 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2887 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2888 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2889 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2890 mins = minTmp;
2891 maxs = maxTmp;
2892
2893 maxs[1] = maxs[1] + 0.35;
2894
2896 }
2897 }
2898
2900 {
2903
2904
2906 foreach (
EntityAI entity : foundEntities)
2907 {
2910 }
2911 }
2912
2913
2915 {
2917
2921 }
2922
2924 {
2926
2928 {
2930 }
2931 else
2932 {
2934 }
2935
2937 }
2938
2940 {
2942
2944 foreach (
string slotName : attachmentSlots)
2945 {
2947 }
2948
2949
2952 else
2954
2956 }
2957
2959 {
2960 string slotNameMounted = slot_name + "_Mounted";
2961 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2962
2963 if (attachment)
2964 {
2965 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2966 if (barbedWire && barbedWire.IsMounted())
2968 else
2970
2971 if (is_locked)
2972 {
2973 SetAnimationPhase(slotNameMounted, 0);
2974 SetAnimationPhase(slot_name, 1);
2975 }
2976 else
2977 {
2978 SetAnimationPhase(slotNameMounted, 1);
2979 SetAnimationPhase(slot_name, 0);
2980 }
2981 }
2982 else
2983 {
2984 SetAnimationPhase(slotNameMounted, 1);
2985 SetAnimationPhase(slot_name, 1);
2986
2988 }
2989 }
2990
2991
2993 {
2996
2999
3002
3003 foreach (
string slotName : attachmentSlots)
3004 {
3006 }
3007
3008
3010 {
3013
3015 }
3016 else
3017 {
3020
3022 }
3023
3026 }
3027
3029 {
3030
3032 return;
3033
3034 string slot_name_mounted = slot_name + "_Mounted";
3035 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3036
3037
3039 RemoveProxyPhysics( slot_name_mounted );
3040 RemoveProxyPhysics( slot_name );
3041
3042 if ( attachment )
3043 {
3045 if ( is_locked )
3046 {
3048 AddProxyPhysics( slot_name_mounted );
3049 }
3050 else
3051 {
3053 AddProxyPhysics( slot_name );
3054 }
3055 }
3056 }
3057
3059 {
3060 SetAffectPathgraph( true, false );
3062 }
3063
3065 {
3066 return true;
3067 }
3068
3070 {
3071 return true;
3072 }
3073
3075 {
3076 if ( attachment )
3077 {
3079 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3080
3081 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3082 }
3083
3084 return false;
3085 }
3086
3088 {
3090 }
3091
3092
3094 {
3095 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3096 if (
GetGame().ConfigIsExisting( config_path ) )
3097 {
3099 }
3100 }
3101
3103 {
3104 return true;
3105 }
3106
3108 {
3109 return true;
3110 }
3111
3113 {
3114 return true;
3115 }
3116
3117
3119 {
3121 {
3123 }
3124
3126 }
3127
3129 {
3131 }
3132
3133
3134
3136 {
3137 return super.CanReceiveAttachment(attachment, slotId);
3138 }
3139
3141 {
3142 int attachment_count = GetInventory().AttachmentCount();
3143 if ( attachment_count > 0 )
3144 {
3145 if (
HasBase() && attachment_count == 1 )
3146 {
3147 return false;
3148 }
3149
3150 return true;
3151 }
3152
3153 return false;
3154 }
3155
3157 {
3158 return true;
3159 }
3160
3162 {
3163 return false;
3164 }
3165
3166
3168 {
3169 return false;
3170 }
3171
3173 {
3174 return false;
3175 }
3176
3177
3179 {
3180 return false;
3181 }
3182
3183
3184
3186 {
3187 return true;
3188 }
3189
3191 {
3192 return true;
3193 }
3194
3197 {
3198 return false;
3199 }
3200
3201
3203 {
3204 return true;
3205 }
3206
3207
3209 {
3210 return false;
3211 }
3212
3213
3215 {
3216 return true;
3217 }
3218
3219
3221 {
3222 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3223 {
3224 return false;
3225 }
3226
3227 return true;
3228 }
3229
3231 {
3234
3235 return item;
3236 }
3237
3238
3240 {
3242 {
3243
3245
3246
3249
3251 if ( MemoryPointExists( slot_name + "_min" ) )
3252 {
3253 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3254 }
3255 if ( MemoryPointExists( slot_name + "_max" ) )
3256 {
3257 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3258 }
3259
3260
3263
3264
3267 center = ModelToWorld( center );
3268
3269
3272
3273 areaDamage.SetExtents( extents[0], extents[1] );
3274 areaDamage.SetAreaPosition( center );
3275 areaDamage.SetAreaOrientation( orientation );
3278 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3279 areaDamage.SetAmmoName( "BarbedWireHit" );
3280 areaDamage.Spawn();
3281
3283 }
3284 }
3285
3287 {
3288 if ( angle_deg != 0 )
3289 {
3290
3291 orientation[0] = orientation[0] - angle_deg;
3292
3293
3295 if ( MemoryPointExists( "rotate_axis" ) )
3296 {
3297 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3298 }
3299 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];
3300 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];
3301 center[0] = r_center_x;
3302 center[2] = r_center_z;
3303 }
3304 }
3305
3307 {
3309 {
3312 {
3313 if (areaDamage)
3314 {
3315 areaDamage.Destroy();
3316 }
3317
3319 }
3320 }
3321 }
3322
3324 {
3325 return true;
3326 }
3327
3328
3329
3330
3332 {
3334 }
3335
3337 {
3339 }
3340
3342 {
3344 }
3345
3347 {
3349
3350 switch ( material_type )
3351 {
3357 }
3358
3359 return "";
3360 }
3361
3363 {
3365
3366 switch ( material_type )
3367 {
3373 }
3374
3375 return "";
3376 }
3377
3378
3380 {
3382 {
3383
3385 {
3386 SetHealth(slot_name,"Health",item.GetHealth());
3387 }
3388 }
3389 }
3390
3392 {
3393 return 111;
3394 }
3395
3397 {
3398 super.SetActions();
3399
3403 }
3404
3405
3406
3407
3409 {
3410 }
3411
3414 {
3415 return null;
3416 }
3417
3419 {
3421 }
3422
3424 {
3427
3428 Man p;
3429
3430 #ifdef SERVER
3433 if (players.Count())
3434 p = players[0];
3435 #else
3437 #endif
3438
3440 {
3441 bool excluded = false;
3443 if (excludes)
3444 {
3445 foreach (string exclude : excludes)
3446 {
3448 {
3449 excluded = true;
3450 break;
3451 }
3452 }
3453 }
3454
3455 if (!excluded)
3456 {
3458 }
3459 }
3460
3462 }
3463}
3464
3466{
3467#ifdef BSB_DEBUG
3469#else
3470
3471#endif
3472}
3474{
3475#ifdef BSB_DEBUG_SPAM
3477#else
3478
3479#endif
3480}
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.