1887{
1889
1891
1893
1895
1901
1902
1903
1909
1915
1917
1921
1922
1924 {
1926
1927
1928 RegisterNetSyncVariableInt( "m_SyncParts01" );
1929 RegisterNetSyncVariableInt( "m_SyncParts02" );
1930 RegisterNetSyncVariableInt( "m_SyncParts03" );
1931 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1932 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1933 RegisterNetSyncVariableBool( "m_HasBase" );
1934
1935
1937
1938 if (ConfigIsExisting("hybridAttachments"))
1939 {
1942 }
1943 if (ConfigIsExisting("mountables"))
1944 {
1947 }
1948
1950 }
1951
1953 {
1954 super.EEDelete(parent);
1955
1957 {
1958 areaDamage.Destroy();
1959 }
1960
1961 }
1962
1964 {
1965 return "disableBaseDamage";
1966 }
1967
1969 {
1970 return true;
1971 }
1972
1974 {
1975 return EInventoryIconVisibility.HIDE_VICINITY;
1976 }
1977
1978
1980 {
1982 {
1983 SetSynchDirty();
1984 }
1985 }
1986
1988 {
1990 super.OnVariablesSynchronized();
1991
1993 }
1994
1996 {
1997
1999
2000
2002
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 else if ( part_id >= 32 && part_id <= 62 )
2022 {
2023 offset = ( part_id % 32 );
2024 mask = 1 << offset;
2025
2027 }
2028 else if ( part_id >= 63 && part_id <= 93 )
2029 {
2030 offset = ( part_id % 63 );
2031 mask = 1 << offset;
2032
2034 }
2035 }
2036
2038 {
2039
2040 int offset;
2041 int mask;
2042
2043 if ( part_id >= 1 && part_id <= 31 )
2044 {
2045 offset = part_id - 1;
2046 mask = 1 << offset;
2047
2049 }
2050 else if ( part_id >= 32 && part_id <= 62 )
2051 {
2052 offset = ( part_id % 32 );
2053 mask = 1 << offset;
2054
2056 }
2057 else if ( part_id >= 63 && part_id <= 93 )
2058 {
2059 offset = ( part_id % 63 );
2060 mask = 1 << offset;
2061
2063 }
2064 }
2065
2067 {
2068
2069 int offset;
2070 int mask;
2071
2072 if ( part_id >= 1 && part_id <= 31 )
2073 {
2074 offset = part_id - 1;
2075 mask = 1 << offset;
2076
2078 {
2079 return true;
2080 }
2081 }
2082 else if ( part_id >= 32 && part_id <= 62 )
2083 {
2084 offset = ( part_id % 32 );
2085 mask = 1 << offset;
2086
2088 {
2089 return true;
2090 }
2091 }
2092 else if ( part_id >= 63 && part_id <= 93 )
2093 {
2094 offset = ( part_id % 63 );
2095 mask = 1 << offset;
2096
2098 {
2099 return true;
2100 }
2101 }
2102
2103 return false;
2104 }
2105
2107 {
2110 }
2111
2113 {
2114
2117 }
2118
2120 {
2122 {
2125
2126 switch( build_action_id )
2127 {
2131 }
2132 }
2133 }
2134
2135
2137 {
2139 bool is_base = part.
IsBase();
2142 if ( is_part_built_sync )
2143 {
2145 {
2149
2150 if (is_base)
2151 {
2154 }
2155 }
2156 }
2157 else
2158 {
2160 {
2164
2165 if (is_base)
2166 {
2169 }
2170 }
2171 }
2172
2173
2175 }
2176
2177
2179 {
2182
2183 for ( int i = 0; i < construction_parts.Count(); ++i )
2184 {
2185 string key = construction_parts.GetKey( i );
2188 }
2189
2190
2192 }
2193
2195 {
2198
2199 for ( int i = 0; i < construction_parts.Count(); ++i )
2200 {
2201 string key = construction_parts.GetKey( i );
2203
2204 if ( value.
GetId() ==
id )
2205 {
2206 return value;
2207 }
2208 }
2209
2210 return NULL;
2211 }
2212
2213
2214
2216 {
2218 }
2219
2221 {
2223 }
2224
2226 {
2227 return true;
2228 }
2229
2231 {
2232 return false;
2233 }
2234
2235
2237 {
2240 {
2242 }
2243
2244 return construction_kit;
2245 }
2246
2248 {
2251 {
2253 }
2254 }
2255
2257 {
2259 }
2260
2262 {
2263 return "";
2264 }
2265
2267 {
2270 }
2271
2272
2274 {
2277 }
2278
2279
2281 {
2282 super.OnStoreSave( ctx );
2283
2284
2288
2290 }
2291
2293 {
2294 if ( !super.OnStoreLoad( ctx, version ) )
2295 return false;
2296
2297
2298
2300 {
2302 return false;
2303 }
2305 {
2307 return false;
2308 }
2310 {
2312 return false;
2313 }
2314
2315
2317 {
2319 return false;
2320 }
2321
2322
2323 return true;
2324 }
2325
2327 {
2328 super.AfterStoreLoad();
2329
2331 {
2333 }
2334 }
2335
2337 {
2338
2340
2341
2344
2345
2347 }
2348
2350 {
2351 super.OnCreatePhysics();
2354 }
2355
2357 {
2359 return;
2360
2361 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2362
2364 return;
2365
2367 string part_name = zone;
2369
2371 {
2372 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2373
2374 if ( construction_part && construction.IsPartConstructed( part_name ) )
2375 {
2377 construction.DestroyConnectedParts(part_name);
2378 }
2379
2380
2381 if ( part_name.
Contains(
"barbed") )
2382 {
2383 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2384 if (barbed_wire)
2385 barbed_wire.SetMountedState( false );
2386 }
2387 }
2388 }
2389
2391 {
2393 {
2395 }
2396
2397 super.EEOnAfterLoad();
2398 }
2399
2401 {
2402 super.EEInit();
2403
2404
2406
2407
2408 #ifdef DEVELOPER
2410 #endif
2411 }
2412
2414 {
2415 super.EEItemAttached( item, slot_name );
2416
2420 }
2421
2423 {
2424 super.EEItemDetached( item, slot_name );
2425
2428 }
2429
2430 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2431 {
2434
2437 }
2438
2439
2441 {
2442 return true;
2443 }
2444
2445
2446
2448 {
2450
2451
2452 if (construtionPart.
IsBase())
2453 {
2455
2456
2458 }
2459
2460
2462
2463
2465
2466
2468
2470
2472
2473
2475
2476
2478 }
2479
2481 {
2482
2484 }
2485
2486
2488 {
2491
2492
2494
2495
2497
2498
2500
2501
2503
2505
2506
2508
2509
2511
2512
2513 if (construtionPart.
IsBase())
2514 {
2515
2517 }
2518
2521 }
2522
2524 {
2525
2527 }
2528
2529
2530 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2531 {
2534
2535
2537
2538
2540
2541
2543
2544
2546
2548
2549
2551
2552
2554
2555
2556 if (construtionPart.
IsBase())
2557 {
2558
2560 }
2561
2564 }
2565
2567 {
2568
2570 }
2571
2573 {
2574 bool process = false;
2575
2576
2580
2581 if (process)
2582 {
2583 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2584 {
2586 return;
2587 }
2588
2590 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2591 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2592
2593
2595 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2596 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2597 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2598 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2599 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2600 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2601 mins = minTmp;
2602 maxs = maxTmp;
2603
2604 maxs[1] = maxs[1] + 0.35;
2605
2607 }
2608 }
2609
2611 {
2614
2615
2617 foreach (
EntityAI entity : foundEntities)
2618 {
2621 }
2622 }
2623
2624
2626 {
2628
2632 }
2633
2635 {
2637
2639 {
2641 }
2642 else
2643 {
2645 }
2646
2648 }
2649
2651 {
2653
2655 foreach (
string slotName : attachmentSlots)
2656 {
2658 }
2659
2660
2663 else
2665
2667 }
2668
2670 {
2671 string slotNameMounted = slot_name + "_Mounted";
2672 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2673
2674 if (attachment)
2675 {
2676 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2677 if (barbedWire && barbedWire.IsMounted())
2679 else
2681
2682 if (is_locked)
2683 {
2684 SetAnimationPhase(slotNameMounted, 0);
2685 SetAnimationPhase(slot_name, 1);
2686 }
2687 else
2688 {
2689 SetAnimationPhase(slotNameMounted, 1);
2690 SetAnimationPhase(slot_name, 0);
2691 }
2692 }
2693 else
2694 {
2695 SetAnimationPhase(slotNameMounted, 1);
2696 SetAnimationPhase(slot_name, 1);
2697
2699 }
2700 }
2701
2702
2704 {
2707
2710
2713
2714 foreach (
string slotName : attachmentSlots)
2715 {
2717 }
2718
2719
2721 {
2724
2726 }
2727 else
2728 {
2731
2733 }
2734
2737 }
2738
2740 {
2741
2743 return;
2744
2745 string slot_name_mounted = slot_name + "_Mounted";
2746 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2747
2748
2750 RemoveProxyPhysics( slot_name_mounted );
2751 RemoveProxyPhysics( slot_name );
2752
2753 if ( attachment )
2754 {
2756 if ( is_locked )
2757 {
2759 AddProxyPhysics( slot_name_mounted );
2760 }
2761 else
2762 {
2764 AddProxyPhysics( slot_name );
2765 }
2766 }
2767 }
2768
2770 {
2771 SetAffectPathgraph( true, false );
2773 }
2774
2776 {
2777 return true;
2778 }
2779
2781 {
2782 return true;
2783 }
2784
2786 {
2787 if ( attachment )
2788 {
2790 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2791
2792 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2793 }
2794
2795 return false;
2796 }
2797
2799 {
2801 }
2802
2803
2805 {
2806 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2807 if (
GetGame().ConfigIsExisting( config_path ) )
2808 {
2810 }
2811 }
2812
2814 {
2815 return true;
2816 }
2817
2819 {
2820 return true;
2821 }
2822
2824 {
2825 return true;
2826 }
2827
2828
2830 {
2832 {
2834 }
2835
2837 }
2838
2840 {
2842 }
2843
2844
2845
2847 {
2848 return super.CanReceiveAttachment(attachment, slotId);
2849 }
2850
2852 {
2853 int attachment_count = GetInventory().AttachmentCount();
2854 if ( attachment_count > 0 )
2855 {
2856 if (
HasBase() && attachment_count == 1 )
2857 {
2858 return false;
2859 }
2860
2861 return true;
2862 }
2863
2864 return false;
2865 }
2866
2868 {
2869 return true;
2870 }
2871
2873 {
2874 return false;
2875 }
2876
2877
2879 {
2880 return false;
2881 }
2882
2884 {
2885 return false;
2886 }
2887
2888
2890 {
2891 return false;
2892 }
2893
2894
2895
2897 {
2898 return true;
2899 }
2900
2902 {
2903 return true;
2904 }
2905
2908 {
2909 return false;
2910 }
2911
2912
2914 {
2915 return true;
2916 }
2917
2918
2920 {
2921 return false;
2922 }
2923
2924
2926 {
2927 return true;
2928 }
2929
2930
2932 {
2933 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2934 {
2935 return false;
2936 }
2937
2938 return true;
2939 }
2940
2942 {
2945
2946 return item;
2947 }
2948
2949
2951 {
2953 {
2954
2956
2957
2960
2962 if ( MemoryPointExists( slot_name + "_min" ) )
2963 {
2964 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2965 }
2966 if ( MemoryPointExists( slot_name + "_max" ) )
2967 {
2968 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2969 }
2970
2971
2974
2975
2978 center = ModelToWorld( center );
2979
2980
2983
2984 areaDamage.SetExtents( extents[0], extents[1] );
2985 areaDamage.SetAreaPosition( center );
2986 areaDamage.SetAreaOrientation( orientation );
2989 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2990 areaDamage.SetAmmoName( "BarbedWireHit" );
2991 areaDamage.Spawn();
2992
2994 }
2995 }
2996
2998 {
2999 if ( angle_deg != 0 )
3000 {
3001
3002 orientation[0] = orientation[0] - angle_deg;
3003
3004
3006 if ( MemoryPointExists( "rotate_axis" ) )
3007 {
3008 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3009 }
3010 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];
3011 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];
3012 center[0] = r_center_x;
3013 center[2] = r_center_z;
3014 }
3015 }
3016
3018 {
3020 {
3023 {
3024 if (areaDamage)
3025 {
3026 areaDamage.Destroy();
3027 }
3028
3030 }
3031 }
3032 }
3033
3035 {
3036 return true;
3037 }
3038
3039
3040
3041
3043 {
3045 }
3046
3048 {
3050 }
3051
3053 {
3055 }
3056
3058 {
3060
3061 switch ( material_type )
3062 {
3068 }
3069
3070 return "";
3071 }
3072
3074 {
3076
3077 switch ( material_type )
3078 {
3084 }
3085
3086 return "";
3087 }
3088
3089
3091 {
3093 {
3094
3096 {
3097 SetHealth(slot_name,"Health",item.GetHealth());
3098 }
3099 }
3100 }
3101
3103 {
3104 return 111;
3105 }
3106
3108 {
3109 super.SetActions();
3110
3114 }
3115
3116
3117
3118
3120 {
3121 }
3122
3125 {
3126 return null;
3127 }
3128
3130 {
3132 }
3133
3135 {
3138
3139 Man p;
3140
3141 #ifdef SERVER
3144 if (players.Count())
3145 p = players[0];
3146 #else
3148 #endif
3149
3151 {
3152 bool excluded = false;
3154 if (excludes)
3155 {
3156 foreach (string exclude : excludes)
3157 {
3159 {
3160 excluded = true;
3161 break;
3162 }
3163 }
3164 }
3165
3166 if (!excluded)
3167 {
3169 }
3170 }
3171
3173 }
3174}
3175
3177{
3178#ifdef BSB_DEBUG
3180#else
3181
3182#endif
3183}
3185{
3186#ifdef BSB_DEBUG_SPAM
3188#else
3189
3190#endif
3191}
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.