2076{
2078
2080
2082
2084
2090
2091
2092
2098
2104
2106
2110
2111
2113 {
2115
2116
2117 RegisterNetSyncVariableInt( "m_SyncParts01" );
2118 RegisterNetSyncVariableInt( "m_SyncParts02" );
2119 RegisterNetSyncVariableInt( "m_SyncParts03" );
2120 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2121 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2122 RegisterNetSyncVariableBool( "m_HasBase" );
2123
2124
2126
2127 if (ConfigIsExisting("hybridAttachments"))
2128 {
2131 }
2132 if (ConfigIsExisting("mountables"))
2133 {
2136 }
2137
2139 }
2140
2142 {
2143 super.EEDelete(parent);
2144
2146 {
2147 areaDamage.Destroy();
2148 }
2149
2150 }
2151
2153 {
2154 return "disableBaseDamage";
2155 }
2156
2158 {
2159 return true;
2160 }
2161
2163 {
2164 return EInventoryIconVisibility.HIDE_VICINITY;
2165 }
2166
2167
2169 {
2171 {
2172 SetSynchDirty();
2173 }
2174 }
2175
2177 {
2179 super.OnVariablesSynchronized();
2180
2182 }
2183
2185 {
2186
2188
2189
2191
2192
2194 }
2195
2196
2198 {
2199
2200 int offset;
2201 int mask;
2202
2203 if ( part_id >= 1 && part_id <= 31 )
2204 {
2205 offset = part_id - 1;
2206 mask = 1 << offset;
2207
2209 }
2210 else if ( part_id >= 32 && part_id <= 62 )
2211 {
2212 offset = ( part_id % 32 );
2213 mask = 1 << offset;
2214
2216 }
2217 else if ( part_id >= 63 && part_id <= 93 )
2218 {
2219 offset = ( part_id % 63 );
2220 mask = 1 << offset;
2221
2223 }
2224 }
2225
2227 {
2228
2229 int offset;
2230 int mask;
2231
2232 if ( part_id >= 1 && part_id <= 31 )
2233 {
2234 offset = part_id - 1;
2235 mask = 1 << offset;
2236
2238 }
2239 else if ( part_id >= 32 && part_id <= 62 )
2240 {
2241 offset = ( part_id % 32 );
2242 mask = 1 << offset;
2243
2245 }
2246 else if ( part_id >= 63 && part_id <= 93 )
2247 {
2248 offset = ( part_id % 63 );
2249 mask = 1 << offset;
2250
2252 }
2253 }
2254
2256 {
2257
2258 int offset;
2259 int mask;
2260
2261 if ( part_id >= 1 && part_id <= 31 )
2262 {
2263 offset = part_id - 1;
2264 mask = 1 << offset;
2265
2267 {
2268 return true;
2269 }
2270 }
2271 else if ( part_id >= 32 && part_id <= 62 )
2272 {
2273 offset = ( part_id % 32 );
2274 mask = 1 << offset;
2275
2277 {
2278 return true;
2279 }
2280 }
2281 else if ( part_id >= 63 && part_id <= 93 )
2282 {
2283 offset = ( part_id % 63 );
2284 mask = 1 << offset;
2285
2287 {
2288 return true;
2289 }
2290 }
2291
2292 return false;
2293 }
2294
2296 {
2299 }
2300
2302 {
2303
2306 }
2307
2309 {
2311 {
2314
2315 switch( build_action_id )
2316 {
2320 }
2321 }
2322 }
2323
2324
2326 {
2328 bool is_base = part.
IsBase();
2331 if ( is_part_built_sync )
2332 {
2334 {
2338
2339 if (is_base)
2340 {
2343 }
2344 }
2345 }
2346 else
2347 {
2349 {
2353
2354 if (is_base)
2355 {
2358 }
2359 }
2360 }
2361
2362
2364 }
2365
2366
2368 {
2371
2372 for ( int i = 0; i < construction_parts.Count(); ++i )
2373 {
2374 string key = construction_parts.GetKey( i );
2377 }
2378
2379
2381 }
2382
2384 {
2387
2388 for ( int i = 0; i < construction_parts.Count(); ++i )
2389 {
2390 string key = construction_parts.GetKey( i );
2392
2393 if ( value.
GetId() ==
id )
2394 {
2395 return value;
2396 }
2397 }
2398
2399 return NULL;
2400 }
2401
2402
2403
2405 {
2407 }
2408
2410 {
2412 }
2413
2415 {
2416 return true;
2417 }
2418
2420 {
2421 return false;
2422 }
2423
2424
2426 {
2429 {
2431 }
2432
2433 return construction_kit;
2434 }
2435
2437 {
2440 {
2442 }
2443 }
2444
2446 {
2448 }
2449
2451 {
2452 return "";
2453 }
2454
2456 {
2459 }
2460
2461
2463 {
2466 }
2467
2468
2470 {
2471 super.OnStoreSave( ctx );
2472
2473
2477
2479 }
2480
2482 {
2483 if ( !super.OnStoreLoad( ctx, version ) )
2484 return false;
2485
2486
2487
2489 {
2491 return false;
2492 }
2494 {
2496 return false;
2497 }
2499 {
2501 return false;
2502 }
2503
2504
2506 {
2508 return false;
2509 }
2510
2511
2512 return true;
2513 }
2514
2516 {
2517 super.AfterStoreLoad();
2518
2520 {
2522 }
2523 }
2524
2526 {
2527
2529
2530
2533
2534
2536 }
2537
2539 {
2540 super.OnCreatePhysics();
2543 }
2544
2546 {
2548 return;
2549
2550 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2551
2553 return;
2554
2556 string part_name = zone;
2558
2560 {
2561 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2562
2563 if ( construction_part && construction.IsPartConstructed( part_name ) )
2564 {
2566 construction.DestroyConnectedParts(part_name);
2567 }
2568
2569
2570 if ( part_name.
Contains(
"barbed") )
2571 {
2572 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2573 if (barbed_wire)
2574 barbed_wire.SetMountedState( false );
2575 }
2576 }
2577 }
2578
2580 {
2582 {
2584 }
2585
2586 super.EEOnAfterLoad();
2587 }
2588
2590 {
2591 super.EEInit();
2592
2593
2595
2596
2597 #ifdef DEVELOPER
2599 #endif
2600 }
2601
2603 {
2604 super.EEItemAttached( item, slot_name );
2605
2609 }
2610
2612 {
2613 super.EEItemDetached( item, slot_name );
2614
2617 }
2618
2619 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2620 {
2623
2626 }
2627
2628
2630 {
2631 return true;
2632 }
2633
2634
2635
2637 {
2639
2640
2641 if (construtionPart.
IsBase())
2642 {
2644
2645
2647 }
2648
2649
2651
2652
2654
2655
2657
2659
2661
2662
2664
2665
2667 }
2668
2670 {
2671
2673 }
2674
2675
2677 {
2680
2681
2683
2684
2686
2687
2689
2690
2692
2694
2695
2697
2698
2700
2701
2702 if (construtionPart.
IsBase())
2703 {
2704
2706 }
2707
2710 }
2711
2713 {
2714
2716 }
2717
2718
2719 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2720 {
2723
2724
2726
2727
2729
2730
2732
2733
2735
2737
2738
2740
2741
2743
2744
2745 if (construtionPart.
IsBase())
2746 {
2747
2749 }
2750
2753 }
2754
2756 {
2757
2759 }
2760
2762 {
2763 bool process = false;
2764
2765
2769
2770 if (process)
2771 {
2772 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2773 {
2775 return;
2776 }
2777
2779 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2780 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2781
2782
2784 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2785 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2786 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2787 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2788 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2789 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2790 mins = minTmp;
2791 maxs = maxTmp;
2792
2793 maxs[1] = maxs[1] + 0.35;
2794
2796 }
2797 }
2798
2800 {
2803
2804
2806 foreach (
EntityAI entity : foundEntities)
2807 {
2810 }
2811 }
2812
2813
2815 {
2817
2821 }
2822
2824 {
2826
2828 {
2830 }
2831 else
2832 {
2834 }
2835
2837 }
2838
2840 {
2842
2844 foreach (
string slotName : attachmentSlots)
2845 {
2847 }
2848
2849
2852 else
2854
2856 }
2857
2859 {
2860 string slotNameMounted = slot_name + "_Mounted";
2861 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2862
2863 if (attachment)
2864 {
2865 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2866 if (barbedWire && barbedWire.IsMounted())
2868 else
2870
2871 if (is_locked)
2872 {
2873 SetAnimationPhase(slotNameMounted, 0);
2874 SetAnimationPhase(slot_name, 1);
2875 }
2876 else
2877 {
2878 SetAnimationPhase(slotNameMounted, 1);
2879 SetAnimationPhase(slot_name, 0);
2880 }
2881 }
2882 else
2883 {
2884 SetAnimationPhase(slotNameMounted, 1);
2885 SetAnimationPhase(slot_name, 1);
2886
2888 }
2889 }
2890
2891
2893 {
2896
2899
2902
2903 foreach (
string slotName : attachmentSlots)
2904 {
2906 }
2907
2908
2910 {
2913
2915 }
2916 else
2917 {
2920
2922 }
2923
2926 }
2927
2929 {
2930
2932 return;
2933
2934 string slot_name_mounted = slot_name + "_Mounted";
2935 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2936
2937
2939 RemoveProxyPhysics( slot_name_mounted );
2940 RemoveProxyPhysics( slot_name );
2941
2942 if ( attachment )
2943 {
2945 if ( is_locked )
2946 {
2948 AddProxyPhysics( slot_name_mounted );
2949 }
2950 else
2951 {
2953 AddProxyPhysics( slot_name );
2954 }
2955 }
2956 }
2957
2959 {
2960 SetAffectPathgraph( true, false );
2962 }
2963
2965 {
2966 return true;
2967 }
2968
2970 {
2971 return true;
2972 }
2973
2975 {
2976 if ( attachment )
2977 {
2979 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2980
2981 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2982 }
2983
2984 return false;
2985 }
2986
2988 {
2990 }
2991
2992
2994 {
2995 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2996 if (
GetGame().ConfigIsExisting( config_path ) )
2997 {
2999 }
3000 }
3001
3003 {
3004 return true;
3005 }
3006
3008 {
3009 return true;
3010 }
3011
3013 {
3014 return true;
3015 }
3016
3017
3019 {
3021 {
3023 }
3024
3026 }
3027
3029 {
3031 }
3032
3033
3034
3036 {
3037 return super.CanReceiveAttachment(attachment, slotId);
3038 }
3039
3041 {
3042 int attachment_count = GetInventory().AttachmentCount();
3043 if ( attachment_count > 0 )
3044 {
3045 if (
HasBase() && attachment_count == 1 )
3046 {
3047 return false;
3048 }
3049
3050 return true;
3051 }
3052
3053 return false;
3054 }
3055
3057 {
3058 return true;
3059 }
3060
3062 {
3063 return false;
3064 }
3065
3066
3068 {
3069 return false;
3070 }
3071
3073 {
3074 return false;
3075 }
3076
3077
3079 {
3080 return false;
3081 }
3082
3083
3084
3086 {
3087 return true;
3088 }
3089
3091 {
3092 return true;
3093 }
3094
3097 {
3098 return false;
3099 }
3100
3101
3103 {
3104 return true;
3105 }
3106
3107
3109 {
3110 return false;
3111 }
3112
3113
3115 {
3116 return true;
3117 }
3118
3119
3121 {
3122 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3123 {
3124 return false;
3125 }
3126
3127 return true;
3128 }
3129
3131 {
3134
3135 return item;
3136 }
3137
3138
3140 {
3142 {
3143
3145
3146
3149
3151 if ( MemoryPointExists( slot_name + "_min" ) )
3152 {
3153 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3154 }
3155 if ( MemoryPointExists( slot_name + "_max" ) )
3156 {
3157 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3158 }
3159
3160
3163
3164
3167 center = ModelToWorld( center );
3168
3169
3172
3173 areaDamage.SetExtents( extents[0], extents[1] );
3174 areaDamage.SetAreaPosition( center );
3175 areaDamage.SetAreaOrientation( orientation );
3178 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3179 areaDamage.SetAmmoName( "BarbedWireHit" );
3180 areaDamage.Spawn();
3181
3183 }
3184 }
3185
3187 {
3188 if ( angle_deg != 0 )
3189 {
3190
3191 orientation[0] = orientation[0] - angle_deg;
3192
3193
3195 if ( MemoryPointExists( "rotate_axis" ) )
3196 {
3197 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3198 }
3199 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];
3200 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];
3201 center[0] = r_center_x;
3202 center[2] = r_center_z;
3203 }
3204 }
3205
3207 {
3209 {
3212 {
3213 if (areaDamage)
3214 {
3215 areaDamage.Destroy();
3216 }
3217
3219 }
3220 }
3221 }
3222
3224 {
3225 return true;
3226 }
3227
3228
3229
3230
3232 {
3234 }
3235
3237 {
3239 }
3240
3242 {
3244 }
3245
3247 {
3249
3250 switch ( material_type )
3251 {
3257 }
3258
3259 return "";
3260 }
3261
3263 {
3265
3266 switch ( material_type )
3267 {
3273 }
3274
3275 return "";
3276 }
3277
3278
3280 {
3282 {
3283
3285 {
3286 SetHealth(slot_name,"Health",item.GetHealth());
3287 }
3288 }
3289 }
3290
3292 {
3293 return 111;
3294 }
3295
3297 {
3298 super.SetActions();
3299
3303 }
3304
3305
3306
3307
3309 {
3310 }
3311
3314 {
3315 return null;
3316 }
3317
3319 {
3321 }
3322
3324 {
3327
3328 Man p;
3329
3330 #ifdef SERVER
3333 if (players.Count())
3334 p = players[0];
3335 #else
3337 #endif
3338
3340 {
3341 bool excluded = false;
3343 if (excludes)
3344 {
3345 foreach (string exclude : excludes)
3346 {
3348 {
3349 excluded = true;
3350 break;
3351 }
3352 }
3353 }
3354
3355 if (!excluded)
3356 {
3358 }
3359 }
3360
3362 }
3363}
3364
3366{
3367#ifdef BSB_DEBUG
3369#else
3370
3371#endif
3372}
3374{
3375#ifdef BSB_DEBUG_SPAM
3377#else
3378
3379#endif
3380}
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.