2199{
2201
2203
2205
2212
2213
2214
2220
2226
2228
2232
2233
2235 {
2237
2238
2239 RegisterNetSyncVariableInt( "m_SyncParts01" );
2240 RegisterNetSyncVariableInt( "m_SyncParts02" );
2241 RegisterNetSyncVariableInt( "m_SyncParts03" );
2242 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2243 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2244 RegisterNetSyncVariableBool( "m_HasBase" );
2245
2246
2247 ConstructionInit();
2248
2249 if (ConfigIsExisting("hybridAttachments"))
2250 {
2253 }
2254 if (ConfigIsExisting("mountables"))
2255 {
2258 }
2259
2261 SetAllowDamage(true);
2262 }
2263
2265 {
2266 return "disableBaseDamage";
2267 }
2268
2270 {
2271 return true;
2272 }
2273
2275 {
2276 return EInventoryIconVisibility.HIDE_VICINITY;
2277 }
2278
2280 {
2281 super.InitItemSounds();
2282
2286
2291 }
2292
2294 {
2295 return "putDown_FenceKit_SoundSet";
2296 }
2297
2299 {
2300 return "Shelter_Site_Build_Loop_SoundSet";
2301 }
2302
2303
2305 {
2307 {
2308 SetSynchDirty();
2309 }
2310 }
2311
2313 {
2315 super.OnVariablesSynchronized();
2316
2318 }
2319
2321 {
2322
2324
2325
2327
2328
2330 }
2331
2332
2334 {
2335
2336 int offset;
2337 int mask;
2338
2339 if ( part_id >= 1 && part_id <= 31 )
2340 {
2341 offset = part_id - 1;
2342 mask = 1 << offset;
2343
2345 }
2346 else if ( part_id >= 32 && part_id <= 62 )
2347 {
2348 offset = ( part_id % 32 );
2349 mask = 1 << offset;
2350
2352 }
2353 else if ( part_id >= 63 && part_id <= 93 )
2354 {
2355 offset = ( part_id % 63 );
2356 mask = 1 << offset;
2357
2359 }
2360 }
2361
2363 {
2364
2365 int offset;
2366 int mask;
2367
2368 if ( part_id >= 1 && part_id <= 31 )
2369 {
2370 offset = part_id - 1;
2371 mask = 1 << offset;
2372
2374 }
2375 else if ( part_id >= 32 && part_id <= 62 )
2376 {
2377 offset = ( part_id % 32 );
2378 mask = 1 << offset;
2379
2381 }
2382 else if ( part_id >= 63 && part_id <= 93 )
2383 {
2384 offset = ( part_id % 63 );
2385 mask = 1 << offset;
2386
2388 }
2389 }
2390
2392 {
2393
2394 int offset;
2395 int mask;
2396
2397 if ( part_id >= 1 && part_id <= 31 )
2398 {
2399 offset = part_id - 1;
2400 mask = 1 << offset;
2401
2403 {
2404 return true;
2405 }
2406 }
2407 else if ( part_id >= 32 && part_id <= 62 )
2408 {
2409 offset = ( part_id % 32 );
2410 mask = 1 << offset;
2411
2413 {
2414 return true;
2415 }
2416 }
2417 else if ( part_id >= 63 && part_id <= 93 )
2418 {
2419 offset = ( part_id % 63 );
2420 mask = 1 << offset;
2421
2423 {
2424 return true;
2425 }
2426 }
2427
2428 return false;
2429 }
2430
2432 {
2435 }
2436
2438 {
2439
2442 }
2443
2445 {
2447 {
2450
2451 switch( build_action_id )
2452 {
2456 }
2457 }
2458 }
2459
2460
2462 {
2464 bool is_base = part.
IsBase();
2467 if ( is_part_built_sync )
2468 {
2470 {
2474
2475 if (is_base)
2476 {
2479 }
2480 }
2481 }
2482 else
2483 {
2485 {
2489
2490 if (is_base)
2491 {
2494 }
2495 }
2496 }
2497
2498
2500 }
2501
2502
2504 {
2507
2508 for ( int i = 0; i < construction_parts.Count(); ++i )
2509 {
2510 string key = construction_parts.GetKey( i );
2513 }
2514
2515
2517 }
2518
2520 {
2523
2524 for ( int i = 0; i < construction_parts.Count(); ++i )
2525 {
2526 string key = construction_parts.GetKey( i );
2528
2529 if ( value.
GetId() ==
id )
2530 {
2531 return value;
2532 }
2533 }
2534
2535 return NULL;
2536 }
2537
2538
2539
2541 {
2543 }
2544
2546 {
2548 }
2549
2551 {
2552 return true;
2553 }
2554
2556 {
2557 return false;
2558 }
2559
2560
2562 {
2565 {
2567 }
2568
2569 return construction_kit;
2570 }
2571
2573 {
2576 {
2578 }
2579 }
2580
2582 {
2584 }
2585
2587 {
2588 return "";
2589 }
2590
2592 {
2594 g_Game.ObjectDelete( construction_kit );
2595 }
2596
2597
2599 {
2601 g_Game.ObjectDelete(
this );
2602 }
2603
2604
2606 {
2607 super.EEDelete(parent);
2608
2610 {
2611 areaDamage.Destroy();
2612 }
2613
2614 }
2615
2617 {
2618 super.OnStoreSave( ctx );
2619
2620
2624
2626 }
2627
2629 {
2630 if ( !super.OnStoreLoad( ctx, version ) )
2631 return false;
2632
2633
2634
2636 {
2638 return false;
2639 }
2641 {
2643 return false;
2644 }
2646 {
2648 return false;
2649 }
2650
2651
2653 {
2655 return false;
2656 }
2657
2658
2659 return true;
2660 }
2661
2663 {
2664 super.AfterStoreLoad();
2665
2667 {
2669 }
2670 }
2671
2673 {
2674
2676
2677
2680
2681
2683 }
2684
2686 {
2687 super.OnCreatePhysics();
2688
2689 ConstructionInit();
2691 }
2692
2694 {
2696 return;
2697
2698 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2699 }
2700
2702 {
2704 {
2706 }
2707
2708 super.EEOnAfterLoad();
2709 }
2710
2712 {
2713 super.EEItemAttached( item, slot_name );
2714
2718 }
2719
2721 {
2722 super.EEItemDetached( item, slot_name );
2723
2726 }
2727
2728 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2729 {
2732
2735 }
2736
2737
2739 {
2740 return true;
2741 }
2742
2743
2744
2746 {
2748
2749
2750 if (construtionPart.
IsBase())
2751 {
2753
2754
2756 }
2757
2758
2760
2761
2763
2764
2766
2768
2770
2771
2773
2774
2776 }
2777
2779 {
2780
2782 }
2783
2784
2786 {
2789
2790
2792
2793
2795
2796
2798
2799
2801
2803
2804
2806
2807
2809
2810
2811 if (construtionPart.
IsBase())
2812 {
2813
2815 }
2816 }
2817
2819 {
2820
2822 }
2823
2824
2825 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2826 {
2829
2830
2832
2833
2835
2836
2838
2839
2841
2843
2844
2846
2847
2849
2850
2851 if (construtionPart.
IsBase())
2852 {
2853
2855 }
2856 }
2857
2859 {
2860
2862 }
2863
2864
2866 {
2868
2871 }
2872
2874 {
2876
2878 {
2880 }
2881 else
2882 {
2884 }
2885
2887 }
2888
2890 {
2892
2894 foreach (
string slotName : attachmentSlots)
2895 {
2897 }
2898
2899
2902 else
2904
2906 }
2907
2909 {
2910 string slotNameMounted = slot_name + "_Mounted";
2911 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2912
2913 if (attachment)
2914 {
2915 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2916 if (barbedWire && barbedWire.IsMounted())
2918 else
2920
2921 if (is_locked)
2922 {
2923 SetAnimationPhase(slotNameMounted, 0);
2924 SetAnimationPhase(slot_name, 1);
2925 }
2926 else
2927 {
2928 SetAnimationPhase(slotNameMounted, 1);
2929 SetAnimationPhase(slot_name, 0);
2930 }
2931 }
2932 else
2933 {
2934 SetAnimationPhase(slotNameMounted, 1);
2935 SetAnimationPhase(slot_name, 1);
2936
2938 }
2939 }
2940
2941
2943 {
2946
2949
2952
2953 foreach (
string slotName : attachmentSlots)
2954 {
2956 }
2957
2958
2960 {
2963
2965 }
2966 else
2967 {
2970
2972 }
2973
2976 }
2977
2979 {
2980
2982 return;
2983
2984 string slot_name_mounted = slot_name + "_Mounted";
2985 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2986
2987
2989 RemoveProxyPhysics( slot_name_mounted );
2990 RemoveProxyPhysics( slot_name );
2991
2992 if ( attachment )
2993 {
2995 if ( is_locked )
2996 {
2998 AddProxyPhysics( slot_name_mounted );
2999 }
3000 else
3001 {
3003 AddProxyPhysics( slot_name );
3004 }
3005 }
3006 }
3007
3009 {
3010 SetAffectPathgraph( true, false );
3012 }
3013
3015 {
3016 return true;
3017 }
3018
3020 {
3021 return true;
3022 }
3023
3025 {
3026 if ( attachment )
3027 {
3029 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
3030
3031 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
3032 }
3033
3034 return false;
3035 }
3036
3038 {
3040 }
3041
3042
3044 {
3045 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3046 if (
g_Game.ConfigIsExisting( config_path ) )
3047 {
3048 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3049 }
3050 }
3051
3053 {
3054 return true;
3055 }
3056
3058 {
3059 return true;
3060 }
3061
3063 {
3064 return true;
3065 }
3066
3067
3069 {
3072 }
3073
3075 {
3077 }
3078
3080 {
3082 }
3083
3085 {
3086 int attachment_count = GetInventory().AttachmentCount();
3087 if ( attachment_count > 0 )
3088 {
3089 if (
HasBase() && attachment_count == 1 )
3090 {
3091 return false;
3092 }
3093
3094 return true;
3095 }
3096
3097 return false;
3098 }
3099
3101 {
3102 return true;
3103 }
3104
3106 {
3107 return false;
3108 }
3109
3110
3112 {
3113 return false;
3114 }
3115
3117 {
3118 return false;
3119 }
3120
3121
3123 {
3124 return false;
3125 }
3126
3127
3128
3130 {
3131 return true;
3132 }
3133
3135 {
3136 return true;
3137 }
3138
3141 {
3142 return false;
3143 }
3144
3145
3147 {
3148 return false;
3149 }
3150
3151
3153 {
3154 return true;
3155 }
3156
3157
3159 {
3160 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3161 {
3162 return false;
3163 }
3164
3165 return true;
3166 }
3167
3169 {
3172
3173 return item;
3174 }
3175
3176
3178 {
3180 {
3181
3183
3184
3187
3189 if ( MemoryPointExists( slot_name + "_min" ) )
3190 {
3191 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3192 }
3193 if ( MemoryPointExists( slot_name + "_max" ) )
3194 {
3195 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3196 }
3197
3198
3201
3202
3205 center = ModelToWorld( center );
3206
3207
3210
3211 areaDamage.SetExtents( extents[0], extents[1] );
3212 areaDamage.SetAreaPosition( center );
3216 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3217 areaDamage.SetAmmoName( "BarbedWireHit" );
3218 areaDamage.Spawn();
3219
3221 }
3222 }
3223
3225 {
3226 if ( angle_deg != 0 )
3227 {
3228
3230
3231
3233 if ( MemoryPointExists( "rotate_axis" ) )
3234 {
3235 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3236 }
3237 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];
3238 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];
3239 center[0] = r_center_x;
3240 center[2] = r_center_z;
3241 }
3242 }
3243
3245 {
3247 {
3250 {
3251 if (areaDamage)
3252 {
3253 areaDamage.Destroy();
3254 }
3255
3257 }
3258 }
3259 }
3260
3262 {
3263 return true;
3264 }
3265
3266
3267
3268
3270 {
3272 }
3273
3275 {
3277 }
3278
3280 {
3282 }
3283
3285 {
3287
3288 switch ( material_type )
3289 {
3295 }
3296
3297 return "";
3298 }
3299
3301 {
3303
3304 switch ( material_type )
3305 {
3311 }
3312
3313 return "";
3314 }
3315
3316
3318 {
3320 {
3321
3323 {
3324 SetHealth(slot_name,"Health",item.GetHealth());
3325 }
3326 }
3327 }
3328
3330 {
3331 return 111;
3332 }
3333
3335 {
3336 super.SetActions();
3337
3341 }
3342
3344 {
3346 if (!construction)
3347 return;
3348
3350 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3351 {
3354 {
3356 }
3357 }
3358 }
3359
3361 {
3363 if (!construction)
3364 return;
3365
3367 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3368 {
3371 {
3372 construction.HandleEntityFalling(part.
GetPartName());
3373 }
3374 }
3375 }
3376
3379 {
3381 return;
3382
3385
3386 if (DestroyOnFall())
3387 {
3389 {
3391 }
3392 else
3393 {
3395 {
3397 }
3399 }
3400 }
3401 }
3402
3404 {
3405 if (HasAnyAttachmentsOrCargo())
3406 {
3409 }
3410 }
3411
3412
3413
3414
3415
3418 {
3419 return null;
3420 }
3421
3423 {
3425 }
3426
3428 {
3431
3432 Man p;
3433
3434 #ifdef SERVER
3436 g_Game.GetWorld().GetPlayerList(players);
3437 if (players.Count())
3438 p = players[0];
3439 #else
3441 #endif
3442
3444 {
3445 bool excluded = false;
3447 if (excludes)
3448 {
3449 foreach (string exclude : excludes)
3450 {
3452 {
3453 excluded = true;
3454 break;
3455 }
3456 }
3457 }
3458
3459 if (!excluded)
3460 {
3462 }
3463 }
3464
3466 }
3467
3469
3471 [
Obsolete(
"handled in the Construction component directly")]
3473 {
3474 }
3475
3476 [
Obsolete(
"handled in the Construction component directly")]
3478 {
3479 }
3480
3481 [
Obsolete(
"obsolete debug method")]
3483 {
3484 }
3485}
3486
3488{
3489#ifdef BSB_DEBUG
3491#else
3492
3493#endif
3494}
3496{
3497#ifdef BSB_DEBUG_SPAM
3499#else
3500
3501#endif
3502}
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.