1601{
1603
1605
1607
1609
1615
1616
1617
1623
1629
1631
1635
1636
1638 {
1640
1641
1642 RegisterNetSyncVariableInt( "m_SyncParts01" );
1643 RegisterNetSyncVariableInt( "m_SyncParts02" );
1644 RegisterNetSyncVariableInt( "m_SyncParts03" );
1645 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1646 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1647 RegisterNetSyncVariableBool( "m_HasBase" );
1648
1649
1651
1652 if (ConfigIsExisting("hybridAttachments"))
1653 {
1656 }
1657 if (ConfigIsExisting("mountables"))
1658 {
1661 }
1662
1664 }
1665
1667 {
1668 super.EEDelete(parent);
1669
1671 {
1672 areaDamage.Destroy();
1673 }
1674
1675 }
1676
1678 {
1679 return "disableBaseDamage";
1680 }
1681
1683 {
1684 return true;
1685 }
1686
1688 {
1689 return EInventoryIconVisibility.HIDE_VICINITY;
1690 }
1691
1692
1694 {
1696 {
1697 SetSynchDirty();
1698 }
1699 }
1700
1702 {
1704 super.OnVariablesSynchronized();
1705
1707 }
1708
1710 {
1711
1713
1714
1716
1717
1719 }
1720
1721
1723 {
1724
1725 int offset;
1726 int mask;
1727
1728 if ( part_id >= 1 && part_id <= 31 )
1729 {
1730 offset = part_id - 1;
1731 mask = 1 << offset;
1732
1734 }
1735 else if ( part_id >= 32 && part_id <= 62 )
1736 {
1737 offset = ( part_id % 32 );
1738 mask = 1 << offset;
1739
1741 }
1742 else if ( part_id >= 63 && part_id <= 93 )
1743 {
1744 offset = ( part_id % 63 );
1745 mask = 1 << offset;
1746
1748 }
1749 }
1750
1752 {
1753
1754 int offset;
1755 int mask;
1756
1757 if ( part_id >= 1 && part_id <= 31 )
1758 {
1759 offset = part_id - 1;
1760 mask = 1 << offset;
1761
1763 }
1764 else if ( part_id >= 32 && part_id <= 62 )
1765 {
1766 offset = ( part_id % 32 );
1767 mask = 1 << offset;
1768
1770 }
1771 else if ( part_id >= 63 && part_id <= 93 )
1772 {
1773 offset = ( part_id % 63 );
1774 mask = 1 << offset;
1775
1777 }
1778 }
1779
1781 {
1782
1783 int offset;
1784 int mask;
1785
1786 if ( part_id >= 1 && part_id <= 31 )
1787 {
1788 offset = part_id - 1;
1789 mask = 1 << offset;
1790
1792 {
1793 return true;
1794 }
1795 }
1796 else if ( part_id >= 32 && part_id <= 62 )
1797 {
1798 offset = ( part_id % 32 );
1799 mask = 1 << offset;
1800
1802 {
1803 return true;
1804 }
1805 }
1806 else if ( part_id >= 63 && part_id <= 93 )
1807 {
1808 offset = ( part_id % 63 );
1809 mask = 1 << offset;
1810
1812 {
1813 return true;
1814 }
1815 }
1816
1817 return false;
1818 }
1819
1821 {
1824 }
1825
1827 {
1828
1831 }
1832
1834 {
1836 {
1839
1840 switch( build_action_id )
1841 {
1845 }
1846 }
1847 }
1848
1849
1851 {
1853 bool is_base = part.
IsBase();
1856 if ( is_part_built_sync )
1857 {
1859 {
1863
1864 if (is_base)
1865 {
1868 }
1869 }
1870 }
1871 else
1872 {
1874 {
1878
1879 if (is_base)
1880 {
1883 }
1884 }
1885 }
1886
1887
1889 }
1890
1891
1893 {
1896
1897 for ( int i = 0; i < construction_parts.Count(); ++i )
1898 {
1899 string key = construction_parts.GetKey( i );
1902 }
1903
1904
1906 }
1907
1909 {
1912
1913 for ( int i = 0; i < construction_parts.Count(); ++i )
1914 {
1915 string key = construction_parts.GetKey( i );
1917
1918 if ( value.
GetId() ==
id )
1919 {
1920 return value;
1921 }
1922 }
1923
1924 return NULL;
1925 }
1926
1927
1928
1930 {
1932 }
1933
1935 {
1937 }
1938
1940 {
1941 return true;
1942 }
1943
1945 {
1946 return false;
1947 }
1948
1949
1951 {
1954 {
1956 }
1957
1958 return construction_kit;
1959 }
1960
1962 {
1965 {
1967 }
1968 }
1969
1971 {
1973 }
1974
1976 {
1977 return "";
1978 }
1979
1981 {
1984 }
1985
1986
1988 {
1991 }
1992
1993
1995 {
1996 super.OnStoreSave( ctx );
1997
1998
2002
2004 }
2005
2007 {
2008 if ( !super.OnStoreLoad( ctx, version ) )
2009 return false;
2010
2011
2012
2014 {
2016 return false;
2017 }
2019 {
2021 return false;
2022 }
2024 {
2026 return false;
2027 }
2028
2029
2031 {
2033 return false;
2034 }
2035
2036
2037 return true;
2038 }
2039
2041 {
2042 super.AfterStoreLoad();
2043
2045 {
2047 }
2048 }
2049
2051 {
2052
2054
2055
2058
2059
2061 }
2062
2064 {
2065 super.OnCreatePhysics();
2068 }
2069
2071 {
2073 return;
2074
2075 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2076
2078 return;
2079
2081 string part_name = zone;
2083
2085 {
2086 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2087
2088 if ( construction_part && construction.IsPartConstructed( part_name ) )
2089 {
2091 construction.DestroyConnectedParts(part_name);
2092 }
2093
2094
2095 if ( part_name.
Contains(
"barbed") )
2096 {
2097 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2098 if (barbed_wire)
2099 barbed_wire.SetMountedState( false );
2100 }
2101 }
2102 }
2103
2105 {
2107 {
2109 }
2110
2111 super.EEOnAfterLoad();
2112 }
2113
2115 {
2116 super.EEInit();
2117
2118
2120
2121
2122 #ifdef DEVELOPER
2124 #endif
2125 }
2126
2128 {
2129 super.EEItemAttached( item, slot_name );
2130
2134 }
2135
2137 {
2138 super.EEItemDetached( item, slot_name );
2139
2142 }
2143
2144 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2145 {
2148
2151 }
2152
2153
2155 {
2156 return true;
2157 }
2158
2159
2160
2162 {
2164
2165
2166 if (construtionPart.
IsBase())
2167 {
2169
2170
2172 }
2173
2174
2176
2177
2179
2180
2182
2184
2186
2187
2189
2190
2192 }
2193
2195 {
2196
2198 }
2199
2200
2202 {
2205
2206
2208
2209
2211
2212
2214
2215
2217
2219
2220
2222
2223
2225
2226
2227 if (construtionPart.
IsBase())
2228 {
2229
2231 }
2232
2235 }
2236
2238 {
2239
2241 }
2242
2243
2244 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2245 {
2248
2249
2251
2252
2254
2255
2257
2258
2260
2262
2263
2265
2266
2268
2269
2270 if (construtionPart.
IsBase())
2271 {
2272
2274 }
2275
2278 }
2279
2281 {
2282
2284 }
2285
2287 {
2288 bool process = false;
2289
2290
2294
2295 if (process)
2296 {
2297 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2298 {
2300 return;
2301 }
2302
2304 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2305 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2306
2307
2309 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2310 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2311 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2312 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2313 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2314 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2315 mins = minTmp;
2316 maxs = maxTmp;
2317
2318 maxs[1] = maxs[1] + 0.35;
2319
2321 }
2322 }
2323
2325 {
2328
2329
2331 foreach (
EntityAI entity : foundEntities)
2332 {
2335 }
2336 }
2337
2338
2340 {
2342
2346 }
2347
2349 {
2351
2353 {
2355 }
2356 else
2357 {
2359 }
2360
2362 }
2363
2365 {
2367
2369 foreach (
string slotName : attachmentSlots)
2370 {
2372 }
2373
2374
2377 else
2379
2381 }
2382
2384 {
2385 string slotNameMounted = slot_name + "_Mounted";
2386 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2387
2388 if (attachment)
2389 {
2390 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2391 if (barbedWire && barbedWire.IsMounted())
2393 else
2395
2396 if (is_locked)
2397 {
2398 SetAnimationPhase(slotNameMounted, 0);
2399 SetAnimationPhase(slot_name, 1);
2400 }
2401 else
2402 {
2403 SetAnimationPhase(slotNameMounted, 1);
2404 SetAnimationPhase(slot_name, 0);
2405 }
2406 }
2407 else
2408 {
2409 SetAnimationPhase(slotNameMounted, 1);
2410 SetAnimationPhase(slot_name, 1);
2411
2413 }
2414 }
2415
2416
2418 {
2421
2424
2427
2428 foreach (
string slotName : attachmentSlots)
2429 {
2431 }
2432
2433
2435 {
2438
2440 }
2441 else
2442 {
2445
2447 }
2448
2451 }
2452
2454 {
2455
2457 return;
2458
2459 string slot_name_mounted = slot_name + "_Mounted";
2460 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2461
2462
2464 RemoveProxyPhysics( slot_name_mounted );
2465 RemoveProxyPhysics( slot_name );
2466
2467 if ( attachment )
2468 {
2470 if ( is_locked )
2471 {
2473 AddProxyPhysics( slot_name_mounted );
2474 }
2475 else
2476 {
2478 AddProxyPhysics( slot_name );
2479 }
2480 }
2481 }
2482
2484 {
2485 SetAffectPathgraph( true, false );
2487 }
2488
2490 {
2491 return true;
2492 }
2493
2495 {
2496 return true;
2497 }
2498
2500 {
2501 if ( attachment )
2502 {
2504 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2505
2506 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2507 }
2508
2509 return false;
2510 }
2511
2513 {
2515 }
2516
2517
2519 {
2520 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2521 if (
GetGame().ConfigIsExisting( config_path ) )
2522 {
2524 }
2525 }
2526
2528 {
2529 return true;
2530 }
2531
2533 {
2534 return true;
2535 }
2536
2538 {
2539 return true;
2540 }
2541
2542
2544 {
2546 {
2548 }
2549
2551 }
2552
2554 {
2556 }
2557
2558
2559
2561 {
2562 return super.CanReceiveAttachment(attachment, slotId);
2563 }
2564
2566 {
2567 int attachment_count = GetInventory().AttachmentCount();
2568 if ( attachment_count > 0 )
2569 {
2570 if (
HasBase() && attachment_count == 1 )
2571 {
2572 return false;
2573 }
2574
2575 return true;
2576 }
2577
2578 return false;
2579 }
2580
2582 {
2583 return true;
2584 }
2585
2587 {
2588 return false;
2589 }
2590
2591
2593 {
2594 return false;
2595 }
2596
2598 {
2599 return false;
2600 }
2601
2602
2604 {
2605 return false;
2606 }
2607
2608
2609
2611 {
2612 return true;
2613 }
2614
2616 {
2617 return true;
2618 }
2619
2622 {
2623 return false;
2624 }
2625
2626
2628 {
2629 return true;
2630 }
2631
2632
2634 {
2635 return false;
2636 }
2637
2638
2640 {
2641 return true;
2642 }
2643
2644
2646 {
2647 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2648 {
2649 return false;
2650 }
2651
2652 return true;
2653 }
2654
2656 {
2659
2660 return item;
2661 }
2662
2663
2665 {
2667 {
2668
2670
2671
2674
2676 if ( MemoryPointExists( slot_name + "_min" ) )
2677 {
2678 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2679 }
2680 if ( MemoryPointExists( slot_name + "_max" ) )
2681 {
2682 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2683 }
2684
2685
2688
2689
2692 center = ModelToWorld( center );
2693
2694
2697
2698 areaDamage.SetExtents( extents[0], extents[1] );
2699 areaDamage.SetAreaPosition( center );
2700 areaDamage.SetAreaOrientation( orientation );
2703 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2704 areaDamage.SetAmmoName( "BarbedWireHit" );
2705 areaDamage.Spawn();
2706
2708 }
2709 }
2710
2712 {
2713 if ( angle_deg != 0 )
2714 {
2715
2716 orientation[0] = orientation[0] - angle_deg;
2717
2718
2720 if ( MemoryPointExists( "rotate_axis" ) )
2721 {
2722 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2723 }
2724 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];
2725 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];
2726 center[0] = r_center_x;
2727 center[2] = r_center_z;
2728 }
2729 }
2730
2732 {
2734 {
2737 {
2738 if (areaDamage)
2739 {
2740 areaDamage.Destroy();
2741 }
2742
2744 }
2745 }
2746 }
2747
2749 {
2750 return true;
2751 }
2752
2753
2754
2755
2757 {
2759 }
2760
2762 {
2764 }
2765
2767 {
2769 }
2770
2772 {
2774
2775 switch ( material_type )
2776 {
2782 }
2783
2784 return "";
2785 }
2786
2788 {
2790
2791 switch ( material_type )
2792 {
2798 }
2799
2800 return "";
2801 }
2802
2803
2805 {
2807 {
2808
2810 {
2811 SetHealth(slot_name,"Health",item.GetHealth());
2812 }
2813 }
2814 }
2815
2817 {
2818 return 111;
2819 }
2820
2822 {
2823 super.SetActions();
2824
2828 }
2829
2830
2831
2832
2834 {
2835 }
2836
2839 {
2840 return null;
2841 }
2842
2844 {
2846 }
2847
2849 {
2852
2853 Man p;
2854
2855 #ifdef SERVER
2858 if (players.Count())
2859 p = players[0];
2860 #else
2862 #endif
2863
2865 {
2866 bool excluded = false;
2868 if (excludes)
2869 {
2870 foreach (string exclude : excludes)
2871 {
2873 {
2874 excluded = true;
2875 break;
2876 }
2877 }
2878 }
2879
2880 if (!excluded)
2881 {
2883 }
2884 }
2885
2887 }
2888}
2889
2891{
2892#ifdef BSB_DEBUG
2894#else
2895
2896#endif
2897}
2899{
2900#ifdef BSB_DEBUG_SPAM
2902#else
2903
2904#endif
2905}
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.