1513{
1515
1517
1519
1521
1527
1528
1529
1535
1541
1543
1547
1548
1550 {
1552
1553
1554 RegisterNetSyncVariableInt( "m_SyncParts01" );
1555 RegisterNetSyncVariableInt( "m_SyncParts02" );
1556 RegisterNetSyncVariableInt( "m_SyncParts03" );
1557 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1558 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1559 RegisterNetSyncVariableBool( "m_HasBase" );
1560
1561
1563
1564 if (ConfigIsExisting("hybridAttachments"))
1565 {
1568 }
1569 if (ConfigIsExisting("mountables"))
1570 {
1573 }
1574
1576 }
1577
1579 {
1580 super.EEDelete(parent);
1581
1583 {
1584 areaDamage.Destroy();
1585 }
1586
1587 }
1588
1590 {
1591 return "disableBaseDamage";
1592 }
1593
1595 {
1596 return true;
1597 }
1598
1600 {
1601 return EInventoryIconVisibility.HIDE_VICINITY;
1602 }
1603
1604
1606 {
1608 {
1609 SetSynchDirty();
1610 }
1611 }
1612
1614 {
1616 super.OnVariablesSynchronized();
1617
1619 }
1620
1622 {
1623
1625
1626
1628
1629
1631 }
1632
1633
1635 {
1636
1637 int offset;
1638 int mask;
1639
1640 if ( part_id >= 1 && part_id <= 31 )
1641 {
1642 offset = part_id - 1;
1643 mask = 1 << offset;
1644
1646 }
1647 else if ( part_id >= 32 && part_id <= 62 )
1648 {
1649 offset = ( part_id % 32 );
1650 mask = 1 << offset;
1651
1653 }
1654 else if ( part_id >= 63 && part_id <= 93 )
1655 {
1656 offset = ( part_id % 63 );
1657 mask = 1 << offset;
1658
1660 }
1661 }
1662
1664 {
1665
1666 int offset;
1667 int mask;
1668
1669 if ( part_id >= 1 && part_id <= 31 )
1670 {
1671 offset = part_id - 1;
1672 mask = 1 << offset;
1673
1675 }
1676 else if ( part_id >= 32 && part_id <= 62 )
1677 {
1678 offset = ( part_id % 32 );
1679 mask = 1 << offset;
1680
1682 }
1683 else if ( part_id >= 63 && part_id <= 93 )
1684 {
1685 offset = ( part_id % 63 );
1686 mask = 1 << offset;
1687
1689 }
1690 }
1691
1693 {
1694
1695 int offset;
1696 int mask;
1697
1698 if ( part_id >= 1 && part_id <= 31 )
1699 {
1700 offset = part_id - 1;
1701 mask = 1 << offset;
1702
1704 {
1705 return true;
1706 }
1707 }
1708 else if ( part_id >= 32 && part_id <= 62 )
1709 {
1710 offset = ( part_id % 32 );
1711 mask = 1 << offset;
1712
1714 {
1715 return true;
1716 }
1717 }
1718 else if ( part_id >= 63 && part_id <= 93 )
1719 {
1720 offset = ( part_id % 63 );
1721 mask = 1 << offset;
1722
1724 {
1725 return true;
1726 }
1727 }
1728
1729 return false;
1730 }
1731
1733 {
1736 }
1737
1739 {
1740
1743 }
1744
1746 {
1748 {
1751
1752 switch( build_action_id )
1753 {
1757 }
1758 }
1759 }
1760
1761
1763 {
1765 bool is_base = part.
IsBase();
1768 if ( is_part_built_sync )
1769 {
1771 {
1775
1776 if (is_base)
1777 {
1780 }
1781 }
1782 }
1783 else
1784 {
1786 {
1790
1791 if (is_base)
1792 {
1795 }
1796 }
1797 }
1798
1799
1801 }
1802
1803
1805 {
1808
1809 for ( int i = 0; i < construction_parts.Count(); ++i )
1810 {
1811 string key = construction_parts.GetKey( i );
1814 }
1815
1816
1818 }
1819
1821 {
1824
1825 for ( int i = 0; i < construction_parts.Count(); ++i )
1826 {
1827 string key = construction_parts.GetKey( i );
1829
1830 if ( value.
GetId() ==
id )
1831 {
1832 return value;
1833 }
1834 }
1835
1836 return NULL;
1837 }
1838
1839
1840
1842 {
1844 }
1845
1847 {
1849 }
1850
1852 {
1853 return true;
1854 }
1855
1857 {
1858 return false;
1859 }
1860
1861
1863 {
1866 {
1868 }
1869
1870 return construction_kit;
1871 }
1872
1874 {
1877 {
1879 }
1880 }
1881
1883 {
1885 }
1886
1888 {
1889 return "";
1890 }
1891
1893 {
1896 }
1897
1898
1900 {
1903 }
1904
1905
1907 {
1908 super.OnStoreSave( ctx );
1909
1910
1914
1916 }
1917
1919 {
1920 if ( !super.OnStoreLoad( ctx, version ) )
1921 return false;
1922
1923
1924
1926 {
1928 return false;
1929 }
1931 {
1933 return false;
1934 }
1936 {
1938 return false;
1939 }
1940
1941
1943 {
1945 return false;
1946 }
1947
1948
1949 return true;
1950 }
1951
1953 {
1954 super.AfterStoreLoad();
1955
1957 {
1959 }
1960 }
1961
1963 {
1964
1966
1967
1970
1971
1973 }
1974
1976 {
1977 super.OnCreatePhysics();
1980 }
1981
1983 {
1985 return;
1986
1987 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1988
1990 return;
1991
1993 string part_name = zone;
1995
1997 {
1998 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
1999
2000 if ( construction_part && construction.IsPartConstructed( part_name ) )
2001 {
2003 construction.DestroyConnectedParts(part_name);
2004 }
2005
2006
2007 if ( part_name.
Contains(
"barbed") )
2008 {
2009 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2010 if (barbed_wire)
2011 barbed_wire.SetMountedState( false );
2012 }
2013 }
2014 }
2015
2017 {
2019 {
2021 }
2022
2023 super.EEOnAfterLoad();
2024 }
2025
2027 {
2028 super.EEInit();
2029
2030
2032
2033
2034 #ifdef DEVELOPER
2036 #endif
2037 }
2038
2040 {
2041 super.EEItemAttached( item, slot_name );
2042
2046 }
2047
2049 {
2050 super.EEItemDetached( item, slot_name );
2051
2054 }
2055
2056 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2057 {
2060
2063 }
2064
2065
2067 {
2068 return true;
2069 }
2070
2071
2072
2074 {
2076
2077
2078 if (construtionPart.
IsBase())
2079 {
2081
2082
2084 }
2085
2086
2088
2089
2091
2092
2094
2096
2098
2099
2101
2102
2104 }
2105
2107 {
2108
2110 }
2111
2112
2114 {
2117
2118
2120
2121
2123
2124
2126
2127
2129
2131
2132
2134
2135
2137
2138
2139 if (construtionPart.
IsBase())
2140 {
2141
2143 }
2144
2147 }
2148
2150 {
2151
2153 }
2154
2155
2156 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2157 {
2160
2161
2163
2164
2166
2167
2169
2170
2172
2174
2175
2177
2178
2180
2181
2182 if (construtionPart.
IsBase())
2183 {
2184
2186 }
2187
2190 }
2191
2193 {
2194
2196 }
2197
2199 {
2200 bool process = false;
2201
2202
2206
2207 if (process)
2208 {
2209 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2210 {
2212 return;
2213 }
2214
2216 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2217 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2218
2219
2221 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2222 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2223 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2224 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2225 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2226 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2227 mins = minTmp;
2228 maxs = maxTmp;
2229
2230 maxs[1] = maxs[1] + 0.35;
2231
2233 }
2234 }
2235
2237 {
2240
2241
2243 foreach (
EntityAI entity : foundEntities)
2244 {
2247 }
2248 }
2249
2250
2252 {
2254
2258 }
2259
2261 {
2263
2265 {
2267 }
2268 else
2269 {
2271 }
2272
2274 }
2275
2277 {
2279
2281 foreach (
string slotName : attachmentSlots)
2282 {
2284 }
2285
2286
2289 else
2291
2293 }
2294
2296 {
2297 string slotNameMounted = slot_name + "_Mounted";
2298 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2299
2300 if (attachment)
2301 {
2302 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2303 if (barbedWire && barbedWire.IsMounted())
2305 else
2307
2308 if (is_locked)
2309 {
2310 SetAnimationPhase(slotNameMounted, 0);
2311 SetAnimationPhase(slot_name, 1);
2312 }
2313 else
2314 {
2315 SetAnimationPhase(slotNameMounted, 1);
2316 SetAnimationPhase(slot_name, 0);
2317 }
2318 }
2319 else
2320 {
2321 SetAnimationPhase(slotNameMounted, 1);
2322 SetAnimationPhase(slot_name, 1);
2323
2325 }
2326 }
2327
2328
2330 {
2333
2336
2339
2340 foreach (
string slotName : attachmentSlots)
2341 {
2343 }
2344
2345
2347 {
2350
2352 }
2353 else
2354 {
2357
2359 }
2360
2363 }
2364
2366 {
2367
2369 return;
2370
2371 string slot_name_mounted = slot_name + "_Mounted";
2372 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2373
2374
2376 RemoveProxyPhysics( slot_name_mounted );
2377 RemoveProxyPhysics( slot_name );
2378
2379 if ( attachment )
2380 {
2382 if ( is_locked )
2383 {
2385 AddProxyPhysics( slot_name_mounted );
2386 }
2387 else
2388 {
2390 AddProxyPhysics( slot_name );
2391 }
2392 }
2393 }
2394
2396 {
2397 SetAffectPathgraph( true, false );
2399 }
2400
2402 {
2403 return true;
2404 }
2405
2407 {
2408 return true;
2409 }
2410
2412 {
2413 if ( attachment )
2414 {
2416 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2417
2418 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2419 }
2420
2421 return false;
2422 }
2423
2425 {
2427 }
2428
2429
2431 {
2432 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2433 if (
GetGame().ConfigIsExisting( config_path ) )
2434 {
2436 }
2437 }
2438
2440 {
2441 return true;
2442 }
2443
2445 {
2446 return true;
2447 }
2448
2450 {
2451 return true;
2452 }
2453
2454
2456 {
2458 {
2460 }
2461
2463 }
2464
2466 {
2468 }
2469
2470
2471
2473 {
2474 return super.CanReceiveAttachment(attachment, slotId);
2475 }
2476
2478 {
2479 int attachment_count = GetInventory().AttachmentCount();
2480 if ( attachment_count > 0 )
2481 {
2482 if (
HasBase() && attachment_count == 1 )
2483 {
2484 return false;
2485 }
2486
2487 return true;
2488 }
2489
2490 return false;
2491 }
2492
2494 {
2495 return true;
2496 }
2497
2499 {
2500 return false;
2501 }
2502
2503
2505 {
2506 return false;
2507 }
2508
2510 {
2511 return false;
2512 }
2513
2514
2516 {
2517 return false;
2518 }
2519
2520
2521
2523 {
2524 return true;
2525 }
2526
2528 {
2529 return true;
2530 }
2531
2534 {
2535 return false;
2536 }
2537
2538
2540 {
2541 return true;
2542 }
2543
2544
2546 {
2547 return false;
2548 }
2549
2550
2552 {
2553 return true;
2554 }
2555
2556
2558 {
2559 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2560 {
2561 return false;
2562 }
2563
2564 return true;
2565 }
2566
2568 {
2571
2572 return item;
2573 }
2574
2575
2577 {
2579 {
2580
2582
2583
2586
2588 if ( MemoryPointExists( slot_name + "_min" ) )
2589 {
2590 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2591 }
2592 if ( MemoryPointExists( slot_name + "_max" ) )
2593 {
2594 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2595 }
2596
2597
2600
2601
2604 center = ModelToWorld( center );
2605
2606
2609
2610 areaDamage.SetExtents( extents[0], extents[1] );
2611 areaDamage.SetAreaPosition( center );
2612 areaDamage.SetAreaOrientation( orientation );
2615 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2616 areaDamage.SetAmmoName( "BarbedWireHit" );
2617 areaDamage.Spawn();
2618
2620 }
2621 }
2622
2624 {
2625 if ( angle_deg != 0 )
2626 {
2627
2628 orientation[0] = orientation[0] - angle_deg;
2629
2630
2632 if ( MemoryPointExists( "rotate_axis" ) )
2633 {
2634 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2635 }
2636 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];
2637 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];
2638 center[0] = r_center_x;
2639 center[2] = r_center_z;
2640 }
2641 }
2642
2644 {
2646 {
2649 {
2650 if (areaDamage)
2651 {
2652 areaDamage.Destroy();
2653 }
2654
2656 }
2657 }
2658 }
2659
2661 {
2662 return true;
2663 }
2664
2665
2666
2667
2669 {
2671 }
2672
2674 {
2676 }
2677
2679 {
2681 }
2682
2684 {
2686
2687 switch ( material_type )
2688 {
2694 }
2695
2696 return "";
2697 }
2698
2700 {
2702
2703 switch ( material_type )
2704 {
2710 }
2711
2712 return "";
2713 }
2714
2715
2717 {
2719 {
2720
2722 {
2723 SetHealth(slot_name,"Health",item.GetHealth());
2724 }
2725 }
2726 }
2727
2729 {
2730 return 111;
2731 }
2732
2734 {
2735 super.SetActions();
2736
2740 }
2741
2742
2743
2744
2746 {
2747 }
2748
2751 {
2752 return null;
2753 }
2754
2756 {
2758 }
2759
2761 {
2764
2765 Man p;
2766
2767 #ifdef SERVER
2770 if (players.Count())
2771 p = players[0];
2772 #else
2774 #endif
2775
2777 {
2778 bool excluded = false;
2780 if (excludes)
2781 {
2782 foreach (string exclude : excludes)
2783 {
2785 {
2786 excluded = true;
2787 break;
2788 }
2789 }
2790 }
2791
2792 if (!excluded)
2793 {
2795 }
2796 }
2797
2799 }
2800}
2801
2803{
2804#ifdef BSB_DEBUG
2806#else
2807
2808#endif
2809}
2811{
2812#ifdef BSB_DEBUG_SPAM
2814#else
2815
2816#endif
2817}
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.