1622{
1624
1626
1628
1630
1636
1637
1638
1644
1650
1652
1656
1657
1659 {
1661
1662
1663 RegisterNetSyncVariableInt( "m_SyncParts01" );
1664 RegisterNetSyncVariableInt( "m_SyncParts02" );
1665 RegisterNetSyncVariableInt( "m_SyncParts03" );
1666 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1667 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1668 RegisterNetSyncVariableBool( "m_HasBase" );
1669
1670
1672
1673 if (ConfigIsExisting("hybridAttachments"))
1674 {
1677 }
1678 if (ConfigIsExisting("mountables"))
1679 {
1682 }
1683
1685 }
1686
1688 {
1689 super.EEDelete(parent);
1690
1692 {
1693 areaDamage.Destroy();
1694 }
1695
1696 }
1697
1699 {
1700 return "disableBaseDamage";
1701 }
1702
1704 {
1705 return true;
1706 }
1707
1709 {
1710 return EInventoryIconVisibility.HIDE_VICINITY;
1711 }
1712
1713
1715 {
1717 {
1718 SetSynchDirty();
1719 }
1720 }
1721
1723 {
1725 super.OnVariablesSynchronized();
1726
1728 }
1729
1731 {
1732
1734
1735
1737
1738
1740 }
1741
1742
1744 {
1745
1746 int offset;
1747 int mask;
1748
1749 if ( part_id >= 1 && part_id <= 31 )
1750 {
1751 offset = part_id - 1;
1752 mask = 1 << offset;
1753
1755 }
1756 else if ( part_id >= 32 && part_id <= 62 )
1757 {
1758 offset = ( part_id % 32 );
1759 mask = 1 << offset;
1760
1762 }
1763 else if ( part_id >= 63 && part_id <= 93 )
1764 {
1765 offset = ( part_id % 63 );
1766 mask = 1 << offset;
1767
1769 }
1770 }
1771
1773 {
1774
1775 int offset;
1776 int mask;
1777
1778 if ( part_id >= 1 && part_id <= 31 )
1779 {
1780 offset = part_id - 1;
1781 mask = 1 << offset;
1782
1784 }
1785 else if ( part_id >= 32 && part_id <= 62 )
1786 {
1787 offset = ( part_id % 32 );
1788 mask = 1 << offset;
1789
1791 }
1792 else if ( part_id >= 63 && part_id <= 93 )
1793 {
1794 offset = ( part_id % 63 );
1795 mask = 1 << offset;
1796
1798 }
1799 }
1800
1802 {
1803
1804 int offset;
1805 int mask;
1806
1807 if ( part_id >= 1 && part_id <= 31 )
1808 {
1809 offset = part_id - 1;
1810 mask = 1 << offset;
1811
1813 {
1814 return true;
1815 }
1816 }
1817 else if ( part_id >= 32 && part_id <= 62 )
1818 {
1819 offset = ( part_id % 32 );
1820 mask = 1 << offset;
1821
1823 {
1824 return true;
1825 }
1826 }
1827 else if ( part_id >= 63 && part_id <= 93 )
1828 {
1829 offset = ( part_id % 63 );
1830 mask = 1 << offset;
1831
1833 {
1834 return true;
1835 }
1836 }
1837
1838 return false;
1839 }
1840
1842 {
1845 }
1846
1848 {
1849
1852 }
1853
1855 {
1857 {
1860
1861 switch( build_action_id )
1862 {
1866 }
1867 }
1868 }
1869
1870
1872 {
1874 bool is_base = part.
IsBase();
1877 if ( is_part_built_sync )
1878 {
1880 {
1884
1885 if (is_base)
1886 {
1889 }
1890 }
1891 }
1892 else
1893 {
1895 {
1899
1900 if (is_base)
1901 {
1904 }
1905 }
1906 }
1907
1908
1910 }
1911
1912
1914 {
1917
1918 for ( int i = 0; i < construction_parts.Count(); ++i )
1919 {
1920 string key = construction_parts.GetKey( i );
1923 }
1924
1925
1927 }
1928
1930 {
1933
1934 for ( int i = 0; i < construction_parts.Count(); ++i )
1935 {
1936 string key = construction_parts.GetKey( i );
1938
1939 if ( value.
GetId() ==
id )
1940 {
1941 return value;
1942 }
1943 }
1944
1945 return NULL;
1946 }
1947
1948
1949
1951 {
1953 }
1954
1956 {
1958 }
1959
1961 {
1962 return true;
1963 }
1964
1966 {
1967 return false;
1968 }
1969
1970
1972 {
1975 {
1977 }
1978
1979 return construction_kit;
1980 }
1981
1983 {
1986 {
1988 }
1989 }
1990
1992 {
1994 }
1995
1997 {
1998 return "";
1999 }
2000
2002 {
2005 }
2006
2007
2009 {
2012 }
2013
2014
2016 {
2017 super.OnStoreSave( ctx );
2018
2019
2023
2025 }
2026
2028 {
2029 if ( !super.OnStoreLoad( ctx, version ) )
2030 return false;
2031
2032
2033
2035 {
2037 return false;
2038 }
2040 {
2042 return false;
2043 }
2045 {
2047 return false;
2048 }
2049
2050
2052 {
2054 return false;
2055 }
2056
2057
2058 return true;
2059 }
2060
2062 {
2063 super.AfterStoreLoad();
2064
2066 {
2068 }
2069 }
2070
2072 {
2073
2075
2076
2079
2080
2082 }
2083
2085 {
2086 super.OnCreatePhysics();
2089 }
2090
2092 {
2094 return;
2095
2096 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2097
2099 return;
2100
2102 string part_name = zone;
2104
2106 {
2107 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2108
2109 if ( construction_part && construction.IsPartConstructed( part_name ) )
2110 {
2112 construction.DestroyConnectedParts(part_name);
2113 }
2114
2115
2116 if ( part_name.
Contains(
"barbed") )
2117 {
2118 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2119 if (barbed_wire)
2120 barbed_wire.SetMountedState( false );
2121 }
2122 }
2123 }
2124
2126 {
2128 {
2130 }
2131
2132 super.EEOnAfterLoad();
2133 }
2134
2136 {
2137 super.EEInit();
2138
2139
2141
2142
2143 #ifdef DEVELOPER
2145 #endif
2146 }
2147
2149 {
2150 super.EEItemAttached( item, slot_name );
2151
2155 }
2156
2158 {
2159 super.EEItemDetached( item, slot_name );
2160
2163 }
2164
2165 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2166 {
2169
2172 }
2173
2174
2176 {
2177 return true;
2178 }
2179
2180
2181
2183 {
2185
2186
2187 if (construtionPart.
IsBase())
2188 {
2190
2191
2193 }
2194
2195
2197
2198
2200
2201
2203
2205
2207
2208
2210
2211
2213 }
2214
2216 {
2217
2219 }
2220
2221
2223 {
2226
2227
2229
2230
2232
2233
2235
2236
2238
2240
2241
2243
2244
2246
2247
2248 if (construtionPart.
IsBase())
2249 {
2250
2252 }
2253
2256 }
2257
2259 {
2260
2262 }
2263
2264
2265 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2266 {
2269
2270
2272
2273
2275
2276
2278
2279
2281
2283
2284
2286
2287
2289
2290
2291 if (construtionPart.
IsBase())
2292 {
2293
2295 }
2296
2299 }
2300
2302 {
2303
2305 }
2306
2308 {
2309 bool process = false;
2310
2311
2315
2316 if (process)
2317 {
2318 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2319 {
2321 return;
2322 }
2323
2325 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2326 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2327
2328
2330 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2331 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2332 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2333 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2334 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2335 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2336 mins = minTmp;
2337 maxs = maxTmp;
2338
2339 maxs[1] = maxs[1] + 0.35;
2340
2342 }
2343 }
2344
2346 {
2349
2350
2352 foreach (
EntityAI entity : foundEntities)
2353 {
2356 }
2357 }
2358
2359
2361 {
2363
2367 }
2368
2370 {
2372
2374 {
2376 }
2377 else
2378 {
2380 }
2381
2383 }
2384
2386 {
2388
2390 foreach (
string slotName : attachmentSlots)
2391 {
2393 }
2394
2395
2398 else
2400
2402 }
2403
2405 {
2406 string slotNameMounted = slot_name + "_Mounted";
2407 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2408
2409 if (attachment)
2410 {
2411 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2412 if (barbedWire && barbedWire.IsMounted())
2414 else
2416
2417 if (is_locked)
2418 {
2419 SetAnimationPhase(slotNameMounted, 0);
2420 SetAnimationPhase(slot_name, 1);
2421 }
2422 else
2423 {
2424 SetAnimationPhase(slotNameMounted, 1);
2425 SetAnimationPhase(slot_name, 0);
2426 }
2427 }
2428 else
2429 {
2430 SetAnimationPhase(slotNameMounted, 1);
2431 SetAnimationPhase(slot_name, 1);
2432
2434 }
2435 }
2436
2437
2439 {
2442
2445
2448
2449 foreach (
string slotName : attachmentSlots)
2450 {
2452 }
2453
2454
2456 {
2459
2461 }
2462 else
2463 {
2466
2468 }
2469
2472 }
2473
2475 {
2476
2478 return;
2479
2480 string slot_name_mounted = slot_name + "_Mounted";
2481 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2482
2483
2485 RemoveProxyPhysics( slot_name_mounted );
2486 RemoveProxyPhysics( slot_name );
2487
2488 if ( attachment )
2489 {
2491 if ( is_locked )
2492 {
2494 AddProxyPhysics( slot_name_mounted );
2495 }
2496 else
2497 {
2499 AddProxyPhysics( slot_name );
2500 }
2501 }
2502 }
2503
2505 {
2506 SetAffectPathgraph( true, false );
2508 }
2509
2511 {
2512 return true;
2513 }
2514
2516 {
2517 return true;
2518 }
2519
2521 {
2522 if ( attachment )
2523 {
2525 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2526
2527 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2528 }
2529
2530 return false;
2531 }
2532
2534 {
2536 }
2537
2538
2540 {
2541 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2542 if (
GetGame().ConfigIsExisting( config_path ) )
2543 {
2545 }
2546 }
2547
2549 {
2550 return true;
2551 }
2552
2554 {
2555 return true;
2556 }
2557
2559 {
2560 return true;
2561 }
2562
2563
2565 {
2567 {
2569 }
2570
2572 }
2573
2575 {
2577 }
2578
2579
2580
2582 {
2583 return super.CanReceiveAttachment(attachment, slotId);
2584 }
2585
2587 {
2588 int attachment_count = GetInventory().AttachmentCount();
2589 if ( attachment_count > 0 )
2590 {
2591 if (
HasBase() && attachment_count == 1 )
2592 {
2593 return false;
2594 }
2595
2596 return true;
2597 }
2598
2599 return false;
2600 }
2601
2603 {
2604 return true;
2605 }
2606
2608 {
2609 return false;
2610 }
2611
2612
2614 {
2615 return false;
2616 }
2617
2619 {
2620 return false;
2621 }
2622
2623
2625 {
2626 return false;
2627 }
2628
2629
2630
2632 {
2633 return true;
2634 }
2635
2637 {
2638 return true;
2639 }
2640
2643 {
2644 return false;
2645 }
2646
2647
2649 {
2650 return true;
2651 }
2652
2653
2655 {
2656 return false;
2657 }
2658
2659
2661 {
2662 return true;
2663 }
2664
2665
2667 {
2668 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2669 {
2670 return false;
2671 }
2672
2673 return true;
2674 }
2675
2677 {
2680
2681 return item;
2682 }
2683
2684
2686 {
2688 {
2689
2691
2692
2695
2697 if ( MemoryPointExists( slot_name + "_min" ) )
2698 {
2699 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2700 }
2701 if ( MemoryPointExists( slot_name + "_max" ) )
2702 {
2703 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2704 }
2705
2706
2709
2710
2713 center = ModelToWorld( center );
2714
2715
2718
2719 areaDamage.SetExtents( extents[0], extents[1] );
2720 areaDamage.SetAreaPosition( center );
2721 areaDamage.SetAreaOrientation( orientation );
2724 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2725 areaDamage.SetAmmoName( "BarbedWireHit" );
2726 areaDamage.Spawn();
2727
2729 }
2730 }
2731
2733 {
2734 if ( angle_deg != 0 )
2735 {
2736
2737 orientation[0] = orientation[0] - angle_deg;
2738
2739
2741 if ( MemoryPointExists( "rotate_axis" ) )
2742 {
2743 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2744 }
2745 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];
2746 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];
2747 center[0] = r_center_x;
2748 center[2] = r_center_z;
2749 }
2750 }
2751
2753 {
2755 {
2758 {
2759 if (areaDamage)
2760 {
2761 areaDamage.Destroy();
2762 }
2763
2765 }
2766 }
2767 }
2768
2770 {
2771 return true;
2772 }
2773
2774
2775
2776
2778 {
2780 }
2781
2783 {
2785 }
2786
2788 {
2790 }
2791
2793 {
2795
2796 switch ( material_type )
2797 {
2803 }
2804
2805 return "";
2806 }
2807
2809 {
2811
2812 switch ( material_type )
2813 {
2819 }
2820
2821 return "";
2822 }
2823
2824
2826 {
2828 {
2829
2831 {
2832 SetHealth(slot_name,"Health",item.GetHealth());
2833 }
2834 }
2835 }
2836
2838 {
2839 return 111;
2840 }
2841
2843 {
2844 super.SetActions();
2845
2849 }
2850
2851
2852
2853
2855 {
2856 }
2857
2860 {
2861 return null;
2862 }
2863
2865 {
2867 }
2868
2870 {
2873
2874 Man p;
2875
2876 #ifdef SERVER
2879 if (players.Count())
2880 p = players[0];
2881 #else
2883 #endif
2884
2886 {
2887 bool excluded = false;
2889 if (excludes)
2890 {
2891 foreach (string exclude : excludes)
2892 {
2894 {
2895 excluded = true;
2896 break;
2897 }
2898 }
2899 }
2900
2901 if (!excluded)
2902 {
2904 }
2905 }
2906
2908 }
2909}
2910
2912{
2913#ifdef BSB_DEBUG
2915#else
2916
2917#endif
2918}
2920{
2921#ifdef BSB_DEBUG_SPAM
2923#else
2924
2925#endif
2926}
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.