1979{
1981
1983
1985
1987
1993
1994
1995
2001
2007
2009
2013
2014
2016 {
2018
2019
2020 RegisterNetSyncVariableInt( "m_SyncParts01" );
2021 RegisterNetSyncVariableInt( "m_SyncParts02" );
2022 RegisterNetSyncVariableInt( "m_SyncParts03" );
2023 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2024 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2025 RegisterNetSyncVariableBool( "m_HasBase" );
2026
2027
2029
2030 if (ConfigIsExisting("hybridAttachments"))
2031 {
2034 }
2035 if (ConfigIsExisting("mountables"))
2036 {
2039 }
2040
2042 }
2043
2045 {
2046 super.EEDelete(parent);
2047
2049 {
2050 areaDamage.Destroy();
2051 }
2052
2053 }
2054
2056 {
2057 return "disableBaseDamage";
2058 }
2059
2061 {
2062 return true;
2063 }
2064
2066 {
2067 return EInventoryIconVisibility.HIDE_VICINITY;
2068 }
2069
2070
2072 {
2074 {
2075 SetSynchDirty();
2076 }
2077 }
2078
2080 {
2082 super.OnVariablesSynchronized();
2083
2085 }
2086
2088 {
2089
2091
2092
2094
2095
2097 }
2098
2099
2101 {
2102
2103 int offset;
2104 int mask;
2105
2106 if ( part_id >= 1 && part_id <= 31 )
2107 {
2108 offset = part_id - 1;
2109 mask = 1 << offset;
2110
2112 }
2113 else if ( part_id >= 32 && part_id <= 62 )
2114 {
2115 offset = ( part_id % 32 );
2116 mask = 1 << offset;
2117
2119 }
2120 else if ( part_id >= 63 && part_id <= 93 )
2121 {
2122 offset = ( part_id % 63 );
2123 mask = 1 << offset;
2124
2126 }
2127 }
2128
2130 {
2131
2132 int offset;
2133 int mask;
2134
2135 if ( part_id >= 1 && part_id <= 31 )
2136 {
2137 offset = part_id - 1;
2138 mask = 1 << offset;
2139
2141 }
2142 else if ( part_id >= 32 && part_id <= 62 )
2143 {
2144 offset = ( part_id % 32 );
2145 mask = 1 << offset;
2146
2148 }
2149 else if ( part_id >= 63 && part_id <= 93 )
2150 {
2151 offset = ( part_id % 63 );
2152 mask = 1 << offset;
2153
2155 }
2156 }
2157
2159 {
2160
2161 int offset;
2162 int mask;
2163
2164 if ( part_id >= 1 && part_id <= 31 )
2165 {
2166 offset = part_id - 1;
2167 mask = 1 << offset;
2168
2170 {
2171 return true;
2172 }
2173 }
2174 else if ( part_id >= 32 && part_id <= 62 )
2175 {
2176 offset = ( part_id % 32 );
2177 mask = 1 << offset;
2178
2180 {
2181 return true;
2182 }
2183 }
2184 else if ( part_id >= 63 && part_id <= 93 )
2185 {
2186 offset = ( part_id % 63 );
2187 mask = 1 << offset;
2188
2190 {
2191 return true;
2192 }
2193 }
2194
2195 return false;
2196 }
2197
2199 {
2202 }
2203
2205 {
2206
2209 }
2210
2212 {
2214 {
2217
2218 switch( build_action_id )
2219 {
2223 }
2224 }
2225 }
2226
2227
2229 {
2231 bool is_base = part.
IsBase();
2234 if ( is_part_built_sync )
2235 {
2237 {
2241
2242 if (is_base)
2243 {
2246 }
2247 }
2248 }
2249 else
2250 {
2252 {
2256
2257 if (is_base)
2258 {
2261 }
2262 }
2263 }
2264
2265
2267 }
2268
2269
2271 {
2274
2275 for ( int i = 0; i < construction_parts.Count(); ++i )
2276 {
2277 string key = construction_parts.GetKey( i );
2280 }
2281
2282
2284 }
2285
2287 {
2290
2291 for ( int i = 0; i < construction_parts.Count(); ++i )
2292 {
2293 string key = construction_parts.GetKey( i );
2295
2296 if ( value.
GetId() ==
id )
2297 {
2298 return value;
2299 }
2300 }
2301
2302 return NULL;
2303 }
2304
2305
2306
2308 {
2310 }
2311
2313 {
2315 }
2316
2318 {
2319 return true;
2320 }
2321
2323 {
2324 return false;
2325 }
2326
2327
2329 {
2332 {
2334 }
2335
2336 return construction_kit;
2337 }
2338
2340 {
2343 {
2345 }
2346 }
2347
2349 {
2351 }
2352
2354 {
2355 return "";
2356 }
2357
2359 {
2362 }
2363
2364
2366 {
2369 }
2370
2371
2373 {
2374 super.OnStoreSave( ctx );
2375
2376
2380
2382 }
2383
2385 {
2386 if ( !super.OnStoreLoad( ctx, version ) )
2387 return false;
2388
2389
2390
2392 {
2394 return false;
2395 }
2397 {
2399 return false;
2400 }
2402 {
2404 return false;
2405 }
2406
2407
2409 {
2411 return false;
2412 }
2413
2414
2415 return true;
2416 }
2417
2419 {
2420 super.AfterStoreLoad();
2421
2423 {
2425 }
2426 }
2427
2429 {
2430
2432
2433
2436
2437
2439 }
2440
2442 {
2443 super.OnCreatePhysics();
2446 }
2447
2449 {
2451 return;
2452
2453 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2454
2456 return;
2457
2459 string part_name = zone;
2461
2463 {
2464 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2465
2466 if ( construction_part && construction.IsPartConstructed( part_name ) )
2467 {
2469 construction.DestroyConnectedParts(part_name);
2470 }
2471
2472
2473 if ( part_name.
Contains(
"barbed") )
2474 {
2475 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2476 if (barbed_wire)
2477 barbed_wire.SetMountedState( false );
2478 }
2479 }
2480 }
2481
2483 {
2485 {
2487 }
2488
2489 super.EEOnAfterLoad();
2490 }
2491
2493 {
2494 super.EEInit();
2495
2496
2498
2499
2500 #ifdef DEVELOPER
2502 #endif
2503 }
2504
2506 {
2507 super.EEItemAttached( item, slot_name );
2508
2512 }
2513
2515 {
2516 super.EEItemDetached( item, slot_name );
2517
2520 }
2521
2522 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2523 {
2526
2529 }
2530
2531
2533 {
2534 return true;
2535 }
2536
2537
2538
2540 {
2542
2543
2544 if (construtionPart.
IsBase())
2545 {
2547
2548
2550 }
2551
2552
2554
2555
2557
2558
2560
2562
2564
2565
2567
2568
2570 }
2571
2573 {
2574
2576 }
2577
2578
2580 {
2583
2584
2586
2587
2589
2590
2592
2593
2595
2597
2598
2600
2601
2603
2604
2605 if (construtionPart.
IsBase())
2606 {
2607
2609 }
2610
2613 }
2614
2616 {
2617
2619 }
2620
2621
2622 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2623 {
2626
2627
2629
2630
2632
2633
2635
2636
2638
2640
2641
2643
2644
2646
2647
2648 if (construtionPart.
IsBase())
2649 {
2650
2652 }
2653
2656 }
2657
2659 {
2660
2662 }
2663
2665 {
2666 bool process = false;
2667
2668
2672
2673 if (process)
2674 {
2675 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2676 {
2678 return;
2679 }
2680
2682 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2683 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2684
2685
2687 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2688 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2689 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2690 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2691 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2692 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2693 mins = minTmp;
2694 maxs = maxTmp;
2695
2696 maxs[1] = maxs[1] + 0.35;
2697
2699 }
2700 }
2701
2703 {
2706
2707
2709 foreach (
EntityAI entity : foundEntities)
2710 {
2713 }
2714 }
2715
2716
2718 {
2720
2724 }
2725
2727 {
2729
2731 {
2733 }
2734 else
2735 {
2737 }
2738
2740 }
2741
2743 {
2745
2747 foreach (
string slotName : attachmentSlots)
2748 {
2750 }
2751
2752
2755 else
2757
2759 }
2760
2762 {
2763 string slotNameMounted = slot_name + "_Mounted";
2764 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2765
2766 if (attachment)
2767 {
2768 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2769 if (barbedWire && barbedWire.IsMounted())
2771 else
2773
2774 if (is_locked)
2775 {
2776 SetAnimationPhase(slotNameMounted, 0);
2777 SetAnimationPhase(slot_name, 1);
2778 }
2779 else
2780 {
2781 SetAnimationPhase(slotNameMounted, 1);
2782 SetAnimationPhase(slot_name, 0);
2783 }
2784 }
2785 else
2786 {
2787 SetAnimationPhase(slotNameMounted, 1);
2788 SetAnimationPhase(slot_name, 1);
2789
2791 }
2792 }
2793
2794
2796 {
2799
2802
2805
2806 foreach (
string slotName : attachmentSlots)
2807 {
2809 }
2810
2811
2813 {
2816
2818 }
2819 else
2820 {
2823
2825 }
2826
2829 }
2830
2832 {
2833
2835 return;
2836
2837 string slot_name_mounted = slot_name + "_Mounted";
2838 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2839
2840
2842 RemoveProxyPhysics( slot_name_mounted );
2843 RemoveProxyPhysics( slot_name );
2844
2845 if ( attachment )
2846 {
2848 if ( is_locked )
2849 {
2851 AddProxyPhysics( slot_name_mounted );
2852 }
2853 else
2854 {
2856 AddProxyPhysics( slot_name );
2857 }
2858 }
2859 }
2860
2862 {
2863 SetAffectPathgraph( true, false );
2865 }
2866
2868 {
2869 return true;
2870 }
2871
2873 {
2874 return true;
2875 }
2876
2878 {
2879 if ( attachment )
2880 {
2882 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2883
2884 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2885 }
2886
2887 return false;
2888 }
2889
2891 {
2893 }
2894
2895
2897 {
2898 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2899 if (
GetGame().ConfigIsExisting( config_path ) )
2900 {
2902 }
2903 }
2904
2906 {
2907 return true;
2908 }
2909
2911 {
2912 return true;
2913 }
2914
2916 {
2917 return true;
2918 }
2919
2920
2922 {
2924 {
2926 }
2927
2929 }
2930
2932 {
2934 }
2935
2936
2937
2939 {
2940 return super.CanReceiveAttachment(attachment, slotId);
2941 }
2942
2944 {
2945 int attachment_count = GetInventory().AttachmentCount();
2946 if ( attachment_count > 0 )
2947 {
2948 if (
HasBase() && attachment_count == 1 )
2949 {
2950 return false;
2951 }
2952
2953 return true;
2954 }
2955
2956 return false;
2957 }
2958
2960 {
2961 return true;
2962 }
2963
2965 {
2966 return false;
2967 }
2968
2969
2971 {
2972 return false;
2973 }
2974
2976 {
2977 return false;
2978 }
2979
2980
2982 {
2983 return false;
2984 }
2985
2986
2987
2989 {
2990 return true;
2991 }
2992
2994 {
2995 return true;
2996 }
2997
3000 {
3001 return false;
3002 }
3003
3004
3006 {
3007 return true;
3008 }
3009
3010
3012 {
3013 return false;
3014 }
3015
3016
3018 {
3019 return true;
3020 }
3021
3022
3024 {
3025 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3026 {
3027 return false;
3028 }
3029
3030 return true;
3031 }
3032
3034 {
3037
3038 return item;
3039 }
3040
3041
3043 {
3045 {
3046
3048
3049
3052
3054 if ( MemoryPointExists( slot_name + "_min" ) )
3055 {
3056 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3057 }
3058 if ( MemoryPointExists( slot_name + "_max" ) )
3059 {
3060 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3061 }
3062
3063
3066
3067
3070 center = ModelToWorld( center );
3071
3072
3075
3076 areaDamage.SetExtents( extents[0], extents[1] );
3077 areaDamage.SetAreaPosition( center );
3078 areaDamage.SetAreaOrientation( orientation );
3081 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3082 areaDamage.SetAmmoName( "BarbedWireHit" );
3083 areaDamage.Spawn();
3084
3086 }
3087 }
3088
3090 {
3091 if ( angle_deg != 0 )
3092 {
3093
3094 orientation[0] = orientation[0] - angle_deg;
3095
3096
3098 if ( MemoryPointExists( "rotate_axis" ) )
3099 {
3100 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3101 }
3102 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];
3103 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];
3104 center[0] = r_center_x;
3105 center[2] = r_center_z;
3106 }
3107 }
3108
3110 {
3112 {
3115 {
3116 if (areaDamage)
3117 {
3118 areaDamage.Destroy();
3119 }
3120
3122 }
3123 }
3124 }
3125
3127 {
3128 return true;
3129 }
3130
3131
3132
3133
3135 {
3137 }
3138
3140 {
3142 }
3143
3145 {
3147 }
3148
3150 {
3152
3153 switch ( material_type )
3154 {
3160 }
3161
3162 return "";
3163 }
3164
3166 {
3168
3169 switch ( material_type )
3170 {
3176 }
3177
3178 return "";
3179 }
3180
3181
3183 {
3185 {
3186
3188 {
3189 SetHealth(slot_name,"Health",item.GetHealth());
3190 }
3191 }
3192 }
3193
3195 {
3196 return 111;
3197 }
3198
3200 {
3201 super.SetActions();
3202
3206 }
3207
3208
3209
3210
3212 {
3213 }
3214
3217 {
3218 return null;
3219 }
3220
3222 {
3224 }
3225
3227 {
3230
3231 Man p;
3232
3233 #ifdef SERVER
3236 if (players.Count())
3237 p = players[0];
3238 #else
3240 #endif
3241
3243 {
3244 bool excluded = false;
3246 if (excludes)
3247 {
3248 foreach (string exclude : excludes)
3249 {
3251 {
3252 excluded = true;
3253 break;
3254 }
3255 }
3256 }
3257
3258 if (!excluded)
3259 {
3261 }
3262 }
3263
3265 }
3266}
3267
3269{
3270#ifdef BSB_DEBUG
3272#else
3273
3274#endif
3275}
3277{
3278#ifdef BSB_DEBUG_SPAM
3280#else
3281
3282#endif
3283}
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.