2411{
2413
2415
2417
2424
2425
2426
2432
2438
2440
2444
2445
2447 {
2449
2450
2451 RegisterNetSyncVariableInt( "m_SyncParts01" );
2452 RegisterNetSyncVariableInt( "m_SyncParts02" );
2453 RegisterNetSyncVariableInt( "m_SyncParts03" );
2454 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2455 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2456 RegisterNetSyncVariableBool( "m_HasBase" );
2457
2458
2459 ConstructionInit();
2460
2461 if (ConfigIsExisting("hybridAttachments"))
2462 {
2465 }
2466 if (ConfigIsExisting("mountables"))
2467 {
2470 }
2471
2473 SetAllowDamage(true);
2474 }
2475
2477 {
2478 return "disableBaseDamage";
2479 }
2480
2482 {
2483 return true;
2484 }
2485
2487 {
2488 return EInventoryIconVisibility.HIDE_VICINITY;
2489 }
2490
2492 {
2493 super.InitItemSounds();
2494
2498
2503 }
2504
2506 {
2507 return "putDown_FenceKit_SoundSet";
2508 }
2509
2511 {
2512 return "Shelter_Site_Build_Loop_SoundSet";
2513 }
2514
2515
2517 {
2519 {
2520 SetSynchDirty();
2521 }
2522 }
2523
2525 {
2527 super.OnVariablesSynchronized();
2528
2530 }
2531
2533 {
2534
2536
2537
2539
2540
2542 }
2543
2544
2546 {
2547
2548 int offset;
2549 int mask;
2550
2551 if ( part_id >= 1 && part_id <= 31 )
2552 {
2553 offset = part_id - 1;
2554 mask = 1 << offset;
2555
2557 }
2558 else if ( part_id >= 32 && part_id <= 62 )
2559 {
2560 offset = ( part_id % 32 );
2561 mask = 1 << offset;
2562
2564 }
2565 else if ( part_id >= 63 && part_id <= 93 )
2566 {
2567 offset = ( part_id % 63 );
2568 mask = 1 << offset;
2569
2571 }
2572 }
2573
2575 {
2576
2577 int offset;
2578 int mask;
2579
2580 if ( part_id >= 1 && part_id <= 31 )
2581 {
2582 offset = part_id - 1;
2583 mask = 1 << offset;
2584
2586 }
2587 else if ( part_id >= 32 && part_id <= 62 )
2588 {
2589 offset = ( part_id % 32 );
2590 mask = 1 << offset;
2591
2593 }
2594 else if ( part_id >= 63 && part_id <= 93 )
2595 {
2596 offset = ( part_id % 63 );
2597 mask = 1 << offset;
2598
2600 }
2601 }
2602
2604 {
2605
2606 int offset;
2607 int mask;
2608
2609 if ( part_id >= 1 && part_id <= 31 )
2610 {
2611 offset = part_id - 1;
2612 mask = 1 << offset;
2613
2615 {
2616 return true;
2617 }
2618 }
2619 else if ( part_id >= 32 && part_id <= 62 )
2620 {
2621 offset = ( part_id % 32 );
2622 mask = 1 << offset;
2623
2625 {
2626 return true;
2627 }
2628 }
2629 else if ( part_id >= 63 && part_id <= 93 )
2630 {
2631 offset = ( part_id % 63 );
2632 mask = 1 << offset;
2633
2635 {
2636 return true;
2637 }
2638 }
2639
2640 return false;
2641 }
2642
2644 {
2647 }
2648
2650 {
2651
2654 }
2655
2657 {
2659 {
2662
2663 switch( build_action_id )
2664 {
2668 }
2669 }
2670 }
2671
2672
2674 {
2676 bool is_base = part.
IsBase();
2679 if ( is_part_built_sync )
2680 {
2682 {
2686
2687 if (is_base)
2688 {
2691 }
2692 }
2693 }
2694 else
2695 {
2697 {
2701
2702 if (is_base)
2703 {
2706 }
2707 }
2708 }
2709
2710
2712 }
2713
2714
2716 {
2719
2720 for ( int i = 0; i < construction_parts.Count(); ++i )
2721 {
2722 string key = construction_parts.GetKey( i );
2725 }
2726
2727
2729 }
2730
2732 {
2735
2736 for ( int i = 0; i < construction_parts.Count(); ++i )
2737 {
2738 string key = construction_parts.GetKey( i );
2740
2741 if ( value.
GetId() ==
id )
2742 {
2743 return value;
2744 }
2745 }
2746
2747 return NULL;
2748 }
2749
2750
2751
2753 {
2755 }
2756
2758 {
2760 }
2761
2763 {
2764 return true;
2765 }
2766
2768 {
2769 return false;
2770 }
2771
2772
2774 {
2777 {
2779 }
2780
2781 return construction_kit;
2782 }
2783
2785 {
2788 {
2790 }
2791 }
2792
2794 {
2796 }
2797
2799 {
2800 return "";
2801 }
2802
2804 {
2806 g_Game.ObjectDelete( construction_kit );
2807 }
2808
2809
2811 {
2813 g_Game.ObjectDelete(
this );
2814 }
2815
2816
2818 {
2819 super.EEDelete(parent);
2820
2822 {
2823 areaDamage.Destroy();
2824 }
2825
2826 }
2827
2829 {
2830 super.OnStoreSave( ctx );
2831
2832
2836
2838 }
2839
2841 {
2842 if ( !super.OnStoreLoad( ctx, version ) )
2843 return false;
2844
2845
2846
2848 {
2850 return false;
2851 }
2853 {
2855 return false;
2856 }
2858 {
2860 return false;
2861 }
2862
2863
2865 {
2867 return false;
2868 }
2869
2870
2871 return true;
2872 }
2873
2875 {
2876 super.AfterStoreLoad();
2877
2879 {
2881 }
2882 }
2883
2885 {
2886
2888
2889
2892
2893
2895 }
2896
2898 {
2899 super.OnCreatePhysics();
2900
2901 ConstructionInit();
2903 }
2904
2906 {
2908 return;
2909
2910 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2911 }
2912
2914 {
2916 {
2918 }
2919
2920 super.EEOnAfterLoad();
2921 }
2922
2924 {
2925 super.EEItemAttached( item, slot_name );
2926
2930 }
2931
2933 {
2934 super.EEItemDetached( item, slot_name );
2935
2938 }
2939
2940 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2941 {
2944
2947 }
2948
2949
2951 {
2952 return true;
2953 }
2954
2955
2956
2958 {
2960
2961
2962 if (construtionPart.
IsBase())
2963 {
2965
2966
2968 }
2969
2970
2972
2973
2975
2976
2978
2980
2982
2983
2985
2986
2988 }
2989
2991 {
2992
2994 }
2995
2996
2998 {
3001
3002
3004
3005
3007
3008
3010
3011
3013
3015
3016
3018
3019
3021
3022
3023 if (construtionPart.
IsBase())
3024 {
3025
3027 }
3028 }
3029
3031 {
3032
3034 }
3035
3036
3037 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
3038 {
3041
3042
3044
3045
3047
3048
3050
3051
3053
3055
3056
3058
3059
3061
3062
3063 if (construtionPart.
IsBase())
3064 {
3065
3067 }
3068 }
3069
3071 {
3072
3074 }
3075
3076
3078 {
3080
3083 }
3084
3086 {
3088
3090 {
3092 }
3093 else
3094 {
3096 }
3097
3099 }
3100
3102 {
3104
3106 foreach (
string slotName : attachmentSlots)
3107 {
3109 }
3110
3111
3114 else
3116
3118 }
3119
3121 {
3122 string slotNameMounted = slot_name + "_Mounted";
3123 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3124
3125 if (attachment)
3126 {
3127 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3128 if (barbedWire && barbedWire.IsMounted())
3130 else
3132
3133 if (is_locked)
3134 {
3135 SetAnimationPhase(slotNameMounted, 0);
3136 SetAnimationPhase(slot_name, 1);
3137 }
3138 else
3139 {
3140 SetAnimationPhase(slotNameMounted, 1);
3141 SetAnimationPhase(slot_name, 0);
3142 }
3143 }
3144 else
3145 {
3146 SetAnimationPhase(slotNameMounted, 1);
3147 SetAnimationPhase(slot_name, 1);
3148
3150 }
3151 }
3152
3153
3155 {
3158
3161
3164
3165 foreach (
string slotName : attachmentSlots)
3166 {
3168 }
3169
3170
3172 {
3175
3177 }
3178 else
3179 {
3182
3184 }
3185
3188 }
3189
3191 {
3192
3194 return;
3195
3196 string slot_name_mounted = slot_name + "_Mounted";
3197 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3198
3199
3201 RemoveProxyPhysics( slot_name_mounted );
3202 RemoveProxyPhysics( slot_name );
3203
3204 if ( attachment )
3205 {
3207 if ( is_locked )
3208 {
3210 AddProxyPhysics( slot_name_mounted );
3211 }
3212 else
3213 {
3215 AddProxyPhysics( slot_name );
3216 }
3217 }
3218 }
3219
3221 {
3222 SetAffectPathgraph( true, false );
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3232 {
3233 return true;
3234 }
3235
3237 {
3238 if ( attachment )
3239 {
3241 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3242
3243 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3244 }
3245
3246 return false;
3247 }
3248
3250 {
3252 }
3253
3254
3256 {
3257 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3258 if (
g_Game.ConfigIsExisting( config_path ) )
3259 {
3260 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3261 }
3262 }
3263
3265 {
3266 return true;
3267 }
3268
3270 {
3271 return true;
3272 }
3273
3275 {
3276 return true;
3277 }
3278
3279
3281 {
3284 }
3285
3287 {
3289 }
3290
3292 {
3294 }
3295
3297 {
3298 int attachment_count = GetInventory().AttachmentCount();
3299 if ( attachment_count > 0 )
3300 {
3301 if (
HasBase() && attachment_count == 1 )
3302 {
3303 return false;
3304 }
3305
3306 return true;
3307 }
3308
3309 return false;
3310 }
3311
3313 {
3314 return true;
3315 }
3316
3318 {
3319 return false;
3320 }
3321
3322
3324 {
3325 return false;
3326 }
3327
3329 {
3330 return false;
3331 }
3332
3333
3335 {
3336 return false;
3337 }
3338
3339
3340
3342 {
3343 return true;
3344 }
3345
3347 {
3348 return true;
3349 }
3350
3353 {
3354 return false;
3355 }
3356
3357
3359 {
3360 return false;
3361 }
3362
3363
3365 {
3366 return true;
3367 }
3368
3369
3371 {
3372 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3373 {
3374 return false;
3375 }
3376
3377 return true;
3378 }
3379
3381 {
3384
3385 return item;
3386 }
3387
3388
3390 {
3392 {
3393
3395
3396
3399
3401 if ( MemoryPointExists( slot_name + "_min" ) )
3402 {
3403 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3404 }
3405 if ( MemoryPointExists( slot_name + "_max" ) )
3406 {
3407 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3408 }
3409
3410
3413
3414
3417 center = ModelToWorld( center );
3418
3419
3422
3423 areaDamage.SetExtents( extents[0], extents[1] );
3424 areaDamage.SetAreaPosition( center );
3428 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3429 areaDamage.SetAmmoName( "BarbedWireHit" );
3430 areaDamage.Spawn();
3431
3433 }
3434 }
3435
3437 {
3438 if ( angle_deg != 0 )
3439 {
3440
3442
3443
3445 if ( MemoryPointExists( "rotate_axis" ) )
3446 {
3447 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3448 }
3449 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];
3450 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];
3451 center[0] = r_center_x;
3452 center[2] = r_center_z;
3453 }
3454 }
3455
3457 {
3459 {
3462 {
3463 if (areaDamage)
3464 {
3465 areaDamage.Destroy();
3466 }
3467
3469 }
3470 }
3471 }
3472
3474 {
3475 return true;
3476 }
3477
3478
3479
3480
3482 {
3484 }
3485
3487 {
3489 }
3490
3492 {
3494 }
3495
3497 {
3499
3500 switch ( material_type )
3501 {
3507 }
3508
3509 return "";
3510 }
3511
3513 {
3515
3516 switch ( material_type )
3517 {
3523 }
3524
3525 return "";
3526 }
3527
3528
3530 {
3532 {
3533
3535 {
3536 SetHealth(slot_name,"Health",item.GetHealth());
3537 }
3538 }
3539 }
3540
3542 {
3543 return 111;
3544 }
3545
3547 {
3548 super.SetActions();
3549
3553 }
3554
3556 {
3558 if (!construction)
3559 return;
3560
3562 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3563 {
3566 {
3568 }
3569 }
3570 }
3571
3573 {
3575 if (!construction)
3576 return;
3577
3579 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3580 {
3583 {
3584 construction.HandleEntityFalling(part.
GetPartName());
3585 }
3586 }
3587 }
3588
3591 {
3593 return;
3594
3597
3598 if (DestroyOnFall())
3599 {
3601 {
3603 }
3604 else
3605 {
3607 {
3609 }
3611 }
3612 }
3613 }
3614
3616 {
3617 if (HasAnyAttachmentsOrCargo())
3618 {
3621 }
3622 }
3623
3624
3625
3626
3627
3630 {
3631 return null;
3632 }
3633
3635 {
3637 }
3638
3640 {
3643
3644 Man p;
3645
3646 #ifdef SERVER
3648 g_Game.GetWorld().GetPlayerList(players);
3649 if (players.Count())
3650 p = players[0];
3651 #else
3653 #endif
3654
3656 {
3657 bool excluded = false;
3659 if (excludes)
3660 {
3661 foreach (string exclude : excludes)
3662 {
3664 {
3665 excluded = true;
3666 break;
3667 }
3668 }
3669 }
3670
3671 if (!excluded)
3672 {
3674 }
3675 }
3676
3678 }
3679
3681
3683 [
Obsolete(
"handled in the Construction component directly")]
3685 {
3686 }
3687
3688 [
Obsolete(
"handled in the Construction component directly")]
3690 {
3691 }
3692
3693 [
Obsolete(
"obsolete debug method")]
3695 {
3696 }
3697}
3698
3700{
3701#ifdef BSB_DEBUG
3703#else
3704
3705#endif
3706}
3708{
3709#ifdef BSB_DEBUG_SPAM
3711#else
3712
3713#endif
3714}
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.