2368{
2370
2372
2374
2381
2382
2383
2389
2395
2397
2401
2402
2404 {
2406
2407
2408 RegisterNetSyncVariableInt( "m_SyncParts01" );
2409 RegisterNetSyncVariableInt( "m_SyncParts02" );
2410 RegisterNetSyncVariableInt( "m_SyncParts03" );
2411 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2412 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2413 RegisterNetSyncVariableBool( "m_HasBase" );
2414
2415
2416 ConstructionInit();
2417
2418 if (ConfigIsExisting("hybridAttachments"))
2419 {
2422 }
2423 if (ConfigIsExisting("mountables"))
2424 {
2427 }
2428
2430 SetAllowDamage(true);
2431 }
2432
2434 {
2435 return "disableBaseDamage";
2436 }
2437
2439 {
2440 return true;
2441 }
2442
2444 {
2445 return EInventoryIconVisibility.HIDE_VICINITY;
2446 }
2447
2449 {
2450 super.InitItemSounds();
2451
2455
2460 }
2461
2463 {
2464 return "putDown_FenceKit_SoundSet";
2465 }
2466
2468 {
2469 return "Shelter_Site_Build_Loop_SoundSet";
2470 }
2471
2472
2474 {
2476 {
2477 SetSynchDirty();
2478 }
2479 }
2480
2482 {
2484 super.OnVariablesSynchronized();
2485
2487 }
2488
2490 {
2491
2493
2494
2496
2497
2499 }
2500
2501
2503 {
2504
2505 int offset;
2506 int mask;
2507
2508 if ( part_id >= 1 && part_id <= 31 )
2509 {
2510 offset = part_id - 1;
2511 mask = 1 << offset;
2512
2514 }
2515 else if ( part_id >= 32 && part_id <= 62 )
2516 {
2517 offset = ( part_id % 32 );
2518 mask = 1 << offset;
2519
2521 }
2522 else if ( part_id >= 63 && part_id <= 93 )
2523 {
2524 offset = ( part_id % 63 );
2525 mask = 1 << offset;
2526
2528 }
2529 }
2530
2532 {
2533
2534 int offset;
2535 int mask;
2536
2537 if ( part_id >= 1 && part_id <= 31 )
2538 {
2539 offset = part_id - 1;
2540 mask = 1 << offset;
2541
2543 }
2544 else if ( part_id >= 32 && part_id <= 62 )
2545 {
2546 offset = ( part_id % 32 );
2547 mask = 1 << offset;
2548
2550 }
2551 else if ( part_id >= 63 && part_id <= 93 )
2552 {
2553 offset = ( part_id % 63 );
2554 mask = 1 << offset;
2555
2557 }
2558 }
2559
2561 {
2562
2563 int offset;
2564 int mask;
2565
2566 if ( part_id >= 1 && part_id <= 31 )
2567 {
2568 offset = part_id - 1;
2569 mask = 1 << offset;
2570
2572 {
2573 return true;
2574 }
2575 }
2576 else if ( part_id >= 32 && part_id <= 62 )
2577 {
2578 offset = ( part_id % 32 );
2579 mask = 1 << offset;
2580
2582 {
2583 return true;
2584 }
2585 }
2586 else if ( part_id >= 63 && part_id <= 93 )
2587 {
2588 offset = ( part_id % 63 );
2589 mask = 1 << offset;
2590
2592 {
2593 return true;
2594 }
2595 }
2596
2597 return false;
2598 }
2599
2601 {
2604 }
2605
2607 {
2608
2611 }
2612
2614 {
2616 {
2619
2620 switch( build_action_id )
2621 {
2625 }
2626 }
2627 }
2628
2629
2631 {
2633 bool is_base = part.
IsBase();
2636 if ( is_part_built_sync )
2637 {
2639 {
2643
2644 if (is_base)
2645 {
2648 }
2649 }
2650 }
2651 else
2652 {
2654 {
2658
2659 if (is_base)
2660 {
2663 }
2664 }
2665 }
2666
2667
2669 }
2670
2671
2673 {
2676
2677 for ( int i = 0; i < construction_parts.Count(); ++i )
2678 {
2679 string key = construction_parts.GetKey( i );
2682 }
2683
2684
2686 }
2687
2689 {
2692
2693 for ( int i = 0; i < construction_parts.Count(); ++i )
2694 {
2695 string key = construction_parts.GetKey( i );
2697
2698 if ( value.
GetId() ==
id )
2699 {
2700 return value;
2701 }
2702 }
2703
2704 return NULL;
2705 }
2706
2707
2708
2710 {
2712 }
2713
2715 {
2717 }
2718
2720 {
2721 return true;
2722 }
2723
2725 {
2726 return false;
2727 }
2728
2729
2731 {
2734 {
2736 }
2737
2738 return construction_kit;
2739 }
2740
2742 {
2745 {
2747 }
2748 }
2749
2751 {
2753 }
2754
2756 {
2757 return "";
2758 }
2759
2761 {
2763 g_Game.ObjectDelete( construction_kit );
2764 }
2765
2766
2768 {
2770 g_Game.ObjectDelete(
this );
2771 }
2772
2773
2775 {
2776 super.EEDelete(parent);
2777
2779 {
2780 areaDamage.Destroy();
2781 }
2782
2783 }
2784
2786 {
2787 super.OnStoreSave( ctx );
2788
2789
2793
2795 }
2796
2798 {
2799 if ( !super.OnStoreLoad( ctx, version ) )
2800 return false;
2801
2802
2803
2805 {
2807 return false;
2808 }
2810 {
2812 return false;
2813 }
2815 {
2817 return false;
2818 }
2819
2820
2822 {
2824 return false;
2825 }
2826
2827
2828 return true;
2829 }
2830
2832 {
2833 super.AfterStoreLoad();
2834
2836 {
2838 }
2839 }
2840
2842 {
2843
2845
2846
2849
2850
2852 }
2853
2855 {
2856 super.OnCreatePhysics();
2857
2858 ConstructionInit();
2860 }
2861
2863 {
2865 return;
2866
2867 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2868 }
2869
2871 {
2873 {
2875 }
2876
2877 super.EEOnAfterLoad();
2878 }
2879
2881 {
2882 super.EEItemAttached( item, slot_name );
2883
2887 }
2888
2890 {
2891 super.EEItemDetached( item, slot_name );
2892
2895 }
2896
2897 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2898 {
2901
2904 }
2905
2906
2908 {
2909 return true;
2910 }
2911
2912
2913
2915 {
2917
2918
2919 if (construtionPart.
IsBase())
2920 {
2922
2923
2925 }
2926
2927
2929
2930
2932
2933
2935
2937
2939
2940
2942
2943
2945 }
2946
2948 {
2949
2951 }
2952
2953
2955 {
2958
2959
2961
2962
2964
2965
2967
2968
2970
2972
2973
2975
2976
2978
2979
2980 if (construtionPart.
IsBase())
2981 {
2982
2984 }
2985 }
2986
2988 {
2989
2991 }
2992
2993
2994 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2995 {
2998
2999
3001
3002
3004
3005
3007
3008
3010
3012
3013
3015
3016
3018
3019
3020 if (construtionPart.
IsBase())
3021 {
3022
3024 }
3025 }
3026
3028 {
3029
3031 }
3032
3033
3035 {
3037
3040 }
3041
3043 {
3045
3047 {
3049 }
3050 else
3051 {
3053 }
3054
3056 }
3057
3059 {
3061
3063 foreach (
string slotName : attachmentSlots)
3064 {
3066 }
3067
3068
3071 else
3073
3075 }
3076
3078 {
3079 string slotNameMounted = slot_name + "_Mounted";
3080 EntityAI attachment = FindAttachmentBySlotName(slot_name);
3081
3082 if (attachment)
3083 {
3084 BarbedWire barbedWire = BarbedWire.Cast(attachment);
3085 if (barbedWire && barbedWire.IsMounted())
3087 else
3089
3090 if (is_locked)
3091 {
3092 SetAnimationPhase(slotNameMounted, 0);
3093 SetAnimationPhase(slot_name, 1);
3094 }
3095 else
3096 {
3097 SetAnimationPhase(slotNameMounted, 1);
3098 SetAnimationPhase(slot_name, 0);
3099 }
3100 }
3101 else
3102 {
3103 SetAnimationPhase(slotNameMounted, 1);
3104 SetAnimationPhase(slot_name, 1);
3105
3107 }
3108 }
3109
3110
3112 {
3115
3118
3121
3122 foreach (
string slotName : attachmentSlots)
3123 {
3125 }
3126
3127
3129 {
3132
3134 }
3135 else
3136 {
3139
3141 }
3142
3145 }
3146
3148 {
3149
3151 return;
3152
3153 string slot_name_mounted = slot_name + "_Mounted";
3154 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3155
3156
3158 RemoveProxyPhysics( slot_name_mounted );
3159 RemoveProxyPhysics( slot_name );
3160
3161 if ( attachment )
3162 {
3164 if ( is_locked )
3165 {
3167 AddProxyPhysics( slot_name_mounted );
3168 }
3169 else
3170 {
3172 AddProxyPhysics( slot_name );
3173 }
3174 }
3175 }
3176
3178 {
3179 SetAffectPathgraph( true, false );
3181 }
3182
3184 {
3185 return true;
3186 }
3187
3189 {
3190 return true;
3191 }
3192
3194 {
3195 if ( attachment )
3196 {
3198 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3199
3200 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3201 }
3202
3203 return false;
3204 }
3205
3207 {
3209 }
3210
3211
3213 {
3214 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3215 if (
g_Game.ConfigIsExisting( config_path ) )
3216 {
3217 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3218 }
3219 }
3220
3222 {
3223 return true;
3224 }
3225
3227 {
3228 return true;
3229 }
3230
3232 {
3233 return true;
3234 }
3235
3236
3238 {
3241 }
3242
3244 {
3246 }
3247
3249 {
3251 }
3252
3254 {
3255 int attachment_count = GetInventory().AttachmentCount();
3256 if ( attachment_count > 0 )
3257 {
3258 if (
HasBase() && attachment_count == 1 )
3259 {
3260 return false;
3261 }
3262
3263 return true;
3264 }
3265
3266 return false;
3267 }
3268
3270 {
3271 return true;
3272 }
3273
3275 {
3276 return false;
3277 }
3278
3279
3281 {
3282 return false;
3283 }
3284
3286 {
3287 return false;
3288 }
3289
3290
3292 {
3293 return false;
3294 }
3295
3296
3297
3299 {
3300 return true;
3301 }
3302
3304 {
3305 return true;
3306 }
3307
3310 {
3311 return false;
3312 }
3313
3314
3316 {
3317 return false;
3318 }
3319
3320
3322 {
3323 return true;
3324 }
3325
3326
3328 {
3329 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3330 {
3331 return false;
3332 }
3333
3334 return true;
3335 }
3336
3338 {
3341
3342 return item;
3343 }
3344
3345
3347 {
3349 {
3350
3352
3353
3356
3358 if ( MemoryPointExists( slot_name + "_min" ) )
3359 {
3360 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3361 }
3362 if ( MemoryPointExists( slot_name + "_max" ) )
3363 {
3364 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3365 }
3366
3367
3370
3371
3374 center = ModelToWorld( center );
3375
3376
3379
3380 areaDamage.SetExtents( extents[0], extents[1] );
3381 areaDamage.SetAreaPosition( center );
3385 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3386 areaDamage.SetAmmoName( "BarbedWireHit" );
3387 areaDamage.Spawn();
3388
3390 }
3391 }
3392
3394 {
3395 if ( angle_deg != 0 )
3396 {
3397
3399
3400
3402 if ( MemoryPointExists( "rotate_axis" ) )
3403 {
3404 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3405 }
3406 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];
3407 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];
3408 center[0] = r_center_x;
3409 center[2] = r_center_z;
3410 }
3411 }
3412
3414 {
3416 {
3419 {
3420 if (areaDamage)
3421 {
3422 areaDamage.Destroy();
3423 }
3424
3426 }
3427 }
3428 }
3429
3431 {
3432 return true;
3433 }
3434
3435
3436
3437
3439 {
3441 }
3442
3444 {
3446 }
3447
3449 {
3451 }
3452
3454 {
3456
3457 switch ( material_type )
3458 {
3464 }
3465
3466 return "";
3467 }
3468
3470 {
3472
3473 switch ( material_type )
3474 {
3480 }
3481
3482 return "";
3483 }
3484
3485
3487 {
3489 {
3490
3492 {
3493 SetHealth(slot_name,"Health",item.GetHealth());
3494 }
3495 }
3496 }
3497
3499 {
3500 return 111;
3501 }
3502
3504 {
3505 super.SetActions();
3506
3510 }
3511
3513 {
3515 if (!construction)
3516 return;
3517
3519 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3520 {
3523 {
3525 }
3526 }
3527 }
3528
3530 {
3532 if (!construction)
3533 return;
3534
3536 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3537 {
3540 {
3541 construction.HandleEntityFalling(part.
GetPartName());
3542 }
3543 }
3544 }
3545
3548 {
3550 return;
3551
3554
3555 if (DestroyOnFall())
3556 {
3558 {
3560 }
3561 else
3562 {
3564 {
3566 }
3568 }
3569 }
3570 }
3571
3573 {
3574 if (HasAnyAttachmentsOrCargo())
3575 {
3578 }
3579 }
3580
3581
3582
3583
3584
3587 {
3588 return null;
3589 }
3590
3592 {
3594 }
3595
3597 {
3600
3601 Man p;
3602
3603 #ifdef SERVER
3605 g_Game.GetWorld().GetPlayerList(players);
3606 if (players.Count())
3607 p = players[0];
3608 #else
3610 #endif
3611
3613 {
3614 bool excluded = false;
3616 if (excludes)
3617 {
3618 foreach (string exclude : excludes)
3619 {
3621 {
3622 excluded = true;
3623 break;
3624 }
3625 }
3626 }
3627
3628 if (!excluded)
3629 {
3631 }
3632 }
3633
3635 }
3636
3638
3640 [
Obsolete(
"handled in the Construction component directly")]
3642 {
3643 }
3644
3645 [
Obsolete(
"handled in the Construction component directly")]
3647 {
3648 }
3649
3650 [
Obsolete(
"obsolete debug method")]
3652 {
3653 }
3654}
3655
3657{
3658#ifdef BSB_DEBUG
3660#else
3661
3662#endif
3663}
3665{
3666#ifdef BSB_DEBUG_SPAM
3668#else
3669
3670#endif
3671}
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.