2102{
2104
2106
2108
2115
2116
2117
2123
2129
2131
2135
2136
2138 {
2140
2141
2142 RegisterNetSyncVariableInt( "m_SyncParts01" );
2143 RegisterNetSyncVariableInt( "m_SyncParts02" );
2144 RegisterNetSyncVariableInt( "m_SyncParts03" );
2145 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2146 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2147 RegisterNetSyncVariableBool( "m_HasBase" );
2148
2149
2150 ConstructionInit();
2151
2152 if (ConfigIsExisting("hybridAttachments"))
2153 {
2156 }
2157 if (ConfigIsExisting("mountables"))
2158 {
2161 }
2162
2164 SetAllowDamage(true);
2165 }
2166
2168 {
2169 return "disableBaseDamage";
2170 }
2171
2173 {
2174 return true;
2175 }
2176
2178 {
2179 return EInventoryIconVisibility.HIDE_VICINITY;
2180 }
2181
2183 {
2184 super.InitItemSounds();
2185
2189
2194 }
2195
2197 {
2198 return "putDown_FenceKit_SoundSet";
2199 }
2200
2202 {
2203 return "Shelter_Site_Build_Loop_SoundSet";
2204 }
2205
2206
2208 {
2210 {
2211 SetSynchDirty();
2212 }
2213 }
2214
2216 {
2218 super.OnVariablesSynchronized();
2219
2221 }
2222
2224 {
2225
2227
2228
2230
2231
2233 }
2234
2235
2237 {
2238
2239 int offset;
2240 int mask;
2241
2242 if ( part_id >= 1 && part_id <= 31 )
2243 {
2244 offset = part_id - 1;
2245 mask = 1 << offset;
2246
2248 }
2249 else if ( part_id >= 32 && part_id <= 62 )
2250 {
2251 offset = ( part_id % 32 );
2252 mask = 1 << offset;
2253
2255 }
2256 else if ( part_id >= 63 && part_id <= 93 )
2257 {
2258 offset = ( part_id % 63 );
2259 mask = 1 << offset;
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 return true;
2308 }
2309 }
2310 else if ( part_id >= 32 && part_id <= 62 )
2311 {
2312 offset = ( part_id % 32 );
2313 mask = 1 << offset;
2314
2316 {
2317 return true;
2318 }
2319 }
2320 else if ( part_id >= 63 && part_id <= 93 )
2321 {
2322 offset = ( part_id % 63 );
2323 mask = 1 << offset;
2324
2326 {
2327 return true;
2328 }
2329 }
2330
2331 return false;
2332 }
2333
2335 {
2338 }
2339
2341 {
2342
2345 }
2346
2348 {
2350 {
2353
2354 switch( build_action_id )
2355 {
2359 }
2360 }
2361 }
2362
2363
2365 {
2367 bool is_base = part.
IsBase();
2370 if ( is_part_built_sync )
2371 {
2373 {
2377
2378 if (is_base)
2379 {
2382 }
2383 }
2384 }
2385 else
2386 {
2388 {
2392
2393 if (is_base)
2394 {
2397 }
2398 }
2399 }
2400
2401
2403 }
2404
2405
2407 {
2410
2411 for ( int i = 0; i < construction_parts.Count(); ++i )
2412 {
2413 string key = construction_parts.GetKey( i );
2416 }
2417
2418
2420 }
2421
2423 {
2426
2427 for ( int i = 0; i < construction_parts.Count(); ++i )
2428 {
2429 string key = construction_parts.GetKey( i );
2431
2432 if ( value.
GetId() ==
id )
2433 {
2434 return value;
2435 }
2436 }
2437
2438 return NULL;
2439 }
2440
2441
2442
2444 {
2446 }
2447
2449 {
2451 }
2452
2454 {
2455 return true;
2456 }
2457
2459 {
2460 return false;
2461 }
2462
2463
2465 {
2468 {
2470 }
2471
2472 return construction_kit;
2473 }
2474
2476 {
2479 {
2481 }
2482 }
2483
2485 {
2487 }
2488
2490 {
2491 return "";
2492 }
2493
2495 {
2497 g_Game.ObjectDelete( construction_kit );
2498 }
2499
2500
2502 {
2504 g_Game.ObjectDelete(
this );
2505 }
2506
2507
2509 {
2510 super.EEDelete(parent);
2511
2513 {
2514 areaDamage.Destroy();
2515 }
2516
2517 }
2518
2520 {
2521 super.OnStoreSave( ctx );
2522
2523
2527
2529 }
2530
2532 {
2533 if ( !super.OnStoreLoad( ctx, version ) )
2534 return false;
2535
2536
2537
2539 {
2541 return false;
2542 }
2544 {
2546 return false;
2547 }
2549 {
2551 return false;
2552 }
2553
2554
2556 {
2558 return false;
2559 }
2560
2561
2562 return true;
2563 }
2564
2566 {
2567 super.AfterStoreLoad();
2568
2570 {
2572 }
2573 }
2574
2576 {
2577
2579
2580
2583
2584
2586 }
2587
2589 {
2590 super.OnCreatePhysics();
2591
2592 ConstructionInit();
2594 }
2595
2597 {
2599 return;
2600
2601 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2602 }
2603
2605 {
2607 {
2609 }
2610
2611 super.EEOnAfterLoad();
2612 }
2613
2615 {
2616 super.EEItemAttached( item, slot_name );
2617
2621 }
2622
2624 {
2625 super.EEItemDetached( item, slot_name );
2626
2629 }
2630
2631 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2632 {
2635
2638 }
2639
2640
2642 {
2643 return true;
2644 }
2645
2646
2647
2649 {
2651
2652
2653 if (construtionPart.
IsBase())
2654 {
2656
2657
2659 }
2660
2661
2663
2664
2666
2667
2669
2671
2673
2674
2676
2677
2679 }
2680
2682 {
2683
2685 }
2686
2687
2689 {
2692
2693
2695
2696
2698
2699
2701
2702
2704
2706
2707
2709
2710
2712
2713
2714 if (construtionPart.
IsBase())
2715 {
2716
2718 }
2719 }
2720
2722 {
2723
2725 }
2726
2727
2728 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2729 {
2732
2733
2735
2736
2738
2739
2741
2742
2744
2746
2747
2749
2750
2752
2753
2754 if (construtionPart.
IsBase())
2755 {
2756
2758 }
2759 }
2760
2762 {
2763
2765 }
2766
2767
2769 {
2771
2774 }
2775
2777 {
2779
2781 {
2783 }
2784 else
2785 {
2787 }
2788
2790 }
2791
2793 {
2795
2797 foreach (
string slotName : attachmentSlots)
2798 {
2800 }
2801
2802
2805 else
2807
2809 }
2810
2812 {
2813 string slotNameMounted = slot_name + "_Mounted";
2814 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2815
2816 if (attachment)
2817 {
2818 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2819 if (barbedWire && barbedWire.IsMounted())
2821 else
2823
2824 if (is_locked)
2825 {
2826 SetAnimationPhase(slotNameMounted, 0);
2827 SetAnimationPhase(slot_name, 1);
2828 }
2829 else
2830 {
2831 SetAnimationPhase(slotNameMounted, 1);
2832 SetAnimationPhase(slot_name, 0);
2833 }
2834 }
2835 else
2836 {
2837 SetAnimationPhase(slotNameMounted, 1);
2838 SetAnimationPhase(slot_name, 1);
2839
2841 }
2842 }
2843
2844
2846 {
2849
2852
2855
2856 foreach (
string slotName : attachmentSlots)
2857 {
2859 }
2860
2861
2863 {
2866
2868 }
2869 else
2870 {
2873
2875 }
2876
2879 }
2880
2882 {
2883
2885 return;
2886
2887 string slot_name_mounted = slot_name + "_Mounted";
2888 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2889
2890
2892 RemoveProxyPhysics( slot_name_mounted );
2893 RemoveProxyPhysics( slot_name );
2894
2895 if ( attachment )
2896 {
2898 if ( is_locked )
2899 {
2901 AddProxyPhysics( slot_name_mounted );
2902 }
2903 else
2904 {
2906 AddProxyPhysics( slot_name );
2907 }
2908 }
2909 }
2910
2912 {
2913 SetAffectPathgraph( true, false );
2915 }
2916
2918 {
2919 return true;
2920 }
2921
2923 {
2924 return true;
2925 }
2926
2928 {
2929 if ( attachment )
2930 {
2932 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2933
2934 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2935 }
2936
2937 return false;
2938 }
2939
2941 {
2943 }
2944
2945
2947 {
2948 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2949 if (
g_Game.ConfigIsExisting( config_path ) )
2950 {
2951 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2952 }
2953 }
2954
2956 {
2957 return true;
2958 }
2959
2961 {
2962 return true;
2963 }
2964
2966 {
2967 return true;
2968 }
2969
2970
2972 {
2975 }
2976
2978 {
2980 }
2981
2983 {
2985 }
2986
2988 {
2989 int attachment_count = GetInventory().AttachmentCount();
2990 if ( attachment_count > 0 )
2991 {
2992 if (
HasBase() && attachment_count == 1 )
2993 {
2994 return false;
2995 }
2996
2997 return true;
2998 }
2999
3000 return false;
3001 }
3002
3004 {
3005 return true;
3006 }
3007
3009 {
3010 return false;
3011 }
3012
3013
3015 {
3016 return false;
3017 }
3018
3020 {
3021 return false;
3022 }
3023
3024
3026 {
3027 return false;
3028 }
3029
3030
3031
3033 {
3034 return true;
3035 }
3036
3038 {
3039 return true;
3040 }
3041
3044 {
3045 return false;
3046 }
3047
3048
3050 {
3051 return false;
3052 }
3053
3054
3056 {
3057 return true;
3058 }
3059
3060
3062 {
3063 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3064 {
3065 return false;
3066 }
3067
3068 return true;
3069 }
3070
3072 {
3075
3076 return item;
3077 }
3078
3079
3081 {
3083 {
3084
3086
3087
3090
3092 if ( MemoryPointExists( slot_name + "_min" ) )
3093 {
3094 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3095 }
3096 if ( MemoryPointExists( slot_name + "_max" ) )
3097 {
3098 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3099 }
3100
3101
3104
3105
3108 center = ModelToWorld( center );
3109
3110
3113
3114 areaDamage.SetExtents( extents[0], extents[1] );
3115 areaDamage.SetAreaPosition( center );
3119 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3120 areaDamage.SetAmmoName( "BarbedWireHit" );
3121 areaDamage.Spawn();
3122
3124 }
3125 }
3126
3128 {
3129 if ( angle_deg != 0 )
3130 {
3131
3133
3134
3136 if ( MemoryPointExists( "rotate_axis" ) )
3137 {
3138 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3139 }
3140 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];
3141 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];
3142 center[0] = r_center_x;
3143 center[2] = r_center_z;
3144 }
3145 }
3146
3148 {
3150 {
3153 {
3154 if (areaDamage)
3155 {
3156 areaDamage.Destroy();
3157 }
3158
3160 }
3161 }
3162 }
3163
3165 {
3166 return true;
3167 }
3168
3169
3170
3171
3173 {
3175 }
3176
3178 {
3180 }
3181
3183 {
3185 }
3186
3188 {
3190
3191 switch ( material_type )
3192 {
3198 }
3199
3200 return "";
3201 }
3202
3204 {
3206
3207 switch ( material_type )
3208 {
3214 }
3215
3216 return "";
3217 }
3218
3219
3221 {
3223 {
3224
3226 {
3227 SetHealth(slot_name,"Health",item.GetHealth());
3228 }
3229 }
3230 }
3231
3233 {
3234 return 111;
3235 }
3236
3238 {
3239 super.SetActions();
3240
3244 }
3245
3247 {
3249 if (!construction)
3250 return;
3251
3253 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3254 {
3257 {
3259 }
3260 }
3261 }
3262
3264 {
3266 if (!construction)
3267 return;
3268
3270 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3271 {
3274 {
3275 construction.HandleEntityFalling(part.
GetPartName());
3276 }
3277 }
3278 }
3279
3282 {
3284 return;
3285
3288
3289 if (DestroyOnFall())
3290 {
3292 {
3294 }
3295 else
3296 {
3298 {
3300 }
3302 }
3303 }
3304 }
3305
3307 {
3308 if (HasAnyAttachmentsOrCargo())
3309 {
3312 }
3313 }
3314
3315
3316
3317
3318
3321 {
3322 return null;
3323 }
3324
3326 {
3328 }
3329
3331 {
3334
3335 Man p;
3336
3337 #ifdef SERVER
3339 g_Game.GetWorld().GetPlayerList(players);
3340 if (players.Count())
3341 p = players[0];
3342 #else
3344 #endif
3345
3347 {
3348 bool excluded = false;
3350 if (excludes)
3351 {
3352 foreach (string exclude : excludes)
3353 {
3355 {
3356 excluded = true;
3357 break;
3358 }
3359 }
3360 }
3361
3362 if (!excluded)
3363 {
3365 }
3366 }
3367
3369 }
3370
3372
3374 [
Obsolete(
"handled in the Construction component directly")]
3376 {
3377 }
3378
3379 [
Obsolete(
"handled in the Construction component directly")]
3381 {
3382 }
3383
3384 [
Obsolete(
"obsolete debug method")]
3386 {
3387 }
3388}
3389
3391{
3392#ifdef BSB_DEBUG
3394#else
3395
3396#endif
3397}
3399{
3400#ifdef BSB_DEBUG_SPAM
3402#else
3403
3404#endif
3405}
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.