2194{
2196
2198
2200
2207
2208
2209
2215
2221
2223
2227
2228
2230 {
2232
2233
2234 RegisterNetSyncVariableInt( "m_SyncParts01" );
2235 RegisterNetSyncVariableInt( "m_SyncParts02" );
2236 RegisterNetSyncVariableInt( "m_SyncParts03" );
2237 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2238 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2239 RegisterNetSyncVariableBool( "m_HasBase" );
2240
2241
2242 ConstructionInit();
2243
2244 if (ConfigIsExisting("hybridAttachments"))
2245 {
2248 }
2249 if (ConfigIsExisting("mountables"))
2250 {
2253 }
2254
2256 SetAllowDamage(true);
2257 }
2258
2260 {
2261 return "disableBaseDamage";
2262 }
2263
2265 {
2266 return true;
2267 }
2268
2270 {
2271 return EInventoryIconVisibility.HIDE_VICINITY;
2272 }
2273
2275 {
2276 super.InitItemSounds();
2277
2281
2286 }
2287
2289 {
2290 return "putDown_FenceKit_SoundSet";
2291 }
2292
2294 {
2295 return "Shelter_Site_Build_Loop_SoundSet";
2296 }
2297
2298
2300 {
2302 {
2303 SetSynchDirty();
2304 }
2305 }
2306
2308 {
2310 super.OnVariablesSynchronized();
2311
2313 }
2314
2316 {
2317
2319
2320
2322
2323
2325 }
2326
2327
2329 {
2330
2331 int offset;
2332 int mask;
2333
2334 if ( part_id >= 1 && part_id <= 31 )
2335 {
2336 offset = part_id - 1;
2337 mask = 1 << offset;
2338
2340 }
2341 else if ( part_id >= 32 && part_id <= 62 )
2342 {
2343 offset = ( part_id % 32 );
2344 mask = 1 << offset;
2345
2347 }
2348 else if ( part_id >= 63 && part_id <= 93 )
2349 {
2350 offset = ( part_id % 63 );
2351 mask = 1 << offset;
2352
2354 }
2355 }
2356
2358 {
2359
2360 int offset;
2361 int mask;
2362
2363 if ( part_id >= 1 && part_id <= 31 )
2364 {
2365 offset = part_id - 1;
2366 mask = 1 << offset;
2367
2369 }
2370 else if ( part_id >= 32 && part_id <= 62 )
2371 {
2372 offset = ( part_id % 32 );
2373 mask = 1 << offset;
2374
2376 }
2377 else if ( part_id >= 63 && part_id <= 93 )
2378 {
2379 offset = ( part_id % 63 );
2380 mask = 1 << offset;
2381
2383 }
2384 }
2385
2387 {
2388
2389 int offset;
2390 int mask;
2391
2392 if ( part_id >= 1 && part_id <= 31 )
2393 {
2394 offset = part_id - 1;
2395 mask = 1 << offset;
2396
2398 {
2399 return true;
2400 }
2401 }
2402 else if ( part_id >= 32 && part_id <= 62 )
2403 {
2404 offset = ( part_id % 32 );
2405 mask = 1 << offset;
2406
2408 {
2409 return true;
2410 }
2411 }
2412 else if ( part_id >= 63 && part_id <= 93 )
2413 {
2414 offset = ( part_id % 63 );
2415 mask = 1 << offset;
2416
2418 {
2419 return true;
2420 }
2421 }
2422
2423 return false;
2424 }
2425
2427 {
2430 }
2431
2433 {
2434
2437 }
2438
2440 {
2442 {
2445
2446 switch( build_action_id )
2447 {
2451 }
2452 }
2453 }
2454
2455
2457 {
2459 bool is_base = part.
IsBase();
2462 if ( is_part_built_sync )
2463 {
2465 {
2469
2470 if (is_base)
2471 {
2474 }
2475 }
2476 }
2477 else
2478 {
2480 {
2484
2485 if (is_base)
2486 {
2489 }
2490 }
2491 }
2492
2493
2495 }
2496
2497
2499 {
2502
2503 for ( int i = 0; i < construction_parts.Count(); ++i )
2504 {
2505 string key = construction_parts.GetKey( i );
2508 }
2509
2510
2512 }
2513
2515 {
2518
2519 for ( int i = 0; i < construction_parts.Count(); ++i )
2520 {
2521 string key = construction_parts.GetKey( i );
2523
2524 if ( value.
GetId() ==
id )
2525 {
2526 return value;
2527 }
2528 }
2529
2530 return NULL;
2531 }
2532
2533
2534
2536 {
2538 }
2539
2541 {
2543 }
2544
2546 {
2547 return true;
2548 }
2549
2551 {
2552 return false;
2553 }
2554
2555
2557 {
2560 {
2562 }
2563
2564 return construction_kit;
2565 }
2566
2568 {
2571 {
2573 }
2574 }
2575
2577 {
2579 }
2580
2582 {
2583 return "";
2584 }
2585
2587 {
2589 g_Game.ObjectDelete( construction_kit );
2590 }
2591
2592
2594 {
2596 g_Game.ObjectDelete(
this );
2597 }
2598
2599
2601 {
2602 super.EEDelete(parent);
2603
2605 {
2606 areaDamage.Destroy();
2607 }
2608
2609 }
2610
2612 {
2613 super.OnStoreSave( ctx );
2614
2615
2619
2621 }
2622
2624 {
2625 if ( !super.OnStoreLoad( ctx, version ) )
2626 return false;
2627
2628
2629
2631 {
2633 return false;
2634 }
2636 {
2638 return false;
2639 }
2641 {
2643 return false;
2644 }
2645
2646
2648 {
2650 return false;
2651 }
2652
2653
2654 return true;
2655 }
2656
2658 {
2659 super.AfterStoreLoad();
2660
2662 {
2664 }
2665 }
2666
2668 {
2669
2671
2672
2675
2676
2678 }
2679
2681 {
2682 super.OnCreatePhysics();
2683
2684 ConstructionInit();
2686 }
2687
2689 {
2691 return;
2692
2693 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2694 }
2695
2697 {
2699 {
2701 }
2702
2703 super.EEOnAfterLoad();
2704 }
2705
2707 {
2708 super.EEItemAttached( item, slot_name );
2709
2713 }
2714
2716 {
2717 super.EEItemDetached( item, slot_name );
2718
2721 }
2722
2723 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2724 {
2727
2730 }
2731
2732
2734 {
2735 return true;
2736 }
2737
2738
2739
2741 {
2743
2744
2745 if (construtionPart.
IsBase())
2746 {
2748
2749
2751 }
2752
2753
2755
2756
2758
2759
2761
2763
2765
2766
2768
2769
2771 }
2772
2774 {
2775
2777 }
2778
2779
2781 {
2784
2785
2787
2788
2790
2791
2793
2794
2796
2798
2799
2801
2802
2804
2805
2806 if (construtionPart.
IsBase())
2807 {
2808
2810 }
2811 }
2812
2814 {
2815
2817 }
2818
2819
2820 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
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
2861 {
2863
2866 }
2867
2869 {
2871
2873 {
2875 }
2876 else
2877 {
2879 }
2880
2882 }
2883
2885 {
2887
2889 foreach (
string slotName : attachmentSlots)
2890 {
2892 }
2893
2894
2897 else
2899
2901 }
2902
2904 {
2905 string slotNameMounted = slot_name + "_Mounted";
2906 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2907
2908 if (attachment)
2909 {
2910 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2911 if (barbedWire && barbedWire.IsMounted())
2913 else
2915
2916 if (is_locked)
2917 {
2918 SetAnimationPhase(slotNameMounted, 0);
2919 SetAnimationPhase(slot_name, 1);
2920 }
2921 else
2922 {
2923 SetAnimationPhase(slotNameMounted, 1);
2924 SetAnimationPhase(slot_name, 0);
2925 }
2926 }
2927 else
2928 {
2929 SetAnimationPhase(slotNameMounted, 1);
2930 SetAnimationPhase(slot_name, 1);
2931
2933 }
2934 }
2935
2936
2938 {
2941
2944
2947
2948 foreach (
string slotName : attachmentSlots)
2949 {
2951 }
2952
2953
2955 {
2958
2960 }
2961 else
2962 {
2965
2967 }
2968
2971 }
2972
2974 {
2975
2977 return;
2978
2979 string slot_name_mounted = slot_name + "_Mounted";
2980 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2981
2982
2984 RemoveProxyPhysics( slot_name_mounted );
2985 RemoveProxyPhysics( slot_name );
2986
2987 if ( attachment )
2988 {
2990 if ( is_locked )
2991 {
2993 AddProxyPhysics( slot_name_mounted );
2994 }
2995 else
2996 {
2998 AddProxyPhysics( slot_name );
2999 }
3000 }
3001 }
3002
3004 {
3005 SetAffectPathgraph( true, false );
3007 }
3008
3010 {
3011 return true;
3012 }
3013
3015 {
3016 return true;
3017 }
3018
3020 {
3021 if ( attachment )
3022 {
3024 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3025
3026 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3027 }
3028
3029 return false;
3030 }
3031
3033 {
3035 }
3036
3037
3039 {
3040 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3041 if (
g_Game.ConfigIsExisting( config_path ) )
3042 {
3043 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3044 }
3045 }
3046
3048 {
3049 return true;
3050 }
3051
3053 {
3054 return true;
3055 }
3056
3058 {
3059 return true;
3060 }
3061
3062
3064 {
3067 }
3068
3070 {
3072 }
3073
3075 {
3077 }
3078
3080 {
3081 int attachment_count = GetInventory().AttachmentCount();
3082 if ( attachment_count > 0 )
3083 {
3084 if (
HasBase() && attachment_count == 1 )
3085 {
3086 return false;
3087 }
3088
3089 return true;
3090 }
3091
3092 return false;
3093 }
3094
3096 {
3097 return true;
3098 }
3099
3101 {
3102 return false;
3103 }
3104
3105
3107 {
3108 return false;
3109 }
3110
3112 {
3113 return false;
3114 }
3115
3116
3118 {
3119 return false;
3120 }
3121
3122
3123
3125 {
3126 return true;
3127 }
3128
3130 {
3131 return true;
3132 }
3133
3136 {
3137 return false;
3138 }
3139
3140
3142 {
3143 return false;
3144 }
3145
3146
3148 {
3149 return true;
3150 }
3151
3152
3154 {
3155 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3156 {
3157 return false;
3158 }
3159
3160 return true;
3161 }
3162
3164 {
3167
3168 return item;
3169 }
3170
3171
3173 {
3175 {
3176
3178
3179
3182
3184 if ( MemoryPointExists( slot_name + "_min" ) )
3185 {
3186 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3187 }
3188 if ( MemoryPointExists( slot_name + "_max" ) )
3189 {
3190 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3191 }
3192
3193
3196
3197
3200 center = ModelToWorld( center );
3201
3202
3205
3206 areaDamage.SetExtents( extents[0], extents[1] );
3207 areaDamage.SetAreaPosition( center );
3211 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3212 areaDamage.SetAmmoName( "BarbedWireHit" );
3213 areaDamage.Spawn();
3214
3216 }
3217 }
3218
3220 {
3221 if ( angle_deg != 0 )
3222 {
3223
3225
3226
3228 if ( MemoryPointExists( "rotate_axis" ) )
3229 {
3230 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3231 }
3232 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];
3233 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];
3234 center[0] = r_center_x;
3235 center[2] = r_center_z;
3236 }
3237 }
3238
3240 {
3242 {
3245 {
3246 if (areaDamage)
3247 {
3248 areaDamage.Destroy();
3249 }
3250
3252 }
3253 }
3254 }
3255
3257 {
3258 return true;
3259 }
3260
3261
3262
3263
3265 {
3267 }
3268
3270 {
3272 }
3273
3275 {
3277 }
3278
3280 {
3282
3283 switch ( material_type )
3284 {
3290 }
3291
3292 return "";
3293 }
3294
3296 {
3298
3299 switch ( material_type )
3300 {
3306 }
3307
3308 return "";
3309 }
3310
3311
3313 {
3315 {
3316
3318 {
3319 SetHealth(slot_name,"Health",item.GetHealth());
3320 }
3321 }
3322 }
3323
3325 {
3326 return 111;
3327 }
3328
3330 {
3331 super.SetActions();
3332
3336 }
3337
3339 {
3341 if (!construction)
3342 return;
3343
3345 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3346 {
3349 {
3351 }
3352 }
3353 }
3354
3356 {
3358 if (!construction)
3359 return;
3360
3362 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3363 {
3366 {
3367 construction.HandleEntityFalling(part.
GetPartName());
3368 }
3369 }
3370 }
3371
3374 {
3376 return;
3377
3380
3381 if (DestroyOnFall())
3382 {
3384 {
3386 }
3387 else
3388 {
3390 {
3392 }
3394 }
3395 }
3396 }
3397
3399 {
3400 if (HasAnyAttachmentsOrCargo())
3401 {
3404 }
3405 }
3406
3407
3408
3409
3410
3413 {
3414 return null;
3415 }
3416
3418 {
3420 }
3421
3423 {
3426
3427 Man p;
3428
3429 #ifdef SERVER
3431 g_Game.GetWorld().GetPlayerList(players);
3432 if (players.Count())
3433 p = players[0];
3434 #else
3436 #endif
3437
3439 {
3440 bool excluded = false;
3442 if (excludes)
3443 {
3444 foreach (string exclude : excludes)
3445 {
3447 {
3448 excluded = true;
3449 break;
3450 }
3451 }
3452 }
3453
3454 if (!excluded)
3455 {
3457 }
3458 }
3459
3461 }
3462
3464
3466 [
Obsolete(
"handled in the Construction component directly")]
3468 {
3469 }
3470
3471 [
Obsolete(
"handled in the Construction component directly")]
3473 {
3474 }
3475
3476 [
Obsolete(
"obsolete debug method")]
3478 {
3479 }
3480}
3481
3483{
3484#ifdef BSB_DEBUG
3486#else
3487
3488#endif
3489}
3491{
3492#ifdef BSB_DEBUG_SPAM
3494#else
3495
3496#endif
3497}
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.