1359{
1361
1363
1365
1367
1373
1374
1375
1381
1387
1389
1393
1394
1396 {
1398
1399
1400 RegisterNetSyncVariableInt( "m_SyncParts01" );
1401 RegisterNetSyncVariableInt( "m_SyncParts02" );
1402 RegisterNetSyncVariableInt( "m_SyncParts03" );
1403 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1404 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1405 RegisterNetSyncVariableBool( "m_HasBase" );
1406
1407
1409
1410 if (ConfigIsExisting("hybridAttachments"))
1411 {
1414 }
1415 if (ConfigIsExisting("mountables"))
1416 {
1419 }
1420
1422 }
1423
1425 {
1426 super.EEDelete(parent);
1427
1429 {
1430 areaDamage.Destroy();
1431 }
1432
1433 }
1434
1436 {
1437 return "disableBaseDamage";
1438 }
1439
1441 {
1442 return true;
1443 }
1444
1446 {
1447 return EInventoryIconVisibility.HIDE_VICINITY;
1448 }
1449
1450
1452 {
1454 {
1455 SetSynchDirty();
1456 }
1457 }
1458
1460 {
1462 super.OnVariablesSynchronized();
1463
1465 }
1466
1468 {
1469
1471
1472
1474
1475
1477 }
1478
1479
1481 {
1482
1483 int offset;
1484 int mask;
1485
1486 if ( part_id >= 1 && part_id <= 31 )
1487 {
1488 offset = part_id - 1;
1489 mask = 1 << offset;
1490
1492 }
1493 else if ( part_id >= 32 && part_id <= 62 )
1494 {
1495 offset = ( part_id % 32 );
1496 mask = 1 << offset;
1497
1499 }
1500 else if ( part_id >= 63 && part_id <= 93 )
1501 {
1502 offset = ( part_id % 63 );
1503 mask = 1 << offset;
1504
1506 }
1507 }
1508
1510 {
1511
1512 int offset;
1513 int mask;
1514
1515 if ( part_id >= 1 && part_id <= 31 )
1516 {
1517 offset = part_id - 1;
1518 mask = 1 << offset;
1519
1521 }
1522 else if ( part_id >= 32 && part_id <= 62 )
1523 {
1524 offset = ( part_id % 32 );
1525 mask = 1 << offset;
1526
1528 }
1529 else if ( part_id >= 63 && part_id <= 93 )
1530 {
1531 offset = ( part_id % 63 );
1532 mask = 1 << offset;
1533
1535 }
1536 }
1537
1539 {
1540
1541 int offset;
1542 int mask;
1543
1544 if ( part_id >= 1 && part_id <= 31 )
1545 {
1546 offset = part_id - 1;
1547 mask = 1 << offset;
1548
1550 {
1551 return true;
1552 }
1553 }
1554 else if ( part_id >= 32 && part_id <= 62 )
1555 {
1556 offset = ( part_id % 32 );
1557 mask = 1 << offset;
1558
1560 {
1561 return true;
1562 }
1563 }
1564 else if ( part_id >= 63 && part_id <= 93 )
1565 {
1566 offset = ( part_id % 63 );
1567 mask = 1 << offset;
1568
1570 {
1571 return true;
1572 }
1573 }
1574
1575 return false;
1576 }
1577
1579 {
1582 }
1583
1585 {
1586
1589 }
1590
1592 {
1594 {
1597
1598 switch( build_action_id )
1599 {
1603 }
1604 }
1605 }
1606
1607
1609 {
1611 bool is_base = part.
IsBase();
1614 if ( is_part_built_sync )
1615 {
1617 {
1621
1622 if (is_base)
1623 {
1626 }
1627 }
1628 }
1629 else
1630 {
1632 {
1636
1637 if (is_base)
1638 {
1641 }
1642 }
1643 }
1644
1645
1647 }
1648
1649
1651 {
1654
1655 for ( int i = 0; i < construction_parts.Count(); ++i )
1656 {
1657 string key = construction_parts.GetKey( i );
1660 }
1661
1662
1664 }
1665
1667 {
1670
1671 for ( int i = 0; i < construction_parts.Count(); ++i )
1672 {
1673 string key = construction_parts.GetKey( i );
1675
1676 if ( value.
GetId() ==
id )
1677 {
1678 return value;
1679 }
1680 }
1681
1682 return NULL;
1683 }
1684
1685
1686
1688 {
1690 }
1691
1693 {
1695 }
1696
1698 {
1699 return true;
1700 }
1701
1703 {
1704 return false;
1705 }
1706
1707
1709 {
1712 {
1714 }
1715
1716 return construction_kit;
1717 }
1718
1720 {
1723 {
1725 }
1726 }
1727
1729 {
1731 }
1732
1734 {
1735 return "";
1736 }
1737
1739 {
1742 }
1743
1744
1746 {
1749 }
1750
1751
1753 {
1754 super.OnStoreSave( ctx );
1755
1756
1760
1762 }
1763
1765 {
1766 if ( !super.OnStoreLoad( ctx, version ) )
1767 return false;
1768
1769
1770
1772 {
1774 return false;
1775 }
1777 {
1779 return false;
1780 }
1782 {
1784 return false;
1785 }
1786
1787
1789 {
1791 return false;
1792 }
1793
1794
1795 return true;
1796 }
1797
1799 {
1800 super.AfterStoreLoad();
1801
1803 {
1805 }
1806 }
1807
1809 {
1810
1812
1813
1816
1817
1819 }
1820
1822 {
1823 super.OnCreatePhysics();
1826 }
1827
1829 {
1831 return;
1832
1833 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1834
1836 return;
1837
1839 string part_name = zone;
1841
1843 {
1844 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1845
1846 if ( construction_part && construction.IsPartConstructed( part_name ) )
1847 {
1849 construction.DestroyConnectedParts(part_name);
1850 }
1851
1852
1853 if ( part_name.
Contains(
"barbed") )
1854 {
1855 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1856 if (barbed_wire)
1857 barbed_wire.SetMountedState( false );
1858 }
1859 }
1860 }
1861
1863 {
1865 {
1867 }
1868
1869 super.EEOnAfterLoad();
1870 }
1871
1873 {
1874 super.EEInit();
1875
1876
1878
1879
1880 #ifdef DEVELOPER
1882 #endif
1883 }
1884
1886 {
1887 super.EEItemAttached( item, slot_name );
1888
1892 }
1893
1895 {
1896 super.EEItemDetached( item, slot_name );
1897
1900 }
1901
1902 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1903 {
1906
1909 }
1910
1911
1913 {
1914 return true;
1915 }
1916
1917
1918
1920 {
1922
1923
1924 if (construtionPart.
IsBase())
1925 {
1927
1928
1930 }
1931
1932
1934
1935
1937
1938
1940
1942
1944
1945
1947
1948
1950 }
1951
1953 {
1954
1956 }
1957
1958
1960 {
1963
1964
1966
1967
1969
1970
1972
1973
1975
1977
1978
1980
1981
1983
1984
1985 if (construtionPart.
IsBase())
1986 {
1987
1989 }
1990
1993 }
1994
1996 {
1997
1999 }
2000
2001
2002 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2003 {
2006
2007
2009
2010
2012
2013
2015
2016
2018
2020
2021
2023
2024
2026
2027
2028 if (construtionPart.
IsBase())
2029 {
2030
2032 }
2033
2036 }
2037
2039 {
2040
2042 }
2043
2045 {
2046 bool process = false;
2047
2048
2052
2053 if (process)
2054 {
2055 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2056 {
2058 return;
2059 }
2060
2062 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2063 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2064
2065
2067 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2068 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2069 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2070 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2071 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2072 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2073 mins = minTmp;
2074 maxs = maxTmp;
2075
2076 maxs[1] = maxs[1] + 0.35;
2077
2079 }
2080 }
2081
2083 {
2086
2087
2089 foreach (
EntityAI entity : foundEntities)
2090 {
2093 }
2094 }
2095
2096
2098 {
2100
2104 }
2105
2107 {
2109
2111 {
2113 }
2114 else
2115 {
2117 }
2118
2120 }
2121
2123 {
2125
2127 foreach (
string slotName : attachmentSlots)
2128 {
2130 }
2131
2132
2135 else
2137
2139 }
2140
2142 {
2143 string slotNameMounted = slot_name + "_Mounted";
2144 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2145
2146 if (attachment)
2147 {
2148 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2149 if (barbedWire && barbedWire.IsMounted())
2151 else
2153
2154 if (is_locked)
2155 {
2156 SetAnimationPhase(slotNameMounted, 0);
2157 SetAnimationPhase(slot_name, 1);
2158 }
2159 else
2160 {
2161 SetAnimationPhase(slotNameMounted, 1);
2162 SetAnimationPhase(slot_name, 0);
2163 }
2164 }
2165 else
2166 {
2167 SetAnimationPhase(slotNameMounted, 1);
2168 SetAnimationPhase(slot_name, 1);
2169
2171 }
2172 }
2173
2174
2176 {
2179
2182
2185
2186 foreach (
string slotName : attachmentSlots)
2187 {
2189 }
2190
2191
2193 {
2196
2198 }
2199 else
2200 {
2203
2205 }
2206
2209 }
2210
2212 {
2213
2215 return;
2216
2217 string slot_name_mounted = slot_name + "_Mounted";
2218 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2219
2220
2222 RemoveProxyPhysics( slot_name_mounted );
2223 RemoveProxyPhysics( slot_name );
2224
2225 if ( attachment )
2226 {
2228 if ( is_locked )
2229 {
2231 AddProxyPhysics( slot_name_mounted );
2232 }
2233 else
2234 {
2236 AddProxyPhysics( slot_name );
2237 }
2238 }
2239 }
2240
2242 {
2243 SetAffectPathgraph( true, false );
2245 }
2246
2248 {
2249 return true;
2250 }
2251
2253 {
2254 return true;
2255 }
2256
2258 {
2259 if ( attachment )
2260 {
2262 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2263
2264 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2265 }
2266
2267 return false;
2268 }
2269
2271 {
2273 }
2274
2275
2277 {
2278 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2279 if (
GetGame().ConfigIsExisting( config_path ) )
2280 {
2282 }
2283 }
2284
2286 {
2287 return true;
2288 }
2289
2291 {
2292 return true;
2293 }
2294
2296 {
2297 return true;
2298 }
2299
2300
2302 {
2304 {
2306 }
2307
2309 }
2310
2312 {
2314 }
2315
2316
2317
2319 {
2320 return super.CanReceiveAttachment(attachment, slotId);
2321 }
2322
2324 {
2325 int attachment_count = GetInventory().AttachmentCount();
2326 if ( attachment_count > 0 )
2327 {
2328 if (
HasBase() && attachment_count == 1 )
2329 {
2330 return false;
2331 }
2332
2333 return true;
2334 }
2335
2336 return false;
2337 }
2338
2340 {
2341 return true;
2342 }
2343
2345 {
2346 return false;
2347 }
2348
2349
2351 {
2352 return false;
2353 }
2354
2356 {
2357 return false;
2358 }
2359
2360
2362 {
2363 return false;
2364 }
2365
2366
2367
2369 {
2370 return true;
2371 }
2372
2374 {
2375 return true;
2376 }
2377
2380 {
2381 return false;
2382 }
2383
2384
2386 {
2387 return true;
2388 }
2389
2390
2392 {
2393 return false;
2394 }
2395
2396
2398 {
2399 return true;
2400 }
2401
2402
2404 {
2405 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2406 {
2407 return false;
2408 }
2409
2410 return true;
2411 }
2412
2414 {
2417
2418 return item;
2419 }
2420
2421
2423 {
2425 {
2426
2428
2429
2432
2434 if ( MemoryPointExists( slot_name + "_min" ) )
2435 {
2436 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2437 }
2438 if ( MemoryPointExists( slot_name + "_max" ) )
2439 {
2440 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2441 }
2442
2443
2446
2447
2450 center = ModelToWorld( center );
2451
2452
2455
2456 areaDamage.SetExtents( extents[0], extents[1] );
2457 areaDamage.SetAreaPosition( center );
2458 areaDamage.SetAreaOrientation( orientation );
2461 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2462 areaDamage.SetAmmoName( "BarbedWireHit" );
2463 areaDamage.Spawn();
2464
2466 }
2467 }
2468
2470 {
2471 if ( angle_deg != 0 )
2472 {
2473
2474 orientation[0] = orientation[0] - angle_deg;
2475
2476
2478 if ( MemoryPointExists( "rotate_axis" ) )
2479 {
2480 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2481 }
2482 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];
2483 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];
2484 center[0] = r_center_x;
2485 center[2] = r_center_z;
2486 }
2487 }
2488
2490 {
2492 {
2495 {
2496 if (areaDamage)
2497 {
2498 areaDamage.Destroy();
2499 }
2500
2502 }
2503 }
2504 }
2505
2507 {
2508 return true;
2509 }
2510
2511
2512
2513
2515 {
2517 }
2518
2520 {
2522 }
2523
2525 {
2527 }
2528
2530 {
2532
2533 switch ( material_type )
2534 {
2540 }
2541
2542 return "";
2543 }
2544
2546 {
2548
2549 switch ( material_type )
2550 {
2556 }
2557
2558 return "";
2559 }
2560
2561
2563 {
2565 {
2566
2568 {
2569 SetHealth(slot_name,"Health",item.GetHealth());
2570 }
2571 }
2572 }
2573
2575 {
2576 return 111;
2577 }
2578
2580 {
2581 super.SetActions();
2582
2586 }
2587
2588
2589
2590
2592 {
2593 }
2594
2597 {
2598 return null;
2599 }
2600
2602 {
2604 }
2605
2607 {
2610
2611 Man p;
2612
2613 #ifdef SERVER
2616 if (players.Count())
2617 p = players[0];
2618 #else
2620 #endif
2621
2623 {
2624 bool excluded = false;
2626 if (excludes)
2627 {
2628 foreach (string exclude : excludes)
2629 {
2631 {
2632 excluded = true;
2633 break;
2634 }
2635 }
2636 }
2637
2638 if (!excluded)
2639 {
2641 }
2642 }
2643
2645 }
2646}
2647
2649{
2650#ifdef BSB_DEBUG
2652#else
2653
2654#endif
2655}
2657{
2658#ifdef BSB_DEBUG_SPAM
2660#else
2661
2662#endif
2663}
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.