2205{
2207
2209
2211
2218
2219
2220
2226
2232
2234
2238
2239
2241 {
2243
2244
2245 RegisterNetSyncVariableInt( "m_SyncParts01" );
2246 RegisterNetSyncVariableInt( "m_SyncParts02" );
2247 RegisterNetSyncVariableInt( "m_SyncParts03" );
2248 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2249 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2250 RegisterNetSyncVariableBool( "m_HasBase" );
2251
2252
2253 ConstructionInit();
2254
2255 if (ConfigIsExisting("hybridAttachments"))
2256 {
2259 }
2260 if (ConfigIsExisting("mountables"))
2261 {
2264 }
2265
2267 SetAllowDamage(true);
2268 }
2269
2271 {
2272 return "disableBaseDamage";
2273 }
2274
2276 {
2277 return true;
2278 }
2279
2281 {
2282 return EInventoryIconVisibility.HIDE_VICINITY;
2283 }
2284
2286 {
2287 super.InitItemSounds();
2288
2292
2297 }
2298
2300 {
2301 return "putDown_FenceKit_SoundSet";
2302 }
2303
2305 {
2306 return "Shelter_Site_Build_Loop_SoundSet";
2307 }
2308
2309
2311 {
2313 {
2314 SetSynchDirty();
2315 }
2316 }
2317
2319 {
2321 super.OnVariablesSynchronized();
2322
2324 }
2325
2327 {
2328
2330
2331
2333
2334
2336 }
2337
2338
2340 {
2341
2342 int offset;
2343 int mask;
2344
2345 if ( part_id >= 1 && part_id <= 31 )
2346 {
2347 offset = part_id - 1;
2348 mask = 1 << offset;
2349
2351 }
2352 else if ( part_id >= 32 && part_id <= 62 )
2353 {
2354 offset = ( part_id % 32 );
2355 mask = 1 << offset;
2356
2358 }
2359 else if ( part_id >= 63 && part_id <= 93 )
2360 {
2361 offset = ( part_id % 63 );
2362 mask = 1 << offset;
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 return true;
2411 }
2412 }
2413 else if ( part_id >= 32 && part_id <= 62 )
2414 {
2415 offset = ( part_id % 32 );
2416 mask = 1 << offset;
2417
2419 {
2420 return true;
2421 }
2422 }
2423 else if ( part_id >= 63 && part_id <= 93 )
2424 {
2425 offset = ( part_id % 63 );
2426 mask = 1 << offset;
2427
2429 {
2430 return true;
2431 }
2432 }
2433
2434 return false;
2435 }
2436
2438 {
2441 }
2442
2444 {
2445
2448 }
2449
2451 {
2453 {
2456
2457 switch( build_action_id )
2458 {
2462 }
2463 }
2464 }
2465
2466
2468 {
2470 bool is_base = part.
IsBase();
2473 if ( is_part_built_sync )
2474 {
2476 {
2480
2481 if (is_base)
2482 {
2485 }
2486 }
2487 }
2488 else
2489 {
2491 {
2495
2496 if (is_base)
2497 {
2500 }
2501 }
2502 }
2503
2504
2506 }
2507
2508
2510 {
2513
2514 for ( int i = 0; i < construction_parts.Count(); ++i )
2515 {
2516 string key = construction_parts.GetKey( i );
2519 }
2520
2521
2523 }
2524
2526 {
2529
2530 for ( int i = 0; i < construction_parts.Count(); ++i )
2531 {
2532 string key = construction_parts.GetKey( i );
2534
2535 if ( value.
GetId() ==
id )
2536 {
2537 return value;
2538 }
2539 }
2540
2541 return NULL;
2542 }
2543
2544
2545
2547 {
2549 }
2550
2552 {
2554 }
2555
2557 {
2558 return true;
2559 }
2560
2562 {
2563 return false;
2564 }
2565
2566
2568 {
2571 {
2573 }
2574
2575 return construction_kit;
2576 }
2577
2579 {
2582 {
2584 }
2585 }
2586
2588 {
2590 }
2591
2593 {
2594 return "";
2595 }
2596
2598 {
2600 g_Game.ObjectDelete( construction_kit );
2601 }
2602
2603
2605 {
2607 g_Game.ObjectDelete(
this );
2608 }
2609
2610
2612 {
2613 super.EEDelete(parent);
2614
2616 {
2617 areaDamage.Destroy();
2618 }
2619
2620 }
2621
2623 {
2624 super.OnStoreSave( ctx );
2625
2626
2630
2632 }
2633
2635 {
2636 if ( !super.OnStoreLoad( ctx, version ) )
2637 return false;
2638
2639
2640
2642 {
2644 return false;
2645 }
2647 {
2649 return false;
2650 }
2652 {
2654 return false;
2655 }
2656
2657
2659 {
2661 return false;
2662 }
2663
2664
2665 return true;
2666 }
2667
2669 {
2670 super.AfterStoreLoad();
2671
2673 {
2675 }
2676 }
2677
2679 {
2680
2682
2683
2686
2687
2689 }
2690
2692 {
2693 super.OnCreatePhysics();
2694
2695 ConstructionInit();
2697 }
2698
2700 {
2702 return;
2703
2704 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2705 }
2706
2708 {
2710 {
2712 }
2713
2714 super.EEOnAfterLoad();
2715 }
2716
2718 {
2719 super.EEItemAttached( item, slot_name );
2720
2724 }
2725
2727 {
2728 super.EEItemDetached( item, slot_name );
2729
2732 }
2733
2734 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2735 {
2738
2741 }
2742
2743
2745 {
2746 return true;
2747 }
2748
2749
2750
2752 {
2754
2755
2756 if (construtionPart.
IsBase())
2757 {
2759
2760
2762 }
2763
2764
2766
2767
2769
2770
2772
2774
2776
2777
2779
2780
2782 }
2783
2785 {
2786
2788 }
2789
2790
2792 {
2795
2796
2798
2799
2801
2802
2804
2805
2807
2809
2810
2812
2813
2815
2816
2817 if (construtionPart.
IsBase())
2818 {
2819
2821 }
2822 }
2823
2825 {
2826
2828 }
2829
2830
2831 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2832 {
2835
2836
2838
2839
2841
2842
2844
2845
2847
2849
2850
2852
2853
2855
2856
2857 if (construtionPart.
IsBase())
2858 {
2859
2861 }
2862 }
2863
2865 {
2866
2868 }
2869
2870
2872 {
2874
2877 }
2878
2880 {
2882
2884 {
2886 }
2887 else
2888 {
2890 }
2891
2893 }
2894
2896 {
2898
2900 foreach (
string slotName : attachmentSlots)
2901 {
2903 }
2904
2905
2908 else
2910
2912 }
2913
2915 {
2916 string slotNameMounted = slot_name + "_Mounted";
2917 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2918
2919 if (attachment)
2920 {
2921 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2922 if (barbedWire && barbedWire.IsMounted())
2924 else
2926
2927 if (is_locked)
2928 {
2929 SetAnimationPhase(slotNameMounted, 0);
2930 SetAnimationPhase(slot_name, 1);
2931 }
2932 else
2933 {
2934 SetAnimationPhase(slotNameMounted, 1);
2935 SetAnimationPhase(slot_name, 0);
2936 }
2937 }
2938 else
2939 {
2940 SetAnimationPhase(slotNameMounted, 1);
2941 SetAnimationPhase(slot_name, 1);
2942
2944 }
2945 }
2946
2947
2949 {
2952
2955
2958
2959 foreach (
string slotName : attachmentSlots)
2960 {
2962 }
2963
2964
2966 {
2969
2971 }
2972 else
2973 {
2976
2978 }
2979
2982 }
2983
2985 {
2986
2988 return;
2989
2990 string slot_name_mounted = slot_name + "_Mounted";
2991 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2992
2993
2995 RemoveProxyPhysics( slot_name_mounted );
2996 RemoveProxyPhysics( slot_name );
2997
2998 if ( attachment )
2999 {
3001 if ( is_locked )
3002 {
3004 AddProxyPhysics( slot_name_mounted );
3005 }
3006 else
3007 {
3009 AddProxyPhysics( slot_name );
3010 }
3011 }
3012 }
3013
3015 {
3016 SetAffectPathgraph( true, false );
3018 }
3019
3021 {
3022 return true;
3023 }
3024
3026 {
3027 return true;
3028 }
3029
3031 {
3032 if ( attachment )
3033 {
3035 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3036
3037 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3038 }
3039
3040 return false;
3041 }
3042
3044 {
3046 }
3047
3048
3050 {
3051 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3052 if (
g_Game.ConfigIsExisting( config_path ) )
3053 {
3054 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3055 }
3056 }
3057
3059 {
3060 return true;
3061 }
3062
3064 {
3065 return true;
3066 }
3067
3069 {
3070 return true;
3071 }
3072
3073
3075 {
3078 }
3079
3081 {
3083 }
3084
3086 {
3088 }
3089
3091 {
3092 int attachment_count = GetInventory().AttachmentCount();
3093 if ( attachment_count > 0 )
3094 {
3095 if (
HasBase() && attachment_count == 1 )
3096 {
3097 return false;
3098 }
3099
3100 return true;
3101 }
3102
3103 return false;
3104 }
3105
3107 {
3108 return true;
3109 }
3110
3112 {
3113 return false;
3114 }
3115
3116
3118 {
3119 return false;
3120 }
3121
3123 {
3124 return false;
3125 }
3126
3127
3129 {
3130 return false;
3131 }
3132
3133
3134
3136 {
3137 return true;
3138 }
3139
3141 {
3142 return true;
3143 }
3144
3147 {
3148 return false;
3149 }
3150
3151
3153 {
3154 return false;
3155 }
3156
3157
3159 {
3160 return true;
3161 }
3162
3163
3165 {
3166 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3167 {
3168 return false;
3169 }
3170
3171 return true;
3172 }
3173
3175 {
3178
3179 return item;
3180 }
3181
3182
3184 {
3186 {
3187
3189
3190
3193
3195 if ( MemoryPointExists( slot_name + "_min" ) )
3196 {
3197 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3198 }
3199 if ( MemoryPointExists( slot_name + "_max" ) )
3200 {
3201 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3202 }
3203
3204
3207
3208
3211 center = ModelToWorld( center );
3212
3213
3216
3217 areaDamage.SetExtents( extents[0], extents[1] );
3218 areaDamage.SetAreaPosition( center );
3222 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3223 areaDamage.SetAmmoName( "BarbedWireHit" );
3224 areaDamage.Spawn();
3225
3227 }
3228 }
3229
3231 {
3232 if ( angle_deg != 0 )
3233 {
3234
3236
3237
3239 if ( MemoryPointExists( "rotate_axis" ) )
3240 {
3241 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3242 }
3243 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];
3244 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];
3245 center[0] = r_center_x;
3246 center[2] = r_center_z;
3247 }
3248 }
3249
3251 {
3253 {
3256 {
3257 if (areaDamage)
3258 {
3259 areaDamage.Destroy();
3260 }
3261
3263 }
3264 }
3265 }
3266
3268 {
3269 return true;
3270 }
3271
3272
3273
3274
3276 {
3278 }
3279
3281 {
3283 }
3284
3286 {
3288 }
3289
3291 {
3293
3294 switch ( material_type )
3295 {
3301 }
3302
3303 return "";
3304 }
3305
3307 {
3309
3310 switch ( material_type )
3311 {
3317 }
3318
3319 return "";
3320 }
3321
3322
3324 {
3326 {
3327
3329 {
3330 SetHealth(slot_name,"Health",item.GetHealth());
3331 }
3332 }
3333 }
3334
3336 {
3337 return 111;
3338 }
3339
3341 {
3342 super.SetActions();
3343
3347 }
3348
3350 {
3352 if (!construction)
3353 return;
3354
3356 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3357 {
3360 {
3362 }
3363 }
3364 }
3365
3367 {
3369 if (!construction)
3370 return;
3371
3373 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3374 {
3377 {
3378 construction.HandleEntityFalling(part.
GetPartName());
3379 }
3380 }
3381 }
3382
3385 {
3387 return;
3388
3391
3392 if (DestroyOnFall())
3393 {
3395 {
3397 }
3398 else
3399 {
3401 {
3403 }
3405 }
3406 }
3407 }
3408
3410 {
3411 if (HasAnyAttachmentsOrCargo())
3412 {
3415 }
3416 }
3417
3418
3419
3420
3421
3424 {
3425 return null;
3426 }
3427
3429 {
3431 }
3432
3434 {
3437
3438 Man p;
3439
3440 #ifdef SERVER
3442 g_Game.GetWorld().GetPlayerList(players);
3443 if (players.Count())
3444 p = players[0];
3445 #else
3447 #endif
3448
3450 {
3451 bool excluded = false;
3453 if (excludes)
3454 {
3455 foreach (string exclude : excludes)
3456 {
3458 {
3459 excluded = true;
3460 break;
3461 }
3462 }
3463 }
3464
3465 if (!excluded)
3466 {
3468 }
3469 }
3470
3472 }
3473
3475
3477 [
Obsolete(
"handled in the Construction component directly")]
3479 {
3480 }
3481
3482 [
Obsolete(
"handled in the Construction component directly")]
3484 {
3485 }
3486
3487 [
Obsolete(
"obsolete debug method")]
3489 {
3490 }
3491}
3492
3494{
3495#ifdef BSB_DEBUG
3497#else
3498
3499#endif
3500}
3502{
3503#ifdef BSB_DEBUG_SPAM
3505#else
3506
3507#endif
3508}
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.