1699{
1701
1703
1705
1707
1713
1714
1715
1721
1727
1729
1733
1734
1736 {
1738
1739
1740 RegisterNetSyncVariableInt( "m_SyncParts01" );
1741 RegisterNetSyncVariableInt( "m_SyncParts02" );
1742 RegisterNetSyncVariableInt( "m_SyncParts03" );
1743 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1744 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1745 RegisterNetSyncVariableBool( "m_HasBase" );
1746
1747
1749
1750 if (ConfigIsExisting("hybridAttachments"))
1751 {
1754 }
1755 if (ConfigIsExisting("mountables"))
1756 {
1759 }
1760
1762 }
1763
1765 {
1766 super.EEDelete(parent);
1767
1769 {
1770 areaDamage.Destroy();
1771 }
1772
1773 }
1774
1776 {
1777 return "disableBaseDamage";
1778 }
1779
1781 {
1782 return true;
1783 }
1784
1786 {
1787 return EInventoryIconVisibility.HIDE_VICINITY;
1788 }
1789
1790
1792 {
1794 {
1795 SetSynchDirty();
1796 }
1797 }
1798
1800 {
1802 super.OnVariablesSynchronized();
1803
1805 }
1806
1808 {
1809
1811
1812
1814
1815
1817 }
1818
1819
1821 {
1822
1823 int offset;
1824 int mask;
1825
1826 if ( part_id >= 1 && part_id <= 31 )
1827 {
1828 offset = part_id - 1;
1829 mask = 1 << offset;
1830
1832 }
1833 else if ( part_id >= 32 && part_id <= 62 )
1834 {
1835 offset = ( part_id % 32 );
1836 mask = 1 << offset;
1837
1839 }
1840 else if ( part_id >= 63 && part_id <= 93 )
1841 {
1842 offset = ( part_id % 63 );
1843 mask = 1 << offset;
1844
1846 }
1847 }
1848
1850 {
1851
1852 int offset;
1853 int mask;
1854
1855 if ( part_id >= 1 && part_id <= 31 )
1856 {
1857 offset = part_id - 1;
1858 mask = 1 << offset;
1859
1861 }
1862 else if ( part_id >= 32 && part_id <= 62 )
1863 {
1864 offset = ( part_id % 32 );
1865 mask = 1 << offset;
1866
1868 }
1869 else if ( part_id >= 63 && part_id <= 93 )
1870 {
1871 offset = ( part_id % 63 );
1872 mask = 1 << offset;
1873
1875 }
1876 }
1877
1879 {
1880
1881 int offset;
1882 int mask;
1883
1884 if ( part_id >= 1 && part_id <= 31 )
1885 {
1886 offset = part_id - 1;
1887 mask = 1 << offset;
1888
1890 {
1891 return true;
1892 }
1893 }
1894 else if ( part_id >= 32 && part_id <= 62 )
1895 {
1896 offset = ( part_id % 32 );
1897 mask = 1 << offset;
1898
1900 {
1901 return true;
1902 }
1903 }
1904 else if ( part_id >= 63 && part_id <= 93 )
1905 {
1906 offset = ( part_id % 63 );
1907 mask = 1 << offset;
1908
1910 {
1911 return true;
1912 }
1913 }
1914
1915 return false;
1916 }
1917
1919 {
1922 }
1923
1925 {
1926
1929 }
1930
1932 {
1934 {
1937
1938 switch( build_action_id )
1939 {
1943 }
1944 }
1945 }
1946
1947
1949 {
1951 bool is_base = part.
IsBase();
1954 if ( is_part_built_sync )
1955 {
1957 {
1961
1962 if (is_base)
1963 {
1966 }
1967 }
1968 }
1969 else
1970 {
1972 {
1976
1977 if (is_base)
1978 {
1981 }
1982 }
1983 }
1984
1985
1987 }
1988
1989
1991 {
1994
1995 for ( int i = 0; i < construction_parts.Count(); ++i )
1996 {
1997 string key = construction_parts.GetKey( i );
2000 }
2001
2002
2004 }
2005
2007 {
2010
2011 for ( int i = 0; i < construction_parts.Count(); ++i )
2012 {
2013 string key = construction_parts.GetKey( i );
2015
2016 if ( value.
GetId() ==
id )
2017 {
2018 return value;
2019 }
2020 }
2021
2022 return NULL;
2023 }
2024
2025
2026
2028 {
2030 }
2031
2033 {
2035 }
2036
2038 {
2039 return true;
2040 }
2041
2043 {
2044 return false;
2045 }
2046
2047
2049 {
2052 {
2054 }
2055
2056 return construction_kit;
2057 }
2058
2060 {
2063 {
2065 }
2066 }
2067
2069 {
2071 }
2072
2074 {
2075 return "";
2076 }
2077
2079 {
2082 }
2083
2084
2086 {
2089 }
2090
2091
2093 {
2094 super.OnStoreSave( ctx );
2095
2096
2100
2102 }
2103
2105 {
2106 if ( !super.OnStoreLoad( ctx, version ) )
2107 return false;
2108
2109
2110
2112 {
2114 return false;
2115 }
2117 {
2119 return false;
2120 }
2122 {
2124 return false;
2125 }
2126
2127
2129 {
2131 return false;
2132 }
2133
2134
2135 return true;
2136 }
2137
2139 {
2140 super.AfterStoreLoad();
2141
2143 {
2145 }
2146 }
2147
2149 {
2150
2152
2153
2156
2157
2159 }
2160
2162 {
2163 super.OnCreatePhysics();
2166 }
2167
2169 {
2171 return;
2172
2173 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2174
2176 return;
2177
2179 string part_name = zone;
2181
2183 {
2184 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2185
2186 if ( construction_part && construction.IsPartConstructed( part_name ) )
2187 {
2189 construction.DestroyConnectedParts(part_name);
2190 }
2191
2192
2193 if ( part_name.
Contains(
"barbed") )
2194 {
2195 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2196 if (barbed_wire)
2197 barbed_wire.SetMountedState( false );
2198 }
2199 }
2200 }
2201
2203 {
2205 {
2207 }
2208
2209 super.EEOnAfterLoad();
2210 }
2211
2213 {
2214 super.EEInit();
2215
2216
2218
2219
2220 #ifdef DEVELOPER
2222 #endif
2223 }
2224
2226 {
2227 super.EEItemAttached( item, slot_name );
2228
2232 }
2233
2235 {
2236 super.EEItemDetached( item, slot_name );
2237
2240 }
2241
2242 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2243 {
2246
2249 }
2250
2251
2253 {
2254 return true;
2255 }
2256
2257
2258
2260 {
2262
2263
2264 if (construtionPart.
IsBase())
2265 {
2267
2268
2270 }
2271
2272
2274
2275
2277
2278
2280
2282
2284
2285
2287
2288
2290 }
2291
2293 {
2294
2296 }
2297
2298
2300 {
2303
2304
2306
2307
2309
2310
2312
2313
2315
2317
2318
2320
2321
2323
2324
2325 if (construtionPart.
IsBase())
2326 {
2327
2329 }
2330
2333 }
2334
2336 {
2337
2339 }
2340
2341
2342 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2343 {
2346
2347
2349
2350
2352
2353
2355
2356
2358
2360
2361
2363
2364
2366
2367
2368 if (construtionPart.
IsBase())
2369 {
2370
2372 }
2373
2376 }
2377
2379 {
2380
2382 }
2383
2385 {
2386 bool process = false;
2387
2388
2392
2393 if (process)
2394 {
2395 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2396 {
2398 return;
2399 }
2400
2402 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2403 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2404
2405
2407 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2408 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2409 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2410 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2411 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2412 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2413 mins = minTmp;
2414 maxs = maxTmp;
2415
2416 maxs[1] = maxs[1] + 0.35;
2417
2419 }
2420 }
2421
2423 {
2426
2427
2429 foreach (
EntityAI entity : foundEntities)
2430 {
2433 }
2434 }
2435
2436
2438 {
2440
2444 }
2445
2447 {
2449
2451 {
2453 }
2454 else
2455 {
2457 }
2458
2460 }
2461
2463 {
2465
2467 foreach (
string slotName : attachmentSlots)
2468 {
2470 }
2471
2472
2475 else
2477
2479 }
2480
2482 {
2483 string slotNameMounted = slot_name + "_Mounted";
2484 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2485
2486 if (attachment)
2487 {
2488 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2489 if (barbedWire && barbedWire.IsMounted())
2491 else
2493
2494 if (is_locked)
2495 {
2496 SetAnimationPhase(slotNameMounted, 0);
2497 SetAnimationPhase(slot_name, 1);
2498 }
2499 else
2500 {
2501 SetAnimationPhase(slotNameMounted, 1);
2502 SetAnimationPhase(slot_name, 0);
2503 }
2504 }
2505 else
2506 {
2507 SetAnimationPhase(slotNameMounted, 1);
2508 SetAnimationPhase(slot_name, 1);
2509
2511 }
2512 }
2513
2514
2516 {
2519
2522
2525
2526 foreach (
string slotName : attachmentSlots)
2527 {
2529 }
2530
2531
2533 {
2536
2538 }
2539 else
2540 {
2543
2545 }
2546
2549 }
2550
2552 {
2553
2555 return;
2556
2557 string slot_name_mounted = slot_name + "_Mounted";
2558 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2559
2560
2562 RemoveProxyPhysics( slot_name_mounted );
2563 RemoveProxyPhysics( slot_name );
2564
2565 if ( attachment )
2566 {
2568 if ( is_locked )
2569 {
2571 AddProxyPhysics( slot_name_mounted );
2572 }
2573 else
2574 {
2576 AddProxyPhysics( slot_name );
2577 }
2578 }
2579 }
2580
2582 {
2583 SetAffectPathgraph( true, false );
2585 }
2586
2588 {
2589 return true;
2590 }
2591
2593 {
2594 return true;
2595 }
2596
2598 {
2599 if ( attachment )
2600 {
2602 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2603
2604 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2605 }
2606
2607 return false;
2608 }
2609
2611 {
2613 }
2614
2615
2617 {
2618 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2619 if (
GetGame().ConfigIsExisting( config_path ) )
2620 {
2622 }
2623 }
2624
2626 {
2627 return true;
2628 }
2629
2631 {
2632 return true;
2633 }
2634
2636 {
2637 return true;
2638 }
2639
2640
2642 {
2644 {
2646 }
2647
2649 }
2650
2652 {
2654 }
2655
2656
2657
2659 {
2660 return super.CanReceiveAttachment(attachment, slotId);
2661 }
2662
2664 {
2665 int attachment_count = GetInventory().AttachmentCount();
2666 if ( attachment_count > 0 )
2667 {
2668 if (
HasBase() && attachment_count == 1 )
2669 {
2670 return false;
2671 }
2672
2673 return true;
2674 }
2675
2676 return false;
2677 }
2678
2680 {
2681 return true;
2682 }
2683
2685 {
2686 return false;
2687 }
2688
2689
2691 {
2692 return false;
2693 }
2694
2696 {
2697 return false;
2698 }
2699
2700
2702 {
2703 return false;
2704 }
2705
2706
2707
2709 {
2710 return true;
2711 }
2712
2714 {
2715 return true;
2716 }
2717
2720 {
2721 return false;
2722 }
2723
2724
2726 {
2727 return true;
2728 }
2729
2730
2732 {
2733 return false;
2734 }
2735
2736
2738 {
2739 return true;
2740 }
2741
2742
2744 {
2745 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2746 {
2747 return false;
2748 }
2749
2750 return true;
2751 }
2752
2754 {
2757
2758 return item;
2759 }
2760
2761
2763 {
2765 {
2766
2768
2769
2772
2774 if ( MemoryPointExists( slot_name + "_min" ) )
2775 {
2776 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2777 }
2778 if ( MemoryPointExists( slot_name + "_max" ) )
2779 {
2780 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2781 }
2782
2783
2786
2787
2790 center = ModelToWorld( center );
2791
2792
2795
2796 areaDamage.SetExtents( extents[0], extents[1] );
2797 areaDamage.SetAreaPosition( center );
2798 areaDamage.SetAreaOrientation( orientation );
2801 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2802 areaDamage.SetAmmoName( "BarbedWireHit" );
2803 areaDamage.Spawn();
2804
2806 }
2807 }
2808
2810 {
2811 if ( angle_deg != 0 )
2812 {
2813
2814 orientation[0] = orientation[0] - angle_deg;
2815
2816
2818 if ( MemoryPointExists( "rotate_axis" ) )
2819 {
2820 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2821 }
2822 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];
2823 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];
2824 center[0] = r_center_x;
2825 center[2] = r_center_z;
2826 }
2827 }
2828
2830 {
2832 {
2835 {
2836 if (areaDamage)
2837 {
2838 areaDamage.Destroy();
2839 }
2840
2842 }
2843 }
2844 }
2845
2847 {
2848 return true;
2849 }
2850
2851
2852
2853
2855 {
2857 }
2858
2860 {
2862 }
2863
2865 {
2867 }
2868
2870 {
2872
2873 switch ( material_type )
2874 {
2880 }
2881
2882 return "";
2883 }
2884
2886 {
2888
2889 switch ( material_type )
2890 {
2896 }
2897
2898 return "";
2899 }
2900
2901
2903 {
2905 {
2906
2908 {
2909 SetHealth(slot_name,"Health",item.GetHealth());
2910 }
2911 }
2912 }
2913
2915 {
2916 return 111;
2917 }
2918
2920 {
2921 super.SetActions();
2922
2926 }
2927
2928
2929
2930
2932 {
2933 }
2934
2937 {
2938 return null;
2939 }
2940
2942 {
2944 }
2945
2947 {
2950
2951 Man p;
2952
2953 #ifdef SERVER
2956 if (players.Count())
2957 p = players[0];
2958 #else
2960 #endif
2961
2963 {
2964 bool excluded = false;
2966 if (excludes)
2967 {
2968 foreach (string exclude : excludes)
2969 {
2971 {
2972 excluded = true;
2973 break;
2974 }
2975 }
2976 }
2977
2978 if (!excluded)
2979 {
2981 }
2982 }
2983
2985 }
2986}
2987
2989{
2990#ifdef BSB_DEBUG
2992#else
2993
2994#endif
2995}
2997{
2998#ifdef BSB_DEBUG_SPAM
3000#else
3001
3002#endif
3003}
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.