2423{
2425
2427
2429
2436
2437
2438
2444
2450
2452
2456
2457
2459 {
2461
2462
2463 RegisterNetSyncVariableInt( "m_SyncParts01" );
2464 RegisterNetSyncVariableInt( "m_SyncParts02" );
2465 RegisterNetSyncVariableInt( "m_SyncParts03" );
2466 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2467 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2468 RegisterNetSyncVariableBool( "m_HasBase" );
2469
2470
2471 ConstructionInit();
2472
2473 if (ConfigIsExisting("hybridAttachments"))
2474 {
2477 }
2478 if (ConfigIsExisting("mountables"))
2479 {
2482 }
2483
2485 SetAllowDamage(true);
2486 }
2487
2489 {
2490 return "disableBaseDamage";
2491 }
2492
2494 {
2495 return true;
2496 }
2497
2499 {
2500 return EInventoryIconVisibility.HIDE_VICINITY;
2501 }
2502
2504 {
2505 super.InitItemSounds();
2506
2510
2515 }
2516
2518 {
2519 return "putDown_FenceKit_SoundSet";
2520 }
2521
2523 {
2524 return "Shelter_Site_Build_Loop_SoundSet";
2525 }
2526
2527
2529 {
2531 {
2532 SetSynchDirty();
2533 }
2534 }
2535
2537 {
2539 super.OnVariablesSynchronized();
2540
2542 }
2543
2545 {
2546
2548
2549
2551
2552
2554 }
2555
2556
2558 {
2559
2560 int offset;
2561 int mask;
2562
2563 if ( part_id >= 1 && part_id <= 31 )
2564 {
2565 offset = part_id - 1;
2566 mask = 1 << offset;
2567
2569 }
2570 else if ( part_id >= 32 && part_id <= 62 )
2571 {
2572 offset = ( part_id % 32 );
2573 mask = 1 << offset;
2574
2576 }
2577 else if ( part_id >= 63 && part_id <= 93 )
2578 {
2579 offset = ( part_id % 63 );
2580 mask = 1 << offset;
2581
2583 }
2584 }
2585
2587 {
2588
2589 int offset;
2590 int mask;
2591
2592 if ( part_id >= 1 && part_id <= 31 )
2593 {
2594 offset = part_id - 1;
2595 mask = 1 << offset;
2596
2598 }
2599 else if ( part_id >= 32 && part_id <= 62 )
2600 {
2601 offset = ( part_id % 32 );
2602 mask = 1 << offset;
2603
2605 }
2606 else if ( part_id >= 63 && part_id <= 93 )
2607 {
2608 offset = ( part_id % 63 );
2609 mask = 1 << offset;
2610
2612 }
2613 }
2614
2616 {
2617
2618 int offset;
2619 int mask;
2620
2621 if ( part_id >= 1 && part_id <= 31 )
2622 {
2623 offset = part_id - 1;
2624 mask = 1 << offset;
2625
2627 {
2628 return true;
2629 }
2630 }
2631 else if ( part_id >= 32 && part_id <= 62 )
2632 {
2633 offset = ( part_id % 32 );
2634 mask = 1 << offset;
2635
2637 {
2638 return true;
2639 }
2640 }
2641 else if ( part_id >= 63 && part_id <= 93 )
2642 {
2643 offset = ( part_id % 63 );
2644 mask = 1 << offset;
2645
2647 {
2648 return true;
2649 }
2650 }
2651
2652 return false;
2653 }
2654
2656 {
2659 }
2660
2662 {
2663
2666 }
2667
2669 {
2671 {
2674
2675 switch( build_action_id )
2676 {
2680 }
2681 }
2682 }
2683
2684
2686 {
2688 bool is_base = part.
IsBase();
2691 if ( is_part_built_sync )
2692 {
2694 {
2698
2699 if (is_base)
2700 {
2703 }
2704 }
2705 }
2706 else
2707 {
2709 {
2713
2714 if (is_base)
2715 {
2718 }
2719 }
2720 }
2721
2722
2724 }
2725
2726
2728 {
2731
2732 for ( int i = 0; i < construction_parts.Count(); ++i )
2733 {
2734 string key = construction_parts.GetKey( i );
2737 }
2738
2739
2741 }
2742
2744 {
2747
2748 for ( int i = 0; i < construction_parts.Count(); ++i )
2749 {
2750 string key = construction_parts.GetKey( i );
2752
2753 if ( value.
GetId() ==
id )
2754 {
2755 return value;
2756 }
2757 }
2758
2759 return NULL;
2760 }
2761
2762
2763
2765 {
2767 }
2768
2770 {
2772 }
2773
2775 {
2776 return true;
2777 }
2778
2780 {
2781 return false;
2782 }
2783
2784
2786 {
2789 {
2791 }
2792
2793 return construction_kit;
2794 }
2795
2797 {
2800 {
2802 }
2803 }
2804
2806 {
2808 }
2809
2811 {
2812 return "";
2813 }
2814
2816 {
2818 g_Game.ObjectDelete( construction_kit );
2819 }
2820
2821
2823 {
2825 g_Game.ObjectDelete(
this );
2826 }
2827
2828
2830 {
2831 super.EEDelete(parent);
2832
2834 {
2835 areaDamage.Destroy();
2836 }
2837
2838 }
2839
2841 {
2842 super.OnStoreSave( ctx );
2843
2844
2848
2850 }
2851
2853 {
2854 if ( !super.OnStoreLoad( ctx, version ) )
2855 return false;
2856
2857
2858
2860 {
2862 return false;
2863 }
2865 {
2867 return false;
2868 }
2870 {
2872 return false;
2873 }
2874
2875
2877 {
2879 return false;
2880 }
2881
2882
2883 return true;
2884 }
2885
2887 {
2888 super.AfterStoreLoad();
2889
2891 {
2893 }
2894 }
2895
2897 {
2898
2900
2901
2904
2905
2907 }
2908
2910 {
2911 super.OnCreatePhysics();
2912
2913 ConstructionInit();
2915 }
2916
2918 {
2920 return;
2921
2922 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2923 }
2924
2926 {
2928 {
2930 }
2931
2932 super.EEOnAfterLoad();
2933 }
2934
2936 {
2937 super.EEItemAttached( item, slot_name );
2938
2942 }
2943
2945 {
2946 super.EEItemDetached( item, slot_name );
2947
2950 }
2951
2952 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2953 {
2956
2959 }
2960
2961
2963 {
2964 return true;
2965 }
2966
2967
2968
2970 {
2972
2973
2974 if (construtionPart.
IsBase())
2975 {
2977
2978
2980 }
2981
2982
2984
2985
2987
2988
2990
2992
2994
2995
2997
2998
3000 }
3001
3003 {
3004
3006 }
3007
3008
3010 {
3013
3014
3016
3017
3019
3020
3022
3023
3025
3027
3028
3030
3031
3033
3034
3035 if (construtionPart.
IsBase())
3036 {
3037
3039 }
3040 }
3041
3043 {
3044
3046 }
3047
3048
3049 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3050 {
3053
3054
3056
3057
3059
3060
3062
3063
3065
3067
3068
3070
3071
3073
3074
3075 if (construtionPart.
IsBase())
3076 {
3077
3079 }
3080 }
3081
3083 {
3084
3086 }
3087
3088
3090 {
3092
3095 }
3096
3098 {
3100
3102 {
3104 }
3105 else
3106 {
3108 }
3109
3111 }
3112
3114 {
3116
3118 foreach (
string slotName : attachmentSlots)
3119 {
3121 }
3122
3123
3126 else
3128
3130 }
3131
3133 {
3134 string slotNameMounted = slot_name + "_Mounted";
3135 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3136
3137 if (attachment)
3138 {
3139 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3140 if (barbedWire && barbedWire.IsMounted())
3142 else
3144
3145 if (is_locked)
3146 {
3147 SetAnimationPhase(slotNameMounted, 0);
3148 SetAnimationPhase(slot_name, 1);
3149 }
3150 else
3151 {
3152 SetAnimationPhase(slotNameMounted, 1);
3153 SetAnimationPhase(slot_name, 0);
3154 }
3155 }
3156 else
3157 {
3158 SetAnimationPhase(slotNameMounted, 1);
3159 SetAnimationPhase(slot_name, 1);
3160
3162 }
3163 }
3164
3165
3167 {
3170
3173
3176
3177 foreach (
string slotName : attachmentSlots)
3178 {
3180 }
3181
3182
3184 {
3187
3189 }
3190 else
3191 {
3194
3196 }
3197
3200 }
3201
3203 {
3204
3206 return;
3207
3208 string slot_name_mounted = slot_name + "_Mounted";
3209 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3210
3211
3213 RemoveProxyPhysics( slot_name_mounted );
3214 RemoveProxyPhysics( slot_name );
3215
3216 if ( attachment )
3217 {
3219 if ( is_locked )
3220 {
3222 AddProxyPhysics( slot_name_mounted );
3223 }
3224 else
3225 {
3227 AddProxyPhysics( slot_name );
3228 }
3229 }
3230 }
3231
3233 {
3234 SetAffectPathgraph( true, false );
3236 }
3237
3239 {
3240 return true;
3241 }
3242
3244 {
3245 return true;
3246 }
3247
3249 {
3250 if ( attachment )
3251 {
3253 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3254
3255 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3256 }
3257
3258 return false;
3259 }
3260
3262 {
3264 }
3265
3266
3268 {
3269 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3270 if (
g_Game.ConfigIsExisting( config_path ) )
3271 {
3272 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3273 }
3274 }
3275
3277 {
3278 return true;
3279 }
3280
3282 {
3283 return true;
3284 }
3285
3287 {
3288 return true;
3289 }
3290
3291
3293 {
3296 }
3297
3299 {
3301 }
3302
3304 {
3306 }
3307
3309 {
3310 int attachment_count = GetInventory().AttachmentCount();
3311 if ( attachment_count > 0 )
3312 {
3313 if (
HasBase() && attachment_count == 1 )
3314 {
3315 return false;
3316 }
3317
3318 return true;
3319 }
3320
3321 return false;
3322 }
3323
3325 {
3326 return true;
3327 }
3328
3330 {
3331 return false;
3332 }
3333
3334
3336 {
3337 return false;
3338 }
3339
3341 {
3342 return false;
3343 }
3344
3345
3347 {
3348 return false;
3349 }
3350
3351
3352
3354 {
3355 return true;
3356 }
3357
3359 {
3360 return true;
3361 }
3362
3365 {
3366 return false;
3367 }
3368
3369
3371 {
3372 return false;
3373 }
3374
3375
3377 {
3378 return true;
3379 }
3380
3381
3383 {
3384 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3385 {
3386 return false;
3387 }
3388
3389 return true;
3390 }
3391
3393 {
3396
3397 return item;
3398 }
3399
3400
3402 {
3404 {
3405
3407
3408
3411
3413 if ( MemoryPointExists( slot_name + "_min" ) )
3414 {
3415 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3416 }
3417 if ( MemoryPointExists( slot_name + "_max" ) )
3418 {
3419 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3420 }
3421
3422
3425
3426
3429 center = ModelToWorld( center );
3430
3431
3434
3435 areaDamage.SetExtents( extents[0], extents[1] );
3436 areaDamage.SetAreaPosition( center );
3440 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3441 areaDamage.SetAmmoName( "BarbedWireHit" );
3442 areaDamage.Spawn();
3443
3445 }
3446 }
3447
3449 {
3450 if ( angle_deg != 0 )
3451 {
3452
3454
3455
3457 if ( MemoryPointExists( "rotate_axis" ) )
3458 {
3459 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3460 }
3461 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];
3462 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];
3463 center[0] = r_center_x;
3464 center[2] = r_center_z;
3465 }
3466 }
3467
3469 {
3471 {
3474 {
3475 if (areaDamage)
3476 {
3477 areaDamage.Destroy();
3478 }
3479
3481 }
3482 }
3483 }
3484
3486 {
3487 return true;
3488 }
3489
3490
3491
3492
3494 {
3496 }
3497
3499 {
3501 }
3502
3504 {
3506 }
3507
3509 {
3511
3512 switch ( material_type )
3513 {
3519 }
3520
3521 return "";
3522 }
3523
3525 {
3527
3528 switch ( material_type )
3529 {
3535 }
3536
3537 return "";
3538 }
3539
3540
3542 {
3544 {
3545
3547 {
3548 SetHealth(slot_name,"Health",item.GetHealth());
3549 }
3550 }
3551 }
3552
3554 {
3555 return 111;
3556 }
3557
3559 {
3560 super.SetActions();
3561
3565 }
3566
3568 {
3570 if (!construction)
3571 return;
3572
3574 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3575 {
3578 {
3580 }
3581 }
3582 }
3583
3585 {
3587 if (!construction)
3588 return;
3589
3591 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3592 {
3595 {
3596 construction.HandleEntityFalling(part.
GetPartName());
3597 }
3598 }
3599 }
3600
3603 {
3605 return;
3606
3609
3610 if (DestroyOnFall())
3611 {
3613 {
3615 }
3616 else
3617 {
3619 {
3621 }
3623 }
3624 }
3625 }
3626
3628 {
3629 if (HasAnyAttachmentsOrCargo())
3630 {
3633 }
3634 }
3635
3636
3637
3638
3639
3642 {
3643 return null;
3644 }
3645
3647 {
3649 }
3650
3652 {
3655
3656 Man p;
3657
3658 #ifdef SERVER
3660 g_Game.GetWorld().GetPlayerList(players);
3661 if (players.Count())
3662 p = players[0];
3663 #else
3665 #endif
3666
3668 {
3669 bool excluded = false;
3671 if (excludes)
3672 {
3673 foreach (string exclude : excludes)
3674 {
3676 {
3677 excluded = true;
3678 break;
3679 }
3680 }
3681 }
3682
3683 if (!excluded)
3684 {
3686 }
3687 }
3688
3690 }
3691
3693
3695 [
Obsolete(
"handled in the Construction component directly")]
3697 {
3698 }
3699
3700 [
Obsolete(
"handled in the Construction component directly")]
3702 {
3703 }
3704
3705 [
Obsolete(
"obsolete debug method")]
3707 {
3708 }
3709}
3710
3712{
3713#ifdef BSB_DEBUG
3715#else
3716
3717#endif
3718}
3720{
3721#ifdef BSB_DEBUG_SPAM
3723#else
3724
3725#endif
3726}
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.