2108{
2110
2112
2114
2121
2122
2123
2129
2135
2137
2141
2142
2144 {
2146
2147
2148 RegisterNetSyncVariableInt( "m_SyncParts01" );
2149 RegisterNetSyncVariableInt( "m_SyncParts02" );
2150 RegisterNetSyncVariableInt( "m_SyncParts03" );
2151 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2152 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2153 RegisterNetSyncVariableBool( "m_HasBase" );
2154
2155
2156 ConstructionInit();
2157
2158 if (ConfigIsExisting("hybridAttachments"))
2159 {
2162 }
2163 if (ConfigIsExisting("mountables"))
2164 {
2167 }
2168
2170 SetAllowDamage(true);
2171 }
2172
2174 {
2175 return "disableBaseDamage";
2176 }
2177
2179 {
2180 return true;
2181 }
2182
2184 {
2185 return EInventoryIconVisibility.HIDE_VICINITY;
2186 }
2187
2189 {
2190 super.InitItemSounds();
2191
2195
2200 }
2201
2203 {
2204 return "putDown_FenceKit_SoundSet";
2205 }
2206
2208 {
2209 return "Shelter_Site_Build_Loop_SoundSet";
2210 }
2211
2212
2214 {
2216 {
2217 SetSynchDirty();
2218 }
2219 }
2220
2222 {
2224 super.OnVariablesSynchronized();
2225
2227 }
2228
2230 {
2231
2233
2234
2236
2237
2239 }
2240
2241
2243 {
2244
2245 int offset;
2246 int mask;
2247
2248 if ( part_id >= 1 && part_id <= 31 )
2249 {
2250 offset = part_id - 1;
2251 mask = 1 << offset;
2252
2254 }
2255 else if ( part_id >= 32 && part_id <= 62 )
2256 {
2257 offset = ( part_id % 32 );
2258 mask = 1 << offset;
2259
2261 }
2262 else if ( part_id >= 63 && part_id <= 93 )
2263 {
2264 offset = ( part_id % 63 );
2265 mask = 1 << offset;
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 return true;
2314 }
2315 }
2316 else if ( part_id >= 32 && part_id <= 62 )
2317 {
2318 offset = ( part_id % 32 );
2319 mask = 1 << offset;
2320
2322 {
2323 return true;
2324 }
2325 }
2326 else if ( part_id >= 63 && part_id <= 93 )
2327 {
2328 offset = ( part_id % 63 );
2329 mask = 1 << offset;
2330
2332 {
2333 return true;
2334 }
2335 }
2336
2337 return false;
2338 }
2339
2341 {
2344 }
2345
2347 {
2348
2351 }
2352
2354 {
2356 {
2359
2360 switch( build_action_id )
2361 {
2365 }
2366 }
2367 }
2368
2369
2371 {
2373 bool is_base = part.
IsBase();
2376 if ( is_part_built_sync )
2377 {
2379 {
2383
2384 if (is_base)
2385 {
2388 }
2389 }
2390 }
2391 else
2392 {
2394 {
2398
2399 if (is_base)
2400 {
2403 }
2404 }
2405 }
2406
2407
2409 }
2410
2411
2413 {
2416
2417 for ( int i = 0; i < construction_parts.Count(); ++i )
2418 {
2419 string key = construction_parts.GetKey( i );
2422 }
2423
2424
2426 }
2427
2429 {
2432
2433 for ( int i = 0; i < construction_parts.Count(); ++i )
2434 {
2435 string key = construction_parts.GetKey( i );
2437
2438 if ( value.
GetId() ==
id )
2439 {
2440 return value;
2441 }
2442 }
2443
2444 return NULL;
2445 }
2446
2447
2448
2450 {
2452 }
2453
2455 {
2457 }
2458
2460 {
2461 return true;
2462 }
2463
2465 {
2466 return false;
2467 }
2468
2469
2471 {
2474 {
2476 }
2477
2478 return construction_kit;
2479 }
2480
2482 {
2485 {
2487 }
2488 }
2489
2491 {
2493 }
2494
2496 {
2497 return "";
2498 }
2499
2501 {
2503 g_Game.ObjectDelete( construction_kit );
2504 }
2505
2506
2508 {
2510 g_Game.ObjectDelete(
this );
2511 }
2512
2513
2515 {
2516 super.EEDelete(parent);
2517
2519 {
2520 areaDamage.Destroy();
2521 }
2522
2523 }
2524
2526 {
2527 super.OnStoreSave( ctx );
2528
2529
2533
2535 }
2536
2538 {
2539 if ( !super.OnStoreLoad( ctx, version ) )
2540 return false;
2541
2542
2543
2545 {
2547 return false;
2548 }
2550 {
2552 return false;
2553 }
2555 {
2557 return false;
2558 }
2559
2560
2562 {
2564 return false;
2565 }
2566
2567
2568 return true;
2569 }
2570
2572 {
2573 super.AfterStoreLoad();
2574
2576 {
2578 }
2579 }
2580
2582 {
2583
2585
2586
2589
2590
2592 }
2593
2595 {
2596 super.OnCreatePhysics();
2597
2598 ConstructionInit();
2600 }
2601
2603 {
2605 return;
2606
2607 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2608 }
2609
2611 {
2613 {
2615 }
2616
2617 super.EEOnAfterLoad();
2618 }
2619
2621 {
2622 super.EEItemAttached( item, slot_name );
2623
2627 }
2628
2630 {
2631 super.EEItemDetached( item, slot_name );
2632
2635 }
2636
2637 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2638 {
2641
2644 }
2645
2646
2648 {
2649 return true;
2650 }
2651
2652
2653
2655 {
2657
2658
2659 if (construtionPart.
IsBase())
2660 {
2662
2663
2665 }
2666
2667
2669
2670
2672
2673
2675
2677
2679
2680
2682
2683
2685 }
2686
2688 {
2689
2691 }
2692
2693
2695 {
2698
2699
2701
2702
2704
2705
2707
2708
2710
2712
2713
2715
2716
2718
2719
2720 if (construtionPart.
IsBase())
2721 {
2722
2724 }
2725 }
2726
2728 {
2729
2731 }
2732
2733
2734 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2735 {
2738
2739
2741
2742
2744
2745
2747
2748
2750
2752
2753
2755
2756
2758
2759
2760 if (construtionPart.
IsBase())
2761 {
2762
2764 }
2765 }
2766
2768 {
2769
2771 }
2772
2773
2775 {
2777
2780 }
2781
2783 {
2785
2787 {
2789 }
2790 else
2791 {
2793 }
2794
2796 }
2797
2799 {
2801
2803 foreach (
string slotName : attachmentSlots)
2804 {
2806 }
2807
2808
2811 else
2813
2815 }
2816
2818 {
2819 string slotNameMounted = slot_name + "_Mounted";
2820 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2821
2822 if (attachment)
2823 {
2824 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2825 if (barbedWire && barbedWire.IsMounted())
2827 else
2829
2830 if (is_locked)
2831 {
2832 SetAnimationPhase(slotNameMounted, 0);
2833 SetAnimationPhase(slot_name, 1);
2834 }
2835 else
2836 {
2837 SetAnimationPhase(slotNameMounted, 1);
2838 SetAnimationPhase(slot_name, 0);
2839 }
2840 }
2841 else
2842 {
2843 SetAnimationPhase(slotNameMounted, 1);
2844 SetAnimationPhase(slot_name, 1);
2845
2847 }
2848 }
2849
2850
2852 {
2855
2858
2861
2862 foreach (
string slotName : attachmentSlots)
2863 {
2865 }
2866
2867
2869 {
2872
2874 }
2875 else
2876 {
2879
2881 }
2882
2885 }
2886
2888 {
2889
2891 return;
2892
2893 string slot_name_mounted = slot_name + "_Mounted";
2894 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2895
2896
2898 RemoveProxyPhysics( slot_name_mounted );
2899 RemoveProxyPhysics( slot_name );
2900
2901 if ( attachment )
2902 {
2904 if ( is_locked )
2905 {
2907 AddProxyPhysics( slot_name_mounted );
2908 }
2909 else
2910 {
2912 AddProxyPhysics( slot_name );
2913 }
2914 }
2915 }
2916
2918 {
2919 SetAffectPathgraph( true, false );
2921 }
2922
2924 {
2925 return true;
2926 }
2927
2929 {
2930 return true;
2931 }
2932
2934 {
2935 if ( attachment )
2936 {
2938 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2939
2940 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2941 }
2942
2943 return false;
2944 }
2945
2947 {
2949 }
2950
2951
2953 {
2954 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2955 if (
g_Game.ConfigIsExisting( config_path ) )
2956 {
2957 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2958 }
2959 }
2960
2962 {
2963 return true;
2964 }
2965
2967 {
2968 return true;
2969 }
2970
2972 {
2973 return true;
2974 }
2975
2976
2978 {
2981 }
2982
2984 {
2986 }
2987
2989 {
2991 }
2992
2994 {
2995 int attachment_count = GetInventory().AttachmentCount();
2996 if ( attachment_count > 0 )
2997 {
2998 if (
HasBase() && attachment_count == 1 )
2999 {
3000 return false;
3001 }
3002
3003 return true;
3004 }
3005
3006 return false;
3007 }
3008
3010 {
3011 return true;
3012 }
3013
3015 {
3016 return false;
3017 }
3018
3019
3021 {
3022 return false;
3023 }
3024
3026 {
3027 return false;
3028 }
3029
3030
3032 {
3033 return false;
3034 }
3035
3036
3037
3039 {
3040 return true;
3041 }
3042
3044 {
3045 return true;
3046 }
3047
3050 {
3051 return false;
3052 }
3053
3054
3056 {
3057 return false;
3058 }
3059
3060
3062 {
3063 return true;
3064 }
3065
3066
3068 {
3069 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3070 {
3071 return false;
3072 }
3073
3074 return true;
3075 }
3076
3078 {
3081
3082 return item;
3083 }
3084
3085
3087 {
3089 {
3090
3092
3093
3096
3098 if ( MemoryPointExists( slot_name + "_min" ) )
3099 {
3100 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3101 }
3102 if ( MemoryPointExists( slot_name + "_max" ) )
3103 {
3104 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3105 }
3106
3107
3110
3111
3114 center = ModelToWorld( center );
3115
3116
3119
3120 areaDamage.SetExtents( extents[0], extents[1] );
3121 areaDamage.SetAreaPosition( center );
3125 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3126 areaDamage.SetAmmoName( "BarbedWireHit" );
3127 areaDamage.Spawn();
3128
3130 }
3131 }
3132
3134 {
3135 if ( angle_deg != 0 )
3136 {
3137
3139
3140
3142 if ( MemoryPointExists( "rotate_axis" ) )
3143 {
3144 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3145 }
3146 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];
3147 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];
3148 center[0] = r_center_x;
3149 center[2] = r_center_z;
3150 }
3151 }
3152
3154 {
3156 {
3159 {
3160 if (areaDamage)
3161 {
3162 areaDamage.Destroy();
3163 }
3164
3166 }
3167 }
3168 }
3169
3171 {
3172 return true;
3173 }
3174
3175
3176
3177
3179 {
3181 }
3182
3184 {
3186 }
3187
3189 {
3191 }
3192
3194 {
3196
3197 switch ( material_type )
3198 {
3204 }
3205
3206 return "";
3207 }
3208
3210 {
3212
3213 switch ( material_type )
3214 {
3220 }
3221
3222 return "";
3223 }
3224
3225
3227 {
3229 {
3230
3232 {
3233 SetHealth(slot_name,"Health",item.GetHealth());
3234 }
3235 }
3236 }
3237
3239 {
3240 return 111;
3241 }
3242
3244 {
3245 super.SetActions();
3246
3250 }
3251
3253 {
3255 if (!construction)
3256 return;
3257
3259 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3260 {
3263 {
3265 }
3266 }
3267 }
3268
3270 {
3272 if (!construction)
3273 return;
3274
3276 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3277 {
3280 {
3281 construction.HandleEntityFalling(part.
GetPartName());
3282 }
3283 }
3284 }
3285
3288 {
3290 return;
3291
3294
3295 if (DestroyOnFall())
3296 {
3298 {
3300 }
3301 else
3302 {
3304 {
3306 }
3308 }
3309 }
3310 }
3311
3313 {
3314 if (HasAnyAttachmentsOrCargo())
3315 {
3318 }
3319 }
3320
3321
3322
3323
3324
3327 {
3328 return null;
3329 }
3330
3332 {
3334 }
3335
3337 {
3340
3341 Man p;
3342
3343 #ifdef SERVER
3345 g_Game.GetWorld().GetPlayerList(players);
3346 if (players.Count())
3347 p = players[0];
3348 #else
3350 #endif
3351
3353 {
3354 bool excluded = false;
3356 if (excludes)
3357 {
3358 foreach (string exclude : excludes)
3359 {
3361 {
3362 excluded = true;
3363 break;
3364 }
3365 }
3366 }
3367
3368 if (!excluded)
3369 {
3371 }
3372 }
3373
3375 }
3376
3378
3380 [
Obsolete(
"handled in the Construction component directly")]
3382 {
3383 }
3384
3385 [
Obsolete(
"handled in the Construction component directly")]
3387 {
3388 }
3389
3390 [
Obsolete(
"obsolete debug method")]
3392 {
3393 }
3394}
3395
3397{
3398#ifdef BSB_DEBUG
3400#else
3401
3402#endif
3403}
3405{
3406#ifdef BSB_DEBUG_SPAM
3408#else
3409
3410#endif
3411}
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.