1847{
1849
1851
1853
1855
1861
1862
1863
1869
1875
1877
1881
1882
1884 {
1886
1887
1888 RegisterNetSyncVariableInt( "m_SyncParts01" );
1889 RegisterNetSyncVariableInt( "m_SyncParts02" );
1890 RegisterNetSyncVariableInt( "m_SyncParts03" );
1891 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1892 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1893 RegisterNetSyncVariableBool( "m_HasBase" );
1894
1895
1897
1898 if (ConfigIsExisting("hybridAttachments"))
1899 {
1902 }
1903 if (ConfigIsExisting("mountables"))
1904 {
1907 }
1908
1910 }
1911
1913 {
1914 super.EEDelete(parent);
1915
1917 {
1918 areaDamage.Destroy();
1919 }
1920
1921 }
1922
1924 {
1925 return "disableBaseDamage";
1926 }
1927
1929 {
1930 return true;
1931 }
1932
1934 {
1935 return EInventoryIconVisibility.HIDE_VICINITY;
1936 }
1937
1938
1940 {
1942 {
1943 SetSynchDirty();
1944 }
1945 }
1946
1948 {
1950 super.OnVariablesSynchronized();
1951
1953 }
1954
1956 {
1957
1959
1960
1962
1963
1965 }
1966
1967
1969 {
1970
1971 int offset;
1972 int mask;
1973
1974 if ( part_id >= 1 && part_id <= 31 )
1975 {
1976 offset = part_id - 1;
1977 mask = 1 << offset;
1978
1980 }
1981 else if ( part_id >= 32 && part_id <= 62 )
1982 {
1983 offset = ( part_id % 32 );
1984 mask = 1 << offset;
1985
1987 }
1988 else if ( part_id >= 63 && part_id <= 93 )
1989 {
1990 offset = ( part_id % 63 );
1991 mask = 1 << offset;
1992
1994 }
1995 }
1996
1998 {
1999
2000 int offset;
2001 int mask;
2002
2003 if ( part_id >= 1 && part_id <= 31 )
2004 {
2005 offset = part_id - 1;
2006 mask = 1 << offset;
2007
2009 }
2010 else if ( part_id >= 32 && part_id <= 62 )
2011 {
2012 offset = ( part_id % 32 );
2013 mask = 1 << offset;
2014
2016 }
2017 else if ( part_id >= 63 && part_id <= 93 )
2018 {
2019 offset = ( part_id % 63 );
2020 mask = 1 << offset;
2021
2023 }
2024 }
2025
2027 {
2028
2029 int offset;
2030 int mask;
2031
2032 if ( part_id >= 1 && part_id <= 31 )
2033 {
2034 offset = part_id - 1;
2035 mask = 1 << offset;
2036
2038 {
2039 return true;
2040 }
2041 }
2042 else if ( part_id >= 32 && part_id <= 62 )
2043 {
2044 offset = ( part_id % 32 );
2045 mask = 1 << offset;
2046
2048 {
2049 return true;
2050 }
2051 }
2052 else if ( part_id >= 63 && part_id <= 93 )
2053 {
2054 offset = ( part_id % 63 );
2055 mask = 1 << offset;
2056
2058 {
2059 return true;
2060 }
2061 }
2062
2063 return false;
2064 }
2065
2067 {
2070 }
2071
2073 {
2074
2077 }
2078
2080 {
2082 {
2085
2086 switch( build_action_id )
2087 {
2091 }
2092 }
2093 }
2094
2095
2097 {
2099 bool is_base = part.
IsBase();
2102 if ( is_part_built_sync )
2103 {
2105 {
2109
2110 if (is_base)
2111 {
2114 }
2115 }
2116 }
2117 else
2118 {
2120 {
2124
2125 if (is_base)
2126 {
2129 }
2130 }
2131 }
2132
2133
2135 }
2136
2137
2139 {
2142
2143 for ( int i = 0; i < construction_parts.Count(); ++i )
2144 {
2145 string key = construction_parts.GetKey( i );
2148 }
2149
2150
2152 }
2153
2155 {
2158
2159 for ( int i = 0; i < construction_parts.Count(); ++i )
2160 {
2161 string key = construction_parts.GetKey( i );
2163
2164 if ( value.
GetId() ==
id )
2165 {
2166 return value;
2167 }
2168 }
2169
2170 return NULL;
2171 }
2172
2173
2174
2176 {
2178 }
2179
2181 {
2183 }
2184
2186 {
2187 return true;
2188 }
2189
2191 {
2192 return false;
2193 }
2194
2195
2197 {
2200 {
2202 }
2203
2204 return construction_kit;
2205 }
2206
2208 {
2211 {
2213 }
2214 }
2215
2217 {
2219 }
2220
2222 {
2223 return "";
2224 }
2225
2227 {
2230 }
2231
2232
2234 {
2237 }
2238
2239
2241 {
2242 super.OnStoreSave( ctx );
2243
2244
2248
2250 }
2251
2253 {
2254 if ( !super.OnStoreLoad( ctx, version ) )
2255 return false;
2256
2257
2258
2260 {
2262 return false;
2263 }
2265 {
2267 return false;
2268 }
2270 {
2272 return false;
2273 }
2274
2275
2277 {
2279 return false;
2280 }
2281
2282
2283 return true;
2284 }
2285
2287 {
2288 super.AfterStoreLoad();
2289
2291 {
2293 }
2294 }
2295
2297 {
2298
2300
2301
2304
2305
2307 }
2308
2310 {
2311 super.OnCreatePhysics();
2314 }
2315
2317 {
2319 return;
2320
2321 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2322
2324 return;
2325
2327 string part_name = zone;
2329
2331 {
2332 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2333
2334 if ( construction_part && construction.IsPartConstructed( part_name ) )
2335 {
2337 construction.DestroyConnectedParts(part_name);
2338 }
2339
2340
2341 if ( part_name.
Contains(
"barbed") )
2342 {
2343 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2344 if (barbed_wire)
2345 barbed_wire.SetMountedState( false );
2346 }
2347 }
2348 }
2349
2351 {
2353 {
2355 }
2356
2357 super.EEOnAfterLoad();
2358 }
2359
2361 {
2362 super.EEInit();
2363
2364
2366
2367
2368 #ifdef DEVELOPER
2370 #endif
2371 }
2372
2374 {
2375 super.EEItemAttached( item, slot_name );
2376
2380 }
2381
2383 {
2384 super.EEItemDetached( item, slot_name );
2385
2388 }
2389
2390 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2391 {
2394
2397 }
2398
2399
2401 {
2402 return true;
2403 }
2404
2405
2406
2408 {
2410
2411
2412 if (construtionPart.
IsBase())
2413 {
2415
2416
2418 }
2419
2420
2422
2423
2425
2426
2428
2430
2432
2433
2435
2436
2438 }
2439
2441 {
2442
2444 }
2445
2446
2448 {
2451
2452
2454
2455
2457
2458
2460
2461
2463
2465
2466
2468
2469
2471
2472
2473 if (construtionPart.
IsBase())
2474 {
2475
2477 }
2478
2481 }
2482
2484 {
2485
2487 }
2488
2489
2490 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2491 {
2494
2495
2497
2498
2500
2501
2503
2504
2506
2508
2509
2511
2512
2514
2515
2516 if (construtionPart.
IsBase())
2517 {
2518
2520 }
2521
2524 }
2525
2527 {
2528
2530 }
2531
2533 {
2534 bool process = false;
2535
2536
2540
2541 if (process)
2542 {
2543 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2544 {
2546 return;
2547 }
2548
2550 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2551 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2552
2553
2555 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2556 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2557 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2558 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2559 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2560 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2561 mins = minTmp;
2562 maxs = maxTmp;
2563
2564 maxs[1] = maxs[1] + 0.35;
2565
2567 }
2568 }
2569
2571 {
2574
2575
2577 foreach (
EntityAI entity : foundEntities)
2578 {
2581 }
2582 }
2583
2584
2586 {
2588
2592 }
2593
2595 {
2597
2599 {
2601 }
2602 else
2603 {
2605 }
2606
2608 }
2609
2611 {
2613
2615 foreach (
string slotName : attachmentSlots)
2616 {
2618 }
2619
2620
2623 else
2625
2627 }
2628
2630 {
2631 string slotNameMounted = slot_name + "_Mounted";
2632 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2633
2634 if (attachment)
2635 {
2636 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2637 if (barbedWire && barbedWire.IsMounted())
2639 else
2641
2642 if (is_locked)
2643 {
2644 SetAnimationPhase(slotNameMounted, 0);
2645 SetAnimationPhase(slot_name, 1);
2646 }
2647 else
2648 {
2649 SetAnimationPhase(slotNameMounted, 1);
2650 SetAnimationPhase(slot_name, 0);
2651 }
2652 }
2653 else
2654 {
2655 SetAnimationPhase(slotNameMounted, 1);
2656 SetAnimationPhase(slot_name, 1);
2657
2659 }
2660 }
2661
2662
2664 {
2667
2670
2673
2674 foreach (
string slotName : attachmentSlots)
2675 {
2677 }
2678
2679
2681 {
2684
2686 }
2687 else
2688 {
2691
2693 }
2694
2697 }
2698
2700 {
2701
2703 return;
2704
2705 string slot_name_mounted = slot_name + "_Mounted";
2706 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2707
2708
2710 RemoveProxyPhysics( slot_name_mounted );
2711 RemoveProxyPhysics( slot_name );
2712
2713 if ( attachment )
2714 {
2716 if ( is_locked )
2717 {
2719 AddProxyPhysics( slot_name_mounted );
2720 }
2721 else
2722 {
2724 AddProxyPhysics( slot_name );
2725 }
2726 }
2727 }
2728
2730 {
2731 SetAffectPathgraph( true, false );
2733 }
2734
2736 {
2737 return true;
2738 }
2739
2741 {
2742 return true;
2743 }
2744
2746 {
2747 if ( attachment )
2748 {
2750 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2751
2752 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2753 }
2754
2755 return false;
2756 }
2757
2759 {
2761 }
2762
2763
2765 {
2766 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2767 if (
GetGame().ConfigIsExisting( config_path ) )
2768 {
2770 }
2771 }
2772
2774 {
2775 return true;
2776 }
2777
2779 {
2780 return true;
2781 }
2782
2784 {
2785 return true;
2786 }
2787
2788
2790 {
2792 {
2794 }
2795
2797 }
2798
2800 {
2802 }
2803
2804
2805
2807 {
2808 return super.CanReceiveAttachment(attachment, slotId);
2809 }
2810
2812 {
2813 int attachment_count = GetInventory().AttachmentCount();
2814 if ( attachment_count > 0 )
2815 {
2816 if (
HasBase() && attachment_count == 1 )
2817 {
2818 return false;
2819 }
2820
2821 return true;
2822 }
2823
2824 return false;
2825 }
2826
2828 {
2829 return true;
2830 }
2831
2833 {
2834 return false;
2835 }
2836
2837
2839 {
2840 return false;
2841 }
2842
2844 {
2845 return false;
2846 }
2847
2848
2850 {
2851 return false;
2852 }
2853
2854
2855
2857 {
2858 return true;
2859 }
2860
2862 {
2863 return true;
2864 }
2865
2868 {
2869 return false;
2870 }
2871
2872
2874 {
2875 return true;
2876 }
2877
2878
2880 {
2881 return false;
2882 }
2883
2884
2886 {
2887 return true;
2888 }
2889
2890
2892 {
2893 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2894 {
2895 return false;
2896 }
2897
2898 return true;
2899 }
2900
2902 {
2905
2906 return item;
2907 }
2908
2909
2911 {
2913 {
2914
2916
2917
2920
2922 if ( MemoryPointExists( slot_name + "_min" ) )
2923 {
2924 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2925 }
2926 if ( MemoryPointExists( slot_name + "_max" ) )
2927 {
2928 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2929 }
2930
2931
2934
2935
2938 center = ModelToWorld( center );
2939
2940
2943
2944 areaDamage.SetExtents( extents[0], extents[1] );
2945 areaDamage.SetAreaPosition( center );
2946 areaDamage.SetAreaOrientation( orientation );
2949 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2950 areaDamage.SetAmmoName( "BarbedWireHit" );
2951 areaDamage.Spawn();
2952
2954 }
2955 }
2956
2958 {
2959 if ( angle_deg != 0 )
2960 {
2961
2962 orientation[0] = orientation[0] - angle_deg;
2963
2964
2966 if ( MemoryPointExists( "rotate_axis" ) )
2967 {
2968 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2969 }
2970 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];
2971 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];
2972 center[0] = r_center_x;
2973 center[2] = r_center_z;
2974 }
2975 }
2976
2978 {
2980 {
2983 {
2984 if (areaDamage)
2985 {
2986 areaDamage.Destroy();
2987 }
2988
2990 }
2991 }
2992 }
2993
2995 {
2996 return true;
2997 }
2998
2999
3000
3001
3003 {
3005 }
3006
3008 {
3010 }
3011
3013 {
3015 }
3016
3018 {
3020
3021 switch ( material_type )
3022 {
3028 }
3029
3030 return "";
3031 }
3032
3034 {
3036
3037 switch ( material_type )
3038 {
3044 }
3045
3046 return "";
3047 }
3048
3049
3051 {
3053 {
3054
3056 {
3057 SetHealth(slot_name,"Health",item.GetHealth());
3058 }
3059 }
3060 }
3061
3063 {
3064 return 111;
3065 }
3066
3068 {
3069 super.SetActions();
3070
3074 }
3075
3076
3077
3078
3080 {
3081 }
3082
3085 {
3086 return null;
3087 }
3088
3090 {
3092 }
3093
3095 {
3098
3099 Man p;
3100
3101 #ifdef SERVER
3104 if (players.Count())
3105 p = players[0];
3106 #else
3108 #endif
3109
3111 {
3112 bool excluded = false;
3114 if (excludes)
3115 {
3116 foreach (string exclude : excludes)
3117 {
3119 {
3120 excluded = true;
3121 break;
3122 }
3123 }
3124 }
3125
3126 if (!excluded)
3127 {
3129 }
3130 }
3131
3133 }
3134}
3135
3137{
3138#ifdef BSB_DEBUG
3140#else
3141
3142#endif
3143}
3145{
3146#ifdef BSB_DEBUG_SPAM
3148#else
3149
3150#endif
3151}
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.