1854{
1856
1858
1860
1862
1868
1869
1870
1876
1882
1884
1888
1889
1891 {
1893
1894
1895 RegisterNetSyncVariableInt( "m_SyncParts01" );
1896 RegisterNetSyncVariableInt( "m_SyncParts02" );
1897 RegisterNetSyncVariableInt( "m_SyncParts03" );
1898 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1899 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1900 RegisterNetSyncVariableBool( "m_HasBase" );
1901
1902
1904
1905 if (ConfigIsExisting("hybridAttachments"))
1906 {
1909 }
1910 if (ConfigIsExisting("mountables"))
1911 {
1914 }
1915
1917 }
1918
1920 {
1921 super.EEDelete(parent);
1922
1924 {
1925 areaDamage.Destroy();
1926 }
1927
1928 }
1929
1931 {
1932 return "disableBaseDamage";
1933 }
1934
1936 {
1937 return true;
1938 }
1939
1941 {
1942 return EInventoryIconVisibility.HIDE_VICINITY;
1943 }
1944
1945
1947 {
1949 {
1950 SetSynchDirty();
1951 }
1952 }
1953
1955 {
1957 super.OnVariablesSynchronized();
1958
1960 }
1961
1963 {
1964
1966
1967
1969
1970
1972 }
1973
1974
1976 {
1977
1978 int offset;
1979 int mask;
1980
1981 if ( part_id >= 1 && part_id <= 31 )
1982 {
1983 offset = part_id - 1;
1984 mask = 1 << offset;
1985
1987 }
1988 else if ( part_id >= 32 && part_id <= 62 )
1989 {
1990 offset = ( part_id % 32 );
1991 mask = 1 << offset;
1992
1994 }
1995 else if ( part_id >= 63 && part_id <= 93 )
1996 {
1997 offset = ( part_id % 63 );
1998 mask = 1 << offset;
1999
2001 }
2002 }
2003
2005 {
2006
2007 int offset;
2008 int mask;
2009
2010 if ( part_id >= 1 && part_id <= 31 )
2011 {
2012 offset = part_id - 1;
2013 mask = 1 << offset;
2014
2016 }
2017 else if ( part_id >= 32 && part_id <= 62 )
2018 {
2019 offset = ( part_id % 32 );
2020 mask = 1 << offset;
2021
2023 }
2024 else if ( part_id >= 63 && part_id <= 93 )
2025 {
2026 offset = ( part_id % 63 );
2027 mask = 1 << offset;
2028
2030 }
2031 }
2032
2034 {
2035
2036 int offset;
2037 int mask;
2038
2039 if ( part_id >= 1 && part_id <= 31 )
2040 {
2041 offset = part_id - 1;
2042 mask = 1 << offset;
2043
2045 {
2046 return true;
2047 }
2048 }
2049 else if ( part_id >= 32 && part_id <= 62 )
2050 {
2051 offset = ( part_id % 32 );
2052 mask = 1 << offset;
2053
2055 {
2056 return true;
2057 }
2058 }
2059 else if ( part_id >= 63 && part_id <= 93 )
2060 {
2061 offset = ( part_id % 63 );
2062 mask = 1 << offset;
2063
2065 {
2066 return true;
2067 }
2068 }
2069
2070 return false;
2071 }
2072
2074 {
2077 }
2078
2080 {
2081
2084 }
2085
2087 {
2089 {
2092
2093 switch( build_action_id )
2094 {
2098 }
2099 }
2100 }
2101
2102
2104 {
2106 bool is_base = part.
IsBase();
2109 if ( is_part_built_sync )
2110 {
2112 {
2116
2117 if (is_base)
2118 {
2121 }
2122 }
2123 }
2124 else
2125 {
2127 {
2131
2132 if (is_base)
2133 {
2136 }
2137 }
2138 }
2139
2140
2142 }
2143
2144
2146 {
2149
2150 for ( int i = 0; i < construction_parts.Count(); ++i )
2151 {
2152 string key = construction_parts.GetKey( i );
2155 }
2156
2157
2159 }
2160
2162 {
2165
2166 for ( int i = 0; i < construction_parts.Count(); ++i )
2167 {
2168 string key = construction_parts.GetKey( i );
2170
2171 if ( value.
GetId() ==
id )
2172 {
2173 return value;
2174 }
2175 }
2176
2177 return NULL;
2178 }
2179
2180
2181
2183 {
2185 }
2186
2188 {
2190 }
2191
2193 {
2194 return true;
2195 }
2196
2198 {
2199 return false;
2200 }
2201
2202
2204 {
2207 {
2209 }
2210
2211 return construction_kit;
2212 }
2213
2215 {
2218 {
2220 }
2221 }
2222
2224 {
2226 }
2227
2229 {
2230 return "";
2231 }
2232
2234 {
2237 }
2238
2239
2241 {
2244 }
2245
2246
2248 {
2249 super.OnStoreSave( ctx );
2250
2251
2255
2257 }
2258
2260 {
2261 if ( !super.OnStoreLoad( ctx, version ) )
2262 return false;
2263
2264
2265
2267 {
2269 return false;
2270 }
2272 {
2274 return false;
2275 }
2277 {
2279 return false;
2280 }
2281
2282
2284 {
2286 return false;
2287 }
2288
2289
2290 return true;
2291 }
2292
2294 {
2295 super.AfterStoreLoad();
2296
2298 {
2300 }
2301 }
2302
2304 {
2305
2307
2308
2311
2312
2314 }
2315
2317 {
2318 super.OnCreatePhysics();
2321 }
2322
2324 {
2326 return;
2327
2328 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2329
2331 return;
2332
2334 string part_name = zone;
2336
2338 {
2339 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2340
2341 if ( construction_part && construction.IsPartConstructed( part_name ) )
2342 {
2344 construction.DestroyConnectedParts(part_name);
2345 }
2346
2347
2348 if ( part_name.
Contains(
"barbed") )
2349 {
2350 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2351 if (barbed_wire)
2352 barbed_wire.SetMountedState( false );
2353 }
2354 }
2355 }
2356
2358 {
2360 {
2362 }
2363
2364 super.EEOnAfterLoad();
2365 }
2366
2368 {
2369 super.EEInit();
2370
2371
2373
2374
2375 #ifdef DEVELOPER
2377 #endif
2378 }
2379
2381 {
2382 super.EEItemAttached( item, slot_name );
2383
2387 }
2388
2390 {
2391 super.EEItemDetached( item, slot_name );
2392
2395 }
2396
2397 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2398 {
2401
2404 }
2405
2406
2408 {
2409 return true;
2410 }
2411
2412
2413
2415 {
2417
2418
2419 if (construtionPart.
IsBase())
2420 {
2422
2423
2425 }
2426
2427
2429
2430
2432
2433
2435
2437
2439
2440
2442
2443
2445 }
2446
2448 {
2449
2451 }
2452
2453
2455 {
2458
2459
2461
2462
2464
2465
2467
2468
2470
2472
2473
2475
2476
2478
2479
2480 if (construtionPart.
IsBase())
2481 {
2482
2484 }
2485
2488 }
2489
2491 {
2492
2494 }
2495
2496
2497 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2498 {
2501
2502
2504
2505
2507
2508
2510
2511
2513
2515
2516
2518
2519
2521
2522
2523 if (construtionPart.
IsBase())
2524 {
2525
2527 }
2528
2531 }
2532
2534 {
2535
2537 }
2538
2540 {
2541 bool process = false;
2542
2543
2547
2548 if (process)
2549 {
2550 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2551 {
2553 return;
2554 }
2555
2557 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2558 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2559
2560
2562 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2563 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2564 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2565 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2566 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2567 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2568 mins = minTmp;
2569 maxs = maxTmp;
2570
2571 maxs[1] = maxs[1] + 0.35;
2572
2574 }
2575 }
2576
2578 {
2581
2582
2584 foreach (
EntityAI entity : foundEntities)
2585 {
2588 }
2589 }
2590
2591
2593 {
2595
2599 }
2600
2602 {
2604
2606 {
2608 }
2609 else
2610 {
2612 }
2613
2615 }
2616
2618 {
2620
2622 foreach (
string slotName : attachmentSlots)
2623 {
2625 }
2626
2627
2630 else
2632
2634 }
2635
2637 {
2638 string slotNameMounted = slot_name + "_Mounted";
2639 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2640
2641 if (attachment)
2642 {
2643 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2644 if (barbedWire && barbedWire.IsMounted())
2646 else
2648
2649 if (is_locked)
2650 {
2651 SetAnimationPhase(slotNameMounted, 0);
2652 SetAnimationPhase(slot_name, 1);
2653 }
2654 else
2655 {
2656 SetAnimationPhase(slotNameMounted, 1);
2657 SetAnimationPhase(slot_name, 0);
2658 }
2659 }
2660 else
2661 {
2662 SetAnimationPhase(slotNameMounted, 1);
2663 SetAnimationPhase(slot_name, 1);
2664
2666 }
2667 }
2668
2669
2671 {
2674
2677
2680
2681 foreach (
string slotName : attachmentSlots)
2682 {
2684 }
2685
2686
2688 {
2691
2693 }
2694 else
2695 {
2698
2700 }
2701
2704 }
2705
2707 {
2708
2710 return;
2711
2712 string slot_name_mounted = slot_name + "_Mounted";
2713 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2714
2715
2717 RemoveProxyPhysics( slot_name_mounted );
2718 RemoveProxyPhysics( slot_name );
2719
2720 if ( attachment )
2721 {
2723 if ( is_locked )
2724 {
2726 AddProxyPhysics( slot_name_mounted );
2727 }
2728 else
2729 {
2731 AddProxyPhysics( slot_name );
2732 }
2733 }
2734 }
2735
2737 {
2738 SetAffectPathgraph( true, false );
2740 }
2741
2743 {
2744 return true;
2745 }
2746
2748 {
2749 return true;
2750 }
2751
2753 {
2754 if ( attachment )
2755 {
2757 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2758
2759 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2760 }
2761
2762 return false;
2763 }
2764
2766 {
2768 }
2769
2770
2772 {
2773 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2774 if (
GetGame().ConfigIsExisting( config_path ) )
2775 {
2777 }
2778 }
2779
2781 {
2782 return true;
2783 }
2784
2786 {
2787 return true;
2788 }
2789
2791 {
2792 return true;
2793 }
2794
2795
2797 {
2799 {
2801 }
2802
2804 }
2805
2807 {
2809 }
2810
2811
2812
2814 {
2815 return super.CanReceiveAttachment(attachment, slotId);
2816 }
2817
2819 {
2820 int attachment_count = GetInventory().AttachmentCount();
2821 if ( attachment_count > 0 )
2822 {
2823 if (
HasBase() && attachment_count == 1 )
2824 {
2825 return false;
2826 }
2827
2828 return true;
2829 }
2830
2831 return false;
2832 }
2833
2835 {
2836 return true;
2837 }
2838
2840 {
2841 return false;
2842 }
2843
2844
2846 {
2847 return false;
2848 }
2849
2851 {
2852 return false;
2853 }
2854
2855
2857 {
2858 return false;
2859 }
2860
2861
2862
2864 {
2865 return true;
2866 }
2867
2869 {
2870 return true;
2871 }
2872
2875 {
2876 return false;
2877 }
2878
2879
2881 {
2882 return true;
2883 }
2884
2885
2887 {
2888 return false;
2889 }
2890
2891
2893 {
2894 return true;
2895 }
2896
2897
2899 {
2900 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2901 {
2902 return false;
2903 }
2904
2905 return true;
2906 }
2907
2909 {
2912
2913 return item;
2914 }
2915
2916
2918 {
2920 {
2921
2923
2924
2927
2929 if ( MemoryPointExists( slot_name + "_min" ) )
2930 {
2931 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2932 }
2933 if ( MemoryPointExists( slot_name + "_max" ) )
2934 {
2935 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2936 }
2937
2938
2941
2942
2945 center = ModelToWorld( center );
2946
2947
2950
2951 areaDamage.SetExtents( extents[0], extents[1] );
2952 areaDamage.SetAreaPosition( center );
2953 areaDamage.SetAreaOrientation( orientation );
2956 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2957 areaDamage.SetAmmoName( "BarbedWireHit" );
2958 areaDamage.Spawn();
2959
2961 }
2962 }
2963
2965 {
2966 if ( angle_deg != 0 )
2967 {
2968
2969 orientation[0] = orientation[0] - angle_deg;
2970
2971
2973 if ( MemoryPointExists( "rotate_axis" ) )
2974 {
2975 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2976 }
2977 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];
2978 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];
2979 center[0] = r_center_x;
2980 center[2] = r_center_z;
2981 }
2982 }
2983
2985 {
2987 {
2990 {
2991 if (areaDamage)
2992 {
2993 areaDamage.Destroy();
2994 }
2995
2997 }
2998 }
2999 }
3000
3002 {
3003 return true;
3004 }
3005
3006
3007
3008
3010 {
3012 }
3013
3015 {
3017 }
3018
3020 {
3022 }
3023
3025 {
3027
3028 switch ( material_type )
3029 {
3035 }
3036
3037 return "";
3038 }
3039
3041 {
3043
3044 switch ( material_type )
3045 {
3051 }
3052
3053 return "";
3054 }
3055
3056
3058 {
3060 {
3061
3063 {
3064 SetHealth(slot_name,"Health",item.GetHealth());
3065 }
3066 }
3067 }
3068
3070 {
3071 return 111;
3072 }
3073
3075 {
3076 super.SetActions();
3077
3081 }
3082
3083
3084
3085
3087 {
3088 }
3089
3092 {
3093 return null;
3094 }
3095
3097 {
3099 }
3100
3102 {
3105
3106 Man p;
3107
3108 #ifdef SERVER
3111 if (players.Count())
3112 p = players[0];
3113 #else
3115 #endif
3116
3118 {
3119 bool excluded = false;
3121 if (excludes)
3122 {
3123 foreach (string exclude : excludes)
3124 {
3126 {
3127 excluded = true;
3128 break;
3129 }
3130 }
3131 }
3132
3133 if (!excluded)
3134 {
3136 }
3137 }
3138
3140 }
3141}
3142
3144{
3145#ifdef BSB_DEBUG
3147#else
3148
3149#endif
3150}
3152{
3153#ifdef BSB_DEBUG_SPAM
3155#else
3156
3157#endif
3158}
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.