1733{
1735
1737
1739
1741
1747
1748
1749
1755
1761
1763
1767
1768
1770 {
1772
1773
1774 RegisterNetSyncVariableInt( "m_SyncParts01" );
1775 RegisterNetSyncVariableInt( "m_SyncParts02" );
1776 RegisterNetSyncVariableInt( "m_SyncParts03" );
1777 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1778 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1779 RegisterNetSyncVariableBool( "m_HasBase" );
1780
1781
1783
1784 if (ConfigIsExisting("hybridAttachments"))
1785 {
1788 }
1789 if (ConfigIsExisting("mountables"))
1790 {
1793 }
1794
1796 }
1797
1799 {
1800 super.EEDelete(parent);
1801
1803 {
1804 areaDamage.Destroy();
1805 }
1806
1807 }
1808
1810 {
1811 return "disableBaseDamage";
1812 }
1813
1815 {
1816 return true;
1817 }
1818
1820 {
1821 return EInventoryIconVisibility.HIDE_VICINITY;
1822 }
1823
1824
1826 {
1828 {
1829 SetSynchDirty();
1830 }
1831 }
1832
1834 {
1836 super.OnVariablesSynchronized();
1837
1839 }
1840
1842 {
1843
1845
1846
1848
1849
1851 }
1852
1853
1855 {
1856
1857 int offset;
1858 int mask;
1859
1860 if ( part_id >= 1 && part_id <= 31 )
1861 {
1862 offset = part_id - 1;
1863 mask = 1 << offset;
1864
1866 }
1867 else if ( part_id >= 32 && part_id <= 62 )
1868 {
1869 offset = ( part_id % 32 );
1870 mask = 1 << offset;
1871
1873 }
1874 else if ( part_id >= 63 && part_id <= 93 )
1875 {
1876 offset = ( part_id % 63 );
1877 mask = 1 << offset;
1878
1880 }
1881 }
1882
1884 {
1885
1886 int offset;
1887 int mask;
1888
1889 if ( part_id >= 1 && part_id <= 31 )
1890 {
1891 offset = part_id - 1;
1892 mask = 1 << offset;
1893
1895 }
1896 else if ( part_id >= 32 && part_id <= 62 )
1897 {
1898 offset = ( part_id % 32 );
1899 mask = 1 << offset;
1900
1902 }
1903 else if ( part_id >= 63 && part_id <= 93 )
1904 {
1905 offset = ( part_id % 63 );
1906 mask = 1 << offset;
1907
1909 }
1910 }
1911
1913 {
1914
1915 int offset;
1916 int mask;
1917
1918 if ( part_id >= 1 && part_id <= 31 )
1919 {
1920 offset = part_id - 1;
1921 mask = 1 << offset;
1922
1924 {
1925 return true;
1926 }
1927 }
1928 else if ( part_id >= 32 && part_id <= 62 )
1929 {
1930 offset = ( part_id % 32 );
1931 mask = 1 << offset;
1932
1934 {
1935 return true;
1936 }
1937 }
1938 else if ( part_id >= 63 && part_id <= 93 )
1939 {
1940 offset = ( part_id % 63 );
1941 mask = 1 << offset;
1942
1944 {
1945 return true;
1946 }
1947 }
1948
1949 return false;
1950 }
1951
1953 {
1956 }
1957
1959 {
1960
1963 }
1964
1966 {
1968 {
1971
1972 switch( build_action_id )
1973 {
1977 }
1978 }
1979 }
1980
1981
1983 {
1985 bool is_base = part.
IsBase();
1988 if ( is_part_built_sync )
1989 {
1991 {
1995
1996 if (is_base)
1997 {
2000 }
2001 }
2002 }
2003 else
2004 {
2006 {
2010
2011 if (is_base)
2012 {
2015 }
2016 }
2017 }
2018
2019
2021 }
2022
2023
2025 {
2028
2029 for ( int i = 0; i < construction_parts.Count(); ++i )
2030 {
2031 string key = construction_parts.GetKey( i );
2034 }
2035
2036
2038 }
2039
2041 {
2044
2045 for ( int i = 0; i < construction_parts.Count(); ++i )
2046 {
2047 string key = construction_parts.GetKey( i );
2049
2050 if ( value.
GetId() ==
id )
2051 {
2052 return value;
2053 }
2054 }
2055
2056 return NULL;
2057 }
2058
2059
2060
2062 {
2064 }
2065
2067 {
2069 }
2070
2072 {
2073 return true;
2074 }
2075
2077 {
2078 return false;
2079 }
2080
2081
2083 {
2086 {
2088 }
2089
2090 return construction_kit;
2091 }
2092
2094 {
2097 {
2099 }
2100 }
2101
2103 {
2105 }
2106
2108 {
2109 return "";
2110 }
2111
2113 {
2116 }
2117
2118
2120 {
2123 }
2124
2125
2127 {
2128 super.OnStoreSave( ctx );
2129
2130
2134
2136 }
2137
2139 {
2140 if ( !super.OnStoreLoad( ctx, version ) )
2141 return false;
2142
2143
2144
2146 {
2148 return false;
2149 }
2151 {
2153 return false;
2154 }
2156 {
2158 return false;
2159 }
2160
2161
2163 {
2165 return false;
2166 }
2167
2168
2169 return true;
2170 }
2171
2173 {
2174 super.AfterStoreLoad();
2175
2177 {
2179 }
2180 }
2181
2183 {
2184
2186
2187
2190
2191
2193 }
2194
2196 {
2197 super.OnCreatePhysics();
2200 }
2201
2203 {
2205 return;
2206
2207 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2208
2210 return;
2211
2213 string part_name = zone;
2215
2217 {
2218 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2219
2220 if ( construction_part && construction.IsPartConstructed( part_name ) )
2221 {
2223 construction.DestroyConnectedParts(part_name);
2224 }
2225
2226
2227 if ( part_name.
Contains(
"barbed") )
2228 {
2229 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2230 if (barbed_wire)
2231 barbed_wire.SetMountedState( false );
2232 }
2233 }
2234 }
2235
2237 {
2239 {
2241 }
2242
2243 super.EEOnAfterLoad();
2244 }
2245
2247 {
2248 super.EEInit();
2249
2250
2252
2253
2254 #ifdef DEVELOPER
2256 #endif
2257 }
2258
2260 {
2261 super.EEItemAttached( item, slot_name );
2262
2266 }
2267
2269 {
2270 super.EEItemDetached( item, slot_name );
2271
2274 }
2275
2276 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2277 {
2280
2283 }
2284
2285
2287 {
2288 return true;
2289 }
2290
2291
2292
2294 {
2296
2297
2298 if (construtionPart.
IsBase())
2299 {
2301
2302
2304 }
2305
2306
2308
2309
2311
2312
2314
2316
2318
2319
2321
2322
2324 }
2325
2327 {
2328
2330 }
2331
2332
2334 {
2337
2338
2340
2341
2343
2344
2346
2347
2349
2351
2352
2354
2355
2357
2358
2359 if (construtionPart.
IsBase())
2360 {
2361
2363 }
2364
2367 }
2368
2370 {
2371
2373 }
2374
2375
2376 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2377 {
2380
2381
2383
2384
2386
2387
2389
2390
2392
2394
2395
2397
2398
2400
2401
2402 if (construtionPart.
IsBase())
2403 {
2404
2406 }
2407
2410 }
2411
2413 {
2414
2416 }
2417
2419 {
2420 bool process = false;
2421
2422
2426
2427 if (process)
2428 {
2429 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2430 {
2432 return;
2433 }
2434
2436 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2437 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2438
2439
2441 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2442 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2443 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2444 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2445 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2446 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2447 mins = minTmp;
2448 maxs = maxTmp;
2449
2450 maxs[1] = maxs[1] + 0.35;
2451
2453 }
2454 }
2455
2457 {
2460
2461
2463 foreach (
EntityAI entity : foundEntities)
2464 {
2467 }
2468 }
2469
2470
2472 {
2474
2478 }
2479
2481 {
2483
2485 {
2487 }
2488 else
2489 {
2491 }
2492
2494 }
2495
2497 {
2499
2501 foreach (
string slotName : attachmentSlots)
2502 {
2504 }
2505
2506
2509 else
2511
2513 }
2514
2516 {
2517 string slotNameMounted = slot_name + "_Mounted";
2518 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2519
2520 if (attachment)
2521 {
2522 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2523 if (barbedWire && barbedWire.IsMounted())
2525 else
2527
2528 if (is_locked)
2529 {
2530 SetAnimationPhase(slotNameMounted, 0);
2531 SetAnimationPhase(slot_name, 1);
2532 }
2533 else
2534 {
2535 SetAnimationPhase(slotNameMounted, 1);
2536 SetAnimationPhase(slot_name, 0);
2537 }
2538 }
2539 else
2540 {
2541 SetAnimationPhase(slotNameMounted, 1);
2542 SetAnimationPhase(slot_name, 1);
2543
2545 }
2546 }
2547
2548
2550 {
2553
2556
2559
2560 foreach (
string slotName : attachmentSlots)
2561 {
2563 }
2564
2565
2567 {
2570
2572 }
2573 else
2574 {
2577
2579 }
2580
2583 }
2584
2586 {
2587
2589 return;
2590
2591 string slot_name_mounted = slot_name + "_Mounted";
2592 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2593
2594
2596 RemoveProxyPhysics( slot_name_mounted );
2597 RemoveProxyPhysics( slot_name );
2598
2599 if ( attachment )
2600 {
2602 if ( is_locked )
2603 {
2605 AddProxyPhysics( slot_name_mounted );
2606 }
2607 else
2608 {
2610 AddProxyPhysics( slot_name );
2611 }
2612 }
2613 }
2614
2616 {
2617 SetAffectPathgraph( true, false );
2619 }
2620
2622 {
2623 return true;
2624 }
2625
2627 {
2628 return true;
2629 }
2630
2632 {
2633 if ( attachment )
2634 {
2636 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2637
2638 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2639 }
2640
2641 return false;
2642 }
2643
2645 {
2647 }
2648
2649
2651 {
2652 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2653 if (
GetGame().ConfigIsExisting( config_path ) )
2654 {
2656 }
2657 }
2658
2660 {
2661 return true;
2662 }
2663
2665 {
2666 return true;
2667 }
2668
2670 {
2671 return true;
2672 }
2673
2674
2676 {
2678 {
2680 }
2681
2683 }
2684
2686 {
2688 }
2689
2690
2691
2693 {
2694 return super.CanReceiveAttachment(attachment, slotId);
2695 }
2696
2698 {
2699 int attachment_count = GetInventory().AttachmentCount();
2700 if ( attachment_count > 0 )
2701 {
2702 if (
HasBase() && attachment_count == 1 )
2703 {
2704 return false;
2705 }
2706
2707 return true;
2708 }
2709
2710 return false;
2711 }
2712
2714 {
2715 return true;
2716 }
2717
2719 {
2720 return false;
2721 }
2722
2723
2725 {
2726 return false;
2727 }
2728
2730 {
2731 return false;
2732 }
2733
2734
2736 {
2737 return false;
2738 }
2739
2740
2741
2743 {
2744 return true;
2745 }
2746
2748 {
2749 return true;
2750 }
2751
2754 {
2755 return false;
2756 }
2757
2758
2760 {
2761 return true;
2762 }
2763
2764
2766 {
2767 return false;
2768 }
2769
2770
2772 {
2773 return true;
2774 }
2775
2776
2778 {
2779 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2780 {
2781 return false;
2782 }
2783
2784 return true;
2785 }
2786
2788 {
2791
2792 return item;
2793 }
2794
2795
2797 {
2799 {
2800
2802
2803
2806
2808 if ( MemoryPointExists( slot_name + "_min" ) )
2809 {
2810 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2811 }
2812 if ( MemoryPointExists( slot_name + "_max" ) )
2813 {
2814 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2815 }
2816
2817
2820
2821
2824 center = ModelToWorld( center );
2825
2826
2829
2830 areaDamage.SetExtents( extents[0], extents[1] );
2831 areaDamage.SetAreaPosition( center );
2832 areaDamage.SetAreaOrientation( orientation );
2835 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2836 areaDamage.SetAmmoName( "BarbedWireHit" );
2837 areaDamage.Spawn();
2838
2840 }
2841 }
2842
2844 {
2845 if ( angle_deg != 0 )
2846 {
2847
2848 orientation[0] = orientation[0] - angle_deg;
2849
2850
2852 if ( MemoryPointExists( "rotate_axis" ) )
2853 {
2854 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2855 }
2856 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];
2857 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];
2858 center[0] = r_center_x;
2859 center[2] = r_center_z;
2860 }
2861 }
2862
2864 {
2866 {
2869 {
2870 if (areaDamage)
2871 {
2872 areaDamage.Destroy();
2873 }
2874
2876 }
2877 }
2878 }
2879
2881 {
2882 return true;
2883 }
2884
2885
2886
2887
2889 {
2891 }
2892
2894 {
2896 }
2897
2899 {
2901 }
2902
2904 {
2906
2907 switch ( material_type )
2908 {
2914 }
2915
2916 return "";
2917 }
2918
2920 {
2922
2923 switch ( material_type )
2924 {
2930 }
2931
2932 return "";
2933 }
2934
2935
2937 {
2939 {
2940
2942 {
2943 SetHealth(slot_name,"Health",item.GetHealth());
2944 }
2945 }
2946 }
2947
2949 {
2950 return 111;
2951 }
2952
2954 {
2955 super.SetActions();
2956
2960 }
2961
2962
2963
2964
2966 {
2967 }
2968
2971 {
2972 return null;
2973 }
2974
2976 {
2978 }
2979
2981 {
2984
2985 Man p;
2986
2987 #ifdef SERVER
2990 if (players.Count())
2991 p = players[0];
2992 #else
2994 #endif
2995
2997 {
2998 bool excluded = false;
3000 if (excludes)
3001 {
3002 foreach (string exclude : excludes)
3003 {
3005 {
3006 excluded = true;
3007 break;
3008 }
3009 }
3010 }
3011
3012 if (!excluded)
3013 {
3015 }
3016 }
3017
3019 }
3020}
3021
3023{
3024#ifdef BSB_DEBUG
3026#else
3027
3028#endif
3029}
3031{
3032#ifdef BSB_DEBUG_SPAM
3034#else
3035
3036#endif
3037}
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.