1402{
1404
1406
1408
1410
1416
1417
1418
1424
1430
1432
1436
1437
1439 {
1441
1442
1443 RegisterNetSyncVariableInt( "m_SyncParts01" );
1444 RegisterNetSyncVariableInt( "m_SyncParts02" );
1445 RegisterNetSyncVariableInt( "m_SyncParts03" );
1446 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1447 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1448 RegisterNetSyncVariableBool( "m_HasBase" );
1449
1450
1452
1453 if (ConfigIsExisting("hybridAttachments"))
1454 {
1457 }
1458 if (ConfigIsExisting("mountables"))
1459 {
1462 }
1463
1465 }
1466
1468 {
1469 super.EEDelete(parent);
1470
1472 {
1473 areaDamage.Destroy();
1474 }
1475
1476 }
1477
1479 {
1480 return "disableBaseDamage";
1481 }
1482
1484 {
1485 return true;
1486 }
1487
1489 {
1490 return EInventoryIconVisibility.HIDE_VICINITY;
1491 }
1492
1493
1495 {
1497 {
1498 SetSynchDirty();
1499 }
1500 }
1501
1503 {
1505 super.OnVariablesSynchronized();
1506
1508 }
1509
1511 {
1512
1514
1515
1517
1518
1520 }
1521
1522
1524 {
1525
1526 int offset;
1527 int mask;
1528
1529 if ( part_id >= 1 && part_id <= 31 )
1530 {
1531 offset = part_id - 1;
1532 mask = 1 << offset;
1533
1535 }
1536 else if ( part_id >= 32 && part_id <= 62 )
1537 {
1538 offset = ( part_id % 32 );
1539 mask = 1 << offset;
1540
1542 }
1543 else if ( part_id >= 63 && part_id <= 93 )
1544 {
1545 offset = ( part_id % 63 );
1546 mask = 1 << offset;
1547
1549 }
1550 }
1551
1553 {
1554
1555 int offset;
1556 int mask;
1557
1558 if ( part_id >= 1 && part_id <= 31 )
1559 {
1560 offset = part_id - 1;
1561 mask = 1 << offset;
1562
1564 }
1565 else if ( part_id >= 32 && part_id <= 62 )
1566 {
1567 offset = ( part_id % 32 );
1568 mask = 1 << offset;
1569
1571 }
1572 else if ( part_id >= 63 && part_id <= 93 )
1573 {
1574 offset = ( part_id % 63 );
1575 mask = 1 << offset;
1576
1578 }
1579 }
1580
1582 {
1583
1584 int offset;
1585 int mask;
1586
1587 if ( part_id >= 1 && part_id <= 31 )
1588 {
1589 offset = part_id - 1;
1590 mask = 1 << offset;
1591
1593 {
1594 return true;
1595 }
1596 }
1597 else if ( part_id >= 32 && part_id <= 62 )
1598 {
1599 offset = ( part_id % 32 );
1600 mask = 1 << offset;
1601
1603 {
1604 return true;
1605 }
1606 }
1607 else if ( part_id >= 63 && part_id <= 93 )
1608 {
1609 offset = ( part_id % 63 );
1610 mask = 1 << offset;
1611
1613 {
1614 return true;
1615 }
1616 }
1617
1618 return false;
1619 }
1620
1622 {
1625 }
1626
1628 {
1629
1632 }
1633
1635 {
1637 {
1640
1641 switch( build_action_id )
1642 {
1646 }
1647 }
1648 }
1649
1650
1652 {
1654 bool is_base = part.
IsBase();
1657 if ( is_part_built_sync )
1658 {
1660 {
1664
1665 if (is_base)
1666 {
1669 }
1670 }
1671 }
1672 else
1673 {
1675 {
1679
1680 if (is_base)
1681 {
1684 }
1685 }
1686 }
1687
1688
1690 }
1691
1692
1694 {
1697
1698 for ( int i = 0; i < construction_parts.Count(); ++i )
1699 {
1700 string key = construction_parts.GetKey( i );
1703 }
1704
1705
1707 }
1708
1710 {
1713
1714 for ( int i = 0; i < construction_parts.Count(); ++i )
1715 {
1716 string key = construction_parts.GetKey( i );
1718
1719 if ( value.
GetId() ==
id )
1720 {
1721 return value;
1722 }
1723 }
1724
1725 return NULL;
1726 }
1727
1728
1729
1731 {
1733 }
1734
1736 {
1738 }
1739
1741 {
1742 return true;
1743 }
1744
1746 {
1747 return false;
1748 }
1749
1750
1752 {
1755 {
1757 }
1758
1759 return construction_kit;
1760 }
1761
1763 {
1766 {
1768 }
1769 }
1770
1772 {
1774 }
1775
1777 {
1778 return "";
1779 }
1780
1782 {
1785 }
1786
1787
1789 {
1792 }
1793
1794
1796 {
1797 super.OnStoreSave( ctx );
1798
1799
1803
1805 }
1806
1808 {
1809 if ( !super.OnStoreLoad( ctx, version ) )
1810 return false;
1811
1812
1813
1815 {
1817 return false;
1818 }
1820 {
1822 return false;
1823 }
1825 {
1827 return false;
1828 }
1829
1830
1832 {
1834 return false;
1835 }
1836
1837
1838 return true;
1839 }
1840
1842 {
1843 super.AfterStoreLoad();
1844
1846 {
1848 }
1849 }
1850
1852 {
1853
1855
1856
1859
1860
1862 }
1863
1865 {
1866 super.OnCreatePhysics();
1869 }
1870
1872 {
1874 return;
1875
1876 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1877
1879 return;
1880
1882 string part_name = zone;
1884
1886 {
1887 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1888
1889 if ( construction_part && construction.IsPartConstructed( part_name ) )
1890 {
1892 construction.DestroyConnectedParts(part_name);
1893 }
1894
1895
1896 if ( part_name.
Contains(
"barbed") )
1897 {
1898 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1899 if (barbed_wire)
1900 barbed_wire.SetMountedState( false );
1901 }
1902 }
1903 }
1904
1906 {
1908 {
1910 }
1911
1912 super.EEOnAfterLoad();
1913 }
1914
1916 {
1917 super.EEInit();
1918
1919
1921
1922
1923 #ifdef DEVELOPER
1925 #endif
1926 }
1927
1929 {
1930 super.EEItemAttached( item, slot_name );
1931
1935 }
1936
1938 {
1939 super.EEItemDetached( item, slot_name );
1940
1943 }
1944
1945 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1946 {
1949
1952 }
1953
1954
1956 {
1957 return true;
1958 }
1959
1960
1961
1963 {
1965
1966
1967 if (construtionPart.
IsBase())
1968 {
1970
1971
1973 }
1974
1975
1977
1978
1980
1981
1983
1985
1987
1988
1990
1991
1993 }
1994
1996 {
1997
1999 }
2000
2001
2003 {
2006
2007
2009
2010
2012
2013
2015
2016
2018
2020
2021
2023
2024
2026
2027
2028 if (construtionPart.
IsBase())
2029 {
2030
2032 }
2033
2036 }
2037
2039 {
2040
2042 }
2043
2044
2045 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2046 {
2049
2050
2052
2053
2055
2056
2058
2059
2061
2063
2064
2066
2067
2069
2070
2071 if (construtionPart.
IsBase())
2072 {
2073
2075 }
2076
2079 }
2080
2082 {
2083
2085 }
2086
2088 {
2089 bool process = false;
2090
2091
2095
2096 if (process)
2097 {
2098 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2099 {
2101 return;
2102 }
2103
2105 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2106 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2107
2108
2110 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2111 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2112 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2113 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2114 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2115 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2116 mins = minTmp;
2117 maxs = maxTmp;
2118
2119 maxs[1] = maxs[1] + 0.35;
2120
2122 }
2123 }
2124
2126 {
2129
2130
2132 foreach (
EntityAI entity : foundEntities)
2133 {
2136 }
2137 }
2138
2139
2141 {
2143
2147 }
2148
2150 {
2152
2154 {
2156 }
2157 else
2158 {
2160 }
2161
2163 }
2164
2166 {
2168
2170 foreach (
string slotName : attachmentSlots)
2171 {
2173 }
2174
2175
2178 else
2180
2182 }
2183
2185 {
2186 string slotNameMounted = slot_name + "_Mounted";
2187 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2188
2189 if (attachment)
2190 {
2191 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2192 if (barbedWire && barbedWire.IsMounted())
2194 else
2196
2197 if (is_locked)
2198 {
2199 SetAnimationPhase(slotNameMounted, 0);
2200 SetAnimationPhase(slot_name, 1);
2201 }
2202 else
2203 {
2204 SetAnimationPhase(slotNameMounted, 1);
2205 SetAnimationPhase(slot_name, 0);
2206 }
2207 }
2208 else
2209 {
2210 SetAnimationPhase(slotNameMounted, 1);
2211 SetAnimationPhase(slot_name, 1);
2212
2214 }
2215 }
2216
2217
2219 {
2222
2225
2228
2229 foreach (
string slotName : attachmentSlots)
2230 {
2232 }
2233
2234
2236 {
2239
2241 }
2242 else
2243 {
2246
2248 }
2249
2252 }
2253
2255 {
2256
2258 return;
2259
2260 string slot_name_mounted = slot_name + "_Mounted";
2261 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2262
2263
2265 RemoveProxyPhysics( slot_name_mounted );
2266 RemoveProxyPhysics( slot_name );
2267
2268 if ( attachment )
2269 {
2271 if ( is_locked )
2272 {
2274 AddProxyPhysics( slot_name_mounted );
2275 }
2276 else
2277 {
2279 AddProxyPhysics( slot_name );
2280 }
2281 }
2282 }
2283
2285 {
2286 SetAffectPathgraph( true, false );
2288 }
2289
2291 {
2292 return true;
2293 }
2294
2296 {
2297 return true;
2298 }
2299
2301 {
2302 if ( attachment )
2303 {
2305 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2306
2307 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2308 }
2309
2310 return false;
2311 }
2312
2314 {
2316 }
2317
2318
2320 {
2321 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2322 if (
GetGame().ConfigIsExisting( config_path ) )
2323 {
2325 }
2326 }
2327
2329 {
2330 return true;
2331 }
2332
2334 {
2335 return true;
2336 }
2337
2339 {
2340 return true;
2341 }
2342
2343
2345 {
2347 {
2349 }
2350
2352 }
2353
2355 {
2357 }
2358
2359
2360
2362 {
2363 return super.CanReceiveAttachment(attachment, slotId);
2364 }
2365
2367 {
2368 int attachment_count = GetInventory().AttachmentCount();
2369 if ( attachment_count > 0 )
2370 {
2371 if (
HasBase() && attachment_count == 1 )
2372 {
2373 return false;
2374 }
2375
2376 return true;
2377 }
2378
2379 return false;
2380 }
2381
2383 {
2384 return true;
2385 }
2386
2388 {
2389 return false;
2390 }
2391
2392
2394 {
2395 return false;
2396 }
2397
2399 {
2400 return false;
2401 }
2402
2403
2405 {
2406 return false;
2407 }
2408
2409
2410
2412 {
2413 return true;
2414 }
2415
2417 {
2418 return true;
2419 }
2420
2423 {
2424 return false;
2425 }
2426
2427
2429 {
2430 return true;
2431 }
2432
2433
2435 {
2436 return false;
2437 }
2438
2439
2441 {
2442 return true;
2443 }
2444
2445
2447 {
2448 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2449 {
2450 return false;
2451 }
2452
2453 return true;
2454 }
2455
2457 {
2460
2461 return item;
2462 }
2463
2464
2466 {
2468 {
2469
2471
2472
2475
2477 if ( MemoryPointExists( slot_name + "_min" ) )
2478 {
2479 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2480 }
2481 if ( MemoryPointExists( slot_name + "_max" ) )
2482 {
2483 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2484 }
2485
2486
2489
2490
2493 center = ModelToWorld( center );
2494
2495
2498
2499 areaDamage.SetExtents( extents[0], extents[1] );
2500 areaDamage.SetAreaPosition( center );
2501 areaDamage.SetAreaOrientation( orientation );
2504 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2505 areaDamage.SetAmmoName( "BarbedWireHit" );
2506 areaDamage.Spawn();
2507
2509 }
2510 }
2511
2513 {
2514 if ( angle_deg != 0 )
2515 {
2516
2517 orientation[0] = orientation[0] - angle_deg;
2518
2519
2521 if ( MemoryPointExists( "rotate_axis" ) )
2522 {
2523 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2524 }
2525 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];
2526 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];
2527 center[0] = r_center_x;
2528 center[2] = r_center_z;
2529 }
2530 }
2531
2533 {
2535 {
2538 {
2539 if (areaDamage)
2540 {
2541 areaDamage.Destroy();
2542 }
2543
2545 }
2546 }
2547 }
2548
2550 {
2551 return true;
2552 }
2553
2554
2555
2556
2558 {
2560 }
2561
2563 {
2565 }
2566
2568 {
2570 }
2571
2573 {
2575
2576 switch ( material_type )
2577 {
2583 }
2584
2585 return "";
2586 }
2587
2589 {
2591
2592 switch ( material_type )
2593 {
2599 }
2600
2601 return "";
2602 }
2603
2604
2606 {
2608 {
2609
2611 {
2612 SetHealth(slot_name,"Health",item.GetHealth());
2613 }
2614 }
2615 }
2616
2618 {
2619 return 111;
2620 }
2621
2623 {
2624 super.SetActions();
2625
2629 }
2630
2631
2632
2633
2635 {
2636 }
2637
2640 {
2641 return null;
2642 }
2643
2645 {
2647 }
2648
2650 {
2653
2654 Man p;
2655
2656 #ifdef SERVER
2659 if (players.Count())
2660 p = players[0];
2661 #else
2663 #endif
2664
2666 {
2667 bool excluded = false;
2669 if (excludes)
2670 {
2671 foreach (string exclude : excludes)
2672 {
2674 {
2675 excluded = true;
2676 break;
2677 }
2678 }
2679 }
2680
2681 if (!excluded)
2682 {
2684 }
2685 }
2686
2688 }
2689}
2690
2692{
2693#ifdef BSB_DEBUG
2695#else
2696
2697#endif
2698}
2700{
2701#ifdef BSB_DEBUG_SPAM
2703#else
2704
2705#endif
2706}
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.