2246{
2248
2250
2252
2259
2260
2261
2267
2273
2275
2279
2280
2282 {
2284
2285
2286 RegisterNetSyncVariableInt( "m_SyncParts01" );
2287 RegisterNetSyncVariableInt( "m_SyncParts02" );
2288 RegisterNetSyncVariableInt( "m_SyncParts03" );
2289 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2290 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2291 RegisterNetSyncVariableBool( "m_HasBase" );
2292
2293
2294 ConstructionInit();
2295
2296 if (ConfigIsExisting("hybridAttachments"))
2297 {
2300 }
2301 if (ConfigIsExisting("mountables"))
2302 {
2305 }
2306
2308 SetAllowDamage(true);
2309 }
2310
2312 {
2313 return "disableBaseDamage";
2314 }
2315
2317 {
2318 return true;
2319 }
2320
2322 {
2323 return EInventoryIconVisibility.HIDE_VICINITY;
2324 }
2325
2327 {
2328 super.InitItemSounds();
2329
2333
2338 }
2339
2341 {
2342 return "putDown_FenceKit_SoundSet";
2343 }
2344
2346 {
2347 return "Shelter_Site_Build_Loop_SoundSet";
2348 }
2349
2350
2352 {
2354 {
2355 SetSynchDirty();
2356 }
2357 }
2358
2360 {
2362 super.OnVariablesSynchronized();
2363
2365 }
2366
2368 {
2369
2371
2372
2374
2375
2377 }
2378
2379
2381 {
2382
2383 int offset;
2384 int mask;
2385
2386 if ( part_id >= 1 && part_id <= 31 )
2387 {
2388 offset = part_id - 1;
2389 mask = 1 << offset;
2390
2392 }
2393 else if ( part_id >= 32 && part_id <= 62 )
2394 {
2395 offset = ( part_id % 32 );
2396 mask = 1 << offset;
2397
2399 }
2400 else if ( part_id >= 63 && part_id <= 93 )
2401 {
2402 offset = ( part_id % 63 );
2403 mask = 1 << offset;
2404
2406 }
2407 }
2408
2410 {
2411
2412 int offset;
2413 int mask;
2414
2415 if ( part_id >= 1 && part_id <= 31 )
2416 {
2417 offset = part_id - 1;
2418 mask = 1 << offset;
2419
2421 }
2422 else if ( part_id >= 32 && part_id <= 62 )
2423 {
2424 offset = ( part_id % 32 );
2425 mask = 1 << offset;
2426
2428 }
2429 else if ( part_id >= 63 && part_id <= 93 )
2430 {
2431 offset = ( part_id % 63 );
2432 mask = 1 << offset;
2433
2435 }
2436 }
2437
2439 {
2440
2441 int offset;
2442 int mask;
2443
2444 if ( part_id >= 1 && part_id <= 31 )
2445 {
2446 offset = part_id - 1;
2447 mask = 1 << offset;
2448
2450 {
2451 return true;
2452 }
2453 }
2454 else if ( part_id >= 32 && part_id <= 62 )
2455 {
2456 offset = ( part_id % 32 );
2457 mask = 1 << offset;
2458
2460 {
2461 return true;
2462 }
2463 }
2464 else if ( part_id >= 63 && part_id <= 93 )
2465 {
2466 offset = ( part_id % 63 );
2467 mask = 1 << offset;
2468
2470 {
2471 return true;
2472 }
2473 }
2474
2475 return false;
2476 }
2477
2479 {
2482 }
2483
2485 {
2486
2489 }
2490
2492 {
2494 {
2497
2498 switch( build_action_id )
2499 {
2503 }
2504 }
2505 }
2506
2507
2509 {
2511 bool is_base = part.
IsBase();
2514 if ( is_part_built_sync )
2515 {
2517 {
2521
2522 if (is_base)
2523 {
2526 }
2527 }
2528 }
2529 else
2530 {
2532 {
2536
2537 if (is_base)
2538 {
2541 }
2542 }
2543 }
2544
2545
2547 }
2548
2549
2551 {
2554
2555 for ( int i = 0; i < construction_parts.Count(); ++i )
2556 {
2557 string key = construction_parts.GetKey( i );
2560 }
2561
2562
2564 }
2565
2567 {
2570
2571 for ( int i = 0; i < construction_parts.Count(); ++i )
2572 {
2573 string key = construction_parts.GetKey( i );
2575
2576 if ( value.
GetId() ==
id )
2577 {
2578 return value;
2579 }
2580 }
2581
2582 return NULL;
2583 }
2584
2585
2586
2588 {
2590 }
2591
2593 {
2595 }
2596
2598 {
2599 return true;
2600 }
2601
2603 {
2604 return false;
2605 }
2606
2607
2609 {
2612 {
2614 }
2615
2616 return construction_kit;
2617 }
2618
2620 {
2623 {
2625 }
2626 }
2627
2629 {
2631 }
2632
2634 {
2635 return "";
2636 }
2637
2639 {
2641 g_Game.ObjectDelete( construction_kit );
2642 }
2643
2644
2646 {
2648 g_Game.ObjectDelete(
this );
2649 }
2650
2651
2653 {
2654 super.EEDelete(parent);
2655
2657 {
2658 areaDamage.Destroy();
2659 }
2660
2661 }
2662
2664 {
2665 super.OnStoreSave( ctx );
2666
2667
2671
2673 }
2674
2676 {
2677 if ( !super.OnStoreLoad( ctx, version ) )
2678 return false;
2679
2680
2681
2683 {
2685 return false;
2686 }
2688 {
2690 return false;
2691 }
2693 {
2695 return false;
2696 }
2697
2698
2700 {
2702 return false;
2703 }
2704
2705
2706 return true;
2707 }
2708
2710 {
2711 super.AfterStoreLoad();
2712
2714 {
2716 }
2717 }
2718
2720 {
2721
2723
2724
2727
2728
2730 }
2731
2733 {
2734 super.OnCreatePhysics();
2735
2736 ConstructionInit();
2738 }
2739
2741 {
2743 return;
2744
2745 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2746 }
2747
2749 {
2751 {
2753 }
2754
2755 super.EEOnAfterLoad();
2756 }
2757
2759 {
2760 super.EEItemAttached( item, slot_name );
2761
2765 }
2766
2768 {
2769 super.EEItemDetached( item, slot_name );
2770
2773 }
2774
2775 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2776 {
2779
2782 }
2783
2784
2786 {
2787 return true;
2788 }
2789
2790
2791
2793 {
2795
2796
2797 if (construtionPart.
IsBase())
2798 {
2800
2801
2803 }
2804
2805
2807
2808
2810
2811
2813
2815
2817
2818
2820
2821
2823 }
2824
2826 {
2827
2829 }
2830
2831
2833 {
2836
2837
2839
2840
2842
2843
2845
2846
2848
2850
2851
2853
2854
2856
2857
2858 if (construtionPart.
IsBase())
2859 {
2860
2862 }
2863 }
2864
2866 {
2867
2869 }
2870
2871
2872 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2873 {
2876
2877
2879
2880
2882
2883
2885
2886
2888
2890
2891
2893
2894
2896
2897
2898 if (construtionPart.
IsBase())
2899 {
2900
2902 }
2903 }
2904
2906 {
2907
2909 }
2910
2911
2913 {
2915
2918 }
2919
2921 {
2923
2925 {
2927 }
2928 else
2929 {
2931 }
2932
2934 }
2935
2937 {
2939
2941 foreach (
string slotName : attachmentSlots)
2942 {
2944 }
2945
2946
2949 else
2951
2953 }
2954
2956 {
2957 string slotNameMounted = slot_name + "_Mounted";
2958 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2959
2960 if (attachment)
2961 {
2962 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2963 if (barbedWire && barbedWire.IsMounted())
2965 else
2967
2968 if (is_locked)
2969 {
2970 SetAnimationPhase(slotNameMounted, 0);
2971 SetAnimationPhase(slot_name, 1);
2972 }
2973 else
2974 {
2975 SetAnimationPhase(slotNameMounted, 1);
2976 SetAnimationPhase(slot_name, 0);
2977 }
2978 }
2979 else
2980 {
2981 SetAnimationPhase(slotNameMounted, 1);
2982 SetAnimationPhase(slot_name, 1);
2983
2985 }
2986 }
2987
2988
2990 {
2993
2996
2999
3000 foreach (
string slotName : attachmentSlots)
3001 {
3003 }
3004
3005
3007 {
3010
3012 }
3013 else
3014 {
3017
3019 }
3020
3023 }
3024
3026 {
3027
3029 return;
3030
3031 string slot_name_mounted = slot_name + "_Mounted";
3032 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3033
3034
3036 RemoveProxyPhysics( slot_name_mounted );
3037 RemoveProxyPhysics( slot_name );
3038
3039 if ( attachment )
3040 {
3042 if ( is_locked )
3043 {
3045 AddProxyPhysics( slot_name_mounted );
3046 }
3047 else
3048 {
3050 AddProxyPhysics( slot_name );
3051 }
3052 }
3053 }
3054
3056 {
3057 SetAffectPathgraph( true, false );
3059 }
3060
3062 {
3063 return true;
3064 }
3065
3067 {
3068 return true;
3069 }
3070
3072 {
3073 if ( attachment )
3074 {
3076 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3077
3078 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3079 }
3080
3081 return false;
3082 }
3083
3085 {
3087 }
3088
3089
3091 {
3092 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3093 if (
g_Game.ConfigIsExisting( config_path ) )
3094 {
3095 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3096 }
3097 }
3098
3100 {
3101 return true;
3102 }
3103
3105 {
3106 return true;
3107 }
3108
3110 {
3111 return true;
3112 }
3113
3114
3116 {
3119 }
3120
3122 {
3124 }
3125
3127 {
3129 }
3130
3132 {
3133 int attachment_count = GetInventory().AttachmentCount();
3134 if ( attachment_count > 0 )
3135 {
3136 if (
HasBase() && attachment_count == 1 )
3137 {
3138 return false;
3139 }
3140
3141 return true;
3142 }
3143
3144 return false;
3145 }
3146
3148 {
3149 return true;
3150 }
3151
3153 {
3154 return false;
3155 }
3156
3157
3159 {
3160 return false;
3161 }
3162
3164 {
3165 return false;
3166 }
3167
3168
3170 {
3171 return false;
3172 }
3173
3174
3175
3177 {
3178 return true;
3179 }
3180
3182 {
3183 return true;
3184 }
3185
3188 {
3189 return false;
3190 }
3191
3192
3194 {
3195 return false;
3196 }
3197
3198
3200 {
3201 return true;
3202 }
3203
3204
3206 {
3207 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3208 {
3209 return false;
3210 }
3211
3212 return true;
3213 }
3214
3216 {
3219
3220 return item;
3221 }
3222
3223
3225 {
3227 {
3228
3230
3231
3234
3236 if ( MemoryPointExists( slot_name + "_min" ) )
3237 {
3238 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3239 }
3240 if ( MemoryPointExists( slot_name + "_max" ) )
3241 {
3242 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3243 }
3244
3245
3248
3249
3252 center = ModelToWorld( center );
3253
3254
3257
3258 areaDamage.SetExtents( extents[0], extents[1] );
3259 areaDamage.SetAreaPosition( center );
3263 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3264 areaDamage.SetAmmoName( "BarbedWireHit" );
3265 areaDamage.Spawn();
3266
3268 }
3269 }
3270
3272 {
3273 if ( angle_deg != 0 )
3274 {
3275
3277
3278
3280 if ( MemoryPointExists( "rotate_axis" ) )
3281 {
3282 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3283 }
3284 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];
3285 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];
3286 center[0] = r_center_x;
3287 center[2] = r_center_z;
3288 }
3289 }
3290
3292 {
3294 {
3297 {
3298 if (areaDamage)
3299 {
3300 areaDamage.Destroy();
3301 }
3302
3304 }
3305 }
3306 }
3307
3309 {
3310 return true;
3311 }
3312
3313
3314
3315
3317 {
3319 }
3320
3322 {
3324 }
3325
3327 {
3329 }
3330
3332 {
3334
3335 switch ( material_type )
3336 {
3342 }
3343
3344 return "";
3345 }
3346
3348 {
3350
3351 switch ( material_type )
3352 {
3358 }
3359
3360 return "";
3361 }
3362
3363
3365 {
3367 {
3368
3370 {
3371 SetHealth(slot_name,"Health",item.GetHealth());
3372 }
3373 }
3374 }
3375
3377 {
3378 return 111;
3379 }
3380
3382 {
3383 super.SetActions();
3384
3388 }
3389
3391 {
3393 if (!construction)
3394 return;
3395
3397 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3398 {
3401 {
3403 }
3404 }
3405 }
3406
3408 {
3410 if (!construction)
3411 return;
3412
3414 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3415 {
3418 {
3419 construction.HandleEntityFalling(part.
GetPartName());
3420 }
3421 }
3422 }
3423
3426 {
3428 return;
3429
3432
3433 if (DestroyOnFall())
3434 {
3436 {
3438 }
3439 else
3440 {
3442 {
3444 }
3446 }
3447 }
3448 }
3449
3451 {
3452 if (HasAnyAttachmentsOrCargo())
3453 {
3456 }
3457 }
3458
3459
3460
3461
3462
3465 {
3466 return null;
3467 }
3468
3470 {
3472 }
3473
3475 {
3478
3479 Man p;
3480
3481 #ifdef SERVER
3483 g_Game.GetWorld().GetPlayerList(players);
3484 if (players.Count())
3485 p = players[0];
3486 #else
3488 #endif
3489
3491 {
3492 bool excluded = false;
3494 if (excludes)
3495 {
3496 foreach (string exclude : excludes)
3497 {
3499 {
3500 excluded = true;
3501 break;
3502 }
3503 }
3504 }
3505
3506 if (!excluded)
3507 {
3509 }
3510 }
3511
3513 }
3514
3516
3518 [
Obsolete(
"handled in the Construction component directly")]
3520 {
3521 }
3522
3523 [
Obsolete(
"handled in the Construction component directly")]
3525 {
3526 }
3527
3528 [
Obsolete(
"obsolete debug method")]
3530 {
3531 }
3532}
3533
3535{
3536#ifdef BSB_DEBUG
3538#else
3539
3540#endif
3541}
3543{
3544#ifdef BSB_DEBUG_SPAM
3546#else
3547
3548#endif
3549}
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.