1330{
1332
1334
1336
1338
1344
1345
1346
1352
1358
1360
1364
1365
1367 {
1369
1370
1371 RegisterNetSyncVariableInt( "m_SyncParts01" );
1372 RegisterNetSyncVariableInt( "m_SyncParts02" );
1373 RegisterNetSyncVariableInt( "m_SyncParts03" );
1374 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1375 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1376 RegisterNetSyncVariableBool( "m_HasBase" );
1377
1378
1380
1381 if (ConfigIsExisting("hybridAttachments"))
1382 {
1385 }
1386 if (ConfigIsExisting("mountables"))
1387 {
1390 }
1391
1393 }
1394
1396 {
1397 super.EEDelete(parent);
1398
1400 {
1401 areaDamage.Destroy();
1402 }
1403
1404 }
1405
1407 {
1408 return "disableBaseDamage";
1409 }
1410
1412 {
1413 return true;
1414 }
1415
1417 {
1418 return EInventoryIconVisibility.HIDE_VICINITY;
1419 }
1420
1421
1423 {
1425 {
1426 SetSynchDirty();
1427 }
1428 }
1429
1431 {
1433 super.OnVariablesSynchronized();
1434
1436 }
1437
1439 {
1440
1442
1443
1445
1446
1448 }
1449
1450
1452 {
1453
1454 int offset;
1455 int mask;
1456
1457 if ( part_id >= 1 && part_id <= 31 )
1458 {
1459 offset = part_id - 1;
1460 mask = 1 << offset;
1461
1463 }
1464 else if ( part_id >= 32 && part_id <= 62 )
1465 {
1466 offset = ( part_id % 32 );
1467 mask = 1 << offset;
1468
1470 }
1471 else if ( part_id >= 63 && part_id <= 93 )
1472 {
1473 offset = ( part_id % 63 );
1474 mask = 1 << offset;
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 return true;
1523 }
1524 }
1525 else if ( part_id >= 32 && part_id <= 62 )
1526 {
1527 offset = ( part_id % 32 );
1528 mask = 1 << offset;
1529
1531 {
1532 return true;
1533 }
1534 }
1535 else if ( part_id >= 63 && part_id <= 93 )
1536 {
1537 offset = ( part_id % 63 );
1538 mask = 1 << offset;
1539
1541 {
1542 return true;
1543 }
1544 }
1545
1546 return false;
1547 }
1548
1550 {
1553 }
1554
1556 {
1557
1560 }
1561
1563 {
1565 {
1568
1569 switch( build_action_id )
1570 {
1574 }
1575 }
1576 }
1577
1578
1580 {
1582 bool is_base = part.
IsBase();
1585 if ( is_part_built_sync )
1586 {
1588 {
1592
1593 if (is_base)
1594 {
1597 }
1598 }
1599 }
1600 else
1601 {
1603 {
1607
1608 if (is_base)
1609 {
1612 }
1613 }
1614 }
1615
1616
1618 }
1619
1620
1622 {
1625
1626 for ( int i = 0; i < construction_parts.Count(); ++i )
1627 {
1628 string key = construction_parts.GetKey( i );
1631 }
1632
1633
1635 }
1636
1638 {
1641
1642 for ( int i = 0; i < construction_parts.Count(); ++i )
1643 {
1644 string key = construction_parts.GetKey( i );
1646
1647 if ( value.
GetId() ==
id )
1648 {
1649 return value;
1650 }
1651 }
1652
1653 return NULL;
1654 }
1655
1656
1657
1659 {
1661 }
1662
1664 {
1666 }
1667
1669 {
1670 return true;
1671 }
1672
1674 {
1675 return false;
1676 }
1677
1678
1680 {
1683 {
1685 }
1686
1687 return construction_kit;
1688 }
1689
1691 {
1694 {
1696 }
1697 }
1698
1700 {
1702 }
1703
1705 {
1706 return "";
1707 }
1708
1710 {
1713 }
1714
1715
1717 {
1720 }
1721
1722
1724 {
1725 super.OnStoreSave( ctx );
1726
1727
1731
1733 }
1734
1736 {
1737 if ( !super.OnStoreLoad( ctx, version ) )
1738 return false;
1739
1740
1741
1743 {
1745 return false;
1746 }
1748 {
1750 return false;
1751 }
1753 {
1755 return false;
1756 }
1757
1758
1760 {
1762 return false;
1763 }
1764
1765
1766 return true;
1767 }
1768
1770 {
1771 super.AfterStoreLoad();
1772
1774 {
1776 }
1777 }
1778
1780 {
1781
1783
1784
1787
1788
1790 }
1791
1793 {
1794 super.OnCreatePhysics();
1797 }
1798
1800 {
1802 return;
1803
1804 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1805
1807 return;
1808
1810 string part_name = zone;
1812
1814 {
1815 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1816
1817 if ( construction_part && construction.IsPartConstructed( part_name ) )
1818 {
1820 construction.DestroyConnectedParts(part_name);
1821 }
1822
1823
1824 if ( part_name.
Contains(
"barbed") )
1825 {
1826 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1827 if (barbed_wire)
1828 barbed_wire.SetMountedState( false );
1829 }
1830 }
1831 }
1832
1834 {
1836 {
1838 }
1839
1840 super.EEOnAfterLoad();
1841 }
1842
1844 {
1845 super.EEInit();
1846
1847
1849
1850
1851 #ifdef DEVELOPER
1853 #endif
1854 }
1855
1857 {
1858 super.EEItemAttached( item, slot_name );
1859
1863 }
1864
1866 {
1867 super.EEItemDetached( item, slot_name );
1868
1871 }
1872
1873 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1874 {
1877
1880 }
1881
1882
1884 {
1885 return true;
1886 }
1887
1888
1889
1891 {
1893
1894
1895 if (construtionPart.
IsBase())
1896 {
1898
1899
1901 }
1902
1903
1905
1906
1908
1909
1911
1913
1915
1916
1918
1919
1921 }
1922
1924 {
1925
1927 }
1928
1929
1931 {
1934
1935
1937
1938
1940
1941
1943
1944
1946
1948
1949
1951
1952
1954
1955
1956 if (construtionPart.
IsBase())
1957 {
1958
1960 }
1961
1964 }
1965
1967 {
1968
1970 }
1971
1972
1973 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
1974 {
1977
1978
1980
1981
1983
1984
1986
1987
1989
1991
1992
1994
1995
1997
1998
1999 if (construtionPart.
IsBase())
2000 {
2001
2003 }
2004
2007 }
2008
2010 {
2011
2013 }
2014
2016 {
2017 bool process = false;
2018
2019
2023
2024 if (process)
2025 {
2026 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2027 {
2029 return;
2030 }
2031
2033 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2034 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2035
2036
2038 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2039 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2040 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2041 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2042 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2043 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2044 mins = minTmp;
2045 maxs = maxTmp;
2046
2047 maxs[1] = maxs[1] + 0.35;
2048
2050 }
2051 }
2052
2054 {
2057
2058
2060 foreach (
EntityAI entity : foundEntities)
2061 {
2064 }
2065 }
2066
2067
2069 {
2071
2075 }
2076
2078 {
2080
2082 {
2084 }
2085 else
2086 {
2088 }
2089
2091 }
2092
2094 {
2096
2098 foreach (
string slotName : attachmentSlots)
2099 {
2101 }
2102
2103
2106 else
2108
2110 }
2111
2113 {
2114 string slotNameMounted = slot_name + "_Mounted";
2115 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2116
2117 if (attachment)
2118 {
2119 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2120 if (barbedWire && barbedWire.IsMounted())
2122 else
2124
2125 if (is_locked)
2126 {
2127 SetAnimationPhase(slotNameMounted, 0);
2128 SetAnimationPhase(slot_name, 1);
2129 }
2130 else
2131 {
2132 SetAnimationPhase(slotNameMounted, 1);
2133 SetAnimationPhase(slot_name, 0);
2134 }
2135 }
2136 else
2137 {
2138 SetAnimationPhase(slotNameMounted, 1);
2139 SetAnimationPhase(slot_name, 1);
2140
2142 }
2143 }
2144
2145
2147 {
2150
2153
2156
2157 foreach (
string slotName : attachmentSlots)
2158 {
2160 }
2161
2162
2164 {
2167
2169 }
2170 else
2171 {
2174
2176 }
2177
2180 }
2181
2183 {
2184
2186 return;
2187
2188 string slot_name_mounted = slot_name + "_Mounted";
2189 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2190
2191
2193 RemoveProxyPhysics( slot_name_mounted );
2194 RemoveProxyPhysics( slot_name );
2195
2196 if ( attachment )
2197 {
2199 if ( is_locked )
2200 {
2202 AddProxyPhysics( slot_name_mounted );
2203 }
2204 else
2205 {
2207 AddProxyPhysics( slot_name );
2208 }
2209 }
2210 }
2211
2213 {
2214 SetAffectPathgraph( true, false );
2216 }
2217
2219 {
2220 return true;
2221 }
2222
2224 {
2225 return true;
2226 }
2227
2229 {
2230 if ( attachment )
2231 {
2233 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2234
2235 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2236 }
2237
2238 return false;
2239 }
2240
2242 {
2244 }
2245
2246
2248 {
2249 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2250 if (
GetGame().ConfigIsExisting( config_path ) )
2251 {
2253 }
2254 }
2255
2257 {
2258 return true;
2259 }
2260
2262 {
2263 return true;
2264 }
2265
2267 {
2268 return true;
2269 }
2270
2271
2273 {
2275 {
2277 }
2278
2280 }
2281
2283 {
2285 }
2286
2287
2288
2290 {
2291 return super.CanReceiveAttachment(attachment, slotId);
2292 }
2293
2295 {
2296 int attachment_count = GetInventory().AttachmentCount();
2297 if ( attachment_count > 0 )
2298 {
2299 if (
HasBase() && attachment_count == 1 )
2300 {
2301 return false;
2302 }
2303
2304 return true;
2305 }
2306
2307 return false;
2308 }
2309
2311 {
2312 return true;
2313 }
2314
2316 {
2317 return false;
2318 }
2319
2320
2322 {
2323 return false;
2324 }
2325
2327 {
2328 return false;
2329 }
2330
2331
2333 {
2334 return false;
2335 }
2336
2337
2338
2340 {
2341 return true;
2342 }
2343
2345 {
2346 return true;
2347 }
2348
2351 {
2352 return false;
2353 }
2354
2355
2357 {
2358 return true;
2359 }
2360
2361
2363 {
2364 return false;
2365 }
2366
2367
2369 {
2370 return true;
2371 }
2372
2373
2375 {
2376 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2377 {
2378 return false;
2379 }
2380
2381 return true;
2382 }
2383
2385 {
2388
2389 return item;
2390 }
2391
2392
2394 {
2396 {
2397
2399
2400
2403
2405 if ( MemoryPointExists( slot_name + "_min" ) )
2406 {
2407 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2408 }
2409 if ( MemoryPointExists( slot_name + "_max" ) )
2410 {
2411 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2412 }
2413
2414
2417
2418
2421 center = ModelToWorld( center );
2422
2423
2426
2427 areaDamage.SetExtents( extents[0], extents[1] );
2428 areaDamage.SetAreaPosition( center );
2429 areaDamage.SetAreaOrientation( orientation );
2432 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2433 areaDamage.SetAmmoName( "BarbedWireHit" );
2434 areaDamage.Spawn();
2435
2437 }
2438 }
2439
2441 {
2442 if ( angle_deg != 0 )
2443 {
2444
2445 orientation[0] = orientation[0] - angle_deg;
2446
2447
2449 if ( MemoryPointExists( "rotate_axis" ) )
2450 {
2451 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2452 }
2453 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];
2454 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];
2455 center[0] = r_center_x;
2456 center[2] = r_center_z;
2457 }
2458 }
2459
2461 {
2463 {
2466 {
2467 if (areaDamage)
2468 {
2469 areaDamage.Destroy();
2470 }
2471
2473 }
2474 }
2475 }
2476
2478 {
2479 return true;
2480 }
2481
2482
2483
2484
2486 {
2488 }
2489
2491 {
2493 }
2494
2496 {
2498 }
2499
2501 {
2503
2504 switch ( material_type )
2505 {
2511 }
2512
2513 return "";
2514 }
2515
2517 {
2519
2520 switch ( material_type )
2521 {
2527 }
2528
2529 return "";
2530 }
2531
2532
2534 {
2536 {
2537
2539 {
2540 SetHealth(slot_name,"Health",item.GetHealth());
2541 }
2542 }
2543 }
2544
2546 {
2547 return 111;
2548 }
2549
2551 {
2552 super.SetActions();
2553
2557 }
2558
2559
2560
2561
2563 {
2564 }
2565
2568 {
2569 return null;
2570 }
2571
2573 {
2575 }
2576
2578 {
2581
2582 Man p;
2583
2584 #ifdef SERVER
2587 if (players.Count())
2588 p = players[0];
2589 #else
2591 #endif
2592
2594 {
2595 bool excluded = false;
2597 if (excludes)
2598 {
2599 foreach (string exclude : excludes)
2600 {
2602 {
2603 excluded = true;
2604 break;
2605 }
2606 }
2607 }
2608
2609 if (!excluded)
2610 {
2612 }
2613 }
2614
2616 }
2617}
2618
2620{
2621#ifdef BSB_DEBUG
2623#else
2624
2625#endif
2626}
2628{
2629#ifdef BSB_DEBUG_SPAM
2631#else
2632
2633#endif
2634}
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.