2110{
2112
2114
2116
2118
2124
2125
2126
2132
2138
2140
2144
2145
2147 {
2149
2150
2151 RegisterNetSyncVariableInt( "m_SyncParts01" );
2152 RegisterNetSyncVariableInt( "m_SyncParts02" );
2153 RegisterNetSyncVariableInt( "m_SyncParts03" );
2154 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2155 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2156 RegisterNetSyncVariableBool( "m_HasBase" );
2157
2158
2160
2161 if (ConfigIsExisting("hybridAttachments"))
2162 {
2165 }
2166 if (ConfigIsExisting("mountables"))
2167 {
2170 }
2171
2173 }
2174
2176 {
2177 super.EEDelete(parent);
2178
2180 {
2181 areaDamage.Destroy();
2182 }
2183
2184 }
2185
2187 {
2188 return "disableBaseDamage";
2189 }
2190
2192 {
2193 return true;
2194 }
2195
2197 {
2198 return EInventoryIconVisibility.HIDE_VICINITY;
2199 }
2200
2201
2203 {
2205 {
2206 SetSynchDirty();
2207 }
2208 }
2209
2211 {
2213 super.OnVariablesSynchronized();
2214
2216 }
2217
2219 {
2220
2222
2223
2225
2226
2228 }
2229
2230
2232 {
2233
2234 int offset;
2235 int mask;
2236
2237 if ( part_id >= 1 && part_id <= 31 )
2238 {
2239 offset = part_id - 1;
2240 mask = 1 << offset;
2241
2243 }
2244 else if ( part_id >= 32 && part_id <= 62 )
2245 {
2246 offset = ( part_id % 32 );
2247 mask = 1 << offset;
2248
2250 }
2251 else if ( part_id >= 63 && part_id <= 93 )
2252 {
2253 offset = ( part_id % 63 );
2254 mask = 1 << offset;
2255
2257 }
2258 }
2259
2261 {
2262
2263 int offset;
2264 int mask;
2265
2266 if ( part_id >= 1 && part_id <= 31 )
2267 {
2268 offset = part_id - 1;
2269 mask = 1 << offset;
2270
2272 }
2273 else if ( part_id >= 32 && part_id <= 62 )
2274 {
2275 offset = ( part_id % 32 );
2276 mask = 1 << offset;
2277
2279 }
2280 else if ( part_id >= 63 && part_id <= 93 )
2281 {
2282 offset = ( part_id % 63 );
2283 mask = 1 << offset;
2284
2286 }
2287 }
2288
2290 {
2291
2292 int offset;
2293 int mask;
2294
2295 if ( part_id >= 1 && part_id <= 31 )
2296 {
2297 offset = part_id - 1;
2298 mask = 1 << offset;
2299
2301 {
2302 return true;
2303 }
2304 }
2305 else if ( part_id >= 32 && part_id <= 62 )
2306 {
2307 offset = ( part_id % 32 );
2308 mask = 1 << offset;
2309
2311 {
2312 return true;
2313 }
2314 }
2315 else if ( part_id >= 63 && part_id <= 93 )
2316 {
2317 offset = ( part_id % 63 );
2318 mask = 1 << offset;
2319
2321 {
2322 return true;
2323 }
2324 }
2325
2326 return false;
2327 }
2328
2330 {
2333 }
2334
2336 {
2337
2340 }
2341
2343 {
2345 {
2348
2349 switch( build_action_id )
2350 {
2354 }
2355 }
2356 }
2357
2358
2360 {
2362 bool is_base = part.
IsBase();
2365 if ( is_part_built_sync )
2366 {
2368 {
2372
2373 if (is_base)
2374 {
2377 }
2378 }
2379 }
2380 else
2381 {
2383 {
2387
2388 if (is_base)
2389 {
2392 }
2393 }
2394 }
2395
2396
2398 }
2399
2400
2402 {
2405
2406 for ( int i = 0; i < construction_parts.Count(); ++i )
2407 {
2408 string key = construction_parts.GetKey( i );
2411 }
2412
2413
2415 }
2416
2418 {
2421
2422 for ( int i = 0; i < construction_parts.Count(); ++i )
2423 {
2424 string key = construction_parts.GetKey( i );
2426
2427 if ( value.
GetId() ==
id )
2428 {
2429 return value;
2430 }
2431 }
2432
2433 return NULL;
2434 }
2435
2436
2437
2439 {
2441 }
2442
2444 {
2446 }
2447
2449 {
2450 return true;
2451 }
2452
2454 {
2455 return false;
2456 }
2457
2458
2460 {
2463 {
2465 }
2466
2467 return construction_kit;
2468 }
2469
2471 {
2474 {
2476 }
2477 }
2478
2480 {
2482 }
2483
2485 {
2486 return "";
2487 }
2488
2490 {
2493 }
2494
2495
2497 {
2500 }
2501
2502
2504 {
2505 super.OnStoreSave( ctx );
2506
2507
2511
2513 }
2514
2516 {
2517 if ( !super.OnStoreLoad( ctx, version ) )
2518 return false;
2519
2520
2521
2523 {
2525 return false;
2526 }
2528 {
2530 return false;
2531 }
2533 {
2535 return false;
2536 }
2537
2538
2540 {
2542 return false;
2543 }
2544
2545
2546 return true;
2547 }
2548
2550 {
2551 super.AfterStoreLoad();
2552
2554 {
2556 }
2557 }
2558
2560 {
2561
2563
2564
2567
2568
2570 }
2571
2573 {
2574 super.OnCreatePhysics();
2577 }
2578
2580 {
2582 return;
2583
2584 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2585
2587 return;
2588
2590 string part_name = zone;
2592
2594 {
2595 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2596
2597 if ( construction_part && construction.IsPartConstructed( part_name ) )
2598 {
2600 construction.DestroyConnectedParts(part_name);
2601 }
2602
2603
2604 if ( part_name.
Contains(
"barbed") )
2605 {
2606 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2607 if (barbed_wire)
2608 barbed_wire.SetMountedState( false );
2609 }
2610 }
2611 }
2612
2614 {
2616 {
2618 }
2619
2620 super.EEOnAfterLoad();
2621 }
2622
2624 {
2625 super.EEInit();
2626
2627
2629
2630
2631 #ifdef DEVELOPER
2633 #endif
2634 }
2635
2637 {
2638 super.EEItemAttached( item, slot_name );
2639
2643 }
2644
2646 {
2647 super.EEItemDetached( item, slot_name );
2648
2651 }
2652
2653 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2654 {
2657
2660 }
2661
2662
2664 {
2665 return true;
2666 }
2667
2668
2669
2671 {
2673
2674
2675 if (construtionPart.
IsBase())
2676 {
2678
2679
2681 }
2682
2683
2685
2686
2688
2689
2691
2693
2695
2696
2698
2699
2701 }
2702
2704 {
2705
2707 }
2708
2709
2711 {
2714
2715
2717
2718
2720
2721
2723
2724
2726
2728
2729
2731
2732
2734
2735
2736 if (construtionPart.
IsBase())
2737 {
2738
2740 }
2741
2744 }
2745
2747 {
2748
2750 }
2751
2752
2753 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2754 {
2757
2758
2760
2761
2763
2764
2766
2767
2769
2771
2772
2774
2775
2777
2778
2779 if (construtionPart.
IsBase())
2780 {
2781
2783 }
2784
2787 }
2788
2790 {
2791
2793 }
2794
2796 {
2797 bool process = false;
2798
2799
2803
2804 if (process)
2805 {
2806 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2807 {
2809 return;
2810 }
2811
2813 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2814 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2815
2816
2818 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2819 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2820 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2821 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2822 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2823 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2824 mins = minTmp;
2825 maxs = maxTmp;
2826
2827 maxs[1] = maxs[1] + 0.35;
2828
2830 }
2831 }
2832
2834 {
2837
2838
2840 foreach (
EntityAI entity : foundEntities)
2841 {
2844 }
2845 }
2846
2847
2849 {
2851
2855 }
2856
2858 {
2860
2862 {
2864 }
2865 else
2866 {
2868 }
2869
2871 }
2872
2874 {
2876
2878 foreach (
string slotName : attachmentSlots)
2879 {
2881 }
2882
2883
2886 else
2888
2890 }
2891
2893 {
2894 string slotNameMounted = slot_name + "_Mounted";
2895 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2896
2897 if (attachment)
2898 {
2899 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2900 if (barbedWire && barbedWire.IsMounted())
2902 else
2904
2905 if (is_locked)
2906 {
2907 SetAnimationPhase(slotNameMounted, 0);
2908 SetAnimationPhase(slot_name, 1);
2909 }
2910 else
2911 {
2912 SetAnimationPhase(slotNameMounted, 1);
2913 SetAnimationPhase(slot_name, 0);
2914 }
2915 }
2916 else
2917 {
2918 SetAnimationPhase(slotNameMounted, 1);
2919 SetAnimationPhase(slot_name, 1);
2920
2922 }
2923 }
2924
2925
2927 {
2930
2933
2936
2937 foreach (
string slotName : attachmentSlots)
2938 {
2940 }
2941
2942
2944 {
2947
2949 }
2950 else
2951 {
2954
2956 }
2957
2960 }
2961
2963 {
2964
2966 return;
2967
2968 string slot_name_mounted = slot_name + "_Mounted";
2969 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2970
2971
2973 RemoveProxyPhysics( slot_name_mounted );
2974 RemoveProxyPhysics( slot_name );
2975
2976 if ( attachment )
2977 {
2979 if ( is_locked )
2980 {
2982 AddProxyPhysics( slot_name_mounted );
2983 }
2984 else
2985 {
2987 AddProxyPhysics( slot_name );
2988 }
2989 }
2990 }
2991
2993 {
2994 SetAffectPathgraph( true, false );
2996 }
2997
2999 {
3000 return true;
3001 }
3002
3004 {
3005 return true;
3006 }
3007
3009 {
3010 if ( attachment )
3011 {
3013 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3014
3015 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3016 }
3017
3018 return false;
3019 }
3020
3022 {
3024 }
3025
3026
3028 {
3029 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3030 if (
GetGame().ConfigIsExisting( config_path ) )
3031 {
3033 }
3034 }
3035
3037 {
3038 return true;
3039 }
3040
3042 {
3043 return true;
3044 }
3045
3047 {
3048 return true;
3049 }
3050
3051
3053 {
3055 {
3057 }
3058
3060 }
3061
3063 {
3065 }
3066
3067
3068
3070 {
3071 return super.CanReceiveAttachment(attachment, slotId);
3072 }
3073
3075 {
3076 int attachment_count = GetInventory().AttachmentCount();
3077 if ( attachment_count > 0 )
3078 {
3079 if (
HasBase() && attachment_count == 1 )
3080 {
3081 return false;
3082 }
3083
3084 return true;
3085 }
3086
3087 return false;
3088 }
3089
3091 {
3092 return true;
3093 }
3094
3096 {
3097 return false;
3098 }
3099
3100
3102 {
3103 return false;
3104 }
3105
3107 {
3108 return false;
3109 }
3110
3111
3113 {
3114 return false;
3115 }
3116
3117
3118
3120 {
3121 return true;
3122 }
3123
3125 {
3126 return true;
3127 }
3128
3131 {
3132 return false;
3133 }
3134
3135
3137 {
3138 return true;
3139 }
3140
3141
3143 {
3144 return false;
3145 }
3146
3147
3149 {
3150 return true;
3151 }
3152
3153
3155 {
3156 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3157 {
3158 return false;
3159 }
3160
3161 return true;
3162 }
3163
3165 {
3168
3169 return item;
3170 }
3171
3172
3174 {
3176 {
3177
3179
3180
3183
3185 if ( MemoryPointExists( slot_name + "_min" ) )
3186 {
3187 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3188 }
3189 if ( MemoryPointExists( slot_name + "_max" ) )
3190 {
3191 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3192 }
3193
3194
3197
3198
3201 center = ModelToWorld( center );
3202
3203
3206
3207 areaDamage.SetExtents( extents[0], extents[1] );
3208 areaDamage.SetAreaPosition( center );
3209 areaDamage.SetAreaOrientation( orientation );
3212 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3213 areaDamage.SetAmmoName( "BarbedWireHit" );
3214 areaDamage.Spawn();
3215
3217 }
3218 }
3219
3221 {
3222 if ( angle_deg != 0 )
3223 {
3224
3225 orientation[0] = orientation[0] - angle_deg;
3226
3227
3229 if ( MemoryPointExists( "rotate_axis" ) )
3230 {
3231 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3232 }
3233 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];
3234 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];
3235 center[0] = r_center_x;
3236 center[2] = r_center_z;
3237 }
3238 }
3239
3241 {
3243 {
3246 {
3247 if (areaDamage)
3248 {
3249 areaDamage.Destroy();
3250 }
3251
3253 }
3254 }
3255 }
3256
3258 {
3259 return true;
3260 }
3261
3262
3263
3264
3266 {
3268 }
3269
3271 {
3273 }
3274
3276 {
3278 }
3279
3281 {
3283
3284 switch ( material_type )
3285 {
3291 }
3292
3293 return "";
3294 }
3295
3297 {
3299
3300 switch ( material_type )
3301 {
3307 }
3308
3309 return "";
3310 }
3311
3312
3314 {
3316 {
3317
3319 {
3320 SetHealth(slot_name,"Health",item.GetHealth());
3321 }
3322 }
3323 }
3324
3326 {
3327 return 111;
3328 }
3329
3331 {
3332 super.SetActions();
3333
3337 }
3338
3339
3340
3341
3343 {
3344 }
3345
3348 {
3349 return null;
3350 }
3351
3353 {
3355 }
3356
3358 {
3361
3362 Man p;
3363
3364 #ifdef SERVER
3367 if (players.Count())
3368 p = players[0];
3369 #else
3371 #endif
3372
3374 {
3375 bool excluded = false;
3377 if (excludes)
3378 {
3379 foreach (string exclude : excludes)
3380 {
3382 {
3383 excluded = true;
3384 break;
3385 }
3386 }
3387 }
3388
3389 if (!excluded)
3390 {
3392 }
3393 }
3394
3396 }
3397}
3398
3400{
3401#ifdef BSB_DEBUG
3403#else
3404
3405#endif
3406}
3408{
3409#ifdef BSB_DEBUG_SPAM
3411#else
3412
3413#endif
3414}
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.