1473{
1475
1477
1479
1481
1487
1488
1489
1495
1501
1503
1507
1508
1510 {
1512
1513
1514 RegisterNetSyncVariableInt( "m_SyncParts01" );
1515 RegisterNetSyncVariableInt( "m_SyncParts02" );
1516 RegisterNetSyncVariableInt( "m_SyncParts03" );
1517 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1518 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1519 RegisterNetSyncVariableBool( "m_HasBase" );
1520
1521
1523
1524 if (ConfigIsExisting("hybridAttachments"))
1525 {
1528 }
1529 if (ConfigIsExisting("mountables"))
1530 {
1533 }
1534
1536 }
1537
1539 {
1540 super.EEDelete(parent);
1541
1543 {
1544 areaDamage.Destroy();
1545 }
1546
1547 }
1548
1550 {
1551 return "disableBaseDamage";
1552 }
1553
1555 {
1556 return true;
1557 }
1558
1560 {
1561 return EInventoryIconVisibility.HIDE_VICINITY;
1562 }
1563
1564
1566 {
1568 {
1569 SetSynchDirty();
1570 }
1571 }
1572
1574 {
1576 super.OnVariablesSynchronized();
1577
1579 }
1580
1582 {
1583
1585
1586
1588
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 else if ( part_id >= 32 && part_id <= 62 )
1608 {
1609 offset = ( part_id % 32 );
1610 mask = 1 << offset;
1611
1613 }
1614 else if ( part_id >= 63 && part_id <= 93 )
1615 {
1616 offset = ( part_id % 63 );
1617 mask = 1 << offset;
1618
1620 }
1621 }
1622
1624 {
1625
1626 int offset;
1627 int mask;
1628
1629 if ( part_id >= 1 && part_id <= 31 )
1630 {
1631 offset = part_id - 1;
1632 mask = 1 << offset;
1633
1635 }
1636 else if ( part_id >= 32 && part_id <= 62 )
1637 {
1638 offset = ( part_id % 32 );
1639 mask = 1 << offset;
1640
1642 }
1643 else if ( part_id >= 63 && part_id <= 93 )
1644 {
1645 offset = ( part_id % 63 );
1646 mask = 1 << offset;
1647
1649 }
1650 }
1651
1653 {
1654
1655 int offset;
1656 int mask;
1657
1658 if ( part_id >= 1 && part_id <= 31 )
1659 {
1660 offset = part_id - 1;
1661 mask = 1 << offset;
1662
1664 {
1665 return true;
1666 }
1667 }
1668 else if ( part_id >= 32 && part_id <= 62 )
1669 {
1670 offset = ( part_id % 32 );
1671 mask = 1 << offset;
1672
1674 {
1675 return true;
1676 }
1677 }
1678 else if ( part_id >= 63 && part_id <= 93 )
1679 {
1680 offset = ( part_id % 63 );
1681 mask = 1 << offset;
1682
1684 {
1685 return true;
1686 }
1687 }
1688
1689 return false;
1690 }
1691
1693 {
1696 }
1697
1699 {
1700
1703 }
1704
1706 {
1708 {
1711
1712 switch( build_action_id )
1713 {
1717 }
1718 }
1719 }
1720
1721
1723 {
1725 bool is_base = part.
IsBase();
1728 if ( is_part_built_sync )
1729 {
1731 {
1735
1736 if (is_base)
1737 {
1740 }
1741 }
1742 }
1743 else
1744 {
1746 {
1750
1751 if (is_base)
1752 {
1755 }
1756 }
1757 }
1758
1759
1761 }
1762
1763
1765 {
1768
1769 for ( int i = 0; i < construction_parts.Count(); ++i )
1770 {
1771 string key = construction_parts.GetKey( i );
1774 }
1775
1776
1778 }
1779
1781 {
1784
1785 for ( int i = 0; i < construction_parts.Count(); ++i )
1786 {
1787 string key = construction_parts.GetKey( i );
1789
1790 if ( value.
GetId() ==
id )
1791 {
1792 return value;
1793 }
1794 }
1795
1796 return NULL;
1797 }
1798
1799
1800
1802 {
1804 }
1805
1807 {
1809 }
1810
1812 {
1813 return true;
1814 }
1815
1817 {
1818 return false;
1819 }
1820
1821
1823 {
1826 {
1828 }
1829
1830 return construction_kit;
1831 }
1832
1834 {
1837 {
1839 }
1840 }
1841
1843 {
1845 }
1846
1848 {
1849 return "";
1850 }
1851
1853 {
1856 }
1857
1858
1860 {
1863 }
1864
1865
1867 {
1868 super.OnStoreSave( ctx );
1869
1870
1874
1876 }
1877
1879 {
1880 if ( !super.OnStoreLoad( ctx, version ) )
1881 return false;
1882
1883
1884
1886 {
1888 return false;
1889 }
1891 {
1893 return false;
1894 }
1896 {
1898 return false;
1899 }
1900
1901
1903 {
1905 return false;
1906 }
1907
1908
1909 return true;
1910 }
1911
1913 {
1914 super.AfterStoreLoad();
1915
1917 {
1919 }
1920 }
1921
1923 {
1924
1926
1927
1930
1931
1933 }
1934
1936 {
1937 super.OnCreatePhysics();
1940 }
1941
1943 {
1945 return;
1946
1947 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1948
1950 return;
1951
1953 string part_name = zone;
1955
1957 {
1958 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1959
1960 if ( construction_part && construction.IsPartConstructed( part_name ) )
1961 {
1963 construction.DestroyConnectedParts(part_name);
1964 }
1965
1966
1967 if ( part_name.
Contains(
"barbed") )
1968 {
1969 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
1970 if (barbed_wire)
1971 barbed_wire.SetMountedState( false );
1972 }
1973 }
1974 }
1975
1977 {
1979 {
1981 }
1982
1983 super.EEOnAfterLoad();
1984 }
1985
1987 {
1988 super.EEInit();
1989
1990
1992
1993
1994 #ifdef DEVELOPER
1996 #endif
1997 }
1998
2000 {
2001 super.EEItemAttached( item, slot_name );
2002
2006 }
2007
2009 {
2010 super.EEItemDetached( item, slot_name );
2011
2014 }
2015
2016 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2017 {
2020
2023 }
2024
2025
2027 {
2028 return true;
2029 }
2030
2031
2032
2034 {
2036
2037
2038 if (construtionPart.
IsBase())
2039 {
2041
2042
2044 }
2045
2046
2048
2049
2051
2052
2054
2056
2058
2059
2061
2062
2064 }
2065
2067 {
2068
2070 }
2071
2072
2074 {
2077
2078
2080
2081
2083
2084
2086
2087
2089
2091
2092
2094
2095
2097
2098
2099 if (construtionPart.
IsBase())
2100 {
2101
2103 }
2104
2107 }
2108
2110 {
2111
2113 }
2114
2115
2116 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2117 {
2120
2121
2123
2124
2126
2127
2129
2130
2132
2134
2135
2137
2138
2140
2141
2142 if (construtionPart.
IsBase())
2143 {
2144
2146 }
2147
2150 }
2151
2153 {
2154
2156 }
2157
2159 {
2160 bool process = false;
2161
2162
2166
2167 if (process)
2168 {
2169 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2170 {
2172 return;
2173 }
2174
2176 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2177 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2178
2179
2181 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2182 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2183 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2184 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2185 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2186 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2187 mins = minTmp;
2188 maxs = maxTmp;
2189
2190 maxs[1] = maxs[1] + 0.35;
2191
2193 }
2194 }
2195
2197 {
2200
2201
2203 foreach (
EntityAI entity : foundEntities)
2204 {
2207 }
2208 }
2209
2210
2212 {
2214
2218 }
2219
2221 {
2223
2225 {
2227 }
2228 else
2229 {
2231 }
2232
2234 }
2235
2237 {
2239
2241 foreach (
string slotName : attachmentSlots)
2242 {
2244 }
2245
2246
2249 else
2251
2253 }
2254
2256 {
2257 string slotNameMounted = slot_name + "_Mounted";
2258 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2259
2260 if (attachment)
2261 {
2262 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2263 if (barbedWire && barbedWire.IsMounted())
2265 else
2267
2268 if (is_locked)
2269 {
2270 SetAnimationPhase(slotNameMounted, 0);
2271 SetAnimationPhase(slot_name, 1);
2272 }
2273 else
2274 {
2275 SetAnimationPhase(slotNameMounted, 1);
2276 SetAnimationPhase(slot_name, 0);
2277 }
2278 }
2279 else
2280 {
2281 SetAnimationPhase(slotNameMounted, 1);
2282 SetAnimationPhase(slot_name, 1);
2283
2285 }
2286 }
2287
2288
2290 {
2293
2296
2299
2300 foreach (
string slotName : attachmentSlots)
2301 {
2303 }
2304
2305
2307 {
2310
2312 }
2313 else
2314 {
2317
2319 }
2320
2323 }
2324
2326 {
2327
2329 return;
2330
2331 string slot_name_mounted = slot_name + "_Mounted";
2332 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2333
2334
2336 RemoveProxyPhysics( slot_name_mounted );
2337 RemoveProxyPhysics( slot_name );
2338
2339 if ( attachment )
2340 {
2342 if ( is_locked )
2343 {
2345 AddProxyPhysics( slot_name_mounted );
2346 }
2347 else
2348 {
2350 AddProxyPhysics( slot_name );
2351 }
2352 }
2353 }
2354
2356 {
2357 SetAffectPathgraph( true, false );
2359 }
2360
2362 {
2363 return true;
2364 }
2365
2367 {
2368 return true;
2369 }
2370
2372 {
2373 if ( attachment )
2374 {
2376 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2377
2378 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2379 }
2380
2381 return false;
2382 }
2383
2385 {
2387 }
2388
2389
2391 {
2392 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2393 if (
GetGame().ConfigIsExisting( config_path ) )
2394 {
2396 }
2397 }
2398
2400 {
2401 return true;
2402 }
2403
2405 {
2406 return true;
2407 }
2408
2410 {
2411 return true;
2412 }
2413
2414
2416 {
2418 {
2420 }
2421
2423 }
2424
2426 {
2428 }
2429
2430
2431
2433 {
2434 return super.CanReceiveAttachment(attachment, slotId);
2435 }
2436
2438 {
2439 int attachment_count = GetInventory().AttachmentCount();
2440 if ( attachment_count > 0 )
2441 {
2442 if (
HasBase() && attachment_count == 1 )
2443 {
2444 return false;
2445 }
2446
2447 return true;
2448 }
2449
2450 return false;
2451 }
2452
2454 {
2455 return true;
2456 }
2457
2459 {
2460 return false;
2461 }
2462
2463
2465 {
2466 return false;
2467 }
2468
2470 {
2471 return false;
2472 }
2473
2474
2476 {
2477 return false;
2478 }
2479
2480
2481
2483 {
2484 return true;
2485 }
2486
2488 {
2489 return true;
2490 }
2491
2494 {
2495 return false;
2496 }
2497
2498
2500 {
2501 return true;
2502 }
2503
2504
2506 {
2507 return false;
2508 }
2509
2510
2512 {
2513 return true;
2514 }
2515
2516
2518 {
2519 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2520 {
2521 return false;
2522 }
2523
2524 return true;
2525 }
2526
2528 {
2531
2532 return item;
2533 }
2534
2535
2537 {
2539 {
2540
2542
2543
2546
2548 if ( MemoryPointExists( slot_name + "_min" ) )
2549 {
2550 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2551 }
2552 if ( MemoryPointExists( slot_name + "_max" ) )
2553 {
2554 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2555 }
2556
2557
2560
2561
2564 center = ModelToWorld( center );
2565
2566
2569
2570 areaDamage.SetExtents( extents[0], extents[1] );
2571 areaDamage.SetAreaPosition( center );
2572 areaDamage.SetAreaOrientation( orientation );
2575 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2576 areaDamage.SetAmmoName( "BarbedWireHit" );
2577 areaDamage.Spawn();
2578
2580 }
2581 }
2582
2584 {
2585 if ( angle_deg != 0 )
2586 {
2587
2588 orientation[0] = orientation[0] - angle_deg;
2589
2590
2592 if ( MemoryPointExists( "rotate_axis" ) )
2593 {
2594 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2595 }
2596 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];
2597 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];
2598 center[0] = r_center_x;
2599 center[2] = r_center_z;
2600 }
2601 }
2602
2604 {
2606 {
2609 {
2610 if (areaDamage)
2611 {
2612 areaDamage.Destroy();
2613 }
2614
2616 }
2617 }
2618 }
2619
2621 {
2622 return true;
2623 }
2624
2625
2626
2627
2629 {
2631 }
2632
2634 {
2636 }
2637
2639 {
2641 }
2642
2644 {
2646
2647 switch ( material_type )
2648 {
2654 }
2655
2656 return "";
2657 }
2658
2660 {
2662
2663 switch ( material_type )
2664 {
2670 }
2671
2672 return "";
2673 }
2674
2675
2677 {
2679 {
2680
2682 {
2683 SetHealth(slot_name,"Health",item.GetHealth());
2684 }
2685 }
2686 }
2687
2689 {
2690 return 111;
2691 }
2692
2694 {
2695 super.SetActions();
2696
2700 }
2701
2702
2703
2704
2706 {
2707 }
2708
2711 {
2712 return null;
2713 }
2714
2716 {
2718 }
2719
2721 {
2724
2725 Man p;
2726
2727 #ifdef SERVER
2730 if (players.Count())
2731 p = players[0];
2732 #else
2734 #endif
2735
2737 {
2738 bool excluded = false;
2740 if (excludes)
2741 {
2742 foreach (string exclude : excludes)
2743 {
2745 {
2746 excluded = true;
2747 break;
2748 }
2749 }
2750 }
2751
2752 if (!excluded)
2753 {
2755 }
2756 }
2757
2759 }
2760}
2761
2763{
2764#ifdef BSB_DEBUG
2766#else
2767
2768#endif
2769}
2771{
2772#ifdef BSB_DEBUG_SPAM
2774#else
2775
2776#endif
2777}
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.