1687{
1689
1691
1693
1695
1701
1702
1703
1709
1715
1717
1721
1722
1724 {
1726
1727
1728 RegisterNetSyncVariableInt( "m_SyncParts01" );
1729 RegisterNetSyncVariableInt( "m_SyncParts02" );
1730 RegisterNetSyncVariableInt( "m_SyncParts03" );
1731 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1732 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1733 RegisterNetSyncVariableBool( "m_HasBase" );
1734
1735
1737
1738 if (ConfigIsExisting("hybridAttachments"))
1739 {
1742 }
1743 if (ConfigIsExisting("mountables"))
1744 {
1747 }
1748
1750 }
1751
1753 {
1754 super.EEDelete(parent);
1755
1757 {
1758 areaDamage.Destroy();
1759 }
1760
1761 }
1762
1764 {
1765 return "disableBaseDamage";
1766 }
1767
1769 {
1770 return true;
1771 }
1772
1774 {
1775 return EInventoryIconVisibility.HIDE_VICINITY;
1776 }
1777
1778
1780 {
1782 {
1783 SetSynchDirty();
1784 }
1785 }
1786
1788 {
1790 super.OnVariablesSynchronized();
1791
1793 }
1794
1796 {
1797
1799
1800
1802
1803
1805 }
1806
1807
1809 {
1810
1811 int offset;
1812 int mask;
1813
1814 if ( part_id >= 1 && part_id <= 31 )
1815 {
1816 offset = part_id - 1;
1817 mask = 1 << offset;
1818
1820 }
1821 else if ( part_id >= 32 && part_id <= 62 )
1822 {
1823 offset = ( part_id % 32 );
1824 mask = 1 << offset;
1825
1827 }
1828 else if ( part_id >= 63 && part_id <= 93 )
1829 {
1830 offset = ( part_id % 63 );
1831 mask = 1 << offset;
1832
1834 }
1835 }
1836
1838 {
1839
1840 int offset;
1841 int mask;
1842
1843 if ( part_id >= 1 && part_id <= 31 )
1844 {
1845 offset = part_id - 1;
1846 mask = 1 << offset;
1847
1849 }
1850 else if ( part_id >= 32 && part_id <= 62 )
1851 {
1852 offset = ( part_id % 32 );
1853 mask = 1 << offset;
1854
1856 }
1857 else if ( part_id >= 63 && part_id <= 93 )
1858 {
1859 offset = ( part_id % 63 );
1860 mask = 1 << offset;
1861
1863 }
1864 }
1865
1867 {
1868
1869 int offset;
1870 int mask;
1871
1872 if ( part_id >= 1 && part_id <= 31 )
1873 {
1874 offset = part_id - 1;
1875 mask = 1 << offset;
1876
1878 {
1879 return true;
1880 }
1881 }
1882 else if ( part_id >= 32 && part_id <= 62 )
1883 {
1884 offset = ( part_id % 32 );
1885 mask = 1 << offset;
1886
1888 {
1889 return true;
1890 }
1891 }
1892 else if ( part_id >= 63 && part_id <= 93 )
1893 {
1894 offset = ( part_id % 63 );
1895 mask = 1 << offset;
1896
1898 {
1899 return true;
1900 }
1901 }
1902
1903 return false;
1904 }
1905
1907 {
1910 }
1911
1913 {
1914
1917 }
1918
1920 {
1922 {
1925
1926 switch( build_action_id )
1927 {
1931 }
1932 }
1933 }
1934
1935
1937 {
1939 bool is_base = part.
IsBase();
1942 if ( is_part_built_sync )
1943 {
1945 {
1949
1950 if (is_base)
1951 {
1954 }
1955 }
1956 }
1957 else
1958 {
1960 {
1964
1965 if (is_base)
1966 {
1969 }
1970 }
1971 }
1972
1973
1975 }
1976
1977
1979 {
1982
1983 for ( int i = 0; i < construction_parts.Count(); ++i )
1984 {
1985 string key = construction_parts.GetKey( i );
1988 }
1989
1990
1992 }
1993
1995 {
1998
1999 for ( int i = 0; i < construction_parts.Count(); ++i )
2000 {
2001 string key = construction_parts.GetKey( i );
2003
2004 if ( value.
GetId() ==
id )
2005 {
2006 return value;
2007 }
2008 }
2009
2010 return NULL;
2011 }
2012
2013
2014
2016 {
2018 }
2019
2021 {
2023 }
2024
2026 {
2027 return true;
2028 }
2029
2031 {
2032 return false;
2033 }
2034
2035
2037 {
2040 {
2042 }
2043
2044 return construction_kit;
2045 }
2046
2048 {
2051 {
2053 }
2054 }
2055
2057 {
2059 }
2060
2062 {
2063 return "";
2064 }
2065
2067 {
2070 }
2071
2072
2074 {
2077 }
2078
2079
2081 {
2082 super.OnStoreSave( ctx );
2083
2084
2088
2090 }
2091
2093 {
2094 if ( !super.OnStoreLoad( ctx, version ) )
2095 return false;
2096
2097
2098
2100 {
2102 return false;
2103 }
2105 {
2107 return false;
2108 }
2110 {
2112 return false;
2113 }
2114
2115
2117 {
2119 return false;
2120 }
2121
2122
2123 return true;
2124 }
2125
2127 {
2128 super.AfterStoreLoad();
2129
2131 {
2133 }
2134 }
2135
2137 {
2138
2140
2141
2144
2145
2147 }
2148
2150 {
2151 super.OnCreatePhysics();
2154 }
2155
2157 {
2159 return;
2160
2161 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2162
2164 return;
2165
2167 string part_name = zone;
2169
2171 {
2172 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2173
2174 if ( construction_part && construction.IsPartConstructed( part_name ) )
2175 {
2177 construction.DestroyConnectedParts(part_name);
2178 }
2179
2180
2181 if ( part_name.
Contains(
"barbed") )
2182 {
2183 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2184 if (barbed_wire)
2185 barbed_wire.SetMountedState( false );
2186 }
2187 }
2188 }
2189
2191 {
2193 {
2195 }
2196
2197 super.EEOnAfterLoad();
2198 }
2199
2201 {
2202 super.EEInit();
2203
2204
2206
2207
2208 #ifdef DEVELOPER
2210 #endif
2211 }
2212
2214 {
2215 super.EEItemAttached( item, slot_name );
2216
2220 }
2221
2223 {
2224 super.EEItemDetached( item, slot_name );
2225
2228 }
2229
2230 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2231 {
2234
2237 }
2238
2239
2241 {
2242 return true;
2243 }
2244
2245
2246
2248 {
2250
2251
2252 if (construtionPart.
IsBase())
2253 {
2255
2256
2258 }
2259
2260
2262
2263
2265
2266
2268
2270
2272
2273
2275
2276
2278 }
2279
2281 {
2282
2284 }
2285
2286
2288 {
2291
2292
2294
2295
2297
2298
2300
2301
2303
2305
2306
2308
2309
2311
2312
2313 if (construtionPart.
IsBase())
2314 {
2315
2317 }
2318
2321 }
2322
2324 {
2325
2327 }
2328
2329
2330 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2331 {
2334
2335
2337
2338
2340
2341
2343
2344
2346
2348
2349
2351
2352
2354
2355
2356 if (construtionPart.
IsBase())
2357 {
2358
2360 }
2361
2364 }
2365
2367 {
2368
2370 }
2371
2373 {
2374 bool process = false;
2375
2376
2380
2381 if (process)
2382 {
2383 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2384 {
2386 return;
2387 }
2388
2390 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2391 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2392
2393
2395 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2396 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2397 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2398 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2399 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2400 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2401 mins = minTmp;
2402 maxs = maxTmp;
2403
2404 maxs[1] = maxs[1] + 0.35;
2405
2407 }
2408 }
2409
2411 {
2414
2415
2417 foreach (
EntityAI entity : foundEntities)
2418 {
2421 }
2422 }
2423
2424
2426 {
2428
2432 }
2433
2435 {
2437
2439 {
2441 }
2442 else
2443 {
2445 }
2446
2448 }
2449
2451 {
2453
2455 foreach (
string slotName : attachmentSlots)
2456 {
2458 }
2459
2460
2463 else
2465
2467 }
2468
2470 {
2471 string slotNameMounted = slot_name + "_Mounted";
2472 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2473
2474 if (attachment)
2475 {
2476 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2477 if (barbedWire && barbedWire.IsMounted())
2479 else
2481
2482 if (is_locked)
2483 {
2484 SetAnimationPhase(slotNameMounted, 0);
2485 SetAnimationPhase(slot_name, 1);
2486 }
2487 else
2488 {
2489 SetAnimationPhase(slotNameMounted, 1);
2490 SetAnimationPhase(slot_name, 0);
2491 }
2492 }
2493 else
2494 {
2495 SetAnimationPhase(slotNameMounted, 1);
2496 SetAnimationPhase(slot_name, 1);
2497
2499 }
2500 }
2501
2502
2504 {
2507
2510
2513
2514 foreach (
string slotName : attachmentSlots)
2515 {
2517 }
2518
2519
2521 {
2524
2526 }
2527 else
2528 {
2531
2533 }
2534
2537 }
2538
2540 {
2541
2543 return;
2544
2545 string slot_name_mounted = slot_name + "_Mounted";
2546 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2547
2548
2550 RemoveProxyPhysics( slot_name_mounted );
2551 RemoveProxyPhysics( slot_name );
2552
2553 if ( attachment )
2554 {
2556 if ( is_locked )
2557 {
2559 AddProxyPhysics( slot_name_mounted );
2560 }
2561 else
2562 {
2564 AddProxyPhysics( slot_name );
2565 }
2566 }
2567 }
2568
2570 {
2571 SetAffectPathgraph( true, false );
2573 }
2574
2576 {
2577 return true;
2578 }
2579
2581 {
2582 return true;
2583 }
2584
2586 {
2587 if ( attachment )
2588 {
2590 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2591
2592 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2593 }
2594
2595 return false;
2596 }
2597
2599 {
2601 }
2602
2603
2605 {
2606 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2607 if (
GetGame().ConfigIsExisting( config_path ) )
2608 {
2610 }
2611 }
2612
2614 {
2615 return true;
2616 }
2617
2619 {
2620 return true;
2621 }
2622
2624 {
2625 return true;
2626 }
2627
2628
2630 {
2632 {
2634 }
2635
2637 }
2638
2640 {
2642 }
2643
2644
2645
2647 {
2648 return super.CanReceiveAttachment(attachment, slotId);
2649 }
2650
2652 {
2653 int attachment_count = GetInventory().AttachmentCount();
2654 if ( attachment_count > 0 )
2655 {
2656 if (
HasBase() && attachment_count == 1 )
2657 {
2658 return false;
2659 }
2660
2661 return true;
2662 }
2663
2664 return false;
2665 }
2666
2668 {
2669 return true;
2670 }
2671
2673 {
2674 return false;
2675 }
2676
2677
2679 {
2680 return false;
2681 }
2682
2684 {
2685 return false;
2686 }
2687
2688
2690 {
2691 return false;
2692 }
2693
2694
2695
2697 {
2698 return true;
2699 }
2700
2702 {
2703 return true;
2704 }
2705
2708 {
2709 return false;
2710 }
2711
2712
2714 {
2715 return true;
2716 }
2717
2718
2720 {
2721 return false;
2722 }
2723
2724
2726 {
2727 return true;
2728 }
2729
2730
2732 {
2733 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2734 {
2735 return false;
2736 }
2737
2738 return true;
2739 }
2740
2742 {
2745
2746 return item;
2747 }
2748
2749
2751 {
2753 {
2754
2756
2757
2760
2762 if ( MemoryPointExists( slot_name + "_min" ) )
2763 {
2764 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2765 }
2766 if ( MemoryPointExists( slot_name + "_max" ) )
2767 {
2768 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2769 }
2770
2771
2774
2775
2778 center = ModelToWorld( center );
2779
2780
2783
2784 areaDamage.SetExtents( extents[0], extents[1] );
2785 areaDamage.SetAreaPosition( center );
2786 areaDamage.SetAreaOrientation( orientation );
2789 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2790 areaDamage.SetAmmoName( "BarbedWireHit" );
2791 areaDamage.Spawn();
2792
2794 }
2795 }
2796
2798 {
2799 if ( angle_deg != 0 )
2800 {
2801
2802 orientation[0] = orientation[0] - angle_deg;
2803
2804
2806 if ( MemoryPointExists( "rotate_axis" ) )
2807 {
2808 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2809 }
2810 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];
2811 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];
2812 center[0] = r_center_x;
2813 center[2] = r_center_z;
2814 }
2815 }
2816
2818 {
2820 {
2823 {
2824 if (areaDamage)
2825 {
2826 areaDamage.Destroy();
2827 }
2828
2830 }
2831 }
2832 }
2833
2835 {
2836 return true;
2837 }
2838
2839
2840
2841
2843 {
2845 }
2846
2848 {
2850 }
2851
2853 {
2855 }
2856
2858 {
2860
2861 switch ( material_type )
2862 {
2868 }
2869
2870 return "";
2871 }
2872
2874 {
2876
2877 switch ( material_type )
2878 {
2884 }
2885
2886 return "";
2887 }
2888
2889
2891 {
2893 {
2894
2896 {
2897 SetHealth(slot_name,"Health",item.GetHealth());
2898 }
2899 }
2900 }
2901
2903 {
2904 return 111;
2905 }
2906
2908 {
2909 super.SetActions();
2910
2914 }
2915
2916
2917
2918
2920 {
2921 }
2922
2925 {
2926 return null;
2927 }
2928
2930 {
2932 }
2933
2935 {
2938
2939 Man p;
2940
2941 #ifdef SERVER
2944 if (players.Count())
2945 p = players[0];
2946 #else
2948 #endif
2949
2951 {
2952 bool excluded = false;
2954 if (excludes)
2955 {
2956 foreach (string exclude : excludes)
2957 {
2959 {
2960 excluded = true;
2961 break;
2962 }
2963 }
2964 }
2965
2966 if (!excluded)
2967 {
2969 }
2970 }
2971
2973 }
2974}
2975
2977{
2978#ifdef BSB_DEBUG
2980#else
2981
2982#endif
2983}
2985{
2986#ifdef BSB_DEBUG_SPAM
2988#else
2989
2990#endif
2991}
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.