1743{
1745
1747
1749
1751
1757
1758
1759
1765
1771
1773
1777
1778
1780 {
1782
1783
1784 RegisterNetSyncVariableInt( "m_SyncParts01" );
1785 RegisterNetSyncVariableInt( "m_SyncParts02" );
1786 RegisterNetSyncVariableInt( "m_SyncParts03" );
1787 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1788 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1789 RegisterNetSyncVariableBool( "m_HasBase" );
1790
1791
1793
1794 if (ConfigIsExisting("hybridAttachments"))
1795 {
1798 }
1799 if (ConfigIsExisting("mountables"))
1800 {
1803 }
1804
1806 }
1807
1809 {
1810 super.EEDelete(parent);
1811
1813 {
1814 areaDamage.Destroy();
1815 }
1816
1817 }
1818
1820 {
1821 return "disableBaseDamage";
1822 }
1823
1825 {
1826 return true;
1827 }
1828
1830 {
1831 return EInventoryIconVisibility.HIDE_VICINITY;
1832 }
1833
1834
1836 {
1838 {
1839 SetSynchDirty();
1840 }
1841 }
1842
1844 {
1846 super.OnVariablesSynchronized();
1847
1849 }
1850
1852 {
1853
1855
1856
1858
1859
1861 }
1862
1863
1865 {
1866
1867 int offset;
1868 int mask;
1869
1870 if ( part_id >= 1 && part_id <= 31 )
1871 {
1872 offset = part_id - 1;
1873 mask = 1 << offset;
1874
1876 }
1877 else if ( part_id >= 32 && part_id <= 62 )
1878 {
1879 offset = ( part_id % 32 );
1880 mask = 1 << offset;
1881
1883 }
1884 else if ( part_id >= 63 && part_id <= 93 )
1885 {
1886 offset = ( part_id % 63 );
1887 mask = 1 << offset;
1888
1890 }
1891 }
1892
1894 {
1895
1896 int offset;
1897 int mask;
1898
1899 if ( part_id >= 1 && part_id <= 31 )
1900 {
1901 offset = part_id - 1;
1902 mask = 1 << offset;
1903
1905 }
1906 else if ( part_id >= 32 && part_id <= 62 )
1907 {
1908 offset = ( part_id % 32 );
1909 mask = 1 << offset;
1910
1912 }
1913 else if ( part_id >= 63 && part_id <= 93 )
1914 {
1915 offset = ( part_id % 63 );
1916 mask = 1 << offset;
1917
1919 }
1920 }
1921
1923 {
1924
1925 int offset;
1926 int mask;
1927
1928 if ( part_id >= 1 && part_id <= 31 )
1929 {
1930 offset = part_id - 1;
1931 mask = 1 << offset;
1932
1934 {
1935 return true;
1936 }
1937 }
1938 else if ( part_id >= 32 && part_id <= 62 )
1939 {
1940 offset = ( part_id % 32 );
1941 mask = 1 << offset;
1942
1944 {
1945 return true;
1946 }
1947 }
1948 else if ( part_id >= 63 && part_id <= 93 )
1949 {
1950 offset = ( part_id % 63 );
1951 mask = 1 << offset;
1952
1954 {
1955 return true;
1956 }
1957 }
1958
1959 return false;
1960 }
1961
1963 {
1966 }
1967
1969 {
1970
1973 }
1974
1976 {
1978 {
1981
1982 switch( build_action_id )
1983 {
1987 }
1988 }
1989 }
1990
1991
1993 {
1995 bool is_base = part.
IsBase();
1998 if ( is_part_built_sync )
1999 {
2001 {
2005
2006 if (is_base)
2007 {
2010 }
2011 }
2012 }
2013 else
2014 {
2016 {
2020
2021 if (is_base)
2022 {
2025 }
2026 }
2027 }
2028
2029
2031 }
2032
2033
2035 {
2038
2039 for ( int i = 0; i < construction_parts.Count(); ++i )
2040 {
2041 string key = construction_parts.GetKey( i );
2044 }
2045
2046
2048 }
2049
2051 {
2054
2055 for ( int i = 0; i < construction_parts.Count(); ++i )
2056 {
2057 string key = construction_parts.GetKey( i );
2059
2060 if ( value.
GetId() ==
id )
2061 {
2062 return value;
2063 }
2064 }
2065
2066 return NULL;
2067 }
2068
2069
2070
2072 {
2074 }
2075
2077 {
2079 }
2080
2082 {
2083 return true;
2084 }
2085
2087 {
2088 return false;
2089 }
2090
2091
2093 {
2096 {
2098 }
2099
2100 return construction_kit;
2101 }
2102
2104 {
2107 {
2109 }
2110 }
2111
2113 {
2115 }
2116
2118 {
2119 return "";
2120 }
2121
2123 {
2126 }
2127
2128
2130 {
2133 }
2134
2135
2137 {
2138 super.OnStoreSave( ctx );
2139
2140
2144
2146 }
2147
2149 {
2150 if ( !super.OnStoreLoad( ctx, version ) )
2151 return false;
2152
2153
2154
2156 {
2158 return false;
2159 }
2161 {
2163 return false;
2164 }
2166 {
2168 return false;
2169 }
2170
2171
2173 {
2175 return false;
2176 }
2177
2178
2179 return true;
2180 }
2181
2183 {
2184 super.AfterStoreLoad();
2185
2187 {
2189 }
2190 }
2191
2193 {
2194
2196
2197
2200
2201
2203 }
2204
2206 {
2207 super.OnCreatePhysics();
2210 }
2211
2213 {
2215 return;
2216
2217 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2218
2220 return;
2221
2223 string part_name = zone;
2225
2227 {
2228 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2229
2230 if ( construction_part && construction.IsPartConstructed( part_name ) )
2231 {
2233 construction.DestroyConnectedParts(part_name);
2234 }
2235
2236
2237 if ( part_name.
Contains(
"barbed") )
2238 {
2239 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2240 if (barbed_wire)
2241 barbed_wire.SetMountedState( false );
2242 }
2243 }
2244 }
2245
2247 {
2249 {
2251 }
2252
2253 super.EEOnAfterLoad();
2254 }
2255
2257 {
2258 super.EEInit();
2259
2260
2262
2263
2264 #ifdef DEVELOPER
2266 #endif
2267 }
2268
2270 {
2271 super.EEItemAttached( item, slot_name );
2272
2276 }
2277
2279 {
2280 super.EEItemDetached( item, slot_name );
2281
2284 }
2285
2286 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2287 {
2290
2293 }
2294
2295
2297 {
2298 return true;
2299 }
2300
2301
2302
2304 {
2306
2307
2308 if (construtionPart.
IsBase())
2309 {
2311
2312
2314 }
2315
2316
2318
2319
2321
2322
2324
2326
2328
2329
2331
2332
2334 }
2335
2337 {
2338
2340 }
2341
2342
2344 {
2347
2348
2350
2351
2353
2354
2356
2357
2359
2361
2362
2364
2365
2367
2368
2369 if (construtionPart.
IsBase())
2370 {
2371
2373 }
2374
2377 }
2378
2380 {
2381
2383 }
2384
2385
2386 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2387 {
2390
2391
2393
2394
2396
2397
2399
2400
2402
2404
2405
2407
2408
2410
2411
2412 if (construtionPart.
IsBase())
2413 {
2414
2416 }
2417
2420 }
2421
2423 {
2424
2426 }
2427
2429 {
2430 bool process = false;
2431
2432
2436
2437 if (process)
2438 {
2439 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2440 {
2442 return;
2443 }
2444
2446 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2447 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2448
2449
2451 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2452 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2453 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2454 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2455 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2456 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2457 mins = minTmp;
2458 maxs = maxTmp;
2459
2460 maxs[1] = maxs[1] + 0.35;
2461
2463 }
2464 }
2465
2467 {
2470
2471
2473 foreach (
EntityAI entity : foundEntities)
2474 {
2477 }
2478 }
2479
2480
2482 {
2484
2488 }
2489
2491 {
2493
2495 {
2497 }
2498 else
2499 {
2501 }
2502
2504 }
2505
2507 {
2509
2511 foreach (
string slotName : attachmentSlots)
2512 {
2514 }
2515
2516
2519 else
2521
2523 }
2524
2526 {
2527 string slotNameMounted = slot_name + "_Mounted";
2528 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2529
2530 if (attachment)
2531 {
2532 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2533 if (barbedWire && barbedWire.IsMounted())
2535 else
2537
2538 if (is_locked)
2539 {
2540 SetAnimationPhase(slotNameMounted, 0);
2541 SetAnimationPhase(slot_name, 1);
2542 }
2543 else
2544 {
2545 SetAnimationPhase(slotNameMounted, 1);
2546 SetAnimationPhase(slot_name, 0);
2547 }
2548 }
2549 else
2550 {
2551 SetAnimationPhase(slotNameMounted, 1);
2552 SetAnimationPhase(slot_name, 1);
2553
2555 }
2556 }
2557
2558
2560 {
2563
2566
2569
2570 foreach (
string slotName : attachmentSlots)
2571 {
2573 }
2574
2575
2577 {
2580
2582 }
2583 else
2584 {
2587
2589 }
2590
2593 }
2594
2596 {
2597
2599 return;
2600
2601 string slot_name_mounted = slot_name + "_Mounted";
2602 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2603
2604
2606 RemoveProxyPhysics( slot_name_mounted );
2607 RemoveProxyPhysics( slot_name );
2608
2609 if ( attachment )
2610 {
2612 if ( is_locked )
2613 {
2615 AddProxyPhysics( slot_name_mounted );
2616 }
2617 else
2618 {
2620 AddProxyPhysics( slot_name );
2621 }
2622 }
2623 }
2624
2626 {
2627 SetAffectPathgraph( true, false );
2629 }
2630
2632 {
2633 return true;
2634 }
2635
2637 {
2638 return true;
2639 }
2640
2642 {
2643 if ( attachment )
2644 {
2646 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2647
2648 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2649 }
2650
2651 return false;
2652 }
2653
2655 {
2657 }
2658
2659
2661 {
2662 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2663 if (
GetGame().ConfigIsExisting( config_path ) )
2664 {
2666 }
2667 }
2668
2670 {
2671 return true;
2672 }
2673
2675 {
2676 return true;
2677 }
2678
2680 {
2681 return true;
2682 }
2683
2684
2686 {
2688 {
2690 }
2691
2693 }
2694
2696 {
2698 }
2699
2700
2701
2703 {
2704 return super.CanReceiveAttachment(attachment, slotId);
2705 }
2706
2708 {
2709 int attachment_count = GetInventory().AttachmentCount();
2710 if ( attachment_count > 0 )
2711 {
2712 if (
HasBase() && attachment_count == 1 )
2713 {
2714 return false;
2715 }
2716
2717 return true;
2718 }
2719
2720 return false;
2721 }
2722
2724 {
2725 return true;
2726 }
2727
2729 {
2730 return false;
2731 }
2732
2733
2735 {
2736 return false;
2737 }
2738
2740 {
2741 return false;
2742 }
2743
2744
2746 {
2747 return false;
2748 }
2749
2750
2751
2753 {
2754 return true;
2755 }
2756
2758 {
2759 return true;
2760 }
2761
2764 {
2765 return false;
2766 }
2767
2768
2770 {
2771 return true;
2772 }
2773
2774
2776 {
2777 return false;
2778 }
2779
2780
2782 {
2783 return true;
2784 }
2785
2786
2788 {
2789 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2790 {
2791 return false;
2792 }
2793
2794 return true;
2795 }
2796
2798 {
2801
2802 return item;
2803 }
2804
2805
2807 {
2809 {
2810
2812
2813
2816
2818 if ( MemoryPointExists( slot_name + "_min" ) )
2819 {
2820 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2821 }
2822 if ( MemoryPointExists( slot_name + "_max" ) )
2823 {
2824 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2825 }
2826
2827
2830
2831
2834 center = ModelToWorld( center );
2835
2836
2839
2840 areaDamage.SetExtents( extents[0], extents[1] );
2841 areaDamage.SetAreaPosition( center );
2842 areaDamage.SetAreaOrientation( orientation );
2845 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2846 areaDamage.SetAmmoName( "BarbedWireHit" );
2847 areaDamage.Spawn();
2848
2850 }
2851 }
2852
2854 {
2855 if ( angle_deg != 0 )
2856 {
2857
2858 orientation[0] = orientation[0] - angle_deg;
2859
2860
2862 if ( MemoryPointExists( "rotate_axis" ) )
2863 {
2864 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2865 }
2866 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];
2867 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];
2868 center[0] = r_center_x;
2869 center[2] = r_center_z;
2870 }
2871 }
2872
2874 {
2876 {
2879 {
2880 if (areaDamage)
2881 {
2882 areaDamage.Destroy();
2883 }
2884
2886 }
2887 }
2888 }
2889
2891 {
2892 return true;
2893 }
2894
2895
2896
2897
2899 {
2901 }
2902
2904 {
2906 }
2907
2909 {
2911 }
2912
2914 {
2916
2917 switch ( material_type )
2918 {
2924 }
2925
2926 return "";
2927 }
2928
2930 {
2932
2933 switch ( material_type )
2934 {
2940 }
2941
2942 return "";
2943 }
2944
2945
2947 {
2949 {
2950
2952 {
2953 SetHealth(slot_name,"Health",item.GetHealth());
2954 }
2955 }
2956 }
2957
2959 {
2960 return 111;
2961 }
2962
2964 {
2965 super.SetActions();
2966
2970 }
2971
2972
2973
2974
2976 {
2977 }
2978
2981 {
2982 return null;
2983 }
2984
2986 {
2988 }
2989
2991 {
2994
2995 Man p;
2996
2997 #ifdef SERVER
3000 if (players.Count())
3001 p = players[0];
3002 #else
3004 #endif
3005
3007 {
3008 bool excluded = false;
3010 if (excludes)
3011 {
3012 foreach (string exclude : excludes)
3013 {
3015 {
3016 excluded = true;
3017 break;
3018 }
3019 }
3020 }
3021
3022 if (!excluded)
3023 {
3025 }
3026 }
3027
3029 }
3030}
3031
3033{
3034#ifdef BSB_DEBUG
3036#else
3037
3038#endif
3039}
3041{
3042#ifdef BSB_DEBUG_SPAM
3044#else
3045
3046#endif
3047}
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.