1829{
1831
1833
1835
1837
1843
1844
1845
1851
1857
1859
1863
1864
1866 {
1868
1869
1870 RegisterNetSyncVariableInt( "m_SyncParts01" );
1871 RegisterNetSyncVariableInt( "m_SyncParts02" );
1872 RegisterNetSyncVariableInt( "m_SyncParts03" );
1873 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1874 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1875 RegisterNetSyncVariableBool( "m_HasBase" );
1876
1877
1879
1880 if (ConfigIsExisting("hybridAttachments"))
1881 {
1884 }
1885 if (ConfigIsExisting("mountables"))
1886 {
1889 }
1890
1892 }
1893
1895 {
1896 super.EEDelete(parent);
1897
1899 {
1900 areaDamage.Destroy();
1901 }
1902
1903 }
1904
1906 {
1907 return "disableBaseDamage";
1908 }
1909
1911 {
1912 return true;
1913 }
1914
1916 {
1917 return EInventoryIconVisibility.HIDE_VICINITY;
1918 }
1919
1920
1922 {
1924 {
1925 SetSynchDirty();
1926 }
1927 }
1928
1930 {
1932 super.OnVariablesSynchronized();
1933
1935 }
1936
1938 {
1939
1941
1942
1944
1945
1947 }
1948
1949
1951 {
1952
1953 int offset;
1954 int mask;
1955
1956 if ( part_id >= 1 && part_id <= 31 )
1957 {
1958 offset = part_id - 1;
1959 mask = 1 << offset;
1960
1962 }
1963 else if ( part_id >= 32 && part_id <= 62 )
1964 {
1965 offset = ( part_id % 32 );
1966 mask = 1 << offset;
1967
1969 }
1970 else if ( part_id >= 63 && part_id <= 93 )
1971 {
1972 offset = ( part_id % 63 );
1973 mask = 1 << offset;
1974
1976 }
1977 }
1978
1980 {
1981
1982 int offset;
1983 int mask;
1984
1985 if ( part_id >= 1 && part_id <= 31 )
1986 {
1987 offset = part_id - 1;
1988 mask = 1 << offset;
1989
1991 }
1992 else if ( part_id >= 32 && part_id <= 62 )
1993 {
1994 offset = ( part_id % 32 );
1995 mask = 1 << offset;
1996
1998 }
1999 else if ( part_id >= 63 && part_id <= 93 )
2000 {
2001 offset = ( part_id % 63 );
2002 mask = 1 << offset;
2003
2005 }
2006 }
2007
2009 {
2010
2011 int offset;
2012 int mask;
2013
2014 if ( part_id >= 1 && part_id <= 31 )
2015 {
2016 offset = part_id - 1;
2017 mask = 1 << offset;
2018
2020 {
2021 return true;
2022 }
2023 }
2024 else if ( part_id >= 32 && part_id <= 62 )
2025 {
2026 offset = ( part_id % 32 );
2027 mask = 1 << offset;
2028
2030 {
2031 return true;
2032 }
2033 }
2034 else if ( part_id >= 63 && part_id <= 93 )
2035 {
2036 offset = ( part_id % 63 );
2037 mask = 1 << offset;
2038
2040 {
2041 return true;
2042 }
2043 }
2044
2045 return false;
2046 }
2047
2049 {
2052 }
2053
2055 {
2056
2059 }
2060
2062 {
2064 {
2067
2068 switch( build_action_id )
2069 {
2073 }
2074 }
2075 }
2076
2077
2079 {
2081 bool is_base = part.
IsBase();
2084 if ( is_part_built_sync )
2085 {
2087 {
2091
2092 if (is_base)
2093 {
2096 }
2097 }
2098 }
2099 else
2100 {
2102 {
2106
2107 if (is_base)
2108 {
2111 }
2112 }
2113 }
2114
2115
2117 }
2118
2119
2121 {
2124
2125 for ( int i = 0; i < construction_parts.Count(); ++i )
2126 {
2127 string key = construction_parts.GetKey( i );
2130 }
2131
2132
2134 }
2135
2137 {
2140
2141 for ( int i = 0; i < construction_parts.Count(); ++i )
2142 {
2143 string key = construction_parts.GetKey( i );
2145
2146 if ( value.
GetId() ==
id )
2147 {
2148 return value;
2149 }
2150 }
2151
2152 return NULL;
2153 }
2154
2155
2156
2158 {
2160 }
2161
2163 {
2165 }
2166
2168 {
2169 return true;
2170 }
2171
2173 {
2174 return false;
2175 }
2176
2177
2179 {
2182 {
2184 }
2185
2186 return construction_kit;
2187 }
2188
2190 {
2193 {
2195 }
2196 }
2197
2199 {
2201 }
2202
2204 {
2205 return "";
2206 }
2207
2209 {
2212 }
2213
2214
2216 {
2219 }
2220
2221
2223 {
2224 super.OnStoreSave( ctx );
2225
2226
2230
2232 }
2233
2235 {
2236 if ( !super.OnStoreLoad( ctx, version ) )
2237 return false;
2238
2239
2240
2242 {
2244 return false;
2245 }
2247 {
2249 return false;
2250 }
2252 {
2254 return false;
2255 }
2256
2257
2259 {
2261 return false;
2262 }
2263
2264
2265 return true;
2266 }
2267
2269 {
2270 super.AfterStoreLoad();
2271
2273 {
2275 }
2276 }
2277
2279 {
2280
2282
2283
2286
2287
2289 }
2290
2292 {
2293 super.OnCreatePhysics();
2296 }
2297
2299 {
2301 return;
2302
2303 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2304
2306 return;
2307
2309 string part_name = zone;
2311
2313 {
2314 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2315
2316 if ( construction_part && construction.IsPartConstructed( part_name ) )
2317 {
2319 construction.DestroyConnectedParts(part_name);
2320 }
2321
2322
2323 if ( part_name.
Contains(
"barbed") )
2324 {
2325 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2326 if (barbed_wire)
2327 barbed_wire.SetMountedState( false );
2328 }
2329 }
2330 }
2331
2333 {
2335 {
2337 }
2338
2339 super.EEOnAfterLoad();
2340 }
2341
2343 {
2344 super.EEInit();
2345
2346
2348
2349
2350 #ifdef DEVELOPER
2352 #endif
2353 }
2354
2356 {
2357 super.EEItemAttached( item, slot_name );
2358
2362 }
2363
2365 {
2366 super.EEItemDetached( item, slot_name );
2367
2370 }
2371
2372 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2373 {
2376
2379 }
2380
2381
2383 {
2384 return true;
2385 }
2386
2387
2388
2390 {
2392
2393
2394 if (construtionPart.
IsBase())
2395 {
2397
2398
2400 }
2401
2402
2404
2405
2407
2408
2410
2412
2414
2415
2417
2418
2420 }
2421
2423 {
2424
2426 }
2427
2428
2430 {
2433
2434
2436
2437
2439
2440
2442
2443
2445
2447
2448
2450
2451
2453
2454
2455 if (construtionPart.
IsBase())
2456 {
2457
2459 }
2460
2463 }
2464
2466 {
2467
2469 }
2470
2471
2472 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2473 {
2476
2477
2479
2480
2482
2483
2485
2486
2488
2490
2491
2493
2494
2496
2497
2498 if (construtionPart.
IsBase())
2499 {
2500
2502 }
2503
2506 }
2507
2509 {
2510
2512 }
2513
2515 {
2516 bool process = false;
2517
2518
2522
2523 if (process)
2524 {
2525 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2526 {
2528 return;
2529 }
2530
2532 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2533 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2534
2535
2537 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2538 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2539 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2540 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2541 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2542 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2543 mins = minTmp;
2544 maxs = maxTmp;
2545
2546 maxs[1] = maxs[1] + 0.35;
2547
2549 }
2550 }
2551
2553 {
2556
2557
2559 foreach (
EntityAI entity : foundEntities)
2560 {
2563 }
2564 }
2565
2566
2568 {
2570
2574 }
2575
2577 {
2579
2581 {
2583 }
2584 else
2585 {
2587 }
2588
2590 }
2591
2593 {
2595
2597 foreach (
string slotName : attachmentSlots)
2598 {
2600 }
2601
2602
2605 else
2607
2609 }
2610
2612 {
2613 string slotNameMounted = slot_name + "_Mounted";
2614 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2615
2616 if (attachment)
2617 {
2618 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2619 if (barbedWire && barbedWire.IsMounted())
2621 else
2623
2624 if (is_locked)
2625 {
2626 SetAnimationPhase(slotNameMounted, 0);
2627 SetAnimationPhase(slot_name, 1);
2628 }
2629 else
2630 {
2631 SetAnimationPhase(slotNameMounted, 1);
2632 SetAnimationPhase(slot_name, 0);
2633 }
2634 }
2635 else
2636 {
2637 SetAnimationPhase(slotNameMounted, 1);
2638 SetAnimationPhase(slot_name, 1);
2639
2641 }
2642 }
2643
2644
2646 {
2649
2652
2655
2656 foreach (
string slotName : attachmentSlots)
2657 {
2659 }
2660
2661
2663 {
2666
2668 }
2669 else
2670 {
2673
2675 }
2676
2679 }
2680
2682 {
2683
2685 return;
2686
2687 string slot_name_mounted = slot_name + "_Mounted";
2688 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2689
2690
2692 RemoveProxyPhysics( slot_name_mounted );
2693 RemoveProxyPhysics( slot_name );
2694
2695 if ( attachment )
2696 {
2698 if ( is_locked )
2699 {
2701 AddProxyPhysics( slot_name_mounted );
2702 }
2703 else
2704 {
2706 AddProxyPhysics( slot_name );
2707 }
2708 }
2709 }
2710
2712 {
2713 SetAffectPathgraph( true, false );
2715 }
2716
2718 {
2719 return true;
2720 }
2721
2723 {
2724 return true;
2725 }
2726
2728 {
2729 if ( attachment )
2730 {
2732 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2733
2734 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2735 }
2736
2737 return false;
2738 }
2739
2741 {
2743 }
2744
2745
2747 {
2748 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2749 if (
GetGame().ConfigIsExisting( config_path ) )
2750 {
2752 }
2753 }
2754
2756 {
2757 return true;
2758 }
2759
2761 {
2762 return true;
2763 }
2764
2766 {
2767 return true;
2768 }
2769
2770
2772 {
2774 {
2776 }
2777
2779 }
2780
2782 {
2784 }
2785
2786
2787
2789 {
2790 return super.CanReceiveAttachment(attachment, slotId);
2791 }
2792
2794 {
2795 int attachment_count = GetInventory().AttachmentCount();
2796 if ( attachment_count > 0 )
2797 {
2798 if (
HasBase() && attachment_count == 1 )
2799 {
2800 return false;
2801 }
2802
2803 return true;
2804 }
2805
2806 return false;
2807 }
2808
2810 {
2811 return true;
2812 }
2813
2815 {
2816 return false;
2817 }
2818
2819
2821 {
2822 return false;
2823 }
2824
2826 {
2827 return false;
2828 }
2829
2830
2832 {
2833 return false;
2834 }
2835
2836
2837
2839 {
2840 return true;
2841 }
2842
2844 {
2845 return true;
2846 }
2847
2850 {
2851 return false;
2852 }
2853
2854
2856 {
2857 return true;
2858 }
2859
2860
2862 {
2863 return false;
2864 }
2865
2866
2868 {
2869 return true;
2870 }
2871
2872
2874 {
2875 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2876 {
2877 return false;
2878 }
2879
2880 return true;
2881 }
2882
2884 {
2887
2888 return item;
2889 }
2890
2891
2893 {
2895 {
2896
2898
2899
2902
2904 if ( MemoryPointExists( slot_name + "_min" ) )
2905 {
2906 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2907 }
2908 if ( MemoryPointExists( slot_name + "_max" ) )
2909 {
2910 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2911 }
2912
2913
2916
2917
2920 center = ModelToWorld( center );
2921
2922
2925
2926 areaDamage.SetExtents( extents[0], extents[1] );
2927 areaDamage.SetAreaPosition( center );
2928 areaDamage.SetAreaOrientation( orientation );
2931 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2932 areaDamage.SetAmmoName( "BarbedWireHit" );
2933 areaDamage.Spawn();
2934
2936 }
2937 }
2938
2940 {
2941 if ( angle_deg != 0 )
2942 {
2943
2944 orientation[0] = orientation[0] - angle_deg;
2945
2946
2948 if ( MemoryPointExists( "rotate_axis" ) )
2949 {
2950 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2951 }
2952 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];
2953 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];
2954 center[0] = r_center_x;
2955 center[2] = r_center_z;
2956 }
2957 }
2958
2960 {
2962 {
2965 {
2966 if (areaDamage)
2967 {
2968 areaDamage.Destroy();
2969 }
2970
2972 }
2973 }
2974 }
2975
2977 {
2978 return true;
2979 }
2980
2981
2982
2983
2985 {
2987 }
2988
2990 {
2992 }
2993
2995 {
2997 }
2998
3000 {
3002
3003 switch ( material_type )
3004 {
3010 }
3011
3012 return "";
3013 }
3014
3016 {
3018
3019 switch ( material_type )
3020 {
3026 }
3027
3028 return "";
3029 }
3030
3031
3033 {
3035 {
3036
3038 {
3039 SetHealth(slot_name,"Health",item.GetHealth());
3040 }
3041 }
3042 }
3043
3045 {
3046 return 111;
3047 }
3048
3050 {
3051 super.SetActions();
3052
3056 }
3057
3058
3059
3060
3062 {
3063 }
3064
3067 {
3068 return null;
3069 }
3070
3072 {
3074 }
3075
3077 {
3080
3081 Man p;
3082
3083 #ifdef SERVER
3086 if (players.Count())
3087 p = players[0];
3088 #else
3090 #endif
3091
3093 {
3094 bool excluded = false;
3096 if (excludes)
3097 {
3098 foreach (string exclude : excludes)
3099 {
3101 {
3102 excluded = true;
3103 break;
3104 }
3105 }
3106 }
3107
3108 if (!excluded)
3109 {
3111 }
3112 }
3113
3115 }
3116}
3117
3119{
3120#ifdef BSB_DEBUG
3122#else
3123
3124#endif
3125}
3127{
3128#ifdef BSB_DEBUG_SPAM
3130#else
3131
3132#endif
3133}
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.