2151{
2153
2155
2157
2164
2165
2166
2172
2178
2180
2184
2185
2187 {
2189
2190
2191 RegisterNetSyncVariableInt( "m_SyncParts01" );
2192 RegisterNetSyncVariableInt( "m_SyncParts02" );
2193 RegisterNetSyncVariableInt( "m_SyncParts03" );
2194 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2195 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2196 RegisterNetSyncVariableBool( "m_HasBase" );
2197
2198
2199 ConstructionInit();
2200
2201 if (ConfigIsExisting("hybridAttachments"))
2202 {
2205 }
2206 if (ConfigIsExisting("mountables"))
2207 {
2210 }
2211
2213 SetAllowDamage(true);
2214 }
2215
2217 {
2218 return "disableBaseDamage";
2219 }
2220
2222 {
2223 return true;
2224 }
2225
2227 {
2228 return EInventoryIconVisibility.HIDE_VICINITY;
2229 }
2230
2232 {
2233 super.InitItemSounds();
2234
2238
2243 }
2244
2246 {
2247 return "putDown_FenceKit_SoundSet";
2248 }
2249
2251 {
2252 return "Shelter_Site_Build_Loop_SoundSet";
2253 }
2254
2255
2257 {
2259 {
2260 SetSynchDirty();
2261 }
2262 }
2263
2265 {
2267 super.OnVariablesSynchronized();
2268
2270 }
2271
2273 {
2274
2276
2277
2279
2280
2282 }
2283
2284
2286 {
2287
2288 int offset;
2289 int mask;
2290
2291 if ( part_id >= 1 && part_id <= 31 )
2292 {
2293 offset = part_id - 1;
2294 mask = 1 << offset;
2295
2297 }
2298 else if ( part_id >= 32 && part_id <= 62 )
2299 {
2300 offset = ( part_id % 32 );
2301 mask = 1 << offset;
2302
2304 }
2305 else if ( part_id >= 63 && part_id <= 93 )
2306 {
2307 offset = ( part_id % 63 );
2308 mask = 1 << offset;
2309
2311 }
2312 }
2313
2315 {
2316
2317 int offset;
2318 int mask;
2319
2320 if ( part_id >= 1 && part_id <= 31 )
2321 {
2322 offset = part_id - 1;
2323 mask = 1 << offset;
2324
2326 }
2327 else if ( part_id >= 32 && part_id <= 62 )
2328 {
2329 offset = ( part_id % 32 );
2330 mask = 1 << offset;
2331
2333 }
2334 else if ( part_id >= 63 && part_id <= 93 )
2335 {
2336 offset = ( part_id % 63 );
2337 mask = 1 << offset;
2338
2340 }
2341 }
2342
2344 {
2345
2346 int offset;
2347 int mask;
2348
2349 if ( part_id >= 1 && part_id <= 31 )
2350 {
2351 offset = part_id - 1;
2352 mask = 1 << offset;
2353
2355 {
2356 return true;
2357 }
2358 }
2359 else if ( part_id >= 32 && part_id <= 62 )
2360 {
2361 offset = ( part_id % 32 );
2362 mask = 1 << offset;
2363
2365 {
2366 return true;
2367 }
2368 }
2369 else if ( part_id >= 63 && part_id <= 93 )
2370 {
2371 offset = ( part_id % 63 );
2372 mask = 1 << offset;
2373
2375 {
2376 return true;
2377 }
2378 }
2379
2380 return false;
2381 }
2382
2384 {
2387 }
2388
2390 {
2391
2394 }
2395
2397 {
2399 {
2402
2403 switch( build_action_id )
2404 {
2408 }
2409 }
2410 }
2411
2412
2414 {
2416 bool is_base = part.
IsBase();
2419 if ( is_part_built_sync )
2420 {
2422 {
2426
2427 if (is_base)
2428 {
2431 }
2432 }
2433 }
2434 else
2435 {
2437 {
2441
2442 if (is_base)
2443 {
2446 }
2447 }
2448 }
2449
2450
2452 }
2453
2454
2456 {
2459
2460 for ( int i = 0; i < construction_parts.Count(); ++i )
2461 {
2462 string key = construction_parts.GetKey( i );
2465 }
2466
2467
2469 }
2470
2472 {
2475
2476 for ( int i = 0; i < construction_parts.Count(); ++i )
2477 {
2478 string key = construction_parts.GetKey( i );
2480
2481 if ( value.
GetId() ==
id )
2482 {
2483 return value;
2484 }
2485 }
2486
2487 return NULL;
2488 }
2489
2490
2491
2493 {
2495 }
2496
2498 {
2500 }
2501
2503 {
2504 return true;
2505 }
2506
2508 {
2509 return false;
2510 }
2511
2512
2514 {
2517 {
2519 }
2520
2521 return construction_kit;
2522 }
2523
2525 {
2528 {
2530 }
2531 }
2532
2534 {
2536 }
2537
2539 {
2540 return "";
2541 }
2542
2544 {
2546 g_Game.ObjectDelete( construction_kit );
2547 }
2548
2549
2551 {
2553 g_Game.ObjectDelete(
this );
2554 }
2555
2556
2558 {
2559 super.EEDelete(parent);
2560
2562 {
2563 areaDamage.Destroy();
2564 }
2565
2566 }
2567
2569 {
2570 super.OnStoreSave( ctx );
2571
2572
2576
2578 }
2579
2581 {
2582 if ( !super.OnStoreLoad( ctx, version ) )
2583 return false;
2584
2585
2586
2588 {
2590 return false;
2591 }
2593 {
2595 return false;
2596 }
2598 {
2600 return false;
2601 }
2602
2603
2605 {
2607 return false;
2608 }
2609
2610
2611 return true;
2612 }
2613
2615 {
2616 super.AfterStoreLoad();
2617
2619 {
2621 }
2622 }
2623
2625 {
2626
2628
2629
2632
2633
2635 }
2636
2638 {
2639 super.OnCreatePhysics();
2640
2641 ConstructionInit();
2643 }
2644
2646 {
2648 return;
2649
2650 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2651 }
2652
2654 {
2656 {
2658 }
2659
2660 super.EEOnAfterLoad();
2661 }
2662
2664 {
2665 super.EEItemAttached( item, slot_name );
2666
2670 }
2671
2673 {
2674 super.EEItemDetached( item, slot_name );
2675
2678 }
2679
2680 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2681 {
2684
2687 }
2688
2689
2691 {
2692 return true;
2693 }
2694
2695
2696
2698 {
2700
2701
2702 if (construtionPart.
IsBase())
2703 {
2705
2706
2708 }
2709
2710
2712
2713
2715
2716
2718
2720
2722
2723
2725
2726
2728 }
2729
2731 {
2732
2734 }
2735
2736
2738 {
2741
2742
2744
2745
2747
2748
2750
2751
2753
2755
2756
2758
2759
2761
2762
2763 if (construtionPart.
IsBase())
2764 {
2765
2767 }
2768 }
2769
2771 {
2772
2774 }
2775
2776
2777 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2778 {
2781
2782
2784
2785
2787
2788
2790
2791
2793
2795
2796
2798
2799
2801
2802
2803 if (construtionPart.
IsBase())
2804 {
2805
2807 }
2808 }
2809
2811 {
2812
2814 }
2815
2816
2818 {
2820
2823 }
2824
2826 {
2828
2830 {
2832 }
2833 else
2834 {
2836 }
2837
2839 }
2840
2842 {
2844
2846 foreach (
string slotName : attachmentSlots)
2847 {
2849 }
2850
2851
2854 else
2856
2858 }
2859
2861 {
2862 string slotNameMounted = slot_name + "_Mounted";
2863 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2864
2865 if (attachment)
2866 {
2867 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2868 if (barbedWire && barbedWire.IsMounted())
2870 else
2872
2873 if (is_locked)
2874 {
2875 SetAnimationPhase(slotNameMounted, 0);
2876 SetAnimationPhase(slot_name, 1);
2877 }
2878 else
2879 {
2880 SetAnimationPhase(slotNameMounted, 1);
2881 SetAnimationPhase(slot_name, 0);
2882 }
2883 }
2884 else
2885 {
2886 SetAnimationPhase(slotNameMounted, 1);
2887 SetAnimationPhase(slot_name, 1);
2888
2890 }
2891 }
2892
2893
2895 {
2898
2901
2904
2905 foreach (
string slotName : attachmentSlots)
2906 {
2908 }
2909
2910
2912 {
2915
2917 }
2918 else
2919 {
2922
2924 }
2925
2928 }
2929
2931 {
2932
2934 return;
2935
2936 string slot_name_mounted = slot_name + "_Mounted";
2937 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2938
2939
2941 RemoveProxyPhysics( slot_name_mounted );
2942 RemoveProxyPhysics( slot_name );
2943
2944 if ( attachment )
2945 {
2947 if ( is_locked )
2948 {
2950 AddProxyPhysics( slot_name_mounted );
2951 }
2952 else
2953 {
2955 AddProxyPhysics( slot_name );
2956 }
2957 }
2958 }
2959
2961 {
2962 SetAffectPathgraph( true, false );
2964 }
2965
2967 {
2968 return true;
2969 }
2970
2972 {
2973 return true;
2974 }
2975
2977 {
2978 if ( attachment )
2979 {
2981 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2982
2983 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2984 }
2985
2986 return false;
2987 }
2988
2990 {
2992 }
2993
2994
2996 {
2997 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2998 if (
g_Game.ConfigIsExisting( config_path ) )
2999 {
3000 g_Game.ConfigGetTextArray( config_path, attachment_slots );
3001 }
3002 }
3003
3005 {
3006 return true;
3007 }
3008
3010 {
3011 return true;
3012 }
3013
3015 {
3016 return true;
3017 }
3018
3019
3021 {
3024 }
3025
3027 {
3029 }
3030
3032 {
3034 }
3035
3037 {
3038 int attachment_count = GetInventory().AttachmentCount();
3039 if ( attachment_count > 0 )
3040 {
3041 if (
HasBase() && attachment_count == 1 )
3042 {
3043 return false;
3044 }
3045
3046 return true;
3047 }
3048
3049 return false;
3050 }
3051
3053 {
3054 return true;
3055 }
3056
3058 {
3059 return false;
3060 }
3061
3062
3064 {
3065 return false;
3066 }
3067
3069 {
3070 return false;
3071 }
3072
3073
3075 {
3076 return false;
3077 }
3078
3079
3080
3082 {
3083 return true;
3084 }
3085
3087 {
3088 return true;
3089 }
3090
3093 {
3094 return false;
3095 }
3096
3097
3099 {
3100 return false;
3101 }
3102
3103
3105 {
3106 return true;
3107 }
3108
3109
3111 {
3112 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3113 {
3114 return false;
3115 }
3116
3117 return true;
3118 }
3119
3121 {
3124
3125 return item;
3126 }
3127
3128
3130 {
3132 {
3133
3135
3136
3139
3141 if ( MemoryPointExists( slot_name + "_min" ) )
3142 {
3143 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3144 }
3145 if ( MemoryPointExists( slot_name + "_max" ) )
3146 {
3147 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3148 }
3149
3150
3153
3154
3157 center = ModelToWorld( center );
3158
3159
3162
3163 areaDamage.SetExtents( extents[0], extents[1] );
3164 areaDamage.SetAreaPosition( center );
3168 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3169 areaDamage.SetAmmoName( "BarbedWireHit" );
3170 areaDamage.Spawn();
3171
3173 }
3174 }
3175
3177 {
3178 if ( angle_deg != 0 )
3179 {
3180
3182
3183
3185 if ( MemoryPointExists( "rotate_axis" ) )
3186 {
3187 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3188 }
3189 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];
3190 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];
3191 center[0] = r_center_x;
3192 center[2] = r_center_z;
3193 }
3194 }
3195
3197 {
3199 {
3202 {
3203 if (areaDamage)
3204 {
3205 areaDamage.Destroy();
3206 }
3207
3209 }
3210 }
3211 }
3212
3214 {
3215 return true;
3216 }
3217
3218
3219
3220
3222 {
3224 }
3225
3227 {
3229 }
3230
3232 {
3234 }
3235
3237 {
3239
3240 switch ( material_type )
3241 {
3247 }
3248
3249 return "";
3250 }
3251
3253 {
3255
3256 switch ( material_type )
3257 {
3263 }
3264
3265 return "";
3266 }
3267
3268
3270 {
3272 {
3273
3275 {
3276 SetHealth(slot_name,"Health",item.GetHealth());
3277 }
3278 }
3279 }
3280
3282 {
3283 return 111;
3284 }
3285
3287 {
3288 super.SetActions();
3289
3293 }
3294
3296 {
3298 if (!construction)
3299 return;
3300
3302 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3303 {
3306 {
3308 }
3309 }
3310 }
3311
3313 {
3315 if (!construction)
3316 return;
3317
3319 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3320 {
3323 {
3324 construction.HandleEntityFalling(part.
GetPartName());
3325 }
3326 }
3327 }
3328
3331 {
3333 return;
3334
3337
3338 if (DestroyOnFall())
3339 {
3341 {
3343 }
3344 else
3345 {
3347 {
3349 }
3351 }
3352 }
3353 }
3354
3356 {
3357 if (HasAnyAttachmentsOrCargo())
3358 {
3361 }
3362 }
3363
3364
3365
3366
3367
3370 {
3371 return null;
3372 }
3373
3375 {
3377 }
3378
3380 {
3383
3384 Man p;
3385
3386 #ifdef SERVER
3388 g_Game.GetWorld().GetPlayerList(players);
3389 if (players.Count())
3390 p = players[0];
3391 #else
3393 #endif
3394
3396 {
3397 bool excluded = false;
3399 if (excludes)
3400 {
3401 foreach (string exclude : excludes)
3402 {
3404 {
3405 excluded = true;
3406 break;
3407 }
3408 }
3409 }
3410
3411 if (!excluded)
3412 {
3414 }
3415 }
3416
3418 }
3419
3421
3423 [
Obsolete(
"handled in the Construction component directly")]
3425 {
3426 }
3427
3428 [
Obsolete(
"handled in the Construction component directly")]
3430 {
3431 }
3432
3433 [
Obsolete(
"obsolete debug method")]
3435 {
3436 }
3437}
3438
3440{
3441#ifdef BSB_DEBUG
3443#else
3444
3445#endif
3446}
3448{
3449#ifdef BSB_DEBUG_SPAM
3451#else
3452
3453#endif
3454}
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.