1894{
1896
1898
1900
1902
1908
1909
1910
1916
1922
1924
1928
1929
1931 {
1933
1934
1935 RegisterNetSyncVariableInt( "m_SyncParts01" );
1936 RegisterNetSyncVariableInt( "m_SyncParts02" );
1937 RegisterNetSyncVariableInt( "m_SyncParts03" );
1938 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1939 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1940 RegisterNetSyncVariableBool( "m_HasBase" );
1941
1942
1944
1945 if (ConfigIsExisting("hybridAttachments"))
1946 {
1949 }
1950 if (ConfigIsExisting("mountables"))
1951 {
1954 }
1955
1957 }
1958
1960 {
1961 super.EEDelete(parent);
1962
1964 {
1965 areaDamage.Destroy();
1966 }
1967
1968 }
1969
1971 {
1972 return "disableBaseDamage";
1973 }
1974
1976 {
1977 return true;
1978 }
1979
1981 {
1982 return EInventoryIconVisibility.HIDE_VICINITY;
1983 }
1984
1985
1987 {
1989 {
1990 SetSynchDirty();
1991 }
1992 }
1993
1995 {
1997 super.OnVariablesSynchronized();
1998
2000 }
2001
2003 {
2004
2006
2007
2009
2010
2012 }
2013
2014
2016 {
2017
2018 int offset;
2019 int mask;
2020
2021 if ( part_id >= 1 && part_id <= 31 )
2022 {
2023 offset = part_id - 1;
2024 mask = 1 << offset;
2025
2027 }
2028 else if ( part_id >= 32 && part_id <= 62 )
2029 {
2030 offset = ( part_id % 32 );
2031 mask = 1 << offset;
2032
2034 }
2035 else if ( part_id >= 63 && part_id <= 93 )
2036 {
2037 offset = ( part_id % 63 );
2038 mask = 1 << offset;
2039
2041 }
2042 }
2043
2045 {
2046
2047 int offset;
2048 int mask;
2049
2050 if ( part_id >= 1 && part_id <= 31 )
2051 {
2052 offset = part_id - 1;
2053 mask = 1 << offset;
2054
2056 }
2057 else if ( part_id >= 32 && part_id <= 62 )
2058 {
2059 offset = ( part_id % 32 );
2060 mask = 1 << offset;
2061
2063 }
2064 else if ( part_id >= 63 && part_id <= 93 )
2065 {
2066 offset = ( part_id % 63 );
2067 mask = 1 << offset;
2068
2070 }
2071 }
2072
2074 {
2075
2076 int offset;
2077 int mask;
2078
2079 if ( part_id >= 1 && part_id <= 31 )
2080 {
2081 offset = part_id - 1;
2082 mask = 1 << offset;
2083
2085 {
2086 return true;
2087 }
2088 }
2089 else if ( part_id >= 32 && part_id <= 62 )
2090 {
2091 offset = ( part_id % 32 );
2092 mask = 1 << offset;
2093
2095 {
2096 return true;
2097 }
2098 }
2099 else if ( part_id >= 63 && part_id <= 93 )
2100 {
2101 offset = ( part_id % 63 );
2102 mask = 1 << offset;
2103
2105 {
2106 return true;
2107 }
2108 }
2109
2110 return false;
2111 }
2112
2114 {
2117 }
2118
2120 {
2121
2124 }
2125
2127 {
2129 {
2132
2133 switch( build_action_id )
2134 {
2138 }
2139 }
2140 }
2141
2142
2144 {
2146 bool is_base = part.
IsBase();
2149 if ( is_part_built_sync )
2150 {
2152 {
2156
2157 if (is_base)
2158 {
2161 }
2162 }
2163 }
2164 else
2165 {
2167 {
2171
2172 if (is_base)
2173 {
2176 }
2177 }
2178 }
2179
2180
2182 }
2183
2184
2186 {
2189
2190 for ( int i = 0; i < construction_parts.Count(); ++i )
2191 {
2192 string key = construction_parts.GetKey( i );
2195 }
2196
2197
2199 }
2200
2202 {
2205
2206 for ( int i = 0; i < construction_parts.Count(); ++i )
2207 {
2208 string key = construction_parts.GetKey( i );
2210
2211 if ( value.
GetId() ==
id )
2212 {
2213 return value;
2214 }
2215 }
2216
2217 return NULL;
2218 }
2219
2220
2221
2223 {
2225 }
2226
2228 {
2230 }
2231
2233 {
2234 return true;
2235 }
2236
2238 {
2239 return false;
2240 }
2241
2242
2244 {
2247 {
2249 }
2250
2251 return construction_kit;
2252 }
2253
2255 {
2258 {
2260 }
2261 }
2262
2264 {
2266 }
2267
2269 {
2270 return "";
2271 }
2272
2274 {
2277 }
2278
2279
2281 {
2284 }
2285
2286
2288 {
2289 super.OnStoreSave( ctx );
2290
2291
2295
2297 }
2298
2300 {
2301 if ( !super.OnStoreLoad( ctx, version ) )
2302 return false;
2303
2304
2305
2307 {
2309 return false;
2310 }
2312 {
2314 return false;
2315 }
2317 {
2319 return false;
2320 }
2321
2322
2324 {
2326 return false;
2327 }
2328
2329
2330 return true;
2331 }
2332
2334 {
2335 super.AfterStoreLoad();
2336
2338 {
2340 }
2341 }
2342
2344 {
2345
2347
2348
2351
2352
2354 }
2355
2357 {
2358 super.OnCreatePhysics();
2361 }
2362
2364 {
2366 return;
2367
2368 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2369
2371 return;
2372
2374 string part_name = zone;
2376
2378 {
2379 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2380
2381 if ( construction_part && construction.IsPartConstructed( part_name ) )
2382 {
2384 construction.DestroyConnectedParts(part_name);
2385 }
2386
2387
2388 if ( part_name.
Contains(
"barbed") )
2389 {
2390 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2391 if (barbed_wire)
2392 barbed_wire.SetMountedState( false );
2393 }
2394 }
2395 }
2396
2398 {
2400 {
2402 }
2403
2404 super.EEOnAfterLoad();
2405 }
2406
2408 {
2409 super.EEInit();
2410
2411
2413
2414
2415 #ifdef DEVELOPER
2417 #endif
2418 }
2419
2421 {
2422 super.EEItemAttached( item, slot_name );
2423
2427 }
2428
2430 {
2431 super.EEItemDetached( item, slot_name );
2432
2435 }
2436
2437 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2438 {
2441
2444 }
2445
2446
2448 {
2449 return true;
2450 }
2451
2452
2453
2455 {
2457
2458
2459 if (construtionPart.
IsBase())
2460 {
2462
2463
2465 }
2466
2467
2469
2470
2472
2473
2475
2477
2479
2480
2482
2483
2485 }
2486
2488 {
2489
2491 }
2492
2493
2495 {
2498
2499
2501
2502
2504
2505
2507
2508
2510
2512
2513
2515
2516
2518
2519
2520 if (construtionPart.
IsBase())
2521 {
2522
2524 }
2525
2528 }
2529
2531 {
2532
2534 }
2535
2536
2537 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
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
2580 {
2581 bool process = false;
2582
2583
2587
2588 if (process)
2589 {
2590 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2591 {
2593 return;
2594 }
2595
2597 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2598 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2599
2600
2602 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2603 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2604 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2605 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2606 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2607 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2608 mins = minTmp;
2609 maxs = maxTmp;
2610
2611 maxs[1] = maxs[1] + 0.35;
2612
2614 }
2615 }
2616
2618 {
2621
2622
2624 foreach (
EntityAI entity : foundEntities)
2625 {
2628 }
2629 }
2630
2631
2633 {
2635
2639 }
2640
2642 {
2644
2646 {
2648 }
2649 else
2650 {
2652 }
2653
2655 }
2656
2658 {
2660
2662 foreach (
string slotName : attachmentSlots)
2663 {
2665 }
2666
2667
2670 else
2672
2674 }
2675
2677 {
2678 string slotNameMounted = slot_name + "_Mounted";
2679 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2680
2681 if (attachment)
2682 {
2683 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2684 if (barbedWire && barbedWire.IsMounted())
2686 else
2688
2689 if (is_locked)
2690 {
2691 SetAnimationPhase(slotNameMounted, 0);
2692 SetAnimationPhase(slot_name, 1);
2693 }
2694 else
2695 {
2696 SetAnimationPhase(slotNameMounted, 1);
2697 SetAnimationPhase(slot_name, 0);
2698 }
2699 }
2700 else
2701 {
2702 SetAnimationPhase(slotNameMounted, 1);
2703 SetAnimationPhase(slot_name, 1);
2704
2706 }
2707 }
2708
2709
2711 {
2714
2717
2720
2721 foreach (
string slotName : attachmentSlots)
2722 {
2724 }
2725
2726
2728 {
2731
2733 }
2734 else
2735 {
2738
2740 }
2741
2744 }
2745
2747 {
2748
2750 return;
2751
2752 string slot_name_mounted = slot_name + "_Mounted";
2753 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2754
2755
2757 RemoveProxyPhysics( slot_name_mounted );
2758 RemoveProxyPhysics( slot_name );
2759
2760 if ( attachment )
2761 {
2763 if ( is_locked )
2764 {
2766 AddProxyPhysics( slot_name_mounted );
2767 }
2768 else
2769 {
2771 AddProxyPhysics( slot_name );
2772 }
2773 }
2774 }
2775
2777 {
2778 SetAffectPathgraph( true, false );
2780 }
2781
2783 {
2784 return true;
2785 }
2786
2788 {
2789 return true;
2790 }
2791
2793 {
2794 if ( attachment )
2795 {
2797 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2798
2799 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2800 }
2801
2802 return false;
2803 }
2804
2806 {
2808 }
2809
2810
2812 {
2813 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2814 if (
GetGame().ConfigIsExisting( config_path ) )
2815 {
2817 }
2818 }
2819
2821 {
2822 return true;
2823 }
2824
2826 {
2827 return true;
2828 }
2829
2831 {
2832 return true;
2833 }
2834
2835
2837 {
2839 {
2841 }
2842
2844 }
2845
2847 {
2849 }
2850
2851
2852
2854 {
2855 return super.CanReceiveAttachment(attachment, slotId);
2856 }
2857
2859 {
2860 int attachment_count = GetInventory().AttachmentCount();
2861 if ( attachment_count > 0 )
2862 {
2863 if (
HasBase() && attachment_count == 1 )
2864 {
2865 return false;
2866 }
2867
2868 return true;
2869 }
2870
2871 return false;
2872 }
2873
2875 {
2876 return true;
2877 }
2878
2880 {
2881 return false;
2882 }
2883
2884
2886 {
2887 return false;
2888 }
2889
2891 {
2892 return false;
2893 }
2894
2895
2897 {
2898 return false;
2899 }
2900
2901
2902
2904 {
2905 return true;
2906 }
2907
2909 {
2910 return true;
2911 }
2912
2915 {
2916 return false;
2917 }
2918
2919
2921 {
2922 return true;
2923 }
2924
2925
2927 {
2928 return false;
2929 }
2930
2931
2933 {
2934 return true;
2935 }
2936
2937
2939 {
2940 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2941 {
2942 return false;
2943 }
2944
2945 return true;
2946 }
2947
2949 {
2952
2953 return item;
2954 }
2955
2956
2958 {
2960 {
2961
2963
2964
2967
2969 if ( MemoryPointExists( slot_name + "_min" ) )
2970 {
2971 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2972 }
2973 if ( MemoryPointExists( slot_name + "_max" ) )
2974 {
2975 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2976 }
2977
2978
2981
2982
2985 center = ModelToWorld( center );
2986
2987
2990
2991 areaDamage.SetExtents( extents[0], extents[1] );
2992 areaDamage.SetAreaPosition( center );
2993 areaDamage.SetAreaOrientation( orientation );
2996 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2997 areaDamage.SetAmmoName( "BarbedWireHit" );
2998 areaDamage.Spawn();
2999
3001 }
3002 }
3003
3005 {
3006 if ( angle_deg != 0 )
3007 {
3008
3009 orientation[0] = orientation[0] - angle_deg;
3010
3011
3013 if ( MemoryPointExists( "rotate_axis" ) )
3014 {
3015 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3016 }
3017 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];
3018 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];
3019 center[0] = r_center_x;
3020 center[2] = r_center_z;
3021 }
3022 }
3023
3025 {
3027 {
3030 {
3031 if (areaDamage)
3032 {
3033 areaDamage.Destroy();
3034 }
3035
3037 }
3038 }
3039 }
3040
3042 {
3043 return true;
3044 }
3045
3046
3047
3048
3050 {
3052 }
3053
3055 {
3057 }
3058
3060 {
3062 }
3063
3065 {
3067
3068 switch ( material_type )
3069 {
3075 }
3076
3077 return "";
3078 }
3079
3081 {
3083
3084 switch ( material_type )
3085 {
3091 }
3092
3093 return "";
3094 }
3095
3096
3098 {
3100 {
3101
3103 {
3104 SetHealth(slot_name,"Health",item.GetHealth());
3105 }
3106 }
3107 }
3108
3110 {
3111 return 111;
3112 }
3113
3115 {
3116 super.SetActions();
3117
3121 }
3122
3123
3124
3125
3127 {
3128 }
3129
3132 {
3133 return null;
3134 }
3135
3137 {
3139 }
3140
3142 {
3145
3146 Man p;
3147
3148 #ifdef SERVER
3151 if (players.Count())
3152 p = players[0];
3153 #else
3155 #endif
3156
3158 {
3159 bool excluded = false;
3161 if (excludes)
3162 {
3163 foreach (string exclude : excludes)
3164 {
3166 {
3167 excluded = true;
3168 break;
3169 }
3170 }
3171 }
3172
3173 if (!excluded)
3174 {
3176 }
3177 }
3178
3180 }
3181}
3182
3184{
3185#ifdef BSB_DEBUG
3187#else
3188
3189#endif
3190}
3192{
3193#ifdef BSB_DEBUG_SPAM
3195#else
3196
3197#endif
3198}
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.