1837{
1839
1841
1843
1845
1851
1852
1853
1859
1865
1867
1871
1872
1874 {
1876
1877
1878 RegisterNetSyncVariableInt( "m_SyncParts01" );
1879 RegisterNetSyncVariableInt( "m_SyncParts02" );
1880 RegisterNetSyncVariableInt( "m_SyncParts03" );
1881 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1882 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1883 RegisterNetSyncVariableBool( "m_HasBase" );
1884
1885
1887
1888 if (ConfigIsExisting("hybridAttachments"))
1889 {
1892 }
1893 if (ConfigIsExisting("mountables"))
1894 {
1897 }
1898
1900 }
1901
1903 {
1904 super.EEDelete(parent);
1905
1907 {
1908 areaDamage.Destroy();
1909 }
1910
1911 }
1912
1914 {
1915 return "disableBaseDamage";
1916 }
1917
1919 {
1920 return true;
1921 }
1922
1924 {
1925 return EInventoryIconVisibility.HIDE_VICINITY;
1926 }
1927
1928
1930 {
1932 {
1933 SetSynchDirty();
1934 }
1935 }
1936
1938 {
1940 super.OnVariablesSynchronized();
1941
1943 }
1944
1946 {
1947
1949
1950
1952
1953
1955 }
1956
1957
1959 {
1960
1961 int offset;
1962 int mask;
1963
1964 if ( part_id >= 1 && part_id <= 31 )
1965 {
1966 offset = part_id - 1;
1967 mask = 1 << offset;
1968
1970 }
1971 else if ( part_id >= 32 && part_id <= 62 )
1972 {
1973 offset = ( part_id % 32 );
1974 mask = 1 << offset;
1975
1977 }
1978 else if ( part_id >= 63 && part_id <= 93 )
1979 {
1980 offset = ( part_id % 63 );
1981 mask = 1 << offset;
1982
1984 }
1985 }
1986
1988 {
1989
1990 int offset;
1991 int mask;
1992
1993 if ( part_id >= 1 && part_id <= 31 )
1994 {
1995 offset = part_id - 1;
1996 mask = 1 << offset;
1997
1999 }
2000 else if ( part_id >= 32 && part_id <= 62 )
2001 {
2002 offset = ( part_id % 32 );
2003 mask = 1 << offset;
2004
2006 }
2007 else if ( part_id >= 63 && part_id <= 93 )
2008 {
2009 offset = ( part_id % 63 );
2010 mask = 1 << offset;
2011
2013 }
2014 }
2015
2017 {
2018
2019 int offset;
2020 int mask;
2021
2022 if ( part_id >= 1 && part_id <= 31 )
2023 {
2024 offset = part_id - 1;
2025 mask = 1 << offset;
2026
2028 {
2029 return true;
2030 }
2031 }
2032 else if ( part_id >= 32 && part_id <= 62 )
2033 {
2034 offset = ( part_id % 32 );
2035 mask = 1 << offset;
2036
2038 {
2039 return true;
2040 }
2041 }
2042 else if ( part_id >= 63 && part_id <= 93 )
2043 {
2044 offset = ( part_id % 63 );
2045 mask = 1 << offset;
2046
2048 {
2049 return true;
2050 }
2051 }
2052
2053 return false;
2054 }
2055
2057 {
2060 }
2061
2063 {
2064
2067 }
2068
2070 {
2072 {
2075
2076 switch( build_action_id )
2077 {
2081 }
2082 }
2083 }
2084
2085
2087 {
2089 bool is_base = part.
IsBase();
2092 if ( is_part_built_sync )
2093 {
2095 {
2099
2100 if (is_base)
2101 {
2104 }
2105 }
2106 }
2107 else
2108 {
2110 {
2114
2115 if (is_base)
2116 {
2119 }
2120 }
2121 }
2122
2123
2125 }
2126
2127
2129 {
2132
2133 for ( int i = 0; i < construction_parts.Count(); ++i )
2134 {
2135 string key = construction_parts.GetKey( i );
2138 }
2139
2140
2142 }
2143
2145 {
2148
2149 for ( int i = 0; i < construction_parts.Count(); ++i )
2150 {
2151 string key = construction_parts.GetKey( i );
2153
2154 if ( value.
GetId() ==
id )
2155 {
2156 return value;
2157 }
2158 }
2159
2160 return NULL;
2161 }
2162
2163
2164
2166 {
2168 }
2169
2171 {
2173 }
2174
2176 {
2177 return true;
2178 }
2179
2181 {
2182 return false;
2183 }
2184
2185
2187 {
2190 {
2192 }
2193
2194 return construction_kit;
2195 }
2196
2198 {
2201 {
2203 }
2204 }
2205
2207 {
2209 }
2210
2212 {
2213 return "";
2214 }
2215
2217 {
2220 }
2221
2222
2224 {
2227 }
2228
2229
2231 {
2232 super.OnStoreSave( ctx );
2233
2234
2238
2240 }
2241
2243 {
2244 if ( !super.OnStoreLoad( ctx, version ) )
2245 return false;
2246
2247
2248
2250 {
2252 return false;
2253 }
2255 {
2257 return false;
2258 }
2260 {
2262 return false;
2263 }
2264
2265
2267 {
2269 return false;
2270 }
2271
2272
2273 return true;
2274 }
2275
2277 {
2278 super.AfterStoreLoad();
2279
2281 {
2283 }
2284 }
2285
2287 {
2288
2290
2291
2294
2295
2297 }
2298
2300 {
2301 super.OnCreatePhysics();
2304 }
2305
2307 {
2309 return;
2310
2311 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2312
2314 return;
2315
2317 string part_name = zone;
2319
2321 {
2322 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2323
2324 if ( construction_part && construction.IsPartConstructed( part_name ) )
2325 {
2327 construction.DestroyConnectedParts(part_name);
2328 }
2329
2330
2331 if ( part_name.
Contains(
"barbed") )
2332 {
2333 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2334 if (barbed_wire)
2335 barbed_wire.SetMountedState( false );
2336 }
2337 }
2338 }
2339
2341 {
2343 {
2345 }
2346
2347 super.EEOnAfterLoad();
2348 }
2349
2351 {
2352 super.EEInit();
2353
2354
2356
2357
2358 #ifdef DEVELOPER
2360 #endif
2361 }
2362
2364 {
2365 super.EEItemAttached( item, slot_name );
2366
2370 }
2371
2373 {
2374 super.EEItemDetached( item, slot_name );
2375
2378 }
2379
2380 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2381 {
2384
2387 }
2388
2389
2391 {
2392 return true;
2393 }
2394
2395
2396
2398 {
2400
2401
2402 if (construtionPart.
IsBase())
2403 {
2405
2406
2408 }
2409
2410
2412
2413
2415
2416
2418
2420
2422
2423
2425
2426
2428 }
2429
2431 {
2432
2434 }
2435
2436
2438 {
2441
2442
2444
2445
2447
2448
2450
2451
2453
2455
2456
2458
2459
2461
2462
2463 if (construtionPart.
IsBase())
2464 {
2465
2467 }
2468
2471 }
2472
2474 {
2475
2477 }
2478
2479
2480 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2481 {
2484
2485
2487
2488
2490
2491
2493
2494
2496
2498
2499
2501
2502
2504
2505
2506 if (construtionPart.
IsBase())
2507 {
2508
2510 }
2511
2514 }
2515
2517 {
2518
2520 }
2521
2523 {
2524 bool process = false;
2525
2526
2530
2531 if (process)
2532 {
2533 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2534 {
2536 return;
2537 }
2538
2540 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2541 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2542
2543
2545 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2546 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2547 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2548 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2549 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2550 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2551 mins = minTmp;
2552 maxs = maxTmp;
2553
2554 maxs[1] = maxs[1] + 0.35;
2555
2557 }
2558 }
2559
2561 {
2564
2565
2567 foreach (
EntityAI entity : foundEntities)
2568 {
2571 }
2572 }
2573
2574
2576 {
2578
2582 }
2583
2585 {
2587
2589 {
2591 }
2592 else
2593 {
2595 }
2596
2598 }
2599
2601 {
2603
2605 foreach (
string slotName : attachmentSlots)
2606 {
2608 }
2609
2610
2613 else
2615
2617 }
2618
2620 {
2621 string slotNameMounted = slot_name + "_Mounted";
2622 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2623
2624 if (attachment)
2625 {
2626 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2627 if (barbedWire && barbedWire.IsMounted())
2629 else
2631
2632 if (is_locked)
2633 {
2634 SetAnimationPhase(slotNameMounted, 0);
2635 SetAnimationPhase(slot_name, 1);
2636 }
2637 else
2638 {
2639 SetAnimationPhase(slotNameMounted, 1);
2640 SetAnimationPhase(slot_name, 0);
2641 }
2642 }
2643 else
2644 {
2645 SetAnimationPhase(slotNameMounted, 1);
2646 SetAnimationPhase(slot_name, 1);
2647
2649 }
2650 }
2651
2652
2654 {
2657
2660
2663
2664 foreach (
string slotName : attachmentSlots)
2665 {
2667 }
2668
2669
2671 {
2674
2676 }
2677 else
2678 {
2681
2683 }
2684
2687 }
2688
2690 {
2691
2693 return;
2694
2695 string slot_name_mounted = slot_name + "_Mounted";
2696 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2697
2698
2700 RemoveProxyPhysics( slot_name_mounted );
2701 RemoveProxyPhysics( slot_name );
2702
2703 if ( attachment )
2704 {
2706 if ( is_locked )
2707 {
2709 AddProxyPhysics( slot_name_mounted );
2710 }
2711 else
2712 {
2714 AddProxyPhysics( slot_name );
2715 }
2716 }
2717 }
2718
2720 {
2721 SetAffectPathgraph( true, false );
2723 }
2724
2726 {
2727 return true;
2728 }
2729
2731 {
2732 return true;
2733 }
2734
2736 {
2737 if ( attachment )
2738 {
2740 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2741
2742 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2743 }
2744
2745 return false;
2746 }
2747
2749 {
2751 }
2752
2753
2755 {
2756 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2757 if (
GetGame().ConfigIsExisting( config_path ) )
2758 {
2760 }
2761 }
2762
2764 {
2765 return true;
2766 }
2767
2769 {
2770 return true;
2771 }
2772
2774 {
2775 return true;
2776 }
2777
2778
2780 {
2782 {
2784 }
2785
2787 }
2788
2790 {
2792 }
2793
2794
2795
2797 {
2798 return super.CanReceiveAttachment(attachment, slotId);
2799 }
2800
2802 {
2803 int attachment_count = GetInventory().AttachmentCount();
2804 if ( attachment_count > 0 )
2805 {
2806 if (
HasBase() && attachment_count == 1 )
2807 {
2808 return false;
2809 }
2810
2811 return true;
2812 }
2813
2814 return false;
2815 }
2816
2818 {
2819 return true;
2820 }
2821
2823 {
2824 return false;
2825 }
2826
2827
2829 {
2830 return false;
2831 }
2832
2834 {
2835 return false;
2836 }
2837
2838
2840 {
2841 return false;
2842 }
2843
2844
2845
2847 {
2848 return true;
2849 }
2850
2852 {
2853 return true;
2854 }
2855
2858 {
2859 return false;
2860 }
2861
2862
2864 {
2865 return true;
2866 }
2867
2868
2870 {
2871 return false;
2872 }
2873
2874
2876 {
2877 return true;
2878 }
2879
2880
2882 {
2883 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2884 {
2885 return false;
2886 }
2887
2888 return true;
2889 }
2890
2892 {
2895
2896 return item;
2897 }
2898
2899
2901 {
2903 {
2904
2906
2907
2910
2912 if ( MemoryPointExists( slot_name + "_min" ) )
2913 {
2914 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2915 }
2916 if ( MemoryPointExists( slot_name + "_max" ) )
2917 {
2918 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2919 }
2920
2921
2924
2925
2928 center = ModelToWorld( center );
2929
2930
2933
2934 areaDamage.SetExtents( extents[0], extents[1] );
2935 areaDamage.SetAreaPosition( center );
2936 areaDamage.SetAreaOrientation( orientation );
2939 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2940 areaDamage.SetAmmoName( "BarbedWireHit" );
2941 areaDamage.Spawn();
2942
2944 }
2945 }
2946
2948 {
2949 if ( angle_deg != 0 )
2950 {
2951
2952 orientation[0] = orientation[0] - angle_deg;
2953
2954
2956 if ( MemoryPointExists( "rotate_axis" ) )
2957 {
2958 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2959 }
2960 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];
2961 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];
2962 center[0] = r_center_x;
2963 center[2] = r_center_z;
2964 }
2965 }
2966
2968 {
2970 {
2973 {
2974 if (areaDamage)
2975 {
2976 areaDamage.Destroy();
2977 }
2978
2980 }
2981 }
2982 }
2983
2985 {
2986 return true;
2987 }
2988
2989
2990
2991
2993 {
2995 }
2996
2998 {
3000 }
3001
3003 {
3005 }
3006
3008 {
3010
3011 switch ( material_type )
3012 {
3018 }
3019
3020 return "";
3021 }
3022
3024 {
3026
3027 switch ( material_type )
3028 {
3034 }
3035
3036 return "";
3037 }
3038
3039
3041 {
3043 {
3044
3046 {
3047 SetHealth(slot_name,"Health",item.GetHealth());
3048 }
3049 }
3050 }
3051
3053 {
3054 return 111;
3055 }
3056
3058 {
3059 super.SetActions();
3060
3064 }
3065
3066
3067
3068
3070 {
3071 }
3072
3075 {
3076 return null;
3077 }
3078
3080 {
3082 }
3083
3085 {
3088
3089 Man p;
3090
3091 #ifdef SERVER
3094 if (players.Count())
3095 p = players[0];
3096 #else
3098 #endif
3099
3101 {
3102 bool excluded = false;
3104 if (excludes)
3105 {
3106 foreach (string exclude : excludes)
3107 {
3109 {
3110 excluded = true;
3111 break;
3112 }
3113 }
3114 }
3115
3116 if (!excluded)
3117 {
3119 }
3120 }
3121
3123 }
3124}
3125
3127{
3128#ifdef BSB_DEBUG
3130#else
3131
3132#endif
3133}
3135{
3136#ifdef BSB_DEBUG_SPAM
3138#else
3139
3140#endif
3141}
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.