2131{
2133
2135
2137
2144
2145
2146
2152
2158
2160
2164
2165
2167 {
2169
2170
2171 RegisterNetSyncVariableInt( "m_SyncParts01" );
2172 RegisterNetSyncVariableInt( "m_SyncParts02" );
2173 RegisterNetSyncVariableInt( "m_SyncParts03" );
2174 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2175 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2176 RegisterNetSyncVariableBool( "m_HasBase" );
2177
2178
2179 ConstructionInit();
2180
2181 if (ConfigIsExisting("hybridAttachments"))
2182 {
2185 }
2186 if (ConfigIsExisting("mountables"))
2187 {
2190 }
2191
2193 SetAllowDamage(true);
2194 }
2195
2197 {
2198 return "disableBaseDamage";
2199 }
2200
2202 {
2203 return true;
2204 }
2205
2207 {
2208 return EInventoryIconVisibility.HIDE_VICINITY;
2209 }
2210
2212 {
2213 super.InitItemSounds();
2214
2218
2223 }
2224
2226 {
2227 return "putDown_FenceKit_SoundSet";
2228 }
2229
2231 {
2232 return "Shelter_Site_Build_Loop_SoundSet";
2233 }
2234
2235
2237 {
2239 {
2240 SetSynchDirty();
2241 }
2242 }
2243
2245 {
2247 super.OnVariablesSynchronized();
2248
2250 }
2251
2253 {
2254
2256
2257
2259
2260
2262 }
2263
2264
2266 {
2267
2268 int offset;
2269 int mask;
2270
2271 if ( part_id >= 1 && part_id <= 31 )
2272 {
2273 offset = part_id - 1;
2274 mask = 1 << offset;
2275
2277 }
2278 else if ( part_id >= 32 && part_id <= 62 )
2279 {
2280 offset = ( part_id % 32 );
2281 mask = 1 << offset;
2282
2284 }
2285 else if ( part_id >= 63 && part_id <= 93 )
2286 {
2287 offset = ( part_id % 63 );
2288 mask = 1 << offset;
2289
2291 }
2292 }
2293
2295 {
2296
2297 int offset;
2298 int mask;
2299
2300 if ( part_id >= 1 && part_id <= 31 )
2301 {
2302 offset = part_id - 1;
2303 mask = 1 << offset;
2304
2306 }
2307 else if ( part_id >= 32 && part_id <= 62 )
2308 {
2309 offset = ( part_id % 32 );
2310 mask = 1 << offset;
2311
2313 }
2314 else if ( part_id >= 63 && part_id <= 93 )
2315 {
2316 offset = ( part_id % 63 );
2317 mask = 1 << offset;
2318
2320 }
2321 }
2322
2324 {
2325
2326 int offset;
2327 int mask;
2328
2329 if ( part_id >= 1 && part_id <= 31 )
2330 {
2331 offset = part_id - 1;
2332 mask = 1 << offset;
2333
2335 {
2336 return true;
2337 }
2338 }
2339 else if ( part_id >= 32 && part_id <= 62 )
2340 {
2341 offset = ( part_id % 32 );
2342 mask = 1 << offset;
2343
2345 {
2346 return true;
2347 }
2348 }
2349 else if ( part_id >= 63 && part_id <= 93 )
2350 {
2351 offset = ( part_id % 63 );
2352 mask = 1 << offset;
2353
2355 {
2356 return true;
2357 }
2358 }
2359
2360 return false;
2361 }
2362
2364 {
2367 }
2368
2370 {
2371
2374 }
2375
2377 {
2379 {
2382
2383 switch( build_action_id )
2384 {
2388 }
2389 }
2390 }
2391
2392
2394 {
2396 bool is_base = part.
IsBase();
2399 if ( is_part_built_sync )
2400 {
2402 {
2406
2407 if (is_base)
2408 {
2411 }
2412 }
2413 }
2414 else
2415 {
2417 {
2421
2422 if (is_base)
2423 {
2426 }
2427 }
2428 }
2429
2430
2432 }
2433
2434
2436 {
2439
2440 for ( int i = 0; i < construction_parts.Count(); ++i )
2441 {
2442 string key = construction_parts.GetKey( i );
2445 }
2446
2447
2449 }
2450
2452 {
2455
2456 for ( int i = 0; i < construction_parts.Count(); ++i )
2457 {
2458 string key = construction_parts.GetKey( i );
2460
2461 if ( value.
GetId() ==
id )
2462 {
2463 return value;
2464 }
2465 }
2466
2467 return NULL;
2468 }
2469
2470
2471
2473 {
2475 }
2476
2478 {
2480 }
2481
2483 {
2484 return true;
2485 }
2486
2488 {
2489 return false;
2490 }
2491
2492
2494 {
2497 {
2499 }
2500
2501 return construction_kit;
2502 }
2503
2505 {
2508 {
2510 }
2511 }
2512
2514 {
2516 }
2517
2519 {
2520 return "";
2521 }
2522
2524 {
2526 g_Game.ObjectDelete( construction_kit );
2527 }
2528
2529
2531 {
2533 g_Game.ObjectDelete(
this );
2534 }
2535
2536
2538 {
2539 super.EEDelete(parent);
2540
2542 {
2543 areaDamage.Destroy();
2544 }
2545
2546 }
2547
2549 {
2550 super.OnStoreSave( ctx );
2551
2552
2556
2558 }
2559
2561 {
2562 if ( !super.OnStoreLoad( ctx, version ) )
2563 return false;
2564
2565
2566
2568 {
2570 return false;
2571 }
2573 {
2575 return false;
2576 }
2578 {
2580 return false;
2581 }
2582
2583
2585 {
2587 return false;
2588 }
2589
2590
2591 return true;
2592 }
2593
2595 {
2596 super.AfterStoreLoad();
2597
2599 {
2601 }
2602 }
2603
2605 {
2606
2608
2609
2612
2613
2615 }
2616
2618 {
2619 super.OnCreatePhysics();
2620
2621 ConstructionInit();
2623 }
2624
2626 {
2628 return;
2629
2630 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2631 }
2632
2634 {
2636 {
2638 }
2639
2640 super.EEOnAfterLoad();
2641 }
2642
2644 {
2645 super.EEItemAttached( item, slot_name );
2646
2650 }
2651
2653 {
2654 super.EEItemDetached( item, slot_name );
2655
2658 }
2659
2660 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2661 {
2664
2667 }
2668
2669
2671 {
2672 return true;
2673 }
2674
2675
2676
2678 {
2680
2681
2682 if (construtionPart.
IsBase())
2683 {
2685
2686
2688 }
2689
2690
2692
2693
2695
2696
2698
2700
2702
2703
2705
2706
2708 }
2709
2711 {
2712
2714 }
2715
2716
2718 {
2721
2722
2724
2725
2727
2728
2730
2731
2733
2735
2736
2738
2739
2741
2742
2743 if (construtionPart.
IsBase())
2744 {
2745
2747 }
2748 }
2749
2751 {
2752
2754 }
2755
2756
2757 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2758 {
2761
2762
2764
2765
2767
2768
2770
2771
2773
2775
2776
2778
2779
2781
2782
2783 if (construtionPart.
IsBase())
2784 {
2785
2787 }
2788 }
2789
2791 {
2792
2794 }
2795
2796
2798 {
2800
2803 }
2804
2806 {
2808
2810 {
2812 }
2813 else
2814 {
2816 }
2817
2819 }
2820
2822 {
2824
2826 foreach (
string slotName : attachmentSlots)
2827 {
2829 }
2830
2831
2834 else
2836
2838 }
2839
2841 {
2842 string slotNameMounted = slot_name + "_Mounted";
2843 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2844
2845 if (attachment)
2846 {
2847 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2848 if (barbedWire && barbedWire.IsMounted())
2850 else
2852
2853 if (is_locked)
2854 {
2855 SetAnimationPhase(slotNameMounted, 0);
2856 SetAnimationPhase(slot_name, 1);
2857 }
2858 else
2859 {
2860 SetAnimationPhase(slotNameMounted, 1);
2861 SetAnimationPhase(slot_name, 0);
2862 }
2863 }
2864 else
2865 {
2866 SetAnimationPhase(slotNameMounted, 1);
2867 SetAnimationPhase(slot_name, 1);
2868
2870 }
2871 }
2872
2873
2875 {
2878
2881
2884
2885 foreach (
string slotName : attachmentSlots)
2886 {
2888 }
2889
2890
2892 {
2895
2897 }
2898 else
2899 {
2902
2904 }
2905
2908 }
2909
2911 {
2912
2914 return;
2915
2916 string slot_name_mounted = slot_name + "_Mounted";
2917 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2918
2919
2921 RemoveProxyPhysics( slot_name_mounted );
2922 RemoveProxyPhysics( slot_name );
2923
2924 if ( attachment )
2925 {
2927 if ( is_locked )
2928 {
2930 AddProxyPhysics( slot_name_mounted );
2931 }
2932 else
2933 {
2935 AddProxyPhysics( slot_name );
2936 }
2937 }
2938 }
2939
2941 {
2942 SetAffectPathgraph( true, false );
2944 }
2945
2947 {
2948 return true;
2949 }
2950
2952 {
2953 return true;
2954 }
2955
2957 {
2958 if ( attachment )
2959 {
2961 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2962
2963 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2964 }
2965
2966 return false;
2967 }
2968
2970 {
2972 }
2973
2974
2976 {
2977 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2978 if (
g_Game.ConfigIsExisting( config_path ) )
2979 {
2980 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2981 }
2982 }
2983
2985 {
2986 return true;
2987 }
2988
2990 {
2991 return true;
2992 }
2993
2995 {
2996 return true;
2997 }
2998
2999
3001 {
3004 }
3005
3007 {
3009 }
3010
3012 {
3014 }
3015
3017 {
3018 int attachment_count = GetInventory().AttachmentCount();
3019 if ( attachment_count > 0 )
3020 {
3021 if (
HasBase() && attachment_count == 1 )
3022 {
3023 return false;
3024 }
3025
3026 return true;
3027 }
3028
3029 return false;
3030 }
3031
3033 {
3034 return true;
3035 }
3036
3038 {
3039 return false;
3040 }
3041
3042
3044 {
3045 return false;
3046 }
3047
3049 {
3050 return false;
3051 }
3052
3053
3055 {
3056 return false;
3057 }
3058
3059
3060
3062 {
3063 return true;
3064 }
3065
3067 {
3068 return true;
3069 }
3070
3073 {
3074 return false;
3075 }
3076
3077
3079 {
3080 return false;
3081 }
3082
3083
3085 {
3086 return true;
3087 }
3088
3089
3091 {
3092 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3093 {
3094 return false;
3095 }
3096
3097 return true;
3098 }
3099
3101 {
3104
3105 return item;
3106 }
3107
3108
3110 {
3112 {
3113
3115
3116
3119
3121 if ( MemoryPointExists( slot_name + "_min" ) )
3122 {
3123 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3124 }
3125 if ( MemoryPointExists( slot_name + "_max" ) )
3126 {
3127 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3128 }
3129
3130
3133
3134
3137 center = ModelToWorld( center );
3138
3139
3142
3143 areaDamage.SetExtents( extents[0], extents[1] );
3144 areaDamage.SetAreaPosition( center );
3148 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3149 areaDamage.SetAmmoName( "BarbedWireHit" );
3150 areaDamage.Spawn();
3151
3153 }
3154 }
3155
3157 {
3158 if ( angle_deg != 0 )
3159 {
3160
3162
3163
3165 if ( MemoryPointExists( "rotate_axis" ) )
3166 {
3167 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3168 }
3169 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];
3170 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];
3171 center[0] = r_center_x;
3172 center[2] = r_center_z;
3173 }
3174 }
3175
3177 {
3179 {
3182 {
3183 if (areaDamage)
3184 {
3185 areaDamage.Destroy();
3186 }
3187
3189 }
3190 }
3191 }
3192
3194 {
3195 return true;
3196 }
3197
3198
3199
3200
3202 {
3204 }
3205
3207 {
3209 }
3210
3212 {
3214 }
3215
3217 {
3219
3220 switch ( material_type )
3221 {
3227 }
3228
3229 return "";
3230 }
3231
3233 {
3235
3236 switch ( material_type )
3237 {
3243 }
3244
3245 return "";
3246 }
3247
3248
3250 {
3252 {
3253
3255 {
3256 SetHealth(slot_name,"Health",item.GetHealth());
3257 }
3258 }
3259 }
3260
3262 {
3263 return 111;
3264 }
3265
3267 {
3268 super.SetActions();
3269
3273 }
3274
3276 {
3278 if (!construction)
3279 return;
3280
3282 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3283 {
3286 {
3288 }
3289 }
3290 }
3291
3293 {
3295 if (!construction)
3296 return;
3297
3299 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3300 {
3303 {
3304 construction.HandleEntityFalling(part.
GetPartName());
3305 }
3306 }
3307 }
3308
3311 {
3313 return;
3314
3317
3318 if (DestroyOnFall())
3319 {
3321 {
3323 }
3324 else
3325 {
3327 {
3329 }
3331 }
3332 }
3333 }
3334
3336 {
3337 if (HasAnyAttachmentsOrCargo())
3338 {
3341 }
3342 }
3343
3344
3345
3346
3347
3350 {
3351 return null;
3352 }
3353
3355 {
3357 }
3358
3360 {
3363
3364 Man p;
3365
3366 #ifdef SERVER
3368 g_Game.GetWorld().GetPlayerList(players);
3369 if (players.Count())
3370 p = players[0];
3371 #else
3373 #endif
3374
3376 {
3377 bool excluded = false;
3379 if (excludes)
3380 {
3381 foreach (string exclude : excludes)
3382 {
3384 {
3385 excluded = true;
3386 break;
3387 }
3388 }
3389 }
3390
3391 if (!excluded)
3392 {
3394 }
3395 }
3396
3398 }
3399
3401
3403 [
Obsolete(
"handled in the Construction component directly")]
3405 {
3406 }
3407
3408 [
Obsolete(
"handled in the Construction component directly")]
3410 {
3411 }
3412
3413 [
Obsolete(
"obsolete debug method")]
3415 {
3416 }
3417}
3418
3420{
3421#ifdef BSB_DEBUG
3423#else
3424
3425#endif
3426}
3428{
3429#ifdef BSB_DEBUG_SPAM
3431#else
3432
3433#endif
3434}
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.