1797{
1799
1801
1803
1805
1811
1812
1813
1819
1825
1827
1831
1832
1834 {
1836
1837
1838 RegisterNetSyncVariableInt( "m_SyncParts01" );
1839 RegisterNetSyncVariableInt( "m_SyncParts02" );
1840 RegisterNetSyncVariableInt( "m_SyncParts03" );
1841 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1842 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1843 RegisterNetSyncVariableBool( "m_HasBase" );
1844
1845
1847
1848 if (ConfigIsExisting("hybridAttachments"))
1849 {
1852 }
1853 if (ConfigIsExisting("mountables"))
1854 {
1857 }
1858
1860 }
1861
1863 {
1864 super.EEDelete(parent);
1865
1867 {
1868 areaDamage.Destroy();
1869 }
1870
1871 }
1872
1874 {
1875 return "disableBaseDamage";
1876 }
1877
1879 {
1880 return true;
1881 }
1882
1884 {
1885 return EInventoryIconVisibility.HIDE_VICINITY;
1886 }
1887
1888
1890 {
1892 {
1893 SetSynchDirty();
1894 }
1895 }
1896
1898 {
1900 super.OnVariablesSynchronized();
1901
1903 }
1904
1906 {
1907
1909
1910
1912
1913
1915 }
1916
1917
1919 {
1920
1921 int offset;
1922 int mask;
1923
1924 if ( part_id >= 1 && part_id <= 31 )
1925 {
1926 offset = part_id - 1;
1927 mask = 1 << offset;
1928
1930 }
1931 else if ( part_id >= 32 && part_id <= 62 )
1932 {
1933 offset = ( part_id % 32 );
1934 mask = 1 << offset;
1935
1937 }
1938 else if ( part_id >= 63 && part_id <= 93 )
1939 {
1940 offset = ( part_id % 63 );
1941 mask = 1 << offset;
1942
1944 }
1945 }
1946
1948 {
1949
1950 int offset;
1951 int mask;
1952
1953 if ( part_id >= 1 && part_id <= 31 )
1954 {
1955 offset = part_id - 1;
1956 mask = 1 << offset;
1957
1959 }
1960 else if ( part_id >= 32 && part_id <= 62 )
1961 {
1962 offset = ( part_id % 32 );
1963 mask = 1 << offset;
1964
1966 }
1967 else if ( part_id >= 63 && part_id <= 93 )
1968 {
1969 offset = ( part_id % 63 );
1970 mask = 1 << offset;
1971
1973 }
1974 }
1975
1977 {
1978
1979 int offset;
1980 int mask;
1981
1982 if ( part_id >= 1 && part_id <= 31 )
1983 {
1984 offset = part_id - 1;
1985 mask = 1 << offset;
1986
1988 {
1989 return true;
1990 }
1991 }
1992 else if ( part_id >= 32 && part_id <= 62 )
1993 {
1994 offset = ( part_id % 32 );
1995 mask = 1 << offset;
1996
1998 {
1999 return true;
2000 }
2001 }
2002 else if ( part_id >= 63 && part_id <= 93 )
2003 {
2004 offset = ( part_id % 63 );
2005 mask = 1 << offset;
2006
2008 {
2009 return true;
2010 }
2011 }
2012
2013 return false;
2014 }
2015
2017 {
2020 }
2021
2023 {
2024
2027 }
2028
2030 {
2032 {
2035
2036 switch( build_action_id )
2037 {
2041 }
2042 }
2043 }
2044
2045
2047 {
2049 bool is_base = part.
IsBase();
2052 if ( is_part_built_sync )
2053 {
2055 {
2059
2060 if (is_base)
2061 {
2064 }
2065 }
2066 }
2067 else
2068 {
2070 {
2074
2075 if (is_base)
2076 {
2079 }
2080 }
2081 }
2082
2083
2085 }
2086
2087
2089 {
2092
2093 for ( int i = 0; i < construction_parts.Count(); ++i )
2094 {
2095 string key = construction_parts.GetKey( i );
2098 }
2099
2100
2102 }
2103
2105 {
2108
2109 for ( int i = 0; i < construction_parts.Count(); ++i )
2110 {
2111 string key = construction_parts.GetKey( i );
2113
2114 if ( value.
GetId() ==
id )
2115 {
2116 return value;
2117 }
2118 }
2119
2120 return NULL;
2121 }
2122
2123
2124
2126 {
2128 }
2129
2131 {
2133 }
2134
2136 {
2137 return true;
2138 }
2139
2141 {
2142 return false;
2143 }
2144
2145
2147 {
2150 {
2152 }
2153
2154 return construction_kit;
2155 }
2156
2158 {
2161 {
2163 }
2164 }
2165
2167 {
2169 }
2170
2172 {
2173 return "";
2174 }
2175
2177 {
2180 }
2181
2182
2184 {
2187 }
2188
2189
2191 {
2192 super.OnStoreSave( ctx );
2193
2194
2198
2200 }
2201
2203 {
2204 if ( !super.OnStoreLoad( ctx, version ) )
2205 return false;
2206
2207
2208
2210 {
2212 return false;
2213 }
2215 {
2217 return false;
2218 }
2220 {
2222 return false;
2223 }
2224
2225
2227 {
2229 return false;
2230 }
2231
2232
2233 return true;
2234 }
2235
2237 {
2238 super.AfterStoreLoad();
2239
2241 {
2243 }
2244 }
2245
2247 {
2248
2250
2251
2254
2255
2257 }
2258
2260 {
2261 super.OnCreatePhysics();
2264 }
2265
2267 {
2269 return;
2270
2271 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2272
2274 return;
2275
2277 string part_name = zone;
2279
2281 {
2282 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2283
2284 if ( construction_part && construction.IsPartConstructed( part_name ) )
2285 {
2287 construction.DestroyConnectedParts(part_name);
2288 }
2289
2290
2291 if ( part_name.
Contains(
"barbed") )
2292 {
2293 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2294 if (barbed_wire)
2295 barbed_wire.SetMountedState( false );
2296 }
2297 }
2298 }
2299
2301 {
2303 {
2305 }
2306
2307 super.EEOnAfterLoad();
2308 }
2309
2311 {
2312 super.EEInit();
2313
2314
2316
2317
2318 #ifdef DEVELOPER
2320 #endif
2321 }
2322
2324 {
2325 super.EEItemAttached( item, slot_name );
2326
2330 }
2331
2333 {
2334 super.EEItemDetached( item, slot_name );
2335
2338 }
2339
2340 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2341 {
2344
2347 }
2348
2349
2351 {
2352 return true;
2353 }
2354
2355
2356
2358 {
2360
2361
2362 if (construtionPart.
IsBase())
2363 {
2365
2366
2368 }
2369
2370
2372
2373
2375
2376
2378
2380
2382
2383
2385
2386
2388 }
2389
2391 {
2392
2394 }
2395
2396
2398 {
2401
2402
2404
2405
2407
2408
2410
2411
2413
2415
2416
2418
2419
2421
2422
2423 if (construtionPart.
IsBase())
2424 {
2425
2427 }
2428
2431 }
2432
2434 {
2435
2437 }
2438
2439
2440 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2441 {
2444
2445
2447
2448
2450
2451
2453
2454
2456
2458
2459
2461
2462
2464
2465
2466 if (construtionPart.
IsBase())
2467 {
2468
2470 }
2471
2474 }
2475
2477 {
2478
2480 }
2481
2483 {
2484 bool process = false;
2485
2486
2490
2491 if (process)
2492 {
2493 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2494 {
2496 return;
2497 }
2498
2500 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2501 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2502
2503
2505 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2506 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2507 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2508 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2509 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2510 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2511 mins = minTmp;
2512 maxs = maxTmp;
2513
2514 maxs[1] = maxs[1] + 0.35;
2515
2517 }
2518 }
2519
2521 {
2524
2525
2527 foreach (
EntityAI entity : foundEntities)
2528 {
2531 }
2532 }
2533
2534
2536 {
2538
2542 }
2543
2545 {
2547
2549 {
2551 }
2552 else
2553 {
2555 }
2556
2558 }
2559
2561 {
2563
2565 foreach (
string slotName : attachmentSlots)
2566 {
2568 }
2569
2570
2573 else
2575
2577 }
2578
2580 {
2581 string slotNameMounted = slot_name + "_Mounted";
2582 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2583
2584 if (attachment)
2585 {
2586 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2587 if (barbedWire && barbedWire.IsMounted())
2589 else
2591
2592 if (is_locked)
2593 {
2594 SetAnimationPhase(slotNameMounted, 0);
2595 SetAnimationPhase(slot_name, 1);
2596 }
2597 else
2598 {
2599 SetAnimationPhase(slotNameMounted, 1);
2600 SetAnimationPhase(slot_name, 0);
2601 }
2602 }
2603 else
2604 {
2605 SetAnimationPhase(slotNameMounted, 1);
2606 SetAnimationPhase(slot_name, 1);
2607
2609 }
2610 }
2611
2612
2614 {
2617
2620
2623
2624 foreach (
string slotName : attachmentSlots)
2625 {
2627 }
2628
2629
2631 {
2634
2636 }
2637 else
2638 {
2641
2643 }
2644
2647 }
2648
2650 {
2651
2653 return;
2654
2655 string slot_name_mounted = slot_name + "_Mounted";
2656 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2657
2658
2660 RemoveProxyPhysics( slot_name_mounted );
2661 RemoveProxyPhysics( slot_name );
2662
2663 if ( attachment )
2664 {
2666 if ( is_locked )
2667 {
2669 AddProxyPhysics( slot_name_mounted );
2670 }
2671 else
2672 {
2674 AddProxyPhysics( slot_name );
2675 }
2676 }
2677 }
2678
2680 {
2681 SetAffectPathgraph( true, false );
2683 }
2684
2686 {
2687 return true;
2688 }
2689
2691 {
2692 return true;
2693 }
2694
2696 {
2697 if ( attachment )
2698 {
2700 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2701
2702 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2703 }
2704
2705 return false;
2706 }
2707
2709 {
2711 }
2712
2713
2715 {
2716 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2717 if (
GetGame().ConfigIsExisting( config_path ) )
2718 {
2720 }
2721 }
2722
2724 {
2725 return true;
2726 }
2727
2729 {
2730 return true;
2731 }
2732
2734 {
2735 return true;
2736 }
2737
2738
2740 {
2742 {
2744 }
2745
2747 }
2748
2750 {
2752 }
2753
2754
2755
2757 {
2758 return super.CanReceiveAttachment(attachment, slotId);
2759 }
2760
2762 {
2763 int attachment_count = GetInventory().AttachmentCount();
2764 if ( attachment_count > 0 )
2765 {
2766 if (
HasBase() && attachment_count == 1 )
2767 {
2768 return false;
2769 }
2770
2771 return true;
2772 }
2773
2774 return false;
2775 }
2776
2778 {
2779 return true;
2780 }
2781
2783 {
2784 return false;
2785 }
2786
2787
2789 {
2790 return false;
2791 }
2792
2794 {
2795 return false;
2796 }
2797
2798
2800 {
2801 return false;
2802 }
2803
2804
2805
2807 {
2808 return true;
2809 }
2810
2812 {
2813 return true;
2814 }
2815
2818 {
2819 return false;
2820 }
2821
2822
2824 {
2825 return true;
2826 }
2827
2828
2830 {
2831 return false;
2832 }
2833
2834
2836 {
2837 return true;
2838 }
2839
2840
2842 {
2843 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2844 {
2845 return false;
2846 }
2847
2848 return true;
2849 }
2850
2852 {
2855
2856 return item;
2857 }
2858
2859
2861 {
2863 {
2864
2866
2867
2870
2872 if ( MemoryPointExists( slot_name + "_min" ) )
2873 {
2874 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2875 }
2876 if ( MemoryPointExists( slot_name + "_max" ) )
2877 {
2878 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2879 }
2880
2881
2884
2885
2888 center = ModelToWorld( center );
2889
2890
2893
2894 areaDamage.SetExtents( extents[0], extents[1] );
2895 areaDamage.SetAreaPosition( center );
2896 areaDamage.SetAreaOrientation( orientation );
2899 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2900 areaDamage.SetAmmoName( "BarbedWireHit" );
2901 areaDamage.Spawn();
2902
2904 }
2905 }
2906
2908 {
2909 if ( angle_deg != 0 )
2910 {
2911
2912 orientation[0] = orientation[0] - angle_deg;
2913
2914
2916 if ( MemoryPointExists( "rotate_axis" ) )
2917 {
2918 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2919 }
2920 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];
2921 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];
2922 center[0] = r_center_x;
2923 center[2] = r_center_z;
2924 }
2925 }
2926
2928 {
2930 {
2933 {
2934 if (areaDamage)
2935 {
2936 areaDamage.Destroy();
2937 }
2938
2940 }
2941 }
2942 }
2943
2945 {
2946 return true;
2947 }
2948
2949
2950
2951
2953 {
2955 }
2956
2958 {
2960 }
2961
2963 {
2965 }
2966
2968 {
2970
2971 switch ( material_type )
2972 {
2978 }
2979
2980 return "";
2981 }
2982
2984 {
2986
2987 switch ( material_type )
2988 {
2994 }
2995
2996 return "";
2997 }
2998
2999
3001 {
3003 {
3004
3006 {
3007 SetHealth(slot_name,"Health",item.GetHealth());
3008 }
3009 }
3010 }
3011
3013 {
3014 return 111;
3015 }
3016
3018 {
3019 super.SetActions();
3020
3024 }
3025
3026
3027
3028
3030 {
3031 }
3032
3035 {
3036 return null;
3037 }
3038
3040 {
3042 }
3043
3045 {
3048
3049 Man p;
3050
3051 #ifdef SERVER
3054 if (players.Count())
3055 p = players[0];
3056 #else
3058 #endif
3059
3061 {
3062 bool excluded = false;
3064 if (excludes)
3065 {
3066 foreach (string exclude : excludes)
3067 {
3069 {
3070 excluded = true;
3071 break;
3072 }
3073 }
3074 }
3075
3076 if (!excluded)
3077 {
3079 }
3080 }
3081
3083 }
3084}
3085
3087{
3088#ifdef BSB_DEBUG
3090#else
3091
3092#endif
3093}
3095{
3096#ifdef BSB_DEBUG_SPAM
3098#else
3099
3100#endif
3101}
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.