2173{
2175
2177
2179
2186
2187
2188
2194
2200
2202
2206
2207
2209 {
2211
2212
2213 RegisterNetSyncVariableInt( "m_SyncParts01" );
2214 RegisterNetSyncVariableInt( "m_SyncParts02" );
2215 RegisterNetSyncVariableInt( "m_SyncParts03" );
2216 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2217 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2218 RegisterNetSyncVariableBool( "m_HasBase" );
2219
2220
2221 ConstructionInit();
2222
2223 if (ConfigIsExisting("hybridAttachments"))
2224 {
2227 }
2228 if (ConfigIsExisting("mountables"))
2229 {
2232 }
2233
2235 SetAllowDamage(true);
2236 }
2237
2239 {
2240 return "disableBaseDamage";
2241 }
2242
2244 {
2245 return true;
2246 }
2247
2249 {
2250 return EInventoryIconVisibility.HIDE_VICINITY;
2251 }
2252
2254 {
2255 super.InitItemSounds();
2256
2260
2265 }
2266
2268 {
2269 return "putDown_FenceKit_SoundSet";
2270 }
2271
2273 {
2274 return "Shelter_Site_Build_Loop_SoundSet";
2275 }
2276
2277
2279 {
2281 {
2282 SetSynchDirty();
2283 }
2284 }
2285
2287 {
2289 super.OnVariablesSynchronized();
2290
2292 }
2293
2295 {
2296
2298
2299
2301
2302
2304 }
2305
2306
2308 {
2309
2310 int offset;
2311 int mask;
2312
2313 if ( part_id >= 1 && part_id <= 31 )
2314 {
2315 offset = part_id - 1;
2316 mask = 1 << offset;
2317
2319 }
2320 else if ( part_id >= 32 && part_id <= 62 )
2321 {
2322 offset = ( part_id % 32 );
2323 mask = 1 << offset;
2324
2326 }
2327 else if ( part_id >= 63 && part_id <= 93 )
2328 {
2329 offset = ( part_id % 63 );
2330 mask = 1 << offset;
2331
2333 }
2334 }
2335
2337 {
2338
2339 int offset;
2340 int mask;
2341
2342 if ( part_id >= 1 && part_id <= 31 )
2343 {
2344 offset = part_id - 1;
2345 mask = 1 << offset;
2346
2348 }
2349 else if ( part_id >= 32 && part_id <= 62 )
2350 {
2351 offset = ( part_id % 32 );
2352 mask = 1 << offset;
2353
2355 }
2356 else if ( part_id >= 63 && part_id <= 93 )
2357 {
2358 offset = ( part_id % 63 );
2359 mask = 1 << offset;
2360
2362 }
2363 }
2364
2366 {
2367
2368 int offset;
2369 int mask;
2370
2371 if ( part_id >= 1 && part_id <= 31 )
2372 {
2373 offset = part_id - 1;
2374 mask = 1 << offset;
2375
2377 {
2378 return true;
2379 }
2380 }
2381 else if ( part_id >= 32 && part_id <= 62 )
2382 {
2383 offset = ( part_id % 32 );
2384 mask = 1 << offset;
2385
2387 {
2388 return true;
2389 }
2390 }
2391 else if ( part_id >= 63 && part_id <= 93 )
2392 {
2393 offset = ( part_id % 63 );
2394 mask = 1 << offset;
2395
2397 {
2398 return true;
2399 }
2400 }
2401
2402 return false;
2403 }
2404
2406 {
2409 }
2410
2412 {
2413
2416 }
2417
2419 {
2421 {
2424
2425 switch( build_action_id )
2426 {
2430 }
2431 }
2432 }
2433
2434
2436 {
2438 bool is_base = part.
IsBase();
2441 if ( is_part_built_sync )
2442 {
2444 {
2448
2449 if (is_base)
2450 {
2453 }
2454 }
2455 }
2456 else
2457 {
2459 {
2463
2464 if (is_base)
2465 {
2468 }
2469 }
2470 }
2471
2472
2474 }
2475
2476
2478 {
2481
2482 for ( int i = 0; i < construction_parts.Count(); ++i )
2483 {
2484 string key = construction_parts.GetKey( i );
2487 }
2488
2489
2491 }
2492
2494 {
2497
2498 for ( int i = 0; i < construction_parts.Count(); ++i )
2499 {
2500 string key = construction_parts.GetKey( i );
2502
2503 if ( value.
GetId() ==
id )
2504 {
2505 return value;
2506 }
2507 }
2508
2509 return NULL;
2510 }
2511
2512
2513
2515 {
2517 }
2518
2520 {
2522 }
2523
2525 {
2526 return true;
2527 }
2528
2530 {
2531 return false;
2532 }
2533
2534
2536 {
2539 {
2541 }
2542
2543 return construction_kit;
2544 }
2545
2547 {
2550 {
2552 }
2553 }
2554
2556 {
2558 }
2559
2561 {
2562 return "";
2563 }
2564
2566 {
2568 g_Game.ObjectDelete( construction_kit );
2569 }
2570
2571
2573 {
2575 g_Game.ObjectDelete(
this );
2576 }
2577
2578
2580 {
2581 super.EEDelete(parent);
2582
2584 {
2585 areaDamage.Destroy();
2586 }
2587
2588 }
2589
2591 {
2592 super.OnStoreSave( ctx );
2593
2594
2598
2600 }
2601
2603 {
2604 if ( !super.OnStoreLoad( ctx, version ) )
2605 return false;
2606
2607
2608
2610 {
2612 return false;
2613 }
2615 {
2617 return false;
2618 }
2620 {
2622 return false;
2623 }
2624
2625
2627 {
2629 return false;
2630 }
2631
2632
2633 return true;
2634 }
2635
2637 {
2638 super.AfterStoreLoad();
2639
2641 {
2643 }
2644 }
2645
2647 {
2648
2650
2651
2654
2655
2657 }
2658
2660 {
2661 super.OnCreatePhysics();
2662
2663 ConstructionInit();
2665 }
2666
2668 {
2670 return;
2671
2672 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2673 }
2674
2676 {
2678 {
2680 }
2681
2682 super.EEOnAfterLoad();
2683 }
2684
2686 {
2687 super.EEItemAttached( item, slot_name );
2688
2692 }
2693
2695 {
2696 super.EEItemDetached( item, slot_name );
2697
2700 }
2701
2702 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2703 {
2706
2709 }
2710
2711
2713 {
2714 return true;
2715 }
2716
2717
2718
2720 {
2722
2723
2724 if (construtionPart.
IsBase())
2725 {
2727
2728
2730 }
2731
2732
2734
2735
2737
2738
2740
2742
2744
2745
2747
2748
2750 }
2751
2753 {
2754
2756 }
2757
2758
2760 {
2763
2764
2766
2767
2769
2770
2772
2773
2775
2777
2778
2780
2781
2783
2784
2785 if (construtionPart.
IsBase())
2786 {
2787
2789 }
2790 }
2791
2793 {
2794
2796 }
2797
2798
2799 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2800 {
2803
2804
2806
2807
2809
2810
2812
2813
2815
2817
2818
2820
2821
2823
2824
2825 if (construtionPart.
IsBase())
2826 {
2827
2829 }
2830 }
2831
2833 {
2834
2836 }
2837
2838
2840 {
2842
2845 }
2846
2848 {
2850
2852 {
2854 }
2855 else
2856 {
2858 }
2859
2861 }
2862
2864 {
2866
2868 foreach (
string slotName : attachmentSlots)
2869 {
2871 }
2872
2873
2876 else
2878
2880 }
2881
2883 {
2884 string slotNameMounted = slot_name + "_Mounted";
2885 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2886
2887 if (attachment)
2888 {
2889 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2890 if (barbedWire && barbedWire.IsMounted())
2892 else
2894
2895 if (is_locked)
2896 {
2897 SetAnimationPhase(slotNameMounted, 0);
2898 SetAnimationPhase(slot_name, 1);
2899 }
2900 else
2901 {
2902 SetAnimationPhase(slotNameMounted, 1);
2903 SetAnimationPhase(slot_name, 0);
2904 }
2905 }
2906 else
2907 {
2908 SetAnimationPhase(slotNameMounted, 1);
2909 SetAnimationPhase(slot_name, 1);
2910
2912 }
2913 }
2914
2915
2917 {
2920
2923
2926
2927 foreach (
string slotName : attachmentSlots)
2928 {
2930 }
2931
2932
2934 {
2937
2939 }
2940 else
2941 {
2944
2946 }
2947
2950 }
2951
2953 {
2954
2956 return;
2957
2958 string slot_name_mounted = slot_name + "_Mounted";
2959 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2960
2961
2963 RemoveProxyPhysics( slot_name_mounted );
2964 RemoveProxyPhysics( slot_name );
2965
2966 if ( attachment )
2967 {
2969 if ( is_locked )
2970 {
2972 AddProxyPhysics( slot_name_mounted );
2973 }
2974 else
2975 {
2977 AddProxyPhysics( slot_name );
2978 }
2979 }
2980 }
2981
2983 {
2984 SetAffectPathgraph( true, false );
2986 }
2987
2989 {
2990 return true;
2991 }
2992
2994 {
2995 return true;
2996 }
2997
2999 {
3000 if ( attachment )
3001 {
3003 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3004
3005 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3006 }
3007
3008 return false;
3009 }
3010
3012 {
3014 }
3015
3016
3018 {
3019 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3020 if (
g_Game.ConfigIsExisting( config_path ) )
3021 {
3022 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3023 }
3024 }
3025
3027 {
3028 return true;
3029 }
3030
3032 {
3033 return true;
3034 }
3035
3037 {
3038 return true;
3039 }
3040
3041
3043 {
3046 }
3047
3049 {
3051 }
3052
3054 {
3056 }
3057
3059 {
3060 int attachment_count = GetInventory().AttachmentCount();
3061 if ( attachment_count > 0 )
3062 {
3063 if (
HasBase() && attachment_count == 1 )
3064 {
3065 return false;
3066 }
3067
3068 return true;
3069 }
3070
3071 return false;
3072 }
3073
3075 {
3076 return true;
3077 }
3078
3080 {
3081 return false;
3082 }
3083
3084
3086 {
3087 return false;
3088 }
3089
3091 {
3092 return false;
3093 }
3094
3095
3097 {
3098 return false;
3099 }
3100
3101
3102
3104 {
3105 return true;
3106 }
3107
3109 {
3110 return true;
3111 }
3112
3115 {
3116 return false;
3117 }
3118
3119
3121 {
3122 return false;
3123 }
3124
3125
3127 {
3128 return true;
3129 }
3130
3131
3133 {
3134 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3135 {
3136 return false;
3137 }
3138
3139 return true;
3140 }
3141
3143 {
3146
3147 return item;
3148 }
3149
3150
3152 {
3154 {
3155
3157
3158
3161
3163 if ( MemoryPointExists( slot_name + "_min" ) )
3164 {
3165 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3166 }
3167 if ( MemoryPointExists( slot_name + "_max" ) )
3168 {
3169 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3170 }
3171
3172
3175
3176
3179 center = ModelToWorld( center );
3180
3181
3184
3185 areaDamage.SetExtents( extents[0], extents[1] );
3186 areaDamage.SetAreaPosition( center );
3190 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3191 areaDamage.SetAmmoName( "BarbedWireHit" );
3192 areaDamage.Spawn();
3193
3195 }
3196 }
3197
3199 {
3200 if ( angle_deg != 0 )
3201 {
3202
3204
3205
3207 if ( MemoryPointExists( "rotate_axis" ) )
3208 {
3209 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3210 }
3211 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];
3212 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];
3213 center[0] = r_center_x;
3214 center[2] = r_center_z;
3215 }
3216 }
3217
3219 {
3221 {
3224 {
3225 if (areaDamage)
3226 {
3227 areaDamage.Destroy();
3228 }
3229
3231 }
3232 }
3233 }
3234
3236 {
3237 return true;
3238 }
3239
3240
3241
3242
3244 {
3246 }
3247
3249 {
3251 }
3252
3254 {
3256 }
3257
3259 {
3261
3262 switch ( material_type )
3263 {
3269 }
3270
3271 return "";
3272 }
3273
3275 {
3277
3278 switch ( material_type )
3279 {
3285 }
3286
3287 return "";
3288 }
3289
3290
3292 {
3294 {
3295
3297 {
3298 SetHealth(slot_name,"Health",item.GetHealth());
3299 }
3300 }
3301 }
3302
3304 {
3305 return 111;
3306 }
3307
3309 {
3310 super.SetActions();
3311
3315 }
3316
3318 {
3320 if (!construction)
3321 return;
3322
3324 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3325 {
3328 {
3330 }
3331 }
3332 }
3333
3335 {
3337 if (!construction)
3338 return;
3339
3341 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3342 {
3345 {
3346 construction.HandleEntityFalling(part.
GetPartName());
3347 }
3348 }
3349 }
3350
3353 {
3355 return;
3356
3359
3360 if (DestroyOnFall())
3361 {
3363 {
3365 }
3366 else
3367 {
3369 {
3371 }
3373 }
3374 }
3375 }
3376
3378 {
3379 if (HasAnyAttachmentsOrCargo())
3380 {
3383 }
3384 }
3385
3386
3387
3388
3389
3392 {
3393 return null;
3394 }
3395
3397 {
3399 }
3400
3402 {
3405
3406 Man p;
3407
3408 #ifdef SERVER
3410 g_Game.GetWorld().GetPlayerList(players);
3411 if (players.Count())
3412 p = players[0];
3413 #else
3415 #endif
3416
3418 {
3419 bool excluded = false;
3421 if (excludes)
3422 {
3423 foreach (string exclude : excludes)
3424 {
3426 {
3427 excluded = true;
3428 break;
3429 }
3430 }
3431 }
3432
3433 if (!excluded)
3434 {
3436 }
3437 }
3438
3440 }
3441
3443
3445 [
Obsolete(
"handled in the Construction component directly")]
3447 {
3448 }
3449
3450 [
Obsolete(
"handled in the Construction component directly")]
3452 {
3453 }
3454
3455 [
Obsolete(
"obsolete debug method")]
3457 {
3458 }
3459}
3460
3462{
3463#ifdef BSB_DEBUG
3465#else
3466
3467#endif
3468}
3470{
3471#ifdef BSB_DEBUG_SPAM
3473#else
3474
3475#endif
3476}
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.