1680{
1682
1684
1686
1688
1694
1695
1696
1702
1708
1710
1714
1715
1717 {
1719
1720
1721 RegisterNetSyncVariableInt( "m_SyncParts01" );
1722 RegisterNetSyncVariableInt( "m_SyncParts02" );
1723 RegisterNetSyncVariableInt( "m_SyncParts03" );
1724 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1725 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1726 RegisterNetSyncVariableBool( "m_HasBase" );
1727
1728
1730
1731 if (ConfigIsExisting("hybridAttachments"))
1732 {
1735 }
1736 if (ConfigIsExisting("mountables"))
1737 {
1740 }
1741
1743 }
1744
1746 {
1747 super.EEDelete(parent);
1748
1750 {
1751 areaDamage.Destroy();
1752 }
1753
1754 }
1755
1757 {
1758 return "disableBaseDamage";
1759 }
1760
1762 {
1763 return true;
1764 }
1765
1767 {
1768 return EInventoryIconVisibility.HIDE_VICINITY;
1769 }
1770
1771
1773 {
1775 {
1776 SetSynchDirty();
1777 }
1778 }
1779
1781 {
1783 super.OnVariablesSynchronized();
1784
1786 }
1787
1789 {
1790
1792
1793
1795
1796
1798 }
1799
1800
1802 {
1803
1804 int offset;
1805 int mask;
1806
1807 if ( part_id >= 1 && part_id <= 31 )
1808 {
1809 offset = part_id - 1;
1810 mask = 1 << offset;
1811
1813 }
1814 else if ( part_id >= 32 && part_id <= 62 )
1815 {
1816 offset = ( part_id % 32 );
1817 mask = 1 << offset;
1818
1820 }
1821 else if ( part_id >= 63 && part_id <= 93 )
1822 {
1823 offset = ( part_id % 63 );
1824 mask = 1 << offset;
1825
1827 }
1828 }
1829
1831 {
1832
1833 int offset;
1834 int mask;
1835
1836 if ( part_id >= 1 && part_id <= 31 )
1837 {
1838 offset = part_id - 1;
1839 mask = 1 << offset;
1840
1842 }
1843 else if ( part_id >= 32 && part_id <= 62 )
1844 {
1845 offset = ( part_id % 32 );
1846 mask = 1 << offset;
1847
1849 }
1850 else if ( part_id >= 63 && part_id <= 93 )
1851 {
1852 offset = ( part_id % 63 );
1853 mask = 1 << offset;
1854
1856 }
1857 }
1858
1860 {
1861
1862 int offset;
1863 int mask;
1864
1865 if ( part_id >= 1 && part_id <= 31 )
1866 {
1867 offset = part_id - 1;
1868 mask = 1 << offset;
1869
1871 {
1872 return true;
1873 }
1874 }
1875 else if ( part_id >= 32 && part_id <= 62 )
1876 {
1877 offset = ( part_id % 32 );
1878 mask = 1 << offset;
1879
1881 {
1882 return true;
1883 }
1884 }
1885 else if ( part_id >= 63 && part_id <= 93 )
1886 {
1887 offset = ( part_id % 63 );
1888 mask = 1 << offset;
1889
1891 {
1892 return true;
1893 }
1894 }
1895
1896 return false;
1897 }
1898
1900 {
1903 }
1904
1906 {
1907
1910 }
1911
1913 {
1915 {
1918
1919 switch( build_action_id )
1920 {
1924 }
1925 }
1926 }
1927
1928
1930 {
1932 bool is_base = part.
IsBase();
1935 if ( is_part_built_sync )
1936 {
1938 {
1942
1943 if (is_base)
1944 {
1947 }
1948 }
1949 }
1950 else
1951 {
1953 {
1957
1958 if (is_base)
1959 {
1962 }
1963 }
1964 }
1965
1966
1968 }
1969
1970
1972 {
1975
1976 for ( int i = 0; i < construction_parts.Count(); ++i )
1977 {
1978 string key = construction_parts.GetKey( i );
1981 }
1982
1983
1985 }
1986
1988 {
1991
1992 for ( int i = 0; i < construction_parts.Count(); ++i )
1993 {
1994 string key = construction_parts.GetKey( i );
1996
1997 if ( value.
GetId() ==
id )
1998 {
1999 return value;
2000 }
2001 }
2002
2003 return NULL;
2004 }
2005
2006
2007
2009 {
2011 }
2012
2014 {
2016 }
2017
2019 {
2020 return true;
2021 }
2022
2024 {
2025 return false;
2026 }
2027
2028
2030 {
2033 {
2035 }
2036
2037 return construction_kit;
2038 }
2039
2041 {
2044 {
2046 }
2047 }
2048
2050 {
2052 }
2053
2055 {
2056 return "";
2057 }
2058
2060 {
2063 }
2064
2065
2067 {
2070 }
2071
2072
2074 {
2075 super.OnStoreSave( ctx );
2076
2077
2081
2083 }
2084
2086 {
2087 if ( !super.OnStoreLoad( ctx, version ) )
2088 return false;
2089
2090
2091
2093 {
2095 return false;
2096 }
2098 {
2100 return false;
2101 }
2103 {
2105 return false;
2106 }
2107
2108
2110 {
2112 return false;
2113 }
2114
2115
2116 return true;
2117 }
2118
2120 {
2121 super.AfterStoreLoad();
2122
2124 {
2126 }
2127 }
2128
2130 {
2131
2133
2134
2137
2138
2140 }
2141
2143 {
2144 super.OnCreatePhysics();
2147 }
2148
2150 {
2152 return;
2153
2154 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2155
2157 return;
2158
2160 string part_name = zone;
2162
2164 {
2165 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2166
2167 if ( construction_part && construction.IsPartConstructed( part_name ) )
2168 {
2170 construction.DestroyConnectedParts(part_name);
2171 }
2172
2173
2174 if ( part_name.
Contains(
"barbed") )
2175 {
2176 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2177 if (barbed_wire)
2178 barbed_wire.SetMountedState( false );
2179 }
2180 }
2181 }
2182
2184 {
2186 {
2188 }
2189
2190 super.EEOnAfterLoad();
2191 }
2192
2194 {
2195 super.EEInit();
2196
2197
2199
2200
2201 #ifdef DEVELOPER
2203 #endif
2204 }
2205
2207 {
2208 super.EEItemAttached( item, slot_name );
2209
2213 }
2214
2216 {
2217 super.EEItemDetached( item, slot_name );
2218
2221 }
2222
2223 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2224 {
2227
2230 }
2231
2232
2234 {
2235 return true;
2236 }
2237
2238
2239
2241 {
2243
2244
2245 if (construtionPart.
IsBase())
2246 {
2248
2249
2251 }
2252
2253
2255
2256
2258
2259
2261
2263
2265
2266
2268
2269
2271 }
2272
2274 {
2275
2277 }
2278
2279
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
2322
2323 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2324 {
2327
2328
2330
2331
2333
2334
2336
2337
2339
2341
2342
2344
2345
2347
2348
2349 if (construtionPart.
IsBase())
2350 {
2351
2353 }
2354
2357 }
2358
2360 {
2361
2363 }
2364
2366 {
2367 bool process = false;
2368
2369
2373
2374 if (process)
2375 {
2376 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2377 {
2379 return;
2380 }
2381
2383 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2384 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2385
2386
2388 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2389 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2390 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2391 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2392 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2393 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2394 mins = minTmp;
2395 maxs = maxTmp;
2396
2397 maxs[1] = maxs[1] + 0.35;
2398
2400 }
2401 }
2402
2404 {
2407
2408
2410 foreach (
EntityAI entity : foundEntities)
2411 {
2414 }
2415 }
2416
2417
2419 {
2421
2425 }
2426
2428 {
2430
2432 {
2434 }
2435 else
2436 {
2438 }
2439
2441 }
2442
2444 {
2446
2448 foreach (
string slotName : attachmentSlots)
2449 {
2451 }
2452
2453
2456 else
2458
2460 }
2461
2463 {
2464 string slotNameMounted = slot_name + "_Mounted";
2465 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2466
2467 if (attachment)
2468 {
2469 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2470 if (barbedWire && barbedWire.IsMounted())
2472 else
2474
2475 if (is_locked)
2476 {
2477 SetAnimationPhase(slotNameMounted, 0);
2478 SetAnimationPhase(slot_name, 1);
2479 }
2480 else
2481 {
2482 SetAnimationPhase(slotNameMounted, 1);
2483 SetAnimationPhase(slot_name, 0);
2484 }
2485 }
2486 else
2487 {
2488 SetAnimationPhase(slotNameMounted, 1);
2489 SetAnimationPhase(slot_name, 1);
2490
2492 }
2493 }
2494
2495
2497 {
2500
2503
2506
2507 foreach (
string slotName : attachmentSlots)
2508 {
2510 }
2511
2512
2514 {
2517
2519 }
2520 else
2521 {
2524
2526 }
2527
2530 }
2531
2533 {
2534
2536 return;
2537
2538 string slot_name_mounted = slot_name + "_Mounted";
2539 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2540
2541
2543 RemoveProxyPhysics( slot_name_mounted );
2544 RemoveProxyPhysics( slot_name );
2545
2546 if ( attachment )
2547 {
2549 if ( is_locked )
2550 {
2552 AddProxyPhysics( slot_name_mounted );
2553 }
2554 else
2555 {
2557 AddProxyPhysics( slot_name );
2558 }
2559 }
2560 }
2561
2563 {
2564 SetAffectPathgraph( true, false );
2566 }
2567
2569 {
2570 return true;
2571 }
2572
2574 {
2575 return true;
2576 }
2577
2579 {
2580 if ( attachment )
2581 {
2583 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2584
2585 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2586 }
2587
2588 return false;
2589 }
2590
2592 {
2594 }
2595
2596
2598 {
2599 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2600 if (
GetGame().ConfigIsExisting( config_path ) )
2601 {
2603 }
2604 }
2605
2607 {
2608 return true;
2609 }
2610
2612 {
2613 return true;
2614 }
2615
2617 {
2618 return true;
2619 }
2620
2621
2623 {
2625 {
2627 }
2628
2630 }
2631
2633 {
2635 }
2636
2637
2638
2640 {
2641 return super.CanReceiveAttachment(attachment, slotId);
2642 }
2643
2645 {
2646 int attachment_count = GetInventory().AttachmentCount();
2647 if ( attachment_count > 0 )
2648 {
2649 if (
HasBase() && attachment_count == 1 )
2650 {
2651 return false;
2652 }
2653
2654 return true;
2655 }
2656
2657 return false;
2658 }
2659
2661 {
2662 return true;
2663 }
2664
2666 {
2667 return false;
2668 }
2669
2670
2672 {
2673 return false;
2674 }
2675
2677 {
2678 return false;
2679 }
2680
2681
2683 {
2684 return false;
2685 }
2686
2687
2688
2690 {
2691 return true;
2692 }
2693
2695 {
2696 return true;
2697 }
2698
2701 {
2702 return false;
2703 }
2704
2705
2707 {
2708 return true;
2709 }
2710
2711
2713 {
2714 return false;
2715 }
2716
2717
2719 {
2720 return true;
2721 }
2722
2723
2725 {
2726 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2727 {
2728 return false;
2729 }
2730
2731 return true;
2732 }
2733
2735 {
2738
2739 return item;
2740 }
2741
2742
2744 {
2746 {
2747
2749
2750
2753
2755 if ( MemoryPointExists( slot_name + "_min" ) )
2756 {
2757 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2758 }
2759 if ( MemoryPointExists( slot_name + "_max" ) )
2760 {
2761 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2762 }
2763
2764
2767
2768
2771 center = ModelToWorld( center );
2772
2773
2776
2777 areaDamage.SetExtents( extents[0], extents[1] );
2778 areaDamage.SetAreaPosition( center );
2779 areaDamage.SetAreaOrientation( orientation );
2782 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2783 areaDamage.SetAmmoName( "BarbedWireHit" );
2784 areaDamage.Spawn();
2785
2787 }
2788 }
2789
2791 {
2792 if ( angle_deg != 0 )
2793 {
2794
2795 orientation[0] = orientation[0] - angle_deg;
2796
2797
2799 if ( MemoryPointExists( "rotate_axis" ) )
2800 {
2801 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2802 }
2803 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];
2804 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];
2805 center[0] = r_center_x;
2806 center[2] = r_center_z;
2807 }
2808 }
2809
2811 {
2813 {
2816 {
2817 if (areaDamage)
2818 {
2819 areaDamage.Destroy();
2820 }
2821
2823 }
2824 }
2825 }
2826
2828 {
2829 return true;
2830 }
2831
2832
2833
2834
2836 {
2838 }
2839
2841 {
2843 }
2844
2846 {
2848 }
2849
2851 {
2853
2854 switch ( material_type )
2855 {
2861 }
2862
2863 return "";
2864 }
2865
2867 {
2869
2870 switch ( material_type )
2871 {
2877 }
2878
2879 return "";
2880 }
2881
2882
2884 {
2886 {
2887
2889 {
2890 SetHealth(slot_name,"Health",item.GetHealth());
2891 }
2892 }
2893 }
2894
2896 {
2897 return 111;
2898 }
2899
2901 {
2902 super.SetActions();
2903
2907 }
2908
2909
2910
2911
2913 {
2914 }
2915
2918 {
2919 return null;
2920 }
2921
2923 {
2925 }
2926
2928 {
2931
2932 Man p;
2933
2934 #ifdef SERVER
2937 if (players.Count())
2938 p = players[0];
2939 #else
2941 #endif
2942
2944 {
2945 bool excluded = false;
2947 if (excludes)
2948 {
2949 foreach (string exclude : excludes)
2950 {
2952 {
2953 excluded = true;
2954 break;
2955 }
2956 }
2957 }
2958
2959 if (!excluded)
2960 {
2962 }
2963 }
2964
2966 }
2967}
2968
2970{
2971#ifdef BSB_DEBUG
2973#else
2974
2975#endif
2976}
2978{
2979#ifdef BSB_DEBUG_SPAM
2981#else
2982
2983#endif
2984}
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.