1585{
1587
1589
1591
1593
1599
1600
1601
1607
1613
1615
1619
1620
1622 {
1624
1625
1626 RegisterNetSyncVariableInt( "m_SyncParts01" );
1627 RegisterNetSyncVariableInt( "m_SyncParts02" );
1628 RegisterNetSyncVariableInt( "m_SyncParts03" );
1629 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1630 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1631 RegisterNetSyncVariableBool( "m_HasBase" );
1632
1633
1635
1636 if (ConfigIsExisting("hybridAttachments"))
1637 {
1640 }
1641 if (ConfigIsExisting("mountables"))
1642 {
1645 }
1646
1648 }
1649
1651 {
1652 super.EEDelete(parent);
1653
1655 {
1656 areaDamage.Destroy();
1657 }
1658
1659 }
1660
1662 {
1663 return "disableBaseDamage";
1664 }
1665
1667 {
1668 return true;
1669 }
1670
1672 {
1673 return EInventoryIconVisibility.HIDE_VICINITY;
1674 }
1675
1676
1678 {
1680 {
1681 SetSynchDirty();
1682 }
1683 }
1684
1686 {
1688 super.OnVariablesSynchronized();
1689
1691 }
1692
1694 {
1695
1697
1698
1700
1701
1703 }
1704
1705
1707 {
1708
1709 int offset;
1710 int mask;
1711
1712 if ( part_id >= 1 && part_id <= 31 )
1713 {
1714 offset = part_id - 1;
1715 mask = 1 << offset;
1716
1718 }
1719 else if ( part_id >= 32 && part_id <= 62 )
1720 {
1721 offset = ( part_id % 32 );
1722 mask = 1 << offset;
1723
1725 }
1726 else if ( part_id >= 63 && part_id <= 93 )
1727 {
1728 offset = ( part_id % 63 );
1729 mask = 1 << offset;
1730
1732 }
1733 }
1734
1736 {
1737
1738 int offset;
1739 int mask;
1740
1741 if ( part_id >= 1 && part_id <= 31 )
1742 {
1743 offset = part_id - 1;
1744 mask = 1 << offset;
1745
1747 }
1748 else if ( part_id >= 32 && part_id <= 62 )
1749 {
1750 offset = ( part_id % 32 );
1751 mask = 1 << offset;
1752
1754 }
1755 else if ( part_id >= 63 && part_id <= 93 )
1756 {
1757 offset = ( part_id % 63 );
1758 mask = 1 << offset;
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 return true;
1778 }
1779 }
1780 else if ( part_id >= 32 && part_id <= 62 )
1781 {
1782 offset = ( part_id % 32 );
1783 mask = 1 << offset;
1784
1786 {
1787 return true;
1788 }
1789 }
1790 else if ( part_id >= 63 && part_id <= 93 )
1791 {
1792 offset = ( part_id % 63 );
1793 mask = 1 << offset;
1794
1796 {
1797 return true;
1798 }
1799 }
1800
1801 return false;
1802 }
1803
1805 {
1808 }
1809
1811 {
1812
1815 }
1816
1818 {
1820 {
1823
1824 switch( build_action_id )
1825 {
1829 }
1830 }
1831 }
1832
1833
1835 {
1837 bool is_base = part.
IsBase();
1840 if ( is_part_built_sync )
1841 {
1843 {
1847
1848 if (is_base)
1849 {
1852 }
1853 }
1854 }
1855 else
1856 {
1858 {
1862
1863 if (is_base)
1864 {
1867 }
1868 }
1869 }
1870
1871
1873 }
1874
1875
1877 {
1880
1881 for ( int i = 0; i < construction_parts.Count(); ++i )
1882 {
1883 string key = construction_parts.GetKey( i );
1886 }
1887
1888
1890 }
1891
1893 {
1896
1897 for ( int i = 0; i < construction_parts.Count(); ++i )
1898 {
1899 string key = construction_parts.GetKey( i );
1901
1902 if ( value.
GetId() ==
id )
1903 {
1904 return value;
1905 }
1906 }
1907
1908 return NULL;
1909 }
1910
1911
1912
1914 {
1916 }
1917
1919 {
1921 }
1922
1924 {
1925 return true;
1926 }
1927
1929 {
1930 return false;
1931 }
1932
1933
1935 {
1938 {
1940 }
1941
1942 return construction_kit;
1943 }
1944
1946 {
1949 {
1951 }
1952 }
1953
1955 {
1957 }
1958
1960 {
1961 return "";
1962 }
1963
1965 {
1968 }
1969
1970
1972 {
1975 }
1976
1977
1979 {
1980 super.OnStoreSave( ctx );
1981
1982
1986
1988 }
1989
1991 {
1992 if ( !super.OnStoreLoad( ctx, version ) )
1993 return false;
1994
1995
1996
1998 {
2000 return false;
2001 }
2003 {
2005 return false;
2006 }
2008 {
2010 return false;
2011 }
2012
2013
2015 {
2017 return false;
2018 }
2019
2020
2021 return true;
2022 }
2023
2025 {
2026 super.AfterStoreLoad();
2027
2029 {
2031 }
2032 }
2033
2035 {
2036
2038
2039
2042
2043
2045 }
2046
2048 {
2049 super.OnCreatePhysics();
2052 }
2053
2055 {
2057 return;
2058
2059 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2060
2062 return;
2063
2065 string part_name = zone;
2067
2069 {
2070 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2071
2072 if ( construction_part && construction.IsPartConstructed( part_name ) )
2073 {
2075 construction.DestroyConnectedParts(part_name);
2076 }
2077
2078
2079 if ( part_name.
Contains(
"barbed") )
2080 {
2081 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2082 if (barbed_wire)
2083 barbed_wire.SetMountedState( false );
2084 }
2085 }
2086 }
2087
2089 {
2091 {
2093 }
2094
2095 super.EEOnAfterLoad();
2096 }
2097
2099 {
2100 super.EEInit();
2101
2102
2104
2105
2106 #ifdef DEVELOPER
2108 #endif
2109 }
2110
2112 {
2113 super.EEItemAttached( item, slot_name );
2114
2118 }
2119
2121 {
2122 super.EEItemDetached( item, slot_name );
2123
2126 }
2127
2128 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2129 {
2132
2135 }
2136
2137
2139 {
2140 return true;
2141 }
2142
2143
2144
2146 {
2148
2149
2150 if (construtionPart.
IsBase())
2151 {
2153
2154
2156 }
2157
2158
2160
2161
2163
2164
2166
2168
2170
2171
2173
2174
2176 }
2177
2179 {
2180
2182 }
2183
2184
2186 {
2189
2190
2192
2193
2195
2196
2198
2199
2201
2203
2204
2206
2207
2209
2210
2211 if (construtionPart.
IsBase())
2212 {
2213
2215 }
2216
2219 }
2220
2222 {
2223
2225 }
2226
2227
2228 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2229 {
2232
2233
2235
2236
2238
2239
2241
2242
2244
2246
2247
2249
2250
2252
2253
2254 if (construtionPart.
IsBase())
2255 {
2256
2258 }
2259
2262 }
2263
2265 {
2266
2268 }
2269
2271 {
2272 bool process = false;
2273
2274
2278
2279 if (process)
2280 {
2281 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2282 {
2284 return;
2285 }
2286
2288 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2289 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2290
2291
2293 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2294 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2295 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2296 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2297 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2298 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2299 mins = minTmp;
2300 maxs = maxTmp;
2301
2302 maxs[1] = maxs[1] + 0.35;
2303
2305 }
2306 }
2307
2309 {
2312
2313
2315 foreach (
EntityAI entity : foundEntities)
2316 {
2319 }
2320 }
2321
2322
2324 {
2326
2330 }
2331
2333 {
2335
2337 {
2339 }
2340 else
2341 {
2343 }
2344
2346 }
2347
2349 {
2351
2353 foreach (
string slotName : attachmentSlots)
2354 {
2356 }
2357
2358
2361 else
2363
2365 }
2366
2368 {
2369 string slotNameMounted = slot_name + "_Mounted";
2370 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2371
2372 if (attachment)
2373 {
2374 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2375 if (barbedWire && barbedWire.IsMounted())
2377 else
2379
2380 if (is_locked)
2381 {
2382 SetAnimationPhase(slotNameMounted, 0);
2383 SetAnimationPhase(slot_name, 1);
2384 }
2385 else
2386 {
2387 SetAnimationPhase(slotNameMounted, 1);
2388 SetAnimationPhase(slot_name, 0);
2389 }
2390 }
2391 else
2392 {
2393 SetAnimationPhase(slotNameMounted, 1);
2394 SetAnimationPhase(slot_name, 1);
2395
2397 }
2398 }
2399
2400
2402 {
2405
2408
2411
2412 foreach (
string slotName : attachmentSlots)
2413 {
2415 }
2416
2417
2419 {
2422
2424 }
2425 else
2426 {
2429
2431 }
2432
2435 }
2436
2438 {
2439
2441 return;
2442
2443 string slot_name_mounted = slot_name + "_Mounted";
2444 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2445
2446
2448 RemoveProxyPhysics( slot_name_mounted );
2449 RemoveProxyPhysics( slot_name );
2450
2451 if ( attachment )
2452 {
2454 if ( is_locked )
2455 {
2457 AddProxyPhysics( slot_name_mounted );
2458 }
2459 else
2460 {
2462 AddProxyPhysics( slot_name );
2463 }
2464 }
2465 }
2466
2468 {
2469 SetAffectPathgraph( true, false );
2471 }
2472
2474 {
2475 return true;
2476 }
2477
2479 {
2480 return true;
2481 }
2482
2484 {
2485 if ( attachment )
2486 {
2488 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2489
2490 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2491 }
2492
2493 return false;
2494 }
2495
2497 {
2499 }
2500
2501
2503 {
2504 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2505 if (
GetGame().ConfigIsExisting( config_path ) )
2506 {
2508 }
2509 }
2510
2512 {
2513 return true;
2514 }
2515
2517 {
2518 return true;
2519 }
2520
2522 {
2523 return true;
2524 }
2525
2526
2528 {
2530 {
2532 }
2533
2535 }
2536
2538 {
2540 }
2541
2542
2543
2545 {
2546 return super.CanReceiveAttachment(attachment, slotId);
2547 }
2548
2550 {
2551 int attachment_count = GetInventory().AttachmentCount();
2552 if ( attachment_count > 0 )
2553 {
2554 if (
HasBase() && attachment_count == 1 )
2555 {
2556 return false;
2557 }
2558
2559 return true;
2560 }
2561
2562 return false;
2563 }
2564
2566 {
2567 return true;
2568 }
2569
2571 {
2572 return false;
2573 }
2574
2575
2577 {
2578 return false;
2579 }
2580
2582 {
2583 return false;
2584 }
2585
2586
2588 {
2589 return false;
2590 }
2591
2592
2593
2595 {
2596 return true;
2597 }
2598
2600 {
2601 return true;
2602 }
2603
2606 {
2607 return false;
2608 }
2609
2610
2612 {
2613 return true;
2614 }
2615
2616
2618 {
2619 return false;
2620 }
2621
2622
2624 {
2625 return true;
2626 }
2627
2628
2630 {
2631 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2632 {
2633 return false;
2634 }
2635
2636 return true;
2637 }
2638
2640 {
2643
2644 return item;
2645 }
2646
2647
2649 {
2651 {
2652
2654
2655
2658
2660 if ( MemoryPointExists( slot_name + "_min" ) )
2661 {
2662 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2663 }
2664 if ( MemoryPointExists( slot_name + "_max" ) )
2665 {
2666 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2667 }
2668
2669
2672
2673
2676 center = ModelToWorld( center );
2677
2678
2681
2682 areaDamage.SetExtents( extents[0], extents[1] );
2683 areaDamage.SetAreaPosition( center );
2684 areaDamage.SetAreaOrientation( orientation );
2687 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2688 areaDamage.SetAmmoName( "BarbedWireHit" );
2689 areaDamage.Spawn();
2690
2692 }
2693 }
2694
2696 {
2697 if ( angle_deg != 0 )
2698 {
2699
2700 orientation[0] = orientation[0] - angle_deg;
2701
2702
2704 if ( MemoryPointExists( "rotate_axis" ) )
2705 {
2706 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2707 }
2708 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];
2709 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];
2710 center[0] = r_center_x;
2711 center[2] = r_center_z;
2712 }
2713 }
2714
2716 {
2718 {
2721 {
2722 if (areaDamage)
2723 {
2724 areaDamage.Destroy();
2725 }
2726
2728 }
2729 }
2730 }
2731
2733 {
2734 return true;
2735 }
2736
2737
2738
2739
2741 {
2743 }
2744
2746 {
2748 }
2749
2751 {
2753 }
2754
2756 {
2758
2759 switch ( material_type )
2760 {
2766 }
2767
2768 return "";
2769 }
2770
2772 {
2774
2775 switch ( material_type )
2776 {
2782 }
2783
2784 return "";
2785 }
2786
2787
2789 {
2791 {
2792
2794 {
2795 SetHealth(slot_name,"Health",item.GetHealth());
2796 }
2797 }
2798 }
2799
2801 {
2802 return 111;
2803 }
2804
2806 {
2807 super.SetActions();
2808
2812 }
2813
2814
2815
2816
2818 {
2819 }
2820
2823 {
2824 return null;
2825 }
2826
2828 {
2830 }
2831
2833 {
2836
2837 Man p;
2838
2839 #ifdef SERVER
2842 if (players.Count())
2843 p = players[0];
2844 #else
2846 #endif
2847
2849 {
2850 bool excluded = false;
2852 if (excludes)
2853 {
2854 foreach (string exclude : excludes)
2855 {
2857 {
2858 excluded = true;
2859 break;
2860 }
2861 }
2862 }
2863
2864 if (!excluded)
2865 {
2867 }
2868 }
2869
2871 }
2872}
2873
2875{
2876#ifdef BSB_DEBUG
2878#else
2879
2880#endif
2881}
2883{
2884#ifdef BSB_DEBUG_SPAM
2886#else
2887
2888#endif
2889}
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.