2262{
2264
2266
2268
2275
2276
2277
2283
2289
2291
2295
2296
2298 {
2300
2301
2302 RegisterNetSyncVariableInt( "m_SyncParts01" );
2303 RegisterNetSyncVariableInt( "m_SyncParts02" );
2304 RegisterNetSyncVariableInt( "m_SyncParts03" );
2305 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2306 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2307 RegisterNetSyncVariableBool( "m_HasBase" );
2308
2309
2310 ConstructionInit();
2311
2312 if (ConfigIsExisting("hybridAttachments"))
2313 {
2316 }
2317 if (ConfigIsExisting("mountables"))
2318 {
2321 }
2322
2324 SetAllowDamage(true);
2325 }
2326
2328 {
2329 return "disableBaseDamage";
2330 }
2331
2333 {
2334 return true;
2335 }
2336
2338 {
2339 return EInventoryIconVisibility.HIDE_VICINITY;
2340 }
2341
2343 {
2344 super.InitItemSounds();
2345
2349
2354 }
2355
2357 {
2358 return "putDown_FenceKit_SoundSet";
2359 }
2360
2362 {
2363 return "Shelter_Site_Build_Loop_SoundSet";
2364 }
2365
2366
2368 {
2370 {
2371 SetSynchDirty();
2372 }
2373 }
2374
2376 {
2378 super.OnVariablesSynchronized();
2379
2381 }
2382
2384 {
2385
2387
2388
2390
2391
2393 }
2394
2395
2397 {
2398
2399 int offset;
2400 int mask;
2401
2402 if ( part_id >= 1 && part_id <= 31 )
2403 {
2404 offset = part_id - 1;
2405 mask = 1 << offset;
2406
2408 }
2409 else if ( part_id >= 32 && part_id <= 62 )
2410 {
2411 offset = ( part_id % 32 );
2412 mask = 1 << offset;
2413
2415 }
2416 else if ( part_id >= 63 && part_id <= 93 )
2417 {
2418 offset = ( part_id % 63 );
2419 mask = 1 << offset;
2420
2422 }
2423 }
2424
2426 {
2427
2428 int offset;
2429 int mask;
2430
2431 if ( part_id >= 1 && part_id <= 31 )
2432 {
2433 offset = part_id - 1;
2434 mask = 1 << offset;
2435
2437 }
2438 else if ( part_id >= 32 && part_id <= 62 )
2439 {
2440 offset = ( part_id % 32 );
2441 mask = 1 << offset;
2442
2444 }
2445 else if ( part_id >= 63 && part_id <= 93 )
2446 {
2447 offset = ( part_id % 63 );
2448 mask = 1 << offset;
2449
2451 }
2452 }
2453
2455 {
2456
2457 int offset;
2458 int mask;
2459
2460 if ( part_id >= 1 && part_id <= 31 )
2461 {
2462 offset = part_id - 1;
2463 mask = 1 << offset;
2464
2466 {
2467 return true;
2468 }
2469 }
2470 else if ( part_id >= 32 && part_id <= 62 )
2471 {
2472 offset = ( part_id % 32 );
2473 mask = 1 << offset;
2474
2476 {
2477 return true;
2478 }
2479 }
2480 else if ( part_id >= 63 && part_id <= 93 )
2481 {
2482 offset = ( part_id % 63 );
2483 mask = 1 << offset;
2484
2486 {
2487 return true;
2488 }
2489 }
2490
2491 return false;
2492 }
2493
2495 {
2498 }
2499
2501 {
2502
2505 }
2506
2508 {
2510 {
2513
2514 switch( build_action_id )
2515 {
2519 }
2520 }
2521 }
2522
2523
2525 {
2527 bool is_base = part.
IsBase();
2530 if ( is_part_built_sync )
2531 {
2533 {
2537
2538 if (is_base)
2539 {
2542 }
2543 }
2544 }
2545 else
2546 {
2548 {
2552
2553 if (is_base)
2554 {
2557 }
2558 }
2559 }
2560
2561
2563 }
2564
2565
2567 {
2570
2571 for ( int i = 0; i < construction_parts.Count(); ++i )
2572 {
2573 string key = construction_parts.GetKey( i );
2576 }
2577
2578
2580 }
2581
2583 {
2586
2587 for ( int i = 0; i < construction_parts.Count(); ++i )
2588 {
2589 string key = construction_parts.GetKey( i );
2591
2592 if ( value.
GetId() ==
id )
2593 {
2594 return value;
2595 }
2596 }
2597
2598 return NULL;
2599 }
2600
2601
2602
2604 {
2606 }
2607
2609 {
2611 }
2612
2614 {
2615 return true;
2616 }
2617
2619 {
2620 return false;
2621 }
2622
2623
2625 {
2628 {
2630 }
2631
2632 return construction_kit;
2633 }
2634
2636 {
2639 {
2641 }
2642 }
2643
2645 {
2647 }
2648
2650 {
2651 return "";
2652 }
2653
2655 {
2657 g_Game.ObjectDelete( construction_kit );
2658 }
2659
2660
2662 {
2664 g_Game.ObjectDelete(
this );
2665 }
2666
2667
2669 {
2670 super.EEDelete(parent);
2671
2673 {
2674 areaDamage.Destroy();
2675 }
2676
2677 }
2678
2680 {
2681 super.OnStoreSave( ctx );
2682
2683
2687
2689 }
2690
2692 {
2693 if ( !super.OnStoreLoad( ctx, version ) )
2694 return false;
2695
2696
2697
2699 {
2701 return false;
2702 }
2704 {
2706 return false;
2707 }
2709 {
2711 return false;
2712 }
2713
2714
2716 {
2718 return false;
2719 }
2720
2721
2722 return true;
2723 }
2724
2726 {
2727 super.AfterStoreLoad();
2728
2730 {
2732 }
2733 }
2734
2736 {
2737
2739
2740
2743
2744
2746 }
2747
2749 {
2750 super.OnCreatePhysics();
2751
2752 ConstructionInit();
2754 }
2755
2757 {
2759 return;
2760
2761 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2762 }
2763
2765 {
2767 {
2769 }
2770
2771 super.EEOnAfterLoad();
2772 }
2773
2775 {
2776 super.EEItemAttached( item, slot_name );
2777
2781 }
2782
2784 {
2785 super.EEItemDetached( item, slot_name );
2786
2789 }
2790
2791 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2792 {
2795
2798 }
2799
2800
2802 {
2803 return true;
2804 }
2805
2806
2807
2809 {
2811
2812
2813 if (construtionPart.
IsBase())
2814 {
2816
2817
2819 }
2820
2821
2823
2824
2826
2827
2829
2831
2833
2834
2836
2837
2839 }
2840
2842 {
2843
2845 }
2846
2847
2849 {
2852
2853
2855
2856
2858
2859
2861
2862
2864
2866
2867
2869
2870
2872
2873
2874 if (construtionPart.
IsBase())
2875 {
2876
2878 }
2879 }
2880
2882 {
2883
2885 }
2886
2887
2888 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2889 {
2892
2893
2895
2896
2898
2899
2901
2902
2904
2906
2907
2909
2910
2912
2913
2914 if (construtionPart.
IsBase())
2915 {
2916
2918 }
2919 }
2920
2922 {
2923
2925 }
2926
2927
2929 {
2931
2934 }
2935
2937 {
2939
2941 {
2943 }
2944 else
2945 {
2947 }
2948
2950 }
2951
2953 {
2955
2957 foreach (
string slotName : attachmentSlots)
2958 {
2960 }
2961
2962
2965 else
2967
2969 }
2970
2972 {
2973 string slotNameMounted = slot_name + "_Mounted";
2974 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2975
2976 if (attachment)
2977 {
2978 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2979 if (barbedWire && barbedWire.IsMounted())
2981 else
2983
2984 if (is_locked)
2985 {
2986 SetAnimationPhase(slotNameMounted, 0);
2987 SetAnimationPhase(slot_name, 1);
2988 }
2989 else
2990 {
2991 SetAnimationPhase(slotNameMounted, 1);
2992 SetAnimationPhase(slot_name, 0);
2993 }
2994 }
2995 else
2996 {
2997 SetAnimationPhase(slotNameMounted, 1);
2998 SetAnimationPhase(slot_name, 1);
2999
3001 }
3002 }
3003
3004
3006 {
3009
3012
3015
3016 foreach (
string slotName : attachmentSlots)
3017 {
3019 }
3020
3021
3023 {
3026
3028 }
3029 else
3030 {
3033
3035 }
3036
3039 }
3040
3042 {
3043
3045 return;
3046
3047 string slot_name_mounted = slot_name + "_Mounted";
3048 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3049
3050
3052 RemoveProxyPhysics( slot_name_mounted );
3053 RemoveProxyPhysics( slot_name );
3054
3055 if ( attachment )
3056 {
3058 if ( is_locked )
3059 {
3061 AddProxyPhysics( slot_name_mounted );
3062 }
3063 else
3064 {
3066 AddProxyPhysics( slot_name );
3067 }
3068 }
3069 }
3070
3072 {
3073 SetAffectPathgraph( true, false );
3075 }
3076
3078 {
3079 return true;
3080 }
3081
3083 {
3084 return true;
3085 }
3086
3088 {
3089 if ( attachment )
3090 {
3092 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3093
3094 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3095 }
3096
3097 return false;
3098 }
3099
3101 {
3103 }
3104
3105
3107 {
3108 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3109 if (
g_Game.ConfigIsExisting( config_path ) )
3110 {
3111 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3112 }
3113 }
3114
3116 {
3117 return true;
3118 }
3119
3121 {
3122 return true;
3123 }
3124
3126 {
3127 return true;
3128 }
3129
3130
3132 {
3135 }
3136
3138 {
3140 }
3141
3143 {
3145 }
3146
3148 {
3149 int attachment_count = GetInventory().AttachmentCount();
3150 if ( attachment_count > 0 )
3151 {
3152 if (
HasBase() && attachment_count == 1 )
3153 {
3154 return false;
3155 }
3156
3157 return true;
3158 }
3159
3160 return false;
3161 }
3162
3164 {
3165 return true;
3166 }
3167
3169 {
3170 return false;
3171 }
3172
3173
3175 {
3176 return false;
3177 }
3178
3180 {
3181 return false;
3182 }
3183
3184
3186 {
3187 return false;
3188 }
3189
3190
3191
3193 {
3194 return true;
3195 }
3196
3198 {
3199 return true;
3200 }
3201
3204 {
3205 return false;
3206 }
3207
3208
3210 {
3211 return false;
3212 }
3213
3214
3216 {
3217 return true;
3218 }
3219
3220
3222 {
3223 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3224 {
3225 return false;
3226 }
3227
3228 return true;
3229 }
3230
3232 {
3235
3236 return item;
3237 }
3238
3239
3241 {
3243 {
3244
3246
3247
3250
3252 if ( MemoryPointExists( slot_name + "_min" ) )
3253 {
3254 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3255 }
3256 if ( MemoryPointExists( slot_name + "_max" ) )
3257 {
3258 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3259 }
3260
3261
3264
3265
3268 center = ModelToWorld( center );
3269
3270
3273
3274 areaDamage.SetExtents( extents[0], extents[1] );
3275 areaDamage.SetAreaPosition( center );
3279 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3280 areaDamage.SetAmmoName( "BarbedWireHit" );
3281 areaDamage.Spawn();
3282
3284 }
3285 }
3286
3288 {
3289 if ( angle_deg != 0 )
3290 {
3291
3293
3294
3296 if ( MemoryPointExists( "rotate_axis" ) )
3297 {
3298 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3299 }
3300 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];
3301 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];
3302 center[0] = r_center_x;
3303 center[2] = r_center_z;
3304 }
3305 }
3306
3308 {
3310 {
3313 {
3314 if (areaDamage)
3315 {
3316 areaDamage.Destroy();
3317 }
3318
3320 }
3321 }
3322 }
3323
3325 {
3326 return true;
3327 }
3328
3329
3330
3331
3333 {
3335 }
3336
3338 {
3340 }
3341
3343 {
3345 }
3346
3348 {
3350
3351 switch ( material_type )
3352 {
3358 }
3359
3360 return "";
3361 }
3362
3364 {
3366
3367 switch ( material_type )
3368 {
3374 }
3375
3376 return "";
3377 }
3378
3379
3381 {
3383 {
3384
3386 {
3387 SetHealth(slot_name,"Health",item.GetHealth());
3388 }
3389 }
3390 }
3391
3393 {
3394 return 111;
3395 }
3396
3398 {
3399 super.SetActions();
3400
3404 }
3405
3407 {
3409 if (!construction)
3410 return;
3411
3413 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3414 {
3417 {
3419 }
3420 }
3421 }
3422
3424 {
3426 if (!construction)
3427 return;
3428
3430 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3431 {
3434 {
3435 construction.HandleEntityFalling(part.
GetPartName());
3436 }
3437 }
3438 }
3439
3442 {
3444 return;
3445
3448
3449 if (DestroyOnFall())
3450 {
3452 {
3454 }
3455 else
3456 {
3458 {
3460 }
3462 }
3463 }
3464 }
3465
3467 {
3468 if (HasAnyAttachmentsOrCargo())
3469 {
3472 }
3473 }
3474
3475
3476
3477
3478
3481 {
3482 return null;
3483 }
3484
3486 {
3488 }
3489
3491 {
3494
3495 Man p;
3496
3497 #ifdef SERVER
3499 g_Game.GetWorld().GetPlayerList(players);
3500 if (players.Count())
3501 p = players[0];
3502 #else
3504 #endif
3505
3507 {
3508 bool excluded = false;
3510 if (excludes)
3511 {
3512 foreach (string exclude : excludes)
3513 {
3515 {
3516 excluded = true;
3517 break;
3518 }
3519 }
3520 }
3521
3522 if (!excluded)
3523 {
3525 }
3526 }
3527
3529 }
3530
3532
3534 [
Obsolete(
"handled in the Construction component directly")]
3536 {
3537 }
3538
3539 [
Obsolete(
"handled in the Construction component directly")]
3541 {
3542 }
3543
3544 [
Obsolete(
"obsolete debug method")]
3546 {
3547 }
3548}
3549
3551{
3552#ifdef BSB_DEBUG
3554#else
3555
3556#endif
3557}
3559{
3560#ifdef BSB_DEBUG_SPAM
3562#else
3563
3564#endif
3565}
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.