2146{
2148
2150
2152
2159
2160
2161
2167
2173
2175
2179
2180
2182 {
2184
2185
2186 RegisterNetSyncVariableInt( "m_SyncParts01" );
2187 RegisterNetSyncVariableInt( "m_SyncParts02" );
2188 RegisterNetSyncVariableInt( "m_SyncParts03" );
2189 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2190 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2191 RegisterNetSyncVariableBool( "m_HasBase" );
2192
2193
2194 ConstructionInit();
2195
2196 if (ConfigIsExisting("hybridAttachments"))
2197 {
2200 }
2201 if (ConfigIsExisting("mountables"))
2202 {
2205 }
2206
2208 SetAllowDamage(true);
2209 }
2210
2212 {
2213 return "disableBaseDamage";
2214 }
2215
2217 {
2218 return true;
2219 }
2220
2222 {
2223 return EInventoryIconVisibility.HIDE_VICINITY;
2224 }
2225
2227 {
2228 super.InitItemSounds();
2229
2233
2238 }
2239
2241 {
2242 return "putDown_FenceKit_SoundSet";
2243 }
2244
2246 {
2247 return "Shelter_Site_Build_Loop_SoundSet";
2248 }
2249
2250
2252 {
2254 {
2255 SetSynchDirty();
2256 }
2257 }
2258
2260 {
2262 super.OnVariablesSynchronized();
2263
2265 }
2266
2268 {
2269
2271
2272
2274
2275
2277 }
2278
2279
2281 {
2282
2283 int offset;
2284 int mask;
2285
2286 if ( part_id >= 1 && part_id <= 31 )
2287 {
2288 offset = part_id - 1;
2289 mask = 1 << offset;
2290
2292 }
2293 else if ( part_id >= 32 && part_id <= 62 )
2294 {
2295 offset = ( part_id % 32 );
2296 mask = 1 << offset;
2297
2299 }
2300 else if ( part_id >= 63 && part_id <= 93 )
2301 {
2302 offset = ( part_id % 63 );
2303 mask = 1 << offset;
2304
2306 }
2307 }
2308
2310 {
2311
2312 int offset;
2313 int mask;
2314
2315 if ( part_id >= 1 && part_id <= 31 )
2316 {
2317 offset = part_id - 1;
2318 mask = 1 << offset;
2319
2321 }
2322 else if ( part_id >= 32 && part_id <= 62 )
2323 {
2324 offset = ( part_id % 32 );
2325 mask = 1 << offset;
2326
2328 }
2329 else if ( part_id >= 63 && part_id <= 93 )
2330 {
2331 offset = ( part_id % 63 );
2332 mask = 1 << offset;
2333
2335 }
2336 }
2337
2339 {
2340
2341 int offset;
2342 int mask;
2343
2344 if ( part_id >= 1 && part_id <= 31 )
2345 {
2346 offset = part_id - 1;
2347 mask = 1 << offset;
2348
2350 {
2351 return true;
2352 }
2353 }
2354 else if ( part_id >= 32 && part_id <= 62 )
2355 {
2356 offset = ( part_id % 32 );
2357 mask = 1 << offset;
2358
2360 {
2361 return true;
2362 }
2363 }
2364 else if ( part_id >= 63 && part_id <= 93 )
2365 {
2366 offset = ( part_id % 63 );
2367 mask = 1 << offset;
2368
2370 {
2371 return true;
2372 }
2373 }
2374
2375 return false;
2376 }
2377
2379 {
2382 }
2383
2385 {
2386
2389 }
2390
2392 {
2394 {
2397
2398 switch( build_action_id )
2399 {
2403 }
2404 }
2405 }
2406
2407
2409 {
2411 bool is_base = part.
IsBase();
2414 if ( is_part_built_sync )
2415 {
2417 {
2421
2422 if (is_base)
2423 {
2426 }
2427 }
2428 }
2429 else
2430 {
2432 {
2436
2437 if (is_base)
2438 {
2441 }
2442 }
2443 }
2444
2445
2447 }
2448
2449
2451 {
2454
2455 for ( int i = 0; i < construction_parts.Count(); ++i )
2456 {
2457 string key = construction_parts.GetKey( i );
2460 }
2461
2462
2464 }
2465
2467 {
2470
2471 for ( int i = 0; i < construction_parts.Count(); ++i )
2472 {
2473 string key = construction_parts.GetKey( i );
2475
2476 if ( value.
GetId() ==
id )
2477 {
2478 return value;
2479 }
2480 }
2481
2482 return NULL;
2483 }
2484
2485
2486
2488 {
2490 }
2491
2493 {
2495 }
2496
2498 {
2499 return true;
2500 }
2501
2503 {
2504 return false;
2505 }
2506
2507
2509 {
2512 {
2514 }
2515
2516 return construction_kit;
2517 }
2518
2520 {
2523 {
2525 }
2526 }
2527
2529 {
2531 }
2532
2534 {
2535 return "";
2536 }
2537
2539 {
2541 g_Game.ObjectDelete( construction_kit );
2542 }
2543
2544
2546 {
2548 g_Game.ObjectDelete(
this );
2549 }
2550
2551
2553 {
2554 super.EEDelete(parent);
2555
2557 {
2558 areaDamage.Destroy();
2559 }
2560
2561 }
2562
2564 {
2565 super.OnStoreSave( ctx );
2566
2567
2571
2573 }
2574
2576 {
2577 if ( !super.OnStoreLoad( ctx, version ) )
2578 return false;
2579
2580
2581
2583 {
2585 return false;
2586 }
2588 {
2590 return false;
2591 }
2593 {
2595 return false;
2596 }
2597
2598
2600 {
2602 return false;
2603 }
2604
2605
2606 return true;
2607 }
2608
2610 {
2611 super.AfterStoreLoad();
2612
2614 {
2616 }
2617 }
2618
2620 {
2621
2623
2624
2627
2628
2630 }
2631
2633 {
2634 super.OnCreatePhysics();
2635
2636 ConstructionInit();
2638 }
2639
2641 {
2643 return;
2644
2645 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2646 }
2647
2649 {
2651 {
2653 }
2654
2655 super.EEOnAfterLoad();
2656 }
2657
2659 {
2660 super.EEItemAttached( item, slot_name );
2661
2665 }
2666
2668 {
2669 super.EEItemDetached( item, slot_name );
2670
2673 }
2674
2675 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2676 {
2679
2682 }
2683
2684
2686 {
2687 return true;
2688 }
2689
2690
2691
2693 {
2695
2696
2697 if (construtionPart.
IsBase())
2698 {
2700
2701
2703 }
2704
2705
2707
2708
2710
2711
2713
2715
2717
2718
2720
2721
2723 }
2724
2726 {
2727
2729 }
2730
2731
2733 {
2736
2737
2739
2740
2742
2743
2745
2746
2748
2750
2751
2753
2754
2756
2757
2758 if (construtionPart.
IsBase())
2759 {
2760
2762 }
2763 }
2764
2766 {
2767
2769 }
2770
2771
2772 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2773 {
2776
2777
2779
2780
2782
2783
2785
2786
2788
2790
2791
2793
2794
2796
2797
2798 if (construtionPart.
IsBase())
2799 {
2800
2802 }
2803 }
2804
2806 {
2807
2809 }
2810
2811
2813 {
2815
2818 }
2819
2821 {
2823
2825 {
2827 }
2828 else
2829 {
2831 }
2832
2834 }
2835
2837 {
2839
2841 foreach (
string slotName : attachmentSlots)
2842 {
2844 }
2845
2846
2849 else
2851
2853 }
2854
2856 {
2857 string slotNameMounted = slot_name + "_Mounted";
2858 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2859
2860 if (attachment)
2861 {
2862 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2863 if (barbedWire && barbedWire.IsMounted())
2865 else
2867
2868 if (is_locked)
2869 {
2870 SetAnimationPhase(slotNameMounted, 0);
2871 SetAnimationPhase(slot_name, 1);
2872 }
2873 else
2874 {
2875 SetAnimationPhase(slotNameMounted, 1);
2876 SetAnimationPhase(slot_name, 0);
2877 }
2878 }
2879 else
2880 {
2881 SetAnimationPhase(slotNameMounted, 1);
2882 SetAnimationPhase(slot_name, 1);
2883
2885 }
2886 }
2887
2888
2890 {
2893
2896
2899
2900 foreach (
string slotName : attachmentSlots)
2901 {
2903 }
2904
2905
2907 {
2910
2912 }
2913 else
2914 {
2917
2919 }
2920
2923 }
2924
2926 {
2927
2929 return;
2930
2931 string slot_name_mounted = slot_name + "_Mounted";
2932 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2933
2934
2936 RemoveProxyPhysics( slot_name_mounted );
2937 RemoveProxyPhysics( slot_name );
2938
2939 if ( attachment )
2940 {
2942 if ( is_locked )
2943 {
2945 AddProxyPhysics( slot_name_mounted );
2946 }
2947 else
2948 {
2950 AddProxyPhysics( slot_name );
2951 }
2952 }
2953 }
2954
2956 {
2957 SetAffectPathgraph( true, false );
2959 }
2960
2962 {
2963 return true;
2964 }
2965
2967 {
2968 return true;
2969 }
2970
2972 {
2973 if ( attachment )
2974 {
2976 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2977
2978 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2979 }
2980
2981 return false;
2982 }
2983
2985 {
2987 }
2988
2989
2991 {
2992 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2993 if (
g_Game.ConfigIsExisting( config_path ) )
2994 {
2995 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2996 }
2997 }
2998
3000 {
3001 return true;
3002 }
3003
3005 {
3006 return true;
3007 }
3008
3010 {
3011 return true;
3012 }
3013
3014
3016 {
3019 }
3020
3022 {
3024 }
3025
3027 {
3029 }
3030
3032 {
3033 int attachment_count = GetInventory().AttachmentCount();
3034 if ( attachment_count > 0 )
3035 {
3036 if (
HasBase() && attachment_count == 1 )
3037 {
3038 return false;
3039 }
3040
3041 return true;
3042 }
3043
3044 return false;
3045 }
3046
3048 {
3049 return true;
3050 }
3051
3053 {
3054 return false;
3055 }
3056
3057
3059 {
3060 return false;
3061 }
3062
3064 {
3065 return false;
3066 }
3067
3068
3070 {
3071 return false;
3072 }
3073
3074
3075
3077 {
3078 return true;
3079 }
3080
3082 {
3083 return true;
3084 }
3085
3088 {
3089 return false;
3090 }
3091
3092
3094 {
3095 return false;
3096 }
3097
3098
3100 {
3101 return true;
3102 }
3103
3104
3106 {
3107 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3108 {
3109 return false;
3110 }
3111
3112 return true;
3113 }
3114
3116 {
3119
3120 return item;
3121 }
3122
3123
3125 {
3127 {
3128
3130
3131
3134
3136 if ( MemoryPointExists( slot_name + "_min" ) )
3137 {
3138 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3139 }
3140 if ( MemoryPointExists( slot_name + "_max" ) )
3141 {
3142 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3143 }
3144
3145
3148
3149
3152 center = ModelToWorld( center );
3153
3154
3157
3158 areaDamage.SetExtents( extents[0], extents[1] );
3159 areaDamage.SetAreaPosition( center );
3163 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3164 areaDamage.SetAmmoName( "BarbedWireHit" );
3165 areaDamage.Spawn();
3166
3168 }
3169 }
3170
3172 {
3173 if ( angle_deg != 0 )
3174 {
3175
3177
3178
3180 if ( MemoryPointExists( "rotate_axis" ) )
3181 {
3182 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3183 }
3184 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];
3185 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];
3186 center[0] = r_center_x;
3187 center[2] = r_center_z;
3188 }
3189 }
3190
3192 {
3194 {
3197 {
3198 if (areaDamage)
3199 {
3200 areaDamage.Destroy();
3201 }
3202
3204 }
3205 }
3206 }
3207
3209 {
3210 return true;
3211 }
3212
3213
3214
3215
3217 {
3219 }
3220
3222 {
3224 }
3225
3227 {
3229 }
3230
3232 {
3234
3235 switch ( material_type )
3236 {
3242 }
3243
3244 return "";
3245 }
3246
3248 {
3250
3251 switch ( material_type )
3252 {
3258 }
3259
3260 return "";
3261 }
3262
3263
3265 {
3267 {
3268
3270 {
3271 SetHealth(slot_name,"Health",item.GetHealth());
3272 }
3273 }
3274 }
3275
3277 {
3278 return 111;
3279 }
3280
3282 {
3283 super.SetActions();
3284
3288 }
3289
3291 {
3293 if (!construction)
3294 return;
3295
3297 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3298 {
3301 {
3303 }
3304 }
3305 }
3306
3308 {
3310 if (!construction)
3311 return;
3312
3314 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3315 {
3318 {
3319 construction.HandleEntityFalling(part.
GetPartName());
3320 }
3321 }
3322 }
3323
3326 {
3328 return;
3329
3332
3333 if (DestroyOnFall())
3334 {
3336 {
3338 }
3339 else
3340 {
3342 {
3344 }
3346 }
3347 }
3348 }
3349
3351 {
3352 if (HasAnyAttachmentsOrCargo())
3353 {
3356 }
3357 }
3358
3359
3360
3361
3362
3365 {
3366 return null;
3367 }
3368
3370 {
3372 }
3373
3375 {
3378
3379 Man p;
3380
3381 #ifdef SERVER
3383 g_Game.GetWorld().GetPlayerList(players);
3384 if (players.Count())
3385 p = players[0];
3386 #else
3388 #endif
3389
3391 {
3392 bool excluded = false;
3394 if (excludes)
3395 {
3396 foreach (string exclude : excludes)
3397 {
3399 {
3400 excluded = true;
3401 break;
3402 }
3403 }
3404 }
3405
3406 if (!excluded)
3407 {
3409 }
3410 }
3411
3413 }
3414
3416
3418 [
Obsolete(
"handled in the Construction component directly")]
3420 {
3421 }
3422
3423 [
Obsolete(
"handled in the Construction component directly")]
3425 {
3426 }
3427
3428 [
Obsolete(
"obsolete debug method")]
3430 {
3431 }
3432}
3433
3435{
3436#ifdef BSB_DEBUG
3438#else
3439
3440#endif
3441}
3443{
3444#ifdef BSB_DEBUG_SPAM
3446#else
3447
3448#endif
3449}
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.