1375{
1377
1379
1381
1383
1389
1390
1391
1397
1403
1405
1409
1410
1412 {
1414
1415
1416 RegisterNetSyncVariableInt( "m_SyncParts01" );
1417 RegisterNetSyncVariableInt( "m_SyncParts02" );
1418 RegisterNetSyncVariableInt( "m_SyncParts03" );
1419 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1420 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1421 RegisterNetSyncVariableBool( "m_HasBase" );
1422
1423
1425
1426 if (ConfigIsExisting("hybridAttachments"))
1427 {
1430 }
1431 if (ConfigIsExisting("mountables"))
1432 {
1435 }
1436
1438 }
1439
1441 {
1442 super.EEDelete(parent);
1443
1445 {
1446 areaDamage.Destroy();
1447 }
1448
1449 }
1450
1452 {
1453 return "disableBaseDamage";
1454 }
1455
1457 {
1458 return true;
1459 }
1460
1462 {
1463 return EInventoryIconVisibility.HIDE_VICINITY;
1464 }
1465
1466
1468 {
1470 {
1471 SetSynchDirty();
1472 }
1473 }
1474
1476 {
1478 super.OnVariablesSynchronized();
1479
1481 }
1482
1484 {
1485
1487
1488
1490
1491
1493 }
1494
1495
1497 {
1498
1499 int offset;
1500 int mask;
1501
1502 if ( part_id >= 1 && part_id <= 31 )
1503 {
1504 offset = part_id - 1;
1505 mask = 1 << offset;
1506
1508 }
1509 else if ( part_id >= 32 && part_id <= 62 )
1510 {
1511 offset = ( part_id % 32 );
1512 mask = 1 << offset;
1513
1515 }
1516 else if ( part_id >= 63 && part_id <= 93 )
1517 {
1518 offset = ( part_id % 63 );
1519 mask = 1 << offset;
1520
1522 }
1523 }
1524
1526 {
1527
1528 int offset;
1529 int mask;
1530
1531 if ( part_id >= 1 && part_id <= 31 )
1532 {
1533 offset = part_id - 1;
1534 mask = 1 << offset;
1535
1537 }
1538 else if ( part_id >= 32 && part_id <= 62 )
1539 {
1540 offset = ( part_id % 32 );
1541 mask = 1 << offset;
1542
1544 }
1545 else if ( part_id >= 63 && part_id <= 93 )
1546 {
1547 offset = ( part_id % 63 );
1548 mask = 1 << offset;
1549
1551 }
1552 }
1553
1555 {
1556
1557 int offset;
1558 int mask;
1559
1560 if ( part_id >= 1 && part_id <= 31 )
1561 {
1562 offset = part_id - 1;
1563 mask = 1 << offset;
1564
1566 {
1567 return true;
1568 }
1569 }
1570 else if ( part_id >= 32 && part_id <= 62 )
1571 {
1572 offset = ( part_id % 32 );
1573 mask = 1 << offset;
1574
1576 {
1577 return true;
1578 }
1579 }
1580 else if ( part_id >= 63 && part_id <= 93 )
1581 {
1582 offset = ( part_id % 63 );
1583 mask = 1 << offset;
1584
1586 {
1587 return true;
1588 }
1589 }
1590
1591 return false;
1592 }
1593
1595 {
1598 }
1599
1601 {
1602
1605 }
1606
1608 {
1610 {
1613
1614 switch( build_action_id )
1615 {
1619 }
1620 }
1621 }
1622
1623
1625 {
1627 bool is_base = part.
IsBase();
1630 if ( is_part_built_sync )
1631 {
1633 {
1637
1638 if (is_base)
1639 {
1642 }
1643 }
1644 }
1645 else
1646 {
1648 {
1652
1653 if (is_base)
1654 {
1657 }
1658 }
1659 }
1660
1661
1663 }
1664
1665
1667 {
1670
1671 for ( int i = 0; i < construction_parts.Count(); ++i )
1672 {
1673 string key = construction_parts.GetKey( i );
1676 }
1677
1678
1680 }
1681
1683 {
1686
1687 for ( int i = 0; i < construction_parts.Count(); ++i )
1688 {
1689 string key = construction_parts.GetKey( i );
1691
1692 if ( value.
GetId() ==
id )
1693 {
1694 return value;
1695 }
1696 }
1697
1698 return NULL;
1699 }
1700
1701
1702
1704 {
1706 }
1707
1709 {
1711 }
1712
1714 {
1715 return true;
1716 }
1717
1719 {
1720 return false;
1721 }
1722
1723
1725 {
1728 {
1730 }
1731
1732 return construction_kit;
1733 }
1734
1736 {
1739 {
1741 }
1742 }
1743
1745 {
1747 }
1748
1750 {
1751 return "";
1752 }
1753
1755 {
1758 }
1759
1760
1762 {
1765 }
1766
1767
1769 {
1770 super.OnStoreSave( ctx );
1771
1772
1776
1778 }
1779
1781 {
1782 if ( !super.OnStoreLoad( ctx, version ) )
1783 return false;
1784
1785
1786
1788 {
1790 return false;
1791 }
1793 {
1795 return false;
1796 }
1798 {
1800 return false;
1801 }
1802
1803
1805 {
1807 return false;
1808 }
1809
1810
1811 return true;
1812 }
1813
1815 {
1816 super.AfterStoreLoad();
1817
1819 {
1821 }
1822 }
1823
1825 {
1826
1828
1829
1832
1833
1835 }
1836
1838 {
1839 super.OnCreatePhysics();
1842 }
1843
1845 {
1847 return;
1848
1849 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1850
1852 return;
1853
1855 string part_name = zone;
1857
1859 {
1860 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1861
1862 if ( construction_part && construction.IsPartConstructed( part_name ) )
1863 {
1865 construction.DestroyConnectedParts(part_name);
1866 }
1867
1868
1869 if ( part_name.
Contains(
"barbed") )
1870 {
1871 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1872 if (barbed_wire)
1873 barbed_wire.SetMountedState( false );
1874 }
1875 }
1876 }
1877
1879 {
1881 {
1883 }
1884
1885 super.EEOnAfterLoad();
1886 }
1887
1889 {
1890 super.EEInit();
1891
1892
1894
1895
1896 #ifdef DEVELOPER
1898 #endif
1899 }
1900
1902 {
1903 super.EEItemAttached( item, slot_name );
1904
1908 }
1909
1911 {
1912 super.EEItemDetached( item, slot_name );
1913
1916 }
1917
1918 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1919 {
1922
1925 }
1926
1927
1929 {
1930 return true;
1931 }
1932
1933
1934
1936 {
1938
1939
1940 if (construtionPart.
IsBase())
1941 {
1943
1944
1946 }
1947
1948
1950
1951
1953
1954
1956
1958
1960
1961
1963
1964
1966 }
1967
1969 {
1970
1972 }
1973
1974
1976 {
1979
1980
1982
1983
1985
1986
1988
1989
1991
1993
1994
1996
1997
1999
2000
2001 if (construtionPart.
IsBase())
2002 {
2003
2005 }
2006
2009 }
2010
2012 {
2013
2015 }
2016
2017
2018 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2019 {
2022
2023
2025
2026
2028
2029
2031
2032
2034
2036
2037
2039
2040
2042
2043
2044 if (construtionPart.
IsBase())
2045 {
2046
2048 }
2049
2052 }
2053
2055 {
2056
2058 }
2059
2061 {
2062 bool process = false;
2063
2064
2068
2069 if (process)
2070 {
2071 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2072 {
2074 return;
2075 }
2076
2078 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2079 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2080
2081
2083 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2084 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2085 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2086 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2087 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2088 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2089 mins = minTmp;
2090 maxs = maxTmp;
2091
2092 maxs[1] = maxs[1] + 0.35;
2093
2095 }
2096 }
2097
2099 {
2102
2103
2105 foreach (
EntityAI entity : foundEntities)
2106 {
2109 }
2110 }
2111
2112
2114 {
2116
2120 }
2121
2123 {
2125
2127 {
2129 }
2130 else
2131 {
2133 }
2134
2136 }
2137
2139 {
2141
2143 foreach (
string slotName : attachmentSlots)
2144 {
2146 }
2147
2148
2151 else
2153
2155 }
2156
2158 {
2159 string slotNameMounted = slot_name + "_Mounted";
2160 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2161
2162 if (attachment)
2163 {
2164 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2165 if (barbedWire && barbedWire.IsMounted())
2167 else
2169
2170 if (is_locked)
2171 {
2172 SetAnimationPhase(slotNameMounted, 0);
2173 SetAnimationPhase(slot_name, 1);
2174 }
2175 else
2176 {
2177 SetAnimationPhase(slotNameMounted, 1);
2178 SetAnimationPhase(slot_name, 0);
2179 }
2180 }
2181 else
2182 {
2183 SetAnimationPhase(slotNameMounted, 1);
2184 SetAnimationPhase(slot_name, 1);
2185
2187 }
2188 }
2189
2190
2192 {
2195
2198
2201
2202 foreach (
string slotName : attachmentSlots)
2203 {
2205 }
2206
2207
2209 {
2212
2214 }
2215 else
2216 {
2219
2221 }
2222
2225 }
2226
2228 {
2229
2231 return;
2232
2233 string slot_name_mounted = slot_name + "_Mounted";
2234 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2235
2236
2238 RemoveProxyPhysics( slot_name_mounted );
2239 RemoveProxyPhysics( slot_name );
2240
2241 if ( attachment )
2242 {
2244 if ( is_locked )
2245 {
2247 AddProxyPhysics( slot_name_mounted );
2248 }
2249 else
2250 {
2252 AddProxyPhysics( slot_name );
2253 }
2254 }
2255 }
2256
2258 {
2259 SetAffectPathgraph( true, false );
2261 }
2262
2264 {
2265 return true;
2266 }
2267
2269 {
2270 return true;
2271 }
2272
2274 {
2275 if ( attachment )
2276 {
2278 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2279
2280 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2281 }
2282
2283 return false;
2284 }
2285
2287 {
2289 }
2290
2291
2293 {
2294 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2295 if (
GetGame().ConfigIsExisting( config_path ) )
2296 {
2298 }
2299 }
2300
2302 {
2303 return true;
2304 }
2305
2307 {
2308 return true;
2309 }
2310
2312 {
2313 return true;
2314 }
2315
2316
2318 {
2320 {
2322 }
2323
2325 }
2326
2328 {
2330 }
2331
2332
2333
2335 {
2336 return super.CanReceiveAttachment(attachment, slotId);
2337 }
2338
2340 {
2341 int attachment_count = GetInventory().AttachmentCount();
2342 if ( attachment_count > 0 )
2343 {
2344 if (
HasBase() && attachment_count == 1 )
2345 {
2346 return false;
2347 }
2348
2349 return true;
2350 }
2351
2352 return false;
2353 }
2354
2356 {
2357 return true;
2358 }
2359
2361 {
2362 return false;
2363 }
2364
2365
2367 {
2368 return false;
2369 }
2370
2372 {
2373 return false;
2374 }
2375
2376
2378 {
2379 return false;
2380 }
2381
2382
2383
2385 {
2386 return true;
2387 }
2388
2390 {
2391 return true;
2392 }
2393
2396 {
2397 return false;
2398 }
2399
2400
2402 {
2403 return true;
2404 }
2405
2406
2408 {
2409 return false;
2410 }
2411
2412
2414 {
2415 return true;
2416 }
2417
2418
2420 {
2421 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2422 {
2423 return false;
2424 }
2425
2426 return true;
2427 }
2428
2430 {
2433
2434 return item;
2435 }
2436
2437
2439 {
2441 {
2442
2444
2445
2448
2450 if ( MemoryPointExists( slot_name + "_min" ) )
2451 {
2452 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2453 }
2454 if ( MemoryPointExists( slot_name + "_max" ) )
2455 {
2456 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2457 }
2458
2459
2462
2463
2466 center = ModelToWorld( center );
2467
2468
2471
2472 areaDamage.SetExtents( extents[0], extents[1] );
2473 areaDamage.SetAreaPosition( center );
2474 areaDamage.SetAreaOrientation( orientation );
2477 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2478 areaDamage.SetAmmoName( "BarbedWireHit" );
2479 areaDamage.Spawn();
2480
2482 }
2483 }
2484
2486 {
2487 if ( angle_deg != 0 )
2488 {
2489
2490 orientation[0] = orientation[0] - angle_deg;
2491
2492
2494 if ( MemoryPointExists( "rotate_axis" ) )
2495 {
2496 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2497 }
2498 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];
2499 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];
2500 center[0] = r_center_x;
2501 center[2] = r_center_z;
2502 }
2503 }
2504
2506 {
2508 {
2511 {
2512 if (areaDamage)
2513 {
2514 areaDamage.Destroy();
2515 }
2516
2518 }
2519 }
2520 }
2521
2523 {
2524 return true;
2525 }
2526
2527
2528
2529
2531 {
2533 }
2534
2536 {
2538 }
2539
2541 {
2543 }
2544
2546 {
2548
2549 switch ( material_type )
2550 {
2556 }
2557
2558 return "";
2559 }
2560
2562 {
2564
2565 switch ( material_type )
2566 {
2572 }
2573
2574 return "";
2575 }
2576
2577
2579 {
2581 {
2582
2584 {
2585 SetHealth(slot_name,"Health",item.GetHealth());
2586 }
2587 }
2588 }
2589
2591 {
2592 return 111;
2593 }
2594
2596 {
2597 super.SetActions();
2598
2602 }
2603
2604
2605
2606
2608 {
2609 }
2610
2613 {
2614 return null;
2615 }
2616
2618 {
2620 }
2621
2623 {
2626
2627 Man p;
2628
2629 #ifdef SERVER
2632 if (players.Count())
2633 p = players[0];
2634 #else
2636 #endif
2637
2639 {
2640 bool excluded = false;
2642 if (excludes)
2643 {
2644 foreach (string exclude : excludes)
2645 {
2647 {
2648 excluded = true;
2649 break;
2650 }
2651 }
2652 }
2653
2654 if (!excluded)
2655 {
2657 }
2658 }
2659
2661 }
2662}
2663
2665{
2666#ifdef BSB_DEBUG
2668#else
2669
2670#endif
2671}
2673{
2674#ifdef BSB_DEBUG_SPAM
2676#else
2677
2678#endif
2679}
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.