1394{
1396
1398
1400
1402
1408
1409
1410
1416
1422
1424
1428
1429
1431 {
1433
1434
1435 RegisterNetSyncVariableInt( "m_SyncParts01" );
1436 RegisterNetSyncVariableInt( "m_SyncParts02" );
1437 RegisterNetSyncVariableInt( "m_SyncParts03" );
1438 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1439 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1440 RegisterNetSyncVariableBool( "m_HasBase" );
1441
1442
1444
1445 if (ConfigIsExisting("hybridAttachments"))
1446 {
1449 }
1450 if (ConfigIsExisting("mountables"))
1451 {
1454 }
1455
1457 }
1458
1460 {
1461 super.EEDelete(parent);
1462
1464 {
1465 areaDamage.Destroy();
1466 }
1467
1468 }
1469
1471 {
1472 return "disableBaseDamage";
1473 }
1474
1476 {
1477 return true;
1478 }
1479
1481 {
1482 return EInventoryIconVisibility.HIDE_VICINITY;
1483 }
1484
1485
1487 {
1489 {
1490 SetSynchDirty();
1491 }
1492 }
1493
1495 {
1497 super.OnVariablesSynchronized();
1498
1500 }
1501
1503 {
1504
1506
1507
1509
1510
1512 }
1513
1514
1516 {
1517
1518 int offset;
1519 int mask;
1520
1521 if ( part_id >= 1 && part_id <= 31 )
1522 {
1523 offset = part_id - 1;
1524 mask = 1 << offset;
1525
1527 }
1528 else if ( part_id >= 32 && part_id <= 62 )
1529 {
1530 offset = ( part_id % 32 );
1531 mask = 1 << offset;
1532
1534 }
1535 else if ( part_id >= 63 && part_id <= 93 )
1536 {
1537 offset = ( part_id % 63 );
1538 mask = 1 << offset;
1539
1541 }
1542 }
1543
1545 {
1546
1547 int offset;
1548 int mask;
1549
1550 if ( part_id >= 1 && part_id <= 31 )
1551 {
1552 offset = part_id - 1;
1553 mask = 1 << offset;
1554
1556 }
1557 else if ( part_id >= 32 && part_id <= 62 )
1558 {
1559 offset = ( part_id % 32 );
1560 mask = 1 << offset;
1561
1563 }
1564 else if ( part_id >= 63 && part_id <= 93 )
1565 {
1566 offset = ( part_id % 63 );
1567 mask = 1 << offset;
1568
1570 }
1571 }
1572
1574 {
1575
1576 int offset;
1577 int mask;
1578
1579 if ( part_id >= 1 && part_id <= 31 )
1580 {
1581 offset = part_id - 1;
1582 mask = 1 << offset;
1583
1585 {
1586 return true;
1587 }
1588 }
1589 else if ( part_id >= 32 && part_id <= 62 )
1590 {
1591 offset = ( part_id % 32 );
1592 mask = 1 << offset;
1593
1595 {
1596 return true;
1597 }
1598 }
1599 else if ( part_id >= 63 && part_id <= 93 )
1600 {
1601 offset = ( part_id % 63 );
1602 mask = 1 << offset;
1603
1605 {
1606 return true;
1607 }
1608 }
1609
1610 return false;
1611 }
1612
1614 {
1617 }
1618
1620 {
1621
1624 }
1625
1627 {
1629 {
1632
1633 switch( build_action_id )
1634 {
1638 }
1639 }
1640 }
1641
1642
1644 {
1646 bool is_base = part.
IsBase();
1649 if ( is_part_built_sync )
1650 {
1652 {
1656
1657 if (is_base)
1658 {
1661 }
1662 }
1663 }
1664 else
1665 {
1667 {
1671
1672 if (is_base)
1673 {
1676 }
1677 }
1678 }
1679
1680
1682 }
1683
1684
1686 {
1689
1690 for ( int i = 0; i < construction_parts.Count(); ++i )
1691 {
1692 string key = construction_parts.GetKey( i );
1695 }
1696
1697
1699 }
1700
1702 {
1705
1706 for ( int i = 0; i < construction_parts.Count(); ++i )
1707 {
1708 string key = construction_parts.GetKey( i );
1710
1711 if ( value.
GetId() ==
id )
1712 {
1713 return value;
1714 }
1715 }
1716
1717 return NULL;
1718 }
1719
1720
1721
1723 {
1725 }
1726
1728 {
1730 }
1731
1733 {
1734 return true;
1735 }
1736
1738 {
1739 return false;
1740 }
1741
1742
1744 {
1747 {
1749 }
1750
1751 return construction_kit;
1752 }
1753
1755 {
1758 {
1760 }
1761 }
1762
1764 {
1766 }
1767
1769 {
1770 return "";
1771 }
1772
1774 {
1777 }
1778
1779
1781 {
1784 }
1785
1786
1788 {
1789 super.OnStoreSave( ctx );
1790
1791
1795
1797 }
1798
1800 {
1801 if ( !super.OnStoreLoad( ctx, version ) )
1802 return false;
1803
1804
1805
1807 {
1809 return false;
1810 }
1812 {
1814 return false;
1815 }
1817 {
1819 return false;
1820 }
1821
1822
1824 {
1826 return false;
1827 }
1828
1829
1830 return true;
1831 }
1832
1834 {
1835 super.AfterStoreLoad();
1836
1838 {
1840 }
1841 }
1842
1844 {
1845
1847
1848
1851
1852
1854 }
1855
1857 {
1858 super.OnCreatePhysics();
1861 }
1862
1864 {
1866 return;
1867
1868 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1869
1871 return;
1872
1874 string part_name = zone;
1876
1878 {
1879 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1880
1881 if ( construction_part && construction.IsPartConstructed( part_name ) )
1882 {
1884 construction.DestroyConnectedParts(part_name);
1885 }
1886
1887
1888 if ( part_name.
Contains(
"barbed") )
1889 {
1890 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1891 if (barbed_wire)
1892 barbed_wire.SetMountedState( false );
1893 }
1894 }
1895 }
1896
1898 {
1900 {
1902 }
1903
1904 super.EEOnAfterLoad();
1905 }
1906
1908 {
1909 super.EEInit();
1910
1911
1913
1914
1915 #ifdef DEVELOPER
1917 #endif
1918 }
1919
1921 {
1922 super.EEItemAttached( item, slot_name );
1923
1927 }
1928
1930 {
1931 super.EEItemDetached( item, slot_name );
1932
1935 }
1936
1937 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1938 {
1941
1944 }
1945
1946
1948 {
1949 return true;
1950 }
1951
1952
1953
1955 {
1957
1958
1959 if (construtionPart.
IsBase())
1960 {
1962
1963
1965 }
1966
1967
1969
1970
1972
1973
1975
1977
1979
1980
1982
1983
1985 }
1986
1988 {
1989
1991 }
1992
1993
1995 {
1998
1999
2001
2002
2004
2005
2007
2008
2010
2012
2013
2015
2016
2018
2019
2020 if (construtionPart.
IsBase())
2021 {
2022
2024 }
2025
2028 }
2029
2031 {
2032
2034 }
2035
2036
2037 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2038 {
2041
2042
2044
2045
2047
2048
2050
2051
2053
2055
2056
2058
2059
2061
2062
2063 if (construtionPart.
IsBase())
2064 {
2065
2067 }
2068
2071 }
2072
2074 {
2075
2077 }
2078
2080 {
2081 bool process = false;
2082
2083
2087
2088 if (process)
2089 {
2090 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2091 {
2093 return;
2094 }
2095
2097 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2098 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2099
2100
2102 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2103 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2104 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2105 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2106 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2107 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2108 mins = minTmp;
2109 maxs = maxTmp;
2110
2111 maxs[1] = maxs[1] + 0.35;
2112
2114 }
2115 }
2116
2118 {
2121
2122
2124 foreach (
EntityAI entity : foundEntities)
2125 {
2128 }
2129 }
2130
2131
2133 {
2135
2139 }
2140
2142 {
2144
2146 {
2148 }
2149 else
2150 {
2152 }
2153
2155 }
2156
2158 {
2160
2162 foreach (
string slotName : attachmentSlots)
2163 {
2165 }
2166
2167
2170 else
2172
2174 }
2175
2177 {
2178 string slotNameMounted = slot_name + "_Mounted";
2179 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2180
2181 if (attachment)
2182 {
2183 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2184 if (barbedWire && barbedWire.IsMounted())
2186 else
2188
2189 if (is_locked)
2190 {
2191 SetAnimationPhase(slotNameMounted, 0);
2192 SetAnimationPhase(slot_name, 1);
2193 }
2194 else
2195 {
2196 SetAnimationPhase(slotNameMounted, 1);
2197 SetAnimationPhase(slot_name, 0);
2198 }
2199 }
2200 else
2201 {
2202 SetAnimationPhase(slotNameMounted, 1);
2203 SetAnimationPhase(slot_name, 1);
2204
2206 }
2207 }
2208
2209
2211 {
2214
2217
2220
2221 foreach (
string slotName : attachmentSlots)
2222 {
2224 }
2225
2226
2228 {
2231
2233 }
2234 else
2235 {
2238
2240 }
2241
2244 }
2245
2247 {
2248
2250 return;
2251
2252 string slot_name_mounted = slot_name + "_Mounted";
2253 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2254
2255
2257 RemoveProxyPhysics( slot_name_mounted );
2258 RemoveProxyPhysics( slot_name );
2259
2260 if ( attachment )
2261 {
2263 if ( is_locked )
2264 {
2266 AddProxyPhysics( slot_name_mounted );
2267 }
2268 else
2269 {
2271 AddProxyPhysics( slot_name );
2272 }
2273 }
2274 }
2275
2277 {
2278 SetAffectPathgraph( true, false );
2280 }
2281
2283 {
2284 return true;
2285 }
2286
2288 {
2289 return true;
2290 }
2291
2293 {
2294 if ( attachment )
2295 {
2297 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2298
2299 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2300 }
2301
2302 return false;
2303 }
2304
2306 {
2308 }
2309
2310
2312 {
2313 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2314 if (
GetGame().ConfigIsExisting( config_path ) )
2315 {
2317 }
2318 }
2319
2321 {
2322 return true;
2323 }
2324
2326 {
2327 return true;
2328 }
2329
2331 {
2332 return true;
2333 }
2334
2335
2337 {
2339 {
2341 }
2342
2344 }
2345
2347 {
2349 }
2350
2351
2352
2354 {
2355 return super.CanReceiveAttachment(attachment, slotId);
2356 }
2357
2359 {
2360 int attachment_count = GetInventory().AttachmentCount();
2361 if ( attachment_count > 0 )
2362 {
2363 if (
HasBase() && attachment_count == 1 )
2364 {
2365 return false;
2366 }
2367
2368 return true;
2369 }
2370
2371 return false;
2372 }
2373
2375 {
2376 return true;
2377 }
2378
2380 {
2381 return false;
2382 }
2383
2384
2386 {
2387 return false;
2388 }
2389
2391 {
2392 return false;
2393 }
2394
2395
2397 {
2398 return false;
2399 }
2400
2401
2402
2404 {
2405 return true;
2406 }
2407
2409 {
2410 return true;
2411 }
2412
2415 {
2416 return false;
2417 }
2418
2419
2421 {
2422 return true;
2423 }
2424
2425
2427 {
2428 return false;
2429 }
2430
2431
2433 {
2434 return true;
2435 }
2436
2437
2439 {
2440 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2441 {
2442 return false;
2443 }
2444
2445 return true;
2446 }
2447
2449 {
2452
2453 return item;
2454 }
2455
2456
2458 {
2460 {
2461
2463
2464
2467
2469 if ( MemoryPointExists( slot_name + "_min" ) )
2470 {
2471 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2472 }
2473 if ( MemoryPointExists( slot_name + "_max" ) )
2474 {
2475 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2476 }
2477
2478
2481
2482
2485 center = ModelToWorld( center );
2486
2487
2490
2491 areaDamage.SetExtents( extents[0], extents[1] );
2492 areaDamage.SetAreaPosition( center );
2493 areaDamage.SetAreaOrientation( orientation );
2496 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2497 areaDamage.SetAmmoName( "BarbedWireHit" );
2498 areaDamage.Spawn();
2499
2501 }
2502 }
2503
2505 {
2506 if ( angle_deg != 0 )
2507 {
2508
2509 orientation[0] = orientation[0] - angle_deg;
2510
2511
2513 if ( MemoryPointExists( "rotate_axis" ) )
2514 {
2515 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2516 }
2517 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];
2518 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];
2519 center[0] = r_center_x;
2520 center[2] = r_center_z;
2521 }
2522 }
2523
2525 {
2527 {
2530 {
2531 if (areaDamage)
2532 {
2533 areaDamage.Destroy();
2534 }
2535
2537 }
2538 }
2539 }
2540
2542 {
2543 return true;
2544 }
2545
2546
2547
2548
2550 {
2552 }
2553
2555 {
2557 }
2558
2560 {
2562 }
2563
2565 {
2567
2568 switch ( material_type )
2569 {
2575 }
2576
2577 return "";
2578 }
2579
2581 {
2583
2584 switch ( material_type )
2585 {
2591 }
2592
2593 return "";
2594 }
2595
2596
2598 {
2600 {
2601
2603 {
2604 SetHealth(slot_name,"Health",item.GetHealth());
2605 }
2606 }
2607 }
2608
2610 {
2611 return 111;
2612 }
2613
2615 {
2616 super.SetActions();
2617
2621 }
2622
2623
2624
2625
2627 {
2628 }
2629
2632 {
2633 return null;
2634 }
2635
2637 {
2639 }
2640
2642 {
2645
2646 Man p;
2647
2648 #ifdef SERVER
2651 if (players.Count())
2652 p = players[0];
2653 #else
2655 #endif
2656
2658 {
2659 bool excluded = false;
2661 if (excludes)
2662 {
2663 foreach (string exclude : excludes)
2664 {
2666 {
2667 excluded = true;
2668 break;
2669 }
2670 }
2671 }
2672
2673 if (!excluded)
2674 {
2676 }
2677 }
2678
2680 }
2681}
2682
2684{
2685#ifdef BSB_DEBUG
2687#else
2688
2689#endif
2690}
2692{
2693#ifdef BSB_DEBUG_SPAM
2695#else
2696
2697#endif
2698}
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.