2373{
2375
2377
2379
2386
2387
2388
2394
2400
2402
2406
2407
2409 {
2411
2412
2413 RegisterNetSyncVariableInt( "m_SyncParts01" );
2414 RegisterNetSyncVariableInt( "m_SyncParts02" );
2415 RegisterNetSyncVariableInt( "m_SyncParts03" );
2416 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2417 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2418 RegisterNetSyncVariableBool( "m_HasBase" );
2419
2420
2421 ConstructionInit();
2422
2423 if (ConfigIsExisting("hybridAttachments"))
2424 {
2427 }
2428 if (ConfigIsExisting("mountables"))
2429 {
2432 }
2433
2435 SetAllowDamage(true);
2436 }
2437
2439 {
2440 return "disableBaseDamage";
2441 }
2442
2444 {
2445 return true;
2446 }
2447
2449 {
2450 return EInventoryIconVisibility.HIDE_VICINITY;
2451 }
2452
2454 {
2455 super.InitItemSounds();
2456
2460
2465 }
2466
2468 {
2469 return "putDown_FenceKit_SoundSet";
2470 }
2471
2473 {
2474 return "Shelter_Site_Build_Loop_SoundSet";
2475 }
2476
2477
2479 {
2481 {
2482 SetSynchDirty();
2483 }
2484 }
2485
2487 {
2489 super.OnVariablesSynchronized();
2490
2492 }
2493
2495 {
2496
2498
2499
2501
2502
2504 }
2505
2506
2508 {
2509
2510 int offset;
2511 int mask;
2512
2513 if ( part_id >= 1 && part_id <= 31 )
2514 {
2515 offset = part_id - 1;
2516 mask = 1 << offset;
2517
2519 }
2520 else if ( part_id >= 32 && part_id <= 62 )
2521 {
2522 offset = ( part_id % 32 );
2523 mask = 1 << offset;
2524
2526 }
2527 else if ( part_id >= 63 && part_id <= 93 )
2528 {
2529 offset = ( part_id % 63 );
2530 mask = 1 << offset;
2531
2533 }
2534 }
2535
2537 {
2538
2539 int offset;
2540 int mask;
2541
2542 if ( part_id >= 1 && part_id <= 31 )
2543 {
2544 offset = part_id - 1;
2545 mask = 1 << offset;
2546
2548 }
2549 else if ( part_id >= 32 && part_id <= 62 )
2550 {
2551 offset = ( part_id % 32 );
2552 mask = 1 << offset;
2553
2555 }
2556 else if ( part_id >= 63 && part_id <= 93 )
2557 {
2558 offset = ( part_id % 63 );
2559 mask = 1 << offset;
2560
2562 }
2563 }
2564
2566 {
2567
2568 int offset;
2569 int mask;
2570
2571 if ( part_id >= 1 && part_id <= 31 )
2572 {
2573 offset = part_id - 1;
2574 mask = 1 << offset;
2575
2577 {
2578 return true;
2579 }
2580 }
2581 else if ( part_id >= 32 && part_id <= 62 )
2582 {
2583 offset = ( part_id % 32 );
2584 mask = 1 << offset;
2585
2587 {
2588 return true;
2589 }
2590 }
2591 else if ( part_id >= 63 && part_id <= 93 )
2592 {
2593 offset = ( part_id % 63 );
2594 mask = 1 << offset;
2595
2597 {
2598 return true;
2599 }
2600 }
2601
2602 return false;
2603 }
2604
2606 {
2609 }
2610
2612 {
2613
2616 }
2617
2619 {
2621 {
2624
2625 switch( build_action_id )
2626 {
2630 }
2631 }
2632 }
2633
2634
2636 {
2638 bool is_base = part.
IsBase();
2641 if ( is_part_built_sync )
2642 {
2644 {
2648
2649 if (is_base)
2650 {
2653 }
2654 }
2655 }
2656 else
2657 {
2659 {
2663
2664 if (is_base)
2665 {
2668 }
2669 }
2670 }
2671
2672
2674 }
2675
2676
2678 {
2681
2682 for ( int i = 0; i < construction_parts.Count(); ++i )
2683 {
2684 string key = construction_parts.GetKey( i );
2687 }
2688
2689
2691 }
2692
2694 {
2697
2698 for ( int i = 0; i < construction_parts.Count(); ++i )
2699 {
2700 string key = construction_parts.GetKey( i );
2702
2703 if ( value.
GetId() ==
id )
2704 {
2705 return value;
2706 }
2707 }
2708
2709 return NULL;
2710 }
2711
2712
2713
2715 {
2717 }
2718
2720 {
2722 }
2723
2725 {
2726 return true;
2727 }
2728
2730 {
2731 return false;
2732 }
2733
2734
2736 {
2739 {
2741 }
2742
2743 return construction_kit;
2744 }
2745
2747 {
2750 {
2752 }
2753 }
2754
2756 {
2758 }
2759
2761 {
2762 return "";
2763 }
2764
2766 {
2768 g_Game.ObjectDelete( construction_kit );
2769 }
2770
2771
2773 {
2775 g_Game.ObjectDelete(
this );
2776 }
2777
2778
2780 {
2781 super.EEDelete(parent);
2782
2784 {
2785 areaDamage.Destroy();
2786 }
2787
2788 }
2789
2791 {
2792 super.OnStoreSave( ctx );
2793
2794
2798
2800 }
2801
2803 {
2804 if ( !super.OnStoreLoad( ctx, version ) )
2805 return false;
2806
2807
2808
2810 {
2812 return false;
2813 }
2815 {
2817 return false;
2818 }
2820 {
2822 return false;
2823 }
2824
2825
2827 {
2829 return false;
2830 }
2831
2832
2833 return true;
2834 }
2835
2837 {
2838 super.AfterStoreLoad();
2839
2841 {
2843 }
2844 }
2845
2847 {
2848
2850
2851
2854
2855
2857 }
2858
2860 {
2861 super.OnCreatePhysics();
2862
2863 ConstructionInit();
2865 }
2866
2868 {
2870 return;
2871
2872 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2873 }
2874
2876 {
2878 {
2880 }
2881
2882 super.EEOnAfterLoad();
2883 }
2884
2886 {
2887 super.EEItemAttached( item, slot_name );
2888
2892 }
2893
2895 {
2896 super.EEItemDetached( item, slot_name );
2897
2900 }
2901
2902 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2903 {
2906
2909 }
2910
2911
2913 {
2914 return true;
2915 }
2916
2917
2918
2920 {
2922
2923
2924 if (construtionPart.
IsBase())
2925 {
2927
2928
2930 }
2931
2932
2934
2935
2937
2938
2940
2942
2944
2945
2947
2948
2950 }
2951
2953 {
2954
2956 }
2957
2958
2960 {
2963
2964
2966
2967
2969
2970
2972
2973
2975
2977
2978
2980
2981
2983
2984
2985 if (construtionPart.
IsBase())
2986 {
2987
2989 }
2990 }
2991
2993 {
2994
2996 }
2997
2998
2999 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3000 {
3003
3004
3006
3007
3009
3010
3012
3013
3015
3017
3018
3020
3021
3023
3024
3025 if (construtionPart.
IsBase())
3026 {
3027
3029 }
3030 }
3031
3033 {
3034
3036 }
3037
3038
3040 {
3042
3045 }
3046
3048 {
3050
3052 {
3054 }
3055 else
3056 {
3058 }
3059
3061 }
3062
3064 {
3066
3068 foreach (
string slotName : attachmentSlots)
3069 {
3071 }
3072
3073
3076 else
3078
3080 }
3081
3083 {
3084 string slotNameMounted = slot_name + "_Mounted";
3085 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3086
3087 if (attachment)
3088 {
3089 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3090 if (barbedWire && barbedWire.IsMounted())
3092 else
3094
3095 if (is_locked)
3096 {
3097 SetAnimationPhase(slotNameMounted, 0);
3098 SetAnimationPhase(slot_name, 1);
3099 }
3100 else
3101 {
3102 SetAnimationPhase(slotNameMounted, 1);
3103 SetAnimationPhase(slot_name, 0);
3104 }
3105 }
3106 else
3107 {
3108 SetAnimationPhase(slotNameMounted, 1);
3109 SetAnimationPhase(slot_name, 1);
3110
3112 }
3113 }
3114
3115
3117 {
3120
3123
3126
3127 foreach (
string slotName : attachmentSlots)
3128 {
3130 }
3131
3132
3134 {
3137
3139 }
3140 else
3141 {
3144
3146 }
3147
3150 }
3151
3153 {
3154
3156 return;
3157
3158 string slot_name_mounted = slot_name + "_Mounted";
3159 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3160
3161
3163 RemoveProxyPhysics( slot_name_mounted );
3164 RemoveProxyPhysics( slot_name );
3165
3166 if ( attachment )
3167 {
3169 if ( is_locked )
3170 {
3172 AddProxyPhysics( slot_name_mounted );
3173 }
3174 else
3175 {
3177 AddProxyPhysics( slot_name );
3178 }
3179 }
3180 }
3181
3183 {
3184 SetAffectPathgraph( true, false );
3186 }
3187
3189 {
3190 return true;
3191 }
3192
3194 {
3195 return true;
3196 }
3197
3199 {
3200 if ( attachment )
3201 {
3203 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3204
3205 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3206 }
3207
3208 return false;
3209 }
3210
3212 {
3214 }
3215
3216
3218 {
3219 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3220 if (
g_Game.ConfigIsExisting( config_path ) )
3221 {
3222 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3223 }
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3232 {
3233 return true;
3234 }
3235
3237 {
3238 return true;
3239 }
3240
3241
3243 {
3246 }
3247
3249 {
3251 }
3252
3254 {
3256 }
3257
3259 {
3260 int attachment_count = GetInventory().AttachmentCount();
3261 if ( attachment_count > 0 )
3262 {
3263 if (
HasBase() && attachment_count == 1 )
3264 {
3265 return false;
3266 }
3267
3268 return true;
3269 }
3270
3271 return false;
3272 }
3273
3275 {
3276 return true;
3277 }
3278
3280 {
3281 return false;
3282 }
3283
3284
3286 {
3287 return false;
3288 }
3289
3291 {
3292 return false;
3293 }
3294
3295
3297 {
3298 return false;
3299 }
3300
3301
3302
3304 {
3305 return true;
3306 }
3307
3309 {
3310 return true;
3311 }
3312
3315 {
3316 return false;
3317 }
3318
3319
3321 {
3322 return false;
3323 }
3324
3325
3327 {
3328 return true;
3329 }
3330
3331
3333 {
3334 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3335 {
3336 return false;
3337 }
3338
3339 return true;
3340 }
3341
3343 {
3346
3347 return item;
3348 }
3349
3350
3352 {
3354 {
3355
3357
3358
3361
3363 if ( MemoryPointExists( slot_name + "_min" ) )
3364 {
3365 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3366 }
3367 if ( MemoryPointExists( slot_name + "_max" ) )
3368 {
3369 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3370 }
3371
3372
3375
3376
3379 center = ModelToWorld( center );
3380
3381
3384
3385 areaDamage.SetExtents( extents[0], extents[1] );
3386 areaDamage.SetAreaPosition( center );
3390 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3391 areaDamage.SetAmmoName( "BarbedWireHit" );
3392 areaDamage.Spawn();
3393
3395 }
3396 }
3397
3399 {
3400 if ( angle_deg != 0 )
3401 {
3402
3404
3405
3407 if ( MemoryPointExists( "rotate_axis" ) )
3408 {
3409 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3410 }
3411 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];
3412 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];
3413 center[0] = r_center_x;
3414 center[2] = r_center_z;
3415 }
3416 }
3417
3419 {
3421 {
3424 {
3425 if (areaDamage)
3426 {
3427 areaDamage.Destroy();
3428 }
3429
3431 }
3432 }
3433 }
3434
3436 {
3437 return true;
3438 }
3439
3440
3441
3442
3444 {
3446 }
3447
3449 {
3451 }
3452
3454 {
3456 }
3457
3459 {
3461
3462 switch ( material_type )
3463 {
3469 }
3470
3471 return "";
3472 }
3473
3475 {
3477
3478 switch ( material_type )
3479 {
3485 }
3486
3487 return "";
3488 }
3489
3490
3492 {
3494 {
3495
3497 {
3498 SetHealth(slot_name,"Health",item.GetHealth());
3499 }
3500 }
3501 }
3502
3504 {
3505 return 111;
3506 }
3507
3509 {
3510 super.SetActions();
3511
3515 }
3516
3518 {
3520 if (!construction)
3521 return;
3522
3524 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3525 {
3528 {
3530 }
3531 }
3532 }
3533
3535 {
3537 if (!construction)
3538 return;
3539
3541 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3542 {
3545 {
3546 construction.HandleEntityFalling(part.
GetPartName());
3547 }
3548 }
3549 }
3550
3553 {
3555 return;
3556
3559
3560 if (DestroyOnFall())
3561 {
3563 {
3565 }
3566 else
3567 {
3569 {
3571 }
3573 }
3574 }
3575 }
3576
3578 {
3579 if (HasAnyAttachmentsOrCargo())
3580 {
3583 }
3584 }
3585
3586
3587
3588
3589
3592 {
3593 return null;
3594 }
3595
3597 {
3599 }
3600
3602 {
3605
3606 Man p;
3607
3608 #ifdef SERVER
3610 g_Game.GetWorld().GetPlayerList(players);
3611 if (players.Count())
3612 p = players[0];
3613 #else
3615 #endif
3616
3618 {
3619 bool excluded = false;
3621 if (excludes)
3622 {
3623 foreach (string exclude : excludes)
3624 {
3626 {
3627 excluded = true;
3628 break;
3629 }
3630 }
3631 }
3632
3633 if (!excluded)
3634 {
3636 }
3637 }
3638
3640 }
3641
3643
3645 [
Obsolete(
"handled in the Construction component directly")]
3647 {
3648 }
3649
3650 [
Obsolete(
"handled in the Construction component directly")]
3652 {
3653 }
3654
3655 [
Obsolete(
"obsolete debug method")]
3657 {
3658 }
3659}
3660
3662{
3663#ifdef BSB_DEBUG
3665#else
3666
3667#endif
3668}
3670{
3671#ifdef BSB_DEBUG_SPAM
3673#else
3674
3675#endif
3676}
const int AT_DISMANTLE_PART
const int AT_DESTROY_PART
ref ConstructionBasic m_Construction
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 DropAttachmentAndCargoItems()
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()
override void InitItemSounds()
void RegisterPartForSync(int part_id)
ConstructionBasic CreateConstructionComponent()
const string SOUND_DISMANTLE_METAL
void SetPartsAfterStoreLoad()
void DestroyConstruction()
ref array< string > m_HybridAttachments
override string GetFoldSoundset()
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()
override void OnItemFallRebuilding()
@Note for modders: This method and is subject to change!
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 ConstructionBasic GetConstructionBasic()
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)
void HandleFallingForConstructedParts()
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
override string GetLoopFoldSoundset()
void OnSetSlotLock(int slotId, bool locked, bool was_locked)
override bool CanPutIntoHands(EntityAI parent)
bool IsPartBuildInSyncData(int part_id)
override bool CanRemoveFromCargo(EntityAI parent)
void DestroyConstructedParts()
const string SOUND_DISMANTLE_WOOD_STAIRS
const int ECE_PLACE_ON_SURFACE
PlayerSpawnPreset slotName
ConstructionMaterialType
used to guide action sound selection, mostly. Could be also used for particles and stuff,...
string GetLoopFoldSoundset()
ItemSoundHandler GetItemSoundHandler()
bool m_FixDamageSystemInit
void ItemSoundHandler(ItemBase parent)
override void SetLoopInterval(float time)
A particular version of the deferred loop used to not damage players inside vehicles.
override void SetDeferDuration(float time)
static bool GetDisableRefundMaterialsOnFall()
static bool GetDisableDropAttachmentsOnFall()
static bool GetDisableItemFalling()
override void DestroyPartServer(Man player, string part_name, int action_id, bool destroyed_by_connected_part=false)
just declared for module 3 use
Instanced construction part data classes for dynamic data, statics now stored on EntityType level in ...
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
static bool IsBaseBuildingLogEnable()
proto bool Write(void value_out)
proto bool Read(void value_in)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override string GetDebugName()
Serializer ParamsReadContext
Serializer ParamsWriteContext
proto void PrintToRPT(void var)
Prints content of variable to RPT file (performance warning - each write means fflush!...
void Obsolete(string msg="")
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
vector GetPosition()
Get the world position of the Effect.
bool Contains(string sample)
Returns true if sample is substring of string.