1668{
1670
1672
1674
1676
1682
1683
1684
1690
1696
1698
1702
1703
1705 {
1707
1708
1709 RegisterNetSyncVariableInt( "m_SyncParts01" );
1710 RegisterNetSyncVariableInt( "m_SyncParts02" );
1711 RegisterNetSyncVariableInt( "m_SyncParts03" );
1712 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1713 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1714 RegisterNetSyncVariableBool( "m_HasBase" );
1715
1716
1718
1719 if (ConfigIsExisting("hybridAttachments"))
1720 {
1723 }
1724 if (ConfigIsExisting("mountables"))
1725 {
1728 }
1729
1731 }
1732
1734 {
1735 super.EEDelete(parent);
1736
1738 {
1739 areaDamage.Destroy();
1740 }
1741
1742 }
1743
1745 {
1746 return "disableBaseDamage";
1747 }
1748
1750 {
1751 return true;
1752 }
1753
1755 {
1756 return EInventoryIconVisibility.HIDE_VICINITY;
1757 }
1758
1759
1761 {
1763 {
1764 SetSynchDirty();
1765 }
1766 }
1767
1769 {
1771 super.OnVariablesSynchronized();
1772
1774 }
1775
1777 {
1778
1780
1781
1783
1784
1786 }
1787
1788
1790 {
1791
1792 int offset;
1793 int mask;
1794
1795 if ( part_id >= 1 && part_id <= 31 )
1796 {
1797 offset = part_id - 1;
1798 mask = 1 << offset;
1799
1801 }
1802 else if ( part_id >= 32 && part_id <= 62 )
1803 {
1804 offset = ( part_id % 32 );
1805 mask = 1 << offset;
1806
1808 }
1809 else if ( part_id >= 63 && part_id <= 93 )
1810 {
1811 offset = ( part_id % 63 );
1812 mask = 1 << offset;
1813
1815 }
1816 }
1817
1819 {
1820
1821 int offset;
1822 int mask;
1823
1824 if ( part_id >= 1 && part_id <= 31 )
1825 {
1826 offset = part_id - 1;
1827 mask = 1 << offset;
1828
1830 }
1831 else if ( part_id >= 32 && part_id <= 62 )
1832 {
1833 offset = ( part_id % 32 );
1834 mask = 1 << offset;
1835
1837 }
1838 else if ( part_id >= 63 && part_id <= 93 )
1839 {
1840 offset = ( part_id % 63 );
1841 mask = 1 << offset;
1842
1844 }
1845 }
1846
1848 {
1849
1850 int offset;
1851 int mask;
1852
1853 if ( part_id >= 1 && part_id <= 31 )
1854 {
1855 offset = part_id - 1;
1856 mask = 1 << offset;
1857
1859 {
1860 return true;
1861 }
1862 }
1863 else if ( part_id >= 32 && part_id <= 62 )
1864 {
1865 offset = ( part_id % 32 );
1866 mask = 1 << offset;
1867
1869 {
1870 return true;
1871 }
1872 }
1873 else if ( part_id >= 63 && part_id <= 93 )
1874 {
1875 offset = ( part_id % 63 );
1876 mask = 1 << offset;
1877
1879 {
1880 return true;
1881 }
1882 }
1883
1884 return false;
1885 }
1886
1888 {
1891 }
1892
1894 {
1895
1898 }
1899
1901 {
1903 {
1906
1907 switch( build_action_id )
1908 {
1912 }
1913 }
1914 }
1915
1916
1918 {
1920 bool is_base = part.
IsBase();
1923 if ( is_part_built_sync )
1924 {
1926 {
1930
1931 if (is_base)
1932 {
1935 }
1936 }
1937 }
1938 else
1939 {
1941 {
1945
1946 if (is_base)
1947 {
1950 }
1951 }
1952 }
1953
1954
1956 }
1957
1958
1960 {
1963
1964 for ( int i = 0; i < construction_parts.Count(); ++i )
1965 {
1966 string key = construction_parts.GetKey( i );
1969 }
1970
1971
1973 }
1974
1976 {
1979
1980 for ( int i = 0; i < construction_parts.Count(); ++i )
1981 {
1982 string key = construction_parts.GetKey( i );
1984
1985 if ( value.
GetId() ==
id )
1986 {
1987 return value;
1988 }
1989 }
1990
1991 return NULL;
1992 }
1993
1994
1995
1997 {
1999 }
2000
2002 {
2004 }
2005
2007 {
2008 return true;
2009 }
2010
2012 {
2013 return false;
2014 }
2015
2016
2018 {
2021 {
2023 }
2024
2025 return construction_kit;
2026 }
2027
2029 {
2032 {
2034 }
2035 }
2036
2038 {
2040 }
2041
2043 {
2044 return "";
2045 }
2046
2048 {
2051 }
2052
2053
2055 {
2058 }
2059
2060
2062 {
2063 super.OnStoreSave( ctx );
2064
2065
2069
2071 }
2072
2074 {
2075 if ( !super.OnStoreLoad( ctx, version ) )
2076 return false;
2077
2078
2079
2081 {
2083 return false;
2084 }
2086 {
2088 return false;
2089 }
2091 {
2093 return false;
2094 }
2095
2096
2098 {
2100 return false;
2101 }
2102
2103
2104 return true;
2105 }
2106
2108 {
2109 super.AfterStoreLoad();
2110
2112 {
2114 }
2115 }
2116
2118 {
2119
2121
2122
2125
2126
2128 }
2129
2131 {
2132 super.OnCreatePhysics();
2135 }
2136
2138 {
2140 return;
2141
2142 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2143
2145 return;
2146
2148 string part_name = zone;
2150
2152 {
2153 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2154
2155 if ( construction_part && construction.IsPartConstructed( part_name ) )
2156 {
2158 construction.DestroyConnectedParts(part_name);
2159 }
2160
2161
2162 if ( part_name.
Contains(
"barbed") )
2163 {
2164 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2165 if (barbed_wire)
2166 barbed_wire.SetMountedState( false );
2167 }
2168 }
2169 }
2170
2172 {
2174 {
2176 }
2177
2178 super.EEOnAfterLoad();
2179 }
2180
2182 {
2183 super.EEInit();
2184
2185
2187
2188
2189 #ifdef DEVELOPER
2191 #endif
2192 }
2193
2195 {
2196 super.EEItemAttached( item, slot_name );
2197
2201 }
2202
2204 {
2205 super.EEItemDetached( item, slot_name );
2206
2209 }
2210
2211 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2212 {
2215
2218 }
2219
2220
2222 {
2223 return true;
2224 }
2225
2226
2227
2229 {
2231
2232
2233 if (construtionPart.
IsBase())
2234 {
2236
2237
2239 }
2240
2241
2243
2244
2246
2247
2249
2251
2253
2254
2256
2257
2259 }
2260
2262 {
2263
2265 }
2266
2267
2269 {
2272
2273
2275
2276
2278
2279
2281
2282
2284
2286
2287
2289
2290
2292
2293
2294 if (construtionPart.
IsBase())
2295 {
2296
2298 }
2299
2302 }
2303
2305 {
2306
2308 }
2309
2310
2311 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2312 {
2315
2316
2318
2319
2321
2322
2324
2325
2327
2329
2330
2332
2333
2335
2336
2337 if (construtionPart.
IsBase())
2338 {
2339
2341 }
2342
2345 }
2346
2348 {
2349
2351 }
2352
2354 {
2355 bool process = false;
2356
2357
2361
2362 if (process)
2363 {
2364 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2365 {
2367 return;
2368 }
2369
2371 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2372 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2373
2374
2376 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2377 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2378 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2379 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2380 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2381 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2382 mins = minTmp;
2383 maxs = maxTmp;
2384
2385 maxs[1] = maxs[1] + 0.35;
2386
2388 }
2389 }
2390
2392 {
2395
2396
2398 foreach (
EntityAI entity : foundEntities)
2399 {
2402 }
2403 }
2404
2405
2407 {
2409
2413 }
2414
2416 {
2418
2420 {
2422 }
2423 else
2424 {
2426 }
2427
2429 }
2430
2432 {
2434
2436 foreach (
string slotName : attachmentSlots)
2437 {
2439 }
2440
2441
2444 else
2446
2448 }
2449
2451 {
2452 string slotNameMounted = slot_name + "_Mounted";
2453 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2454
2455 if (attachment)
2456 {
2457 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2458 if (barbedWire && barbedWire.IsMounted())
2460 else
2462
2463 if (is_locked)
2464 {
2465 SetAnimationPhase(slotNameMounted, 0);
2466 SetAnimationPhase(slot_name, 1);
2467 }
2468 else
2469 {
2470 SetAnimationPhase(slotNameMounted, 1);
2471 SetAnimationPhase(slot_name, 0);
2472 }
2473 }
2474 else
2475 {
2476 SetAnimationPhase(slotNameMounted, 1);
2477 SetAnimationPhase(slot_name, 1);
2478
2480 }
2481 }
2482
2483
2485 {
2488
2491
2494
2495 foreach (
string slotName : attachmentSlots)
2496 {
2498 }
2499
2500
2502 {
2505
2507 }
2508 else
2509 {
2512
2514 }
2515
2518 }
2519
2521 {
2522
2524 return;
2525
2526 string slot_name_mounted = slot_name + "_Mounted";
2527 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2528
2529
2531 RemoveProxyPhysics( slot_name_mounted );
2532 RemoveProxyPhysics( slot_name );
2533
2534 if ( attachment )
2535 {
2537 if ( is_locked )
2538 {
2540 AddProxyPhysics( slot_name_mounted );
2541 }
2542 else
2543 {
2545 AddProxyPhysics( slot_name );
2546 }
2547 }
2548 }
2549
2551 {
2552 SetAffectPathgraph( true, false );
2554 }
2555
2557 {
2558 return true;
2559 }
2560
2562 {
2563 return true;
2564 }
2565
2567 {
2568 if ( attachment )
2569 {
2571 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2572
2573 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2574 }
2575
2576 return false;
2577 }
2578
2580 {
2582 }
2583
2584
2586 {
2587 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2588 if (
GetGame().ConfigIsExisting( config_path ) )
2589 {
2591 }
2592 }
2593
2595 {
2596 return true;
2597 }
2598
2600 {
2601 return true;
2602 }
2603
2605 {
2606 return true;
2607 }
2608
2609
2611 {
2613 {
2615 }
2616
2618 }
2619
2621 {
2623 }
2624
2625
2626
2628 {
2629 return super.CanReceiveAttachment(attachment, slotId);
2630 }
2631
2633 {
2634 int attachment_count = GetInventory().AttachmentCount();
2635 if ( attachment_count > 0 )
2636 {
2637 if (
HasBase() && attachment_count == 1 )
2638 {
2639 return false;
2640 }
2641
2642 return true;
2643 }
2644
2645 return false;
2646 }
2647
2649 {
2650 return true;
2651 }
2652
2654 {
2655 return false;
2656 }
2657
2658
2660 {
2661 return false;
2662 }
2663
2665 {
2666 return false;
2667 }
2668
2669
2671 {
2672 return false;
2673 }
2674
2675
2676
2678 {
2679 return true;
2680 }
2681
2683 {
2684 return true;
2685 }
2686
2689 {
2690 return false;
2691 }
2692
2693
2695 {
2696 return true;
2697 }
2698
2699
2701 {
2702 return false;
2703 }
2704
2705
2707 {
2708 return true;
2709 }
2710
2711
2713 {
2714 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2715 {
2716 return false;
2717 }
2718
2719 return true;
2720 }
2721
2723 {
2726
2727 return item;
2728 }
2729
2730
2732 {
2734 {
2735
2737
2738
2741
2743 if ( MemoryPointExists( slot_name + "_min" ) )
2744 {
2745 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2746 }
2747 if ( MemoryPointExists( slot_name + "_max" ) )
2748 {
2749 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2750 }
2751
2752
2755
2756
2759 center = ModelToWorld( center );
2760
2761
2764
2765 areaDamage.SetExtents( extents[0], extents[1] );
2766 areaDamage.SetAreaPosition( center );
2767 areaDamage.SetAreaOrientation( orientation );
2770 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2771 areaDamage.SetAmmoName( "BarbedWireHit" );
2772 areaDamage.Spawn();
2773
2775 }
2776 }
2777
2779 {
2780 if ( angle_deg != 0 )
2781 {
2782
2783 orientation[0] = orientation[0] - angle_deg;
2784
2785
2787 if ( MemoryPointExists( "rotate_axis" ) )
2788 {
2789 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2790 }
2791 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];
2792 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];
2793 center[0] = r_center_x;
2794 center[2] = r_center_z;
2795 }
2796 }
2797
2799 {
2801 {
2804 {
2805 if (areaDamage)
2806 {
2807 areaDamage.Destroy();
2808 }
2809
2811 }
2812 }
2813 }
2814
2816 {
2817 return true;
2818 }
2819
2820
2821
2822
2824 {
2826 }
2827
2829 {
2831 }
2832
2834 {
2836 }
2837
2839 {
2841
2842 switch ( material_type )
2843 {
2849 }
2850
2851 return "";
2852 }
2853
2855 {
2857
2858 switch ( material_type )
2859 {
2865 }
2866
2867 return "";
2868 }
2869
2870
2872 {
2874 {
2875
2877 {
2878 SetHealth(slot_name,"Health",item.GetHealth());
2879 }
2880 }
2881 }
2882
2884 {
2885 return 111;
2886 }
2887
2889 {
2890 super.SetActions();
2891
2895 }
2896
2897
2898
2899
2901 {
2902 }
2903
2906 {
2907 return null;
2908 }
2909
2911 {
2913 }
2914
2916 {
2919
2920 Man p;
2921
2922 #ifdef SERVER
2925 if (players.Count())
2926 p = players[0];
2927 #else
2929 #endif
2930
2932 {
2933 bool excluded = false;
2935 if (excludes)
2936 {
2937 foreach (string exclude : excludes)
2938 {
2940 {
2941 excluded = true;
2942 break;
2943 }
2944 }
2945 }
2946
2947 if (!excluded)
2948 {
2950 }
2951 }
2952
2954 }
2955}
2956
2958{
2959#ifdef BSB_DEBUG
2961#else
2962
2963#endif
2964}
2966{
2967#ifdef BSB_DEBUG_SPAM
2969#else
2970
2971#endif
2972}
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.