1937{
1939
1941
1943
1945
1951
1952
1953
1959
1965
1967
1971
1972
1974 {
1976
1977
1978 RegisterNetSyncVariableInt( "m_SyncParts01" );
1979 RegisterNetSyncVariableInt( "m_SyncParts02" );
1980 RegisterNetSyncVariableInt( "m_SyncParts03" );
1981 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1982 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1983 RegisterNetSyncVariableBool( "m_HasBase" );
1984
1985
1987
1988 if (ConfigIsExisting("hybridAttachments"))
1989 {
1992 }
1993 if (ConfigIsExisting("mountables"))
1994 {
1997 }
1998
2000 }
2001
2003 {
2004 super.EEDelete(parent);
2005
2007 {
2008 areaDamage.Destroy();
2009 }
2010
2011 }
2012
2014 {
2015 return "disableBaseDamage";
2016 }
2017
2019 {
2020 return true;
2021 }
2022
2024 {
2025 return EInventoryIconVisibility.HIDE_VICINITY;
2026 }
2027
2028
2030 {
2032 {
2033 SetSynchDirty();
2034 }
2035 }
2036
2038 {
2040 super.OnVariablesSynchronized();
2041
2043 }
2044
2046 {
2047
2049
2050
2052
2053
2055 }
2056
2057
2059 {
2060
2061 int offset;
2062 int mask;
2063
2064 if ( part_id >= 1 && part_id <= 31 )
2065 {
2066 offset = part_id - 1;
2067 mask = 1 << offset;
2068
2070 }
2071 else if ( part_id >= 32 && part_id <= 62 )
2072 {
2073 offset = ( part_id % 32 );
2074 mask = 1 << offset;
2075
2077 }
2078 else if ( part_id >= 63 && part_id <= 93 )
2079 {
2080 offset = ( part_id % 63 );
2081 mask = 1 << offset;
2082
2084 }
2085 }
2086
2088 {
2089
2090 int offset;
2091 int mask;
2092
2093 if ( part_id >= 1 && part_id <= 31 )
2094 {
2095 offset = part_id - 1;
2096 mask = 1 << offset;
2097
2099 }
2100 else if ( part_id >= 32 && part_id <= 62 )
2101 {
2102 offset = ( part_id % 32 );
2103 mask = 1 << offset;
2104
2106 }
2107 else if ( part_id >= 63 && part_id <= 93 )
2108 {
2109 offset = ( part_id % 63 );
2110 mask = 1 << offset;
2111
2113 }
2114 }
2115
2117 {
2118
2119 int offset;
2120 int mask;
2121
2122 if ( part_id >= 1 && part_id <= 31 )
2123 {
2124 offset = part_id - 1;
2125 mask = 1 << offset;
2126
2128 {
2129 return true;
2130 }
2131 }
2132 else if ( part_id >= 32 && part_id <= 62 )
2133 {
2134 offset = ( part_id % 32 );
2135 mask = 1 << offset;
2136
2138 {
2139 return true;
2140 }
2141 }
2142 else if ( part_id >= 63 && part_id <= 93 )
2143 {
2144 offset = ( part_id % 63 );
2145 mask = 1 << offset;
2146
2148 {
2149 return true;
2150 }
2151 }
2152
2153 return false;
2154 }
2155
2157 {
2160 }
2161
2163 {
2164
2167 }
2168
2170 {
2172 {
2175
2176 switch( build_action_id )
2177 {
2181 }
2182 }
2183 }
2184
2185
2187 {
2189 bool is_base = part.
IsBase();
2192 if ( is_part_built_sync )
2193 {
2195 {
2199
2200 if (is_base)
2201 {
2204 }
2205 }
2206 }
2207 else
2208 {
2210 {
2214
2215 if (is_base)
2216 {
2219 }
2220 }
2221 }
2222
2223
2225 }
2226
2227
2229 {
2232
2233 for ( int i = 0; i < construction_parts.Count(); ++i )
2234 {
2235 string key = construction_parts.GetKey( i );
2238 }
2239
2240
2242 }
2243
2245 {
2248
2249 for ( int i = 0; i < construction_parts.Count(); ++i )
2250 {
2251 string key = construction_parts.GetKey( i );
2253
2254 if ( value.
GetId() ==
id )
2255 {
2256 return value;
2257 }
2258 }
2259
2260 return NULL;
2261 }
2262
2263
2264
2266 {
2268 }
2269
2271 {
2273 }
2274
2276 {
2277 return true;
2278 }
2279
2281 {
2282 return false;
2283 }
2284
2285
2287 {
2290 {
2292 }
2293
2294 return construction_kit;
2295 }
2296
2298 {
2301 {
2303 }
2304 }
2305
2307 {
2309 }
2310
2312 {
2313 return "";
2314 }
2315
2317 {
2320 }
2321
2322
2324 {
2327 }
2328
2329
2331 {
2332 super.OnStoreSave( ctx );
2333
2334
2338
2340 }
2341
2343 {
2344 if ( !super.OnStoreLoad( ctx, version ) )
2345 return false;
2346
2347
2348
2350 {
2352 return false;
2353 }
2355 {
2357 return false;
2358 }
2360 {
2362 return false;
2363 }
2364
2365
2367 {
2369 return false;
2370 }
2371
2372
2373 return true;
2374 }
2375
2377 {
2378 super.AfterStoreLoad();
2379
2381 {
2383 }
2384 }
2385
2387 {
2388
2390
2391
2394
2395
2397 }
2398
2400 {
2401 super.OnCreatePhysics();
2404 }
2405
2407 {
2409 return;
2410
2411 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2412
2414 return;
2415
2417 string part_name = zone;
2419
2421 {
2422 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2423
2424 if ( construction_part && construction.IsPartConstructed( part_name ) )
2425 {
2427 construction.DestroyConnectedParts(part_name);
2428 }
2429
2430
2431 if ( part_name.
Contains(
"barbed") )
2432 {
2433 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2434 if (barbed_wire)
2435 barbed_wire.SetMountedState( false );
2436 }
2437 }
2438 }
2439
2441 {
2443 {
2445 }
2446
2447 super.EEOnAfterLoad();
2448 }
2449
2451 {
2452 super.EEInit();
2453
2454
2456
2457
2458 #ifdef DEVELOPER
2460 #endif
2461 }
2462
2464 {
2465 super.EEItemAttached( item, slot_name );
2466
2470 }
2471
2473 {
2474 super.EEItemDetached( item, slot_name );
2475
2478 }
2479
2480 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2481 {
2484
2487 }
2488
2489
2491 {
2492 return true;
2493 }
2494
2495
2496
2498 {
2500
2501
2502 if (construtionPart.
IsBase())
2503 {
2505
2506
2508 }
2509
2510
2512
2513
2515
2516
2518
2520
2522
2523
2525
2526
2528 }
2529
2531 {
2532
2534 }
2535
2536
2538 {
2541
2542
2544
2545
2547
2548
2550
2551
2553
2555
2556
2558
2559
2561
2562
2563 if (construtionPart.
IsBase())
2564 {
2565
2567 }
2568
2571 }
2572
2574 {
2575
2577 }
2578
2579
2580 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2581 {
2584
2585
2587
2588
2590
2591
2593
2594
2596
2598
2599
2601
2602
2604
2605
2606 if (construtionPart.
IsBase())
2607 {
2608
2610 }
2611
2614 }
2615
2617 {
2618
2620 }
2621
2623 {
2624 bool process = false;
2625
2626
2630
2631 if (process)
2632 {
2633 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2634 {
2636 return;
2637 }
2638
2640 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2641 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2642
2643
2645 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2646 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2647 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2648 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2649 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2650 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2651 mins = minTmp;
2652 maxs = maxTmp;
2653
2654 maxs[1] = maxs[1] + 0.35;
2655
2657 }
2658 }
2659
2661 {
2664
2665
2667 foreach (
EntityAI entity : foundEntities)
2668 {
2671 }
2672 }
2673
2674
2676 {
2678
2682 }
2683
2685 {
2687
2689 {
2691 }
2692 else
2693 {
2695 }
2696
2698 }
2699
2701 {
2703
2705 foreach (
string slotName : attachmentSlots)
2706 {
2708 }
2709
2710
2713 else
2715
2717 }
2718
2720 {
2721 string slotNameMounted = slot_name + "_Mounted";
2722 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2723
2724 if (attachment)
2725 {
2726 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2727 if (barbedWire && barbedWire.IsMounted())
2729 else
2731
2732 if (is_locked)
2733 {
2734 SetAnimationPhase(slotNameMounted, 0);
2735 SetAnimationPhase(slot_name, 1);
2736 }
2737 else
2738 {
2739 SetAnimationPhase(slotNameMounted, 1);
2740 SetAnimationPhase(slot_name, 0);
2741 }
2742 }
2743 else
2744 {
2745 SetAnimationPhase(slotNameMounted, 1);
2746 SetAnimationPhase(slot_name, 1);
2747
2749 }
2750 }
2751
2752
2754 {
2757
2760
2763
2764 foreach (
string slotName : attachmentSlots)
2765 {
2767 }
2768
2769
2771 {
2774
2776 }
2777 else
2778 {
2781
2783 }
2784
2787 }
2788
2790 {
2791
2793 return;
2794
2795 string slot_name_mounted = slot_name + "_Mounted";
2796 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2797
2798
2800 RemoveProxyPhysics( slot_name_mounted );
2801 RemoveProxyPhysics( slot_name );
2802
2803 if ( attachment )
2804 {
2806 if ( is_locked )
2807 {
2809 AddProxyPhysics( slot_name_mounted );
2810 }
2811 else
2812 {
2814 AddProxyPhysics( slot_name );
2815 }
2816 }
2817 }
2818
2820 {
2821 SetAffectPathgraph( true, false );
2823 }
2824
2826 {
2827 return true;
2828 }
2829
2831 {
2832 return true;
2833 }
2834
2836 {
2837 if ( attachment )
2838 {
2840 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2841
2842 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2843 }
2844
2845 return false;
2846 }
2847
2849 {
2851 }
2852
2853
2855 {
2856 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2857 if (
GetGame().ConfigIsExisting( config_path ) )
2858 {
2860 }
2861 }
2862
2864 {
2865 return true;
2866 }
2867
2869 {
2870 return true;
2871 }
2872
2874 {
2875 return true;
2876 }
2877
2878
2880 {
2882 {
2884 }
2885
2887 }
2888
2890 {
2892 }
2893
2894
2895
2897 {
2898 return super.CanReceiveAttachment(attachment, slotId);
2899 }
2900
2902 {
2903 int attachment_count = GetInventory().AttachmentCount();
2904 if ( attachment_count > 0 )
2905 {
2906 if (
HasBase() && attachment_count == 1 )
2907 {
2908 return false;
2909 }
2910
2911 return true;
2912 }
2913
2914 return false;
2915 }
2916
2918 {
2919 return true;
2920 }
2921
2923 {
2924 return false;
2925 }
2926
2927
2929 {
2930 return false;
2931 }
2932
2934 {
2935 return false;
2936 }
2937
2938
2940 {
2941 return false;
2942 }
2943
2944
2945
2947 {
2948 return true;
2949 }
2950
2952 {
2953 return true;
2954 }
2955
2958 {
2959 return false;
2960 }
2961
2962
2964 {
2965 return true;
2966 }
2967
2968
2970 {
2971 return false;
2972 }
2973
2974
2976 {
2977 return true;
2978 }
2979
2980
2982 {
2983 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2984 {
2985 return false;
2986 }
2987
2988 return true;
2989 }
2990
2992 {
2995
2996 return item;
2997 }
2998
2999
3001 {
3003 {
3004
3006
3007
3010
3012 if ( MemoryPointExists( slot_name + "_min" ) )
3013 {
3014 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3015 }
3016 if ( MemoryPointExists( slot_name + "_max" ) )
3017 {
3018 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3019 }
3020
3021
3024
3025
3028 center = ModelToWorld( center );
3029
3030
3033
3034 areaDamage.SetExtents( extents[0], extents[1] );
3035 areaDamage.SetAreaPosition( center );
3036 areaDamage.SetAreaOrientation( orientation );
3039 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3040 areaDamage.SetAmmoName( "BarbedWireHit" );
3041 areaDamage.Spawn();
3042
3044 }
3045 }
3046
3048 {
3049 if ( angle_deg != 0 )
3050 {
3051
3052 orientation[0] = orientation[0] - angle_deg;
3053
3054
3056 if ( MemoryPointExists( "rotate_axis" ) )
3057 {
3058 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3059 }
3060 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];
3061 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];
3062 center[0] = r_center_x;
3063 center[2] = r_center_z;
3064 }
3065 }
3066
3068 {
3070 {
3073 {
3074 if (areaDamage)
3075 {
3076 areaDamage.Destroy();
3077 }
3078
3080 }
3081 }
3082 }
3083
3085 {
3086 return true;
3087 }
3088
3089
3090
3091
3093 {
3095 }
3096
3098 {
3100 }
3101
3103 {
3105 }
3106
3108 {
3110
3111 switch ( material_type )
3112 {
3118 }
3119
3120 return "";
3121 }
3122
3124 {
3126
3127 switch ( material_type )
3128 {
3134 }
3135
3136 return "";
3137 }
3138
3139
3141 {
3143 {
3144
3146 {
3147 SetHealth(slot_name,"Health",item.GetHealth());
3148 }
3149 }
3150 }
3151
3153 {
3154 return 111;
3155 }
3156
3158 {
3159 super.SetActions();
3160
3164 }
3165
3166
3167
3168
3170 {
3171 }
3172
3175 {
3176 return null;
3177 }
3178
3180 {
3182 }
3183
3185 {
3188
3189 Man p;
3190
3191 #ifdef SERVER
3194 if (players.Count())
3195 p = players[0];
3196 #else
3198 #endif
3199
3201 {
3202 bool excluded = false;
3204 if (excludes)
3205 {
3206 foreach (string exclude : excludes)
3207 {
3209 {
3210 excluded = true;
3211 break;
3212 }
3213 }
3214 }
3215
3216 if (!excluded)
3217 {
3219 }
3220 }
3221
3223 }
3224}
3225
3227{
3228#ifdef BSB_DEBUG
3230#else
3231
3232#endif
3233}
3235{
3236#ifdef BSB_DEBUG_SPAM
3238#else
3239
3240#endif
3241}
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.