2137{
2139
2141
2143
2150
2151
2152
2158
2164
2166
2170
2171
2173 {
2175
2176
2177 RegisterNetSyncVariableInt( "m_SyncParts01" );
2178 RegisterNetSyncVariableInt( "m_SyncParts02" );
2179 RegisterNetSyncVariableInt( "m_SyncParts03" );
2180 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2181 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2182 RegisterNetSyncVariableBool( "m_HasBase" );
2183
2184
2185 ConstructionInit();
2186
2187 if (ConfigIsExisting("hybridAttachments"))
2188 {
2191 }
2192 if (ConfigIsExisting("mountables"))
2193 {
2196 }
2197
2199 SetAllowDamage(true);
2200 }
2201
2203 {
2204 return "disableBaseDamage";
2205 }
2206
2208 {
2209 return true;
2210 }
2211
2213 {
2214 return EInventoryIconVisibility.HIDE_VICINITY;
2215 }
2216
2218 {
2219 super.InitItemSounds();
2220
2224
2229 }
2230
2232 {
2233 return "putDown_FenceKit_SoundSet";
2234 }
2235
2237 {
2238 return "Shelter_Site_Build_Loop_SoundSet";
2239 }
2240
2241
2243 {
2245 {
2246 SetSynchDirty();
2247 }
2248 }
2249
2251 {
2253 super.OnVariablesSynchronized();
2254
2256 }
2257
2259 {
2260
2262
2263
2265
2266
2268 }
2269
2270
2272 {
2273
2274 int offset;
2275 int mask;
2276
2277 if ( part_id >= 1 && part_id <= 31 )
2278 {
2279 offset = part_id - 1;
2280 mask = 1 << offset;
2281
2283 }
2284 else if ( part_id >= 32 && part_id <= 62 )
2285 {
2286 offset = ( part_id % 32 );
2287 mask = 1 << offset;
2288
2290 }
2291 else if ( part_id >= 63 && part_id <= 93 )
2292 {
2293 offset = ( part_id % 63 );
2294 mask = 1 << offset;
2295
2297 }
2298 }
2299
2301 {
2302
2303 int offset;
2304 int mask;
2305
2306 if ( part_id >= 1 && part_id <= 31 )
2307 {
2308 offset = part_id - 1;
2309 mask = 1 << offset;
2310
2312 }
2313 else if ( part_id >= 32 && part_id <= 62 )
2314 {
2315 offset = ( part_id % 32 );
2316 mask = 1 << offset;
2317
2319 }
2320 else if ( part_id >= 63 && part_id <= 93 )
2321 {
2322 offset = ( part_id % 63 );
2323 mask = 1 << offset;
2324
2326 }
2327 }
2328
2330 {
2331
2332 int offset;
2333 int mask;
2334
2335 if ( part_id >= 1 && part_id <= 31 )
2336 {
2337 offset = part_id - 1;
2338 mask = 1 << offset;
2339
2341 {
2342 return true;
2343 }
2344 }
2345 else if ( part_id >= 32 && part_id <= 62 )
2346 {
2347 offset = ( part_id % 32 );
2348 mask = 1 << offset;
2349
2351 {
2352 return true;
2353 }
2354 }
2355 else if ( part_id >= 63 && part_id <= 93 )
2356 {
2357 offset = ( part_id % 63 );
2358 mask = 1 << offset;
2359
2361 {
2362 return true;
2363 }
2364 }
2365
2366 return false;
2367 }
2368
2370 {
2373 }
2374
2376 {
2377
2380 }
2381
2383 {
2385 {
2388
2389 switch( build_action_id )
2390 {
2394 }
2395 }
2396 }
2397
2398
2400 {
2402 bool is_base = part.
IsBase();
2405 if ( is_part_built_sync )
2406 {
2408 {
2412
2413 if (is_base)
2414 {
2417 }
2418 }
2419 }
2420 else
2421 {
2423 {
2427
2428 if (is_base)
2429 {
2432 }
2433 }
2434 }
2435
2436
2438 }
2439
2440
2442 {
2445
2446 for ( int i = 0; i < construction_parts.Count(); ++i )
2447 {
2448 string key = construction_parts.GetKey( i );
2451 }
2452
2453
2455 }
2456
2458 {
2461
2462 for ( int i = 0; i < construction_parts.Count(); ++i )
2463 {
2464 string key = construction_parts.GetKey( i );
2466
2467 if ( value.
GetId() ==
id )
2468 {
2469 return value;
2470 }
2471 }
2472
2473 return NULL;
2474 }
2475
2476
2477
2479 {
2481 }
2482
2484 {
2486 }
2487
2489 {
2490 return true;
2491 }
2492
2494 {
2495 return false;
2496 }
2497
2498
2500 {
2503 {
2505 }
2506
2507 return construction_kit;
2508 }
2509
2511 {
2514 {
2516 }
2517 }
2518
2520 {
2522 }
2523
2525 {
2526 return "";
2527 }
2528
2530 {
2532 g_Game.ObjectDelete( construction_kit );
2533 }
2534
2535
2537 {
2539 g_Game.ObjectDelete(
this );
2540 }
2541
2542
2544 {
2545 super.EEDelete(parent);
2546
2548 {
2549 areaDamage.Destroy();
2550 }
2551
2552 }
2553
2555 {
2556 super.OnStoreSave( ctx );
2557
2558
2562
2564 }
2565
2567 {
2568 if ( !super.OnStoreLoad( ctx, version ) )
2569 return false;
2570
2571
2572
2574 {
2576 return false;
2577 }
2579 {
2581 return false;
2582 }
2584 {
2586 return false;
2587 }
2588
2589
2591 {
2593 return false;
2594 }
2595
2596
2597 return true;
2598 }
2599
2601 {
2602 super.AfterStoreLoad();
2603
2605 {
2607 }
2608 }
2609
2611 {
2612
2614
2615
2618
2619
2621 }
2622
2624 {
2625 super.OnCreatePhysics();
2626
2627 ConstructionInit();
2629 }
2630
2632 {
2634 return;
2635
2636 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2637 }
2638
2640 {
2642 {
2644 }
2645
2646 super.EEOnAfterLoad();
2647 }
2648
2650 {
2651 super.EEItemAttached( item, slot_name );
2652
2656 }
2657
2659 {
2660 super.EEItemDetached( item, slot_name );
2661
2664 }
2665
2666 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2667 {
2670
2673 }
2674
2675
2677 {
2678 return true;
2679 }
2680
2681
2682
2684 {
2686
2687
2688 if (construtionPart.
IsBase())
2689 {
2691
2692
2694 }
2695
2696
2698
2699
2701
2702
2704
2706
2708
2709
2711
2712
2714 }
2715
2717 {
2718
2720 }
2721
2722
2724 {
2727
2728
2730
2731
2733
2734
2736
2737
2739
2741
2742
2744
2745
2747
2748
2749 if (construtionPart.
IsBase())
2750 {
2751
2753 }
2754 }
2755
2757 {
2758
2760 }
2761
2762
2763 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2764 {
2767
2768
2770
2771
2773
2774
2776
2777
2779
2781
2782
2784
2785
2787
2788
2789 if (construtionPart.
IsBase())
2790 {
2791
2793 }
2794 }
2795
2797 {
2798
2800 }
2801
2802
2804 {
2806
2809 }
2810
2812 {
2814
2816 {
2818 }
2819 else
2820 {
2822 }
2823
2825 }
2826
2828 {
2830
2832 foreach (
string slotName : attachmentSlots)
2833 {
2835 }
2836
2837
2840 else
2842
2844 }
2845
2847 {
2848 string slotNameMounted = slot_name + "_Mounted";
2849 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2850
2851 if (attachment)
2852 {
2853 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2854 if (barbedWire && barbedWire.IsMounted())
2856 else
2858
2859 if (is_locked)
2860 {
2861 SetAnimationPhase(slotNameMounted, 0);
2862 SetAnimationPhase(slot_name, 1);
2863 }
2864 else
2865 {
2866 SetAnimationPhase(slotNameMounted, 1);
2867 SetAnimationPhase(slot_name, 0);
2868 }
2869 }
2870 else
2871 {
2872 SetAnimationPhase(slotNameMounted, 1);
2873 SetAnimationPhase(slot_name, 1);
2874
2876 }
2877 }
2878
2879
2881 {
2884
2887
2890
2891 foreach (
string slotName : attachmentSlots)
2892 {
2894 }
2895
2896
2898 {
2901
2903 }
2904 else
2905 {
2908
2910 }
2911
2914 }
2915
2917 {
2918
2920 return;
2921
2922 string slot_name_mounted = slot_name + "_Mounted";
2923 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2924
2925
2927 RemoveProxyPhysics( slot_name_mounted );
2928 RemoveProxyPhysics( slot_name );
2929
2930 if ( attachment )
2931 {
2933 if ( is_locked )
2934 {
2936 AddProxyPhysics( slot_name_mounted );
2937 }
2938 else
2939 {
2941 AddProxyPhysics( slot_name );
2942 }
2943 }
2944 }
2945
2947 {
2948 SetAffectPathgraph( true, false );
2950 }
2951
2953 {
2954 return true;
2955 }
2956
2958 {
2959 return true;
2960 }
2961
2963 {
2964 if ( attachment )
2965 {
2967 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2968
2969 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2970 }
2971
2972 return false;
2973 }
2974
2976 {
2978 }
2979
2980
2982 {
2983 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2984 if (
g_Game.ConfigIsExisting( config_path ) )
2985 {
2986 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2987 }
2988 }
2989
2991 {
2992 return true;
2993 }
2994
2996 {
2997 return true;
2998 }
2999
3001 {
3002 return true;
3003 }
3004
3005
3007 {
3010 }
3011
3013 {
3015 }
3016
3018 {
3020 }
3021
3023 {
3024 int attachment_count = GetInventory().AttachmentCount();
3025 if ( attachment_count > 0 )
3026 {
3027 if (
HasBase() && attachment_count == 1 )
3028 {
3029 return false;
3030 }
3031
3032 return true;
3033 }
3034
3035 return false;
3036 }
3037
3039 {
3040 return true;
3041 }
3042
3044 {
3045 return false;
3046 }
3047
3048
3050 {
3051 return false;
3052 }
3053
3055 {
3056 return false;
3057 }
3058
3059
3061 {
3062 return false;
3063 }
3064
3065
3066
3068 {
3069 return true;
3070 }
3071
3073 {
3074 return true;
3075 }
3076
3079 {
3080 return false;
3081 }
3082
3083
3085 {
3086 return false;
3087 }
3088
3089
3091 {
3092 return true;
3093 }
3094
3095
3097 {
3098 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3099 {
3100 return false;
3101 }
3102
3103 return true;
3104 }
3105
3107 {
3110
3111 return item;
3112 }
3113
3114
3116 {
3118 {
3119
3121
3122
3125
3127 if ( MemoryPointExists( slot_name + "_min" ) )
3128 {
3129 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3130 }
3131 if ( MemoryPointExists( slot_name + "_max" ) )
3132 {
3133 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3134 }
3135
3136
3139
3140
3143 center = ModelToWorld( center );
3144
3145
3148
3149 areaDamage.SetExtents( extents[0], extents[1] );
3150 areaDamage.SetAreaPosition( center );
3154 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3155 areaDamage.SetAmmoName( "BarbedWireHit" );
3156 areaDamage.Spawn();
3157
3159 }
3160 }
3161
3163 {
3164 if ( angle_deg != 0 )
3165 {
3166
3168
3169
3171 if ( MemoryPointExists( "rotate_axis" ) )
3172 {
3173 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3174 }
3175 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];
3176 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];
3177 center[0] = r_center_x;
3178 center[2] = r_center_z;
3179 }
3180 }
3181
3183 {
3185 {
3188 {
3189 if (areaDamage)
3190 {
3191 areaDamage.Destroy();
3192 }
3193
3195 }
3196 }
3197 }
3198
3200 {
3201 return true;
3202 }
3203
3204
3205
3206
3208 {
3210 }
3211
3213 {
3215 }
3216
3218 {
3220 }
3221
3223 {
3225
3226 switch ( material_type )
3227 {
3233 }
3234
3235 return "";
3236 }
3237
3239 {
3241
3242 switch ( material_type )
3243 {
3249 }
3250
3251 return "";
3252 }
3253
3254
3256 {
3258 {
3259
3261 {
3262 SetHealth(slot_name,"Health",item.GetHealth());
3263 }
3264 }
3265 }
3266
3268 {
3269 return 111;
3270 }
3271
3273 {
3274 super.SetActions();
3275
3279 }
3280
3282 {
3284 if (!construction)
3285 return;
3286
3288 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3289 {
3292 {
3294 }
3295 }
3296 }
3297
3299 {
3301 if (!construction)
3302 return;
3303
3305 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3306 {
3309 {
3310 construction.HandleEntityFalling(part.
GetPartName());
3311 }
3312 }
3313 }
3314
3317 {
3319 return;
3320
3323
3324 if (DestroyOnFall())
3325 {
3327 {
3329 }
3330 else
3331 {
3333 {
3335 }
3337 }
3338 }
3339 }
3340
3342 {
3343 if (HasAnyAttachmentsOrCargo())
3344 {
3347 }
3348 }
3349
3350
3351
3352
3353
3356 {
3357 return null;
3358 }
3359
3361 {
3363 }
3364
3366 {
3369
3370 Man p;
3371
3372 #ifdef SERVER
3374 g_Game.GetWorld().GetPlayerList(players);
3375 if (players.Count())
3376 p = players[0];
3377 #else
3379 #endif
3380
3382 {
3383 bool excluded = false;
3385 if (excludes)
3386 {
3387 foreach (string exclude : excludes)
3388 {
3390 {
3391 excluded = true;
3392 break;
3393 }
3394 }
3395 }
3396
3397 if (!excluded)
3398 {
3400 }
3401 }
3402
3404 }
3405
3407
3409 [
Obsolete(
"handled in the Construction component directly")]
3411 {
3412 }
3413
3414 [
Obsolete(
"handled in the Construction component directly")]
3416 {
3417 }
3418
3419 [
Obsolete(
"obsolete debug method")]
3421 {
3422 }
3423}
3424
3426{
3427#ifdef BSB_DEBUG
3429#else
3430
3431#endif
3432}
3434{
3435#ifdef BSB_DEBUG_SPAM
3437#else
3438
3439#endif
3440}
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.