1654{
1656
1658
1660
1662
1668
1669
1670
1676
1682
1684
1688
1689
1691 {
1693
1694
1695 RegisterNetSyncVariableInt( "m_SyncParts01" );
1696 RegisterNetSyncVariableInt( "m_SyncParts02" );
1697 RegisterNetSyncVariableInt( "m_SyncParts03" );
1698 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1699 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1700 RegisterNetSyncVariableBool( "m_HasBase" );
1701
1702
1704
1705 if (ConfigIsExisting("hybridAttachments"))
1706 {
1709 }
1710 if (ConfigIsExisting("mountables"))
1711 {
1714 }
1715
1717 }
1718
1720 {
1721 super.EEDelete(parent);
1722
1724 {
1725 areaDamage.Destroy();
1726 }
1727
1728 }
1729
1731 {
1732 return "disableBaseDamage";
1733 }
1734
1736 {
1737 return true;
1738 }
1739
1741 {
1742 return EInventoryIconVisibility.HIDE_VICINITY;
1743 }
1744
1745
1747 {
1749 {
1750 SetSynchDirty();
1751 }
1752 }
1753
1755 {
1757 super.OnVariablesSynchronized();
1758
1760 }
1761
1763 {
1764
1766
1767
1769
1770
1772 }
1773
1774
1776 {
1777
1778 int offset;
1779 int mask;
1780
1781 if ( part_id >= 1 && part_id <= 31 )
1782 {
1783 offset = part_id - 1;
1784 mask = 1 << offset;
1785
1787 }
1788 else if ( part_id >= 32 && part_id <= 62 )
1789 {
1790 offset = ( part_id % 32 );
1791 mask = 1 << offset;
1792
1794 }
1795 else if ( part_id >= 63 && part_id <= 93 )
1796 {
1797 offset = ( part_id % 63 );
1798 mask = 1 << offset;
1799
1801 }
1802 }
1803
1805 {
1806
1807 int offset;
1808 int mask;
1809
1810 if ( part_id >= 1 && part_id <= 31 )
1811 {
1812 offset = part_id - 1;
1813 mask = 1 << offset;
1814
1816 }
1817 else if ( part_id >= 32 && part_id <= 62 )
1818 {
1819 offset = ( part_id % 32 );
1820 mask = 1 << offset;
1821
1823 }
1824 else if ( part_id >= 63 && part_id <= 93 )
1825 {
1826 offset = ( part_id % 63 );
1827 mask = 1 << offset;
1828
1830 }
1831 }
1832
1834 {
1835
1836 int offset;
1837 int mask;
1838
1839 if ( part_id >= 1 && part_id <= 31 )
1840 {
1841 offset = part_id - 1;
1842 mask = 1 << offset;
1843
1845 {
1846 return true;
1847 }
1848 }
1849 else if ( part_id >= 32 && part_id <= 62 )
1850 {
1851 offset = ( part_id % 32 );
1852 mask = 1 << offset;
1853
1855 {
1856 return true;
1857 }
1858 }
1859 else if ( part_id >= 63 && part_id <= 93 )
1860 {
1861 offset = ( part_id % 63 );
1862 mask = 1 << offset;
1863
1865 {
1866 return true;
1867 }
1868 }
1869
1870 return false;
1871 }
1872
1874 {
1877 }
1878
1880 {
1881
1884 }
1885
1887 {
1889 {
1892
1893 switch( build_action_id )
1894 {
1898 }
1899 }
1900 }
1901
1902
1904 {
1906 bool is_base = part.
IsBase();
1909 if ( is_part_built_sync )
1910 {
1912 {
1916
1917 if (is_base)
1918 {
1921 }
1922 }
1923 }
1924 else
1925 {
1927 {
1931
1932 if (is_base)
1933 {
1936 }
1937 }
1938 }
1939
1940
1942 }
1943
1944
1946 {
1949
1950 for ( int i = 0; i < construction_parts.Count(); ++i )
1951 {
1952 string key = construction_parts.GetKey( i );
1955 }
1956
1957
1959 }
1960
1962 {
1965
1966 for ( int i = 0; i < construction_parts.Count(); ++i )
1967 {
1968 string key = construction_parts.GetKey( i );
1970
1971 if ( value.
GetId() ==
id )
1972 {
1973 return value;
1974 }
1975 }
1976
1977 return NULL;
1978 }
1979
1980
1981
1983 {
1985 }
1986
1988 {
1990 }
1991
1993 {
1994 return true;
1995 }
1996
1998 {
1999 return false;
2000 }
2001
2002
2004 {
2007 {
2009 }
2010
2011 return construction_kit;
2012 }
2013
2015 {
2018 {
2020 }
2021 }
2022
2024 {
2026 }
2027
2029 {
2030 return "";
2031 }
2032
2034 {
2037 }
2038
2039
2041 {
2044 }
2045
2046
2048 {
2049 super.OnStoreSave( ctx );
2050
2051
2055
2057 }
2058
2060 {
2061 if ( !super.OnStoreLoad( ctx, version ) )
2062 return false;
2063
2064
2065
2067 {
2069 return false;
2070 }
2072 {
2074 return false;
2075 }
2077 {
2079 return false;
2080 }
2081
2082
2084 {
2086 return false;
2087 }
2088
2089
2090 return true;
2091 }
2092
2094 {
2095 super.AfterStoreLoad();
2096
2098 {
2100 }
2101 }
2102
2104 {
2105
2107
2108
2111
2112
2114 }
2115
2117 {
2118 super.OnCreatePhysics();
2121 }
2122
2124 {
2126 return;
2127
2128 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2129
2131 return;
2132
2134 string part_name = zone;
2136
2138 {
2139 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2140
2141 if ( construction_part && construction.IsPartConstructed( part_name ) )
2142 {
2144 construction.DestroyConnectedParts(part_name);
2145 }
2146
2147
2148 if ( part_name.
Contains(
"barbed") )
2149 {
2150 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2151 if (barbed_wire)
2152 barbed_wire.SetMountedState( false );
2153 }
2154 }
2155 }
2156
2158 {
2160 {
2162 }
2163
2164 super.EEOnAfterLoad();
2165 }
2166
2168 {
2169 super.EEInit();
2170
2171
2173
2174
2175 #ifdef DEVELOPER
2177 #endif
2178 }
2179
2181 {
2182 super.EEItemAttached( item, slot_name );
2183
2187 }
2188
2190 {
2191 super.EEItemDetached( item, slot_name );
2192
2195 }
2196
2197 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2198 {
2201
2204 }
2205
2206
2208 {
2209 return true;
2210 }
2211
2212
2213
2215 {
2217
2218
2219 if (construtionPart.
IsBase())
2220 {
2222
2223
2225 }
2226
2227
2229
2230
2232
2233
2235
2237
2239
2240
2242
2243
2245 }
2246
2248 {
2249
2251 }
2252
2253
2255 {
2258
2259
2261
2262
2264
2265
2267
2268
2270
2272
2273
2275
2276
2278
2279
2280 if (construtionPart.
IsBase())
2281 {
2282
2284 }
2285
2288 }
2289
2291 {
2292
2294 }
2295
2296
2297 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2298 {
2301
2302
2304
2305
2307
2308
2310
2311
2313
2315
2316
2318
2319
2321
2322
2323 if (construtionPart.
IsBase())
2324 {
2325
2327 }
2328
2331 }
2332
2334 {
2335
2337 }
2338
2340 {
2341 bool process = false;
2342
2343
2347
2348 if (process)
2349 {
2350 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2351 {
2353 return;
2354 }
2355
2357 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2358 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2359
2360
2362 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2363 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2364 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2365 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2366 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2367 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2368 mins = minTmp;
2369 maxs = maxTmp;
2370
2371 maxs[1] = maxs[1] + 0.35;
2372
2374 }
2375 }
2376
2378 {
2381
2382
2384 foreach (
EntityAI entity : foundEntities)
2385 {
2388 }
2389 }
2390
2391
2393 {
2395
2399 }
2400
2402 {
2404
2406 {
2408 }
2409 else
2410 {
2412 }
2413
2415 }
2416
2418 {
2420
2422 foreach (
string slotName : attachmentSlots)
2423 {
2425 }
2426
2427
2430 else
2432
2434 }
2435
2437 {
2438 string slotNameMounted = slot_name + "_Mounted";
2439 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2440
2441 if (attachment)
2442 {
2443 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2444 if (barbedWire && barbedWire.IsMounted())
2446 else
2448
2449 if (is_locked)
2450 {
2451 SetAnimationPhase(slotNameMounted, 0);
2452 SetAnimationPhase(slot_name, 1);
2453 }
2454 else
2455 {
2456 SetAnimationPhase(slotNameMounted, 1);
2457 SetAnimationPhase(slot_name, 0);
2458 }
2459 }
2460 else
2461 {
2462 SetAnimationPhase(slotNameMounted, 1);
2463 SetAnimationPhase(slot_name, 1);
2464
2466 }
2467 }
2468
2469
2471 {
2474
2477
2480
2481 foreach (
string slotName : attachmentSlots)
2482 {
2484 }
2485
2486
2488 {
2491
2493 }
2494 else
2495 {
2498
2500 }
2501
2504 }
2505
2507 {
2508
2510 return;
2511
2512 string slot_name_mounted = slot_name + "_Mounted";
2513 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2514
2515
2517 RemoveProxyPhysics( slot_name_mounted );
2518 RemoveProxyPhysics( slot_name );
2519
2520 if ( attachment )
2521 {
2523 if ( is_locked )
2524 {
2526 AddProxyPhysics( slot_name_mounted );
2527 }
2528 else
2529 {
2531 AddProxyPhysics( slot_name );
2532 }
2533 }
2534 }
2535
2537 {
2538 SetAffectPathgraph( true, false );
2540 }
2541
2543 {
2544 return true;
2545 }
2546
2548 {
2549 return true;
2550 }
2551
2553 {
2554 if ( attachment )
2555 {
2557 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2558
2559 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2560 }
2561
2562 return false;
2563 }
2564
2566 {
2568 }
2569
2570
2572 {
2573 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2574 if (
GetGame().ConfigIsExisting( config_path ) )
2575 {
2577 }
2578 }
2579
2581 {
2582 return true;
2583 }
2584
2586 {
2587 return true;
2588 }
2589
2591 {
2592 return true;
2593 }
2594
2595
2597 {
2599 {
2601 }
2602
2604 }
2605
2607 {
2609 }
2610
2611
2612
2614 {
2615 return super.CanReceiveAttachment(attachment, slotId);
2616 }
2617
2619 {
2620 int attachment_count = GetInventory().AttachmentCount();
2621 if ( attachment_count > 0 )
2622 {
2623 if (
HasBase() && attachment_count == 1 )
2624 {
2625 return false;
2626 }
2627
2628 return true;
2629 }
2630
2631 return false;
2632 }
2633
2635 {
2636 return true;
2637 }
2638
2640 {
2641 return false;
2642 }
2643
2644
2646 {
2647 return false;
2648 }
2649
2651 {
2652 return false;
2653 }
2654
2655
2657 {
2658 return false;
2659 }
2660
2661
2662
2664 {
2665 return true;
2666 }
2667
2669 {
2670 return true;
2671 }
2672
2675 {
2676 return false;
2677 }
2678
2679
2681 {
2682 return true;
2683 }
2684
2685
2687 {
2688 return false;
2689 }
2690
2691
2693 {
2694 return true;
2695 }
2696
2697
2699 {
2700 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2701 {
2702 return false;
2703 }
2704
2705 return true;
2706 }
2707
2709 {
2712
2713 return item;
2714 }
2715
2716
2718 {
2720 {
2721
2723
2724
2727
2729 if ( MemoryPointExists( slot_name + "_min" ) )
2730 {
2731 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2732 }
2733 if ( MemoryPointExists( slot_name + "_max" ) )
2734 {
2735 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2736 }
2737
2738
2741
2742
2745 center = ModelToWorld( center );
2746
2747
2750
2751 areaDamage.SetExtents( extents[0], extents[1] );
2752 areaDamage.SetAreaPosition( center );
2753 areaDamage.SetAreaOrientation( orientation );
2756 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2757 areaDamage.SetAmmoName( "BarbedWireHit" );
2758 areaDamage.Spawn();
2759
2761 }
2762 }
2763
2765 {
2766 if ( angle_deg != 0 )
2767 {
2768
2769 orientation[0] = orientation[0] - angle_deg;
2770
2771
2773 if ( MemoryPointExists( "rotate_axis" ) )
2774 {
2775 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2776 }
2777 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];
2778 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];
2779 center[0] = r_center_x;
2780 center[2] = r_center_z;
2781 }
2782 }
2783
2785 {
2787 {
2790 {
2791 if (areaDamage)
2792 {
2793 areaDamage.Destroy();
2794 }
2795
2797 }
2798 }
2799 }
2800
2802 {
2803 return true;
2804 }
2805
2806
2807
2808
2810 {
2812 }
2813
2815 {
2817 }
2818
2820 {
2822 }
2823
2825 {
2827
2828 switch ( material_type )
2829 {
2835 }
2836
2837 return "";
2838 }
2839
2841 {
2843
2844 switch ( material_type )
2845 {
2851 }
2852
2853 return "";
2854 }
2855
2856
2858 {
2860 {
2861
2863 {
2864 SetHealth(slot_name,"Health",item.GetHealth());
2865 }
2866 }
2867 }
2868
2870 {
2871 return 111;
2872 }
2873
2875 {
2876 super.SetActions();
2877
2881 }
2882
2883
2884
2885
2887 {
2888 }
2889
2892 {
2893 return null;
2894 }
2895
2897 {
2899 }
2900
2902 {
2905
2906 Man p;
2907
2908 #ifdef SERVER
2911 if (players.Count())
2912 p = players[0];
2913 #else
2915 #endif
2916
2918 {
2919 bool excluded = false;
2921 if (excludes)
2922 {
2923 foreach (string exclude : excludes)
2924 {
2926 {
2927 excluded = true;
2928 break;
2929 }
2930 }
2931 }
2932
2933 if (!excluded)
2934 {
2936 }
2937 }
2938
2940 }
2941}
2942
2944{
2945#ifdef BSB_DEBUG
2947#else
2948
2949#endif
2950}
2952{
2953#ifdef BSB_DEBUG_SPAM
2955#else
2956
2957#endif
2958}
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.