1973{
1975
1977
1979
1981
1987
1988
1989
1995
2001
2003
2007
2008
2010 {
2012
2013
2014 RegisterNetSyncVariableInt( "m_SyncParts01" );
2015 RegisterNetSyncVariableInt( "m_SyncParts02" );
2016 RegisterNetSyncVariableInt( "m_SyncParts03" );
2017 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2018 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2019 RegisterNetSyncVariableBool( "m_HasBase" );
2020
2021
2023
2024 if (ConfigIsExisting("hybridAttachments"))
2025 {
2028 }
2029 if (ConfigIsExisting("mountables"))
2030 {
2033 }
2034
2036 }
2037
2039 {
2040 super.EEDelete(parent);
2041
2043 {
2044 areaDamage.Destroy();
2045 }
2046
2047 }
2048
2050 {
2051 return "disableBaseDamage";
2052 }
2053
2055 {
2056 return true;
2057 }
2058
2060 {
2061 return EInventoryIconVisibility.HIDE_VICINITY;
2062 }
2063
2064
2066 {
2068 {
2069 SetSynchDirty();
2070 }
2071 }
2072
2074 {
2076 super.OnVariablesSynchronized();
2077
2079 }
2080
2082 {
2083
2085
2086
2088
2089
2091 }
2092
2093
2095 {
2096
2097 int offset;
2098 int mask;
2099
2100 if ( part_id >= 1 && part_id <= 31 )
2101 {
2102 offset = part_id - 1;
2103 mask = 1 << offset;
2104
2106 }
2107 else if ( part_id >= 32 && part_id <= 62 )
2108 {
2109 offset = ( part_id % 32 );
2110 mask = 1 << offset;
2111
2113 }
2114 else if ( part_id >= 63 && part_id <= 93 )
2115 {
2116 offset = ( part_id % 63 );
2117 mask = 1 << offset;
2118
2120 }
2121 }
2122
2124 {
2125
2126 int offset;
2127 int mask;
2128
2129 if ( part_id >= 1 && part_id <= 31 )
2130 {
2131 offset = part_id - 1;
2132 mask = 1 << offset;
2133
2135 }
2136 else if ( part_id >= 32 && part_id <= 62 )
2137 {
2138 offset = ( part_id % 32 );
2139 mask = 1 << offset;
2140
2142 }
2143 else if ( part_id >= 63 && part_id <= 93 )
2144 {
2145 offset = ( part_id % 63 );
2146 mask = 1 << offset;
2147
2149 }
2150 }
2151
2153 {
2154
2155 int offset;
2156 int mask;
2157
2158 if ( part_id >= 1 && part_id <= 31 )
2159 {
2160 offset = part_id - 1;
2161 mask = 1 << offset;
2162
2164 {
2165 return true;
2166 }
2167 }
2168 else if ( part_id >= 32 && part_id <= 62 )
2169 {
2170 offset = ( part_id % 32 );
2171 mask = 1 << offset;
2172
2174 {
2175 return true;
2176 }
2177 }
2178 else if ( part_id >= 63 && part_id <= 93 )
2179 {
2180 offset = ( part_id % 63 );
2181 mask = 1 << offset;
2182
2184 {
2185 return true;
2186 }
2187 }
2188
2189 return false;
2190 }
2191
2193 {
2196 }
2197
2199 {
2200
2203 }
2204
2206 {
2208 {
2211
2212 switch( build_action_id )
2213 {
2217 }
2218 }
2219 }
2220
2221
2223 {
2225 bool is_base = part.
IsBase();
2228 if ( is_part_built_sync )
2229 {
2231 {
2235
2236 if (is_base)
2237 {
2240 }
2241 }
2242 }
2243 else
2244 {
2246 {
2250
2251 if (is_base)
2252 {
2255 }
2256 }
2257 }
2258
2259
2261 }
2262
2263
2265 {
2268
2269 for ( int i = 0; i < construction_parts.Count(); ++i )
2270 {
2271 string key = construction_parts.GetKey( i );
2274 }
2275
2276
2278 }
2279
2281 {
2284
2285 for ( int i = 0; i < construction_parts.Count(); ++i )
2286 {
2287 string key = construction_parts.GetKey( i );
2289
2290 if ( value.
GetId() ==
id )
2291 {
2292 return value;
2293 }
2294 }
2295
2296 return NULL;
2297 }
2298
2299
2300
2302 {
2304 }
2305
2307 {
2309 }
2310
2312 {
2313 return true;
2314 }
2315
2317 {
2318 return false;
2319 }
2320
2321
2323 {
2326 {
2328 }
2329
2330 return construction_kit;
2331 }
2332
2334 {
2337 {
2339 }
2340 }
2341
2343 {
2345 }
2346
2348 {
2349 return "";
2350 }
2351
2353 {
2356 }
2357
2358
2360 {
2363 }
2364
2365
2367 {
2368 super.OnStoreSave( ctx );
2369
2370
2374
2376 }
2377
2379 {
2380 if ( !super.OnStoreLoad( ctx, version ) )
2381 return false;
2382
2383
2384
2386 {
2388 return false;
2389 }
2391 {
2393 return false;
2394 }
2396 {
2398 return false;
2399 }
2400
2401
2403 {
2405 return false;
2406 }
2407
2408
2409 return true;
2410 }
2411
2413 {
2414 super.AfterStoreLoad();
2415
2417 {
2419 }
2420 }
2421
2423 {
2424
2426
2427
2430
2431
2433 }
2434
2436 {
2437 super.OnCreatePhysics();
2440 }
2441
2443 {
2445 return;
2446
2447 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2448
2450 return;
2451
2453 string part_name = zone;
2455
2457 {
2458 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2459
2460 if ( construction_part && construction.IsPartConstructed( part_name ) )
2461 {
2463 construction.DestroyConnectedParts(part_name);
2464 }
2465
2466
2467 if ( part_name.
Contains(
"barbed") )
2468 {
2469 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2470 if (barbed_wire)
2471 barbed_wire.SetMountedState( false );
2472 }
2473 }
2474 }
2475
2477 {
2479 {
2481 }
2482
2483 super.EEOnAfterLoad();
2484 }
2485
2487 {
2488 super.EEInit();
2489
2490
2492
2493
2494 #ifdef DEVELOPER
2496 #endif
2497 }
2498
2500 {
2501 super.EEItemAttached( item, slot_name );
2502
2506 }
2507
2509 {
2510 super.EEItemDetached( item, slot_name );
2511
2514 }
2515
2516 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2517 {
2520
2523 }
2524
2525
2527 {
2528 return true;
2529 }
2530
2531
2532
2534 {
2536
2537
2538 if (construtionPart.
IsBase())
2539 {
2541
2542
2544 }
2545
2546
2548
2549
2551
2552
2554
2556
2558
2559
2561
2562
2564 }
2565
2567 {
2568
2570 }
2571
2572
2574 {
2577
2578
2580
2581
2583
2584
2586
2587
2589
2591
2592
2594
2595
2597
2598
2599 if (construtionPart.
IsBase())
2600 {
2601
2603 }
2604
2607 }
2608
2610 {
2611
2613 }
2614
2615
2616 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2617 {
2620
2621
2623
2624
2626
2627
2629
2630
2632
2634
2635
2637
2638
2640
2641
2642 if (construtionPart.
IsBase())
2643 {
2644
2646 }
2647
2650 }
2651
2653 {
2654
2656 }
2657
2659 {
2660 bool process = false;
2661
2662
2666
2667 if (process)
2668 {
2669 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2670 {
2672 return;
2673 }
2674
2676 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2677 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2678
2679
2681 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2682 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2683 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2684 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2685 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2686 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2687 mins = minTmp;
2688 maxs = maxTmp;
2689
2690 maxs[1] = maxs[1] + 0.35;
2691
2693 }
2694 }
2695
2697 {
2700
2701
2703 foreach (
EntityAI entity : foundEntities)
2704 {
2707 }
2708 }
2709
2710
2712 {
2714
2718 }
2719
2721 {
2723
2725 {
2727 }
2728 else
2729 {
2731 }
2732
2734 }
2735
2737 {
2739
2741 foreach (
string slotName : attachmentSlots)
2742 {
2744 }
2745
2746
2749 else
2751
2753 }
2754
2756 {
2757 string slotNameMounted = slot_name + "_Mounted";
2758 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2759
2760 if (attachment)
2761 {
2762 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2763 if (barbedWire && barbedWire.IsMounted())
2765 else
2767
2768 if (is_locked)
2769 {
2770 SetAnimationPhase(slotNameMounted, 0);
2771 SetAnimationPhase(slot_name, 1);
2772 }
2773 else
2774 {
2775 SetAnimationPhase(slotNameMounted, 1);
2776 SetAnimationPhase(slot_name, 0);
2777 }
2778 }
2779 else
2780 {
2781 SetAnimationPhase(slotNameMounted, 1);
2782 SetAnimationPhase(slot_name, 1);
2783
2785 }
2786 }
2787
2788
2790 {
2793
2796
2799
2800 foreach (
string slotName : attachmentSlots)
2801 {
2803 }
2804
2805
2807 {
2810
2812 }
2813 else
2814 {
2817
2819 }
2820
2823 }
2824
2826 {
2827
2829 return;
2830
2831 string slot_name_mounted = slot_name + "_Mounted";
2832 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2833
2834
2836 RemoveProxyPhysics( slot_name_mounted );
2837 RemoveProxyPhysics( slot_name );
2838
2839 if ( attachment )
2840 {
2842 if ( is_locked )
2843 {
2845 AddProxyPhysics( slot_name_mounted );
2846 }
2847 else
2848 {
2850 AddProxyPhysics( slot_name );
2851 }
2852 }
2853 }
2854
2856 {
2857 SetAffectPathgraph( true, false );
2859 }
2860
2862 {
2863 return true;
2864 }
2865
2867 {
2868 return true;
2869 }
2870
2872 {
2873 if ( attachment )
2874 {
2876 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2877
2878 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2879 }
2880
2881 return false;
2882 }
2883
2885 {
2887 }
2888
2889
2891 {
2892 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2893 if (
GetGame().ConfigIsExisting( config_path ) )
2894 {
2896 }
2897 }
2898
2900 {
2901 return true;
2902 }
2903
2905 {
2906 return true;
2907 }
2908
2910 {
2911 return true;
2912 }
2913
2914
2916 {
2918 {
2920 }
2921
2923 }
2924
2926 {
2928 }
2929
2930
2931
2933 {
2934 return super.CanReceiveAttachment(attachment, slotId);
2935 }
2936
2938 {
2939 int attachment_count = GetInventory().AttachmentCount();
2940 if ( attachment_count > 0 )
2941 {
2942 if (
HasBase() && attachment_count == 1 )
2943 {
2944 return false;
2945 }
2946
2947 return true;
2948 }
2949
2950 return false;
2951 }
2952
2954 {
2955 return true;
2956 }
2957
2959 {
2960 return false;
2961 }
2962
2963
2965 {
2966 return false;
2967 }
2968
2970 {
2971 return false;
2972 }
2973
2974
2976 {
2977 return false;
2978 }
2979
2980
2981
2983 {
2984 return true;
2985 }
2986
2988 {
2989 return true;
2990 }
2991
2994 {
2995 return false;
2996 }
2997
2998
3000 {
3001 return true;
3002 }
3003
3004
3006 {
3007 return false;
3008 }
3009
3010
3012 {
3013 return true;
3014 }
3015
3016
3018 {
3019 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3020 {
3021 return false;
3022 }
3023
3024 return true;
3025 }
3026
3028 {
3031
3032 return item;
3033 }
3034
3035
3037 {
3039 {
3040
3042
3043
3046
3048 if ( MemoryPointExists( slot_name + "_min" ) )
3049 {
3050 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3051 }
3052 if ( MemoryPointExists( slot_name + "_max" ) )
3053 {
3054 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3055 }
3056
3057
3060
3061
3064 center = ModelToWorld( center );
3065
3066
3069
3070 areaDamage.SetExtents( extents[0], extents[1] );
3071 areaDamage.SetAreaPosition( center );
3072 areaDamage.SetAreaOrientation( orientation );
3075 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3076 areaDamage.SetAmmoName( "BarbedWireHit" );
3077 areaDamage.Spawn();
3078
3080 }
3081 }
3082
3084 {
3085 if ( angle_deg != 0 )
3086 {
3087
3088 orientation[0] = orientation[0] - angle_deg;
3089
3090
3092 if ( MemoryPointExists( "rotate_axis" ) )
3093 {
3094 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3095 }
3096 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];
3097 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];
3098 center[0] = r_center_x;
3099 center[2] = r_center_z;
3100 }
3101 }
3102
3104 {
3106 {
3109 {
3110 if (areaDamage)
3111 {
3112 areaDamage.Destroy();
3113 }
3114
3116 }
3117 }
3118 }
3119
3121 {
3122 return true;
3123 }
3124
3125
3126
3127
3129 {
3131 }
3132
3134 {
3136 }
3137
3139 {
3141 }
3142
3144 {
3146
3147 switch ( material_type )
3148 {
3154 }
3155
3156 return "";
3157 }
3158
3160 {
3162
3163 switch ( material_type )
3164 {
3170 }
3171
3172 return "";
3173 }
3174
3175
3177 {
3179 {
3180
3182 {
3183 SetHealth(slot_name,"Health",item.GetHealth());
3184 }
3185 }
3186 }
3187
3189 {
3190 return 111;
3191 }
3192
3194 {
3195 super.SetActions();
3196
3200 }
3201
3202
3203
3204
3206 {
3207 }
3208
3211 {
3212 return null;
3213 }
3214
3216 {
3218 }
3219
3221 {
3224
3225 Man p;
3226
3227 #ifdef SERVER
3230 if (players.Count())
3231 p = players[0];
3232 #else
3234 #endif
3235
3237 {
3238 bool excluded = false;
3240 if (excludes)
3241 {
3242 foreach (string exclude : excludes)
3243 {
3245 {
3246 excluded = true;
3247 break;
3248 }
3249 }
3250 }
3251
3252 if (!excluded)
3253 {
3255 }
3256 }
3257
3259 }
3260}
3261
3263{
3264#ifdef BSB_DEBUG
3266#else
3267
3268#endif
3269}
3271{
3272#ifdef BSB_DEBUG_SPAM
3274#else
3275
3276#endif
3277}
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.