1380{
1382
1384
1386
1388
1394
1395
1396
1402
1408
1410
1414
1415
1417 {
1419
1420
1421 RegisterNetSyncVariableInt( "m_SyncParts01" );
1422 RegisterNetSyncVariableInt( "m_SyncParts02" );
1423 RegisterNetSyncVariableInt( "m_SyncParts03" );
1424 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1425 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1426 RegisterNetSyncVariableBool( "m_HasBase" );
1427
1428
1430
1431 if (ConfigIsExisting("hybridAttachments"))
1432 {
1435 }
1436 if (ConfigIsExisting("mountables"))
1437 {
1440 }
1441
1443 }
1444
1446 {
1447 super.EEDelete(parent);
1448
1450 {
1451 areaDamage.Destroy();
1452 }
1453
1454 }
1455
1457 {
1458 return "disableBaseDamage";
1459 }
1460
1462 {
1463 return true;
1464 }
1465
1467 {
1468 return EInventoryIconVisibility.HIDE_VICINITY;
1469 }
1470
1471
1473 {
1475 {
1476 SetSynchDirty();
1477 }
1478 }
1479
1481 {
1483 super.OnVariablesSynchronized();
1484
1486 }
1487
1489 {
1490
1492
1493
1495
1496
1498 }
1499
1500
1502 {
1503
1504 int offset;
1505 int mask;
1506
1507 if ( part_id >= 1 && part_id <= 31 )
1508 {
1509 offset = part_id - 1;
1510 mask = 1 << offset;
1511
1513 }
1514 else if ( part_id >= 32 && part_id <= 62 )
1515 {
1516 offset = ( part_id % 32 );
1517 mask = 1 << offset;
1518
1520 }
1521 else if ( part_id >= 63 && part_id <= 93 )
1522 {
1523 offset = ( part_id % 63 );
1524 mask = 1 << offset;
1525
1527 }
1528 }
1529
1531 {
1532
1533 int offset;
1534 int mask;
1535
1536 if ( part_id >= 1 && part_id <= 31 )
1537 {
1538 offset = part_id - 1;
1539 mask = 1 << offset;
1540
1542 }
1543 else if ( part_id >= 32 && part_id <= 62 )
1544 {
1545 offset = ( part_id % 32 );
1546 mask = 1 << offset;
1547
1549 }
1550 else if ( part_id >= 63 && part_id <= 93 )
1551 {
1552 offset = ( part_id % 63 );
1553 mask = 1 << offset;
1554
1556 }
1557 }
1558
1560 {
1561
1562 int offset;
1563 int mask;
1564
1565 if ( part_id >= 1 && part_id <= 31 )
1566 {
1567 offset = part_id - 1;
1568 mask = 1 << offset;
1569
1571 {
1572 return true;
1573 }
1574 }
1575 else if ( part_id >= 32 && part_id <= 62 )
1576 {
1577 offset = ( part_id % 32 );
1578 mask = 1 << offset;
1579
1581 {
1582 return true;
1583 }
1584 }
1585 else if ( part_id >= 63 && part_id <= 93 )
1586 {
1587 offset = ( part_id % 63 );
1588 mask = 1 << offset;
1589
1591 {
1592 return true;
1593 }
1594 }
1595
1596 return false;
1597 }
1598
1600 {
1603 }
1604
1606 {
1607
1610 }
1611
1613 {
1615 {
1618
1619 switch( build_action_id )
1620 {
1624 }
1625 }
1626 }
1627
1628
1630 {
1632 bool is_base = part.
IsBase();
1635 if ( is_part_built_sync )
1636 {
1638 {
1642
1643 if (is_base)
1644 {
1647 }
1648 }
1649 }
1650 else
1651 {
1653 {
1657
1658 if (is_base)
1659 {
1662 }
1663 }
1664 }
1665
1666
1668 }
1669
1670
1672 {
1675
1676 for ( int i = 0; i < construction_parts.Count(); ++i )
1677 {
1678 string key = construction_parts.GetKey( i );
1681 }
1682
1683
1685 }
1686
1688 {
1691
1692 for ( int i = 0; i < construction_parts.Count(); ++i )
1693 {
1694 string key = construction_parts.GetKey( i );
1696
1697 if ( value.
GetId() ==
id )
1698 {
1699 return value;
1700 }
1701 }
1702
1703 return NULL;
1704 }
1705
1706
1707
1709 {
1711 }
1712
1714 {
1716 }
1717
1719 {
1720 return true;
1721 }
1722
1724 {
1725 return false;
1726 }
1727
1728
1730 {
1733 {
1735 }
1736
1737 return construction_kit;
1738 }
1739
1741 {
1744 {
1746 }
1747 }
1748
1750 {
1752 }
1753
1755 {
1756 return "";
1757 }
1758
1760 {
1763 }
1764
1765
1767 {
1770 }
1771
1772
1774 {
1775 super.OnStoreSave( ctx );
1776
1777
1781
1783 }
1784
1786 {
1787 if ( !super.OnStoreLoad( ctx, version ) )
1788 return false;
1789
1790
1791
1793 {
1795 return false;
1796 }
1798 {
1800 return false;
1801 }
1803 {
1805 return false;
1806 }
1807
1808
1810 {
1812 return false;
1813 }
1814
1815
1816 return true;
1817 }
1818
1820 {
1821 super.AfterStoreLoad();
1822
1824 {
1826 }
1827 }
1828
1830 {
1831
1833
1834
1837
1838
1840 }
1841
1843 {
1844 super.OnCreatePhysics();
1847 }
1848
1850 {
1852 return;
1853
1854 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1855
1857 return;
1858
1860 string part_name = zone;
1862
1864 {
1865 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1866
1867 if ( construction_part && construction.IsPartConstructed( part_name ) )
1868 {
1870 construction.DestroyConnectedParts(part_name);
1871 }
1872
1873
1874 if ( part_name.
Contains(
"barbed") )
1875 {
1876 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1877 if (barbed_wire)
1878 barbed_wire.SetMountedState( false );
1879 }
1880 }
1881 }
1882
1884 {
1886 {
1888 }
1889
1890 super.EEOnAfterLoad();
1891 }
1892
1894 {
1895 super.EEInit();
1896
1897
1899
1900
1901 #ifdef DEVELOPER
1903 #endif
1904 }
1905
1907 {
1908 super.EEItemAttached( item, slot_name );
1909
1913 }
1914
1916 {
1917 super.EEItemDetached( item, slot_name );
1918
1921 }
1922
1923 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1924 {
1927
1930 }
1931
1932
1934 {
1935 return true;
1936 }
1937
1938
1939
1941 {
1943
1944
1945 if (construtionPart.
IsBase())
1946 {
1948
1949
1951 }
1952
1953
1955
1956
1958
1959
1961
1963
1965
1966
1968
1969
1971 }
1972
1974 {
1975
1977 }
1978
1979
1981 {
1984
1985
1987
1988
1990
1991
1993
1994
1996
1998
1999
2001
2002
2004
2005
2006 if (construtionPart.
IsBase())
2007 {
2008
2010 }
2011
2014 }
2015
2017 {
2018
2020 }
2021
2022
2023 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2024 {
2027
2028
2030
2031
2033
2034
2036
2037
2039
2041
2042
2044
2045
2047
2048
2049 if (construtionPart.
IsBase())
2050 {
2051
2053 }
2054
2057 }
2058
2060 {
2061
2063 }
2064
2066 {
2067 bool process = false;
2068
2069
2073
2074 if (process)
2075 {
2076 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2077 {
2079 return;
2080 }
2081
2083 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2084 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2085
2086
2088 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2089 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2090 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2091 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2092 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2093 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2094 mins = minTmp;
2095 maxs = maxTmp;
2096
2097 maxs[1] = maxs[1] + 0.35;
2098
2100 }
2101 }
2102
2104 {
2107
2108
2110 foreach (
EntityAI entity : foundEntities)
2111 {
2114 }
2115 }
2116
2117
2119 {
2121
2125 }
2126
2128 {
2130
2132 {
2134 }
2135 else
2136 {
2138 }
2139
2141 }
2142
2144 {
2146
2148 foreach (
string slotName : attachmentSlots)
2149 {
2151 }
2152
2153
2156 else
2158
2160 }
2161
2163 {
2164 string slotNameMounted = slot_name + "_Mounted";
2165 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2166
2167 if (attachment)
2168 {
2169 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2170 if (barbedWire && barbedWire.IsMounted())
2172 else
2174
2175 if (is_locked)
2176 {
2177 SetAnimationPhase(slotNameMounted, 0);
2178 SetAnimationPhase(slot_name, 1);
2179 }
2180 else
2181 {
2182 SetAnimationPhase(slotNameMounted, 1);
2183 SetAnimationPhase(slot_name, 0);
2184 }
2185 }
2186 else
2187 {
2188 SetAnimationPhase(slotNameMounted, 1);
2189 SetAnimationPhase(slot_name, 1);
2190
2192 }
2193 }
2194
2195
2197 {
2200
2203
2206
2207 foreach (
string slotName : attachmentSlots)
2208 {
2210 }
2211
2212
2214 {
2217
2219 }
2220 else
2221 {
2224
2226 }
2227
2230 }
2231
2233 {
2234
2236 return;
2237
2238 string slot_name_mounted = slot_name + "_Mounted";
2239 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2240
2241
2243 RemoveProxyPhysics( slot_name_mounted );
2244 RemoveProxyPhysics( slot_name );
2245
2246 if ( attachment )
2247 {
2249 if ( is_locked )
2250 {
2252 AddProxyPhysics( slot_name_mounted );
2253 }
2254 else
2255 {
2257 AddProxyPhysics( slot_name );
2258 }
2259 }
2260 }
2261
2263 {
2264 SetAffectPathgraph( true, false );
2266 }
2267
2269 {
2270 return true;
2271 }
2272
2274 {
2275 return true;
2276 }
2277
2279 {
2280 if ( attachment )
2281 {
2283 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2284
2285 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2286 }
2287
2288 return false;
2289 }
2290
2292 {
2294 }
2295
2296
2298 {
2299 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2300 if (
GetGame().ConfigIsExisting( config_path ) )
2301 {
2303 }
2304 }
2305
2307 {
2308 return true;
2309 }
2310
2312 {
2313 return true;
2314 }
2315
2317 {
2318 return true;
2319 }
2320
2321
2323 {
2325 {
2327 }
2328
2330 }
2331
2333 {
2335 }
2336
2337
2338
2340 {
2341 return super.CanReceiveAttachment(attachment, slotId);
2342 }
2343
2345 {
2346 int attachment_count = GetInventory().AttachmentCount();
2347 if ( attachment_count > 0 )
2348 {
2349 if (
HasBase() && attachment_count == 1 )
2350 {
2351 return false;
2352 }
2353
2354 return true;
2355 }
2356
2357 return false;
2358 }
2359
2361 {
2362 return true;
2363 }
2364
2366 {
2367 return false;
2368 }
2369
2370
2372 {
2373 return false;
2374 }
2375
2377 {
2378 return false;
2379 }
2380
2381
2383 {
2384 return false;
2385 }
2386
2387
2388
2390 {
2391 return true;
2392 }
2393
2395 {
2396 return true;
2397 }
2398
2401 {
2402 return false;
2403 }
2404
2405
2407 {
2408 return true;
2409 }
2410
2411
2413 {
2414 return false;
2415 }
2416
2417
2419 {
2420 return true;
2421 }
2422
2423
2425 {
2426 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2427 {
2428 return false;
2429 }
2430
2431 return true;
2432 }
2433
2435 {
2438
2439 return item;
2440 }
2441
2442
2444 {
2446 {
2447
2449
2450
2453
2455 if ( MemoryPointExists( slot_name + "_min" ) )
2456 {
2457 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2458 }
2459 if ( MemoryPointExists( slot_name + "_max" ) )
2460 {
2461 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2462 }
2463
2464
2467
2468
2471 center = ModelToWorld( center );
2472
2473
2476
2477 areaDamage.SetExtents( extents[0], extents[1] );
2478 areaDamage.SetAreaPosition( center );
2479 areaDamage.SetAreaOrientation( orientation );
2482 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2483 areaDamage.SetAmmoName( "BarbedWireHit" );
2484 areaDamage.Spawn();
2485
2487 }
2488 }
2489
2491 {
2492 if ( angle_deg != 0 )
2493 {
2494
2495 orientation[0] = orientation[0] - angle_deg;
2496
2497
2499 if ( MemoryPointExists( "rotate_axis" ) )
2500 {
2501 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2502 }
2503 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];
2504 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];
2505 center[0] = r_center_x;
2506 center[2] = r_center_z;
2507 }
2508 }
2509
2511 {
2513 {
2516 {
2517 if (areaDamage)
2518 {
2519 areaDamage.Destroy();
2520 }
2521
2523 }
2524 }
2525 }
2526
2528 {
2529 return true;
2530 }
2531
2532
2533
2534
2536 {
2538 }
2539
2541 {
2543 }
2544
2546 {
2548 }
2549
2551 {
2553
2554 switch ( material_type )
2555 {
2561 }
2562
2563 return "";
2564 }
2565
2567 {
2569
2570 switch ( material_type )
2571 {
2577 }
2578
2579 return "";
2580 }
2581
2582
2584 {
2586 {
2587
2589 {
2590 SetHealth(slot_name,"Health",item.GetHealth());
2591 }
2592 }
2593 }
2594
2596 {
2597 return 111;
2598 }
2599
2601 {
2602 super.SetActions();
2603
2607 }
2608
2609
2610
2611
2613 {
2614 }
2615
2618 {
2619 return null;
2620 }
2621
2623 {
2625 }
2626
2628 {
2631
2632 Man p;
2633
2634 #ifdef SERVER
2637 if (players.Count())
2638 p = players[0];
2639 #else
2641 #endif
2642
2644 {
2645 bool excluded = false;
2647 if (excludes)
2648 {
2649 foreach (string exclude : excludes)
2650 {
2652 {
2653 excluded = true;
2654 break;
2655 }
2656 }
2657 }
2658
2659 if (!excluded)
2660 {
2662 }
2663 }
2664
2666 }
2667}
2668
2670{
2671#ifdef BSB_DEBUG
2673#else
2674
2675#endif
2676}
2678{
2679#ifdef BSB_DEBUG_SPAM
2681#else
2682
2683#endif
2684}
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.