2497{
2499
2501
2503
2510
2511
2512
2518
2524
2526
2530
2531
2533 {
2535
2536
2537 RegisterNetSyncVariableInt( "m_SyncParts01" );
2538 RegisterNetSyncVariableInt( "m_SyncParts02" );
2539 RegisterNetSyncVariableInt( "m_SyncParts03" );
2540 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2541 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2542 RegisterNetSyncVariableBool( "m_HasBase" );
2543
2544
2545 ConstructionInit();
2546
2547 if (ConfigIsExisting("hybridAttachments"))
2548 {
2551 }
2552 if (ConfigIsExisting("mountables"))
2553 {
2556 }
2557
2559 SetAllowDamage(true);
2560 }
2561
2563 {
2564 return "disableBaseDamage";
2565 }
2566
2568 {
2569 return true;
2570 }
2571
2573 {
2574 return EInventoryIconVisibility.HIDE_VICINITY;
2575 }
2576
2578 {
2579 super.InitItemSounds();
2580
2584
2589 }
2590
2592 {
2593 return "putDown_FenceKit_SoundSet";
2594 }
2595
2597 {
2598 return "Shelter_Site_Build_Loop_SoundSet";
2599 }
2600
2601
2603 {
2605 {
2606 SetSynchDirty();
2607 }
2608 }
2609
2611 {
2613 super.OnVariablesSynchronized();
2614
2616 }
2617
2619 {
2620
2622
2623
2625
2626
2628 }
2629
2630
2632 {
2633
2634 int offset;
2635 int mask;
2636
2637 if ( part_id >= 1 && part_id <= 31 )
2638 {
2639 offset = part_id - 1;
2640 mask = 1 << offset;
2641
2643 }
2644 else if ( part_id >= 32 && part_id <= 62 )
2645 {
2646 offset = ( part_id % 32 );
2647 mask = 1 << offset;
2648
2650 }
2651 else if ( part_id >= 63 && part_id <= 93 )
2652 {
2653 offset = ( part_id % 63 );
2654 mask = 1 << offset;
2655
2657 }
2658 }
2659
2661 {
2662
2663 int offset;
2664 int mask;
2665
2666 if ( part_id >= 1 && part_id <= 31 )
2667 {
2668 offset = part_id - 1;
2669 mask = 1 << offset;
2670
2672 }
2673 else if ( part_id >= 32 && part_id <= 62 )
2674 {
2675 offset = ( part_id % 32 );
2676 mask = 1 << offset;
2677
2679 }
2680 else if ( part_id >= 63 && part_id <= 93 )
2681 {
2682 offset = ( part_id % 63 );
2683 mask = 1 << offset;
2684
2686 }
2687 }
2688
2690 {
2691
2692 int offset;
2693 int mask;
2694
2695 if ( part_id >= 1 && part_id <= 31 )
2696 {
2697 offset = part_id - 1;
2698 mask = 1 << offset;
2699
2701 {
2702 return true;
2703 }
2704 }
2705 else if ( part_id >= 32 && part_id <= 62 )
2706 {
2707 offset = ( part_id % 32 );
2708 mask = 1 << offset;
2709
2711 {
2712 return true;
2713 }
2714 }
2715 else if ( part_id >= 63 && part_id <= 93 )
2716 {
2717 offset = ( part_id % 63 );
2718 mask = 1 << offset;
2719
2721 {
2722 return true;
2723 }
2724 }
2725
2726 return false;
2727 }
2728
2730 {
2733 }
2734
2736 {
2737
2740 }
2741
2743 {
2745 {
2748
2749 switch( build_action_id )
2750 {
2754 }
2755 }
2756 }
2757
2758
2760 {
2762 bool is_base = part.
IsBase();
2765 if ( is_part_built_sync )
2766 {
2768 {
2772
2773 if (is_base)
2774 {
2777 }
2778 }
2779 }
2780 else
2781 {
2783 {
2787
2788 if (is_base)
2789 {
2792 }
2793 }
2794 }
2795
2796
2798 }
2799
2800
2802 {
2805
2806 for ( int i = 0; i < construction_parts.Count(); ++i )
2807 {
2808 string key = construction_parts.GetKey( i );
2811 }
2812
2813
2815 }
2816
2818 {
2821
2822 for ( int i = 0; i < construction_parts.Count(); ++i )
2823 {
2824 string key = construction_parts.GetKey( i );
2826
2827 if ( value.
GetId() ==
id )
2828 {
2829 return value;
2830 }
2831 }
2832
2833 return NULL;
2834 }
2835
2836
2837
2839 {
2841 }
2842
2844 {
2846 }
2847
2849 {
2850 return true;
2851 }
2852
2854 {
2855 return false;
2856 }
2857
2858
2860 {
2863 {
2865 }
2866
2867 return construction_kit;
2868 }
2869
2871 {
2874 {
2876 }
2877 }
2878
2880 {
2882 }
2883
2885 {
2886 return "";
2887 }
2888
2890 {
2892 g_Game.ObjectDelete( construction_kit );
2893 }
2894
2895
2897 {
2899 g_Game.ObjectDelete(
this );
2900 }
2901
2902
2904 {
2905 super.EEDelete(parent);
2906
2908 {
2909 areaDamage.Destroy();
2910 }
2911
2912 }
2913
2915 {
2916 super.OnStoreSave( ctx );
2917
2918
2922
2924 }
2925
2927 {
2928 if ( !super.OnStoreLoad( ctx, version ) )
2929 return false;
2930
2931
2932
2934 {
2936 return false;
2937 }
2939 {
2941 return false;
2942 }
2944 {
2946 return false;
2947 }
2948
2949
2951 {
2953 return false;
2954 }
2955
2956
2957 return true;
2958 }
2959
2961 {
2962 super.AfterStoreLoad();
2963
2965 {
2967 }
2968 }
2969
2971 {
2972
2974
2975
2978
2979
2981 }
2982
2984 {
2985 super.OnCreatePhysics();
2986
2987 ConstructionInit();
2989 }
2990
2992 {
2994 return;
2995
2996 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2997 }
2998
3000 {
3002 {
3004 }
3005
3006 super.EEOnAfterLoad();
3007 }
3008
3010 {
3011 super.EEItemAttached( item, slot_name );
3012
3016 }
3017
3019 {
3020 super.EEItemDetached( item, slot_name );
3021
3024 }
3025
3026 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
3027 {
3030
3033 }
3034
3035
3037 {
3038 return true;
3039 }
3040
3041
3042
3044 {
3046
3047
3048 if (construtionPart.
IsBase())
3049 {
3051
3052
3054 }
3055
3056
3058
3059
3061
3062
3064
3066
3068
3069
3071
3072
3074 }
3075
3077 {
3078
3080 }
3081
3082
3084 {
3087
3088
3090
3091
3093
3094
3096
3097
3099
3101
3102
3104
3105
3107
3108
3109 if (construtionPart.
IsBase())
3110 {
3111
3113 }
3114 }
3115
3117 {
3118
3120 }
3121
3122
3123 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3124 {
3127
3128
3130
3131
3133
3134
3136
3137
3139
3141
3142
3144
3145
3147
3148
3149 if (construtionPart.
IsBase())
3150 {
3151
3153 }
3154 }
3155
3157 {
3158
3160 }
3161
3162
3164 {
3166
3169 }
3170
3172 {
3174
3176 {
3178 }
3179 else
3180 {
3182 }
3183
3185 }
3186
3188 {
3190
3192 foreach (
string slotName : attachmentSlots)
3193 {
3195 }
3196
3197
3200 else
3202
3204 }
3205
3207 {
3208 string slotNameMounted = slot_name + "_Mounted";
3209 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3210
3211 if (attachment)
3212 {
3213 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3214 if (barbedWire && barbedWire.IsMounted())
3216 else
3218
3219 if (is_locked)
3220 {
3221 SetAnimationPhase(slotNameMounted, 0);
3222 SetAnimationPhase(slot_name, 1);
3223 }
3224 else
3225 {
3226 SetAnimationPhase(slotNameMounted, 1);
3227 SetAnimationPhase(slot_name, 0);
3228 }
3229 }
3230 else
3231 {
3232 SetAnimationPhase(slotNameMounted, 1);
3233 SetAnimationPhase(slot_name, 1);
3234
3236 }
3237 }
3238
3239
3241 {
3244
3247
3250
3251 foreach (
string slotName : attachmentSlots)
3252 {
3254 }
3255
3256
3258 {
3261
3263 }
3264 else
3265 {
3268
3270 }
3271
3274 }
3275
3277 {
3278
3280 return;
3281
3282 string slot_name_mounted = slot_name + "_Mounted";
3283 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3284
3285
3287 RemoveProxyPhysics( slot_name_mounted );
3288 RemoveProxyPhysics( slot_name );
3289
3290 if ( attachment )
3291 {
3293 if ( is_locked )
3294 {
3296 AddProxyPhysics( slot_name_mounted );
3297 }
3298 else
3299 {
3301 AddProxyPhysics( slot_name );
3302 }
3303 }
3304 }
3305
3307 {
3308 SetAffectPathgraph( true, false );
3310 }
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return true;
3320 }
3321
3323 {
3324 if ( attachment )
3325 {
3327 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3328
3329 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3330 }
3331
3332 return false;
3333 }
3334
3336 {
3338 }
3339
3340
3342 {
3343 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3344 if (
g_Game.ConfigIsExisting( config_path ) )
3345 {
3346 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3347 }
3348 }
3349
3351 {
3352 return true;
3353 }
3354
3356 {
3357 return true;
3358 }
3359
3361 {
3362 return true;
3363 }
3364
3365
3367 {
3370 }
3371
3373 {
3375 }
3376
3378 {
3380 }
3381
3383 {
3384 int attachment_count = GetInventory().AttachmentCount();
3385 if ( attachment_count > 0 )
3386 {
3387 if (
HasBase() && attachment_count == 1 )
3388 {
3389 return false;
3390 }
3391
3392 return true;
3393 }
3394
3395 return false;
3396 }
3397
3399 {
3400 return true;
3401 }
3402
3404 {
3405 return false;
3406 }
3407
3408
3410 {
3411 return false;
3412 }
3413
3415 {
3416 return false;
3417 }
3418
3419
3421 {
3422 return false;
3423 }
3424
3425
3426
3428 {
3429 return true;
3430 }
3431
3433 {
3434 return true;
3435 }
3436
3439 {
3440 return false;
3441 }
3442
3443
3445 {
3446 return false;
3447 }
3448
3449
3451 {
3452 return true;
3453 }
3454
3455
3457 {
3458 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3459 {
3460 return false;
3461 }
3462
3463 return true;
3464 }
3465
3467 {
3470
3471 return item;
3472 }
3473
3474
3476 {
3478 {
3479
3481
3482
3485
3487 if ( MemoryPointExists( slot_name + "_min" ) )
3488 {
3489 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3490 }
3491 if ( MemoryPointExists( slot_name + "_max" ) )
3492 {
3493 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3494 }
3495
3496
3499
3500
3503 center = ModelToWorld( center );
3504
3505
3508
3509 areaDamage.SetExtents( extents[0], extents[1] );
3510 areaDamage.SetAreaPosition( center );
3514 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3515 areaDamage.SetAmmoName( "BarbedWireHit" );
3516 areaDamage.Spawn();
3517
3519 }
3520 }
3521
3523 {
3524 if ( angle_deg != 0 )
3525 {
3526
3528
3529
3531 if ( MemoryPointExists( "rotate_axis" ) )
3532 {
3533 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3534 }
3535 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];
3536 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];
3537 center[0] = r_center_x;
3538 center[2] = r_center_z;
3539 }
3540 }
3541
3543 {
3545 {
3548 {
3549 if (areaDamage)
3550 {
3551 areaDamage.Destroy();
3552 }
3553
3555 }
3556 }
3557 }
3558
3560 {
3561 return true;
3562 }
3563
3564
3565
3566
3568 {
3570 }
3571
3573 {
3575 }
3576
3578 {
3580 }
3581
3583 {
3585
3586 switch ( material_type )
3587 {
3593 }
3594
3595 return "";
3596 }
3597
3599 {
3601
3602 switch ( material_type )
3603 {
3609 }
3610
3611 return "";
3612 }
3613
3614
3616 {
3618 {
3619
3621 {
3622 SetHealth(slot_name,"Health",item.GetHealth());
3623 }
3624 }
3625 }
3626
3628 {
3629 return 111;
3630 }
3631
3633 {
3634 super.SetActions();
3635
3639 }
3640
3642 {
3644 if (!construction)
3645 return;
3646
3648 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3649 {
3652 {
3654 }
3655 }
3656 }
3657
3659 {
3661 if (!construction)
3662 return;
3663
3665 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3666 {
3669 {
3670 construction.HandleEntityFalling(part.
GetPartName());
3671 }
3672 }
3673 }
3674
3677 {
3679 return;
3680
3683
3684 if (DestroyOnFall())
3685 {
3687 {
3689 }
3690 else
3691 {
3693 {
3695 }
3697 }
3698 }
3699 }
3700
3702 {
3703 if (HasAnyAttachmentsOrCargo())
3704 {
3707 }
3708 }
3709
3710
3711
3712
3713
3716 {
3717 return null;
3718 }
3719
3721 {
3723 }
3724
3726 {
3729
3730 Man p;
3731
3732 #ifdef SERVER
3734 g_Game.GetWorld().GetPlayerList(players);
3735 if (players.Count())
3736 p = players[0];
3737 #else
3739 #endif
3740
3742 {
3743 bool excluded = false;
3745 if (excludes)
3746 {
3747 foreach (string exclude : excludes)
3748 {
3750 {
3751 excluded = true;
3752 break;
3753 }
3754 }
3755 }
3756
3757 if (!excluded)
3758 {
3760 }
3761 }
3762
3764 }
3765
3767
3769 [
Obsolete(
"handled in the Construction component directly")]
3771 {
3772 }
3773
3774 [
Obsolete(
"handled in the Construction component directly")]
3776 {
3777 }
3778
3779 [
Obsolete(
"obsolete debug method")]
3781 {
3782 }
3783}
3784
3786{
3787#ifdef BSB_DEBUG
3789#else
3790
3791#endif
3792}
3794{
3795#ifdef BSB_DEBUG_SPAM
3797#else
3798
3799#endif
3800}
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.