1543{
1545
1547
1549
1551
1557
1558
1559
1565
1571
1573
1577
1578
1580 {
1582
1583
1584 RegisterNetSyncVariableInt( "m_SyncParts01" );
1585 RegisterNetSyncVariableInt( "m_SyncParts02" );
1586 RegisterNetSyncVariableInt( "m_SyncParts03" );
1587 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1588 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1589 RegisterNetSyncVariableBool( "m_HasBase" );
1590
1591
1593
1594 if (ConfigIsExisting("hybridAttachments"))
1595 {
1598 }
1599 if (ConfigIsExisting("mountables"))
1600 {
1603 }
1604
1606 }
1607
1609 {
1610 super.EEDelete(parent);
1611
1613 {
1614 areaDamage.Destroy();
1615 }
1616
1617 }
1618
1620 {
1621 return "disableBaseDamage";
1622 }
1623
1625 {
1626 return true;
1627 }
1628
1630 {
1631 return EInventoryIconVisibility.HIDE_VICINITY;
1632 }
1633
1634
1636 {
1638 {
1639 SetSynchDirty();
1640 }
1641 }
1642
1644 {
1646 super.OnVariablesSynchronized();
1647
1649 }
1650
1652 {
1653
1655
1656
1658
1659
1661 }
1662
1663
1665 {
1666
1667 int offset;
1668 int mask;
1669
1670 if ( part_id >= 1 && part_id <= 31 )
1671 {
1672 offset = part_id - 1;
1673 mask = 1 << offset;
1674
1676 }
1677 else if ( part_id >= 32 && part_id <= 62 )
1678 {
1679 offset = ( part_id % 32 );
1680 mask = 1 << offset;
1681
1683 }
1684 else if ( part_id >= 63 && part_id <= 93 )
1685 {
1686 offset = ( part_id % 63 );
1687 mask = 1 << offset;
1688
1690 }
1691 }
1692
1694 {
1695
1696 int offset;
1697 int mask;
1698
1699 if ( part_id >= 1 && part_id <= 31 )
1700 {
1701 offset = part_id - 1;
1702 mask = 1 << offset;
1703
1705 }
1706 else if ( part_id >= 32 && part_id <= 62 )
1707 {
1708 offset = ( part_id % 32 );
1709 mask = 1 << offset;
1710
1712 }
1713 else if ( part_id >= 63 && part_id <= 93 )
1714 {
1715 offset = ( part_id % 63 );
1716 mask = 1 << offset;
1717
1719 }
1720 }
1721
1723 {
1724
1725 int offset;
1726 int mask;
1727
1728 if ( part_id >= 1 && part_id <= 31 )
1729 {
1730 offset = part_id - 1;
1731 mask = 1 << offset;
1732
1734 {
1735 return true;
1736 }
1737 }
1738 else if ( part_id >= 32 && part_id <= 62 )
1739 {
1740 offset = ( part_id % 32 );
1741 mask = 1 << offset;
1742
1744 {
1745 return true;
1746 }
1747 }
1748 else if ( part_id >= 63 && part_id <= 93 )
1749 {
1750 offset = ( part_id % 63 );
1751 mask = 1 << offset;
1752
1754 {
1755 return true;
1756 }
1757 }
1758
1759 return false;
1760 }
1761
1763 {
1766 }
1767
1769 {
1770
1773 }
1774
1776 {
1778 {
1781
1782 switch( build_action_id )
1783 {
1787 }
1788 }
1789 }
1790
1791
1793 {
1795 bool is_base = part.
IsBase();
1798 if ( is_part_built_sync )
1799 {
1801 {
1805
1806 if (is_base)
1807 {
1810 }
1811 }
1812 }
1813 else
1814 {
1816 {
1820
1821 if (is_base)
1822 {
1825 }
1826 }
1827 }
1828
1829
1831 }
1832
1833
1835 {
1838
1839 for ( int i = 0; i < construction_parts.Count(); ++i )
1840 {
1841 string key = construction_parts.GetKey( i );
1844 }
1845
1846
1848 }
1849
1851 {
1854
1855 for ( int i = 0; i < construction_parts.Count(); ++i )
1856 {
1857 string key = construction_parts.GetKey( i );
1859
1860 if ( value.
GetId() ==
id )
1861 {
1862 return value;
1863 }
1864 }
1865
1866 return NULL;
1867 }
1868
1869
1870
1872 {
1874 }
1875
1877 {
1879 }
1880
1882 {
1883 return true;
1884 }
1885
1887 {
1888 return false;
1889 }
1890
1891
1893 {
1896 {
1898 }
1899
1900 return construction_kit;
1901 }
1902
1904 {
1907 {
1909 }
1910 }
1911
1913 {
1915 }
1916
1918 {
1919 return "";
1920 }
1921
1923 {
1926 }
1927
1928
1930 {
1933 }
1934
1935
1937 {
1938 super.OnStoreSave( ctx );
1939
1940
1944
1946 }
1947
1949 {
1950 if ( !super.OnStoreLoad( ctx, version ) )
1951 return false;
1952
1953
1954
1956 {
1958 return false;
1959 }
1961 {
1963 return false;
1964 }
1966 {
1968 return false;
1969 }
1970
1971
1973 {
1975 return false;
1976 }
1977
1978
1979 return true;
1980 }
1981
1983 {
1984 super.AfterStoreLoad();
1985
1987 {
1989 }
1990 }
1991
1993 {
1994
1996
1997
2000
2001
2003 }
2004
2006 {
2007 super.OnCreatePhysics();
2010 }
2011
2013 {
2015 return;
2016
2017 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2018
2020 return;
2021
2023 string part_name = zone;
2025
2027 {
2028 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2029
2030 if ( construction_part && construction.IsPartConstructed( part_name ) )
2031 {
2033 construction.DestroyConnectedParts(part_name);
2034 }
2035
2036
2037 if ( part_name.
Contains(
"barbed") )
2038 {
2039 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2040 if (barbed_wire)
2041 barbed_wire.SetMountedState( false );
2042 }
2043 }
2044 }
2045
2047 {
2049 {
2051 }
2052
2053 super.EEOnAfterLoad();
2054 }
2055
2057 {
2058 super.EEInit();
2059
2060
2062
2063
2064 #ifdef DEVELOPER
2066 #endif
2067 }
2068
2070 {
2071 super.EEItemAttached( item, slot_name );
2072
2076 }
2077
2079 {
2080 super.EEItemDetached( item, slot_name );
2081
2084 }
2085
2086 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2087 {
2090
2093 }
2094
2095
2097 {
2098 return true;
2099 }
2100
2101
2102
2104 {
2106
2107
2108 if (construtionPart.
IsBase())
2109 {
2111
2112
2114 }
2115
2116
2118
2119
2121
2122
2124
2126
2128
2129
2131
2132
2134 }
2135
2137 {
2138
2140 }
2141
2142
2144 {
2147
2148
2150
2151
2153
2154
2156
2157
2159
2161
2162
2164
2165
2167
2168
2169 if (construtionPart.
IsBase())
2170 {
2171
2173 }
2174
2177 }
2178
2180 {
2181
2183 }
2184
2185
2186 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2187 {
2190
2191
2193
2194
2196
2197
2199
2200
2202
2204
2205
2207
2208
2210
2211
2212 if (construtionPart.
IsBase())
2213 {
2214
2216 }
2217
2220 }
2221
2223 {
2224
2226 }
2227
2229 {
2230 bool process = false;
2231
2232
2236
2237 if (process)
2238 {
2239 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2240 {
2242 return;
2243 }
2244
2246 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2247 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2248
2249
2251 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2252 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2253 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2254 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2255 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2256 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2257 mins = minTmp;
2258 maxs = maxTmp;
2259
2260 maxs[1] = maxs[1] + 0.35;
2261
2263 }
2264 }
2265
2267 {
2270
2271
2273 foreach (
EntityAI entity : foundEntities)
2274 {
2277 }
2278 }
2279
2280
2282 {
2284
2288 }
2289
2291 {
2293
2295 {
2297 }
2298 else
2299 {
2301 }
2302
2304 }
2305
2307 {
2309
2311 foreach (
string slotName : attachmentSlots)
2312 {
2314 }
2315
2316
2319 else
2321
2323 }
2324
2326 {
2327 string slotNameMounted = slot_name + "_Mounted";
2328 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2329
2330 if (attachment)
2331 {
2332 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2333 if (barbedWire && barbedWire.IsMounted())
2335 else
2337
2338 if (is_locked)
2339 {
2340 SetAnimationPhase(slotNameMounted, 0);
2341 SetAnimationPhase(slot_name, 1);
2342 }
2343 else
2344 {
2345 SetAnimationPhase(slotNameMounted, 1);
2346 SetAnimationPhase(slot_name, 0);
2347 }
2348 }
2349 else
2350 {
2351 SetAnimationPhase(slotNameMounted, 1);
2352 SetAnimationPhase(slot_name, 1);
2353
2355 }
2356 }
2357
2358
2360 {
2363
2366
2369
2370 foreach (
string slotName : attachmentSlots)
2371 {
2373 }
2374
2375
2377 {
2380
2382 }
2383 else
2384 {
2387
2389 }
2390
2393 }
2394
2396 {
2397
2399 return;
2400
2401 string slot_name_mounted = slot_name + "_Mounted";
2402 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2403
2404
2406 RemoveProxyPhysics( slot_name_mounted );
2407 RemoveProxyPhysics( slot_name );
2408
2409 if ( attachment )
2410 {
2412 if ( is_locked )
2413 {
2415 AddProxyPhysics( slot_name_mounted );
2416 }
2417 else
2418 {
2420 AddProxyPhysics( slot_name );
2421 }
2422 }
2423 }
2424
2426 {
2427 SetAffectPathgraph( true, false );
2429 }
2430
2432 {
2433 return true;
2434 }
2435
2437 {
2438 return true;
2439 }
2440
2442 {
2443 if ( attachment )
2444 {
2446 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2447
2448 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2449 }
2450
2451 return false;
2452 }
2453
2455 {
2457 }
2458
2459
2461 {
2462 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2463 if (
GetGame().ConfigIsExisting( config_path ) )
2464 {
2466 }
2467 }
2468
2470 {
2471 return true;
2472 }
2473
2475 {
2476 return true;
2477 }
2478
2480 {
2481 return true;
2482 }
2483
2484
2486 {
2488 {
2490 }
2491
2493 }
2494
2496 {
2498 }
2499
2500
2501
2503 {
2504 return super.CanReceiveAttachment(attachment, slotId);
2505 }
2506
2508 {
2509 int attachment_count = GetInventory().AttachmentCount();
2510 if ( attachment_count > 0 )
2511 {
2512 if (
HasBase() && attachment_count == 1 )
2513 {
2514 return false;
2515 }
2516
2517 return true;
2518 }
2519
2520 return false;
2521 }
2522
2524 {
2525 return true;
2526 }
2527
2529 {
2530 return false;
2531 }
2532
2533
2535 {
2536 return false;
2537 }
2538
2540 {
2541 return false;
2542 }
2543
2544
2546 {
2547 return false;
2548 }
2549
2550
2551
2553 {
2554 return true;
2555 }
2556
2558 {
2559 return true;
2560 }
2561
2564 {
2565 return false;
2566 }
2567
2568
2570 {
2571 return true;
2572 }
2573
2574
2576 {
2577 return false;
2578 }
2579
2580
2582 {
2583 return true;
2584 }
2585
2586
2588 {
2589 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2590 {
2591 return false;
2592 }
2593
2594 return true;
2595 }
2596
2598 {
2601
2602 return item;
2603 }
2604
2605
2607 {
2609 {
2610
2612
2613
2616
2618 if ( MemoryPointExists( slot_name + "_min" ) )
2619 {
2620 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2621 }
2622 if ( MemoryPointExists( slot_name + "_max" ) )
2623 {
2624 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2625 }
2626
2627
2630
2631
2634 center = ModelToWorld( center );
2635
2636
2639
2640 areaDamage.SetExtents( extents[0], extents[1] );
2641 areaDamage.SetAreaPosition( center );
2642 areaDamage.SetAreaOrientation( orientation );
2645 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2646 areaDamage.SetAmmoName( "BarbedWireHit" );
2647 areaDamage.Spawn();
2648
2650 }
2651 }
2652
2654 {
2655 if ( angle_deg != 0 )
2656 {
2657
2658 orientation[0] = orientation[0] - angle_deg;
2659
2660
2662 if ( MemoryPointExists( "rotate_axis" ) )
2663 {
2664 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2665 }
2666 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];
2667 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];
2668 center[0] = r_center_x;
2669 center[2] = r_center_z;
2670 }
2671 }
2672
2674 {
2676 {
2679 {
2680 if (areaDamage)
2681 {
2682 areaDamage.Destroy();
2683 }
2684
2686 }
2687 }
2688 }
2689
2691 {
2692 return true;
2693 }
2694
2695
2696
2697
2699 {
2701 }
2702
2704 {
2706 }
2707
2709 {
2711 }
2712
2714 {
2716
2717 switch ( material_type )
2718 {
2724 }
2725
2726 return "";
2727 }
2728
2730 {
2732
2733 switch ( material_type )
2734 {
2740 }
2741
2742 return "";
2743 }
2744
2745
2747 {
2749 {
2750
2752 {
2753 SetHealth(slot_name,"Health",item.GetHealth());
2754 }
2755 }
2756 }
2757
2759 {
2760 return 111;
2761 }
2762
2764 {
2765 super.SetActions();
2766
2770 }
2771
2772
2773
2774
2776 {
2777 }
2778
2781 {
2782 return null;
2783 }
2784
2786 {
2788 }
2789
2791 {
2794
2795 Man p;
2796
2797 #ifdef SERVER
2800 if (players.Count())
2801 p = players[0];
2802 #else
2804 #endif
2805
2807 {
2808 bool excluded = false;
2810 if (excludes)
2811 {
2812 foreach (string exclude : excludes)
2813 {
2815 {
2816 excluded = true;
2817 break;
2818 }
2819 }
2820 }
2821
2822 if (!excluded)
2823 {
2825 }
2826 }
2827
2829 }
2830}
2831
2833{
2834#ifdef BSB_DEBUG
2836#else
2837
2838#endif
2839}
2841{
2842#ifdef BSB_DEBUG_SPAM
2844#else
2845
2846#endif
2847}
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.