1637{
1639
1641
1643
1645
1651
1652
1653
1659
1665
1667
1671
1672
1674 {
1676
1677
1678 RegisterNetSyncVariableInt( "m_SyncParts01" );
1679 RegisterNetSyncVariableInt( "m_SyncParts02" );
1680 RegisterNetSyncVariableInt( "m_SyncParts03" );
1681 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1682 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1683 RegisterNetSyncVariableBool( "m_HasBase" );
1684
1685
1687
1688 if (ConfigIsExisting("hybridAttachments"))
1689 {
1692 }
1693 if (ConfigIsExisting("mountables"))
1694 {
1697 }
1698
1700 }
1701
1703 {
1704 super.EEDelete(parent);
1705
1707 {
1708 areaDamage.Destroy();
1709 }
1710
1711 }
1712
1714 {
1715 return "disableBaseDamage";
1716 }
1717
1719 {
1720 return true;
1721 }
1722
1724 {
1725 return EInventoryIconVisibility.HIDE_VICINITY;
1726 }
1727
1728
1730 {
1732 {
1733 SetSynchDirty();
1734 }
1735 }
1736
1738 {
1740 super.OnVariablesSynchronized();
1741
1743 }
1744
1746 {
1747
1749
1750
1752
1753
1755 }
1756
1757
1759 {
1760
1761 int offset;
1762 int mask;
1763
1764 if ( part_id >= 1 && part_id <= 31 )
1765 {
1766 offset = part_id - 1;
1767 mask = 1 << offset;
1768
1770 }
1771 else if ( part_id >= 32 && part_id <= 62 )
1772 {
1773 offset = ( part_id % 32 );
1774 mask = 1 << offset;
1775
1777 }
1778 else if ( part_id >= 63 && part_id <= 93 )
1779 {
1780 offset = ( part_id % 63 );
1781 mask = 1 << offset;
1782
1784 }
1785 }
1786
1788 {
1789
1790 int offset;
1791 int mask;
1792
1793 if ( part_id >= 1 && part_id <= 31 )
1794 {
1795 offset = part_id - 1;
1796 mask = 1 << offset;
1797
1799 }
1800 else if ( part_id >= 32 && part_id <= 62 )
1801 {
1802 offset = ( part_id % 32 );
1803 mask = 1 << offset;
1804
1806 }
1807 else if ( part_id >= 63 && part_id <= 93 )
1808 {
1809 offset = ( part_id % 63 );
1810 mask = 1 << offset;
1811
1813 }
1814 }
1815
1817 {
1818
1819 int offset;
1820 int mask;
1821
1822 if ( part_id >= 1 && part_id <= 31 )
1823 {
1824 offset = part_id - 1;
1825 mask = 1 << offset;
1826
1828 {
1829 return true;
1830 }
1831 }
1832 else if ( part_id >= 32 && part_id <= 62 )
1833 {
1834 offset = ( part_id % 32 );
1835 mask = 1 << offset;
1836
1838 {
1839 return true;
1840 }
1841 }
1842 else if ( part_id >= 63 && part_id <= 93 )
1843 {
1844 offset = ( part_id % 63 );
1845 mask = 1 << offset;
1846
1848 {
1849 return true;
1850 }
1851 }
1852
1853 return false;
1854 }
1855
1857 {
1860 }
1861
1863 {
1864
1867 }
1868
1870 {
1872 {
1875
1876 switch( build_action_id )
1877 {
1881 }
1882 }
1883 }
1884
1885
1887 {
1889 bool is_base = part.
IsBase();
1892 if ( is_part_built_sync )
1893 {
1895 {
1899
1900 if (is_base)
1901 {
1904 }
1905 }
1906 }
1907 else
1908 {
1910 {
1914
1915 if (is_base)
1916 {
1919 }
1920 }
1921 }
1922
1923
1925 }
1926
1927
1929 {
1932
1933 for ( int i = 0; i < construction_parts.Count(); ++i )
1934 {
1935 string key = construction_parts.GetKey( i );
1938 }
1939
1940
1942 }
1943
1945 {
1948
1949 for ( int i = 0; i < construction_parts.Count(); ++i )
1950 {
1951 string key = construction_parts.GetKey( i );
1953
1954 if ( value.
GetId() ==
id )
1955 {
1956 return value;
1957 }
1958 }
1959
1960 return NULL;
1961 }
1962
1963
1964
1966 {
1968 }
1969
1971 {
1973 }
1974
1976 {
1977 return true;
1978 }
1979
1981 {
1982 return false;
1983 }
1984
1985
1987 {
1990 {
1992 }
1993
1994 return construction_kit;
1995 }
1996
1998 {
2001 {
2003 }
2004 }
2005
2007 {
2009 }
2010
2012 {
2013 return "";
2014 }
2015
2017 {
2020 }
2021
2022
2024 {
2027 }
2028
2029
2031 {
2032 super.OnStoreSave( ctx );
2033
2034
2038
2040 }
2041
2043 {
2044 if ( !super.OnStoreLoad( ctx, version ) )
2045 return false;
2046
2047
2048
2050 {
2052 return false;
2053 }
2055 {
2057 return false;
2058 }
2060 {
2062 return false;
2063 }
2064
2065
2067 {
2069 return false;
2070 }
2071
2072
2073 return true;
2074 }
2075
2077 {
2078 super.AfterStoreLoad();
2079
2081 {
2083 }
2084 }
2085
2087 {
2088
2090
2091
2094
2095
2097 }
2098
2100 {
2101 super.OnCreatePhysics();
2104 }
2105
2107 {
2109 return;
2110
2111 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2112
2114 return;
2115
2117 string part_name = zone;
2119
2121 {
2122 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2123
2124 if ( construction_part && construction.IsPartConstructed( part_name ) )
2125 {
2127 construction.DestroyConnectedParts(part_name);
2128 }
2129
2130
2131 if ( part_name.
Contains(
"barbed") )
2132 {
2133 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2134 if (barbed_wire)
2135 barbed_wire.SetMountedState( false );
2136 }
2137 }
2138 }
2139
2141 {
2143 {
2145 }
2146
2147 super.EEOnAfterLoad();
2148 }
2149
2151 {
2152 super.EEInit();
2153
2154
2156
2157
2158 #ifdef DEVELOPER
2160 #endif
2161 }
2162
2164 {
2165 super.EEItemAttached( item, slot_name );
2166
2170 }
2171
2173 {
2174 super.EEItemDetached( item, slot_name );
2175
2178 }
2179
2180 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2181 {
2184
2187 }
2188
2189
2191 {
2192 return true;
2193 }
2194
2195
2196
2198 {
2200
2201
2202 if (construtionPart.
IsBase())
2203 {
2205
2206
2208 }
2209
2210
2212
2213
2215
2216
2218
2220
2222
2223
2225
2226
2228 }
2229
2231 {
2232
2234 }
2235
2236
2238 {
2241
2242
2244
2245
2247
2248
2250
2251
2253
2255
2256
2258
2259
2261
2262
2263 if (construtionPart.
IsBase())
2264 {
2265
2267 }
2268
2271 }
2272
2274 {
2275
2277 }
2278
2279
2280 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2281 {
2284
2285
2287
2288
2290
2291
2293
2294
2296
2298
2299
2301
2302
2304
2305
2306 if (construtionPart.
IsBase())
2307 {
2308
2310 }
2311
2314 }
2315
2317 {
2318
2320 }
2321
2323 {
2324 bool process = false;
2325
2326
2330
2331 if (process)
2332 {
2333 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2334 {
2336 return;
2337 }
2338
2340 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2341 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2342
2343
2345 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2346 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2347 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2348 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2349 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2350 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2351 mins = minTmp;
2352 maxs = maxTmp;
2353
2354 maxs[1] = maxs[1] + 0.35;
2355
2357 }
2358 }
2359
2361 {
2364
2365
2367 foreach (
EntityAI entity : foundEntities)
2368 {
2371 }
2372 }
2373
2374
2376 {
2378
2382 }
2383
2385 {
2387
2389 {
2391 }
2392 else
2393 {
2395 }
2396
2398 }
2399
2401 {
2403
2405 foreach (
string slotName : attachmentSlots)
2406 {
2408 }
2409
2410
2413 else
2415
2417 }
2418
2420 {
2421 string slotNameMounted = slot_name + "_Mounted";
2422 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2423
2424 if (attachment)
2425 {
2426 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2427 if (barbedWire && barbedWire.IsMounted())
2429 else
2431
2432 if (is_locked)
2433 {
2434 SetAnimationPhase(slotNameMounted, 0);
2435 SetAnimationPhase(slot_name, 1);
2436 }
2437 else
2438 {
2439 SetAnimationPhase(slotNameMounted, 1);
2440 SetAnimationPhase(slot_name, 0);
2441 }
2442 }
2443 else
2444 {
2445 SetAnimationPhase(slotNameMounted, 1);
2446 SetAnimationPhase(slot_name, 1);
2447
2449 }
2450 }
2451
2452
2454 {
2457
2460
2463
2464 foreach (
string slotName : attachmentSlots)
2465 {
2467 }
2468
2469
2471 {
2474
2476 }
2477 else
2478 {
2481
2483 }
2484
2487 }
2488
2490 {
2491
2493 return;
2494
2495 string slot_name_mounted = slot_name + "_Mounted";
2496 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2497
2498
2500 RemoveProxyPhysics( slot_name_mounted );
2501 RemoveProxyPhysics( slot_name );
2502
2503 if ( attachment )
2504 {
2506 if ( is_locked )
2507 {
2509 AddProxyPhysics( slot_name_mounted );
2510 }
2511 else
2512 {
2514 AddProxyPhysics( slot_name );
2515 }
2516 }
2517 }
2518
2520 {
2521 SetAffectPathgraph( true, false );
2523 }
2524
2526 {
2527 return true;
2528 }
2529
2531 {
2532 return true;
2533 }
2534
2536 {
2537 if ( attachment )
2538 {
2540 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2541
2542 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2543 }
2544
2545 return false;
2546 }
2547
2549 {
2551 }
2552
2553
2555 {
2556 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2557 if (
GetGame().ConfigIsExisting( config_path ) )
2558 {
2560 }
2561 }
2562
2564 {
2565 return true;
2566 }
2567
2569 {
2570 return true;
2571 }
2572
2574 {
2575 return true;
2576 }
2577
2578
2580 {
2582 {
2584 }
2585
2587 }
2588
2590 {
2592 }
2593
2594
2595
2597 {
2598 return super.CanReceiveAttachment(attachment, slotId);
2599 }
2600
2602 {
2603 int attachment_count = GetInventory().AttachmentCount();
2604 if ( attachment_count > 0 )
2605 {
2606 if (
HasBase() && attachment_count == 1 )
2607 {
2608 return false;
2609 }
2610
2611 return true;
2612 }
2613
2614 return false;
2615 }
2616
2618 {
2619 return true;
2620 }
2621
2623 {
2624 return false;
2625 }
2626
2627
2629 {
2630 return false;
2631 }
2632
2634 {
2635 return false;
2636 }
2637
2638
2640 {
2641 return false;
2642 }
2643
2644
2645
2647 {
2648 return true;
2649 }
2650
2652 {
2653 return true;
2654 }
2655
2658 {
2659 return false;
2660 }
2661
2662
2664 {
2665 return true;
2666 }
2667
2668
2670 {
2671 return false;
2672 }
2673
2674
2676 {
2677 return true;
2678 }
2679
2680
2682 {
2683 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2684 {
2685 return false;
2686 }
2687
2688 return true;
2689 }
2690
2692 {
2695
2696 return item;
2697 }
2698
2699
2701 {
2703 {
2704
2706
2707
2710
2712 if ( MemoryPointExists( slot_name + "_min" ) )
2713 {
2714 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2715 }
2716 if ( MemoryPointExists( slot_name + "_max" ) )
2717 {
2718 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2719 }
2720
2721
2724
2725
2728 center = ModelToWorld( center );
2729
2730
2733
2734 areaDamage.SetExtents( extents[0], extents[1] );
2735 areaDamage.SetAreaPosition( center );
2736 areaDamage.SetAreaOrientation( orientation );
2739 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2740 areaDamage.SetAmmoName( "BarbedWireHit" );
2741 areaDamage.Spawn();
2742
2744 }
2745 }
2746
2748 {
2749 if ( angle_deg != 0 )
2750 {
2751
2752 orientation[0] = orientation[0] - angle_deg;
2753
2754
2756 if ( MemoryPointExists( "rotate_axis" ) )
2757 {
2758 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2759 }
2760 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];
2761 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];
2762 center[0] = r_center_x;
2763 center[2] = r_center_z;
2764 }
2765 }
2766
2768 {
2770 {
2773 {
2774 if (areaDamage)
2775 {
2776 areaDamage.Destroy();
2777 }
2778
2780 }
2781 }
2782 }
2783
2785 {
2786 return true;
2787 }
2788
2789
2790
2791
2793 {
2795 }
2796
2798 {
2800 }
2801
2803 {
2805 }
2806
2808 {
2810
2811 switch ( material_type )
2812 {
2818 }
2819
2820 return "";
2821 }
2822
2824 {
2826
2827 switch ( material_type )
2828 {
2834 }
2835
2836 return "";
2837 }
2838
2839
2841 {
2843 {
2844
2846 {
2847 SetHealth(slot_name,"Health",item.GetHealth());
2848 }
2849 }
2850 }
2851
2853 {
2854 return 111;
2855 }
2856
2858 {
2859 super.SetActions();
2860
2864 }
2865
2866
2867
2868
2870 {
2871 }
2872
2875 {
2876 return null;
2877 }
2878
2880 {
2882 }
2883
2885 {
2888
2889 Man p;
2890
2891 #ifdef SERVER
2894 if (players.Count())
2895 p = players[0];
2896 #else
2898 #endif
2899
2901 {
2902 bool excluded = false;
2904 if (excludes)
2905 {
2906 foreach (string exclude : excludes)
2907 {
2909 {
2910 excluded = true;
2911 break;
2912 }
2913 }
2914 }
2915
2916 if (!excluded)
2917 {
2919 }
2920 }
2921
2923 }
2924}
2925
2927{
2928#ifdef BSB_DEBUG
2930#else
2931
2932#endif
2933}
2935{
2936#ifdef BSB_DEBUG_SPAM
2938#else
2939
2940#endif
2941}
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.