1643{
1645
1647
1649
1651
1657
1658
1659
1665
1671
1673
1677
1678
1680 {
1682
1683
1684 RegisterNetSyncVariableInt( "m_SyncParts01" );
1685 RegisterNetSyncVariableInt( "m_SyncParts02" );
1686 RegisterNetSyncVariableInt( "m_SyncParts03" );
1687 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1688 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1689 RegisterNetSyncVariableBool( "m_HasBase" );
1690
1691
1693
1694 if (ConfigIsExisting("hybridAttachments"))
1695 {
1698 }
1699 if (ConfigIsExisting("mountables"))
1700 {
1703 }
1704
1706 }
1707
1709 {
1710 super.EEDelete(parent);
1711
1713 {
1714 areaDamage.Destroy();
1715 }
1716
1717 }
1718
1720 {
1721 return "disableBaseDamage";
1722 }
1723
1725 {
1726 return true;
1727 }
1728
1730 {
1731 return EInventoryIconVisibility.HIDE_VICINITY;
1732 }
1733
1734
1736 {
1738 {
1739 SetSynchDirty();
1740 }
1741 }
1742
1744 {
1746 super.OnVariablesSynchronized();
1747
1749 }
1750
1752 {
1753
1755
1756
1758
1759
1761 }
1762
1763
1765 {
1766
1767 int offset;
1768 int mask;
1769
1770 if ( part_id >= 1 && part_id <= 31 )
1771 {
1772 offset = part_id - 1;
1773 mask = 1 << offset;
1774
1776 }
1777 else if ( part_id >= 32 && part_id <= 62 )
1778 {
1779 offset = ( part_id % 32 );
1780 mask = 1 << offset;
1781
1783 }
1784 else if ( part_id >= 63 && part_id <= 93 )
1785 {
1786 offset = ( part_id % 63 );
1787 mask = 1 << offset;
1788
1790 }
1791 }
1792
1794 {
1795
1796 int offset;
1797 int mask;
1798
1799 if ( part_id >= 1 && part_id <= 31 )
1800 {
1801 offset = part_id - 1;
1802 mask = 1 << offset;
1803
1805 }
1806 else if ( part_id >= 32 && part_id <= 62 )
1807 {
1808 offset = ( part_id % 32 );
1809 mask = 1 << offset;
1810
1812 }
1813 else if ( part_id >= 63 && part_id <= 93 )
1814 {
1815 offset = ( part_id % 63 );
1816 mask = 1 << offset;
1817
1819 }
1820 }
1821
1823 {
1824
1825 int offset;
1826 int mask;
1827
1828 if ( part_id >= 1 && part_id <= 31 )
1829 {
1830 offset = part_id - 1;
1831 mask = 1 << offset;
1832
1834 {
1835 return true;
1836 }
1837 }
1838 else if ( part_id >= 32 && part_id <= 62 )
1839 {
1840 offset = ( part_id % 32 );
1841 mask = 1 << offset;
1842
1844 {
1845 return true;
1846 }
1847 }
1848 else if ( part_id >= 63 && part_id <= 93 )
1849 {
1850 offset = ( part_id % 63 );
1851 mask = 1 << offset;
1852
1854 {
1855 return true;
1856 }
1857 }
1858
1859 return false;
1860 }
1861
1863 {
1866 }
1867
1869 {
1870
1873 }
1874
1876 {
1878 {
1881
1882 switch( build_action_id )
1883 {
1887 }
1888 }
1889 }
1890
1891
1893 {
1895 bool is_base = part.
IsBase();
1898 if ( is_part_built_sync )
1899 {
1901 {
1905
1906 if (is_base)
1907 {
1910 }
1911 }
1912 }
1913 else
1914 {
1916 {
1920
1921 if (is_base)
1922 {
1925 }
1926 }
1927 }
1928
1929
1931 }
1932
1933
1935 {
1938
1939 for ( int i = 0; i < construction_parts.Count(); ++i )
1940 {
1941 string key = construction_parts.GetKey( i );
1944 }
1945
1946
1948 }
1949
1951 {
1954
1955 for ( int i = 0; i < construction_parts.Count(); ++i )
1956 {
1957 string key = construction_parts.GetKey( i );
1959
1960 if ( value.
GetId() ==
id )
1961 {
1962 return value;
1963 }
1964 }
1965
1966 return NULL;
1967 }
1968
1969
1970
1972 {
1974 }
1975
1977 {
1979 }
1980
1982 {
1983 return true;
1984 }
1985
1987 {
1988 return false;
1989 }
1990
1991
1993 {
1996 {
1998 }
1999
2000 return construction_kit;
2001 }
2002
2004 {
2007 {
2009 }
2010 }
2011
2013 {
2015 }
2016
2018 {
2019 return "";
2020 }
2021
2023 {
2026 }
2027
2028
2030 {
2033 }
2034
2035
2037 {
2038 super.OnStoreSave( ctx );
2039
2040
2044
2046 }
2047
2049 {
2050 if ( !super.OnStoreLoad( ctx, version ) )
2051 return false;
2052
2053
2054
2056 {
2058 return false;
2059 }
2061 {
2063 return false;
2064 }
2066 {
2068 return false;
2069 }
2070
2071
2073 {
2075 return false;
2076 }
2077
2078
2079 return true;
2080 }
2081
2083 {
2084 super.AfterStoreLoad();
2085
2087 {
2089 }
2090 }
2091
2093 {
2094
2096
2097
2100
2101
2103 }
2104
2106 {
2107 super.OnCreatePhysics();
2110 }
2111
2113 {
2115 return;
2116
2117 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2118
2120 return;
2121
2123 string part_name = zone;
2125
2127 {
2128 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2129
2130 if ( construction_part && construction.IsPartConstructed( part_name ) )
2131 {
2133 construction.DestroyConnectedParts(part_name);
2134 }
2135
2136
2137 if ( part_name.
Contains(
"barbed") )
2138 {
2139 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2140 if (barbed_wire)
2141 barbed_wire.SetMountedState( false );
2142 }
2143 }
2144 }
2145
2147 {
2149 {
2151 }
2152
2153 super.EEOnAfterLoad();
2154 }
2155
2157 {
2158 super.EEInit();
2159
2160
2162
2163
2164 #ifdef DEVELOPER
2166 #endif
2167 }
2168
2170 {
2171 super.EEItemAttached( item, slot_name );
2172
2176 }
2177
2179 {
2180 super.EEItemDetached( item, slot_name );
2181
2184 }
2185
2186 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2187 {
2190
2193 }
2194
2195
2197 {
2198 return true;
2199 }
2200
2201
2202
2204 {
2206
2207
2208 if (construtionPart.
IsBase())
2209 {
2211
2212
2214 }
2215
2216
2218
2219
2221
2222
2224
2226
2228
2229
2231
2232
2234 }
2235
2237 {
2238
2240 }
2241
2242
2244 {
2247
2248
2250
2251
2253
2254
2256
2257
2259
2261
2262
2264
2265
2267
2268
2269 if (construtionPart.
IsBase())
2270 {
2271
2273 }
2274
2277 }
2278
2280 {
2281
2283 }
2284
2285
2286 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2287 {
2290
2291
2293
2294
2296
2297
2299
2300
2302
2304
2305
2307
2308
2310
2311
2312 if (construtionPart.
IsBase())
2313 {
2314
2316 }
2317
2320 }
2321
2323 {
2324
2326 }
2327
2329 {
2330 bool process = false;
2331
2332
2336
2337 if (process)
2338 {
2339 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2340 {
2342 return;
2343 }
2344
2346 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2347 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2348
2349
2351 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2352 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2353 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2354 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2355 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2356 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2357 mins = minTmp;
2358 maxs = maxTmp;
2359
2360 maxs[1] = maxs[1] + 0.35;
2361
2363 }
2364 }
2365
2367 {
2370
2371
2373 foreach (
EntityAI entity : foundEntities)
2374 {
2377 }
2378 }
2379
2380
2382 {
2384
2388 }
2389
2391 {
2393
2395 {
2397 }
2398 else
2399 {
2401 }
2402
2404 }
2405
2407 {
2409
2411 foreach (
string slotName : attachmentSlots)
2412 {
2414 }
2415
2416
2419 else
2421
2423 }
2424
2426 {
2427 string slotNameMounted = slot_name + "_Mounted";
2428 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2429
2430 if (attachment)
2431 {
2432 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2433 if (barbedWire && barbedWire.IsMounted())
2435 else
2437
2438 if (is_locked)
2439 {
2440 SetAnimationPhase(slotNameMounted, 0);
2441 SetAnimationPhase(slot_name, 1);
2442 }
2443 else
2444 {
2445 SetAnimationPhase(slotNameMounted, 1);
2446 SetAnimationPhase(slot_name, 0);
2447 }
2448 }
2449 else
2450 {
2451 SetAnimationPhase(slotNameMounted, 1);
2452 SetAnimationPhase(slot_name, 1);
2453
2455 }
2456 }
2457
2458
2460 {
2463
2466
2469
2470 foreach (
string slotName : attachmentSlots)
2471 {
2473 }
2474
2475
2477 {
2480
2482 }
2483 else
2484 {
2487
2489 }
2490
2493 }
2494
2496 {
2497
2499 return;
2500
2501 string slot_name_mounted = slot_name + "_Mounted";
2502 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2503
2504
2506 RemoveProxyPhysics( slot_name_mounted );
2507 RemoveProxyPhysics( slot_name );
2508
2509 if ( attachment )
2510 {
2512 if ( is_locked )
2513 {
2515 AddProxyPhysics( slot_name_mounted );
2516 }
2517 else
2518 {
2520 AddProxyPhysics( slot_name );
2521 }
2522 }
2523 }
2524
2526 {
2527 SetAffectPathgraph( true, false );
2529 }
2530
2532 {
2533 return true;
2534 }
2535
2537 {
2538 return true;
2539 }
2540
2542 {
2543 if ( attachment )
2544 {
2546 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2547
2548 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2549 }
2550
2551 return false;
2552 }
2553
2555 {
2557 }
2558
2559
2561 {
2562 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2563 if (
GetGame().ConfigIsExisting( config_path ) )
2564 {
2566 }
2567 }
2568
2570 {
2571 return true;
2572 }
2573
2575 {
2576 return true;
2577 }
2578
2580 {
2581 return true;
2582 }
2583
2584
2586 {
2588 {
2590 }
2591
2593 }
2594
2596 {
2598 }
2599
2600
2601
2603 {
2604 return super.CanReceiveAttachment(attachment, slotId);
2605 }
2606
2608 {
2609 int attachment_count = GetInventory().AttachmentCount();
2610 if ( attachment_count > 0 )
2611 {
2612 if (
HasBase() && attachment_count == 1 )
2613 {
2614 return false;
2615 }
2616
2617 return true;
2618 }
2619
2620 return false;
2621 }
2622
2624 {
2625 return true;
2626 }
2627
2629 {
2630 return false;
2631 }
2632
2633
2635 {
2636 return false;
2637 }
2638
2640 {
2641 return false;
2642 }
2643
2644
2646 {
2647 return false;
2648 }
2649
2650
2651
2653 {
2654 return true;
2655 }
2656
2658 {
2659 return true;
2660 }
2661
2664 {
2665 return false;
2666 }
2667
2668
2670 {
2671 return true;
2672 }
2673
2674
2676 {
2677 return false;
2678 }
2679
2680
2682 {
2683 return true;
2684 }
2685
2686
2688 {
2689 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2690 {
2691 return false;
2692 }
2693
2694 return true;
2695 }
2696
2698 {
2701
2702 return item;
2703 }
2704
2705
2707 {
2709 {
2710
2712
2713
2716
2718 if ( MemoryPointExists( slot_name + "_min" ) )
2719 {
2720 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2721 }
2722 if ( MemoryPointExists( slot_name + "_max" ) )
2723 {
2724 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2725 }
2726
2727
2730
2731
2734 center = ModelToWorld( center );
2735
2736
2739
2740 areaDamage.SetExtents( extents[0], extents[1] );
2741 areaDamage.SetAreaPosition( center );
2742 areaDamage.SetAreaOrientation( orientation );
2745 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2746 areaDamage.SetAmmoName( "BarbedWireHit" );
2747 areaDamage.Spawn();
2748
2750 }
2751 }
2752
2754 {
2755 if ( angle_deg != 0 )
2756 {
2757
2758 orientation[0] = orientation[0] - angle_deg;
2759
2760
2762 if ( MemoryPointExists( "rotate_axis" ) )
2763 {
2764 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2765 }
2766 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];
2767 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];
2768 center[0] = r_center_x;
2769 center[2] = r_center_z;
2770 }
2771 }
2772
2774 {
2776 {
2779 {
2780 if (areaDamage)
2781 {
2782 areaDamage.Destroy();
2783 }
2784
2786 }
2787 }
2788 }
2789
2791 {
2792 return true;
2793 }
2794
2795
2796
2797
2799 {
2801 }
2802
2804 {
2806 }
2807
2809 {
2811 }
2812
2814 {
2816
2817 switch ( material_type )
2818 {
2824 }
2825
2826 return "";
2827 }
2828
2830 {
2832
2833 switch ( material_type )
2834 {
2840 }
2841
2842 return "";
2843 }
2844
2845
2847 {
2849 {
2850
2852 {
2853 SetHealth(slot_name,"Health",item.GetHealth());
2854 }
2855 }
2856 }
2857
2859 {
2860 return 111;
2861 }
2862
2864 {
2865 super.SetActions();
2866
2870 }
2871
2872
2873
2874
2876 {
2877 }
2878
2881 {
2882 return null;
2883 }
2884
2886 {
2888 }
2889
2891 {
2894
2895 Man p;
2896
2897 #ifdef SERVER
2900 if (players.Count())
2901 p = players[0];
2902 #else
2904 #endif
2905
2907 {
2908 bool excluded = false;
2910 if (excludes)
2911 {
2912 foreach (string exclude : excludes)
2913 {
2915 {
2916 excluded = true;
2917 break;
2918 }
2919 }
2920 }
2921
2922 if (!excluded)
2923 {
2925 }
2926 }
2927
2929 }
2930}
2931
2933{
2934#ifdef BSB_DEBUG
2936#else
2937
2938#endif
2939}
2941{
2942#ifdef BSB_DEBUG_SPAM
2944#else
2945
2946#endif
2947}
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.