1673{
1675
1677
1679
1681
1687
1688
1689
1695
1701
1703
1707
1708
1710 {
1712
1713
1714 RegisterNetSyncVariableInt( "m_SyncParts01" );
1715 RegisterNetSyncVariableInt( "m_SyncParts02" );
1716 RegisterNetSyncVariableInt( "m_SyncParts03" );
1717 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1718 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1719 RegisterNetSyncVariableBool( "m_HasBase" );
1720
1721
1723
1724 if (ConfigIsExisting("hybridAttachments"))
1725 {
1728 }
1729 if (ConfigIsExisting("mountables"))
1730 {
1733 }
1734
1736 }
1737
1739 {
1740 super.EEDelete(parent);
1741
1743 {
1744 areaDamage.Destroy();
1745 }
1746
1747 }
1748
1750 {
1751 return "disableBaseDamage";
1752 }
1753
1755 {
1756 return true;
1757 }
1758
1760 {
1761 return EInventoryIconVisibility.HIDE_VICINITY;
1762 }
1763
1764
1766 {
1768 {
1769 SetSynchDirty();
1770 }
1771 }
1772
1774 {
1776 super.OnVariablesSynchronized();
1777
1779 }
1780
1782 {
1783
1785
1786
1788
1789
1791 }
1792
1793
1795 {
1796
1797 int offset;
1798 int mask;
1799
1800 if ( part_id >= 1 && part_id <= 31 )
1801 {
1802 offset = part_id - 1;
1803 mask = 1 << offset;
1804
1806 }
1807 else if ( part_id >= 32 && part_id <= 62 )
1808 {
1809 offset = ( part_id % 32 );
1810 mask = 1 << offset;
1811
1813 }
1814 else if ( part_id >= 63 && part_id <= 93 )
1815 {
1816 offset = ( part_id % 63 );
1817 mask = 1 << offset;
1818
1820 }
1821 }
1822
1824 {
1825
1826 int offset;
1827 int mask;
1828
1829 if ( part_id >= 1 && part_id <= 31 )
1830 {
1831 offset = part_id - 1;
1832 mask = 1 << offset;
1833
1835 }
1836 else if ( part_id >= 32 && part_id <= 62 )
1837 {
1838 offset = ( part_id % 32 );
1839 mask = 1 << offset;
1840
1842 }
1843 else if ( part_id >= 63 && part_id <= 93 )
1844 {
1845 offset = ( part_id % 63 );
1846 mask = 1 << offset;
1847
1849 }
1850 }
1851
1853 {
1854
1855 int offset;
1856 int mask;
1857
1858 if ( part_id >= 1 && part_id <= 31 )
1859 {
1860 offset = part_id - 1;
1861 mask = 1 << offset;
1862
1864 {
1865 return true;
1866 }
1867 }
1868 else if ( part_id >= 32 && part_id <= 62 )
1869 {
1870 offset = ( part_id % 32 );
1871 mask = 1 << offset;
1872
1874 {
1875 return true;
1876 }
1877 }
1878 else if ( part_id >= 63 && part_id <= 93 )
1879 {
1880 offset = ( part_id % 63 );
1881 mask = 1 << offset;
1882
1884 {
1885 return true;
1886 }
1887 }
1888
1889 return false;
1890 }
1891
1893 {
1896 }
1897
1899 {
1900
1903 }
1904
1906 {
1908 {
1911
1912 switch( build_action_id )
1913 {
1917 }
1918 }
1919 }
1920
1921
1923 {
1925 bool is_base = part.
IsBase();
1928 if ( is_part_built_sync )
1929 {
1931 {
1935
1936 if (is_base)
1937 {
1940 }
1941 }
1942 }
1943 else
1944 {
1946 {
1950
1951 if (is_base)
1952 {
1955 }
1956 }
1957 }
1958
1959
1961 }
1962
1963
1965 {
1968
1969 for ( int i = 0; i < construction_parts.Count(); ++i )
1970 {
1971 string key = construction_parts.GetKey( i );
1974 }
1975
1976
1978 }
1979
1981 {
1984
1985 for ( int i = 0; i < construction_parts.Count(); ++i )
1986 {
1987 string key = construction_parts.GetKey( i );
1989
1990 if ( value.
GetId() ==
id )
1991 {
1992 return value;
1993 }
1994 }
1995
1996 return NULL;
1997 }
1998
1999
2000
2002 {
2004 }
2005
2007 {
2009 }
2010
2012 {
2013 return true;
2014 }
2015
2017 {
2018 return false;
2019 }
2020
2021
2023 {
2026 {
2028 }
2029
2030 return construction_kit;
2031 }
2032
2034 {
2037 {
2039 }
2040 }
2041
2043 {
2045 }
2046
2048 {
2049 return "";
2050 }
2051
2053 {
2056 }
2057
2058
2060 {
2063 }
2064
2065
2067 {
2068 super.OnStoreSave( ctx );
2069
2070
2074
2076 }
2077
2079 {
2080 if ( !super.OnStoreLoad( ctx, version ) )
2081 return false;
2082
2083
2084
2086 {
2088 return false;
2089 }
2091 {
2093 return false;
2094 }
2096 {
2098 return false;
2099 }
2100
2101
2103 {
2105 return false;
2106 }
2107
2108
2109 return true;
2110 }
2111
2113 {
2114 super.AfterStoreLoad();
2115
2117 {
2119 }
2120 }
2121
2123 {
2124
2126
2127
2130
2131
2133 }
2134
2136 {
2137 super.OnCreatePhysics();
2140 }
2141
2143 {
2145 return;
2146
2147 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2148
2150 return;
2151
2153 string part_name = zone;
2155
2157 {
2158 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2159
2160 if ( construction_part && construction.IsPartConstructed( part_name ) )
2161 {
2163 construction.DestroyConnectedParts(part_name);
2164 }
2165
2166
2167 if ( part_name.
Contains(
"barbed") )
2168 {
2169 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2170 if (barbed_wire)
2171 barbed_wire.SetMountedState( false );
2172 }
2173 }
2174 }
2175
2177 {
2179 {
2181 }
2182
2183 super.EEOnAfterLoad();
2184 }
2185
2187 {
2188 super.EEInit();
2189
2190
2192
2193
2194 #ifdef DEVELOPER
2196 #endif
2197 }
2198
2200 {
2201 super.EEItemAttached( item, slot_name );
2202
2206 }
2207
2209 {
2210 super.EEItemDetached( item, slot_name );
2211
2214 }
2215
2216 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2217 {
2220
2223 }
2224
2225
2227 {
2228 return true;
2229 }
2230
2231
2232
2234 {
2236
2237
2238 if (construtionPart.
IsBase())
2239 {
2241
2242
2244 }
2245
2246
2248
2249
2251
2252
2254
2256
2258
2259
2261
2262
2264 }
2265
2267 {
2268
2270 }
2271
2272
2274 {
2277
2278
2280
2281
2283
2284
2286
2287
2289
2291
2292
2294
2295
2297
2298
2299 if (construtionPart.
IsBase())
2300 {
2301
2303 }
2304
2307 }
2308
2310 {
2311
2313 }
2314
2315
2316 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2317 {
2320
2321
2323
2324
2326
2327
2329
2330
2332
2334
2335
2337
2338
2340
2341
2342 if (construtionPart.
IsBase())
2343 {
2344
2346 }
2347
2350 }
2351
2353 {
2354
2356 }
2357
2359 {
2360 bool process = false;
2361
2362
2366
2367 if (process)
2368 {
2369 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2370 {
2372 return;
2373 }
2374
2376 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2377 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2378
2379
2381 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2382 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2383 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2384 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2385 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2386 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2387 mins = minTmp;
2388 maxs = maxTmp;
2389
2390 maxs[1] = maxs[1] + 0.35;
2391
2393 }
2394 }
2395
2397 {
2400
2401
2403 foreach (
EntityAI entity : foundEntities)
2404 {
2407 }
2408 }
2409
2410
2412 {
2414
2418 }
2419
2421 {
2423
2425 {
2427 }
2428 else
2429 {
2431 }
2432
2434 }
2435
2437 {
2439
2441 foreach (
string slotName : attachmentSlots)
2442 {
2444 }
2445
2446
2449 else
2451
2453 }
2454
2456 {
2457 string slotNameMounted = slot_name + "_Mounted";
2458 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2459
2460 if (attachment)
2461 {
2462 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2463 if (barbedWire && barbedWire.IsMounted())
2465 else
2467
2468 if (is_locked)
2469 {
2470 SetAnimationPhase(slotNameMounted, 0);
2471 SetAnimationPhase(slot_name, 1);
2472 }
2473 else
2474 {
2475 SetAnimationPhase(slotNameMounted, 1);
2476 SetAnimationPhase(slot_name, 0);
2477 }
2478 }
2479 else
2480 {
2481 SetAnimationPhase(slotNameMounted, 1);
2482 SetAnimationPhase(slot_name, 1);
2483
2485 }
2486 }
2487
2488
2490 {
2493
2496
2499
2500 foreach (
string slotName : attachmentSlots)
2501 {
2503 }
2504
2505
2507 {
2510
2512 }
2513 else
2514 {
2517
2519 }
2520
2523 }
2524
2526 {
2527
2529 return;
2530
2531 string slot_name_mounted = slot_name + "_Mounted";
2532 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2533
2534
2536 RemoveProxyPhysics( slot_name_mounted );
2537 RemoveProxyPhysics( slot_name );
2538
2539 if ( attachment )
2540 {
2542 if ( is_locked )
2543 {
2545 AddProxyPhysics( slot_name_mounted );
2546 }
2547 else
2548 {
2550 AddProxyPhysics( slot_name );
2551 }
2552 }
2553 }
2554
2556 {
2557 SetAffectPathgraph( true, false );
2559 }
2560
2562 {
2563 return true;
2564 }
2565
2567 {
2568 return true;
2569 }
2570
2572 {
2573 if ( attachment )
2574 {
2576 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2577
2578 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2579 }
2580
2581 return false;
2582 }
2583
2585 {
2587 }
2588
2589
2591 {
2592 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2593 if (
GetGame().ConfigIsExisting( config_path ) )
2594 {
2596 }
2597 }
2598
2600 {
2601 return true;
2602 }
2603
2605 {
2606 return true;
2607 }
2608
2610 {
2611 return true;
2612 }
2613
2614
2616 {
2618 {
2620 }
2621
2623 }
2624
2626 {
2628 }
2629
2630
2631
2633 {
2634 return super.CanReceiveAttachment(attachment, slotId);
2635 }
2636
2638 {
2639 int attachment_count = GetInventory().AttachmentCount();
2640 if ( attachment_count > 0 )
2641 {
2642 if (
HasBase() && attachment_count == 1 )
2643 {
2644 return false;
2645 }
2646
2647 return true;
2648 }
2649
2650 return false;
2651 }
2652
2654 {
2655 return true;
2656 }
2657
2659 {
2660 return false;
2661 }
2662
2663
2665 {
2666 return false;
2667 }
2668
2670 {
2671 return false;
2672 }
2673
2674
2676 {
2677 return false;
2678 }
2679
2680
2681
2683 {
2684 return true;
2685 }
2686
2688 {
2689 return true;
2690 }
2691
2694 {
2695 return false;
2696 }
2697
2698
2700 {
2701 return true;
2702 }
2703
2704
2706 {
2707 return false;
2708 }
2709
2710
2712 {
2713 return true;
2714 }
2715
2716
2718 {
2719 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2720 {
2721 return false;
2722 }
2723
2724 return true;
2725 }
2726
2728 {
2731
2732 return item;
2733 }
2734
2735
2737 {
2739 {
2740
2742
2743
2746
2748 if ( MemoryPointExists( slot_name + "_min" ) )
2749 {
2750 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2751 }
2752 if ( MemoryPointExists( slot_name + "_max" ) )
2753 {
2754 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2755 }
2756
2757
2760
2761
2764 center = ModelToWorld( center );
2765
2766
2769
2770 areaDamage.SetExtents( extents[0], extents[1] );
2771 areaDamage.SetAreaPosition( center );
2772 areaDamage.SetAreaOrientation( orientation );
2775 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2776 areaDamage.SetAmmoName( "BarbedWireHit" );
2777 areaDamage.Spawn();
2778
2780 }
2781 }
2782
2784 {
2785 if ( angle_deg != 0 )
2786 {
2787
2788 orientation[0] = orientation[0] - angle_deg;
2789
2790
2792 if ( MemoryPointExists( "rotate_axis" ) )
2793 {
2794 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2795 }
2796 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];
2797 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];
2798 center[0] = r_center_x;
2799 center[2] = r_center_z;
2800 }
2801 }
2802
2804 {
2806 {
2809 {
2810 if (areaDamage)
2811 {
2812 areaDamage.Destroy();
2813 }
2814
2816 }
2817 }
2818 }
2819
2821 {
2822 return true;
2823 }
2824
2825
2826
2827
2829 {
2831 }
2832
2834 {
2836 }
2837
2839 {
2841 }
2842
2844 {
2846
2847 switch ( material_type )
2848 {
2854 }
2855
2856 return "";
2857 }
2858
2860 {
2862
2863 switch ( material_type )
2864 {
2870 }
2871
2872 return "";
2873 }
2874
2875
2877 {
2879 {
2880
2882 {
2883 SetHealth(slot_name,"Health",item.GetHealth());
2884 }
2885 }
2886 }
2887
2889 {
2890 return 111;
2891 }
2892
2894 {
2895 super.SetActions();
2896
2900 }
2901
2902
2903
2904
2906 {
2907 }
2908
2911 {
2912 return null;
2913 }
2914
2916 {
2918 }
2919
2921 {
2924
2925 Man p;
2926
2927 #ifdef SERVER
2930 if (players.Count())
2931 p = players[0];
2932 #else
2934 #endif
2935
2937 {
2938 bool excluded = false;
2940 if (excludes)
2941 {
2942 foreach (string exclude : excludes)
2943 {
2945 {
2946 excluded = true;
2947 break;
2948 }
2949 }
2950 }
2951
2952 if (!excluded)
2953 {
2955 }
2956 }
2957
2959 }
2960}
2961
2963{
2964#ifdef BSB_DEBUG
2966#else
2967
2968#endif
2969}
2971{
2972#ifdef BSB_DEBUG_SPAM
2974#else
2975
2976#endif
2977}
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.