1930{
1932
1934
1936
1938
1944
1945
1946
1952
1958
1960
1964
1965
1967 {
1969
1970
1971 RegisterNetSyncVariableInt( "m_SyncParts01" );
1972 RegisterNetSyncVariableInt( "m_SyncParts02" );
1973 RegisterNetSyncVariableInt( "m_SyncParts03" );
1974 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1975 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1976 RegisterNetSyncVariableBool( "m_HasBase" );
1977
1978
1980
1981 if (ConfigIsExisting("hybridAttachments"))
1982 {
1985 }
1986 if (ConfigIsExisting("mountables"))
1987 {
1990 }
1991
1993 }
1994
1996 {
1997 super.EEDelete(parent);
1998
2000 {
2001 areaDamage.Destroy();
2002 }
2003
2004 }
2005
2007 {
2008 return "disableBaseDamage";
2009 }
2010
2012 {
2013 return true;
2014 }
2015
2017 {
2018 return EInventoryIconVisibility.HIDE_VICINITY;
2019 }
2020
2021
2023 {
2025 {
2026 SetSynchDirty();
2027 }
2028 }
2029
2031 {
2033 super.OnVariablesSynchronized();
2034
2036 }
2037
2039 {
2040
2042
2043
2045
2046
2048 }
2049
2050
2052 {
2053
2054 int offset;
2055 int mask;
2056
2057 if ( part_id >= 1 && part_id <= 31 )
2058 {
2059 offset = part_id - 1;
2060 mask = 1 << offset;
2061
2063 }
2064 else if ( part_id >= 32 && part_id <= 62 )
2065 {
2066 offset = ( part_id % 32 );
2067 mask = 1 << offset;
2068
2070 }
2071 else if ( part_id >= 63 && part_id <= 93 )
2072 {
2073 offset = ( part_id % 63 );
2074 mask = 1 << offset;
2075
2077 }
2078 }
2079
2081 {
2082
2083 int offset;
2084 int mask;
2085
2086 if ( part_id >= 1 && part_id <= 31 )
2087 {
2088 offset = part_id - 1;
2089 mask = 1 << offset;
2090
2092 }
2093 else if ( part_id >= 32 && part_id <= 62 )
2094 {
2095 offset = ( part_id % 32 );
2096 mask = 1 << offset;
2097
2099 }
2100 else if ( part_id >= 63 && part_id <= 93 )
2101 {
2102 offset = ( part_id % 63 );
2103 mask = 1 << offset;
2104
2106 }
2107 }
2108
2110 {
2111
2112 int offset;
2113 int mask;
2114
2115 if ( part_id >= 1 && part_id <= 31 )
2116 {
2117 offset = part_id - 1;
2118 mask = 1 << offset;
2119
2121 {
2122 return true;
2123 }
2124 }
2125 else if ( part_id >= 32 && part_id <= 62 )
2126 {
2127 offset = ( part_id % 32 );
2128 mask = 1 << offset;
2129
2131 {
2132 return true;
2133 }
2134 }
2135 else if ( part_id >= 63 && part_id <= 93 )
2136 {
2137 offset = ( part_id % 63 );
2138 mask = 1 << offset;
2139
2141 {
2142 return true;
2143 }
2144 }
2145
2146 return false;
2147 }
2148
2150 {
2153 }
2154
2156 {
2157
2160 }
2161
2163 {
2165 {
2168
2169 switch( build_action_id )
2170 {
2174 }
2175 }
2176 }
2177
2178
2180 {
2182 bool is_base = part.
IsBase();
2185 if ( is_part_built_sync )
2186 {
2188 {
2192
2193 if (is_base)
2194 {
2197 }
2198 }
2199 }
2200 else
2201 {
2203 {
2207
2208 if (is_base)
2209 {
2212 }
2213 }
2214 }
2215
2216
2218 }
2219
2220
2222 {
2225
2226 for ( int i = 0; i < construction_parts.Count(); ++i )
2227 {
2228 string key = construction_parts.GetKey( i );
2231 }
2232
2233
2235 }
2236
2238 {
2241
2242 for ( int i = 0; i < construction_parts.Count(); ++i )
2243 {
2244 string key = construction_parts.GetKey( i );
2246
2247 if ( value.
GetId() ==
id )
2248 {
2249 return value;
2250 }
2251 }
2252
2253 return NULL;
2254 }
2255
2256
2257
2259 {
2261 }
2262
2264 {
2266 }
2267
2269 {
2270 return true;
2271 }
2272
2274 {
2275 return false;
2276 }
2277
2278
2280 {
2283 {
2285 }
2286
2287 return construction_kit;
2288 }
2289
2291 {
2294 {
2296 }
2297 }
2298
2300 {
2302 }
2303
2305 {
2306 return "";
2307 }
2308
2310 {
2313 }
2314
2315
2317 {
2320 }
2321
2322
2324 {
2325 super.OnStoreSave( ctx );
2326
2327
2331
2333 }
2334
2336 {
2337 if ( !super.OnStoreLoad( ctx, version ) )
2338 return false;
2339
2340
2341
2343 {
2345 return false;
2346 }
2348 {
2350 return false;
2351 }
2353 {
2355 return false;
2356 }
2357
2358
2360 {
2362 return false;
2363 }
2364
2365
2366 return true;
2367 }
2368
2370 {
2371 super.AfterStoreLoad();
2372
2374 {
2376 }
2377 }
2378
2380 {
2381
2383
2384
2387
2388
2390 }
2391
2393 {
2394 super.OnCreatePhysics();
2397 }
2398
2400 {
2402 return;
2403
2404 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2405
2407 return;
2408
2410 string part_name = zone;
2412
2414 {
2415 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2416
2417 if ( construction_part && construction.IsPartConstructed( part_name ) )
2418 {
2420 construction.DestroyConnectedParts(part_name);
2421 }
2422
2423
2424 if ( part_name.
Contains(
"barbed") )
2425 {
2426 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2427 if (barbed_wire)
2428 barbed_wire.SetMountedState( false );
2429 }
2430 }
2431 }
2432
2434 {
2436 {
2438 }
2439
2440 super.EEOnAfterLoad();
2441 }
2442
2444 {
2445 super.EEInit();
2446
2447
2449
2450
2451 #ifdef DEVELOPER
2453 #endif
2454 }
2455
2457 {
2458 super.EEItemAttached( item, slot_name );
2459
2463 }
2464
2466 {
2467 super.EEItemDetached( item, slot_name );
2468
2471 }
2472
2473 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2474 {
2477
2480 }
2481
2482
2484 {
2485 return true;
2486 }
2487
2488
2489
2491 {
2493
2494
2495 if (construtionPart.
IsBase())
2496 {
2498
2499
2501 }
2502
2503
2505
2506
2508
2509
2511
2513
2515
2516
2518
2519
2521 }
2522
2524 {
2525
2527 }
2528
2529
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
2572
2573 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2574 {
2577
2578
2580
2581
2583
2584
2586
2587
2589
2591
2592
2594
2595
2597
2598
2599 if (construtionPart.
IsBase())
2600 {
2601
2603 }
2604
2607 }
2608
2610 {
2611
2613 }
2614
2616 {
2617 bool process = false;
2618
2619
2623
2624 if (process)
2625 {
2626 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2627 {
2629 return;
2630 }
2631
2633 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2634 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2635
2636
2638 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2639 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2640 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2641 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2642 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2643 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2644 mins = minTmp;
2645 maxs = maxTmp;
2646
2647 maxs[1] = maxs[1] + 0.35;
2648
2650 }
2651 }
2652
2654 {
2657
2658
2660 foreach (
EntityAI entity : foundEntities)
2661 {
2664 }
2665 }
2666
2667
2669 {
2671
2675 }
2676
2678 {
2680
2682 {
2684 }
2685 else
2686 {
2688 }
2689
2691 }
2692
2694 {
2696
2698 foreach (
string slotName : attachmentSlots)
2699 {
2701 }
2702
2703
2706 else
2708
2710 }
2711
2713 {
2714 string slotNameMounted = slot_name + "_Mounted";
2715 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2716
2717 if (attachment)
2718 {
2719 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2720 if (barbedWire && barbedWire.IsMounted())
2722 else
2724
2725 if (is_locked)
2726 {
2727 SetAnimationPhase(slotNameMounted, 0);
2728 SetAnimationPhase(slot_name, 1);
2729 }
2730 else
2731 {
2732 SetAnimationPhase(slotNameMounted, 1);
2733 SetAnimationPhase(slot_name, 0);
2734 }
2735 }
2736 else
2737 {
2738 SetAnimationPhase(slotNameMounted, 1);
2739 SetAnimationPhase(slot_name, 1);
2740
2742 }
2743 }
2744
2745
2747 {
2750
2753
2756
2757 foreach (
string slotName : attachmentSlots)
2758 {
2760 }
2761
2762
2764 {
2767
2769 }
2770 else
2771 {
2774
2776 }
2777
2780 }
2781
2783 {
2784
2786 return;
2787
2788 string slot_name_mounted = slot_name + "_Mounted";
2789 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2790
2791
2793 RemoveProxyPhysics( slot_name_mounted );
2794 RemoveProxyPhysics( slot_name );
2795
2796 if ( attachment )
2797 {
2799 if ( is_locked )
2800 {
2802 AddProxyPhysics( slot_name_mounted );
2803 }
2804 else
2805 {
2807 AddProxyPhysics( slot_name );
2808 }
2809 }
2810 }
2811
2813 {
2814 SetAffectPathgraph( true, false );
2816 }
2817
2819 {
2820 return true;
2821 }
2822
2824 {
2825 return true;
2826 }
2827
2829 {
2830 if ( attachment )
2831 {
2833 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2834
2835 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2836 }
2837
2838 return false;
2839 }
2840
2842 {
2844 }
2845
2846
2848 {
2849 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2850 if (
GetGame().ConfigIsExisting( config_path ) )
2851 {
2853 }
2854 }
2855
2857 {
2858 return true;
2859 }
2860
2862 {
2863 return true;
2864 }
2865
2867 {
2868 return true;
2869 }
2870
2871
2873 {
2875 {
2877 }
2878
2880 }
2881
2883 {
2885 }
2886
2887
2888
2890 {
2891 return super.CanReceiveAttachment(attachment, slotId);
2892 }
2893
2895 {
2896 int attachment_count = GetInventory().AttachmentCount();
2897 if ( attachment_count > 0 )
2898 {
2899 if (
HasBase() && attachment_count == 1 )
2900 {
2901 return false;
2902 }
2903
2904 return true;
2905 }
2906
2907 return false;
2908 }
2909
2911 {
2912 return true;
2913 }
2914
2916 {
2917 return false;
2918 }
2919
2920
2922 {
2923 return false;
2924 }
2925
2927 {
2928 return false;
2929 }
2930
2931
2933 {
2934 return false;
2935 }
2936
2937
2938
2940 {
2941 return true;
2942 }
2943
2945 {
2946 return true;
2947 }
2948
2951 {
2952 return false;
2953 }
2954
2955
2957 {
2958 return true;
2959 }
2960
2961
2963 {
2964 return false;
2965 }
2966
2967
2969 {
2970 return true;
2971 }
2972
2973
2975 {
2976 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2977 {
2978 return false;
2979 }
2980
2981 return true;
2982 }
2983
2985 {
2988
2989 return item;
2990 }
2991
2992
2994 {
2996 {
2997
2999
3000
3003
3005 if ( MemoryPointExists( slot_name + "_min" ) )
3006 {
3007 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3008 }
3009 if ( MemoryPointExists( slot_name + "_max" ) )
3010 {
3011 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3012 }
3013
3014
3017
3018
3021 center = ModelToWorld( center );
3022
3023
3026
3027 areaDamage.SetExtents( extents[0], extents[1] );
3028 areaDamage.SetAreaPosition( center );
3029 areaDamage.SetAreaOrientation( orientation );
3032 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3033 areaDamage.SetAmmoName( "BarbedWireHit" );
3034 areaDamage.Spawn();
3035
3037 }
3038 }
3039
3041 {
3042 if ( angle_deg != 0 )
3043 {
3044
3045 orientation[0] = orientation[0] - angle_deg;
3046
3047
3049 if ( MemoryPointExists( "rotate_axis" ) )
3050 {
3051 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3052 }
3053 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];
3054 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];
3055 center[0] = r_center_x;
3056 center[2] = r_center_z;
3057 }
3058 }
3059
3061 {
3063 {
3066 {
3067 if (areaDamage)
3068 {
3069 areaDamage.Destroy();
3070 }
3071
3073 }
3074 }
3075 }
3076
3078 {
3079 return true;
3080 }
3081
3082
3083
3084
3086 {
3088 }
3089
3091 {
3093 }
3094
3096 {
3098 }
3099
3101 {
3103
3104 switch ( material_type )
3105 {
3111 }
3112
3113 return "";
3114 }
3115
3117 {
3119
3120 switch ( material_type )
3121 {
3127 }
3128
3129 return "";
3130 }
3131
3132
3134 {
3136 {
3137
3139 {
3140 SetHealth(slot_name,"Health",item.GetHealth());
3141 }
3142 }
3143 }
3144
3146 {
3147 return 111;
3148 }
3149
3151 {
3152 super.SetActions();
3153
3157 }
3158
3159
3160
3161
3163 {
3164 }
3165
3168 {
3169 return null;
3170 }
3171
3173 {
3175 }
3176
3178 {
3181
3182 Man p;
3183
3184 #ifdef SERVER
3187 if (players.Count())
3188 p = players[0];
3189 #else
3191 #endif
3192
3194 {
3195 bool excluded = false;
3197 if (excludes)
3198 {
3199 foreach (string exclude : excludes)
3200 {
3202 {
3203 excluded = true;
3204 break;
3205 }
3206 }
3207 }
3208
3209 if (!excluded)
3210 {
3212 }
3213 }
3214
3216 }
3217}
3218
3220{
3221#ifdef BSB_DEBUG
3223#else
3224
3225#endif
3226}
3228{
3229#ifdef BSB_DEBUG_SPAM
3231#else
3232
3233#endif
3234}
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.