2032{
2034
2036
2038
2040
2046
2047
2048
2054
2060
2062
2066
2067
2069 {
2071
2072
2073 RegisterNetSyncVariableInt( "m_SyncParts01" );
2074 RegisterNetSyncVariableInt( "m_SyncParts02" );
2075 RegisterNetSyncVariableInt( "m_SyncParts03" );
2076 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2077 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2078 RegisterNetSyncVariableBool( "m_HasBase" );
2079
2080
2082
2083 if (ConfigIsExisting("hybridAttachments"))
2084 {
2087 }
2088 if (ConfigIsExisting("mountables"))
2089 {
2092 }
2093
2095 }
2096
2098 {
2099 super.EEDelete(parent);
2100
2102 {
2103 areaDamage.Destroy();
2104 }
2105
2106 }
2107
2109 {
2110 return "disableBaseDamage";
2111 }
2112
2114 {
2115 return true;
2116 }
2117
2119 {
2120 return EInventoryIconVisibility.HIDE_VICINITY;
2121 }
2122
2123
2125 {
2127 {
2128 SetSynchDirty();
2129 }
2130 }
2131
2133 {
2135 super.OnVariablesSynchronized();
2136
2138 }
2139
2141 {
2142
2144
2145
2147
2148
2150 }
2151
2152
2154 {
2155
2156 int offset;
2157 int mask;
2158
2159 if ( part_id >= 1 && part_id <= 31 )
2160 {
2161 offset = part_id - 1;
2162 mask = 1 << offset;
2163
2165 }
2166 else if ( part_id >= 32 && part_id <= 62 )
2167 {
2168 offset = ( part_id % 32 );
2169 mask = 1 << offset;
2170
2172 }
2173 else if ( part_id >= 63 && part_id <= 93 )
2174 {
2175 offset = ( part_id % 63 );
2176 mask = 1 << offset;
2177
2179 }
2180 }
2181
2183 {
2184
2185 int offset;
2186 int mask;
2187
2188 if ( part_id >= 1 && part_id <= 31 )
2189 {
2190 offset = part_id - 1;
2191 mask = 1 << offset;
2192
2194 }
2195 else if ( part_id >= 32 && part_id <= 62 )
2196 {
2197 offset = ( part_id % 32 );
2198 mask = 1 << offset;
2199
2201 }
2202 else if ( part_id >= 63 && part_id <= 93 )
2203 {
2204 offset = ( part_id % 63 );
2205 mask = 1 << offset;
2206
2208 }
2209 }
2210
2212 {
2213
2214 int offset;
2215 int mask;
2216
2217 if ( part_id >= 1 && part_id <= 31 )
2218 {
2219 offset = part_id - 1;
2220 mask = 1 << offset;
2221
2223 {
2224 return true;
2225 }
2226 }
2227 else if ( part_id >= 32 && part_id <= 62 )
2228 {
2229 offset = ( part_id % 32 );
2230 mask = 1 << offset;
2231
2233 {
2234 return true;
2235 }
2236 }
2237 else if ( part_id >= 63 && part_id <= 93 )
2238 {
2239 offset = ( part_id % 63 );
2240 mask = 1 << offset;
2241
2243 {
2244 return true;
2245 }
2246 }
2247
2248 return false;
2249 }
2250
2252 {
2255 }
2256
2258 {
2259
2262 }
2263
2265 {
2267 {
2270
2271 switch( build_action_id )
2272 {
2276 }
2277 }
2278 }
2279
2280
2282 {
2284 bool is_base = part.
IsBase();
2287 if ( is_part_built_sync )
2288 {
2290 {
2294
2295 if (is_base)
2296 {
2299 }
2300 }
2301 }
2302 else
2303 {
2305 {
2309
2310 if (is_base)
2311 {
2314 }
2315 }
2316 }
2317
2318
2320 }
2321
2322
2324 {
2327
2328 for ( int i = 0; i < construction_parts.Count(); ++i )
2329 {
2330 string key = construction_parts.GetKey( i );
2333 }
2334
2335
2337 }
2338
2340 {
2343
2344 for ( int i = 0; i < construction_parts.Count(); ++i )
2345 {
2346 string key = construction_parts.GetKey( i );
2348
2349 if ( value.
GetId() ==
id )
2350 {
2351 return value;
2352 }
2353 }
2354
2355 return NULL;
2356 }
2357
2358
2359
2361 {
2363 }
2364
2366 {
2368 }
2369
2371 {
2372 return true;
2373 }
2374
2376 {
2377 return false;
2378 }
2379
2380
2382 {
2385 {
2387 }
2388
2389 return construction_kit;
2390 }
2391
2393 {
2396 {
2398 }
2399 }
2400
2402 {
2404 }
2405
2407 {
2408 return "";
2409 }
2410
2412 {
2415 }
2416
2417
2419 {
2422 }
2423
2424
2426 {
2427 super.OnStoreSave( ctx );
2428
2429
2433
2435 }
2436
2438 {
2439 if ( !super.OnStoreLoad( ctx, version ) )
2440 return false;
2441
2442
2443
2445 {
2447 return false;
2448 }
2450 {
2452 return false;
2453 }
2455 {
2457 return false;
2458 }
2459
2460
2462 {
2464 return false;
2465 }
2466
2467
2468 return true;
2469 }
2470
2472 {
2473 super.AfterStoreLoad();
2474
2476 {
2478 }
2479 }
2480
2482 {
2483
2485
2486
2489
2490
2492 }
2493
2495 {
2496 super.OnCreatePhysics();
2499 }
2500
2502 {
2504 return;
2505
2506 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2507
2509 return;
2510
2512 string part_name = zone;
2514
2516 {
2517 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2518
2519 if ( construction_part && construction.IsPartConstructed( part_name ) )
2520 {
2522 construction.DestroyConnectedParts(part_name);
2523 }
2524
2525
2526 if ( part_name.
Contains(
"barbed") )
2527 {
2528 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2529 if (barbed_wire)
2530 barbed_wire.SetMountedState( false );
2531 }
2532 }
2533 }
2534
2536 {
2538 {
2540 }
2541
2542 super.EEOnAfterLoad();
2543 }
2544
2546 {
2547 super.EEInit();
2548
2549
2551
2552
2553 #ifdef DEVELOPER
2555 #endif
2556 }
2557
2559 {
2560 super.EEItemAttached( item, slot_name );
2561
2565 }
2566
2568 {
2569 super.EEItemDetached( item, slot_name );
2570
2573 }
2574
2575 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2576 {
2579
2582 }
2583
2584
2586 {
2587 return true;
2588 }
2589
2590
2591
2593 {
2595
2596
2597 if (construtionPart.
IsBase())
2598 {
2600
2601
2603 }
2604
2605
2607
2608
2610
2611
2613
2615
2617
2618
2620
2621
2623 }
2624
2626 {
2627
2629 }
2630
2631
2633 {
2636
2637
2639
2640
2642
2643
2645
2646
2648
2650
2651
2653
2654
2656
2657
2658 if (construtionPart.
IsBase())
2659 {
2660
2662 }
2663
2666 }
2667
2669 {
2670
2672 }
2673
2674
2675 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2676 {
2679
2680
2682
2683
2685
2686
2688
2689
2691
2693
2694
2696
2697
2699
2700
2701 if (construtionPart.
IsBase())
2702 {
2703
2705 }
2706
2709 }
2710
2712 {
2713
2715 }
2716
2718 {
2719 bool process = false;
2720
2721
2725
2726 if (process)
2727 {
2728 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2729 {
2731 return;
2732 }
2733
2735 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2736 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2737
2738
2740 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2741 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2742 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2743 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2744 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2745 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2746 mins = minTmp;
2747 maxs = maxTmp;
2748
2749 maxs[1] = maxs[1] + 0.35;
2750
2752 }
2753 }
2754
2756 {
2759
2760
2762 foreach (
EntityAI entity : foundEntities)
2763 {
2766 }
2767 }
2768
2769
2771 {
2773
2777 }
2778
2780 {
2782
2784 {
2786 }
2787 else
2788 {
2790 }
2791
2793 }
2794
2796 {
2798
2800 foreach (
string slotName : attachmentSlots)
2801 {
2803 }
2804
2805
2808 else
2810
2812 }
2813
2815 {
2816 string slotNameMounted = slot_name + "_Mounted";
2817 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2818
2819 if (attachment)
2820 {
2821 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2822 if (barbedWire && barbedWire.IsMounted())
2824 else
2826
2827 if (is_locked)
2828 {
2829 SetAnimationPhase(slotNameMounted, 0);
2830 SetAnimationPhase(slot_name, 1);
2831 }
2832 else
2833 {
2834 SetAnimationPhase(slotNameMounted, 1);
2835 SetAnimationPhase(slot_name, 0);
2836 }
2837 }
2838 else
2839 {
2840 SetAnimationPhase(slotNameMounted, 1);
2841 SetAnimationPhase(slot_name, 1);
2842
2844 }
2845 }
2846
2847
2849 {
2852
2855
2858
2859 foreach (
string slotName : attachmentSlots)
2860 {
2862 }
2863
2864
2866 {
2869
2871 }
2872 else
2873 {
2876
2878 }
2879
2882 }
2883
2885 {
2886
2888 return;
2889
2890 string slot_name_mounted = slot_name + "_Mounted";
2891 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2892
2893
2895 RemoveProxyPhysics( slot_name_mounted );
2896 RemoveProxyPhysics( slot_name );
2897
2898 if ( attachment )
2899 {
2901 if ( is_locked )
2902 {
2904 AddProxyPhysics( slot_name_mounted );
2905 }
2906 else
2907 {
2909 AddProxyPhysics( slot_name );
2910 }
2911 }
2912 }
2913
2915 {
2916 SetAffectPathgraph( true, false );
2918 }
2919
2921 {
2922 return true;
2923 }
2924
2926 {
2927 return true;
2928 }
2929
2931 {
2932 if ( attachment )
2933 {
2935 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2936
2937 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2938 }
2939
2940 return false;
2941 }
2942
2944 {
2946 }
2947
2948
2950 {
2951 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2952 if (
GetGame().ConfigIsExisting( config_path ) )
2953 {
2955 }
2956 }
2957
2959 {
2960 return true;
2961 }
2962
2964 {
2965 return true;
2966 }
2967
2969 {
2970 return true;
2971 }
2972
2973
2975 {
2977 {
2979 }
2980
2982 }
2983
2985 {
2987 }
2988
2989
2990
2992 {
2993 return super.CanReceiveAttachment(attachment, slotId);
2994 }
2995
2997 {
2998 int attachment_count = GetInventory().AttachmentCount();
2999 if ( attachment_count > 0 )
3000 {
3001 if (
HasBase() && attachment_count == 1 )
3002 {
3003 return false;
3004 }
3005
3006 return true;
3007 }
3008
3009 return false;
3010 }
3011
3013 {
3014 return true;
3015 }
3016
3018 {
3019 return false;
3020 }
3021
3022
3024 {
3025 return false;
3026 }
3027
3029 {
3030 return false;
3031 }
3032
3033
3035 {
3036 return false;
3037 }
3038
3039
3040
3042 {
3043 return true;
3044 }
3045
3047 {
3048 return true;
3049 }
3050
3053 {
3054 return false;
3055 }
3056
3057
3059 {
3060 return true;
3061 }
3062
3063
3065 {
3066 return false;
3067 }
3068
3069
3071 {
3072 return true;
3073 }
3074
3075
3077 {
3078 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3079 {
3080 return false;
3081 }
3082
3083 return true;
3084 }
3085
3087 {
3090
3091 return item;
3092 }
3093
3094
3096 {
3098 {
3099
3101
3102
3105
3107 if ( MemoryPointExists( slot_name + "_min" ) )
3108 {
3109 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3110 }
3111 if ( MemoryPointExists( slot_name + "_max" ) )
3112 {
3113 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3114 }
3115
3116
3119
3120
3123 center = ModelToWorld( center );
3124
3125
3128
3129 areaDamage.SetExtents( extents[0], extents[1] );
3130 areaDamage.SetAreaPosition( center );
3131 areaDamage.SetAreaOrientation( orientation );
3134 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3135 areaDamage.SetAmmoName( "BarbedWireHit" );
3136 areaDamage.Spawn();
3137
3139 }
3140 }
3141
3143 {
3144 if ( angle_deg != 0 )
3145 {
3146
3147 orientation[0] = orientation[0] - angle_deg;
3148
3149
3151 if ( MemoryPointExists( "rotate_axis" ) )
3152 {
3153 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3154 }
3155 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];
3156 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];
3157 center[0] = r_center_x;
3158 center[2] = r_center_z;
3159 }
3160 }
3161
3163 {
3165 {
3168 {
3169 if (areaDamage)
3170 {
3171 areaDamage.Destroy();
3172 }
3173
3175 }
3176 }
3177 }
3178
3180 {
3181 return true;
3182 }
3183
3184
3185
3186
3188 {
3190 }
3191
3193 {
3195 }
3196
3198 {
3200 }
3201
3203 {
3205
3206 switch ( material_type )
3207 {
3213 }
3214
3215 return "";
3216 }
3217
3219 {
3221
3222 switch ( material_type )
3223 {
3229 }
3230
3231 return "";
3232 }
3233
3234
3236 {
3238 {
3239
3241 {
3242 SetHealth(slot_name,"Health",item.GetHealth());
3243 }
3244 }
3245 }
3246
3248 {
3249 return 111;
3250 }
3251
3253 {
3254 super.SetActions();
3255
3259 }
3260
3261
3262
3263
3265 {
3266 }
3267
3270 {
3271 return null;
3272 }
3273
3275 {
3277 }
3278
3280 {
3283
3284 Man p;
3285
3286 #ifdef SERVER
3289 if (players.Count())
3290 p = players[0];
3291 #else
3293 #endif
3294
3296 {
3297 bool excluded = false;
3299 if (excludes)
3300 {
3301 foreach (string exclude : excludes)
3302 {
3304 {
3305 excluded = true;
3306 break;
3307 }
3308 }
3309 }
3310
3311 if (!excluded)
3312 {
3314 }
3315 }
3316
3318 }
3319}
3320
3322{
3323#ifdef BSB_DEBUG
3325#else
3326
3327#endif
3328}
3330{
3331#ifdef BSB_DEBUG_SPAM
3333#else
3334
3335#endif
3336}
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.