1370{
1372
1374
1376
1378
1384
1385
1386
1392
1398
1400
1404
1405
1407 {
1409
1410
1411 RegisterNetSyncVariableInt( "m_SyncParts01" );
1412 RegisterNetSyncVariableInt( "m_SyncParts02" );
1413 RegisterNetSyncVariableInt( "m_SyncParts03" );
1414 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1415 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1416 RegisterNetSyncVariableBool( "m_HasBase" );
1417
1418
1420
1421 if (ConfigIsExisting("hybridAttachments"))
1422 {
1425 }
1426 if (ConfigIsExisting("mountables"))
1427 {
1430 }
1431
1433 }
1434
1436 {
1437 super.EEDelete(parent);
1438
1440 {
1441 areaDamage.Destroy();
1442 }
1443
1444 }
1445
1447 {
1448 return "disableBaseDamage";
1449 }
1450
1452 {
1453 return true;
1454 }
1455
1457 {
1458 return EInventoryIconVisibility.HIDE_VICINITY;
1459 }
1460
1461
1463 {
1465 {
1466 SetSynchDirty();
1467 }
1468 }
1469
1471 {
1473 super.OnVariablesSynchronized();
1474
1476 }
1477
1479 {
1480
1482
1483
1485
1486
1488 }
1489
1490
1492 {
1493
1494 int offset;
1495 int mask;
1496
1497 if ( part_id >= 1 && part_id <= 31 )
1498 {
1499 offset = part_id - 1;
1500 mask = 1 << offset;
1501
1503 }
1504 else if ( part_id >= 32 && part_id <= 62 )
1505 {
1506 offset = ( part_id % 32 );
1507 mask = 1 << offset;
1508
1510 }
1511 else if ( part_id >= 63 && part_id <= 93 )
1512 {
1513 offset = ( part_id % 63 );
1514 mask = 1 << offset;
1515
1517 }
1518 }
1519
1521 {
1522
1523 int offset;
1524 int mask;
1525
1526 if ( part_id >= 1 && part_id <= 31 )
1527 {
1528 offset = part_id - 1;
1529 mask = 1 << offset;
1530
1532 }
1533 else if ( part_id >= 32 && part_id <= 62 )
1534 {
1535 offset = ( part_id % 32 );
1536 mask = 1 << offset;
1537
1539 }
1540 else if ( part_id >= 63 && part_id <= 93 )
1541 {
1542 offset = ( part_id % 63 );
1543 mask = 1 << offset;
1544
1546 }
1547 }
1548
1550 {
1551
1552 int offset;
1553 int mask;
1554
1555 if ( part_id >= 1 && part_id <= 31 )
1556 {
1557 offset = part_id - 1;
1558 mask = 1 << offset;
1559
1561 {
1562 return true;
1563 }
1564 }
1565 else if ( part_id >= 32 && part_id <= 62 )
1566 {
1567 offset = ( part_id % 32 );
1568 mask = 1 << offset;
1569
1571 {
1572 return true;
1573 }
1574 }
1575 else if ( part_id >= 63 && part_id <= 93 )
1576 {
1577 offset = ( part_id % 63 );
1578 mask = 1 << offset;
1579
1581 {
1582 return true;
1583 }
1584 }
1585
1586 return false;
1587 }
1588
1590 {
1593 }
1594
1596 {
1597
1600 }
1601
1603 {
1605 {
1608
1609 switch( build_action_id )
1610 {
1614 }
1615 }
1616 }
1617
1618
1620 {
1622 bool is_base = part.
IsBase();
1625 if ( is_part_built_sync )
1626 {
1628 {
1632
1633 if (is_base)
1634 {
1637 }
1638 }
1639 }
1640 else
1641 {
1643 {
1647
1648 if (is_base)
1649 {
1652 }
1653 }
1654 }
1655
1656
1658 }
1659
1660
1662 {
1665
1666 for ( int i = 0; i < construction_parts.Count(); ++i )
1667 {
1668 string key = construction_parts.GetKey( i );
1671 }
1672
1673
1675 }
1676
1678 {
1681
1682 for ( int i = 0; i < construction_parts.Count(); ++i )
1683 {
1684 string key = construction_parts.GetKey( i );
1686
1687 if ( value.
GetId() ==
id )
1688 {
1689 return value;
1690 }
1691 }
1692
1693 return NULL;
1694 }
1695
1696
1697
1699 {
1701 }
1702
1704 {
1706 }
1707
1709 {
1710 return true;
1711 }
1712
1714 {
1715 return false;
1716 }
1717
1718
1720 {
1723 {
1725 }
1726
1727 return construction_kit;
1728 }
1729
1731 {
1734 {
1736 }
1737 }
1738
1740 {
1742 }
1743
1745 {
1746 return "";
1747 }
1748
1750 {
1753 }
1754
1755
1757 {
1760 }
1761
1762
1764 {
1765 super.OnStoreSave( ctx );
1766
1767
1771
1773 }
1774
1776 {
1777 if ( !super.OnStoreLoad( ctx, version ) )
1778 return false;
1779
1780
1781
1783 {
1785 return false;
1786 }
1788 {
1790 return false;
1791 }
1793 {
1795 return false;
1796 }
1797
1798
1800 {
1802 return false;
1803 }
1804
1805
1806 return true;
1807 }
1808
1810 {
1811 super.AfterStoreLoad();
1812
1814 {
1816 }
1817 }
1818
1820 {
1821
1823
1824
1827
1828
1830 }
1831
1833 {
1834 super.OnCreatePhysics();
1837 }
1838
1840 {
1842 return;
1843
1844 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1845
1847 return;
1848
1850 string part_name = zone;
1852
1854 {
1855 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1856
1857 if ( construction_part && construction.IsPartConstructed( part_name ) )
1858 {
1860 construction.DestroyConnectedParts(part_name);
1861 }
1862
1863
1864 if ( part_name.
Contains(
"barbed") )
1865 {
1866 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1867 if (barbed_wire)
1868 barbed_wire.SetMountedState( false );
1869 }
1870 }
1871 }
1872
1874 {
1876 {
1878 }
1879
1880 super.EEOnAfterLoad();
1881 }
1882
1884 {
1885 super.EEInit();
1886
1887
1889
1890
1891 #ifdef DEVELOPER
1893 #endif
1894 }
1895
1897 {
1898 super.EEItemAttached( item, slot_name );
1899
1903 }
1904
1906 {
1907 super.EEItemDetached( item, slot_name );
1908
1911 }
1912
1913 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1914 {
1917
1920 }
1921
1922
1924 {
1925 return true;
1926 }
1927
1928
1929
1931 {
1933
1934
1935 if (construtionPart.
IsBase())
1936 {
1938
1939
1941 }
1942
1943
1945
1946
1948
1949
1951
1953
1955
1956
1958
1959
1961 }
1962
1964 {
1965
1967 }
1968
1969
1971 {
1974
1975
1977
1978
1980
1981
1983
1984
1986
1988
1989
1991
1992
1994
1995
1996 if (construtionPart.
IsBase())
1997 {
1998
2000 }
2001
2004 }
2005
2007 {
2008
2010 }
2011
2012
2013 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2014 {
2017
2018
2020
2021
2023
2024
2026
2027
2029
2031
2032
2034
2035
2037
2038
2039 if (construtionPart.
IsBase())
2040 {
2041
2043 }
2044
2047 }
2048
2050 {
2051
2053 }
2054
2056 {
2057 bool process = false;
2058
2059
2063
2064 if (process)
2065 {
2066 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2067 {
2069 return;
2070 }
2071
2073 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2074 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2075
2076
2078 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2079 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2080 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2081 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2082 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2083 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2084 mins = minTmp;
2085 maxs = maxTmp;
2086
2087 maxs[1] = maxs[1] + 0.35;
2088
2090 }
2091 }
2092
2094 {
2097
2098
2100 foreach (
EntityAI entity : foundEntities)
2101 {
2104 }
2105 }
2106
2107
2109 {
2111
2115 }
2116
2118 {
2120
2122 {
2124 }
2125 else
2126 {
2128 }
2129
2131 }
2132
2134 {
2136
2138 foreach (
string slotName : attachmentSlots)
2139 {
2141 }
2142
2143
2146 else
2148
2150 }
2151
2153 {
2154 string slotNameMounted = slot_name + "_Mounted";
2155 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2156
2157 if (attachment)
2158 {
2159 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2160 if (barbedWire && barbedWire.IsMounted())
2162 else
2164
2165 if (is_locked)
2166 {
2167 SetAnimationPhase(slotNameMounted, 0);
2168 SetAnimationPhase(slot_name, 1);
2169 }
2170 else
2171 {
2172 SetAnimationPhase(slotNameMounted, 1);
2173 SetAnimationPhase(slot_name, 0);
2174 }
2175 }
2176 else
2177 {
2178 SetAnimationPhase(slotNameMounted, 1);
2179 SetAnimationPhase(slot_name, 1);
2180
2182 }
2183 }
2184
2185
2187 {
2190
2193
2196
2197 foreach (
string slotName : attachmentSlots)
2198 {
2200 }
2201
2202
2204 {
2207
2209 }
2210 else
2211 {
2214
2216 }
2217
2220 }
2221
2223 {
2224
2226 return;
2227
2228 string slot_name_mounted = slot_name + "_Mounted";
2229 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2230
2231
2233 RemoveProxyPhysics( slot_name_mounted );
2234 RemoveProxyPhysics( slot_name );
2235
2236 if ( attachment )
2237 {
2239 if ( is_locked )
2240 {
2242 AddProxyPhysics( slot_name_mounted );
2243 }
2244 else
2245 {
2247 AddProxyPhysics( slot_name );
2248 }
2249 }
2250 }
2251
2253 {
2254 SetAffectPathgraph( true, false );
2256 }
2257
2259 {
2260 return true;
2261 }
2262
2264 {
2265 return true;
2266 }
2267
2269 {
2270 if ( attachment )
2271 {
2273 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2274
2275 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2276 }
2277
2278 return false;
2279 }
2280
2282 {
2284 }
2285
2286
2288 {
2289 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2290 if (
GetGame().ConfigIsExisting( config_path ) )
2291 {
2293 }
2294 }
2295
2297 {
2298 return true;
2299 }
2300
2302 {
2303 return true;
2304 }
2305
2307 {
2308 return true;
2309 }
2310
2311
2313 {
2315 {
2317 }
2318
2320 }
2321
2323 {
2325 }
2326
2327
2328
2330 {
2331 return super.CanReceiveAttachment(attachment, slotId);
2332 }
2333
2335 {
2336 int attachment_count = GetInventory().AttachmentCount();
2337 if ( attachment_count > 0 )
2338 {
2339 if (
HasBase() && attachment_count == 1 )
2340 {
2341 return false;
2342 }
2343
2344 return true;
2345 }
2346
2347 return false;
2348 }
2349
2351 {
2352 return true;
2353 }
2354
2356 {
2357 return false;
2358 }
2359
2360
2362 {
2363 return false;
2364 }
2365
2367 {
2368 return false;
2369 }
2370
2371
2373 {
2374 return false;
2375 }
2376
2377
2378
2380 {
2381 return true;
2382 }
2383
2385 {
2386 return true;
2387 }
2388
2391 {
2392 return false;
2393 }
2394
2395
2397 {
2398 return true;
2399 }
2400
2401
2403 {
2404 return false;
2405 }
2406
2407
2409 {
2410 return true;
2411 }
2412
2413
2415 {
2416 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2417 {
2418 return false;
2419 }
2420
2421 return true;
2422 }
2423
2425 {
2428
2429 return item;
2430 }
2431
2432
2434 {
2436 {
2437
2439
2440
2443
2445 if ( MemoryPointExists( slot_name + "_min" ) )
2446 {
2447 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2448 }
2449 if ( MemoryPointExists( slot_name + "_max" ) )
2450 {
2451 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2452 }
2453
2454
2457
2458
2461 center = ModelToWorld( center );
2462
2463
2466
2467 areaDamage.SetExtents( extents[0], extents[1] );
2468 areaDamage.SetAreaPosition( center );
2469 areaDamage.SetAreaOrientation( orientation );
2472 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2473 areaDamage.SetAmmoName( "BarbedWireHit" );
2474 areaDamage.Spawn();
2475
2477 }
2478 }
2479
2481 {
2482 if ( angle_deg != 0 )
2483 {
2484
2485 orientation[0] = orientation[0] - angle_deg;
2486
2487
2489 if ( MemoryPointExists( "rotate_axis" ) )
2490 {
2491 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2492 }
2493 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];
2494 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];
2495 center[0] = r_center_x;
2496 center[2] = r_center_z;
2497 }
2498 }
2499
2501 {
2503 {
2506 {
2507 if (areaDamage)
2508 {
2509 areaDamage.Destroy();
2510 }
2511
2513 }
2514 }
2515 }
2516
2518 {
2519 return true;
2520 }
2521
2522
2523
2524
2526 {
2528 }
2529
2531 {
2533 }
2534
2536 {
2538 }
2539
2541 {
2543
2544 switch ( material_type )
2545 {
2551 }
2552
2553 return "";
2554 }
2555
2557 {
2559
2560 switch ( material_type )
2561 {
2567 }
2568
2569 return "";
2570 }
2571
2572
2574 {
2576 {
2577
2579 {
2580 SetHealth(slot_name,"Health",item.GetHealth());
2581 }
2582 }
2583 }
2584
2586 {
2587 return 111;
2588 }
2589
2591 {
2592 super.SetActions();
2593
2597 }
2598
2599
2600
2601
2603 {
2604 }
2605
2608 {
2609 return null;
2610 }
2611
2613 {
2615 }
2616
2618 {
2621
2622 Man p;
2623
2624 #ifdef SERVER
2627 if (players.Count())
2628 p = players[0];
2629 #else
2631 #endif
2632
2634 {
2635 bool excluded = false;
2637 if (excludes)
2638 {
2639 foreach (string exclude : excludes)
2640 {
2642 {
2643 excluded = true;
2644 break;
2645 }
2646 }
2647 }
2648
2649 if (!excluded)
2650 {
2652 }
2653 }
2654
2656 }
2657}
2658
2660{
2661#ifdef BSB_DEBUG
2663#else
2664
2665#endif
2666}
2668{
2669#ifdef BSB_DEBUG_SPAM
2671#else
2672
2673#endif
2674}
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.