1807{
1809
1811
1813
1815
1821
1822
1823
1829
1835
1837
1841
1842
1844 {
1846
1847
1848 RegisterNetSyncVariableInt( "m_SyncParts01" );
1849 RegisterNetSyncVariableInt( "m_SyncParts02" );
1850 RegisterNetSyncVariableInt( "m_SyncParts03" );
1851 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1852 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1853 RegisterNetSyncVariableBool( "m_HasBase" );
1854
1855
1857
1858 if (ConfigIsExisting("hybridAttachments"))
1859 {
1862 }
1863 if (ConfigIsExisting("mountables"))
1864 {
1867 }
1868
1870 }
1871
1873 {
1874 super.EEDelete(parent);
1875
1877 {
1878 areaDamage.Destroy();
1879 }
1880
1881 }
1882
1884 {
1885 return "disableBaseDamage";
1886 }
1887
1889 {
1890 return true;
1891 }
1892
1894 {
1895 return EInventoryIconVisibility.HIDE_VICINITY;
1896 }
1897
1898
1900 {
1902 {
1903 SetSynchDirty();
1904 }
1905 }
1906
1908 {
1910 super.OnVariablesSynchronized();
1911
1913 }
1914
1916 {
1917
1919
1920
1922
1923
1925 }
1926
1927
1929 {
1930
1931 int offset;
1932 int mask;
1933
1934 if ( part_id >= 1 && part_id <= 31 )
1935 {
1936 offset = part_id - 1;
1937 mask = 1 << offset;
1938
1940 }
1941 else if ( part_id >= 32 && part_id <= 62 )
1942 {
1943 offset = ( part_id % 32 );
1944 mask = 1 << offset;
1945
1947 }
1948 else if ( part_id >= 63 && part_id <= 93 )
1949 {
1950 offset = ( part_id % 63 );
1951 mask = 1 << offset;
1952
1954 }
1955 }
1956
1958 {
1959
1960 int offset;
1961 int mask;
1962
1963 if ( part_id >= 1 && part_id <= 31 )
1964 {
1965 offset = part_id - 1;
1966 mask = 1 << offset;
1967
1969 }
1970 else if ( part_id >= 32 && part_id <= 62 )
1971 {
1972 offset = ( part_id % 32 );
1973 mask = 1 << offset;
1974
1976 }
1977 else if ( part_id >= 63 && part_id <= 93 )
1978 {
1979 offset = ( part_id % 63 );
1980 mask = 1 << offset;
1981
1983 }
1984 }
1985
1987 {
1988
1989 int offset;
1990 int mask;
1991
1992 if ( part_id >= 1 && part_id <= 31 )
1993 {
1994 offset = part_id - 1;
1995 mask = 1 << offset;
1996
1998 {
1999 return true;
2000 }
2001 }
2002 else if ( part_id >= 32 && part_id <= 62 )
2003 {
2004 offset = ( part_id % 32 );
2005 mask = 1 << offset;
2006
2008 {
2009 return true;
2010 }
2011 }
2012 else if ( part_id >= 63 && part_id <= 93 )
2013 {
2014 offset = ( part_id % 63 );
2015 mask = 1 << offset;
2016
2018 {
2019 return true;
2020 }
2021 }
2022
2023 return false;
2024 }
2025
2027 {
2030 }
2031
2033 {
2034
2037 }
2038
2040 {
2042 {
2045
2046 switch( build_action_id )
2047 {
2051 }
2052 }
2053 }
2054
2055
2057 {
2059 bool is_base = part.
IsBase();
2062 if ( is_part_built_sync )
2063 {
2065 {
2069
2070 if (is_base)
2071 {
2074 }
2075 }
2076 }
2077 else
2078 {
2080 {
2084
2085 if (is_base)
2086 {
2089 }
2090 }
2091 }
2092
2093
2095 }
2096
2097
2099 {
2102
2103 for ( int i = 0; i < construction_parts.Count(); ++i )
2104 {
2105 string key = construction_parts.GetKey( i );
2108 }
2109
2110
2112 }
2113
2115 {
2118
2119 for ( int i = 0; i < construction_parts.Count(); ++i )
2120 {
2121 string key = construction_parts.GetKey( i );
2123
2124 if ( value.
GetId() ==
id )
2125 {
2126 return value;
2127 }
2128 }
2129
2130 return NULL;
2131 }
2132
2133
2134
2136 {
2138 }
2139
2141 {
2143 }
2144
2146 {
2147 return true;
2148 }
2149
2151 {
2152 return false;
2153 }
2154
2155
2157 {
2160 {
2162 }
2163
2164 return construction_kit;
2165 }
2166
2168 {
2171 {
2173 }
2174 }
2175
2177 {
2179 }
2180
2182 {
2183 return "";
2184 }
2185
2187 {
2190 }
2191
2192
2194 {
2197 }
2198
2199
2201 {
2202 super.OnStoreSave( ctx );
2203
2204
2208
2210 }
2211
2213 {
2214 if ( !super.OnStoreLoad( ctx, version ) )
2215 return false;
2216
2217
2218
2220 {
2222 return false;
2223 }
2225 {
2227 return false;
2228 }
2230 {
2232 return false;
2233 }
2234
2235
2237 {
2239 return false;
2240 }
2241
2242
2243 return true;
2244 }
2245
2247 {
2248 super.AfterStoreLoad();
2249
2251 {
2253 }
2254 }
2255
2257 {
2258
2260
2261
2264
2265
2267 }
2268
2270 {
2271 super.OnCreatePhysics();
2274 }
2275
2277 {
2279 return;
2280
2281 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2282
2284 return;
2285
2287 string part_name = zone;
2289
2291 {
2292 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2293
2294 if ( construction_part && construction.IsPartConstructed( part_name ) )
2295 {
2297 construction.DestroyConnectedParts(part_name);
2298 }
2299
2300
2301 if ( part_name.
Contains(
"barbed") )
2302 {
2303 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2304 if (barbed_wire)
2305 barbed_wire.SetMountedState( false );
2306 }
2307 }
2308 }
2309
2311 {
2313 {
2315 }
2316
2317 super.EEOnAfterLoad();
2318 }
2319
2321 {
2322 super.EEInit();
2323
2324
2326
2327
2328 #ifdef DEVELOPER
2330 #endif
2331 }
2332
2334 {
2335 super.EEItemAttached( item, slot_name );
2336
2340 }
2341
2343 {
2344 super.EEItemDetached( item, slot_name );
2345
2348 }
2349
2350 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2351 {
2354
2357 }
2358
2359
2361 {
2362 return true;
2363 }
2364
2365
2366
2368 {
2370
2371
2372 if (construtionPart.
IsBase())
2373 {
2375
2376
2378 }
2379
2380
2382
2383
2385
2386
2388
2390
2392
2393
2395
2396
2398 }
2399
2401 {
2402
2404 }
2405
2406
2408 {
2411
2412
2414
2415
2417
2418
2420
2421
2423
2425
2426
2428
2429
2431
2432
2433 if (construtionPart.
IsBase())
2434 {
2435
2437 }
2438
2441 }
2442
2444 {
2445
2447 }
2448
2449
2450 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2451 {
2454
2455
2457
2458
2460
2461
2463
2464
2466
2468
2469
2471
2472
2474
2475
2476 if (construtionPart.
IsBase())
2477 {
2478
2480 }
2481
2484 }
2485
2487 {
2488
2490 }
2491
2493 {
2494 bool process = false;
2495
2496
2500
2501 if (process)
2502 {
2503 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2504 {
2506 return;
2507 }
2508
2510 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2511 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2512
2513
2515 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2516 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2517 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2518 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2519 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2520 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2521 mins = minTmp;
2522 maxs = maxTmp;
2523
2524 maxs[1] = maxs[1] + 0.35;
2525
2527 }
2528 }
2529
2531 {
2534
2535
2537 foreach (
EntityAI entity : foundEntities)
2538 {
2541 }
2542 }
2543
2544
2546 {
2548
2552 }
2553
2555 {
2557
2559 {
2561 }
2562 else
2563 {
2565 }
2566
2568 }
2569
2571 {
2573
2575 foreach (
string slotName : attachmentSlots)
2576 {
2578 }
2579
2580
2583 else
2585
2587 }
2588
2590 {
2591 string slotNameMounted = slot_name + "_Mounted";
2592 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2593
2594 if (attachment)
2595 {
2596 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2597 if (barbedWire && barbedWire.IsMounted())
2599 else
2601
2602 if (is_locked)
2603 {
2604 SetAnimationPhase(slotNameMounted, 0);
2605 SetAnimationPhase(slot_name, 1);
2606 }
2607 else
2608 {
2609 SetAnimationPhase(slotNameMounted, 1);
2610 SetAnimationPhase(slot_name, 0);
2611 }
2612 }
2613 else
2614 {
2615 SetAnimationPhase(slotNameMounted, 1);
2616 SetAnimationPhase(slot_name, 1);
2617
2619 }
2620 }
2621
2622
2624 {
2627
2630
2633
2634 foreach (
string slotName : attachmentSlots)
2635 {
2637 }
2638
2639
2641 {
2644
2646 }
2647 else
2648 {
2651
2653 }
2654
2657 }
2658
2660 {
2661
2663 return;
2664
2665 string slot_name_mounted = slot_name + "_Mounted";
2666 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2667
2668
2670 RemoveProxyPhysics( slot_name_mounted );
2671 RemoveProxyPhysics( slot_name );
2672
2673 if ( attachment )
2674 {
2676 if ( is_locked )
2677 {
2679 AddProxyPhysics( slot_name_mounted );
2680 }
2681 else
2682 {
2684 AddProxyPhysics( slot_name );
2685 }
2686 }
2687 }
2688
2690 {
2691 SetAffectPathgraph( true, false );
2693 }
2694
2696 {
2697 return true;
2698 }
2699
2701 {
2702 return true;
2703 }
2704
2706 {
2707 if ( attachment )
2708 {
2710 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2711
2712 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2713 }
2714
2715 return false;
2716 }
2717
2719 {
2721 }
2722
2723
2725 {
2726 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2727 if (
GetGame().ConfigIsExisting( config_path ) )
2728 {
2730 }
2731 }
2732
2734 {
2735 return true;
2736 }
2737
2739 {
2740 return true;
2741 }
2742
2744 {
2745 return true;
2746 }
2747
2748
2750 {
2752 {
2754 }
2755
2757 }
2758
2760 {
2762 }
2763
2764
2765
2767 {
2768 return super.CanReceiveAttachment(attachment, slotId);
2769 }
2770
2772 {
2773 int attachment_count = GetInventory().AttachmentCount();
2774 if ( attachment_count > 0 )
2775 {
2776 if (
HasBase() && attachment_count == 1 )
2777 {
2778 return false;
2779 }
2780
2781 return true;
2782 }
2783
2784 return false;
2785 }
2786
2788 {
2789 return true;
2790 }
2791
2793 {
2794 return false;
2795 }
2796
2797
2799 {
2800 return false;
2801 }
2802
2804 {
2805 return false;
2806 }
2807
2808
2810 {
2811 return false;
2812 }
2813
2814
2815
2817 {
2818 return true;
2819 }
2820
2822 {
2823 return true;
2824 }
2825
2828 {
2829 return false;
2830 }
2831
2832
2834 {
2835 return true;
2836 }
2837
2838
2840 {
2841 return false;
2842 }
2843
2844
2846 {
2847 return true;
2848 }
2849
2850
2852 {
2853 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2854 {
2855 return false;
2856 }
2857
2858 return true;
2859 }
2860
2862 {
2865
2866 return item;
2867 }
2868
2869
2871 {
2873 {
2874
2876
2877
2880
2882 if ( MemoryPointExists( slot_name + "_min" ) )
2883 {
2884 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2885 }
2886 if ( MemoryPointExists( slot_name + "_max" ) )
2887 {
2888 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2889 }
2890
2891
2894
2895
2898 center = ModelToWorld( center );
2899
2900
2903
2904 areaDamage.SetExtents( extents[0], extents[1] );
2905 areaDamage.SetAreaPosition( center );
2906 areaDamage.SetAreaOrientation( orientation );
2909 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2910 areaDamage.SetAmmoName( "BarbedWireHit" );
2911 areaDamage.Spawn();
2912
2914 }
2915 }
2916
2918 {
2919 if ( angle_deg != 0 )
2920 {
2921
2922 orientation[0] = orientation[0] - angle_deg;
2923
2924
2926 if ( MemoryPointExists( "rotate_axis" ) )
2927 {
2928 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2929 }
2930 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];
2931 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];
2932 center[0] = r_center_x;
2933 center[2] = r_center_z;
2934 }
2935 }
2936
2938 {
2940 {
2943 {
2944 if (areaDamage)
2945 {
2946 areaDamage.Destroy();
2947 }
2948
2950 }
2951 }
2952 }
2953
2955 {
2956 return true;
2957 }
2958
2959
2960
2961
2963 {
2965 }
2966
2968 {
2970 }
2971
2973 {
2975 }
2976
2978 {
2980
2981 switch ( material_type )
2982 {
2988 }
2989
2990 return "";
2991 }
2992
2994 {
2996
2997 switch ( material_type )
2998 {
3004 }
3005
3006 return "";
3007 }
3008
3009
3011 {
3013 {
3014
3016 {
3017 SetHealth(slot_name,"Health",item.GetHealth());
3018 }
3019 }
3020 }
3021
3023 {
3024 return 111;
3025 }
3026
3028 {
3029 super.SetActions();
3030
3034 }
3035
3036
3037
3038
3040 {
3041 }
3042
3045 {
3046 return null;
3047 }
3048
3050 {
3052 }
3053
3055 {
3058
3059 Man p;
3060
3061 #ifdef SERVER
3064 if (players.Count())
3065 p = players[0];
3066 #else
3068 #endif
3069
3071 {
3072 bool excluded = false;
3074 if (excludes)
3075 {
3076 foreach (string exclude : excludes)
3077 {
3079 {
3080 excluded = true;
3081 break;
3082 }
3083 }
3084 }
3085
3086 if (!excluded)
3087 {
3089 }
3090 }
3091
3093 }
3094}
3095
3097{
3098#ifdef BSB_DEBUG
3100#else
3101
3102#endif
3103}
3105{
3106#ifdef BSB_DEBUG_SPAM
3108#else
3109
3110#endif
3111}
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.