2220{
2222
2224
2226
2228
2234
2235
2236
2242
2248
2250
2254
2255
2257 {
2259
2260
2261 RegisterNetSyncVariableInt( "m_SyncParts01" );
2262 RegisterNetSyncVariableInt( "m_SyncParts02" );
2263 RegisterNetSyncVariableInt( "m_SyncParts03" );
2264 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2265 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2266 RegisterNetSyncVariableBool( "m_HasBase" );
2267
2268
2270
2271 if (ConfigIsExisting("hybridAttachments"))
2272 {
2275 }
2276 if (ConfigIsExisting("mountables"))
2277 {
2280 }
2281
2283 }
2284
2286 {
2287 super.EEDelete(parent);
2288
2290 {
2291 areaDamage.Destroy();
2292 }
2293
2294 }
2295
2297 {
2298 return "disableBaseDamage";
2299 }
2300
2302 {
2303 return true;
2304 }
2305
2307 {
2308 return EInventoryIconVisibility.HIDE_VICINITY;
2309 }
2310
2311
2313 {
2315 {
2316 SetSynchDirty();
2317 }
2318 }
2319
2321 {
2323 super.OnVariablesSynchronized();
2324
2326 }
2327
2329 {
2330
2332
2333
2335
2336
2338 }
2339
2340
2342 {
2343
2344 int offset;
2345 int mask;
2346
2347 if ( part_id >= 1 && part_id <= 31 )
2348 {
2349 offset = part_id - 1;
2350 mask = 1 << offset;
2351
2353 }
2354 else if ( part_id >= 32 && part_id <= 62 )
2355 {
2356 offset = ( part_id % 32 );
2357 mask = 1 << offset;
2358
2360 }
2361 else if ( part_id >= 63 && part_id <= 93 )
2362 {
2363 offset = ( part_id % 63 );
2364 mask = 1 << offset;
2365
2367 }
2368 }
2369
2371 {
2372
2373 int offset;
2374 int mask;
2375
2376 if ( part_id >= 1 && part_id <= 31 )
2377 {
2378 offset = part_id - 1;
2379 mask = 1 << offset;
2380
2382 }
2383 else if ( part_id >= 32 && part_id <= 62 )
2384 {
2385 offset = ( part_id % 32 );
2386 mask = 1 << offset;
2387
2389 }
2390 else if ( part_id >= 63 && part_id <= 93 )
2391 {
2392 offset = ( part_id % 63 );
2393 mask = 1 << offset;
2394
2396 }
2397 }
2398
2400 {
2401
2402 int offset;
2403 int mask;
2404
2405 if ( part_id >= 1 && part_id <= 31 )
2406 {
2407 offset = part_id - 1;
2408 mask = 1 << offset;
2409
2411 {
2412 return true;
2413 }
2414 }
2415 else if ( part_id >= 32 && part_id <= 62 )
2416 {
2417 offset = ( part_id % 32 );
2418 mask = 1 << offset;
2419
2421 {
2422 return true;
2423 }
2424 }
2425 else if ( part_id >= 63 && part_id <= 93 )
2426 {
2427 offset = ( part_id % 63 );
2428 mask = 1 << offset;
2429
2431 {
2432 return true;
2433 }
2434 }
2435
2436 return false;
2437 }
2438
2440 {
2443 }
2444
2446 {
2447
2450 }
2451
2453 {
2455 {
2458
2459 switch( build_action_id )
2460 {
2464 }
2465 }
2466 }
2467
2468
2470 {
2472 bool is_base = part.
IsBase();
2475 if ( is_part_built_sync )
2476 {
2478 {
2482
2483 if (is_base)
2484 {
2487 }
2488 }
2489 }
2490 else
2491 {
2493 {
2497
2498 if (is_base)
2499 {
2502 }
2503 }
2504 }
2505
2506
2508 }
2509
2510
2512 {
2515
2516 for ( int i = 0; i < construction_parts.Count(); ++i )
2517 {
2518 string key = construction_parts.GetKey( i );
2521 }
2522
2523
2525 }
2526
2528 {
2531
2532 for ( int i = 0; i < construction_parts.Count(); ++i )
2533 {
2534 string key = construction_parts.GetKey( i );
2536
2537 if ( value.
GetId() ==
id )
2538 {
2539 return value;
2540 }
2541 }
2542
2543 return NULL;
2544 }
2545
2546
2547
2549 {
2551 }
2552
2554 {
2556 }
2557
2559 {
2560 return true;
2561 }
2562
2564 {
2565 return false;
2566 }
2567
2568
2570 {
2573 {
2575 }
2576
2577 return construction_kit;
2578 }
2579
2581 {
2584 {
2586 }
2587 }
2588
2590 {
2592 }
2593
2595 {
2596 return "";
2597 }
2598
2600 {
2603 }
2604
2605
2607 {
2610 }
2611
2612
2614 {
2615 super.OnStoreSave( ctx );
2616
2617
2621
2623 }
2624
2626 {
2627 if ( !super.OnStoreLoad( ctx, version ) )
2628 return false;
2629
2630
2631
2633 {
2635 return false;
2636 }
2638 {
2640 return false;
2641 }
2643 {
2645 return false;
2646 }
2647
2648
2650 {
2652 return false;
2653 }
2654
2655
2656 return true;
2657 }
2658
2660 {
2661 super.AfterStoreLoad();
2662
2664 {
2666 }
2667 }
2668
2670 {
2671
2673
2674
2677
2678
2680 }
2681
2683 {
2684 super.OnCreatePhysics();
2687 }
2688
2690 {
2692 return;
2693
2694 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2695
2697 return;
2698
2700 string part_name = zone;
2702
2704 {
2705 ConstructionPart construction_part = construction.GetConstructionPart( part_name );
2706
2707 if ( construction_part && construction.IsPartConstructed( part_name ) )
2708 {
2710 construction.DestroyConnectedParts(part_name);
2711 }
2712
2713
2714 if ( part_name.
Contains(
"barbed") )
2715 {
2716 BarbedWire barbed_wire = BarbedWire.Cast( FindAttachmentBySlotName( zone ) );
2717 if (barbed_wire)
2718 barbed_wire.SetMountedState( false );
2719 }
2720 }
2721 }
2722
2724 {
2726 {
2728 }
2729
2730 super.EEOnAfterLoad();
2731 }
2732
2734 {
2735 super.EEInit();
2736
2737
2739
2740
2741 #ifdef DEVELOPER
2743 #endif
2744 }
2745
2747 {
2748 super.EEItemAttached( item, slot_name );
2749
2753 }
2754
2756 {
2757 super.EEItemDetached( item, slot_name );
2758
2761 }
2762
2763 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2764 {
2767
2770 }
2771
2772
2774 {
2775 return true;
2776 }
2777
2778
2779
2781 {
2783
2784
2785 if (construtionPart.
IsBase())
2786 {
2788
2789
2791 }
2792
2793
2795
2796
2798
2799
2801
2803
2805
2806
2808
2809
2811 }
2812
2814 {
2815
2817 }
2818
2819
2821 {
2824
2825
2827
2828
2830
2831
2833
2834
2836
2838
2839
2841
2842
2844
2845
2846 if (construtionPart.
IsBase())
2847 {
2848
2850 }
2851
2854 }
2855
2857 {
2858
2860 }
2861
2862
2863 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2864 {
2867
2868
2870
2871
2873
2874
2876
2877
2879
2881
2882
2884
2885
2887
2888
2889 if (construtionPart.
IsBase())
2890 {
2891
2893 }
2894
2897 }
2898
2900 {
2901
2903 }
2904
2906 {
2907 bool process = false;
2908
2909
2913
2914 if (process)
2915 {
2916 if (!MemoryPointExists(part.
m_PartName +
"_min") || !MemoryPointExists(part.
m_PartName +
"_max"))
2917 {
2919 return;
2920 }
2921
2923 mins = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_min"));
2924 maxs = ModelToWorld(GetMemoryPointPos(part.
m_PartName +
"_max"));
2925
2926
2928 minTmp[0] =
Math.
Min(mins[0],maxs[0]);
2929 maxTmp[0] =
Math.
Max(mins[0],maxs[0]);
2930 minTmp[1] =
Math.
Min(mins[1],maxs[1]);
2931 maxTmp[1] =
Math.
Max(mins[1],maxs[1]);
2932 minTmp[2] =
Math.
Min(mins[2],maxs[2]);
2933 maxTmp[2] =
Math.
Max(mins[2],maxs[2]);
2934 mins = minTmp;
2935 maxs = maxTmp;
2936
2937 maxs[1] = maxs[1] + 0.35;
2938
2940 }
2941 }
2942
2944 {
2947
2948
2950 foreach (
EntityAI entity : foundEntities)
2951 {
2954 }
2955 }
2956
2957
2959 {
2961
2965 }
2966
2968 {
2970
2972 {
2974 }
2975 else
2976 {
2978 }
2979
2981 }
2982
2984 {
2986
2988 foreach (
string slotName : attachmentSlots)
2989 {
2991 }
2992
2993
2996 else
2998
3000 }
3001
3003 {
3004 string slotNameMounted = slot_name + "_Mounted";
3005 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3006
3007 if (attachment)
3008 {
3009 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3010 if (barbedWire && barbedWire.IsMounted())
3012 else
3014
3015 if (is_locked)
3016 {
3017 SetAnimationPhase(slotNameMounted, 0);
3018 SetAnimationPhase(slot_name, 1);
3019 }
3020 else
3021 {
3022 SetAnimationPhase(slotNameMounted, 1);
3023 SetAnimationPhase(slot_name, 0);
3024 }
3025 }
3026 else
3027 {
3028 SetAnimationPhase(slotNameMounted, 1);
3029 SetAnimationPhase(slot_name, 1);
3030
3032 }
3033 }
3034
3035
3037 {
3040
3043
3046
3047 foreach (
string slotName : attachmentSlots)
3048 {
3050 }
3051
3052
3054 {
3057
3059 }
3060 else
3061 {
3064
3066 }
3067
3070 }
3071
3073 {
3074
3076 return;
3077
3078 string slot_name_mounted = slot_name + "_Mounted";
3079 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3080
3081
3083 RemoveProxyPhysics( slot_name_mounted );
3084 RemoveProxyPhysics( slot_name );
3085
3086 if ( attachment )
3087 {
3089 if ( is_locked )
3090 {
3092 AddProxyPhysics( slot_name_mounted );
3093 }
3094 else
3095 {
3097 AddProxyPhysics( slot_name );
3098 }
3099 }
3100 }
3101
3103 {
3104 SetAffectPathgraph( true, false );
3106 }
3107
3109 {
3110 return true;
3111 }
3112
3114 {
3115 return true;
3116 }
3117
3119 {
3120 if ( attachment )
3121 {
3123 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3124
3125 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3126 }
3127
3128 return false;
3129 }
3130
3132 {
3134 }
3135
3136
3138 {
3139 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3140 if (
GetGame().ConfigIsExisting( config_path ) )
3141 {
3143 }
3144 }
3145
3147 {
3148 return true;
3149 }
3150
3152 {
3153 return true;
3154 }
3155
3157 {
3158 return true;
3159 }
3160
3161
3163 {
3165 {
3167 }
3168
3170 }
3171
3173 {
3175 }
3176
3177
3178
3180 {
3181 return super.CanReceiveAttachment(attachment, slotId);
3182 }
3183
3185 {
3186 int attachment_count = GetInventory().AttachmentCount();
3187 if ( attachment_count > 0 )
3188 {
3189 if (
HasBase() && attachment_count == 1 )
3190 {
3191 return false;
3192 }
3193
3194 return true;
3195 }
3196
3197 return false;
3198 }
3199
3201 {
3202 return true;
3203 }
3204
3206 {
3207 return false;
3208 }
3209
3210
3212 {
3213 return false;
3214 }
3215
3217 {
3218 return false;
3219 }
3220
3221
3223 {
3224 return false;
3225 }
3226
3227
3228
3230 {
3231 return true;
3232 }
3233
3235 {
3236 return true;
3237 }
3238
3241 {
3242 return false;
3243 }
3244
3245
3247 {
3248 return true;
3249 }
3250
3251
3253 {
3254 return false;
3255 }
3256
3257
3259 {
3260 return true;
3261 }
3262
3263
3265 {
3266 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3267 {
3268 return false;
3269 }
3270
3271 return true;
3272 }
3273
3275 {
3278
3279 return item;
3280 }
3281
3282
3284 {
3286 {
3287
3289
3290
3293
3295 if ( MemoryPointExists( slot_name + "_min" ) )
3296 {
3297 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3298 }
3299 if ( MemoryPointExists( slot_name + "_max" ) )
3300 {
3301 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3302 }
3303
3304
3307
3308
3311 center = ModelToWorld( center );
3312
3313
3316
3317 areaDamage.SetExtents( extents[0], extents[1] );
3318 areaDamage.SetAreaPosition( center );
3319 areaDamage.SetAreaOrientation( orientation );
3322 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3323 areaDamage.SetAmmoName( "BarbedWireHit" );
3324 areaDamage.Spawn();
3325
3327 }
3328 }
3329
3331 {
3332 if ( angle_deg != 0 )
3333 {
3334
3335 orientation[0] = orientation[0] - angle_deg;
3336
3337
3339 if ( MemoryPointExists( "rotate_axis" ) )
3340 {
3341 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3342 }
3343 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];
3344 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];
3345 center[0] = r_center_x;
3346 center[2] = r_center_z;
3347 }
3348 }
3349
3351 {
3353 {
3356 {
3357 if (areaDamage)
3358 {
3359 areaDamage.Destroy();
3360 }
3361
3363 }
3364 }
3365 }
3366
3368 {
3369 return true;
3370 }
3371
3372
3373
3374
3376 {
3378 }
3379
3381 {
3383 }
3384
3386 {
3388 }
3389
3391 {
3393
3394 switch ( material_type )
3395 {
3401 }
3402
3403 return "";
3404 }
3405
3407 {
3409
3410 switch ( material_type )
3411 {
3417 }
3418
3419 return "";
3420 }
3421
3422
3424 {
3426 {
3427
3429 {
3430 SetHealth(slot_name,"Health",item.GetHealth());
3431 }
3432 }
3433 }
3434
3436 {
3437 return 111;
3438 }
3439
3441 {
3442 super.SetActions();
3443
3447 }
3448
3449
3450
3451
3453 {
3454 }
3455
3458 {
3459 return null;
3460 }
3461
3463 {
3465 }
3466
3468 {
3471
3472 Man p;
3473
3474 #ifdef SERVER
3477 if (players.Count())
3478 p = players[0];
3479 #else
3481 #endif
3482
3484 {
3485 bool excluded = false;
3487 if (excludes)
3488 {
3489 foreach (string exclude : excludes)
3490 {
3492 {
3493 excluded = true;
3494 break;
3495 }
3496 }
3497 }
3498
3499 if (!excluded)
3500 {
3502 }
3503 }
3504
3506 }
3507}
3508
3510{
3511#ifdef BSB_DEBUG
3513#else
3514
3515#endif
3516}
3518{
3519#ifdef BSB_DEBUG_SPAM
3521#else
3522
3523#endif
3524}
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.