1519{
1521
1523
1525
1527
1533
1534
1535
1541
1547
1549
1553
1554
1556 {
1558
1559
1560 RegisterNetSyncVariableInt( "m_SyncParts01" );
1561 RegisterNetSyncVariableInt( "m_SyncParts02" );
1562 RegisterNetSyncVariableInt( "m_SyncParts03" );
1563 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1564 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1565 RegisterNetSyncVariableBool( "m_HasBase" );
1566
1567
1569
1570 if (ConfigIsExisting("hybridAttachments"))
1571 {
1574 }
1575 if (ConfigIsExisting("mountables"))
1576 {
1579 }
1580
1582 }
1583
1585 {
1586 super.EEDelete(parent);
1587
1589 {
1590 areaDamage.Destroy();
1591 }
1592
1593 }
1594
1596 {
1597 return "disableBaseDamage";
1598 }
1599
1601 {
1602 return true;
1603 }
1604
1606 {
1607 return EInventoryIconVisibility.HIDE_VICINITY;
1608 }
1609
1610
1612 {
1614 {
1615 SetSynchDirty();
1616 }
1617 }
1618
1620 {
1622 super.OnVariablesSynchronized();
1623
1625 }
1626
1628 {
1629
1631
1632
1634
1635
1637 }
1638
1639
1641 {
1642
1643 int offset;
1644 int mask;
1645
1646 if ( part_id >= 1 && part_id <= 31 )
1647 {
1648 offset = part_id - 1;
1649 mask = 1 << offset;
1650
1652 }
1653 else if ( part_id >= 32 && part_id <= 62 )
1654 {
1655 offset = ( part_id % 32 );
1656 mask = 1 << offset;
1657
1659 }
1660 else if ( part_id >= 63 && part_id <= 93 )
1661 {
1662 offset = ( part_id % 63 );
1663 mask = 1 << offset;
1664
1666 }
1667 }
1668
1670 {
1671
1672 int offset;
1673 int mask;
1674
1675 if ( part_id >= 1 && part_id <= 31 )
1676 {
1677 offset = part_id - 1;
1678 mask = 1 << offset;
1679
1681 }
1682 else if ( part_id >= 32 && part_id <= 62 )
1683 {
1684 offset = ( part_id % 32 );
1685 mask = 1 << offset;
1686
1688 }
1689 else if ( part_id >= 63 && part_id <= 93 )
1690 {
1691 offset = ( part_id % 63 );
1692 mask = 1 << offset;
1693
1695 }
1696 }
1697
1699 {
1700
1701 int offset;
1702 int mask;
1703
1704 if ( part_id >= 1 && part_id <= 31 )
1705 {
1706 offset = part_id - 1;
1707 mask = 1 << offset;
1708
1710 {
1711 return true;
1712 }
1713 }
1714 else if ( part_id >= 32 && part_id <= 62 )
1715 {
1716 offset = ( part_id % 32 );
1717 mask = 1 << offset;
1718
1720 {
1721 return true;
1722 }
1723 }
1724 else if ( part_id >= 63 && part_id <= 93 )
1725 {
1726 offset = ( part_id % 63 );
1727 mask = 1 << offset;
1728
1730 {
1731 return true;
1732 }
1733 }
1734
1735 return false;
1736 }
1737
1739 {
1742 }
1743
1745 {
1746
1749 }
1750
1752 {
1754 {
1757
1758 switch( build_action_id )
1759 {
1763 }
1764 }
1765 }
1766
1767
1769 {
1771 bool is_base = part.
IsBase();
1774 if ( is_part_built_sync )
1775 {
1777 {
1781
1782 if (is_base)
1783 {
1786 }
1787 }
1788 }
1789 else
1790 {
1792 {
1796
1797 if (is_base)
1798 {
1801 }
1802 }
1803 }
1804
1805
1807 }
1808
1809
1811 {
1814
1815 for ( int i = 0; i < construction_parts.Count(); ++i )
1816 {
1817 string key = construction_parts.GetKey( i );
1820 }
1821
1822
1824 }
1825
1827 {
1830
1831 for ( int i = 0; i < construction_parts.Count(); ++i )
1832 {
1833 string key = construction_parts.GetKey( i );
1835
1836 if ( value.
GetId() ==
id )
1837 {
1838 return value;
1839 }
1840 }
1841
1842 return NULL;
1843 }
1844
1845
1846
1848 {
1850 }
1851
1853 {
1855 }
1856
1858 {
1859 return true;
1860 }
1861
1863 {
1864 return false;
1865 }
1866
1867
1869 {
1872 {
1874 }
1875
1876 return construction_kit;
1877 }
1878
1880 {
1883 {
1885 }
1886 }
1887
1889 {
1891 }
1892
1894 {
1895 return "";
1896 }
1897
1899 {
1902 }
1903
1904
1906 {
1909 }
1910
1911
1913 {
1914 super.OnStoreSave( ctx );
1915
1916
1920
1922 }
1923
1925 {
1926 if ( !super.OnStoreLoad( ctx, version ) )
1927 return false;
1928
1929
1930
1932 {
1934 return false;
1935 }
1937 {
1939 return false;
1940 }
1942 {
1944 return false;
1945 }
1946
1947
1949 {
1951 return false;
1952 }
1953
1954
1955 return true;
1956 }
1957
1959 {
1960 super.AfterStoreLoad();
1961
1963 {
1965 }
1966 }
1967
1969 {
1970
1972
1973
1976
1977
1979 }
1980
1982 {
1983 super.OnCreatePhysics();
1986 }
1987
1989 {
1991 return;
1992
1993 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1994
1996 return;
1997
1999 string part_name = zone;
2001
2003 {
2004 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2005
2006 if ( construction_part && construction.IsPartConstructed( part_name ) )
2007 {
2009 construction.DestroyConnectedParts(part_name);
2010 }
2011
2012
2013 if ( part_name.
Contains(
"barbed") )
2014 {
2015 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2016 if (barbed_wire)
2017 barbed_wire.SetMountedState( false );
2018 }
2019 }
2020 }
2021
2023 {
2025 {
2027 }
2028
2029 super.EEOnAfterLoad();
2030 }
2031
2033 {
2034 super.EEInit();
2035
2036
2038
2039
2040 #ifdef DEVELOPER
2042 #endif
2043 }
2044
2046 {
2047 super.EEItemAttached( item, slot_name );
2048
2052 }
2053
2055 {
2056 super.EEItemDetached( item, slot_name );
2057
2060 }
2061
2062 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2063 {
2066
2069 }
2070
2071
2073 {
2074 return true;
2075 }
2076
2077
2078
2080 {
2082
2083
2084 if (construtionPart.
IsBase())
2085 {
2087
2088
2090 }
2091
2092
2094
2095
2097
2098
2100
2102
2104
2105
2107
2108
2110 }
2111
2113 {
2114
2116 }
2117
2118
2120 {
2123
2124
2126
2127
2129
2130
2132
2133
2135
2137
2138
2140
2141
2143
2144
2145 if (construtionPart.
IsBase())
2146 {
2147
2149 }
2150
2153 }
2154
2156 {
2157
2159 }
2160
2161
2162 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2163 {
2166
2167
2169
2170
2172
2173
2175
2176
2178
2180
2181
2183
2184
2186
2187
2188 if (construtionPart.
IsBase())
2189 {
2190
2192 }
2193
2196 }
2197
2199 {
2200
2202 }
2203
2205 {
2206 bool process = false;
2207
2208
2212
2213 if (process)
2214 {
2215 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2216 {
2218 return;
2219 }
2220
2222 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2223 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2224
2225
2227 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2228 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2229 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2230 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2231 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2232 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2233 mins = minTmp;
2234 maxs = maxTmp;
2235
2236 maxs[1] = maxs[1] + 0.35;
2237
2239 }
2240 }
2241
2243 {
2246
2247
2249 foreach (
EntityAI entity : foundEntities)
2250 {
2253 }
2254 }
2255
2256
2258 {
2260
2264 }
2265
2267 {
2269
2271 {
2273 }
2274 else
2275 {
2277 }
2278
2280 }
2281
2283 {
2285
2287 foreach (
string slotName : attachmentSlots)
2288 {
2290 }
2291
2292
2295 else
2297
2299 }
2300
2302 {
2303 string slotNameMounted = slot_name + "_Mounted";
2304 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2305
2306 if (attachment)
2307 {
2308 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2309 if (barbedWire && barbedWire.IsMounted())
2311 else
2313
2314 if (is_locked)
2315 {
2316 SetAnimationPhase(slotNameMounted, 0);
2317 SetAnimationPhase(slot_name, 1);
2318 }
2319 else
2320 {
2321 SetAnimationPhase(slotNameMounted, 1);
2322 SetAnimationPhase(slot_name, 0);
2323 }
2324 }
2325 else
2326 {
2327 SetAnimationPhase(slotNameMounted, 1);
2328 SetAnimationPhase(slot_name, 1);
2329
2331 }
2332 }
2333
2334
2336 {
2339
2342
2345
2346 foreach (
string slotName : attachmentSlots)
2347 {
2349 }
2350
2351
2353 {
2356
2358 }
2359 else
2360 {
2363
2365 }
2366
2369 }
2370
2372 {
2373
2375 return;
2376
2377 string slot_name_mounted = slot_name + "_Mounted";
2378 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2379
2380
2382 RemoveProxyPhysics( slot_name_mounted );
2383 RemoveProxyPhysics( slot_name );
2384
2385 if ( attachment )
2386 {
2388 if ( is_locked )
2389 {
2391 AddProxyPhysics( slot_name_mounted );
2392 }
2393 else
2394 {
2396 AddProxyPhysics( slot_name );
2397 }
2398 }
2399 }
2400
2402 {
2403 SetAffectPathgraph( true, false );
2405 }
2406
2408 {
2409 return true;
2410 }
2411
2413 {
2414 return true;
2415 }
2416
2418 {
2419 if ( attachment )
2420 {
2422 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2423
2424 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2425 }
2426
2427 return false;
2428 }
2429
2431 {
2433 }
2434
2435
2437 {
2438 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2439 if (
GetGame().ConfigIsExisting( config_path ) )
2440 {
2442 }
2443 }
2444
2446 {
2447 return true;
2448 }
2449
2451 {
2452 return true;
2453 }
2454
2456 {
2457 return true;
2458 }
2459
2460
2462 {
2464 {
2466 }
2467
2469 }
2470
2472 {
2474 }
2475
2476
2477
2479 {
2480 return super.CanReceiveAttachment(attachment, slotId);
2481 }
2482
2484 {
2485 int attachment_count = GetInventory().AttachmentCount();
2486 if ( attachment_count > 0 )
2487 {
2488 if (
HasBase() && attachment_count == 1 )
2489 {
2490 return false;
2491 }
2492
2493 return true;
2494 }
2495
2496 return false;
2497 }
2498
2500 {
2501 return true;
2502 }
2503
2505 {
2506 return false;
2507 }
2508
2509
2511 {
2512 return false;
2513 }
2514
2516 {
2517 return false;
2518 }
2519
2520
2522 {
2523 return false;
2524 }
2525
2526
2527
2529 {
2530 return true;
2531 }
2532
2534 {
2535 return true;
2536 }
2537
2540 {
2541 return false;
2542 }
2543
2544
2546 {
2547 return true;
2548 }
2549
2550
2552 {
2553 return false;
2554 }
2555
2556
2558 {
2559 return true;
2560 }
2561
2562
2564 {
2565 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2566 {
2567 return false;
2568 }
2569
2570 return true;
2571 }
2572
2574 {
2577
2578 return item;
2579 }
2580
2581
2583 {
2585 {
2586
2588
2589
2592
2594 if ( MemoryPointExists( slot_name + "_min" ) )
2595 {
2596 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2597 }
2598 if ( MemoryPointExists( slot_name + "_max" ) )
2599 {
2600 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2601 }
2602
2603
2606
2607
2610 center = ModelToWorld( center );
2611
2612
2615
2616 areaDamage.SetExtents( extents[0], extents[1] );
2617 areaDamage.SetAreaPosition( center );
2618 areaDamage.SetAreaOrientation( orientation );
2621 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2622 areaDamage.SetAmmoName( "BarbedWireHit" );
2623 areaDamage.Spawn();
2624
2626 }
2627 }
2628
2630 {
2631 if ( angle_deg != 0 )
2632 {
2633
2634 orientation[0] = orientation[0] - angle_deg;
2635
2636
2638 if ( MemoryPointExists( "rotate_axis" ) )
2639 {
2640 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2641 }
2642 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];
2643 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];
2644 center[0] = r_center_x;
2645 center[2] = r_center_z;
2646 }
2647 }
2648
2650 {
2652 {
2655 {
2656 if (areaDamage)
2657 {
2658 areaDamage.Destroy();
2659 }
2660
2662 }
2663 }
2664 }
2665
2667 {
2668 return true;
2669 }
2670
2671
2672
2673
2675 {
2677 }
2678
2680 {
2682 }
2683
2685 {
2687 }
2688
2690 {
2692
2693 switch ( material_type )
2694 {
2700 }
2701
2702 return "";
2703 }
2704
2706 {
2708
2709 switch ( material_type )
2710 {
2716 }
2717
2718 return "";
2719 }
2720
2721
2723 {
2725 {
2726
2728 {
2729 SetHealth(slot_name,"Health",item.GetHealth());
2730 }
2731 }
2732 }
2733
2735 {
2736 return 111;
2737 }
2738
2740 {
2741 super.SetActions();
2742
2746 }
2747
2748
2749
2750
2752 {
2753 }
2754
2757 {
2758 return null;
2759 }
2760
2762 {
2764 }
2765
2767 {
2770
2771 Man p;
2772
2773 #ifdef SERVER
2776 if (players.Count())
2777 p = players[0];
2778 #else
2780 #endif
2781
2783 {
2784 bool excluded = false;
2786 if (excludes)
2787 {
2788 foreach (string exclude : excludes)
2789 {
2791 {
2792 excluded = true;
2793 break;
2794 }
2795 }
2796 }
2797
2798 if (!excluded)
2799 {
2801 }
2802 }
2803
2805 }
2806}
2807
2809{
2810#ifdef BSB_DEBUG
2812#else
2813
2814#endif
2815}
2817{
2818#ifdef BSB_DEBUG_SPAM
2820#else
2821
2822#endif
2823}
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.