Some buildings can only be built from outside.
2234{
2236
2238
2240
2247
2248
2249
2255
2261
2263
2267
2268
2270 {
2272
2273
2274 RegisterNetSyncVariableInt( "m_SyncParts01" );
2275 RegisterNetSyncVariableInt( "m_SyncParts02" );
2276 RegisterNetSyncVariableInt( "m_SyncParts03" );
2277 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2278 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2279 RegisterNetSyncVariableBool( "m_HasBase" );
2280
2281
2282 ConstructionInit();
2283
2284 if (ConfigIsExisting("hybridAttachments"))
2285 {
2288 }
2289 if (ConfigIsExisting("mountables"))
2290 {
2293 }
2294
2296 SetAllowDamage(true);
2297 }
2298
2300 {
2301 return "disableBaseDamage";
2302 }
2303
2305 {
2306 return true;
2307 }
2308
2310 {
2311 return EInventoryIconVisibility.HIDE_VICINITY;
2312 }
2313
2315 {
2316 super.InitItemSounds();
2317
2321
2326 }
2327
2329 {
2330 return "putDown_FenceKit_SoundSet";
2331 }
2332
2334 {
2335 return "Shelter_Site_Build_Loop_SoundSet";
2336 }
2337
2338
2340 {
2342 {
2343 SetSynchDirty();
2344 }
2345 }
2346
2348 {
2350 super.OnVariablesSynchronized();
2351
2353 }
2354
2356 {
2357
2359
2360
2362
2363
2365 }
2366
2367
2369 {
2370
2371 int offset;
2372 int mask;
2373
2374 if ( part_id >= 1 && part_id <= 31 )
2375 {
2376 offset = part_id - 1;
2377 mask = 1 << offset;
2378
2380 }
2381 else if ( part_id >= 32 && part_id <= 62 )
2382 {
2383 offset = ( part_id % 32 );
2384 mask = 1 << offset;
2385
2387 }
2388 else if ( part_id >= 63 && part_id <= 93 )
2389 {
2390 offset = ( part_id % 63 );
2391 mask = 1 << offset;
2392
2394 }
2395 }
2396
2398 {
2399
2400 int offset;
2401 int mask;
2402
2403 if ( part_id >= 1 && part_id <= 31 )
2404 {
2405 offset = part_id - 1;
2406 mask = 1 << offset;
2407
2409 }
2410 else if ( part_id >= 32 && part_id <= 62 )
2411 {
2412 offset = ( part_id % 32 );
2413 mask = 1 << offset;
2414
2416 }
2417 else if ( part_id >= 63 && part_id <= 93 )
2418 {
2419 offset = ( part_id % 63 );
2420 mask = 1 << offset;
2421
2423 }
2424 }
2425
2427 {
2428
2429 int offset;
2430 int mask;
2431
2432 if ( part_id >= 1 && part_id <= 31 )
2433 {
2434 offset = part_id - 1;
2435 mask = 1 << offset;
2436
2438 {
2439 return true;
2440 }
2441 }
2442 else if ( part_id >= 32 && part_id <= 62 )
2443 {
2444 offset = ( part_id % 32 );
2445 mask = 1 << offset;
2446
2448 {
2449 return true;
2450 }
2451 }
2452 else if ( part_id >= 63 && part_id <= 93 )
2453 {
2454 offset = ( part_id % 63 );
2455 mask = 1 << offset;
2456
2458 {
2459 return true;
2460 }
2461 }
2462
2463 return false;
2464 }
2465
2467 {
2470 }
2471
2473 {
2474
2477 }
2478
2480 {
2482 {
2485
2486 switch( build_action_id )
2487 {
2491 }
2492 }
2493 }
2494
2495
2497 {
2499 bool is_base = part.
IsBase();
2502 if ( is_part_built_sync )
2503 {
2505 {
2509
2510 if (is_base)
2511 {
2514 }
2515 }
2516 }
2517 else
2518 {
2520 {
2524
2525 if (is_base)
2526 {
2529 }
2530 }
2531 }
2532
2533
2535 }
2536
2537
2539 {
2542
2543 for ( int i = 0; i < construction_parts.Count(); ++i )
2544 {
2545 string key = construction_parts.GetKey( i );
2548 }
2549
2550
2552 }
2553
2555 {
2558
2559 for ( int i = 0; i < construction_parts.Count(); ++i )
2560 {
2561 string key = construction_parts.GetKey( i );
2563
2564 if ( value.
GetId() ==
id )
2565 {
2566 return value;
2567 }
2568 }
2569
2570 return NULL;
2571 }
2572
2573
2574
2576 {
2578 }
2579
2581 {
2583 }
2584
2586 {
2587 return true;
2588 }
2589
2591 {
2592 return false;
2593 }
2594
2595
2597 {
2600 {
2602 }
2603
2604 return construction_kit;
2605 }
2606
2608 {
2611 {
2613 }
2614 }
2615
2617 {
2619 }
2620
2622 {
2623 return "";
2624 }
2625
2627 {
2629 g_Game.ObjectDelete( construction_kit );
2630 }
2631
2632
2634 {
2636 g_Game.ObjectDelete(
this );
2637 }
2638
2639
2641 {
2642 super.EEDelete(parent);
2643
2645 {
2646 areaDamage.Destroy();
2647 }
2648
2649 }
2650
2652 {
2653 super.OnStoreSave( ctx );
2654
2655
2659
2661 }
2662
2664 {
2665 if ( !super.OnStoreLoad( ctx, version ) )
2666 return false;
2667
2668
2669
2671 {
2673 return false;
2674 }
2676 {
2678 return false;
2679 }
2681 {
2683 return false;
2684 }
2685
2686
2688 {
2690 return false;
2691 }
2692
2693
2694 return true;
2695 }
2696
2698 {
2699 super.AfterStoreLoad();
2700
2702 {
2704 }
2705 }
2706
2708 {
2709
2711
2712
2715
2716
2718 }
2719
2721 {
2722 super.OnCreatePhysics();
2723
2724 ConstructionInit();
2726 }
2727
2729 {
2731 return;
2732
2733 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2734 }
2735
2737 {
2739 {
2741 }
2742
2743 super.EEOnAfterLoad();
2744 }
2745
2747 {
2748 super.EEItemAttached( item, slot_name );
2749
2753 }
2754
2756 {
2757 super.EEItemDetached( item, slot_name );
2758
2761 }
2762
2763 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2764 {
2767
2770 }
2771
2772
2774 {
2775 return true;
2776 }
2777
2778
2779
2781 {
2783
2784
2785 if (construtionPart.
IsBase())
2786 {
2788
2789
2791 }
2792
2793
2795
2796
2798
2799
2801
2803
2805
2806
2808
2809
2811 }
2812
2814 {
2815
2817 }
2818
2819
2821 {
2824
2825
2827
2828
2830
2831
2833
2834
2836
2838
2839
2841
2842
2844
2845
2846 if (construtionPart.
IsBase())
2847 {
2848
2850 }
2851 }
2852
2854 {
2855
2857 }
2858
2859
2860 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2861 {
2864
2865
2867
2868
2870
2871
2873
2874
2876
2878
2879
2881
2882
2884
2885
2886 if (construtionPart.
IsBase())
2887 {
2888
2890 }
2891 }
2892
2894 {
2895
2897 }
2898
2899
2901 {
2903
2906 }
2907
2909 {
2911
2913 {
2915 }
2916 else
2917 {
2919 }
2920
2922 }
2923
2925 {
2927
2929 foreach (
string slotName : attachmentSlots)
2930 {
2932 }
2933
2934
2937 else
2939
2941 }
2942
2944 {
2945 string slotNameMounted = slot_name + "_Mounted";
2946 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2947
2948 if (attachment)
2949 {
2950 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2951 if (barbedWire && barbedWire.IsMounted())
2953 else
2955
2956 if (is_locked)
2957 {
2958 SetAnimationPhase(slotNameMounted, 0);
2959 SetAnimationPhase(slot_name, 1);
2960 }
2961 else
2962 {
2963 SetAnimationPhase(slotNameMounted, 1);
2964 SetAnimationPhase(slot_name, 0);
2965 }
2966 }
2967 else
2968 {
2969 SetAnimationPhase(slotNameMounted, 1);
2970 SetAnimationPhase(slot_name, 1);
2971
2973 }
2974 }
2975
2976
2978 {
2981
2984
2987
2988 foreach (
string slotName : attachmentSlots)
2989 {
2991 }
2992
2993
2995 {
2998
3000 }
3001 else
3002 {
3005
3007 }
3008
3011 }
3012
3014 {
3015
3017 return;
3018
3019 string slot_name_mounted = slot_name + "_Mounted";
3020 EntityAI attachment = FindAttachmentBySlotName( slot_name );
3021
3022
3024 RemoveProxyPhysics( slot_name_mounted );
3025 RemoveProxyPhysics( slot_name );
3026
3027 if ( attachment )
3028 {
3030 if ( is_locked )
3031 {
3033 AddProxyPhysics( slot_name_mounted );
3034 }
3035 else
3036 {
3038 AddProxyPhysics( slot_name );
3039 }
3040 }
3041 }
3042
3044 {
3045 SetAffectPathgraph( true, false );
3047 }
3048
3050 {
3051 return true;
3052 }
3053
3055 {
3056 return true;
3057 }
3058
3060 {
3061 if ( attachment )
3062 {
3064 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3065
3066 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3067 }
3068
3069 return false;
3070 }
3071
3073 {
3075 }
3076
3077
3079 {
3080 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3081 if (
g_Game.ConfigIsExisting( config_path ) )
3082 {
3083 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3084 }
3085 }
3086
3088 {
3089 return true;
3090 }
3091
3093 {
3094 return true;
3095 }
3096
3098 {
3099 return true;
3100 }
3101
3102
3104 {
3107 }
3108
3110 {
3112 }
3113
3115 {
3117 }
3118
3120 {
3121 int attachment_count = GetInventory().AttachmentCount();
3122 if ( attachment_count > 0 )
3123 {
3124 if (
HasBase() && attachment_count == 1 )
3125 {
3126 return false;
3127 }
3128
3129 return true;
3130 }
3131
3132 return false;
3133 }
3134
3136 {
3137 return true;
3138 }
3139
3141 {
3142 return false;
3143 }
3144
3145
3147 {
3148 return false;
3149 }
3150
3152 {
3153 return false;
3154 }
3155
3156
3158 {
3159 return false;
3160 }
3161
3162
3163
3165 {
3166 return true;
3167 }
3168
3170 {
3171 return true;
3172 }
3173
3176 {
3177 return false;
3178 }
3179
3180
3182 {
3183 return false;
3184 }
3185
3186
3188 {
3189 return true;
3190 }
3191
3192
3194 {
3195 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3196 {
3197 return false;
3198 }
3199
3200 return true;
3201 }
3202
3204 {
3207
3208 return item;
3209 }
3210
3211
3213 {
3215 {
3216
3218
3219
3222
3224 if ( MemoryPointExists( slot_name + "_min" ) )
3225 {
3226 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3227 }
3228 if ( MemoryPointExists( slot_name + "_max" ) )
3229 {
3230 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3231 }
3232
3233
3236
3237
3240 center = ModelToWorld( center );
3241
3242
3245
3246 areaDamage.SetExtents( extents[0], extents[1] );
3247 areaDamage.SetAreaPosition( center );
3251 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3252 areaDamage.SetAmmoName( "BarbedWireHit" );
3253 areaDamage.Spawn();
3254
3256 }
3257 }
3258
3260 {
3261 if ( angle_deg != 0 )
3262 {
3263
3265
3266
3268 if ( MemoryPointExists( "rotate_axis" ) )
3269 {
3270 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3271 }
3272 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];
3273 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];
3274 center[0] = r_center_x;
3275 center[2] = r_center_z;
3276 }
3277 }
3278
3280 {
3282 {
3285 {
3286 if (areaDamage)
3287 {
3288 areaDamage.Destroy();
3289 }
3290
3292 }
3293 }
3294 }
3295
3297 {
3298 return true;
3299 }
3300
3301
3302
3303
3305 {
3307 }
3308
3310 {
3312 }
3313
3315 {
3317 }
3318
3320 {
3322
3323 switch ( material_type )
3324 {
3330 }
3331
3332 return "";
3333 }
3334
3336 {
3338
3339 switch ( material_type )
3340 {
3346 }
3347
3348 return "";
3349 }
3350
3351
3353 {
3355 {
3356
3358 {
3359 SetHealth(slot_name,"Health",item.GetHealth());
3360 }
3361 }
3362 }
3363
3365 {
3366 return 111;
3367 }
3368
3370 {
3371 super.SetActions();
3372
3376 }
3377
3379 {
3381 if (!construction)
3382 return;
3383
3385 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3386 {
3389 {
3391 }
3392 }
3393 }
3394
3396 {
3398 if (!construction)
3399 return;
3400
3402 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3403 {
3406 {
3407 construction.HandleEntityFalling(part.
GetPartName());
3408 }
3409 }
3410 }
3411
3414 {
3416 return;
3417
3420
3421 if (DestroyOnFall())
3422 {
3424 {
3426 }
3427 else
3428 {
3430 {
3432 }
3434 }
3435 }
3436 }
3437
3439 {
3440 if (HasAnyAttachmentsOrCargo())
3441 {
3444 }
3445 }
3446
3447
3448
3449
3450
3453 {
3454 return null;
3455 }
3456
3458 {
3460 }
3461
3463 {
3466
3467 Man p;
3468
3469 #ifdef SERVER
3471 g_Game.GetWorld().GetPlayerList(players);
3472 if (players.Count())
3473 p = players[0];
3474 #else
3476 #endif
3477
3479 {
3480 bool excluded = false;
3482 if (excludes)
3483 {
3484 foreach (string exclude : excludes)
3485 {
3487 {
3488 excluded = true;
3489 break;
3490 }
3491 }
3492 }
3493
3494 if (!excluded)
3495 {
3497 }
3498 }
3499
3501 }
3502
3504
3506 [
Obsolete(
"handled in the Construction component directly")]
3508 {
3509 }
3510
3511 [
Obsolete(
"handled in the Construction component directly")]
3513 {
3514 }
3515
3516 [
Obsolete(
"obsolete debug method")]
3518 {
3519 }
3520}
3521
3523{
3524#ifdef BSB_DEBUG
3526#else
3527
3528#endif
3529}
3531{
3532#ifdef BSB_DEBUG_SPAM
3534#else
3535
3536#endif
3537}
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.