1526{
1528
1530
1532
1534
1540
1541
1542
1548
1554
1556
1560
1561
1563 {
1565
1566
1567 RegisterNetSyncVariableInt( "m_SyncParts01" );
1568 RegisterNetSyncVariableInt( "m_SyncParts02" );
1569 RegisterNetSyncVariableInt( "m_SyncParts03" );
1570 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1571 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1572 RegisterNetSyncVariableBool( "m_HasBase" );
1573
1574
1576
1577 if (ConfigIsExisting("hybridAttachments"))
1578 {
1581 }
1582 if (ConfigIsExisting("mountables"))
1583 {
1586 }
1587
1589 }
1590
1592 {
1593 super.EEDelete(parent);
1594
1596 {
1597 areaDamage.Destroy();
1598 }
1599
1600 }
1601
1603 {
1604 return "disableBaseDamage";
1605 }
1606
1608 {
1609 return true;
1610 }
1611
1613 {
1614 return EInventoryIconVisibility.HIDE_VICINITY;
1615 }
1616
1617
1619 {
1621 {
1622 SetSynchDirty();
1623 }
1624 }
1625
1627 {
1629 super.OnVariablesSynchronized();
1630
1632 }
1633
1635 {
1636
1638
1639
1641
1642
1644 }
1645
1646
1648 {
1649
1650 int offset;
1651 int mask;
1652
1653 if ( part_id >= 1 && part_id <= 31 )
1654 {
1655 offset = part_id - 1;
1656 mask = 1 << offset;
1657
1659 }
1660 else if ( part_id >= 32 && part_id <= 62 )
1661 {
1662 offset = ( part_id % 32 );
1663 mask = 1 << offset;
1664
1666 }
1667 else if ( part_id >= 63 && part_id <= 93 )
1668 {
1669 offset = ( part_id % 63 );
1670 mask = 1 << offset;
1671
1673 }
1674 }
1675
1677 {
1678
1679 int offset;
1680 int mask;
1681
1682 if ( part_id >= 1 && part_id <= 31 )
1683 {
1684 offset = part_id - 1;
1685 mask = 1 << offset;
1686
1688 }
1689 else if ( part_id >= 32 && part_id <= 62 )
1690 {
1691 offset = ( part_id % 32 );
1692 mask = 1 << offset;
1693
1695 }
1696 else if ( part_id >= 63 && part_id <= 93 )
1697 {
1698 offset = ( part_id % 63 );
1699 mask = 1 << offset;
1700
1702 }
1703 }
1704
1706 {
1707
1708 int offset;
1709 int mask;
1710
1711 if ( part_id >= 1 && part_id <= 31 )
1712 {
1713 offset = part_id - 1;
1714 mask = 1 << offset;
1715
1717 {
1718 return true;
1719 }
1720 }
1721 else if ( part_id >= 32 && part_id <= 62 )
1722 {
1723 offset = ( part_id % 32 );
1724 mask = 1 << offset;
1725
1727 {
1728 return true;
1729 }
1730 }
1731 else if ( part_id >= 63 && part_id <= 93 )
1732 {
1733 offset = ( part_id % 63 );
1734 mask = 1 << offset;
1735
1737 {
1738 return true;
1739 }
1740 }
1741
1742 return false;
1743 }
1744
1746 {
1749 }
1750
1752 {
1753
1756 }
1757
1759 {
1761 {
1764
1765 switch( build_action_id )
1766 {
1770 }
1771 }
1772 }
1773
1774
1776 {
1778 bool is_base = part.
IsBase();
1781 if ( is_part_built_sync )
1782 {
1784 {
1788
1789 if (is_base)
1790 {
1793 }
1794 }
1795 }
1796 else
1797 {
1799 {
1803
1804 if (is_base)
1805 {
1808 }
1809 }
1810 }
1811
1812
1814 }
1815
1816
1818 {
1821
1822 for ( int i = 0; i < construction_parts.Count(); ++i )
1823 {
1824 string key = construction_parts.GetKey( i );
1827 }
1828
1829
1831 }
1832
1834 {
1837
1838 for ( int i = 0; i < construction_parts.Count(); ++i )
1839 {
1840 string key = construction_parts.GetKey( i );
1842
1843 if ( value.
GetId() ==
id )
1844 {
1845 return value;
1846 }
1847 }
1848
1849 return NULL;
1850 }
1851
1852
1853
1855 {
1857 }
1858
1860 {
1862 }
1863
1865 {
1866 return true;
1867 }
1868
1870 {
1871 return false;
1872 }
1873
1874
1876 {
1879 {
1881 }
1882
1883 return construction_kit;
1884 }
1885
1887 {
1890 {
1892 }
1893 }
1894
1896 {
1898 }
1899
1901 {
1902 return "";
1903 }
1904
1906 {
1909 }
1910
1911
1913 {
1916 }
1917
1918
1920 {
1921 super.OnStoreSave( ctx );
1922
1923
1927
1929 }
1930
1932 {
1933 if ( !super.OnStoreLoad( ctx, version ) )
1934 return false;
1935
1936
1937
1939 {
1941 return false;
1942 }
1944 {
1946 return false;
1947 }
1949 {
1951 return false;
1952 }
1953
1954
1956 {
1958 return false;
1959 }
1960
1961
1962 return true;
1963 }
1964
1966 {
1967 super.AfterStoreLoad();
1968
1970 {
1972 }
1973 }
1974
1976 {
1977
1979
1980
1983
1984
1986 }
1987
1989 {
1990 super.OnCreatePhysics();
1993 }
1994
1996 {
1998 return;
1999
2000 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2001
2003 return;
2004
2006 string part_name = zone;
2008
2010 {
2011 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2012
2013 if ( construction_part && construction.IsPartConstructed( part_name ) )
2014 {
2016 construction.DestroyConnectedParts(part_name);
2017 }
2018
2019
2020 if ( part_name.
Contains(
"barbed") )
2021 {
2022 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2023 if (barbed_wire)
2024 barbed_wire.SetMountedState( false );
2025 }
2026 }
2027 }
2028
2030 {
2032 {
2034 }
2035
2036 super.EEOnAfterLoad();
2037 }
2038
2040 {
2041 super.EEInit();
2042
2043
2045
2046
2047 #ifdef DEVELOPER
2049 #endif
2050 }
2051
2053 {
2054 super.EEItemAttached( item, slot_name );
2055
2059 }
2060
2062 {
2063 super.EEItemDetached( item, slot_name );
2064
2067 }
2068
2069 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2070 {
2073
2076 }
2077
2078
2080 {
2081 return true;
2082 }
2083
2084
2085
2087 {
2089
2090
2091 if (construtionPart.
IsBase())
2092 {
2094
2095
2097 }
2098
2099
2101
2102
2104
2105
2107
2109
2111
2112
2114
2115
2117 }
2118
2120 {
2121
2123 }
2124
2125
2127 {
2130
2131
2133
2134
2136
2137
2139
2140
2142
2144
2145
2147
2148
2150
2151
2152 if (construtionPart.
IsBase())
2153 {
2154
2156 }
2157
2160 }
2161
2163 {
2164
2166 }
2167
2168
2169 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2170 {
2173
2174
2176
2177
2179
2180
2182
2183
2185
2187
2188
2190
2191
2193
2194
2195 if (construtionPart.
IsBase())
2196 {
2197
2199 }
2200
2203 }
2204
2206 {
2207
2209 }
2210
2212 {
2213 bool process = false;
2214
2215
2219
2220 if (process)
2221 {
2222 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2223 {
2225 return;
2226 }
2227
2229 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2230 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2231
2232
2234 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2235 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2236 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2237 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2238 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2239 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2240 mins = minTmp;
2241 maxs = maxTmp;
2242
2243 maxs[1] = maxs[1] + 0.35;
2244
2246 }
2247 }
2248
2250 {
2253
2254
2256 foreach (
EntityAI entity : foundEntities)
2257 {
2260 }
2261 }
2262
2263
2265 {
2267
2271 }
2272
2274 {
2276
2278 {
2280 }
2281 else
2282 {
2284 }
2285
2287 }
2288
2290 {
2292
2294 foreach (
string slotName : attachmentSlots)
2295 {
2297 }
2298
2299
2302 else
2304
2306 }
2307
2309 {
2310 string slotNameMounted = slot_name + "_Mounted";
2311 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2312
2313 if (attachment)
2314 {
2315 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2316 if (barbedWire && barbedWire.IsMounted())
2318 else
2320
2321 if (is_locked)
2322 {
2323 SetAnimationPhase(slotNameMounted, 0);
2324 SetAnimationPhase(slot_name, 1);
2325 }
2326 else
2327 {
2328 SetAnimationPhase(slotNameMounted, 1);
2329 SetAnimationPhase(slot_name, 0);
2330 }
2331 }
2332 else
2333 {
2334 SetAnimationPhase(slotNameMounted, 1);
2335 SetAnimationPhase(slot_name, 1);
2336
2338 }
2339 }
2340
2341
2343 {
2346
2349
2352
2353 foreach (
string slotName : attachmentSlots)
2354 {
2356 }
2357
2358
2360 {
2363
2365 }
2366 else
2367 {
2370
2372 }
2373
2376 }
2377
2379 {
2380
2382 return;
2383
2384 string slot_name_mounted = slot_name + "_Mounted";
2385 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2386
2387
2389 RemoveProxyPhysics( slot_name_mounted );
2390 RemoveProxyPhysics( slot_name );
2391
2392 if ( attachment )
2393 {
2395 if ( is_locked )
2396 {
2398 AddProxyPhysics( slot_name_mounted );
2399 }
2400 else
2401 {
2403 AddProxyPhysics( slot_name );
2404 }
2405 }
2406 }
2407
2409 {
2410 SetAffectPathgraph( true, false );
2412 }
2413
2415 {
2416 return true;
2417 }
2418
2420 {
2421 return true;
2422 }
2423
2425 {
2426 if ( attachment )
2427 {
2429 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2430
2431 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2432 }
2433
2434 return false;
2435 }
2436
2438 {
2440 }
2441
2442
2444 {
2445 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2446 if (
GetGame().ConfigIsExisting( config_path ) )
2447 {
2449 }
2450 }
2451
2453 {
2454 return true;
2455 }
2456
2458 {
2459 return true;
2460 }
2461
2463 {
2464 return true;
2465 }
2466
2467
2469 {
2471 {
2473 }
2474
2476 }
2477
2479 {
2481 }
2482
2483
2484
2486 {
2487 return super.CanReceiveAttachment(attachment, slotId);
2488 }
2489
2491 {
2492 int attachment_count = GetInventory().AttachmentCount();
2493 if ( attachment_count > 0 )
2494 {
2495 if (
HasBase() && attachment_count == 1 )
2496 {
2497 return false;
2498 }
2499
2500 return true;
2501 }
2502
2503 return false;
2504 }
2505
2507 {
2508 return true;
2509 }
2510
2512 {
2513 return false;
2514 }
2515
2516
2518 {
2519 return false;
2520 }
2521
2523 {
2524 return false;
2525 }
2526
2527
2529 {
2530 return false;
2531 }
2532
2533
2534
2536 {
2537 return true;
2538 }
2539
2541 {
2542 return true;
2543 }
2544
2547 {
2548 return false;
2549 }
2550
2551
2553 {
2554 return true;
2555 }
2556
2557
2559 {
2560 return false;
2561 }
2562
2563
2565 {
2566 return true;
2567 }
2568
2569
2571 {
2572 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2573 {
2574 return false;
2575 }
2576
2577 return true;
2578 }
2579
2581 {
2584
2585 return item;
2586 }
2587
2588
2590 {
2592 {
2593
2595
2596
2599
2601 if ( MemoryPointExists( slot_name + "_min" ) )
2602 {
2603 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2604 }
2605 if ( MemoryPointExists( slot_name + "_max" ) )
2606 {
2607 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2608 }
2609
2610
2613
2614
2617 center = ModelToWorld( center );
2618
2619
2622
2623 areaDamage.SetExtents( extents[0], extents[1] );
2624 areaDamage.SetAreaPosition( center );
2625 areaDamage.SetAreaOrientation( orientation );
2628 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2629 areaDamage.SetAmmoName( "BarbedWireHit" );
2630 areaDamage.Spawn();
2631
2633 }
2634 }
2635
2637 {
2638 if ( angle_deg != 0 )
2639 {
2640
2641 orientation[0] = orientation[0] - angle_deg;
2642
2643
2645 if ( MemoryPointExists( "rotate_axis" ) )
2646 {
2647 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2648 }
2649 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];
2650 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];
2651 center[0] = r_center_x;
2652 center[2] = r_center_z;
2653 }
2654 }
2655
2657 {
2659 {
2662 {
2663 if (areaDamage)
2664 {
2665 areaDamage.Destroy();
2666 }
2667
2669 }
2670 }
2671 }
2672
2674 {
2675 return true;
2676 }
2677
2678
2679
2680
2682 {
2684 }
2685
2687 {
2689 }
2690
2692 {
2694 }
2695
2697 {
2699
2700 switch ( material_type )
2701 {
2707 }
2708
2709 return "";
2710 }
2711
2713 {
2715
2716 switch ( material_type )
2717 {
2723 }
2724
2725 return "";
2726 }
2727
2728
2730 {
2732 {
2733
2735 {
2736 SetHealth(slot_name,"Health",item.GetHealth());
2737 }
2738 }
2739 }
2740
2742 {
2743 return 111;
2744 }
2745
2747 {
2748 super.SetActions();
2749
2753 }
2754
2755
2756
2757
2759 {
2760 }
2761
2764 {
2765 return null;
2766 }
2767
2769 {
2771 }
2772
2774 {
2777
2778 Man p;
2779
2780 #ifdef SERVER
2783 if (players.Count())
2784 p = players[0];
2785 #else
2787 #endif
2788
2790 {
2791 bool excluded = false;
2793 if (excludes)
2794 {
2795 foreach (string exclude : excludes)
2796 {
2798 {
2799 excluded = true;
2800 break;
2801 }
2802 }
2803 }
2804
2805 if (!excluded)
2806 {
2808 }
2809 }
2810
2812 }
2813}
2814
2816{
2817#ifdef BSB_DEBUG
2819#else
2820
2821#endif
2822}
2824{
2825#ifdef BSB_DEBUG_SPAM
2827#else
2828
2829#endif
2830}
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.