1763{
1765
1767
1769
1771
1777
1778
1779
1785
1791
1793
1797
1798
1800 {
1802
1803
1804 RegisterNetSyncVariableInt( "m_SyncParts01" );
1805 RegisterNetSyncVariableInt( "m_SyncParts02" );
1806 RegisterNetSyncVariableInt( "m_SyncParts03" );
1807 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1808 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1809 RegisterNetSyncVariableBool( "m_HasBase" );
1810
1811
1813
1814 if (ConfigIsExisting("hybridAttachments"))
1815 {
1818 }
1819 if (ConfigIsExisting("mountables"))
1820 {
1823 }
1824
1826 }
1827
1829 {
1830 super.EEDelete(parent);
1831
1833 {
1834 areaDamage.Destroy();
1835 }
1836
1837 }
1838
1840 {
1841 return "disableBaseDamage";
1842 }
1843
1845 {
1846 return true;
1847 }
1848
1850 {
1851 return EInventoryIconVisibility.HIDE_VICINITY;
1852 }
1853
1854
1856 {
1858 {
1859 SetSynchDirty();
1860 }
1861 }
1862
1864 {
1866 super.OnVariablesSynchronized();
1867
1869 }
1870
1872 {
1873
1875
1876
1878
1879
1881 }
1882
1883
1885 {
1886
1887 int offset;
1888 int mask;
1889
1890 if ( part_id >= 1 && part_id <= 31 )
1891 {
1892 offset = part_id - 1;
1893 mask = 1 << offset;
1894
1896 }
1897 else if ( part_id >= 32 && part_id <= 62 )
1898 {
1899 offset = ( part_id % 32 );
1900 mask = 1 << offset;
1901
1903 }
1904 else if ( part_id >= 63 && part_id <= 93 )
1905 {
1906 offset = ( part_id % 63 );
1907 mask = 1 << offset;
1908
1910 }
1911 }
1912
1914 {
1915
1916 int offset;
1917 int mask;
1918
1919 if ( part_id >= 1 && part_id <= 31 )
1920 {
1921 offset = part_id - 1;
1922 mask = 1 << offset;
1923
1925 }
1926 else if ( part_id >= 32 && part_id <= 62 )
1927 {
1928 offset = ( part_id % 32 );
1929 mask = 1 << offset;
1930
1932 }
1933 else if ( part_id >= 63 && part_id <= 93 )
1934 {
1935 offset = ( part_id % 63 );
1936 mask = 1 << offset;
1937
1939 }
1940 }
1941
1943 {
1944
1945 int offset;
1946 int mask;
1947
1948 if ( part_id >= 1 && part_id <= 31 )
1949 {
1950 offset = part_id - 1;
1951 mask = 1 << offset;
1952
1954 {
1955 return true;
1956 }
1957 }
1958 else if ( part_id >= 32 && part_id <= 62 )
1959 {
1960 offset = ( part_id % 32 );
1961 mask = 1 << offset;
1962
1964 {
1965 return true;
1966 }
1967 }
1968 else if ( part_id >= 63 && part_id <= 93 )
1969 {
1970 offset = ( part_id % 63 );
1971 mask = 1 << offset;
1972
1974 {
1975 return true;
1976 }
1977 }
1978
1979 return false;
1980 }
1981
1983 {
1986 }
1987
1989 {
1990
1993 }
1994
1996 {
1998 {
2001
2002 switch( build_action_id )
2003 {
2007 }
2008 }
2009 }
2010
2011
2013 {
2015 bool is_base = part.
IsBase();
2018 if ( is_part_built_sync )
2019 {
2021 {
2025
2026 if (is_base)
2027 {
2030 }
2031 }
2032 }
2033 else
2034 {
2036 {
2040
2041 if (is_base)
2042 {
2045 }
2046 }
2047 }
2048
2049
2051 }
2052
2053
2055 {
2058
2059 for ( int i = 0; i < construction_parts.Count(); ++i )
2060 {
2061 string key = construction_parts.GetKey( i );
2064 }
2065
2066
2068 }
2069
2071 {
2074
2075 for ( int i = 0; i < construction_parts.Count(); ++i )
2076 {
2077 string key = construction_parts.GetKey( i );
2079
2080 if ( value.
GetId() ==
id )
2081 {
2082 return value;
2083 }
2084 }
2085
2086 return NULL;
2087 }
2088
2089
2090
2092 {
2094 }
2095
2097 {
2099 }
2100
2102 {
2103 return true;
2104 }
2105
2107 {
2108 return false;
2109 }
2110
2111
2113 {
2116 {
2118 }
2119
2120 return construction_kit;
2121 }
2122
2124 {
2127 {
2129 }
2130 }
2131
2133 {
2135 }
2136
2138 {
2139 return "";
2140 }
2141
2143 {
2146 }
2147
2148
2150 {
2153 }
2154
2155
2157 {
2158 super.OnStoreSave( ctx );
2159
2160
2164
2166 }
2167
2169 {
2170 if ( !super.OnStoreLoad( ctx, version ) )
2171 return false;
2172
2173
2174
2176 {
2178 return false;
2179 }
2181 {
2183 return false;
2184 }
2186 {
2188 return false;
2189 }
2190
2191
2193 {
2195 return false;
2196 }
2197
2198
2199 return true;
2200 }
2201
2203 {
2204 super.AfterStoreLoad();
2205
2207 {
2209 }
2210 }
2211
2213 {
2214
2216
2217
2220
2221
2223 }
2224
2226 {
2227 super.OnCreatePhysics();
2230 }
2231
2233 {
2235 return;
2236
2237 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2238
2240 return;
2241
2243 string part_name = zone;
2245
2247 {
2248 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2249
2250 if ( construction_part && construction.IsPartConstructed( part_name ) )
2251 {
2253 construction.DestroyConnectedParts(part_name);
2254 }
2255
2256
2257 if ( part_name.
Contains(
"barbed") )
2258 {
2259 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2260 if (barbed_wire)
2261 barbed_wire.SetMountedState( false );
2262 }
2263 }
2264 }
2265
2267 {
2269 {
2271 }
2272
2273 super.EEOnAfterLoad();
2274 }
2275
2277 {
2278 super.EEInit();
2279
2280
2282
2283
2284 #ifdef DEVELOPER
2286 #endif
2287 }
2288
2290 {
2291 super.EEItemAttached( item, slot_name );
2292
2296 }
2297
2299 {
2300 super.EEItemDetached( item, slot_name );
2301
2304 }
2305
2306 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2307 {
2310
2313 }
2314
2315
2317 {
2318 return true;
2319 }
2320
2321
2322
2324 {
2326
2327
2328 if (construtionPart.
IsBase())
2329 {
2331
2332
2334 }
2335
2336
2338
2339
2341
2342
2344
2346
2348
2349
2351
2352
2354 }
2355
2357 {
2358
2360 }
2361
2362
2364 {
2367
2368
2370
2371
2373
2374
2376
2377
2379
2381
2382
2384
2385
2387
2388
2389 if (construtionPart.
IsBase())
2390 {
2391
2393 }
2394
2397 }
2398
2400 {
2401
2403 }
2404
2405
2406 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2407 {
2410
2411
2413
2414
2416
2417
2419
2420
2422
2424
2425
2427
2428
2430
2431
2432 if (construtionPart.
IsBase())
2433 {
2434
2436 }
2437
2440 }
2441
2443 {
2444
2446 }
2447
2449 {
2450 bool process = false;
2451
2452
2456
2457 if (process)
2458 {
2459 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2460 {
2462 return;
2463 }
2464
2466 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2467 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2468
2469
2471 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2472 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2473 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2474 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2475 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2476 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2477 mins = minTmp;
2478 maxs = maxTmp;
2479
2480 maxs[1] = maxs[1] + 0.35;
2481
2483 }
2484 }
2485
2487 {
2490
2491
2493 foreach (
EntityAI entity : foundEntities)
2494 {
2497 }
2498 }
2499
2500
2502 {
2504
2508 }
2509
2511 {
2513
2515 {
2517 }
2518 else
2519 {
2521 }
2522
2524 }
2525
2527 {
2529
2531 foreach (
string slotName : attachmentSlots)
2532 {
2534 }
2535
2536
2539 else
2541
2543 }
2544
2546 {
2547 string slotNameMounted = slot_name + "_Mounted";
2548 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2549
2550 if (attachment)
2551 {
2552 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2553 if (barbedWire && barbedWire.IsMounted())
2555 else
2557
2558 if (is_locked)
2559 {
2560 SetAnimationPhase(slotNameMounted, 0);
2561 SetAnimationPhase(slot_name, 1);
2562 }
2563 else
2564 {
2565 SetAnimationPhase(slotNameMounted, 1);
2566 SetAnimationPhase(slot_name, 0);
2567 }
2568 }
2569 else
2570 {
2571 SetAnimationPhase(slotNameMounted, 1);
2572 SetAnimationPhase(slot_name, 1);
2573
2575 }
2576 }
2577
2578
2580 {
2583
2586
2589
2590 foreach (
string slotName : attachmentSlots)
2591 {
2593 }
2594
2595
2597 {
2600
2602 }
2603 else
2604 {
2607
2609 }
2610
2613 }
2614
2616 {
2617
2619 return;
2620
2621 string slot_name_mounted = slot_name + "_Mounted";
2622 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2623
2624
2626 RemoveProxyPhysics( slot_name_mounted );
2627 RemoveProxyPhysics( slot_name );
2628
2629 if ( attachment )
2630 {
2632 if ( is_locked )
2633 {
2635 AddProxyPhysics( slot_name_mounted );
2636 }
2637 else
2638 {
2640 AddProxyPhysics( slot_name );
2641 }
2642 }
2643 }
2644
2646 {
2647 SetAffectPathgraph( true, false );
2649 }
2650
2652 {
2653 return true;
2654 }
2655
2657 {
2658 return true;
2659 }
2660
2662 {
2663 if ( attachment )
2664 {
2666 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2667
2668 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2669 }
2670
2671 return false;
2672 }
2673
2675 {
2677 }
2678
2679
2681 {
2682 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2683 if (
GetGame().ConfigIsExisting( config_path ) )
2684 {
2686 }
2687 }
2688
2690 {
2691 return true;
2692 }
2693
2695 {
2696 return true;
2697 }
2698
2700 {
2701 return true;
2702 }
2703
2704
2706 {
2708 {
2710 }
2711
2713 }
2714
2716 {
2718 }
2719
2720
2721
2723 {
2724 return super.CanReceiveAttachment(attachment, slotId);
2725 }
2726
2728 {
2729 int attachment_count = GetInventory().AttachmentCount();
2730 if ( attachment_count > 0 )
2731 {
2732 if (
HasBase() && attachment_count == 1 )
2733 {
2734 return false;
2735 }
2736
2737 return true;
2738 }
2739
2740 return false;
2741 }
2742
2744 {
2745 return true;
2746 }
2747
2749 {
2750 return false;
2751 }
2752
2753
2755 {
2756 return false;
2757 }
2758
2760 {
2761 return false;
2762 }
2763
2764
2766 {
2767 return false;
2768 }
2769
2770
2771
2773 {
2774 return true;
2775 }
2776
2778 {
2779 return true;
2780 }
2781
2784 {
2785 return false;
2786 }
2787
2788
2790 {
2791 return true;
2792 }
2793
2794
2796 {
2797 return false;
2798 }
2799
2800
2802 {
2803 return true;
2804 }
2805
2806
2808 {
2809 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2810 {
2811 return false;
2812 }
2813
2814 return true;
2815 }
2816
2818 {
2821
2822 return item;
2823 }
2824
2825
2827 {
2829 {
2830
2832
2833
2836
2838 if ( MemoryPointExists( slot_name + "_min" ) )
2839 {
2840 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2841 }
2842 if ( MemoryPointExists( slot_name + "_max" ) )
2843 {
2844 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2845 }
2846
2847
2850
2851
2854 center = ModelToWorld( center );
2855
2856
2859
2860 areaDamage.SetExtents( extents[0], extents[1] );
2861 areaDamage.SetAreaPosition( center );
2862 areaDamage.SetAreaOrientation( orientation );
2865 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2866 areaDamage.SetAmmoName( "BarbedWireHit" );
2867 areaDamage.Spawn();
2868
2870 }
2871 }
2872
2874 {
2875 if ( angle_deg != 0 )
2876 {
2877
2878 orientation[0] = orientation[0] - angle_deg;
2879
2880
2882 if ( MemoryPointExists( "rotate_axis" ) )
2883 {
2884 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2885 }
2886 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];
2887 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];
2888 center[0] = r_center_x;
2889 center[2] = r_center_z;
2890 }
2891 }
2892
2894 {
2896 {
2899 {
2900 if (areaDamage)
2901 {
2902 areaDamage.Destroy();
2903 }
2904
2906 }
2907 }
2908 }
2909
2911 {
2912 return true;
2913 }
2914
2915
2916
2917
2919 {
2921 }
2922
2924 {
2926 }
2927
2929 {
2931 }
2932
2934 {
2936
2937 switch ( material_type )
2938 {
2944 }
2945
2946 return "";
2947 }
2948
2950 {
2952
2953 switch ( material_type )
2954 {
2960 }
2961
2962 return "";
2963 }
2964
2965
2967 {
2969 {
2970
2972 {
2973 SetHealth(slot_name,"Health",item.GetHealth());
2974 }
2975 }
2976 }
2977
2979 {
2980 return 111;
2981 }
2982
2984 {
2985 super.SetActions();
2986
2990 }
2991
2992
2993
2994
2996 {
2997 }
2998
3001 {
3002 return null;
3003 }
3004
3006 {
3008 }
3009
3011 {
3014
3015 Man p;
3016
3017 #ifdef SERVER
3020 if (players.Count())
3021 p = players[0];
3022 #else
3024 #endif
3025
3027 {
3028 bool excluded = false;
3030 if (excludes)
3031 {
3032 foreach (string exclude : excludes)
3033 {
3035 {
3036 excluded = true;
3037 break;
3038 }
3039 }
3040 }
3041
3042 if (!excluded)
3043 {
3045 }
3046 }
3047
3049 }
3050}
3051
3053{
3054#ifdef BSB_DEBUG
3056#else
3057
3058#endif
3059}
3061{
3062#ifdef BSB_DEBUG_SPAM
3064#else
3065
3066#endif
3067}
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.