2162{
2164
2166
2168
2175
2176
2177
2183
2189
2191
2195
2196
2198 {
2200
2201
2202 RegisterNetSyncVariableInt( "m_SyncParts01" );
2203 RegisterNetSyncVariableInt( "m_SyncParts02" );
2204 RegisterNetSyncVariableInt( "m_SyncParts03" );
2205 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2206 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2207 RegisterNetSyncVariableBool( "m_HasBase" );
2208
2209
2210 ConstructionInit();
2211
2212 if (ConfigIsExisting("hybridAttachments"))
2213 {
2216 }
2217 if (ConfigIsExisting("mountables"))
2218 {
2221 }
2222
2224 SetAllowDamage(true);
2225 }
2226
2228 {
2229 return "disableBaseDamage";
2230 }
2231
2233 {
2234 return true;
2235 }
2236
2238 {
2239 return EInventoryIconVisibility.HIDE_VICINITY;
2240 }
2241
2243 {
2244 super.InitItemSounds();
2245
2249
2254 }
2255
2257 {
2258 return "putDown_FenceKit_SoundSet";
2259 }
2260
2262 {
2263 return "Shelter_Site_Build_Loop_SoundSet";
2264 }
2265
2266
2268 {
2270 {
2271 SetSynchDirty();
2272 }
2273 }
2274
2276 {
2278 super.OnVariablesSynchronized();
2279
2281 }
2282
2284 {
2285
2287
2288
2290
2291
2293 }
2294
2295
2297 {
2298
2299 int offset;
2300 int mask;
2301
2302 if ( part_id >= 1 && part_id <= 31 )
2303 {
2304 offset = part_id - 1;
2305 mask = 1 << offset;
2306
2308 }
2309 else if ( part_id >= 32 && part_id <= 62 )
2310 {
2311 offset = ( part_id % 32 );
2312 mask = 1 << offset;
2313
2315 }
2316 else if ( part_id >= 63 && part_id <= 93 )
2317 {
2318 offset = ( part_id % 63 );
2319 mask = 1 << offset;
2320
2322 }
2323 }
2324
2326 {
2327
2328 int offset;
2329 int mask;
2330
2331 if ( part_id >= 1 && part_id <= 31 )
2332 {
2333 offset = part_id - 1;
2334 mask = 1 << offset;
2335
2337 }
2338 else if ( part_id >= 32 && part_id <= 62 )
2339 {
2340 offset = ( part_id % 32 );
2341 mask = 1 << offset;
2342
2344 }
2345 else if ( part_id >= 63 && part_id <= 93 )
2346 {
2347 offset = ( part_id % 63 );
2348 mask = 1 << offset;
2349
2351 }
2352 }
2353
2355 {
2356
2357 int offset;
2358 int mask;
2359
2360 if ( part_id >= 1 && part_id <= 31 )
2361 {
2362 offset = part_id - 1;
2363 mask = 1 << offset;
2364
2366 {
2367 return true;
2368 }
2369 }
2370 else if ( part_id >= 32 && part_id <= 62 )
2371 {
2372 offset = ( part_id % 32 );
2373 mask = 1 << offset;
2374
2376 {
2377 return true;
2378 }
2379 }
2380 else if ( part_id >= 63 && part_id <= 93 )
2381 {
2382 offset = ( part_id % 63 );
2383 mask = 1 << offset;
2384
2386 {
2387 return true;
2388 }
2389 }
2390
2391 return false;
2392 }
2393
2395 {
2398 }
2399
2401 {
2402
2405 }
2406
2408 {
2410 {
2413
2414 switch( build_action_id )
2415 {
2419 }
2420 }
2421 }
2422
2423
2425 {
2427 bool is_base = part.
IsBase();
2430 if ( is_part_built_sync )
2431 {
2433 {
2437
2438 if (is_base)
2439 {
2442 }
2443 }
2444 }
2445 else
2446 {
2448 {
2452
2453 if (is_base)
2454 {
2457 }
2458 }
2459 }
2460
2461
2463 }
2464
2465
2467 {
2470
2471 for ( int i = 0; i < construction_parts.Count(); ++i )
2472 {
2473 string key = construction_parts.GetKey( i );
2476 }
2477
2478
2480 }
2481
2483 {
2486
2487 for ( int i = 0; i < construction_parts.Count(); ++i )
2488 {
2489 string key = construction_parts.GetKey( i );
2491
2492 if ( value.
GetId() ==
id )
2493 {
2494 return value;
2495 }
2496 }
2497
2498 return NULL;
2499 }
2500
2501
2502
2504 {
2506 }
2507
2509 {
2511 }
2512
2514 {
2515 return true;
2516 }
2517
2519 {
2520 return false;
2521 }
2522
2523
2525 {
2528 {
2530 }
2531
2532 return construction_kit;
2533 }
2534
2536 {
2539 {
2541 }
2542 }
2543
2545 {
2547 }
2548
2550 {
2551 return "";
2552 }
2553
2555 {
2557 g_Game.ObjectDelete( construction_kit );
2558 }
2559
2560
2562 {
2564 g_Game.ObjectDelete(
this );
2565 }
2566
2567
2569 {
2570 super.EEDelete(parent);
2571
2573 {
2574 areaDamage.Destroy();
2575 }
2576
2577 }
2578
2580 {
2581 super.OnStoreSave( ctx );
2582
2583
2587
2589 }
2590
2592 {
2593 if ( !super.OnStoreLoad( ctx, version ) )
2594 return false;
2595
2596
2597
2599 {
2601 return false;
2602 }
2604 {
2606 return false;
2607 }
2609 {
2611 return false;
2612 }
2613
2614
2616 {
2618 return false;
2619 }
2620
2621
2622 return true;
2623 }
2624
2626 {
2627 super.AfterStoreLoad();
2628
2630 {
2632 }
2633 }
2634
2636 {
2637
2639
2640
2643
2644
2646 }
2647
2649 {
2650 super.OnCreatePhysics();
2651
2652 ConstructionInit();
2654 }
2655
2657 {
2659 return;
2660
2661 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2662 }
2663
2665 {
2667 {
2669 }
2670
2671 super.EEOnAfterLoad();
2672 }
2673
2675 {
2676 super.EEItemAttached( item, slot_name );
2677
2681 }
2682
2684 {
2685 super.EEItemDetached( item, slot_name );
2686
2689 }
2690
2691 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2692 {
2695
2698 }
2699
2700
2702 {
2703 return true;
2704 }
2705
2706
2707
2709 {
2711
2712
2713 if (construtionPart.
IsBase())
2714 {
2716
2717
2719 }
2720
2721
2723
2724
2726
2727
2729
2731
2733
2734
2736
2737
2739 }
2740
2742 {
2743
2745 }
2746
2747
2749 {
2752
2753
2755
2756
2758
2759
2761
2762
2764
2766
2767
2769
2770
2772
2773
2774 if (construtionPart.
IsBase())
2775 {
2776
2778 }
2779 }
2780
2782 {
2783
2785 }
2786
2787
2788 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2789 {
2792
2793
2795
2796
2798
2799
2801
2802
2804
2806
2807
2809
2810
2812
2813
2814 if (construtionPart.
IsBase())
2815 {
2816
2818 }
2819 }
2820
2822 {
2823
2825 }
2826
2827
2829 {
2831
2834 }
2835
2837 {
2839
2841 {
2843 }
2844 else
2845 {
2847 }
2848
2850 }
2851
2853 {
2855
2857 foreach (
string slotName : attachmentSlots)
2858 {
2860 }
2861
2862
2865 else
2867
2869 }
2870
2872 {
2873 string slotNameMounted = slot_name + "_Mounted";
2874 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2875
2876 if (attachment)
2877 {
2878 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2879 if (barbedWire && barbedWire.IsMounted())
2881 else
2883
2884 if (is_locked)
2885 {
2886 SetAnimationPhase(slotNameMounted, 0);
2887 SetAnimationPhase(slot_name, 1);
2888 }
2889 else
2890 {
2891 SetAnimationPhase(slotNameMounted, 1);
2892 SetAnimationPhase(slot_name, 0);
2893 }
2894 }
2895 else
2896 {
2897 SetAnimationPhase(slotNameMounted, 1);
2898 SetAnimationPhase(slot_name, 1);
2899
2901 }
2902 }
2903
2904
2906 {
2909
2912
2915
2916 foreach (
string slotName : attachmentSlots)
2917 {
2919 }
2920
2921
2923 {
2926
2928 }
2929 else
2930 {
2933
2935 }
2936
2939 }
2940
2942 {
2943
2945 return;
2946
2947 string slot_name_mounted = slot_name + "_Mounted";
2948 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2949
2950
2952 RemoveProxyPhysics( slot_name_mounted );
2953 RemoveProxyPhysics( slot_name );
2954
2955 if ( attachment )
2956 {
2958 if ( is_locked )
2959 {
2961 AddProxyPhysics( slot_name_mounted );
2962 }
2963 else
2964 {
2966 AddProxyPhysics( slot_name );
2967 }
2968 }
2969 }
2970
2972 {
2973 SetAffectPathgraph( true, false );
2975 }
2976
2978 {
2979 return true;
2980 }
2981
2983 {
2984 return true;
2985 }
2986
2988 {
2989 if ( attachment )
2990 {
2992 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2993
2994 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2995 }
2996
2997 return false;
2998 }
2999
3001 {
3003 }
3004
3005
3007 {
3008 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
3009 if (
g_Game.ConfigIsExisting( config_path ) )
3010 {
3011 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3012 }
3013 }
3014
3016 {
3017 return true;
3018 }
3019
3021 {
3022 return true;
3023 }
3024
3026 {
3027 return true;
3028 }
3029
3030
3032 {
3035 }
3036
3038 {
3040 }
3041
3043 {
3045 }
3046
3048 {
3049 int attachment_count = GetInventory().AttachmentCount();
3050 if ( attachment_count > 0 )
3051 {
3052 if (
HasBase() && attachment_count == 1 )
3053 {
3054 return false;
3055 }
3056
3057 return true;
3058 }
3059
3060 return false;
3061 }
3062
3064 {
3065 return true;
3066 }
3067
3069 {
3070 return false;
3071 }
3072
3073
3075 {
3076 return false;
3077 }
3078
3080 {
3081 return false;
3082 }
3083
3084
3086 {
3087 return false;
3088 }
3089
3090
3091
3093 {
3094 return true;
3095 }
3096
3098 {
3099 return true;
3100 }
3101
3104 {
3105 return false;
3106 }
3107
3108
3110 {
3111 return false;
3112 }
3113
3114
3116 {
3117 return true;
3118 }
3119
3120
3122 {
3123 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3124 {
3125 return false;
3126 }
3127
3128 return true;
3129 }
3130
3132 {
3135
3136 return item;
3137 }
3138
3139
3141 {
3143 {
3144
3146
3147
3150
3152 if ( MemoryPointExists( slot_name + "_min" ) )
3153 {
3154 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3155 }
3156 if ( MemoryPointExists( slot_name + "_max" ) )
3157 {
3158 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3159 }
3160
3161
3164
3165
3168 center = ModelToWorld( center );
3169
3170
3173
3174 areaDamage.SetExtents( extents[0], extents[1] );
3175 areaDamage.SetAreaPosition( center );
3179 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3180 areaDamage.SetAmmoName( "BarbedWireHit" );
3181 areaDamage.Spawn();
3182
3184 }
3185 }
3186
3188 {
3189 if ( angle_deg != 0 )
3190 {
3191
3193
3194
3196 if ( MemoryPointExists( "rotate_axis" ) )
3197 {
3198 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3199 }
3200 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];
3201 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];
3202 center[0] = r_center_x;
3203 center[2] = r_center_z;
3204 }
3205 }
3206
3208 {
3210 {
3213 {
3214 if (areaDamage)
3215 {
3216 areaDamage.Destroy();
3217 }
3218
3220 }
3221 }
3222 }
3223
3225 {
3226 return true;
3227 }
3228
3229
3230
3231
3233 {
3235 }
3236
3238 {
3240 }
3241
3243 {
3245 }
3246
3248 {
3250
3251 switch ( material_type )
3252 {
3258 }
3259
3260 return "";
3261 }
3262
3264 {
3266
3267 switch ( material_type )
3268 {
3274 }
3275
3276 return "";
3277 }
3278
3279
3281 {
3283 {
3284
3286 {
3287 SetHealth(slot_name,"Health",item.GetHealth());
3288 }
3289 }
3290 }
3291
3293 {
3294 return 111;
3295 }
3296
3298 {
3299 super.SetActions();
3300
3304 }
3305
3307 {
3309 if (!construction)
3310 return;
3311
3313 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3314 {
3317 {
3319 }
3320 }
3321 }
3322
3324 {
3326 if (!construction)
3327 return;
3328
3330 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3331 {
3334 {
3335 construction.HandleEntityFalling(part.
GetPartName());
3336 }
3337 }
3338 }
3339
3342 {
3344 return;
3345
3348
3349 if (DestroyOnFall())
3350 {
3352 {
3354 }
3355 else
3356 {
3358 {
3360 }
3362 }
3363 }
3364 }
3365
3367 {
3368 if (HasAnyAttachmentsOrCargo())
3369 {
3372 }
3373 }
3374
3375
3376
3377
3378
3381 {
3382 return null;
3383 }
3384
3386 {
3388 }
3389
3391 {
3394
3395 Man p;
3396
3397 #ifdef SERVER
3399 g_Game.GetWorld().GetPlayerList(players);
3400 if (players.Count())
3401 p = players[0];
3402 #else
3404 #endif
3405
3407 {
3408 bool excluded = false;
3410 if (excludes)
3411 {
3412 foreach (string exclude : excludes)
3413 {
3415 {
3416 excluded = true;
3417 break;
3418 }
3419 }
3420 }
3421
3422 if (!excluded)
3423 {
3425 }
3426 }
3427
3429 }
3430
3432
3434 [
Obsolete(
"handled in the Construction component directly")]
3436 {
3437 }
3438
3439 [
Obsolete(
"handled in the Construction component directly")]
3441 {
3442 }
3443
3444 [
Obsolete(
"obsolete debug method")]
3446 {
3447 }
3448}
3449
3451{
3452#ifdef BSB_DEBUG
3454#else
3455
3456#endif
3457}
3459{
3460#ifdef BSB_DEBUG_SPAM
3462#else
3463
3464#endif
3465}
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.