1415{
1417
1419
1421
1423
1429
1430
1431
1437
1443
1445
1449
1450
1452 {
1454
1455
1456 RegisterNetSyncVariableInt( "m_SyncParts01" );
1457 RegisterNetSyncVariableInt( "m_SyncParts02" );
1458 RegisterNetSyncVariableInt( "m_SyncParts03" );
1459 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1460 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1461 RegisterNetSyncVariableBool( "m_HasBase" );
1462
1463
1465
1466 if (ConfigIsExisting("hybridAttachments"))
1467 {
1470 }
1471 if (ConfigIsExisting("mountables"))
1472 {
1475 }
1476
1478 }
1479
1481 {
1482 super.EEDelete(parent);
1483
1485 {
1486 areaDamage.Destroy();
1487 }
1488
1489 }
1490
1492 {
1493 return "disableBaseDamage";
1494 }
1495
1497 {
1498 return true;
1499 }
1500
1502 {
1503 return EInventoryIconVisibility.HIDE_VICINITY;
1504 }
1505
1506
1508 {
1510 {
1511 SetSynchDirty();
1512 }
1513 }
1514
1516 {
1518 super.OnVariablesSynchronized();
1519
1521 }
1522
1524 {
1525
1527
1528
1530
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 else if ( part_id >= 32 && part_id <= 62 )
1579 {
1580 offset = ( part_id % 32 );
1581 mask = 1 << offset;
1582
1584 }
1585 else if ( part_id >= 63 && part_id <= 93 )
1586 {
1587 offset = ( part_id % 63 );
1588 mask = 1 << offset;
1589
1591 }
1592 }
1593
1595 {
1596
1597 int offset;
1598 int mask;
1599
1600 if ( part_id >= 1 && part_id <= 31 )
1601 {
1602 offset = part_id - 1;
1603 mask = 1 << offset;
1604
1606 {
1607 return true;
1608 }
1609 }
1610 else if ( part_id >= 32 && part_id <= 62 )
1611 {
1612 offset = ( part_id % 32 );
1613 mask = 1 << offset;
1614
1616 {
1617 return true;
1618 }
1619 }
1620 else if ( part_id >= 63 && part_id <= 93 )
1621 {
1622 offset = ( part_id % 63 );
1623 mask = 1 << offset;
1624
1626 {
1627 return true;
1628 }
1629 }
1630
1631 return false;
1632 }
1633
1635 {
1638 }
1639
1641 {
1642
1645 }
1646
1648 {
1650 {
1653
1654 switch( build_action_id )
1655 {
1659 }
1660 }
1661 }
1662
1663
1665 {
1667 bool is_base = part.
IsBase();
1670 if ( is_part_built_sync )
1671 {
1673 {
1677
1678 if (is_base)
1679 {
1682 }
1683 }
1684 }
1685 else
1686 {
1688 {
1692
1693 if (is_base)
1694 {
1697 }
1698 }
1699 }
1700
1701
1703 }
1704
1705
1707 {
1710
1711 for ( int i = 0; i < construction_parts.Count(); ++i )
1712 {
1713 string key = construction_parts.GetKey( i );
1716 }
1717
1718
1720 }
1721
1723 {
1726
1727 for ( int i = 0; i < construction_parts.Count(); ++i )
1728 {
1729 string key = construction_parts.GetKey( i );
1731
1732 if ( value.
GetId() ==
id )
1733 {
1734 return value;
1735 }
1736 }
1737
1738 return NULL;
1739 }
1740
1741
1742
1744 {
1746 }
1747
1749 {
1751 }
1752
1754 {
1755 return true;
1756 }
1757
1759 {
1760 return false;
1761 }
1762
1763
1765 {
1768 {
1770 }
1771
1772 return construction_kit;
1773 }
1774
1776 {
1779 {
1781 }
1782 }
1783
1785 {
1787 }
1788
1790 {
1791 return "";
1792 }
1793
1795 {
1798 }
1799
1800
1802 {
1805 }
1806
1807
1809 {
1810 super.OnStoreSave( ctx );
1811
1812
1816
1818 }
1819
1821 {
1822 if ( !super.OnStoreLoad( ctx, version ) )
1823 return false;
1824
1825
1826
1828 {
1830 return false;
1831 }
1833 {
1835 return false;
1836 }
1838 {
1840 return false;
1841 }
1842
1843
1845 {
1847 return false;
1848 }
1849
1850
1851 return true;
1852 }
1853
1855 {
1856 super.AfterStoreLoad();
1857
1859 {
1861 }
1862 }
1863
1865 {
1866
1868
1869
1872
1873
1875 }
1876
1878 {
1879 super.OnCreatePhysics();
1882 }
1883
1885 {
1887 return;
1888
1889 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1890
1892 return;
1893
1895 string part_name = zone;
1897
1899 {
1900 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1901
1902 if ( construction_part && construction.IsPartConstructed( part_name ) )
1903 {
1905 construction.DestroyConnectedParts(part_name);
1906 }
1907
1908
1909 if ( part_name.
Contains(
"barbed") )
1910 {
1911 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1912 if (barbed_wire)
1913 barbed_wire.SetMountedState( false );
1914 }
1915 }
1916 }
1917
1919 {
1921 {
1923 }
1924
1925 super.EEOnAfterLoad();
1926 }
1927
1929 {
1930 super.EEInit();
1931
1932
1934
1935
1936 #ifdef DEVELOPER
1938 #endif
1939 }
1940
1942 {
1943 super.EEItemAttached( item, slot_name );
1944
1948 }
1949
1951 {
1952 super.EEItemDetached( item, slot_name );
1953
1956 }
1957
1958 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1959 {
1962
1965 }
1966
1967
1969 {
1970 return true;
1971 }
1972
1973
1974
1976 {
1978
1979
1980 if (construtionPart.
IsBase())
1981 {
1983
1984
1986 }
1987
1988
1990
1991
1993
1994
1996
1998
2000
2001
2003
2004
2006 }
2007
2009 {
2010
2012 }
2013
2014
2016 {
2019
2020
2022
2023
2025
2026
2028
2029
2031
2033
2034
2036
2037
2039
2040
2041 if (construtionPart.
IsBase())
2042 {
2043
2045 }
2046
2049 }
2050
2052 {
2053
2055 }
2056
2057
2058 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2059 {
2062
2063
2065
2066
2068
2069
2071
2072
2074
2076
2077
2079
2080
2082
2083
2084 if (construtionPart.
IsBase())
2085 {
2086
2088 }
2089
2092 }
2093
2095 {
2096
2098 }
2099
2101 {
2102 bool process = false;
2103
2104
2108
2109 if (process)
2110 {
2111 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2112 {
2114 return;
2115 }
2116
2118 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2119 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2120
2121
2123 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2124 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2125 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2126 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2127 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2128 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2129 mins = minTmp;
2130 maxs = maxTmp;
2131
2132 maxs[1] = maxs[1] + 0.35;
2133
2135 }
2136 }
2137
2139 {
2142
2143
2145 foreach (
EntityAI entity : foundEntities)
2146 {
2149 }
2150 }
2151
2152
2154 {
2156
2160 }
2161
2163 {
2165
2167 {
2169 }
2170 else
2171 {
2173 }
2174
2176 }
2177
2179 {
2181
2183 foreach (
string slotName : attachmentSlots)
2184 {
2186 }
2187
2188
2191 else
2193
2195 }
2196
2198 {
2199 string slotNameMounted = slot_name + "_Mounted";
2200 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2201
2202 if (attachment)
2203 {
2204 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2205 if (barbedWire && barbedWire.IsMounted())
2207 else
2209
2210 if (is_locked)
2211 {
2212 SetAnimationPhase(slotNameMounted, 0);
2213 SetAnimationPhase(slot_name, 1);
2214 }
2215 else
2216 {
2217 SetAnimationPhase(slotNameMounted, 1);
2218 SetAnimationPhase(slot_name, 0);
2219 }
2220 }
2221 else
2222 {
2223 SetAnimationPhase(slotNameMounted, 1);
2224 SetAnimationPhase(slot_name, 1);
2225
2227 }
2228 }
2229
2230
2232 {
2235
2238
2241
2242 foreach (
string slotName : attachmentSlots)
2243 {
2245 }
2246
2247
2249 {
2252
2254 }
2255 else
2256 {
2259
2261 }
2262
2265 }
2266
2268 {
2269
2271 return;
2272
2273 string slot_name_mounted = slot_name + "_Mounted";
2274 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2275
2276
2278 RemoveProxyPhysics( slot_name_mounted );
2279 RemoveProxyPhysics( slot_name );
2280
2281 if ( attachment )
2282 {
2284 if ( is_locked )
2285 {
2287 AddProxyPhysics( slot_name_mounted );
2288 }
2289 else
2290 {
2292 AddProxyPhysics( slot_name );
2293 }
2294 }
2295 }
2296
2298 {
2299 SetAffectPathgraph( true, false );
2301 }
2302
2304 {
2305 return true;
2306 }
2307
2309 {
2310 return true;
2311 }
2312
2314 {
2315 if ( attachment )
2316 {
2318 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2319
2320 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2321 }
2322
2323 return false;
2324 }
2325
2327 {
2329 }
2330
2331
2333 {
2334 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2335 if (
GetGame().ConfigIsExisting( config_path ) )
2336 {
2338 }
2339 }
2340
2342 {
2343 return true;
2344 }
2345
2347 {
2348 return true;
2349 }
2350
2352 {
2353 return true;
2354 }
2355
2356
2358 {
2360 {
2362 }
2363
2365 }
2366
2368 {
2370 }
2371
2372
2373
2375 {
2376 return super.CanReceiveAttachment(attachment, slotId);
2377 }
2378
2380 {
2381 int attachment_count = GetInventory().AttachmentCount();
2382 if ( attachment_count > 0 )
2383 {
2384 if (
HasBase() && attachment_count == 1 )
2385 {
2386 return false;
2387 }
2388
2389 return true;
2390 }
2391
2392 return false;
2393 }
2394
2396 {
2397 return true;
2398 }
2399
2401 {
2402 return false;
2403 }
2404
2405
2407 {
2408 return false;
2409 }
2410
2412 {
2413 return false;
2414 }
2415
2416
2418 {
2419 return false;
2420 }
2421
2422
2423
2425 {
2426 return true;
2427 }
2428
2430 {
2431 return true;
2432 }
2433
2436 {
2437 return false;
2438 }
2439
2440
2442 {
2443 return true;
2444 }
2445
2446
2448 {
2449 return false;
2450 }
2451
2452
2454 {
2455 return true;
2456 }
2457
2458
2460 {
2461 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2462 {
2463 return false;
2464 }
2465
2466 return true;
2467 }
2468
2470 {
2473
2474 return item;
2475 }
2476
2477
2479 {
2481 {
2482
2484
2485
2488
2490 if ( MemoryPointExists( slot_name + "_min" ) )
2491 {
2492 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2493 }
2494 if ( MemoryPointExists( slot_name + "_max" ) )
2495 {
2496 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2497 }
2498
2499
2502
2503
2506 center = ModelToWorld( center );
2507
2508
2511
2512 areaDamage.SetExtents( extents[0], extents[1] );
2513 areaDamage.SetAreaPosition( center );
2514 areaDamage.SetAreaOrientation( orientation );
2517 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2518 areaDamage.SetAmmoName( "BarbedWireHit" );
2519 areaDamage.Spawn();
2520
2522 }
2523 }
2524
2526 {
2527 if ( angle_deg != 0 )
2528 {
2529
2530 orientation[0] = orientation[0] - angle_deg;
2531
2532
2534 if ( MemoryPointExists( "rotate_axis" ) )
2535 {
2536 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2537 }
2538 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];
2539 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];
2540 center[0] = r_center_x;
2541 center[2] = r_center_z;
2542 }
2543 }
2544
2546 {
2548 {
2551 {
2552 if (areaDamage)
2553 {
2554 areaDamage.Destroy();
2555 }
2556
2558 }
2559 }
2560 }
2561
2563 {
2564 return true;
2565 }
2566
2567
2568
2569
2571 {
2573 }
2574
2576 {
2578 }
2579
2581 {
2583 }
2584
2586 {
2588
2589 switch ( material_type )
2590 {
2596 }
2597
2598 return "";
2599 }
2600
2602 {
2604
2605 switch ( material_type )
2606 {
2612 }
2613
2614 return "";
2615 }
2616
2617
2619 {
2621 {
2622
2624 {
2625 SetHealth(slot_name,"Health",item.GetHealth());
2626 }
2627 }
2628 }
2629
2631 {
2632 return 111;
2633 }
2634
2636 {
2637 super.SetActions();
2638
2642 }
2643
2644
2645
2646
2648 {
2649 }
2650
2653 {
2654 return null;
2655 }
2656
2658 {
2660 }
2661
2663 {
2666
2667 Man p;
2668
2669 #ifdef SERVER
2672 if (players.Count())
2673 p = players[0];
2674 #else
2676 #endif
2677
2679 {
2680 bool excluded = false;
2682 if (excludes)
2683 {
2684 foreach (string exclude : excludes)
2685 {
2687 {
2688 excluded = true;
2689 break;
2690 }
2691 }
2692 }
2693
2694 if (!excluded)
2695 {
2697 }
2698 }
2699
2701 }
2702}
2703
2705{
2706#ifdef BSB_DEBUG
2708#else
2709
2710#endif
2711}
2713{
2714#ifdef BSB_DEBUG_SPAM
2716#else
2717
2718#endif
2719}
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.