2428{
2430
2432
2434
2441
2442
2443
2449
2455
2457
2461
2462
2464 {
2466
2467
2468 RegisterNetSyncVariableInt( "m_SyncParts01" );
2469 RegisterNetSyncVariableInt( "m_SyncParts02" );
2470 RegisterNetSyncVariableInt( "m_SyncParts03" );
2471 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2472 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2473 RegisterNetSyncVariableBool( "m_HasBase" );
2474
2475
2476 ConstructionInit();
2477
2478 if (ConfigIsExisting("hybridAttachments"))
2479 {
2482 }
2483 if (ConfigIsExisting("mountables"))
2484 {
2487 }
2488
2490 SetAllowDamage(true);
2491 }
2492
2494 {
2495 return "disableBaseDamage";
2496 }
2497
2499 {
2500 return true;
2501 }
2502
2504 {
2505 return EInventoryIconVisibility.HIDE_VICINITY;
2506 }
2507
2509 {
2510 super.InitItemSounds();
2511
2515
2520 }
2521
2523 {
2524 return "putDown_FenceKit_SoundSet";
2525 }
2526
2528 {
2529 return "Shelter_Site_Build_Loop_SoundSet";
2530 }
2531
2532
2534 {
2536 {
2537 SetSynchDirty();
2538 }
2539 }
2540
2542 {
2544 super.OnVariablesSynchronized();
2545
2547 }
2548
2550 {
2551
2553
2554
2556
2557
2559 }
2560
2561
2563 {
2564
2565 int offset;
2566 int mask;
2567
2568 if ( part_id >= 1 && part_id <= 31 )
2569 {
2570 offset = part_id - 1;
2571 mask = 1 << offset;
2572
2574 }
2575 else if ( part_id >= 32 && part_id <= 62 )
2576 {
2577 offset = ( part_id % 32 );
2578 mask = 1 << offset;
2579
2581 }
2582 else if ( part_id >= 63 && part_id <= 93 )
2583 {
2584 offset = ( part_id % 63 );
2585 mask = 1 << offset;
2586
2588 }
2589 }
2590
2592 {
2593
2594 int offset;
2595 int mask;
2596
2597 if ( part_id >= 1 && part_id <= 31 )
2598 {
2599 offset = part_id - 1;
2600 mask = 1 << offset;
2601
2603 }
2604 else if ( part_id >= 32 && part_id <= 62 )
2605 {
2606 offset = ( part_id % 32 );
2607 mask = 1 << offset;
2608
2610 }
2611 else if ( part_id >= 63 && part_id <= 93 )
2612 {
2613 offset = ( part_id % 63 );
2614 mask = 1 << offset;
2615
2617 }
2618 }
2619
2621 {
2622
2623 int offset;
2624 int mask;
2625
2626 if ( part_id >= 1 && part_id <= 31 )
2627 {
2628 offset = part_id - 1;
2629 mask = 1 << offset;
2630
2632 {
2633 return true;
2634 }
2635 }
2636 else if ( part_id >= 32 && part_id <= 62 )
2637 {
2638 offset = ( part_id % 32 );
2639 mask = 1 << offset;
2640
2642 {
2643 return true;
2644 }
2645 }
2646 else if ( part_id >= 63 && part_id <= 93 )
2647 {
2648 offset = ( part_id % 63 );
2649 mask = 1 << offset;
2650
2652 {
2653 return true;
2654 }
2655 }
2656
2657 return false;
2658 }
2659
2661 {
2664 }
2665
2667 {
2668
2671 }
2672
2674 {
2676 {
2679
2680 switch( build_action_id )
2681 {
2685 }
2686 }
2687 }
2688
2689
2691 {
2693 bool is_base = part.
IsBase();
2696 if ( is_part_built_sync )
2697 {
2699 {
2703
2704 if (is_base)
2705 {
2708 }
2709 }
2710 }
2711 else
2712 {
2714 {
2718
2719 if (is_base)
2720 {
2723 }
2724 }
2725 }
2726
2727
2729 }
2730
2731
2733 {
2736
2737 for ( int i = 0; i < construction_parts.Count(); ++i )
2738 {
2739 string key = construction_parts.GetKey( i );
2742 }
2743
2744
2746 }
2747
2749 {
2752
2753 for ( int i = 0; i < construction_parts.Count(); ++i )
2754 {
2755 string key = construction_parts.GetKey( i );
2757
2758 if ( value.
GetId() ==
id )
2759 {
2760 return value;
2761 }
2762 }
2763
2764 return NULL;
2765 }
2766
2767
2768
2770 {
2772 }
2773
2775 {
2777 }
2778
2780 {
2781 return true;
2782 }
2783
2785 {
2786 return false;
2787 }
2788
2789
2791 {
2794 {
2796 }
2797
2798 return construction_kit;
2799 }
2800
2802 {
2805 {
2807 }
2808 }
2809
2811 {
2813 }
2814
2816 {
2817 return "";
2818 }
2819
2821 {
2823 g_Game.ObjectDelete( construction_kit );
2824 }
2825
2826
2828 {
2830 g_Game.ObjectDelete(
this );
2831 }
2832
2833
2835 {
2836 super.EEDelete(parent);
2837
2839 {
2840 areaDamage.Destroy();
2841 }
2842
2843 }
2844
2846 {
2847 super.OnStoreSave( ctx );
2848
2849
2853
2855 }
2856
2858 {
2859 if ( !super.OnStoreLoad( ctx, version ) )
2860 return false;
2861
2862
2863
2865 {
2867 return false;
2868 }
2870 {
2872 return false;
2873 }
2875 {
2877 return false;
2878 }
2879
2880
2882 {
2884 return false;
2885 }
2886
2887
2888 return true;
2889 }
2890
2892 {
2893 super.AfterStoreLoad();
2894
2896 {
2898 }
2899 }
2900
2902 {
2903
2905
2906
2909
2910
2912 }
2913
2915 {
2916 super.OnCreatePhysics();
2917
2918 ConstructionInit();
2920 }
2921
2923 {
2925 return;
2926
2927 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2928 }
2929
2931 {
2933 {
2935 }
2936
2937 super.EEOnAfterLoad();
2938 }
2939
2941 {
2942 super.EEItemAttached( item, slot_name );
2943
2947 }
2948
2950 {
2951 super.EEItemDetached( item, slot_name );
2952
2955 }
2956
2957 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2958 {
2961
2964 }
2965
2966
2968 {
2969 return true;
2970 }
2971
2972
2973
2975 {
2977
2978
2979 if (construtionPart.
IsBase())
2980 {
2982
2983
2985 }
2986
2987
2989
2990
2992
2993
2995
2997
2999
3000
3002
3003
3005 }
3006
3008 {
3009
3011 }
3012
3013
3015 {
3018
3019
3021
3022
3024
3025
3027
3028
3030
3032
3033
3035
3036
3038
3039
3040 if (construtionPart.
IsBase())
3041 {
3042
3044 }
3045 }
3046
3048 {
3049
3051 }
3052
3053
3054 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3055 {
3058
3059
3061
3062
3064
3065
3067
3068
3070
3072
3073
3075
3076
3078
3079
3080 if (construtionPart.
IsBase())
3081 {
3082
3084 }
3085 }
3086
3088 {
3089
3091 }
3092
3093
3095 {
3097
3100 }
3101
3103 {
3105
3107 {
3109 }
3110 else
3111 {
3113 }
3114
3116 }
3117
3119 {
3121
3123 foreach (
string slotName : attachmentSlots)
3124 {
3126 }
3127
3128
3131 else
3133
3135 }
3136
3138 {
3139 string slotNameMounted = slot_name + "_Mounted";
3140 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3141
3142 if (attachment)
3143 {
3144 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3145 if (barbedWire && barbedWire.IsMounted())
3147 else
3149
3150 if (is_locked)
3151 {
3152 SetAnimationPhase(slotNameMounted, 0);
3153 SetAnimationPhase(slot_name, 1);
3154 }
3155 else
3156 {
3157 SetAnimationPhase(slotNameMounted, 1);
3158 SetAnimationPhase(slot_name, 0);
3159 }
3160 }
3161 else
3162 {
3163 SetAnimationPhase(slotNameMounted, 1);
3164 SetAnimationPhase(slot_name, 1);
3165
3167 }
3168 }
3169
3170
3172 {
3175
3178
3181
3182 foreach (
string slotName : attachmentSlots)
3183 {
3185 }
3186
3187
3189 {
3192
3194 }
3195 else
3196 {
3199
3201 }
3202
3205 }
3206
3208 {
3209
3211 return;
3212
3213 string slot_name_mounted = slot_name + "_Mounted";
3214 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3215
3216
3218 RemoveProxyPhysics( slot_name_mounted );
3219 RemoveProxyPhysics( slot_name );
3220
3221 if ( attachment )
3222 {
3224 if ( is_locked )
3225 {
3227 AddProxyPhysics( slot_name_mounted );
3228 }
3229 else
3230 {
3232 AddProxyPhysics( slot_name );
3233 }
3234 }
3235 }
3236
3238 {
3239 SetAffectPathgraph( true, false );
3241 }
3242
3244 {
3245 return true;
3246 }
3247
3249 {
3250 return true;
3251 }
3252
3254 {
3255 if ( attachment )
3256 {
3258 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3259
3260 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3261 }
3262
3263 return false;
3264 }
3265
3267 {
3269 }
3270
3271
3273 {
3274 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3275 if (
g_Game.ConfigIsExisting( config_path ) )
3276 {
3277 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3278 }
3279 }
3280
3282 {
3283 return true;
3284 }
3285
3287 {
3288 return true;
3289 }
3290
3292 {
3293 return true;
3294 }
3295
3296
3298 {
3301 }
3302
3304 {
3306 }
3307
3309 {
3311 }
3312
3314 {
3315 int attachment_count = GetInventory().AttachmentCount();
3316 if ( attachment_count > 0 )
3317 {
3318 if (
HasBase() && attachment_count == 1 )
3319 {
3320 return false;
3321 }
3322
3323 return true;
3324 }
3325
3326 return false;
3327 }
3328
3330 {
3331 return true;
3332 }
3333
3335 {
3336 return false;
3337 }
3338
3339
3341 {
3342 return false;
3343 }
3344
3346 {
3347 return false;
3348 }
3349
3350
3352 {
3353 return false;
3354 }
3355
3356
3357
3359 {
3360 return true;
3361 }
3362
3364 {
3365 return true;
3366 }
3367
3370 {
3371 return false;
3372 }
3373
3374
3376 {
3377 return false;
3378 }
3379
3380
3382 {
3383 return true;
3384 }
3385
3386
3388 {
3389 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3390 {
3391 return false;
3392 }
3393
3394 return true;
3395 }
3396
3398 {
3401
3402 return item;
3403 }
3404
3405
3407 {
3409 {
3410
3412
3413
3416
3418 if ( MemoryPointExists( slot_name + "_min" ) )
3419 {
3420 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3421 }
3422 if ( MemoryPointExists( slot_name + "_max" ) )
3423 {
3424 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3425 }
3426
3427
3430
3431
3434 center = ModelToWorld( center );
3435
3436
3439
3440 areaDamage.SetExtents( extents[0], extents[1] );
3441 areaDamage.SetAreaPosition( center );
3445 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3446 areaDamage.SetAmmoName( "BarbedWireHit" );
3447 areaDamage.Spawn();
3448
3450 }
3451 }
3452
3454 {
3455 if ( angle_deg != 0 )
3456 {
3457
3459
3460
3462 if ( MemoryPointExists( "rotate_axis" ) )
3463 {
3464 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3465 }
3466 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];
3467 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];
3468 center[0] = r_center_x;
3469 center[2] = r_center_z;
3470 }
3471 }
3472
3474 {
3476 {
3479 {
3480 if (areaDamage)
3481 {
3482 areaDamage.Destroy();
3483 }
3484
3486 }
3487 }
3488 }
3489
3491 {
3492 return true;
3493 }
3494
3495
3496
3497
3499 {
3501 }
3502
3504 {
3506 }
3507
3509 {
3511 }
3512
3514 {
3516
3517 switch ( material_type )
3518 {
3524 }
3525
3526 return "";
3527 }
3528
3530 {
3532
3533 switch ( material_type )
3534 {
3540 }
3541
3542 return "";
3543 }
3544
3545
3547 {
3549 {
3550
3552 {
3553 SetHealth(slot_name,"Health",item.GetHealth());
3554 }
3555 }
3556 }
3557
3559 {
3560 return 111;
3561 }
3562
3564 {
3565 super.SetActions();
3566
3570 }
3571
3573 {
3575 if (!construction)
3576 return;
3577
3579 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3580 {
3583 {
3585 }
3586 }
3587 }
3588
3590 {
3592 if (!construction)
3593 return;
3594
3596 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3597 {
3600 {
3601 construction.HandleEntityFalling(part.
GetPartName());
3602 }
3603 }
3604 }
3605
3608 {
3610 return;
3611
3614
3615 if (DestroyOnFall())
3616 {
3618 {
3620 }
3621 else
3622 {
3624 {
3626 }
3628 }
3629 }
3630 }
3631
3633 {
3634 if (HasAnyAttachmentsOrCargo())
3635 {
3638 }
3639 }
3640
3641
3642
3643
3644
3647 {
3648 return null;
3649 }
3650
3652 {
3654 }
3655
3657 {
3660
3661 Man p;
3662
3663 #ifdef SERVER
3665 g_Game.GetWorld().GetPlayerList(players);
3666 if (players.Count())
3667 p = players[0];
3668 #else
3670 #endif
3671
3673 {
3674 bool excluded = false;
3676 if (excludes)
3677 {
3678 foreach (string exclude : excludes)
3679 {
3681 {
3682 excluded = true;
3683 break;
3684 }
3685 }
3686 }
3687
3688 if (!excluded)
3689 {
3691 }
3692 }
3693
3695 }
3696
3698
3700 [
Obsolete(
"handled in the Construction component directly")]
3702 {
3703 }
3704
3705 [
Obsolete(
"handled in the Construction component directly")]
3707 {
3708 }
3709
3710 [
Obsolete(
"obsolete debug method")]
3712 {
3713 }
3714}
3715
3717{
3718#ifdef BSB_DEBUG
3720#else
3721
3722#endif
3723}
3725{
3726#ifdef BSB_DEBUG_SPAM
3728#else
3729
3730#endif
3731}
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.