2210{
2212
2214
2216
2223
2224
2225
2231
2237
2239
2243
2244
2246 {
2248
2249
2250 RegisterNetSyncVariableInt( "m_SyncParts01" );
2251 RegisterNetSyncVariableInt( "m_SyncParts02" );
2252 RegisterNetSyncVariableInt( "m_SyncParts03" );
2253 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2254 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2255 RegisterNetSyncVariableBool( "m_HasBase" );
2256
2257
2258 ConstructionInit();
2259
2260 if (ConfigIsExisting("hybridAttachments"))
2261 {
2264 }
2265 if (ConfigIsExisting("mountables"))
2266 {
2269 }
2270
2272 SetAllowDamage(true);
2273 }
2274
2276 {
2277 return "disableBaseDamage";
2278 }
2279
2281 {
2282 return true;
2283 }
2284
2286 {
2287 return EInventoryIconVisibility.HIDE_VICINITY;
2288 }
2289
2291 {
2292 super.InitItemSounds();
2293
2297
2302 }
2303
2305 {
2306 return "putDown_FenceKit_SoundSet";
2307 }
2308
2310 {
2311 return "Shelter_Site_Build_Loop_SoundSet";
2312 }
2313
2314
2316 {
2318 {
2319 SetSynchDirty();
2320 }
2321 }
2322
2324 {
2326 super.OnVariablesSynchronized();
2327
2329 }
2330
2332 {
2333
2335
2336
2338
2339
2341 }
2342
2343
2345 {
2346
2347 int offset;
2348 int mask;
2349
2350 if ( part_id >= 1 && part_id <= 31 )
2351 {
2352 offset = part_id - 1;
2353 mask = 1 << offset;
2354
2356 }
2357 else if ( part_id >= 32 && part_id <= 62 )
2358 {
2359 offset = ( part_id % 32 );
2360 mask = 1 << offset;
2361
2363 }
2364 else if ( part_id >= 63 && part_id <= 93 )
2365 {
2366 offset = ( part_id % 63 );
2367 mask = 1 << offset;
2368
2370 }
2371 }
2372
2374 {
2375
2376 int offset;
2377 int mask;
2378
2379 if ( part_id >= 1 && part_id <= 31 )
2380 {
2381 offset = part_id - 1;
2382 mask = 1 << offset;
2383
2385 }
2386 else if ( part_id >= 32 && part_id <= 62 )
2387 {
2388 offset = ( part_id % 32 );
2389 mask = 1 << offset;
2390
2392 }
2393 else if ( part_id >= 63 && part_id <= 93 )
2394 {
2395 offset = ( part_id % 63 );
2396 mask = 1 << offset;
2397
2399 }
2400 }
2401
2403 {
2404
2405 int offset;
2406 int mask;
2407
2408 if ( part_id >= 1 && part_id <= 31 )
2409 {
2410 offset = part_id - 1;
2411 mask = 1 << offset;
2412
2414 {
2415 return true;
2416 }
2417 }
2418 else if ( part_id >= 32 && part_id <= 62 )
2419 {
2420 offset = ( part_id % 32 );
2421 mask = 1 << offset;
2422
2424 {
2425 return true;
2426 }
2427 }
2428 else if ( part_id >= 63 && part_id <= 93 )
2429 {
2430 offset = ( part_id % 63 );
2431 mask = 1 << offset;
2432
2434 {
2435 return true;
2436 }
2437 }
2438
2439 return false;
2440 }
2441
2443 {
2446 }
2447
2449 {
2450
2453 }
2454
2456 {
2458 {
2461
2462 switch( build_action_id )
2463 {
2467 }
2468 }
2469 }
2470
2471
2473 {
2475 bool is_base = part.
IsBase();
2478 if ( is_part_built_sync )
2479 {
2481 {
2485
2486 if (is_base)
2487 {
2490 }
2491 }
2492 }
2493 else
2494 {
2496 {
2500
2501 if (is_base)
2502 {
2505 }
2506 }
2507 }
2508
2509
2511 }
2512
2513
2515 {
2518
2519 for ( int i = 0; i < construction_parts.Count(); ++i )
2520 {
2521 string key = construction_parts.GetKey( i );
2524 }
2525
2526
2528 }
2529
2531 {
2534
2535 for ( int i = 0; i < construction_parts.Count(); ++i )
2536 {
2537 string key = construction_parts.GetKey( i );
2539
2540 if ( value.
GetId() ==
id )
2541 {
2542 return value;
2543 }
2544 }
2545
2546 return NULL;
2547 }
2548
2549
2550
2552 {
2554 }
2555
2557 {
2559 }
2560
2562 {
2563 return true;
2564 }
2565
2567 {
2568 return false;
2569 }
2570
2571
2573 {
2576 {
2578 }
2579
2580 return construction_kit;
2581 }
2582
2584 {
2587 {
2589 }
2590 }
2591
2593 {
2595 }
2596
2598 {
2599 return "";
2600 }
2601
2603 {
2605 g_Game.ObjectDelete( construction_kit );
2606 }
2607
2608
2610 {
2612 g_Game.ObjectDelete(
this );
2613 }
2614
2615
2617 {
2618 super.EEDelete(parent);
2619
2621 {
2622 areaDamage.Destroy();
2623 }
2624
2625 }
2626
2628 {
2629 super.OnStoreSave( ctx );
2630
2631
2635
2637 }
2638
2640 {
2641 if ( !super.OnStoreLoad( ctx, version ) )
2642 return false;
2643
2644
2645
2647 {
2649 return false;
2650 }
2652 {
2654 return false;
2655 }
2657 {
2659 return false;
2660 }
2661
2662
2664 {
2666 return false;
2667 }
2668
2669
2670 return true;
2671 }
2672
2674 {
2675 super.AfterStoreLoad();
2676
2678 {
2680 }
2681 }
2682
2684 {
2685
2687
2688
2691
2692
2694 }
2695
2697 {
2698 super.OnCreatePhysics();
2699
2700 ConstructionInit();
2702 }
2703
2705 {
2707 return;
2708
2709 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2710 }
2711
2713 {
2715 {
2717 }
2718
2719 super.EEOnAfterLoad();
2720 }
2721
2723 {
2724 super.EEItemAttached( item, slot_name );
2725
2729 }
2730
2732 {
2733 super.EEItemDetached( item, slot_name );
2734
2737 }
2738
2739 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2740 {
2743
2746 }
2747
2748
2750 {
2751 return true;
2752 }
2753
2754
2755
2757 {
2759
2760
2761 if (construtionPart.
IsBase())
2762 {
2764
2765
2767 }
2768
2769
2771
2772
2774
2775
2777
2779
2781
2782
2784
2785
2787 }
2788
2790 {
2791
2793 }
2794
2795
2797 {
2800
2801
2803
2804
2806
2807
2809
2810
2812
2814
2815
2817
2818
2820
2821
2822 if (construtionPart.
IsBase())
2823 {
2824
2826 }
2827 }
2828
2830 {
2831
2833 }
2834
2835
2836 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2837 {
2840
2841
2843
2844
2846
2847
2849
2850
2852
2854
2855
2857
2858
2860
2861
2862 if (construtionPart.
IsBase())
2863 {
2864
2866 }
2867 }
2868
2870 {
2871
2873 }
2874
2875
2877 {
2879
2882 }
2883
2885 {
2887
2889 {
2891 }
2892 else
2893 {
2895 }
2896
2898 }
2899
2901 {
2903
2905 foreach (
string slotName : attachmentSlots)
2906 {
2908 }
2909
2910
2913 else
2915
2917 }
2918
2920 {
2921 string slotNameMounted = slot_name + "_Mounted";
2922 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2923
2924 if (attachment)
2925 {
2926 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2927 if (barbedWire && barbedWire.IsMounted())
2929 else
2931
2932 if (is_locked)
2933 {
2934 SetAnimationPhase(slotNameMounted, 0);
2935 SetAnimationPhase(slot_name, 1);
2936 }
2937 else
2938 {
2939 SetAnimationPhase(slotNameMounted, 1);
2940 SetAnimationPhase(slot_name, 0);
2941 }
2942 }
2943 else
2944 {
2945 SetAnimationPhase(slotNameMounted, 1);
2946 SetAnimationPhase(slot_name, 1);
2947
2949 }
2950 }
2951
2952
2954 {
2957
2960
2963
2964 foreach (
string slotName : attachmentSlots)
2965 {
2967 }
2968
2969
2971 {
2974
2976 }
2977 else
2978 {
2981
2983 }
2984
2987 }
2988
2990 {
2991
2993 return;
2994
2995 string slot_name_mounted = slot_name + "_Mounted";
2996 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2997
2998
3000 RemoveProxyPhysics( slot_name_mounted );
3001 RemoveProxyPhysics( slot_name );
3002
3003 if ( attachment )
3004 {
3006 if ( is_locked )
3007 {
3009 AddProxyPhysics( slot_name_mounted );
3010 }
3011 else
3012 {
3014 AddProxyPhysics( slot_name );
3015 }
3016 }
3017 }
3018
3020 {
3021 SetAffectPathgraph( true, false );
3023 }
3024
3026 {
3027 return true;
3028 }
3029
3031 {
3032 return true;
3033 }
3034
3036 {
3037 if ( attachment )
3038 {
3040 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3041
3042 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3043 }
3044
3045 return false;
3046 }
3047
3049 {
3051 }
3052
3053
3055 {
3056 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3057 if (
g_Game.ConfigIsExisting( config_path ) )
3058 {
3059 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3060 }
3061 }
3062
3064 {
3065 return true;
3066 }
3067
3069 {
3070 return true;
3071 }
3072
3074 {
3075 return true;
3076 }
3077
3078
3080 {
3083 }
3084
3086 {
3088 }
3089
3091 {
3093 }
3094
3096 {
3097 int attachment_count = GetInventory().AttachmentCount();
3098 if ( attachment_count > 0 )
3099 {
3100 if (
HasBase() && attachment_count == 1 )
3101 {
3102 return false;
3103 }
3104
3105 return true;
3106 }
3107
3108 return false;
3109 }
3110
3112 {
3113 return true;
3114 }
3115
3117 {
3118 return false;
3119 }
3120
3121
3123 {
3124 return false;
3125 }
3126
3128 {
3129 return false;
3130 }
3131
3132
3134 {
3135 return false;
3136 }
3137
3138
3139
3141 {
3142 return true;
3143 }
3144
3146 {
3147 return true;
3148 }
3149
3152 {
3153 return false;
3154 }
3155
3156
3158 {
3159 return false;
3160 }
3161
3162
3164 {
3165 return true;
3166 }
3167
3168
3170 {
3171 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3172 {
3173 return false;
3174 }
3175
3176 return true;
3177 }
3178
3180 {
3183
3184 return item;
3185 }
3186
3187
3189 {
3191 {
3192
3194
3195
3198
3200 if ( MemoryPointExists( slot_name + "_min" ) )
3201 {
3202 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3203 }
3204 if ( MemoryPointExists( slot_name + "_max" ) )
3205 {
3206 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3207 }
3208
3209
3212
3213
3216 center = ModelToWorld( center );
3217
3218
3221
3222 areaDamage.SetExtents( extents[0], extents[1] );
3223 areaDamage.SetAreaPosition( center );
3227 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3228 areaDamage.SetAmmoName( "BarbedWireHit" );
3229 areaDamage.Spawn();
3230
3232 }
3233 }
3234
3236 {
3237 if ( angle_deg != 0 )
3238 {
3239
3241
3242
3244 if ( MemoryPointExists( "rotate_axis" ) )
3245 {
3246 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3247 }
3248 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];
3249 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];
3250 center[0] = r_center_x;
3251 center[2] = r_center_z;
3252 }
3253 }
3254
3256 {
3258 {
3261 {
3262 if (areaDamage)
3263 {
3264 areaDamage.Destroy();
3265 }
3266
3268 }
3269 }
3270 }
3271
3273 {
3274 return true;
3275 }
3276
3277
3278
3279
3281 {
3283 }
3284
3286 {
3288 }
3289
3291 {
3293 }
3294
3296 {
3298
3299 switch ( material_type )
3300 {
3306 }
3307
3308 return "";
3309 }
3310
3312 {
3314
3315 switch ( material_type )
3316 {
3322 }
3323
3324 return "";
3325 }
3326
3327
3329 {
3331 {
3332
3334 {
3335 SetHealth(slot_name,"Health",item.GetHealth());
3336 }
3337 }
3338 }
3339
3341 {
3342 return 111;
3343 }
3344
3346 {
3347 super.SetActions();
3348
3352 }
3353
3355 {
3357 if (!construction)
3358 return;
3359
3361 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3362 {
3365 {
3367 }
3368 }
3369 }
3370
3372 {
3374 if (!construction)
3375 return;
3376
3378 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3379 {
3382 {
3383 construction.HandleEntityFalling(part.
GetPartName());
3384 }
3385 }
3386 }
3387
3390 {
3392 return;
3393
3396
3397 if (DestroyOnFall())
3398 {
3400 {
3402 }
3403 else
3404 {
3406 {
3408 }
3410 }
3411 }
3412 }
3413
3415 {
3416 if (HasAnyAttachmentsOrCargo())
3417 {
3420 }
3421 }
3422
3423
3424
3425
3426
3429 {
3430 return null;
3431 }
3432
3434 {
3436 }
3437
3439 {
3442
3443 Man p;
3444
3445 #ifdef SERVER
3447 g_Game.GetWorld().GetPlayerList(players);
3448 if (players.Count())
3449 p = players[0];
3450 #else
3452 #endif
3453
3455 {
3456 bool excluded = false;
3458 if (excludes)
3459 {
3460 foreach (string exclude : excludes)
3461 {
3463 {
3464 excluded = true;
3465 break;
3466 }
3467 }
3468 }
3469
3470 if (!excluded)
3471 {
3473 }
3474 }
3475
3477 }
3478
3480
3482 [
Obsolete(
"handled in the Construction component directly")]
3484 {
3485 }
3486
3487 [
Obsolete(
"handled in the Construction component directly")]
3489 {
3490 }
3491
3492 [
Obsolete(
"obsolete debug method")]
3494 {
3495 }
3496}
3497
3499{
3500#ifdef BSB_DEBUG
3502#else
3503
3504#endif
3505}
3507{
3508#ifdef BSB_DEBUG_SPAM
3510#else
3511
3512#endif
3513}
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.