1983{
1985
1987
1989
1996
1997
1998
2004
2010
2012
2016
2017
2019 {
2021
2022
2023 RegisterNetSyncVariableInt( "m_SyncParts01" );
2024 RegisterNetSyncVariableInt( "m_SyncParts02" );
2025 RegisterNetSyncVariableInt( "m_SyncParts03" );
2026 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2027 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2028 RegisterNetSyncVariableBool( "m_HasBase" );
2029
2030
2031 ConstructionInit();
2032
2033 if (ConfigIsExisting("hybridAttachments"))
2034 {
2037 }
2038 if (ConfigIsExisting("mountables"))
2039 {
2042 }
2043
2045 SetAllowDamage(true);
2046 }
2047
2049 {
2050 return "disableBaseDamage";
2051 }
2052
2054 {
2055 return true;
2056 }
2057
2059 {
2060 return EInventoryIconVisibility.HIDE_VICINITY;
2061 }
2062
2064 {
2065 super.InitItemSounds();
2066
2070
2075 }
2076
2078 {
2079 return "putDown_FenceKit_SoundSet";
2080 }
2081
2083 {
2084 return "Shelter_Site_Build_Loop_SoundSet";
2085 }
2086
2087
2089 {
2091 {
2092 SetSynchDirty();
2093 }
2094 }
2095
2097 {
2099 super.OnVariablesSynchronized();
2100
2102 }
2103
2105 {
2106
2108
2109
2111
2112
2114 }
2115
2116
2118 {
2119
2120 int offset;
2121 int mask;
2122
2123 if ( part_id >= 1 && part_id <= 31 )
2124 {
2125 offset = part_id - 1;
2126 mask = 1 << offset;
2127
2129 }
2130 else if ( part_id >= 32 && part_id <= 62 )
2131 {
2132 offset = ( part_id % 32 );
2133 mask = 1 << offset;
2134
2136 }
2137 else if ( part_id >= 63 && part_id <= 93 )
2138 {
2139 offset = ( part_id % 63 );
2140 mask = 1 << offset;
2141
2143 }
2144 }
2145
2147 {
2148
2149 int offset;
2150 int mask;
2151
2152 if ( part_id >= 1 && part_id <= 31 )
2153 {
2154 offset = part_id - 1;
2155 mask = 1 << offset;
2156
2158 }
2159 else if ( part_id >= 32 && part_id <= 62 )
2160 {
2161 offset = ( part_id % 32 );
2162 mask = 1 << offset;
2163
2165 }
2166 else if ( part_id >= 63 && part_id <= 93 )
2167 {
2168 offset = ( part_id % 63 );
2169 mask = 1 << offset;
2170
2172 }
2173 }
2174
2176 {
2177
2178 int offset;
2179 int mask;
2180
2181 if ( part_id >= 1 && part_id <= 31 )
2182 {
2183 offset = part_id - 1;
2184 mask = 1 << offset;
2185
2187 {
2188 return true;
2189 }
2190 }
2191 else if ( part_id >= 32 && part_id <= 62 )
2192 {
2193 offset = ( part_id % 32 );
2194 mask = 1 << offset;
2195
2197 {
2198 return true;
2199 }
2200 }
2201 else if ( part_id >= 63 && part_id <= 93 )
2202 {
2203 offset = ( part_id % 63 );
2204 mask = 1 << offset;
2205
2207 {
2208 return true;
2209 }
2210 }
2211
2212 return false;
2213 }
2214
2216 {
2219 }
2220
2222 {
2223
2226 }
2227
2229 {
2231 {
2234
2235 switch( build_action_id )
2236 {
2240 }
2241 }
2242 }
2243
2244
2246 {
2248 bool is_base = part.
IsBase();
2251 if ( is_part_built_sync )
2252 {
2254 {
2258
2259 if (is_base)
2260 {
2263 }
2264 }
2265 }
2266 else
2267 {
2269 {
2273
2274 if (is_base)
2275 {
2278 }
2279 }
2280 }
2281
2282
2284 }
2285
2286
2288 {
2291
2292 for ( int i = 0; i < construction_parts.Count(); ++i )
2293 {
2294 string key = construction_parts.GetKey( i );
2297 }
2298
2299
2301 }
2302
2304 {
2307
2308 for ( int i = 0; i < construction_parts.Count(); ++i )
2309 {
2310 string key = construction_parts.GetKey( i );
2312
2313 if ( value.
GetId() ==
id )
2314 {
2315 return value;
2316 }
2317 }
2318
2319 return NULL;
2320 }
2321
2322
2323
2325 {
2327 }
2328
2330 {
2332 }
2333
2335 {
2336 return true;
2337 }
2338
2340 {
2341 return false;
2342 }
2343
2344
2346 {
2349 {
2351 }
2352
2353 return construction_kit;
2354 }
2355
2357 {
2360 {
2362 }
2363 }
2364
2366 {
2368 }
2369
2371 {
2372 return "";
2373 }
2374
2376 {
2378 g_Game.ObjectDelete( construction_kit );
2379 }
2380
2381
2383 {
2385 g_Game.ObjectDelete(
this );
2386 }
2387
2388
2390 {
2391 super.EEDelete(parent);
2392
2394 {
2395 areaDamage.Destroy();
2396 }
2397
2398 }
2399
2401 {
2402 super.OnStoreSave( ctx );
2403
2404
2408
2410 }
2411
2413 {
2414 if ( !super.OnStoreLoad( ctx, version ) )
2415 return false;
2416
2417
2418
2420 {
2422 return false;
2423 }
2425 {
2427 return false;
2428 }
2430 {
2432 return false;
2433 }
2434
2435
2437 {
2439 return false;
2440 }
2441
2442
2443 return true;
2444 }
2445
2447 {
2448 super.AfterStoreLoad();
2449
2451 {
2453 }
2454 }
2455
2457 {
2458
2460
2461
2464
2465
2467 }
2468
2470 {
2471 super.OnCreatePhysics();
2472
2473 ConstructionInit();
2475 }
2476
2478 {
2480 return;
2481
2482 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2483 }
2484
2486 {
2488 {
2490 }
2491
2492 super.EEOnAfterLoad();
2493 }
2494
2496 {
2497 super.EEItemAttached( item, slot_name );
2498
2502 }
2503
2505 {
2506 super.EEItemDetached( item, slot_name );
2507
2510 }
2511
2512 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2513 {
2516
2519 }
2520
2521
2523 {
2524 return true;
2525 }
2526
2527
2528
2530 {
2532
2533
2534 if (construtionPart.
IsBase())
2535 {
2537
2538
2540 }
2541
2542
2544
2545
2547
2548
2550
2552
2554
2555
2557
2558
2560 }
2561
2563 {
2564
2566 }
2567
2568
2570 {
2573
2574
2576
2577
2579
2580
2582
2583
2585
2587
2588
2590
2591
2593
2594
2595 if (construtionPart.
IsBase())
2596 {
2597
2599 }
2600 }
2601
2603 {
2604
2606 }
2607
2608
2609 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2610 {
2613
2614
2616
2617
2619
2620
2622
2623
2625
2627
2628
2630
2631
2633
2634
2635 if (construtionPart.
IsBase())
2636 {
2637
2639 }
2640 }
2641
2643 {
2644
2646 }
2647
2648
2650 {
2652
2655 }
2656
2658 {
2660
2662 {
2664 }
2665 else
2666 {
2668 }
2669
2671 }
2672
2674 {
2676
2678 foreach (
string slotName : attachmentSlots)
2679 {
2681 }
2682
2683
2686 else
2688
2690 }
2691
2693 {
2694 string slotNameMounted = slot_name + "_Mounted";
2695 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2696
2697 if (attachment)
2698 {
2699 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2700 if (barbedWire && barbedWire.IsMounted())
2702 else
2704
2705 if (is_locked)
2706 {
2707 SetAnimationPhase(slotNameMounted, 0);
2708 SetAnimationPhase(slot_name, 1);
2709 }
2710 else
2711 {
2712 SetAnimationPhase(slotNameMounted, 1);
2713 SetAnimationPhase(slot_name, 0);
2714 }
2715 }
2716 else
2717 {
2718 SetAnimationPhase(slotNameMounted, 1);
2719 SetAnimationPhase(slot_name, 1);
2720
2722 }
2723 }
2724
2725
2727 {
2730
2733
2736
2737 foreach (
string slotName : attachmentSlots)
2738 {
2740 }
2741
2742
2744 {
2747
2749 }
2750 else
2751 {
2754
2756 }
2757
2760 }
2761
2763 {
2764
2766 return;
2767
2768 string slot_name_mounted = slot_name + "_Mounted";
2769 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2770
2771
2773 RemoveProxyPhysics( slot_name_mounted );
2774 RemoveProxyPhysics( slot_name );
2775
2776 if ( attachment )
2777 {
2779 if ( is_locked )
2780 {
2782 AddProxyPhysics( slot_name_mounted );
2783 }
2784 else
2785 {
2787 AddProxyPhysics( slot_name );
2788 }
2789 }
2790 }
2791
2793 {
2794 SetAffectPathgraph( true, false );
2796 }
2797
2799 {
2800 return true;
2801 }
2802
2804 {
2805 return true;
2806 }
2807
2809 {
2810 if ( attachment )
2811 {
2813 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2814
2815 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2816 }
2817
2818 return false;
2819 }
2820
2822 {
2824 }
2825
2826
2828 {
2829 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2830 if (
g_Game.ConfigIsExisting( config_path ) )
2831 {
2832 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2833 }
2834 }
2835
2837 {
2838 return true;
2839 }
2840
2842 {
2843 return true;
2844 }
2845
2847 {
2848 return true;
2849 }
2850
2851
2853 {
2856 }
2857
2859 {
2861 }
2862
2864 {
2866 }
2867
2869 {
2870 int attachment_count = GetInventory().AttachmentCount();
2871 if ( attachment_count > 0 )
2872 {
2873 if (
HasBase() && attachment_count == 1 )
2874 {
2875 return false;
2876 }
2877
2878 return true;
2879 }
2880
2881 return false;
2882 }
2883
2885 {
2886 return true;
2887 }
2888
2890 {
2891 return false;
2892 }
2893
2894
2896 {
2897 return false;
2898 }
2899
2901 {
2902 return false;
2903 }
2904
2905
2907 {
2908 return false;
2909 }
2910
2911
2912
2914 {
2915 return true;
2916 }
2917
2919 {
2920 return true;
2921 }
2922
2925 {
2926 return false;
2927 }
2928
2929
2931 {
2932 return false;
2933 }
2934
2935
2937 {
2938 return true;
2939 }
2940
2941
2943 {
2944 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2945 {
2946 return false;
2947 }
2948
2949 return true;
2950 }
2951
2953 {
2956
2957 return item;
2958 }
2959
2960
2962 {
2964 {
2965
2967
2968
2971
2973 if ( MemoryPointExists( slot_name + "_min" ) )
2974 {
2975 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2976 }
2977 if ( MemoryPointExists( slot_name + "_max" ) )
2978 {
2979 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2980 }
2981
2982
2985
2986
2989 center = ModelToWorld( center );
2990
2991
2994
2995 areaDamage.SetExtents( extents[0], extents[1] );
2996 areaDamage.SetAreaPosition( center );
3000 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3001 areaDamage.SetAmmoName( "BarbedWireHit" );
3002 areaDamage.Spawn();
3003
3005 }
3006 }
3007
3009 {
3010 if ( angle_deg != 0 )
3011 {
3012
3014
3015
3017 if ( MemoryPointExists( "rotate_axis" ) )
3018 {
3019 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3020 }
3021 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];
3022 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];
3023 center[0] = r_center_x;
3024 center[2] = r_center_z;
3025 }
3026 }
3027
3029 {
3031 {
3034 {
3035 if (areaDamage)
3036 {
3037 areaDamage.Destroy();
3038 }
3039
3041 }
3042 }
3043 }
3044
3046 {
3047 return true;
3048 }
3049
3050
3051
3052
3054 {
3056 }
3057
3059 {
3061 }
3062
3064 {
3066 }
3067
3069 {
3071
3072 switch ( material_type )
3073 {
3079 }
3080
3081 return "";
3082 }
3083
3085 {
3087
3088 switch ( material_type )
3089 {
3095 }
3096
3097 return "";
3098 }
3099
3100
3102 {
3104 {
3105
3107 {
3108 SetHealth(slot_name,"Health",item.GetHealth());
3109 }
3110 }
3111 }
3112
3114 {
3115 return 111;
3116 }
3117
3119 {
3120 super.SetActions();
3121
3125 }
3126
3128 {
3130 if (!construction)
3131 return;
3132
3134 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3135 {
3138 {
3140 }
3141 }
3142 }
3143
3145 {
3147 if (!construction)
3148 return;
3149
3151 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3152 {
3155 {
3156 construction.HandleEntityFalling(part.
GetPartName());
3157 }
3158 }
3159 }
3160
3163 {
3165 return;
3166
3169
3170 if (DestroyOnFall())
3171 {
3173 {
3175 }
3176 else
3177 {
3179 {
3181 }
3183 }
3184 }
3185 }
3186
3188 {
3189 if (HasAnyAttachmentsOrCargo())
3190 {
3193 }
3194 }
3195
3196
3197
3198
3199
3202 {
3203 return null;
3204 }
3205
3207 {
3209 }
3210
3212 {
3215
3216 Man p;
3217
3218 #ifdef SERVER
3220 g_Game.GetWorld().GetPlayerList(players);
3221 if (players.Count())
3222 p = players[0];
3223 #else
3225 #endif
3226
3228 {
3229 bool excluded = false;
3231 if (excludes)
3232 {
3233 foreach (string exclude : excludes)
3234 {
3236 {
3237 excluded = true;
3238 break;
3239 }
3240 }
3241 }
3242
3243 if (!excluded)
3244 {
3246 }
3247 }
3248
3250 }
3251
3253
3255 [
Obsolete(
"handled in the Construction component directly")]
3257 {
3258 }
3259
3260 [
Obsolete(
"handled in the Construction component directly")]
3262 {
3263 }
3264
3265 [
Obsolete(
"obsolete debug method")]
3267 {
3268 }
3269}
3270
3272{
3273#ifdef BSB_DEBUG
3275#else
3276
3277#endif
3278}
3280{
3281#ifdef BSB_DEBUG_SPAM
3283#else
3284
3285#endif
3286}
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.