2240{
2242
2244
2246
2253
2254
2255
2261
2267
2269
2273
2274
2276 {
2278
2279
2280 RegisterNetSyncVariableInt( "m_SyncParts01" );
2281 RegisterNetSyncVariableInt( "m_SyncParts02" );
2282 RegisterNetSyncVariableInt( "m_SyncParts03" );
2283 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2284 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2285 RegisterNetSyncVariableBool( "m_HasBase" );
2286
2287
2288 ConstructionInit();
2289
2290 if (ConfigIsExisting("hybridAttachments"))
2291 {
2294 }
2295 if (ConfigIsExisting("mountables"))
2296 {
2299 }
2300
2302 SetAllowDamage(true);
2303 }
2304
2306 {
2307 return "disableBaseDamage";
2308 }
2309
2311 {
2312 return true;
2313 }
2314
2316 {
2317 return EInventoryIconVisibility.HIDE_VICINITY;
2318 }
2319
2321 {
2322 super.InitItemSounds();
2323
2327
2332 }
2333
2335 {
2336 return "putDown_FenceKit_SoundSet";
2337 }
2338
2340 {
2341 return "Shelter_Site_Build_Loop_SoundSet";
2342 }
2343
2344
2346 {
2348 {
2349 SetSynchDirty();
2350 }
2351 }
2352
2354 {
2356 super.OnVariablesSynchronized();
2357
2359 }
2360
2362 {
2363
2365
2366
2368
2369
2371 }
2372
2373
2375 {
2376
2377 int offset;
2378 int mask;
2379
2380 if ( part_id >= 1 && part_id <= 31 )
2381 {
2382 offset = part_id - 1;
2383 mask = 1 << offset;
2384
2386 }
2387 else if ( part_id >= 32 && part_id <= 62 )
2388 {
2389 offset = ( part_id % 32 );
2390 mask = 1 << offset;
2391
2393 }
2394 else if ( part_id >= 63 && part_id <= 93 )
2395 {
2396 offset = ( part_id % 63 );
2397 mask = 1 << offset;
2398
2400 }
2401 }
2402
2404 {
2405
2406 int offset;
2407 int mask;
2408
2409 if ( part_id >= 1 && part_id <= 31 )
2410 {
2411 offset = part_id - 1;
2412 mask = 1 << offset;
2413
2415 }
2416 else if ( part_id >= 32 && part_id <= 62 )
2417 {
2418 offset = ( part_id % 32 );
2419 mask = 1 << offset;
2420
2422 }
2423 else if ( part_id >= 63 && part_id <= 93 )
2424 {
2425 offset = ( part_id % 63 );
2426 mask = 1 << offset;
2427
2429 }
2430 }
2431
2433 {
2434
2435 int offset;
2436 int mask;
2437
2438 if ( part_id >= 1 && part_id <= 31 )
2439 {
2440 offset = part_id - 1;
2441 mask = 1 << offset;
2442
2444 {
2445 return true;
2446 }
2447 }
2448 else if ( part_id >= 32 && part_id <= 62 )
2449 {
2450 offset = ( part_id % 32 );
2451 mask = 1 << offset;
2452
2454 {
2455 return true;
2456 }
2457 }
2458 else if ( part_id >= 63 && part_id <= 93 )
2459 {
2460 offset = ( part_id % 63 );
2461 mask = 1 << offset;
2462
2464 {
2465 return true;
2466 }
2467 }
2468
2469 return false;
2470 }
2471
2473 {
2476 }
2477
2479 {
2480
2483 }
2484
2486 {
2488 {
2491
2492 switch( build_action_id )
2493 {
2497 }
2498 }
2499 }
2500
2501
2503 {
2505 bool is_base = part.
IsBase();
2508 if ( is_part_built_sync )
2509 {
2511 {
2515
2516 if (is_base)
2517 {
2520 }
2521 }
2522 }
2523 else
2524 {
2526 {
2530
2531 if (is_base)
2532 {
2535 }
2536 }
2537 }
2538
2539
2541 }
2542
2543
2545 {
2548
2549 for ( int i = 0; i < construction_parts.Count(); ++i )
2550 {
2551 string key = construction_parts.GetKey( i );
2554 }
2555
2556
2558 }
2559
2561 {
2564
2565 for ( int i = 0; i < construction_parts.Count(); ++i )
2566 {
2567 string key = construction_parts.GetKey( i );
2569
2570 if ( value.
GetId() ==
id )
2571 {
2572 return value;
2573 }
2574 }
2575
2576 return NULL;
2577 }
2578
2579
2580
2582 {
2584 }
2585
2587 {
2589 }
2590
2592 {
2593 return true;
2594 }
2595
2597 {
2598 return false;
2599 }
2600
2601
2603 {
2606 {
2608 }
2609
2610 return construction_kit;
2611 }
2612
2614 {
2617 {
2619 }
2620 }
2621
2623 {
2625 }
2626
2628 {
2629 return "";
2630 }
2631
2633 {
2635 g_Game.ObjectDelete( construction_kit );
2636 }
2637
2638
2640 {
2642 g_Game.ObjectDelete(
this );
2643 }
2644
2645
2647 {
2648 super.EEDelete(parent);
2649
2651 {
2652 areaDamage.Destroy();
2653 }
2654
2655 }
2656
2658 {
2659 super.OnStoreSave( ctx );
2660
2661
2665
2667 }
2668
2670 {
2671 if ( !super.OnStoreLoad( ctx, version ) )
2672 return false;
2673
2674
2675
2677 {
2679 return false;
2680 }
2682 {
2684 return false;
2685 }
2687 {
2689 return false;
2690 }
2691
2692
2694 {
2696 return false;
2697 }
2698
2699
2700 return true;
2701 }
2702
2704 {
2705 super.AfterStoreLoad();
2706
2708 {
2710 }
2711 }
2712
2714 {
2715
2717
2718
2721
2722
2724 }
2725
2727 {
2728 super.OnCreatePhysics();
2729
2730 ConstructionInit();
2732 }
2733
2735 {
2737 return;
2738
2739 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2740 }
2741
2743 {
2745 {
2747 }
2748
2749 super.EEOnAfterLoad();
2750 }
2751
2753 {
2754 super.EEItemAttached( item, slot_name );
2755
2759 }
2760
2762 {
2763 super.EEItemDetached( item, slot_name );
2764
2767 }
2768
2769 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2770 {
2773
2776 }
2777
2778
2780 {
2781 return true;
2782 }
2783
2784
2785
2787 {
2789
2790
2791 if (construtionPart.
IsBase())
2792 {
2794
2795
2797 }
2798
2799
2801
2802
2804
2805
2807
2809
2811
2812
2814
2815
2817 }
2818
2820 {
2821
2823 }
2824
2825
2827 {
2830
2831
2833
2834
2836
2837
2839
2840
2842
2844
2845
2847
2848
2850
2851
2852 if (construtionPart.
IsBase())
2853 {
2854
2856 }
2857 }
2858
2860 {
2861
2863 }
2864
2865
2866 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2867 {
2870
2871
2873
2874
2876
2877
2879
2880
2882
2884
2885
2887
2888
2890
2891
2892 if (construtionPart.
IsBase())
2893 {
2894
2896 }
2897 }
2898
2900 {
2901
2903 }
2904
2905
2907 {
2909
2912 }
2913
2915 {
2917
2919 {
2921 }
2922 else
2923 {
2925 }
2926
2928 }
2929
2931 {
2933
2935 foreach (
string slotName : attachmentSlots)
2936 {
2938 }
2939
2940
2943 else
2945
2947 }
2948
2950 {
2951 string slotNameMounted = slot_name + "_Mounted";
2952 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2953
2954 if (attachment)
2955 {
2956 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2957 if (barbedWire && barbedWire.IsMounted())
2959 else
2961
2962 if (is_locked)
2963 {
2964 SetAnimationPhase(slotNameMounted, 0);
2965 SetAnimationPhase(slot_name, 1);
2966 }
2967 else
2968 {
2969 SetAnimationPhase(slotNameMounted, 1);
2970 SetAnimationPhase(slot_name, 0);
2971 }
2972 }
2973 else
2974 {
2975 SetAnimationPhase(slotNameMounted, 1);
2976 SetAnimationPhase(slot_name, 1);
2977
2979 }
2980 }
2981
2982
2984 {
2987
2990
2993
2994 foreach (
string slotName : attachmentSlots)
2995 {
2997 }
2998
2999
3001 {
3004
3006 }
3007 else
3008 {
3011
3013 }
3014
3017 }
3018
3020 {
3021
3023 return;
3024
3025 string slot_name_mounted = slot_name + "_Mounted";
3026 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3027
3028
3030 RemoveProxyPhysics( slot_name_mounted );
3031 RemoveProxyPhysics( slot_name );
3032
3033 if ( attachment )
3034 {
3036 if ( is_locked )
3037 {
3039 AddProxyPhysics( slot_name_mounted );
3040 }
3041 else
3042 {
3044 AddProxyPhysics( slot_name );
3045 }
3046 }
3047 }
3048
3050 {
3051 SetAffectPathgraph( true, false );
3053 }
3054
3056 {
3057 return true;
3058 }
3059
3061 {
3062 return true;
3063 }
3064
3066 {
3067 if ( attachment )
3068 {
3070 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3071
3072 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3073 }
3074
3075 return false;
3076 }
3077
3079 {
3081 }
3082
3083
3085 {
3086 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3087 if (
g_Game.ConfigIsExisting( config_path ) )
3088 {
3089 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3090 }
3091 }
3092
3094 {
3095 return true;
3096 }
3097
3099 {
3100 return true;
3101 }
3102
3104 {
3105 return true;
3106 }
3107
3108
3110 {
3113 }
3114
3116 {
3118 }
3119
3121 {
3123 }
3124
3126 {
3127 int attachment_count = GetInventory().AttachmentCount();
3128 if ( attachment_count > 0 )
3129 {
3130 if (
HasBase() && attachment_count == 1 )
3131 {
3132 return false;
3133 }
3134
3135 return true;
3136 }
3137
3138 return false;
3139 }
3140
3142 {
3143 return true;
3144 }
3145
3147 {
3148 return false;
3149 }
3150
3151
3153 {
3154 return false;
3155 }
3156
3158 {
3159 return false;
3160 }
3161
3162
3164 {
3165 return false;
3166 }
3167
3168
3169
3171 {
3172 return true;
3173 }
3174
3176 {
3177 return true;
3178 }
3179
3182 {
3183 return false;
3184 }
3185
3186
3188 {
3189 return false;
3190 }
3191
3192
3194 {
3195 return true;
3196 }
3197
3198
3200 {
3201 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3202 {
3203 return false;
3204 }
3205
3206 return true;
3207 }
3208
3210 {
3213
3214 return item;
3215 }
3216
3217
3219 {
3221 {
3222
3224
3225
3228
3230 if ( MemoryPointExists( slot_name + "_min" ) )
3231 {
3232 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3233 }
3234 if ( MemoryPointExists( slot_name + "_max" ) )
3235 {
3236 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3237 }
3238
3239
3242
3243
3246 center = ModelToWorld( center );
3247
3248
3251
3252 areaDamage.SetExtents( extents[0], extents[1] );
3253 areaDamage.SetAreaPosition( center );
3257 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3258 areaDamage.SetAmmoName( "BarbedWireHit" );
3259 areaDamage.Spawn();
3260
3262 }
3263 }
3264
3266 {
3267 if ( angle_deg != 0 )
3268 {
3269
3271
3272
3274 if ( MemoryPointExists( "rotate_axis" ) )
3275 {
3276 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3277 }
3278 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];
3279 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];
3280 center[0] = r_center_x;
3281 center[2] = r_center_z;
3282 }
3283 }
3284
3286 {
3288 {
3291 {
3292 if (areaDamage)
3293 {
3294 areaDamage.Destroy();
3295 }
3296
3298 }
3299 }
3300 }
3301
3303 {
3304 return true;
3305 }
3306
3307
3308
3309
3311 {
3313 }
3314
3316 {
3318 }
3319
3321 {
3323 }
3324
3326 {
3328
3329 switch ( material_type )
3330 {
3336 }
3337
3338 return "";
3339 }
3340
3342 {
3344
3345 switch ( material_type )
3346 {
3352 }
3353
3354 return "";
3355 }
3356
3357
3359 {
3361 {
3362
3364 {
3365 SetHealth(slot_name,"Health",item.GetHealth());
3366 }
3367 }
3368 }
3369
3371 {
3372 return 111;
3373 }
3374
3376 {
3377 super.SetActions();
3378
3382 }
3383
3385 {
3387 if (!construction)
3388 return;
3389
3391 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3392 {
3395 {
3397 }
3398 }
3399 }
3400
3402 {
3404 if (!construction)
3405 return;
3406
3408 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3409 {
3412 {
3413 construction.HandleEntityFalling(part.
GetPartName());
3414 }
3415 }
3416 }
3417
3420 {
3422 return;
3423
3426
3427 if (DestroyOnFall())
3428 {
3430 {
3432 }
3433 else
3434 {
3436 {
3438 }
3440 }
3441 }
3442 }
3443
3445 {
3446 if (HasAnyAttachmentsOrCargo())
3447 {
3450 }
3451 }
3452
3453
3454
3455
3456
3459 {
3460 return null;
3461 }
3462
3464 {
3466 }
3467
3469 {
3472
3473 Man p;
3474
3475 #ifdef SERVER
3477 g_Game.GetWorld().GetPlayerList(players);
3478 if (players.Count())
3479 p = players[0];
3480 #else
3482 #endif
3483
3485 {
3486 bool excluded = false;
3488 if (excludes)
3489 {
3490 foreach (string exclude : excludes)
3491 {
3493 {
3494 excluded = true;
3495 break;
3496 }
3497 }
3498 }
3499
3500 if (!excluded)
3501 {
3503 }
3504 }
3505
3507 }
3508
3510
3512 [
Obsolete(
"handled in the Construction component directly")]
3514 {
3515 }
3516
3517 [
Obsolete(
"handled in the Construction component directly")]
3519 {
3520 }
3521
3522 [
Obsolete(
"obsolete debug method")]
3524 {
3525 }
3526}
3527
3529{
3530#ifdef BSB_DEBUG
3532#else
3533
3534#endif
3535}
3537{
3538#ifdef BSB_DEBUG_SPAM
3540#else
3541
3542#endif
3543}
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.