2454{
2456
2458
2460
2467
2468
2469
2475
2481
2483
2487
2488
2490 {
2492
2493
2494 RegisterNetSyncVariableInt( "m_SyncParts01" );
2495 RegisterNetSyncVariableInt( "m_SyncParts02" );
2496 RegisterNetSyncVariableInt( "m_SyncParts03" );
2497 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2498 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2499 RegisterNetSyncVariableBool( "m_HasBase" );
2500
2501
2502 ConstructionInit();
2503
2504 if (ConfigIsExisting("hybridAttachments"))
2505 {
2508 }
2509 if (ConfigIsExisting("mountables"))
2510 {
2513 }
2514
2516 SetAllowDamage(true);
2517 }
2518
2520 {
2521 return "disableBaseDamage";
2522 }
2523
2525 {
2526 return true;
2527 }
2528
2530 {
2531 return EInventoryIconVisibility.HIDE_VICINITY;
2532 }
2533
2535 {
2536 super.InitItemSounds();
2537
2541
2546 }
2547
2549 {
2550 return "putDown_FenceKit_SoundSet";
2551 }
2552
2554 {
2555 return "Shelter_Site_Build_Loop_SoundSet";
2556 }
2557
2558
2560 {
2562 {
2563 SetSynchDirty();
2564 }
2565 }
2566
2568 {
2570 super.OnVariablesSynchronized();
2571
2573 }
2574
2576 {
2577
2579
2580
2582
2583
2585 }
2586
2587
2589 {
2590
2591 int offset;
2592 int mask;
2593
2594 if ( part_id >= 1 && part_id <= 31 )
2595 {
2596 offset = part_id - 1;
2597 mask = 1 << offset;
2598
2600 }
2601 else if ( part_id >= 32 && part_id <= 62 )
2602 {
2603 offset = ( part_id % 32 );
2604 mask = 1 << offset;
2605
2607 }
2608 else if ( part_id >= 63 && part_id <= 93 )
2609 {
2610 offset = ( part_id % 63 );
2611 mask = 1 << offset;
2612
2614 }
2615 }
2616
2618 {
2619
2620 int offset;
2621 int mask;
2622
2623 if ( part_id >= 1 && part_id <= 31 )
2624 {
2625 offset = part_id - 1;
2626 mask = 1 << offset;
2627
2629 }
2630 else if ( part_id >= 32 && part_id <= 62 )
2631 {
2632 offset = ( part_id % 32 );
2633 mask = 1 << offset;
2634
2636 }
2637 else if ( part_id >= 63 && part_id <= 93 )
2638 {
2639 offset = ( part_id % 63 );
2640 mask = 1 << offset;
2641
2643 }
2644 }
2645
2647 {
2648
2649 int offset;
2650 int mask;
2651
2652 if ( part_id >= 1 && part_id <= 31 )
2653 {
2654 offset = part_id - 1;
2655 mask = 1 << offset;
2656
2658 {
2659 return true;
2660 }
2661 }
2662 else if ( part_id >= 32 && part_id <= 62 )
2663 {
2664 offset = ( part_id % 32 );
2665 mask = 1 << offset;
2666
2668 {
2669 return true;
2670 }
2671 }
2672 else if ( part_id >= 63 && part_id <= 93 )
2673 {
2674 offset = ( part_id % 63 );
2675 mask = 1 << offset;
2676
2678 {
2679 return true;
2680 }
2681 }
2682
2683 return false;
2684 }
2685
2687 {
2690 }
2691
2693 {
2694
2697 }
2698
2700 {
2702 {
2705
2706 switch( build_action_id )
2707 {
2711 }
2712 }
2713 }
2714
2715
2717 {
2719 bool is_base = part.
IsBase();
2722 if ( is_part_built_sync )
2723 {
2725 {
2729
2730 if (is_base)
2731 {
2734 }
2735 }
2736 }
2737 else
2738 {
2740 {
2744
2745 if (is_base)
2746 {
2749 }
2750 }
2751 }
2752
2753
2755 }
2756
2757
2759 {
2762
2763 for ( int i = 0; i < construction_parts.Count(); ++i )
2764 {
2765 string key = construction_parts.GetKey( i );
2768 }
2769
2770
2772 }
2773
2775 {
2778
2779 for ( int i = 0; i < construction_parts.Count(); ++i )
2780 {
2781 string key = construction_parts.GetKey( i );
2783
2784 if ( value.
GetId() ==
id )
2785 {
2786 return value;
2787 }
2788 }
2789
2790 return NULL;
2791 }
2792
2793
2794
2796 {
2798 }
2799
2801 {
2803 }
2804
2806 {
2807 return true;
2808 }
2809
2811 {
2812 return false;
2813 }
2814
2815
2817 {
2820 {
2822 }
2823
2824 return construction_kit;
2825 }
2826
2828 {
2831 {
2833 }
2834 }
2835
2837 {
2839 }
2840
2842 {
2843 return "";
2844 }
2845
2847 {
2849 g_Game.ObjectDelete( construction_kit );
2850 }
2851
2852
2854 {
2856 g_Game.ObjectDelete(
this );
2857 }
2858
2859
2861 {
2862 super.EEDelete(parent);
2863
2865 {
2866 areaDamage.Destroy();
2867 }
2868
2869 }
2870
2872 {
2873 super.OnStoreSave( ctx );
2874
2875
2879
2881 }
2882
2884 {
2885 if ( !super.OnStoreLoad( ctx, version ) )
2886 return false;
2887
2888
2889
2891 {
2893 return false;
2894 }
2896 {
2898 return false;
2899 }
2901 {
2903 return false;
2904 }
2905
2906
2908 {
2910 return false;
2911 }
2912
2913
2914 return true;
2915 }
2916
2918 {
2919 super.AfterStoreLoad();
2920
2922 {
2924 }
2925 }
2926
2928 {
2929
2931
2932
2935
2936
2938 }
2939
2941 {
2942 super.OnCreatePhysics();
2943
2944 ConstructionInit();
2946 }
2947
2949 {
2951 return;
2952
2953 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2954 }
2955
2957 {
2959 {
2961 }
2962
2963 super.EEOnAfterLoad();
2964 }
2965
2967 {
2968 super.EEItemAttached( item, slot_name );
2969
2973 }
2974
2976 {
2977 super.EEItemDetached( item, slot_name );
2978
2981 }
2982
2983 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2984 {
2987
2990 }
2991
2992
2994 {
2995 return true;
2996 }
2997
2998
2999
3001 {
3003
3004
3005 if (construtionPart.
IsBase())
3006 {
3008
3009
3011 }
3012
3013
3015
3016
3018
3019
3021
3023
3025
3026
3028
3029
3031 }
3032
3034 {
3035
3037 }
3038
3039
3041 {
3044
3045
3047
3048
3050
3051
3053
3054
3056
3058
3059
3061
3062
3064
3065
3066 if (construtionPart.
IsBase())
3067 {
3068
3070 }
3071 }
3072
3074 {
3075
3077 }
3078
3079
3080 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3081 {
3084
3085
3087
3088
3090
3091
3093
3094
3096
3098
3099
3101
3102
3104
3105
3106 if (construtionPart.
IsBase())
3107 {
3108
3110 }
3111 }
3112
3114 {
3115
3117 }
3118
3119
3121 {
3123
3126 }
3127
3129 {
3131
3133 {
3135 }
3136 else
3137 {
3139 }
3140
3142 }
3143
3145 {
3147
3149 foreach (
string slotName : attachmentSlots)
3150 {
3152 }
3153
3154
3157 else
3159
3161 }
3162
3164 {
3165 string slotNameMounted = slot_name + "_Mounted";
3166 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3167
3168 if (attachment)
3169 {
3170 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3171 if (barbedWire && barbedWire.IsMounted())
3173 else
3175
3176 if (is_locked)
3177 {
3178 SetAnimationPhase(slotNameMounted, 0);
3179 SetAnimationPhase(slot_name, 1);
3180 }
3181 else
3182 {
3183 SetAnimationPhase(slotNameMounted, 1);
3184 SetAnimationPhase(slot_name, 0);
3185 }
3186 }
3187 else
3188 {
3189 SetAnimationPhase(slotNameMounted, 1);
3190 SetAnimationPhase(slot_name, 1);
3191
3193 }
3194 }
3195
3196
3198 {
3201
3204
3207
3208 foreach (
string slotName : attachmentSlots)
3209 {
3211 }
3212
3213
3215 {
3218
3220 }
3221 else
3222 {
3225
3227 }
3228
3231 }
3232
3234 {
3235
3237 return;
3238
3239 string slot_name_mounted = slot_name + "_Mounted";
3240 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3241
3242
3244 RemoveProxyPhysics( slot_name_mounted );
3245 RemoveProxyPhysics( slot_name );
3246
3247 if ( attachment )
3248 {
3250 if ( is_locked )
3251 {
3253 AddProxyPhysics( slot_name_mounted );
3254 }
3255 else
3256 {
3258 AddProxyPhysics( slot_name );
3259 }
3260 }
3261 }
3262
3264 {
3265 SetAffectPathgraph( true, false );
3267 }
3268
3270 {
3271 return true;
3272 }
3273
3275 {
3276 return true;
3277 }
3278
3280 {
3281 if ( attachment )
3282 {
3284 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3285
3286 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3287 }
3288
3289 return false;
3290 }
3291
3293 {
3295 }
3296
3297
3299 {
3300 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3301 if (
g_Game.ConfigIsExisting( config_path ) )
3302 {
3303 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3304 }
3305 }
3306
3308 {
3309 return true;
3310 }
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return true;
3320 }
3321
3322
3324 {
3327 }
3328
3330 {
3332 }
3333
3335 {
3337 }
3338
3340 {
3341 int attachment_count = GetInventory().AttachmentCount();
3342 if ( attachment_count > 0 )
3343 {
3344 if (
HasBase() && attachment_count == 1 )
3345 {
3346 return false;
3347 }
3348
3349 return true;
3350 }
3351
3352 return false;
3353 }
3354
3356 {
3357 return true;
3358 }
3359
3361 {
3362 return false;
3363 }
3364
3365
3367 {
3368 return false;
3369 }
3370
3372 {
3373 return false;
3374 }
3375
3376
3378 {
3379 return false;
3380 }
3381
3382
3383
3385 {
3386 return true;
3387 }
3388
3390 {
3391 return true;
3392 }
3393
3396 {
3397 return false;
3398 }
3399
3400
3402 {
3403 return false;
3404 }
3405
3406
3408 {
3409 return true;
3410 }
3411
3412
3414 {
3415 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3416 {
3417 return false;
3418 }
3419
3420 return true;
3421 }
3422
3424 {
3427
3428 return item;
3429 }
3430
3431
3433 {
3435 {
3436
3438
3439
3442
3444 if ( MemoryPointExists( slot_name + "_min" ) )
3445 {
3446 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3447 }
3448 if ( MemoryPointExists( slot_name + "_max" ) )
3449 {
3450 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3451 }
3452
3453
3456
3457
3460 center = ModelToWorld( center );
3461
3462
3465
3466 areaDamage.SetExtents( extents[0], extents[1] );
3467 areaDamage.SetAreaPosition( center );
3471 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3472 areaDamage.SetAmmoName( "BarbedWireHit" );
3473 areaDamage.Spawn();
3474
3476 }
3477 }
3478
3480 {
3481 if ( angle_deg != 0 )
3482 {
3483
3485
3486
3488 if ( MemoryPointExists( "rotate_axis" ) )
3489 {
3490 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3491 }
3492 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];
3493 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];
3494 center[0] = r_center_x;
3495 center[2] = r_center_z;
3496 }
3497 }
3498
3500 {
3502 {
3505 {
3506 if (areaDamage)
3507 {
3508 areaDamage.Destroy();
3509 }
3510
3512 }
3513 }
3514 }
3515
3517 {
3518 return true;
3519 }
3520
3521
3522
3523
3525 {
3527 }
3528
3530 {
3532 }
3533
3535 {
3537 }
3538
3540 {
3542
3543 switch ( material_type )
3544 {
3550 }
3551
3552 return "";
3553 }
3554
3556 {
3558
3559 switch ( material_type )
3560 {
3566 }
3567
3568 return "";
3569 }
3570
3571
3573 {
3575 {
3576
3578 {
3579 SetHealth(slot_name,"Health",item.GetHealth());
3580 }
3581 }
3582 }
3583
3585 {
3586 return 111;
3587 }
3588
3590 {
3591 super.SetActions();
3592
3596 }
3597
3599 {
3601 if (!construction)
3602 return;
3603
3605 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3606 {
3609 {
3611 }
3612 }
3613 }
3614
3616 {
3618 if (!construction)
3619 return;
3620
3622 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3623 {
3626 {
3627 construction.HandleEntityFalling(part.
GetPartName());
3628 }
3629 }
3630 }
3631
3634 {
3636 return;
3637
3640
3641 if (DestroyOnFall())
3642 {
3644 {
3646 }
3647 else
3648 {
3650 {
3652 }
3654 }
3655 }
3656 }
3657
3659 {
3660 if (HasAnyAttachmentsOrCargo())
3661 {
3664 }
3665 }
3666
3667
3668
3669
3670
3673 {
3674 return null;
3675 }
3676
3678 {
3680 }
3681
3683 {
3686
3687 Man p;
3688
3689 #ifdef SERVER
3691 g_Game.GetWorld().GetPlayerList(players);
3692 if (players.Count())
3693 p = players[0];
3694 #else
3696 #endif
3697
3699 {
3700 bool excluded = false;
3702 if (excludes)
3703 {
3704 foreach (string exclude : excludes)
3705 {
3707 {
3708 excluded = true;
3709 break;
3710 }
3711 }
3712 }
3713
3714 if (!excluded)
3715 {
3717 }
3718 }
3719
3721 }
3722
3724
3726 [
Obsolete(
"handled in the Construction component directly")]
3728 {
3729 }
3730
3731 [
Obsolete(
"handled in the Construction component directly")]
3733 {
3734 }
3735
3736 [
Obsolete(
"obsolete debug method")]
3738 {
3739 }
3740}
3741
3743{
3744#ifdef BSB_DEBUG
3746#else
3747
3748#endif
3749}
3751{
3752#ifdef BSB_DEBUG_SPAM
3754#else
3755
3756#endif
3757}
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.