1386{
1388
1390
1392
1394
1400
1401
1402
1408
1414
1416
1420
1421
1423 {
1425
1426
1427 RegisterNetSyncVariableInt( "m_SyncParts01" );
1428 RegisterNetSyncVariableInt( "m_SyncParts02" );
1429 RegisterNetSyncVariableInt( "m_SyncParts03" );
1430 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1431 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1432 RegisterNetSyncVariableBool( "m_HasBase" );
1433
1434
1436
1437 if (ConfigIsExisting("hybridAttachments"))
1438 {
1441 }
1442 if (ConfigIsExisting("mountables"))
1443 {
1446 }
1447
1449 }
1450
1452 {
1453 super.EEDelete(parent);
1454
1456 {
1457 areaDamage.Destroy();
1458 }
1459
1460 }
1461
1463 {
1464 return "disableBaseDamage";
1465 }
1466
1468 {
1469 return true;
1470 }
1471
1473 {
1474 return EInventoryIconVisibility.HIDE_VICINITY;
1475 }
1476
1477
1479 {
1481 {
1482 SetSynchDirty();
1483 }
1484 }
1485
1487 {
1489 super.OnVariablesSynchronized();
1490
1492 }
1493
1495 {
1496
1498
1499
1501
1502
1504 }
1505
1506
1508 {
1509
1510 int offset;
1511 int mask;
1512
1513 if ( part_id >= 1 && part_id <= 31 )
1514 {
1515 offset = part_id - 1;
1516 mask = 1 << offset;
1517
1519 }
1520 else if ( part_id >= 32 && part_id <= 62 )
1521 {
1522 offset = ( part_id % 32 );
1523 mask = 1 << offset;
1524
1526 }
1527 else if ( part_id >= 63 && part_id <= 93 )
1528 {
1529 offset = ( part_id % 63 );
1530 mask = 1 << offset;
1531
1533 }
1534 }
1535
1537 {
1538
1539 int offset;
1540 int mask;
1541
1542 if ( part_id >= 1 && part_id <= 31 )
1543 {
1544 offset = part_id - 1;
1545 mask = 1 << offset;
1546
1548 }
1549 else if ( part_id >= 32 && part_id <= 62 )
1550 {
1551 offset = ( part_id % 32 );
1552 mask = 1 << offset;
1553
1555 }
1556 else if ( part_id >= 63 && part_id <= 93 )
1557 {
1558 offset = ( part_id % 63 );
1559 mask = 1 << offset;
1560
1562 }
1563 }
1564
1566 {
1567
1568 int offset;
1569 int mask;
1570
1571 if ( part_id >= 1 && part_id <= 31 )
1572 {
1573 offset = part_id - 1;
1574 mask = 1 << offset;
1575
1577 {
1578 return true;
1579 }
1580 }
1581 else if ( part_id >= 32 && part_id <= 62 )
1582 {
1583 offset = ( part_id % 32 );
1584 mask = 1 << offset;
1585
1587 {
1588 return true;
1589 }
1590 }
1591 else if ( part_id >= 63 && part_id <= 93 )
1592 {
1593 offset = ( part_id % 63 );
1594 mask = 1 << offset;
1595
1597 {
1598 return true;
1599 }
1600 }
1601
1602 return false;
1603 }
1604
1606 {
1609 }
1610
1612 {
1613
1616 }
1617
1619 {
1621 {
1624
1625 switch( build_action_id )
1626 {
1630 }
1631 }
1632 }
1633
1634
1636 {
1638 bool is_base = part.
IsBase();
1641 if ( is_part_built_sync )
1642 {
1644 {
1648
1649 if (is_base)
1650 {
1653 }
1654 }
1655 }
1656 else
1657 {
1659 {
1663
1664 if (is_base)
1665 {
1668 }
1669 }
1670 }
1671
1672
1674 }
1675
1676
1678 {
1681
1682 for ( int i = 0; i < construction_parts.Count(); ++i )
1683 {
1684 string key = construction_parts.GetKey( i );
1687 }
1688
1689
1691 }
1692
1694 {
1697
1698 for ( int i = 0; i < construction_parts.Count(); ++i )
1699 {
1700 string key = construction_parts.GetKey( i );
1702
1703 if ( value.
GetId() ==
id )
1704 {
1705 return value;
1706 }
1707 }
1708
1709 return NULL;
1710 }
1711
1712
1713
1715 {
1717 }
1718
1720 {
1722 }
1723
1725 {
1726 return true;
1727 }
1728
1730 {
1731 return false;
1732 }
1733
1734
1736 {
1739 {
1741 }
1742
1743 return construction_kit;
1744 }
1745
1747 {
1750 {
1752 }
1753 }
1754
1756 {
1758 }
1759
1761 {
1762 return "";
1763 }
1764
1766 {
1769 }
1770
1771
1773 {
1776 }
1777
1778
1780 {
1781 super.OnStoreSave( ctx );
1782
1783
1787
1789 }
1790
1792 {
1793 if ( !super.OnStoreLoad( ctx, version ) )
1794 return false;
1795
1796
1797
1799 {
1801 return false;
1802 }
1804 {
1806 return false;
1807 }
1809 {
1811 return false;
1812 }
1813
1814
1816 {
1818 return false;
1819 }
1820
1821
1822 return true;
1823 }
1824
1826 {
1827 super.AfterStoreLoad();
1828
1830 {
1832 }
1833 }
1834
1836 {
1837
1839
1840
1843
1844
1846 }
1847
1849 {
1850 super.OnCreatePhysics();
1853 }
1854
1856 {
1858 return;
1859
1860 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1861
1863 return;
1864
1866 string part_name = zone;
1868
1870 {
1871 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1872
1873 if ( construction_part && construction.IsPartConstructed( part_name ) )
1874 {
1876 construction.DestroyConnectedParts(part_name);
1877 }
1878
1879
1880 if ( part_name.
Contains(
"barbed") )
1881 {
1882 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1883 if (barbed_wire)
1884 barbed_wire.SetMountedState( false );
1885 }
1886 }
1887 }
1888
1890 {
1892 {
1894 }
1895
1896 super.EEOnAfterLoad();
1897 }
1898
1900 {
1901 super.EEInit();
1902
1903
1905
1906
1907 #ifdef DEVELOPER
1909 #endif
1910 }
1911
1913 {
1914 super.EEItemAttached( item, slot_name );
1915
1919 }
1920
1922 {
1923 super.EEItemDetached( item, slot_name );
1924
1927 }
1928
1929 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1930 {
1933
1936 }
1937
1938
1940 {
1941 return true;
1942 }
1943
1944
1945
1947 {
1949
1950
1951 if (construtionPart.
IsBase())
1952 {
1954
1955
1957 }
1958
1959
1961
1962
1964
1965
1967
1969
1971
1972
1974
1975
1977 }
1978
1980 {
1981
1983 }
1984
1985
1987 {
1990
1991
1993
1994
1996
1997
1999
2000
2002
2004
2005
2007
2008
2010
2011
2012 if (construtionPart.
IsBase())
2013 {
2014
2016 }
2017
2020 }
2021
2023 {
2024
2026 }
2027
2028
2029 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2030 {
2033
2034
2036
2037
2039
2040
2042
2043
2045
2047
2048
2050
2051
2053
2054
2055 if (construtionPart.
IsBase())
2056 {
2057
2059 }
2060
2063 }
2064
2066 {
2067
2069 }
2070
2072 {
2073 bool process = false;
2074
2075
2079
2080 if (process)
2081 {
2082 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2083 {
2085 return;
2086 }
2087
2089 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2090 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2091
2092
2094 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2095 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2096 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2097 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2098 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2099 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2100 mins = minTmp;
2101 maxs = maxTmp;
2102
2103 maxs[1] = maxs[1] + 0.35;
2104
2106 }
2107 }
2108
2110 {
2113
2114
2116 foreach (
EntityAI entity : foundEntities)
2117 {
2120 }
2121 }
2122
2123
2125 {
2127
2131 }
2132
2134 {
2136
2138 {
2140 }
2141 else
2142 {
2144 }
2145
2147 }
2148
2150 {
2152
2154 foreach (
string slotName : attachmentSlots)
2155 {
2157 }
2158
2159
2162 else
2164
2166 }
2167
2169 {
2170 string slotNameMounted = slot_name + "_Mounted";
2171 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2172
2173 if (attachment)
2174 {
2175 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2176 if (barbedWire && barbedWire.IsMounted())
2178 else
2180
2181 if (is_locked)
2182 {
2183 SetAnimationPhase(slotNameMounted, 0);
2184 SetAnimationPhase(slot_name, 1);
2185 }
2186 else
2187 {
2188 SetAnimationPhase(slotNameMounted, 1);
2189 SetAnimationPhase(slot_name, 0);
2190 }
2191 }
2192 else
2193 {
2194 SetAnimationPhase(slotNameMounted, 1);
2195 SetAnimationPhase(slot_name, 1);
2196
2198 }
2199 }
2200
2201
2203 {
2206
2209
2212
2213 foreach (
string slotName : attachmentSlots)
2214 {
2216 }
2217
2218
2220 {
2223
2225 }
2226 else
2227 {
2230
2232 }
2233
2236 }
2237
2239 {
2240
2242 return;
2243
2244 string slot_name_mounted = slot_name + "_Mounted";
2245 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2246
2247
2249 RemoveProxyPhysics( slot_name_mounted );
2250 RemoveProxyPhysics( slot_name );
2251
2252 if ( attachment )
2253 {
2255 if ( is_locked )
2256 {
2258 AddProxyPhysics( slot_name_mounted );
2259 }
2260 else
2261 {
2263 AddProxyPhysics( slot_name );
2264 }
2265 }
2266 }
2267
2269 {
2270 SetAffectPathgraph( true, false );
2272 }
2273
2275 {
2276 return true;
2277 }
2278
2280 {
2281 return true;
2282 }
2283
2285 {
2286 if ( attachment )
2287 {
2289 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2290
2291 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2292 }
2293
2294 return false;
2295 }
2296
2298 {
2300 }
2301
2302
2304 {
2305 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2306 if (
GetGame().ConfigIsExisting( config_path ) )
2307 {
2309 }
2310 }
2311
2313 {
2314 return true;
2315 }
2316
2318 {
2319 return true;
2320 }
2321
2323 {
2324 return true;
2325 }
2326
2327
2329 {
2331 {
2333 }
2334
2336 }
2337
2339 {
2341 }
2342
2343
2344
2346 {
2347 return super.CanReceiveAttachment(attachment, slotId);
2348 }
2349
2351 {
2352 int attachment_count = GetInventory().AttachmentCount();
2353 if ( attachment_count > 0 )
2354 {
2355 if (
HasBase() && attachment_count == 1 )
2356 {
2357 return false;
2358 }
2359
2360 return true;
2361 }
2362
2363 return false;
2364 }
2365
2367 {
2368 return true;
2369 }
2370
2372 {
2373 return false;
2374 }
2375
2376
2378 {
2379 return false;
2380 }
2381
2383 {
2384 return false;
2385 }
2386
2387
2389 {
2390 return false;
2391 }
2392
2393
2394
2396 {
2397 return true;
2398 }
2399
2401 {
2402 return true;
2403 }
2404
2407 {
2408 return false;
2409 }
2410
2411
2413 {
2414 return true;
2415 }
2416
2417
2419 {
2420 return false;
2421 }
2422
2423
2425 {
2426 return true;
2427 }
2428
2429
2431 {
2432 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2433 {
2434 return false;
2435 }
2436
2437 return true;
2438 }
2439
2441 {
2444
2445 return item;
2446 }
2447
2448
2450 {
2452 {
2453
2455
2456
2459
2461 if ( MemoryPointExists( slot_name + "_min" ) )
2462 {
2463 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2464 }
2465 if ( MemoryPointExists( slot_name + "_max" ) )
2466 {
2467 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2468 }
2469
2470
2473
2474
2477 center = ModelToWorld( center );
2478
2479
2482
2483 areaDamage.SetExtents( extents[0], extents[1] );
2484 areaDamage.SetAreaPosition( center );
2485 areaDamage.SetAreaOrientation( orientation );
2488 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2489 areaDamage.SetAmmoName( "BarbedWireHit" );
2490 areaDamage.Spawn();
2491
2493 }
2494 }
2495
2497 {
2498 if ( angle_deg != 0 )
2499 {
2500
2501 orientation[0] = orientation[0] - angle_deg;
2502
2503
2505 if ( MemoryPointExists( "rotate_axis" ) )
2506 {
2507 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2508 }
2509 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];
2510 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];
2511 center[0] = r_center_x;
2512 center[2] = r_center_z;
2513 }
2514 }
2515
2517 {
2519 {
2522 {
2523 if (areaDamage)
2524 {
2525 areaDamage.Destroy();
2526 }
2527
2529 }
2530 }
2531 }
2532
2534 {
2535 return true;
2536 }
2537
2538
2539
2540
2542 {
2544 }
2545
2547 {
2549 }
2550
2552 {
2554 }
2555
2557 {
2559
2560 switch ( material_type )
2561 {
2567 }
2568
2569 return "";
2570 }
2571
2573 {
2575
2576 switch ( material_type )
2577 {
2583 }
2584
2585 return "";
2586 }
2587
2588
2590 {
2592 {
2593
2595 {
2596 SetHealth(slot_name,"Health",item.GetHealth());
2597 }
2598 }
2599 }
2600
2602 {
2603 return 111;
2604 }
2605
2607 {
2608 super.SetActions();
2609
2613 }
2614
2615
2616
2617
2619 {
2620 }
2621
2624 {
2625 return null;
2626 }
2627
2629 {
2631 }
2632
2634 {
2637
2638 Man p;
2639
2640 #ifdef SERVER
2643 if (players.Count())
2644 p = players[0];
2645 #else
2647 #endif
2648
2650 {
2651 bool excluded = false;
2653 if (excludes)
2654 {
2655 foreach (string exclude : excludes)
2656 {
2658 {
2659 excluded = true;
2660 break;
2661 }
2662 }
2663 }
2664
2665 if (!excluded)
2666 {
2668 }
2669 }
2670
2672 }
2673}
2674
2676{
2677#ifdef BSB_DEBUG
2679#else
2680
2681#endif
2682}
2684{
2685#ifdef BSB_DEBUG_SPAM
2687#else
2688
2689#endif
2690}
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.