1663{
1665
1667
1669
1671
1677
1678
1679
1685
1691
1693
1697
1698
1700 {
1702
1703
1704 RegisterNetSyncVariableInt( "m_SyncParts01" );
1705 RegisterNetSyncVariableInt( "m_SyncParts02" );
1706 RegisterNetSyncVariableInt( "m_SyncParts03" );
1707 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1708 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1709 RegisterNetSyncVariableBool( "m_HasBase" );
1710
1711
1713
1714 if (ConfigIsExisting("hybridAttachments"))
1715 {
1718 }
1719 if (ConfigIsExisting("mountables"))
1720 {
1723 }
1724
1726 }
1727
1729 {
1730 super.EEDelete(parent);
1731
1733 {
1734 areaDamage.Destroy();
1735 }
1736
1737 }
1738
1740 {
1741 return "disableBaseDamage";
1742 }
1743
1745 {
1746 return true;
1747 }
1748
1750 {
1751 return EInventoryIconVisibility.HIDE_VICINITY;
1752 }
1753
1754
1756 {
1758 {
1759 SetSynchDirty();
1760 }
1761 }
1762
1764 {
1766 super.OnVariablesSynchronized();
1767
1769 }
1770
1772 {
1773
1775
1776
1778
1779
1781 }
1782
1783
1785 {
1786
1787 int offset;
1788 int mask;
1789
1790 if ( part_id >= 1 && part_id <= 31 )
1791 {
1792 offset = part_id - 1;
1793 mask = 1 << offset;
1794
1796 }
1797 else if ( part_id >= 32 && part_id <= 62 )
1798 {
1799 offset = ( part_id % 32 );
1800 mask = 1 << offset;
1801
1803 }
1804 else if ( part_id >= 63 && part_id <= 93 )
1805 {
1806 offset = ( part_id % 63 );
1807 mask = 1 << offset;
1808
1810 }
1811 }
1812
1814 {
1815
1816 int offset;
1817 int mask;
1818
1819 if ( part_id >= 1 && part_id <= 31 )
1820 {
1821 offset = part_id - 1;
1822 mask = 1 << offset;
1823
1825 }
1826 else if ( part_id >= 32 && part_id <= 62 )
1827 {
1828 offset = ( part_id % 32 );
1829 mask = 1 << offset;
1830
1832 }
1833 else if ( part_id >= 63 && part_id <= 93 )
1834 {
1835 offset = ( part_id % 63 );
1836 mask = 1 << offset;
1837
1839 }
1840 }
1841
1843 {
1844
1845 int offset;
1846 int mask;
1847
1848 if ( part_id >= 1 && part_id <= 31 )
1849 {
1850 offset = part_id - 1;
1851 mask = 1 << offset;
1852
1854 {
1855 return true;
1856 }
1857 }
1858 else if ( part_id >= 32 && part_id <= 62 )
1859 {
1860 offset = ( part_id % 32 );
1861 mask = 1 << offset;
1862
1864 {
1865 return true;
1866 }
1867 }
1868 else if ( part_id >= 63 && part_id <= 93 )
1869 {
1870 offset = ( part_id % 63 );
1871 mask = 1 << offset;
1872
1874 {
1875 return true;
1876 }
1877 }
1878
1879 return false;
1880 }
1881
1883 {
1886 }
1887
1889 {
1890
1893 }
1894
1896 {
1898 {
1901
1902 switch( build_action_id )
1903 {
1907 }
1908 }
1909 }
1910
1911
1913 {
1915 bool is_base = part.
IsBase();
1918 if ( is_part_built_sync )
1919 {
1921 {
1925
1926 if (is_base)
1927 {
1930 }
1931 }
1932 }
1933 else
1934 {
1936 {
1940
1941 if (is_base)
1942 {
1945 }
1946 }
1947 }
1948
1949
1951 }
1952
1953
1955 {
1958
1959 for ( int i = 0; i < construction_parts.Count(); ++i )
1960 {
1961 string key = construction_parts.GetKey( i );
1964 }
1965
1966
1968 }
1969
1971 {
1974
1975 for ( int i = 0; i < construction_parts.Count(); ++i )
1976 {
1977 string key = construction_parts.GetKey( i );
1979
1980 if ( value.
GetId() ==
id )
1981 {
1982 return value;
1983 }
1984 }
1985
1986 return NULL;
1987 }
1988
1989
1990
1992 {
1994 }
1995
1997 {
1999 }
2000
2002 {
2003 return true;
2004 }
2005
2007 {
2008 return false;
2009 }
2010
2011
2013 {
2016 {
2018 }
2019
2020 return construction_kit;
2021 }
2022
2024 {
2027 {
2029 }
2030 }
2031
2033 {
2035 }
2036
2038 {
2039 return "";
2040 }
2041
2043 {
2046 }
2047
2048
2050 {
2053 }
2054
2055
2057 {
2058 super.OnStoreSave( ctx );
2059
2060
2064
2066 }
2067
2069 {
2070 if ( !super.OnStoreLoad( ctx, version ) )
2071 return false;
2072
2073
2074
2076 {
2078 return false;
2079 }
2081 {
2083 return false;
2084 }
2086 {
2088 return false;
2089 }
2090
2091
2093 {
2095 return false;
2096 }
2097
2098
2099 return true;
2100 }
2101
2103 {
2104 super.AfterStoreLoad();
2105
2107 {
2109 }
2110 }
2111
2113 {
2114
2116
2117
2120
2121
2123 }
2124
2126 {
2127 super.OnCreatePhysics();
2130 }
2131
2133 {
2135 return;
2136
2137 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2138
2140 return;
2141
2143 string part_name = zone;
2145
2147 {
2148 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2149
2150 if ( construction_part && construction.IsPartConstructed( part_name ) )
2151 {
2153 construction.DestroyConnectedParts(part_name);
2154 }
2155
2156
2157 if ( part_name.
Contains(
"barbed") )
2158 {
2159 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2160 if (barbed_wire)
2161 barbed_wire.SetMountedState( false );
2162 }
2163 }
2164 }
2165
2167 {
2169 {
2171 }
2172
2173 super.EEOnAfterLoad();
2174 }
2175
2177 {
2178 super.EEInit();
2179
2180
2182
2183
2184 #ifdef DEVELOPER
2186 #endif
2187 }
2188
2190 {
2191 super.EEItemAttached( item, slot_name );
2192
2196 }
2197
2199 {
2200 super.EEItemDetached( item, slot_name );
2201
2204 }
2205
2206 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2207 {
2210
2213 }
2214
2215
2217 {
2218 return true;
2219 }
2220
2221
2222
2224 {
2226
2227
2228 if (construtionPart.
IsBase())
2229 {
2231
2232
2234 }
2235
2236
2238
2239
2241
2242
2244
2246
2248
2249
2251
2252
2254 }
2255
2257 {
2258
2260 }
2261
2262
2264 {
2267
2268
2270
2271
2273
2274
2276
2277
2279
2281
2282
2284
2285
2287
2288
2289 if (construtionPart.
IsBase())
2290 {
2291
2293 }
2294
2297 }
2298
2300 {
2301
2303 }
2304
2305
2306 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2307 {
2310
2311
2313
2314
2316
2317
2319
2320
2322
2324
2325
2327
2328
2330
2331
2332 if (construtionPart.
IsBase())
2333 {
2334
2336 }
2337
2340 }
2341
2343 {
2344
2346 }
2347
2349 {
2350 bool process = false;
2351
2352
2356
2357 if (process)
2358 {
2359 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2360 {
2362 return;
2363 }
2364
2366 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2367 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2368
2369
2371 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2372 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2373 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2374 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2375 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2376 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2377 mins = minTmp;
2378 maxs = maxTmp;
2379
2380 maxs[1] = maxs[1] + 0.35;
2381
2383 }
2384 }
2385
2387 {
2390
2391
2393 foreach (
EntityAI entity : foundEntities)
2394 {
2397 }
2398 }
2399
2400
2402 {
2404
2408 }
2409
2411 {
2413
2415 {
2417 }
2418 else
2419 {
2421 }
2422
2424 }
2425
2427 {
2429
2431 foreach (
string slotName : attachmentSlots)
2432 {
2434 }
2435
2436
2439 else
2441
2443 }
2444
2446 {
2447 string slotNameMounted = slot_name + "_Mounted";
2448 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2449
2450 if (attachment)
2451 {
2452 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2453 if (barbedWire && barbedWire.IsMounted())
2455 else
2457
2458 if (is_locked)
2459 {
2460 SetAnimationPhase(slotNameMounted, 0);
2461 SetAnimationPhase(slot_name, 1);
2462 }
2463 else
2464 {
2465 SetAnimationPhase(slotNameMounted, 1);
2466 SetAnimationPhase(slot_name, 0);
2467 }
2468 }
2469 else
2470 {
2471 SetAnimationPhase(slotNameMounted, 1);
2472 SetAnimationPhase(slot_name, 1);
2473
2475 }
2476 }
2477
2478
2480 {
2483
2486
2489
2490 foreach (
string slotName : attachmentSlots)
2491 {
2493 }
2494
2495
2497 {
2500
2502 }
2503 else
2504 {
2507
2509 }
2510
2513 }
2514
2516 {
2517
2519 return;
2520
2521 string slot_name_mounted = slot_name + "_Mounted";
2522 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2523
2524
2526 RemoveProxyPhysics( slot_name_mounted );
2527 RemoveProxyPhysics( slot_name );
2528
2529 if ( attachment )
2530 {
2532 if ( is_locked )
2533 {
2535 AddProxyPhysics( slot_name_mounted );
2536 }
2537 else
2538 {
2540 AddProxyPhysics( slot_name );
2541 }
2542 }
2543 }
2544
2546 {
2547 SetAffectPathgraph( true, false );
2549 }
2550
2552 {
2553 return true;
2554 }
2555
2557 {
2558 return true;
2559 }
2560
2562 {
2563 if ( attachment )
2564 {
2566 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2567
2568 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2569 }
2570
2571 return false;
2572 }
2573
2575 {
2577 }
2578
2579
2581 {
2582 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2583 if (
GetGame().ConfigIsExisting( config_path ) )
2584 {
2586 }
2587 }
2588
2590 {
2591 return true;
2592 }
2593
2595 {
2596 return true;
2597 }
2598
2600 {
2601 return true;
2602 }
2603
2604
2606 {
2608 {
2610 }
2611
2613 }
2614
2616 {
2618 }
2619
2620
2621
2623 {
2624 return super.CanReceiveAttachment(attachment, slotId);
2625 }
2626
2628 {
2629 int attachment_count = GetInventory().AttachmentCount();
2630 if ( attachment_count > 0 )
2631 {
2632 if (
HasBase() && attachment_count == 1 )
2633 {
2634 return false;
2635 }
2636
2637 return true;
2638 }
2639
2640 return false;
2641 }
2642
2644 {
2645 return true;
2646 }
2647
2649 {
2650 return false;
2651 }
2652
2653
2655 {
2656 return false;
2657 }
2658
2660 {
2661 return false;
2662 }
2663
2664
2666 {
2667 return false;
2668 }
2669
2670
2671
2673 {
2674 return true;
2675 }
2676
2678 {
2679 return true;
2680 }
2681
2684 {
2685 return false;
2686 }
2687
2688
2690 {
2691 return true;
2692 }
2693
2694
2696 {
2697 return false;
2698 }
2699
2700
2702 {
2703 return true;
2704 }
2705
2706
2708 {
2709 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2710 {
2711 return false;
2712 }
2713
2714 return true;
2715 }
2716
2718 {
2721
2722 return item;
2723 }
2724
2725
2727 {
2729 {
2730
2732
2733
2736
2738 if ( MemoryPointExists( slot_name + "_min" ) )
2739 {
2740 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2741 }
2742 if ( MemoryPointExists( slot_name + "_max" ) )
2743 {
2744 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2745 }
2746
2747
2750
2751
2754 center = ModelToWorld( center );
2755
2756
2759
2760 areaDamage.SetExtents( extents[0], extents[1] );
2761 areaDamage.SetAreaPosition( center );
2762 areaDamage.SetAreaOrientation( orientation );
2765 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2766 areaDamage.SetAmmoName( "BarbedWireHit" );
2767 areaDamage.Spawn();
2768
2770 }
2771 }
2772
2774 {
2775 if ( angle_deg != 0 )
2776 {
2777
2778 orientation[0] = orientation[0] - angle_deg;
2779
2780
2782 if ( MemoryPointExists( "rotate_axis" ) )
2783 {
2784 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2785 }
2786 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];
2787 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];
2788 center[0] = r_center_x;
2789 center[2] = r_center_z;
2790 }
2791 }
2792
2794 {
2796 {
2799 {
2800 if (areaDamage)
2801 {
2802 areaDamage.Destroy();
2803 }
2804
2806 }
2807 }
2808 }
2809
2811 {
2812 return true;
2813 }
2814
2815
2816
2817
2819 {
2821 }
2822
2824 {
2826 }
2827
2829 {
2831 }
2832
2834 {
2836
2837 switch ( material_type )
2838 {
2844 }
2845
2846 return "";
2847 }
2848
2850 {
2852
2853 switch ( material_type )
2854 {
2860 }
2861
2862 return "";
2863 }
2864
2865
2867 {
2869 {
2870
2872 {
2873 SetHealth(slot_name,"Health",item.GetHealth());
2874 }
2875 }
2876 }
2877
2879 {
2880 return 111;
2881 }
2882
2884 {
2885 super.SetActions();
2886
2890 }
2891
2892
2893
2894
2896 {
2897 }
2898
2901 {
2902 return null;
2903 }
2904
2906 {
2908 }
2909
2911 {
2914
2915 Man p;
2916
2917 #ifdef SERVER
2920 if (players.Count())
2921 p = players[0];
2922 #else
2924 #endif
2925
2927 {
2928 bool excluded = false;
2930 if (excludes)
2931 {
2932 foreach (string exclude : excludes)
2933 {
2935 {
2936 excluded = true;
2937 break;
2938 }
2939 }
2940 }
2941
2942 if (!excluded)
2943 {
2945 }
2946 }
2947
2949 }
2950}
2951
2953{
2954#ifdef BSB_DEBUG
2956#else
2957
2958#endif
2959}
2961{
2962#ifdef BSB_DEBUG_SPAM
2964#else
2965
2966#endif
2967}
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.