1756{
1758
1760
1762
1764
1770
1771
1772
1778
1784
1786
1790
1791
1793 {
1795
1796
1797 RegisterNetSyncVariableInt( "m_SyncParts01" );
1798 RegisterNetSyncVariableInt( "m_SyncParts02" );
1799 RegisterNetSyncVariableInt( "m_SyncParts03" );
1800 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1801 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1802 RegisterNetSyncVariableBool( "m_HasBase" );
1803
1804
1806
1807 if (ConfigIsExisting("hybridAttachments"))
1808 {
1811 }
1812 if (ConfigIsExisting("mountables"))
1813 {
1816 }
1817
1819 }
1820
1822 {
1823 super.EEDelete(parent);
1824
1826 {
1827 areaDamage.Destroy();
1828 }
1829
1830 }
1831
1833 {
1834 return "disableBaseDamage";
1835 }
1836
1838 {
1839 return true;
1840 }
1841
1843 {
1844 return EInventoryIconVisibility.HIDE_VICINITY;
1845 }
1846
1847
1849 {
1851 {
1852 SetSynchDirty();
1853 }
1854 }
1855
1857 {
1859 super.OnVariablesSynchronized();
1860
1862 }
1863
1865 {
1866
1868
1869
1871
1872
1874 }
1875
1876
1878 {
1879
1880 int offset;
1881 int mask;
1882
1883 if ( part_id >= 1 && part_id <= 31 )
1884 {
1885 offset = part_id - 1;
1886 mask = 1 << offset;
1887
1889 }
1890 else if ( part_id >= 32 && part_id <= 62 )
1891 {
1892 offset = ( part_id % 32 );
1893 mask = 1 << offset;
1894
1896 }
1897 else if ( part_id >= 63 && part_id <= 93 )
1898 {
1899 offset = ( part_id % 63 );
1900 mask = 1 << offset;
1901
1903 }
1904 }
1905
1907 {
1908
1909 int offset;
1910 int mask;
1911
1912 if ( part_id >= 1 && part_id <= 31 )
1913 {
1914 offset = part_id - 1;
1915 mask = 1 << offset;
1916
1918 }
1919 else if ( part_id >= 32 && part_id <= 62 )
1920 {
1921 offset = ( part_id % 32 );
1922 mask = 1 << offset;
1923
1925 }
1926 else if ( part_id >= 63 && part_id <= 93 )
1927 {
1928 offset = ( part_id % 63 );
1929 mask = 1 << offset;
1930
1932 }
1933 }
1934
1936 {
1937
1938 int offset;
1939 int mask;
1940
1941 if ( part_id >= 1 && part_id <= 31 )
1942 {
1943 offset = part_id - 1;
1944 mask = 1 << offset;
1945
1947 {
1948 return true;
1949 }
1950 }
1951 else if ( part_id >= 32 && part_id <= 62 )
1952 {
1953 offset = ( part_id % 32 );
1954 mask = 1 << offset;
1955
1957 {
1958 return true;
1959 }
1960 }
1961 else if ( part_id >= 63 && part_id <= 93 )
1962 {
1963 offset = ( part_id % 63 );
1964 mask = 1 << offset;
1965
1967 {
1968 return true;
1969 }
1970 }
1971
1972 return false;
1973 }
1974
1976 {
1979 }
1980
1982 {
1983
1986 }
1987
1989 {
1991 {
1994
1995 switch( build_action_id )
1996 {
2000 }
2001 }
2002 }
2003
2004
2006 {
2008 bool is_base = part.
IsBase();
2011 if ( is_part_built_sync )
2012 {
2014 {
2018
2019 if (is_base)
2020 {
2023 }
2024 }
2025 }
2026 else
2027 {
2029 {
2033
2034 if (is_base)
2035 {
2038 }
2039 }
2040 }
2041
2042
2044 }
2045
2046
2048 {
2051
2052 for ( int i = 0; i < construction_parts.Count(); ++i )
2053 {
2054 string key = construction_parts.GetKey( i );
2057 }
2058
2059
2061 }
2062
2064 {
2067
2068 for ( int i = 0; i < construction_parts.Count(); ++i )
2069 {
2070 string key = construction_parts.GetKey( i );
2072
2073 if ( value.
GetId() ==
id )
2074 {
2075 return value;
2076 }
2077 }
2078
2079 return NULL;
2080 }
2081
2082
2083
2085 {
2087 }
2088
2090 {
2092 }
2093
2095 {
2096 return true;
2097 }
2098
2100 {
2101 return false;
2102 }
2103
2104
2106 {
2109 {
2111 }
2112
2113 return construction_kit;
2114 }
2115
2117 {
2120 {
2122 }
2123 }
2124
2126 {
2128 }
2129
2131 {
2132 return "";
2133 }
2134
2136 {
2139 }
2140
2141
2143 {
2146 }
2147
2148
2150 {
2151 super.OnStoreSave( ctx );
2152
2153
2157
2159 }
2160
2162 {
2163 if ( !super.OnStoreLoad( ctx, version ) )
2164 return false;
2165
2166
2167
2169 {
2171 return false;
2172 }
2174 {
2176 return false;
2177 }
2179 {
2181 return false;
2182 }
2183
2184
2186 {
2188 return false;
2189 }
2190
2191
2192 return true;
2193 }
2194
2196 {
2197 super.AfterStoreLoad();
2198
2200 {
2202 }
2203 }
2204
2206 {
2207
2209
2210
2213
2214
2216 }
2217
2219 {
2220 super.OnCreatePhysics();
2223 }
2224
2226 {
2228 return;
2229
2230 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2231
2233 return;
2234
2236 string part_name = zone;
2238
2240 {
2241 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2242
2243 if ( construction_part && construction.IsPartConstructed( part_name ) )
2244 {
2246 construction.DestroyConnectedParts(part_name);
2247 }
2248
2249
2250 if ( part_name.
Contains(
"barbed") )
2251 {
2252 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2253 if (barbed_wire)
2254 barbed_wire.SetMountedState( false );
2255 }
2256 }
2257 }
2258
2260 {
2262 {
2264 }
2265
2266 super.EEOnAfterLoad();
2267 }
2268
2270 {
2271 super.EEInit();
2272
2273
2275
2276
2277 #ifdef DEVELOPER
2279 #endif
2280 }
2281
2283 {
2284 super.EEItemAttached( item, slot_name );
2285
2289 }
2290
2292 {
2293 super.EEItemDetached( item, slot_name );
2294
2297 }
2298
2299 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2300 {
2303
2306 }
2307
2308
2310 {
2311 return true;
2312 }
2313
2314
2315
2317 {
2319
2320
2321 if (construtionPart.
IsBase())
2322 {
2324
2325
2327 }
2328
2329
2331
2332
2334
2335
2337
2339
2341
2342
2344
2345
2347 }
2348
2350 {
2351
2353 }
2354
2355
2357 {
2360
2361
2363
2364
2366
2367
2369
2370
2372
2374
2375
2377
2378
2380
2381
2382 if (construtionPart.
IsBase())
2383 {
2384
2386 }
2387
2390 }
2391
2393 {
2394
2396 }
2397
2398
2399 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2400 {
2403
2404
2406
2407
2409
2410
2412
2413
2415
2417
2418
2420
2421
2423
2424
2425 if (construtionPart.
IsBase())
2426 {
2427
2429 }
2430
2433 }
2434
2436 {
2437
2439 }
2440
2442 {
2443 bool process = false;
2444
2445
2449
2450 if (process)
2451 {
2452 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2453 {
2455 return;
2456 }
2457
2459 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2460 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2461
2462
2464 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2465 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2466 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2467 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2468 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2469 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2470 mins = minTmp;
2471 maxs = maxTmp;
2472
2473 maxs[1] = maxs[1] + 0.35;
2474
2476 }
2477 }
2478
2480 {
2483
2484
2486 foreach (
EntityAI entity : foundEntities)
2487 {
2490 }
2491 }
2492
2493
2495 {
2497
2501 }
2502
2504 {
2506
2508 {
2510 }
2511 else
2512 {
2514 }
2515
2517 }
2518
2520 {
2522
2524 foreach (
string slotName : attachmentSlots)
2525 {
2527 }
2528
2529
2532 else
2534
2536 }
2537
2539 {
2540 string slotNameMounted = slot_name + "_Mounted";
2541 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2542
2543 if (attachment)
2544 {
2545 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2546 if (barbedWire && barbedWire.IsMounted())
2548 else
2550
2551 if (is_locked)
2552 {
2553 SetAnimationPhase(slotNameMounted, 0);
2554 SetAnimationPhase(slot_name, 1);
2555 }
2556 else
2557 {
2558 SetAnimationPhase(slotNameMounted, 1);
2559 SetAnimationPhase(slot_name, 0);
2560 }
2561 }
2562 else
2563 {
2564 SetAnimationPhase(slotNameMounted, 1);
2565 SetAnimationPhase(slot_name, 1);
2566
2568 }
2569 }
2570
2571
2573 {
2576
2579
2582
2583 foreach (
string slotName : attachmentSlots)
2584 {
2586 }
2587
2588
2590 {
2593
2595 }
2596 else
2597 {
2600
2602 }
2603
2606 }
2607
2609 {
2610
2612 return;
2613
2614 string slot_name_mounted = slot_name + "_Mounted";
2615 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2616
2617
2619 RemoveProxyPhysics( slot_name_mounted );
2620 RemoveProxyPhysics( slot_name );
2621
2622 if ( attachment )
2623 {
2625 if ( is_locked )
2626 {
2628 AddProxyPhysics( slot_name_mounted );
2629 }
2630 else
2631 {
2633 AddProxyPhysics( slot_name );
2634 }
2635 }
2636 }
2637
2639 {
2640 SetAffectPathgraph( true, false );
2642 }
2643
2645 {
2646 return true;
2647 }
2648
2650 {
2651 return true;
2652 }
2653
2655 {
2656 if ( attachment )
2657 {
2659 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2660
2661 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2662 }
2663
2664 return false;
2665 }
2666
2668 {
2670 }
2671
2672
2674 {
2675 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2676 if (
GetGame().ConfigIsExisting( config_path ) )
2677 {
2679 }
2680 }
2681
2683 {
2684 return true;
2685 }
2686
2688 {
2689 return true;
2690 }
2691
2693 {
2694 return true;
2695 }
2696
2697
2699 {
2701 {
2703 }
2704
2706 }
2707
2709 {
2711 }
2712
2713
2714
2716 {
2717 return super.CanReceiveAttachment(attachment, slotId);
2718 }
2719
2721 {
2722 int attachment_count = GetInventory().AttachmentCount();
2723 if ( attachment_count > 0 )
2724 {
2725 if (
HasBase() && attachment_count == 1 )
2726 {
2727 return false;
2728 }
2729
2730 return true;
2731 }
2732
2733 return false;
2734 }
2735
2737 {
2738 return true;
2739 }
2740
2742 {
2743 return false;
2744 }
2745
2746
2748 {
2749 return false;
2750 }
2751
2753 {
2754 return false;
2755 }
2756
2757
2759 {
2760 return false;
2761 }
2762
2763
2764
2766 {
2767 return true;
2768 }
2769
2771 {
2772 return true;
2773 }
2774
2777 {
2778 return false;
2779 }
2780
2781
2783 {
2784 return true;
2785 }
2786
2787
2789 {
2790 return false;
2791 }
2792
2793
2795 {
2796 return true;
2797 }
2798
2799
2801 {
2802 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2803 {
2804 return false;
2805 }
2806
2807 return true;
2808 }
2809
2811 {
2814
2815 return item;
2816 }
2817
2818
2820 {
2822 {
2823
2825
2826
2829
2831 if ( MemoryPointExists( slot_name + "_min" ) )
2832 {
2833 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2834 }
2835 if ( MemoryPointExists( slot_name + "_max" ) )
2836 {
2837 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2838 }
2839
2840
2843
2844
2847 center = ModelToWorld( center );
2848
2849
2852
2853 areaDamage.SetExtents( extents[0], extents[1] );
2854 areaDamage.SetAreaPosition( center );
2855 areaDamage.SetAreaOrientation( orientation );
2858 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2859 areaDamage.SetAmmoName( "BarbedWireHit" );
2860 areaDamage.Spawn();
2861
2863 }
2864 }
2865
2867 {
2868 if ( angle_deg != 0 )
2869 {
2870
2871 orientation[0] = orientation[0] - angle_deg;
2872
2873
2875 if ( MemoryPointExists( "rotate_axis" ) )
2876 {
2877 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2878 }
2879 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];
2880 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];
2881 center[0] = r_center_x;
2882 center[2] = r_center_z;
2883 }
2884 }
2885
2887 {
2889 {
2892 {
2893 if (areaDamage)
2894 {
2895 areaDamage.Destroy();
2896 }
2897
2899 }
2900 }
2901 }
2902
2904 {
2905 return true;
2906 }
2907
2908
2909
2910
2912 {
2914 }
2915
2917 {
2919 }
2920
2922 {
2924 }
2925
2927 {
2929
2930 switch ( material_type )
2931 {
2937 }
2938
2939 return "";
2940 }
2941
2943 {
2945
2946 switch ( material_type )
2947 {
2953 }
2954
2955 return "";
2956 }
2957
2958
2960 {
2962 {
2963
2965 {
2966 SetHealth(slot_name,"Health",item.GetHealth());
2967 }
2968 }
2969 }
2970
2972 {
2973 return 111;
2974 }
2975
2977 {
2978 super.SetActions();
2979
2983 }
2984
2985
2986
2987
2989 {
2990 }
2991
2994 {
2995 return null;
2996 }
2997
2999 {
3001 }
3002
3004 {
3007
3008 Man p;
3009
3010 #ifdef SERVER
3013 if (players.Count())
3014 p = players[0];
3015 #else
3017 #endif
3018
3020 {
3021 bool excluded = false;
3023 if (excludes)
3024 {
3025 foreach (string exclude : excludes)
3026 {
3028 {
3029 excluded = true;
3030 break;
3031 }
3032 }
3033 }
3034
3035 if (!excluded)
3036 {
3038 }
3039 }
3040
3042 }
3043}
3044
3046{
3047#ifdef BSB_DEBUG
3049#else
3050
3051#endif
3052}
3054{
3055#ifdef BSB_DEBUG_SPAM
3057#else
3058
3059#endif
3060}
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.