2017{
2019
2021
2023
2025
2031
2032
2033
2039
2045
2047
2051
2052
2054 {
2056
2057
2058 RegisterNetSyncVariableInt( "m_SyncParts01" );
2059 RegisterNetSyncVariableInt( "m_SyncParts02" );
2060 RegisterNetSyncVariableInt( "m_SyncParts03" );
2061 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2062 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2063 RegisterNetSyncVariableBool( "m_HasBase" );
2064
2065
2067
2068 if (ConfigIsExisting("hybridAttachments"))
2069 {
2072 }
2073 if (ConfigIsExisting("mountables"))
2074 {
2077 }
2078
2080 }
2081
2083 {
2084 super.EEDelete(parent);
2085
2087 {
2088 areaDamage.Destroy();
2089 }
2090
2091 }
2092
2094 {
2095 return "disableBaseDamage";
2096 }
2097
2099 {
2100 return true;
2101 }
2102
2104 {
2105 return EInventoryIconVisibility.HIDE_VICINITY;
2106 }
2107
2108
2110 {
2112 {
2113 SetSynchDirty();
2114 }
2115 }
2116
2118 {
2120 super.OnVariablesSynchronized();
2121
2123 }
2124
2126 {
2127
2129
2130
2132
2133
2135 }
2136
2137
2139 {
2140
2141 int offset;
2142 int mask;
2143
2144 if ( part_id >= 1 && part_id <= 31 )
2145 {
2146 offset = part_id - 1;
2147 mask = 1 << offset;
2148
2150 }
2151 else if ( part_id >= 32 && part_id <= 62 )
2152 {
2153 offset = ( part_id % 32 );
2154 mask = 1 << offset;
2155
2157 }
2158 else if ( part_id >= 63 && part_id <= 93 )
2159 {
2160 offset = ( part_id % 63 );
2161 mask = 1 << offset;
2162
2164 }
2165 }
2166
2168 {
2169
2170 int offset;
2171 int mask;
2172
2173 if ( part_id >= 1 && part_id <= 31 )
2174 {
2175 offset = part_id - 1;
2176 mask = 1 << offset;
2177
2179 }
2180 else if ( part_id >= 32 && part_id <= 62 )
2181 {
2182 offset = ( part_id % 32 );
2183 mask = 1 << offset;
2184
2186 }
2187 else if ( part_id >= 63 && part_id <= 93 )
2188 {
2189 offset = ( part_id % 63 );
2190 mask = 1 << offset;
2191
2193 }
2194 }
2195
2197 {
2198
2199 int offset;
2200 int mask;
2201
2202 if ( part_id >= 1 && part_id <= 31 )
2203 {
2204 offset = part_id - 1;
2205 mask = 1 << offset;
2206
2208 {
2209 return true;
2210 }
2211 }
2212 else if ( part_id >= 32 && part_id <= 62 )
2213 {
2214 offset = ( part_id % 32 );
2215 mask = 1 << offset;
2216
2218 {
2219 return true;
2220 }
2221 }
2222 else if ( part_id >= 63 && part_id <= 93 )
2223 {
2224 offset = ( part_id % 63 );
2225 mask = 1 << offset;
2226
2228 {
2229 return true;
2230 }
2231 }
2232
2233 return false;
2234 }
2235
2237 {
2240 }
2241
2243 {
2244
2247 }
2248
2250 {
2252 {
2255
2256 switch( build_action_id )
2257 {
2261 }
2262 }
2263 }
2264
2265
2267 {
2269 bool is_base = part.
IsBase();
2272 if ( is_part_built_sync )
2273 {
2275 {
2279
2280 if (is_base)
2281 {
2284 }
2285 }
2286 }
2287 else
2288 {
2290 {
2294
2295 if (is_base)
2296 {
2299 }
2300 }
2301 }
2302
2303
2305 }
2306
2307
2309 {
2312
2313 for ( int i = 0; i < construction_parts.Count(); ++i )
2314 {
2315 string key = construction_parts.GetKey( i );
2318 }
2319
2320
2322 }
2323
2325 {
2328
2329 for ( int i = 0; i < construction_parts.Count(); ++i )
2330 {
2331 string key = construction_parts.GetKey( i );
2333
2334 if ( value.
GetId() ==
id )
2335 {
2336 return value;
2337 }
2338 }
2339
2340 return NULL;
2341 }
2342
2343
2344
2346 {
2348 }
2349
2351 {
2353 }
2354
2356 {
2357 return true;
2358 }
2359
2361 {
2362 return false;
2363 }
2364
2365
2367 {
2370 {
2372 }
2373
2374 return construction_kit;
2375 }
2376
2378 {
2381 {
2383 }
2384 }
2385
2387 {
2389 }
2390
2392 {
2393 return "";
2394 }
2395
2397 {
2400 }
2401
2402
2404 {
2407 }
2408
2409
2411 {
2412 super.OnStoreSave( ctx );
2413
2414
2418
2420 }
2421
2423 {
2424 if ( !super.OnStoreLoad( ctx, version ) )
2425 return false;
2426
2427
2428
2430 {
2432 return false;
2433 }
2435 {
2437 return false;
2438 }
2440 {
2442 return false;
2443 }
2444
2445
2447 {
2449 return false;
2450 }
2451
2452
2453 return true;
2454 }
2455
2457 {
2458 super.AfterStoreLoad();
2459
2461 {
2463 }
2464 }
2465
2467 {
2468
2470
2471
2474
2475
2477 }
2478
2480 {
2481 super.OnCreatePhysics();
2484 }
2485
2487 {
2489 return;
2490
2491 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2492
2494 return;
2495
2497 string part_name = zone;
2499
2501 {
2502 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2503
2504 if ( construction_part && construction.IsPartConstructed( part_name ) )
2505 {
2507 construction.DestroyConnectedParts(part_name);
2508 }
2509
2510
2511 if ( part_name.
Contains(
"barbed") )
2512 {
2513 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2514 if (barbed_wire)
2515 barbed_wire.SetMountedState( false );
2516 }
2517 }
2518 }
2519
2521 {
2523 {
2525 }
2526
2527 super.EEOnAfterLoad();
2528 }
2529
2531 {
2532 super.EEInit();
2533
2534
2536
2537
2538 #ifdef DEVELOPER
2540 #endif
2541 }
2542
2544 {
2545 super.EEItemAttached( item, slot_name );
2546
2550 }
2551
2553 {
2554 super.EEItemDetached( item, slot_name );
2555
2558 }
2559
2560 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2561 {
2564
2567 }
2568
2569
2571 {
2572 return true;
2573 }
2574
2575
2576
2578 {
2580
2581
2582 if (construtionPart.
IsBase())
2583 {
2585
2586
2588 }
2589
2590
2592
2593
2595
2596
2598
2600
2602
2603
2605
2606
2608 }
2609
2611 {
2612
2614 }
2615
2616
2618 {
2621
2622
2624
2625
2627
2628
2630
2631
2633
2635
2636
2638
2639
2641
2642
2643 if (construtionPart.
IsBase())
2644 {
2645
2647 }
2648
2651 }
2652
2654 {
2655
2657 }
2658
2659
2660 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2661 {
2664
2665
2667
2668
2670
2671
2673
2674
2676
2678
2679
2681
2682
2684
2685
2686 if (construtionPart.
IsBase())
2687 {
2688
2690 }
2691
2694 }
2695
2697 {
2698
2700 }
2701
2703 {
2704 bool process = false;
2705
2706
2710
2711 if (process)
2712 {
2713 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2714 {
2716 return;
2717 }
2718
2720 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2721 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2722
2723
2725 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2726 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2727 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2728 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2729 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2730 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2731 mins = minTmp;
2732 maxs = maxTmp;
2733
2734 maxs[1] = maxs[1] + 0.35;
2735
2737 }
2738 }
2739
2741 {
2744
2745
2747 foreach (
EntityAI entity : foundEntities)
2748 {
2751 }
2752 }
2753
2754
2756 {
2758
2762 }
2763
2765 {
2767
2769 {
2771 }
2772 else
2773 {
2775 }
2776
2778 }
2779
2781 {
2783
2785 foreach (
string slotName : attachmentSlots)
2786 {
2788 }
2789
2790
2793 else
2795
2797 }
2798
2800 {
2801 string slotNameMounted = slot_name + "_Mounted";
2802 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2803
2804 if (attachment)
2805 {
2806 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2807 if (barbedWire && barbedWire.IsMounted())
2809 else
2811
2812 if (is_locked)
2813 {
2814 SetAnimationPhase(slotNameMounted, 0);
2815 SetAnimationPhase(slot_name, 1);
2816 }
2817 else
2818 {
2819 SetAnimationPhase(slotNameMounted, 1);
2820 SetAnimationPhase(slot_name, 0);
2821 }
2822 }
2823 else
2824 {
2825 SetAnimationPhase(slotNameMounted, 1);
2826 SetAnimationPhase(slot_name, 1);
2827
2829 }
2830 }
2831
2832
2834 {
2837
2840
2843
2844 foreach (
string slotName : attachmentSlots)
2845 {
2847 }
2848
2849
2851 {
2854
2856 }
2857 else
2858 {
2861
2863 }
2864
2867 }
2868
2870 {
2871
2873 return;
2874
2875 string slot_name_mounted = slot_name + "_Mounted";
2876 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2877
2878
2880 RemoveProxyPhysics( slot_name_mounted );
2881 RemoveProxyPhysics( slot_name );
2882
2883 if ( attachment )
2884 {
2886 if ( is_locked )
2887 {
2889 AddProxyPhysics( slot_name_mounted );
2890 }
2891 else
2892 {
2894 AddProxyPhysics( slot_name );
2895 }
2896 }
2897 }
2898
2900 {
2901 SetAffectPathgraph( true, false );
2903 }
2904
2906 {
2907 return true;
2908 }
2909
2911 {
2912 return true;
2913 }
2914
2916 {
2917 if ( attachment )
2918 {
2920 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2921
2922 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2923 }
2924
2925 return false;
2926 }
2927
2929 {
2931 }
2932
2933
2935 {
2936 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2937 if (
GetGame().ConfigIsExisting( config_path ) )
2938 {
2940 }
2941 }
2942
2944 {
2945 return true;
2946 }
2947
2949 {
2950 return true;
2951 }
2952
2954 {
2955 return true;
2956 }
2957
2958
2960 {
2962 {
2964 }
2965
2967 }
2968
2970 {
2972 }
2973
2974
2975
2977 {
2978 return super.CanReceiveAttachment(attachment, slotId);
2979 }
2980
2982 {
2983 int attachment_count = GetInventory().AttachmentCount();
2984 if ( attachment_count > 0 )
2985 {
2986 if (
HasBase() && attachment_count == 1 )
2987 {
2988 return false;
2989 }
2990
2991 return true;
2992 }
2993
2994 return false;
2995 }
2996
2998 {
2999 return true;
3000 }
3001
3003 {
3004 return false;
3005 }
3006
3007
3009 {
3010 return false;
3011 }
3012
3014 {
3015 return false;
3016 }
3017
3018
3020 {
3021 return false;
3022 }
3023
3024
3025
3027 {
3028 return true;
3029 }
3030
3032 {
3033 return true;
3034 }
3035
3038 {
3039 return false;
3040 }
3041
3042
3044 {
3045 return true;
3046 }
3047
3048
3050 {
3051 return false;
3052 }
3053
3054
3056 {
3057 return true;
3058 }
3059
3060
3062 {
3063 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3064 {
3065 return false;
3066 }
3067
3068 return true;
3069 }
3070
3072 {
3075
3076 return item;
3077 }
3078
3079
3081 {
3083 {
3084
3086
3087
3090
3092 if ( MemoryPointExists( slot_name + "_min" ) )
3093 {
3094 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3095 }
3096 if ( MemoryPointExists( slot_name + "_max" ) )
3097 {
3098 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3099 }
3100
3101
3104
3105
3108 center = ModelToWorld( center );
3109
3110
3113
3114 areaDamage.SetExtents( extents[0], extents[1] );
3115 areaDamage.SetAreaPosition( center );
3116 areaDamage.SetAreaOrientation( orientation );
3119 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3120 areaDamage.SetAmmoName( "BarbedWireHit" );
3121 areaDamage.Spawn();
3122
3124 }
3125 }
3126
3128 {
3129 if ( angle_deg != 0 )
3130 {
3131
3132 orientation[0] = orientation[0] - angle_deg;
3133
3134
3136 if ( MemoryPointExists( "rotate_axis" ) )
3137 {
3138 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3139 }
3140 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];
3141 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];
3142 center[0] = r_center_x;
3143 center[2] = r_center_z;
3144 }
3145 }
3146
3148 {
3150 {
3153 {
3154 if (areaDamage)
3155 {
3156 areaDamage.Destroy();
3157 }
3158
3160 }
3161 }
3162 }
3163
3165 {
3166 return true;
3167 }
3168
3169
3170
3171
3173 {
3175 }
3176
3178 {
3180 }
3181
3183 {
3185 }
3186
3188 {
3190
3191 switch ( material_type )
3192 {
3198 }
3199
3200 return "";
3201 }
3202
3204 {
3206
3207 switch ( material_type )
3208 {
3214 }
3215
3216 return "";
3217 }
3218
3219
3221 {
3223 {
3224
3226 {
3227 SetHealth(slot_name,"Health",item.GetHealth());
3228 }
3229 }
3230 }
3231
3233 {
3234 return 111;
3235 }
3236
3238 {
3239 super.SetActions();
3240
3244 }
3245
3246
3247
3248
3250 {
3251 }
3252
3255 {
3256 return null;
3257 }
3258
3260 {
3262 }
3263
3265 {
3268
3269 Man p;
3270
3271 #ifdef SERVER
3274 if (players.Count())
3275 p = players[0];
3276 #else
3278 #endif
3279
3281 {
3282 bool excluded = false;
3284 if (excludes)
3285 {
3286 foreach (string exclude : excludes)
3287 {
3289 {
3290 excluded = true;
3291 break;
3292 }
3293 }
3294 }
3295
3296 if (!excluded)
3297 {
3299 }
3300 }
3301
3303 }
3304}
3305
3307{
3308#ifdef BSB_DEBUG
3310#else
3311
3312#endif
3313}
3315{
3316#ifdef BSB_DEBUG_SPAM
3318#else
3319
3320#endif
3321}
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.