1805{
1807
1809
1811
1818
1819
1820
1826
1832
1834
1838
1839
1841 {
1843
1844
1845 RegisterNetSyncVariableInt( "m_SyncParts01" );
1846 RegisterNetSyncVariableInt( "m_SyncParts02" );
1847 RegisterNetSyncVariableInt( "m_SyncParts03" );
1848 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1849 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1850 RegisterNetSyncVariableBool( "m_HasBase" );
1851
1852
1853 ConstructionInit();
1854
1855 if (ConfigIsExisting("hybridAttachments"))
1856 {
1859 }
1860 if (ConfigIsExisting("mountables"))
1861 {
1864 }
1865
1867 SetAllowDamage(true);
1868 }
1869
1871 {
1872 return "disableBaseDamage";
1873 }
1874
1876 {
1877 return true;
1878 }
1879
1881 {
1882 return EInventoryIconVisibility.HIDE_VICINITY;
1883 }
1884
1886 {
1887 super.InitItemSounds();
1888
1892
1897 }
1898
1900 {
1901 return "putDown_FenceKit_SoundSet";
1902 }
1903
1905 {
1906 return "Shelter_Site_Build_Loop_SoundSet";
1907 }
1908
1909
1911 {
1913 {
1914 SetSynchDirty();
1915 }
1916 }
1917
1919 {
1921 super.OnVariablesSynchronized();
1922
1924 }
1925
1927 {
1928
1930
1931
1933
1934
1936 }
1937
1938
1940 {
1941
1942 int offset;
1943 int mask;
1944
1945 if ( part_id >= 1 && part_id <= 31 )
1946 {
1947 offset = part_id - 1;
1948 mask = 1 << offset;
1949
1951 }
1952 else if ( part_id >= 32 && part_id <= 62 )
1953 {
1954 offset = ( part_id % 32 );
1955 mask = 1 << offset;
1956
1958 }
1959 else if ( part_id >= 63 && part_id <= 93 )
1960 {
1961 offset = ( part_id % 63 );
1962 mask = 1 << offset;
1963
1965 }
1966 }
1967
1969 {
1970
1971 int offset;
1972 int mask;
1973
1974 if ( part_id >= 1 && part_id <= 31 )
1975 {
1976 offset = part_id - 1;
1977 mask = 1 << offset;
1978
1980 }
1981 else if ( part_id >= 32 && part_id <= 62 )
1982 {
1983 offset = ( part_id % 32 );
1984 mask = 1 << offset;
1985
1987 }
1988 else if ( part_id >= 63 && part_id <= 93 )
1989 {
1990 offset = ( part_id % 63 );
1991 mask = 1 << offset;
1992
1994 }
1995 }
1996
1998 {
1999
2000 int offset;
2001 int mask;
2002
2003 if ( part_id >= 1 && part_id <= 31 )
2004 {
2005 offset = part_id - 1;
2006 mask = 1 << offset;
2007
2009 {
2010 return true;
2011 }
2012 }
2013 else if ( part_id >= 32 && part_id <= 62 )
2014 {
2015 offset = ( part_id % 32 );
2016 mask = 1 << offset;
2017
2019 {
2020 return true;
2021 }
2022 }
2023 else if ( part_id >= 63 && part_id <= 93 )
2024 {
2025 offset = ( part_id % 63 );
2026 mask = 1 << offset;
2027
2029 {
2030 return true;
2031 }
2032 }
2033
2034 return false;
2035 }
2036
2038 {
2041 }
2042
2044 {
2045
2048 }
2049
2051 {
2053 {
2056
2057 switch( build_action_id )
2058 {
2062 }
2063 }
2064 }
2065
2066
2068 {
2070 bool is_base = part.
IsBase();
2073 if ( is_part_built_sync )
2074 {
2076 {
2080
2081 if (is_base)
2082 {
2085 }
2086 }
2087 }
2088 else
2089 {
2091 {
2095
2096 if (is_base)
2097 {
2100 }
2101 }
2102 }
2103
2104
2106 }
2107
2108
2110 {
2113
2114 for ( int i = 0; i < construction_parts.Count(); ++i )
2115 {
2116 string key = construction_parts.GetKey( i );
2119 }
2120
2121
2123 }
2124
2126 {
2129
2130 for ( int i = 0; i < construction_parts.Count(); ++i )
2131 {
2132 string key = construction_parts.GetKey( i );
2134
2135 if ( value.
GetId() ==
id )
2136 {
2137 return value;
2138 }
2139 }
2140
2141 return NULL;
2142 }
2143
2144
2145
2147 {
2149 }
2150
2152 {
2154 }
2155
2157 {
2158 return true;
2159 }
2160
2162 {
2163 return false;
2164 }
2165
2166
2168 {
2171 {
2173 }
2174
2175 return construction_kit;
2176 }
2177
2179 {
2182 {
2184 }
2185 }
2186
2188 {
2190 }
2191
2193 {
2194 return "";
2195 }
2196
2198 {
2200 g_Game.ObjectDelete( construction_kit );
2201 }
2202
2203
2205 {
2207 g_Game.ObjectDelete(
this );
2208 }
2209
2210
2212 {
2213 super.EEDelete(parent);
2214
2216 {
2217 areaDamage.Destroy();
2218 }
2219
2220 }
2221
2223 {
2224 super.OnStoreSave( ctx );
2225
2226
2230
2232 }
2233
2235 {
2236 if ( !super.OnStoreLoad( ctx, version ) )
2237 return false;
2238
2239
2240
2242 {
2244 return false;
2245 }
2247 {
2249 return false;
2250 }
2252 {
2254 return false;
2255 }
2256
2257
2259 {
2261 return false;
2262 }
2263
2264
2265 return true;
2266 }
2267
2269 {
2270 super.AfterStoreLoad();
2271
2273 {
2275 }
2276 }
2277
2279 {
2280
2282
2283
2286
2287
2289 }
2290
2292 {
2293 super.OnCreatePhysics();
2294
2295 ConstructionInit();
2297 }
2298
2300 {
2302 return;
2303
2304 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2305 }
2306
2308 {
2310 {
2312 }
2313
2314 super.EEOnAfterLoad();
2315 }
2316
2318 {
2319 super.EEItemAttached( item, slot_name );
2320
2324 }
2325
2327 {
2328 super.EEItemDetached( item, slot_name );
2329
2332 }
2333
2334 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2335 {
2338
2341 }
2342
2343
2345 {
2346 return true;
2347 }
2348
2349
2350
2352 {
2354
2355
2356 if (construtionPart.
IsBase())
2357 {
2359
2360
2362 }
2363
2364
2366
2367
2369
2370
2372
2374
2376
2377
2379
2380
2382 }
2383
2385 {
2386
2388 }
2389
2390
2392 {
2395
2396
2398
2399
2401
2402
2404
2405
2407
2409
2410
2412
2413
2415
2416
2417 if (construtionPart.
IsBase())
2418 {
2419
2421 }
2422 }
2423
2425 {
2426
2428 }
2429
2430
2431 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2432 {
2435
2436
2438
2439
2441
2442
2444
2445
2447
2449
2450
2452
2453
2455
2456
2457 if (construtionPart.
IsBase())
2458 {
2459
2461 }
2462 }
2463
2465 {
2466
2468 }
2469
2470
2472 {
2474
2477 }
2478
2480 {
2482
2484 {
2486 }
2487 else
2488 {
2490 }
2491
2493 }
2494
2496 {
2498
2500 foreach (
string slotName : attachmentSlots)
2501 {
2503 }
2504
2505
2508 else
2510
2512 }
2513
2515 {
2516 string slotNameMounted = slot_name + "_Mounted";
2517 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2518
2519 if (attachment)
2520 {
2521 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2522 if (barbedWire && barbedWire.IsMounted())
2524 else
2526
2527 if (is_locked)
2528 {
2529 SetAnimationPhase(slotNameMounted, 0);
2530 SetAnimationPhase(slot_name, 1);
2531 }
2532 else
2533 {
2534 SetAnimationPhase(slotNameMounted, 1);
2535 SetAnimationPhase(slot_name, 0);
2536 }
2537 }
2538 else
2539 {
2540 SetAnimationPhase(slotNameMounted, 1);
2541 SetAnimationPhase(slot_name, 1);
2542
2544 }
2545 }
2546
2547
2549 {
2552
2555
2558
2559 foreach (
string slotName : attachmentSlots)
2560 {
2562 }
2563
2564
2566 {
2569
2571 }
2572 else
2573 {
2576
2578 }
2579
2582 }
2583
2585 {
2586
2588 return;
2589
2590 string slot_name_mounted = slot_name + "_Mounted";
2591 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2592
2593
2595 RemoveProxyPhysics( slot_name_mounted );
2596 RemoveProxyPhysics( slot_name );
2597
2598 if ( attachment )
2599 {
2601 if ( is_locked )
2602 {
2604 AddProxyPhysics( slot_name_mounted );
2605 }
2606 else
2607 {
2609 AddProxyPhysics( slot_name );
2610 }
2611 }
2612 }
2613
2615 {
2616 SetAffectPathgraph( true, false );
2618 }
2619
2621 {
2622 return true;
2623 }
2624
2626 {
2627 return true;
2628 }
2629
2631 {
2632 if ( attachment )
2633 {
2635 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2636
2637 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2638 }
2639
2640 return false;
2641 }
2642
2644 {
2646 }
2647
2648
2650 {
2651 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2652 if (
g_Game.ConfigIsExisting( config_path ) )
2653 {
2654 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2655 }
2656 }
2657
2659 {
2660 return true;
2661 }
2662
2664 {
2665 return true;
2666 }
2667
2669 {
2670 return true;
2671 }
2672
2673
2675 {
2678 }
2679
2681 {
2683 }
2684
2686 {
2688 }
2689
2691 {
2692 int attachment_count = GetInventory().AttachmentCount();
2693 if ( attachment_count > 0 )
2694 {
2695 if (
HasBase() && attachment_count == 1 )
2696 {
2697 return false;
2698 }
2699
2700 return true;
2701 }
2702
2703 return false;
2704 }
2705
2707 {
2708 return true;
2709 }
2710
2712 {
2713 return false;
2714 }
2715
2716
2718 {
2719 return false;
2720 }
2721
2723 {
2724 return false;
2725 }
2726
2727
2729 {
2730 return false;
2731 }
2732
2733
2734
2736 {
2737 return true;
2738 }
2739
2741 {
2742 return true;
2743 }
2744
2747 {
2748 return false;
2749 }
2750
2751
2753 {
2754 return false;
2755 }
2756
2757
2759 {
2760 return true;
2761 }
2762
2763
2765 {
2766 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2767 {
2768 return false;
2769 }
2770
2771 return true;
2772 }
2773
2775 {
2778
2779 return item;
2780 }
2781
2782
2784 {
2786 {
2787
2789
2790
2793
2795 if ( MemoryPointExists( slot_name + "_min" ) )
2796 {
2797 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2798 }
2799 if ( MemoryPointExists( slot_name + "_max" ) )
2800 {
2801 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2802 }
2803
2804
2807
2808
2811 center = ModelToWorld( center );
2812
2813
2816
2817 areaDamage.SetExtents( extents[0], extents[1] );
2818 areaDamage.SetAreaPosition( center );
2822 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2823 areaDamage.SetAmmoName( "BarbedWireHit" );
2824 areaDamage.Spawn();
2825
2827 }
2828 }
2829
2831 {
2832 if ( angle_deg != 0 )
2833 {
2834
2836
2837
2839 if ( MemoryPointExists( "rotate_axis" ) )
2840 {
2841 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2842 }
2843 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];
2844 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];
2845 center[0] = r_center_x;
2846 center[2] = r_center_z;
2847 }
2848 }
2849
2851 {
2853 {
2856 {
2857 if (areaDamage)
2858 {
2859 areaDamage.Destroy();
2860 }
2861
2863 }
2864 }
2865 }
2866
2868 {
2869 return true;
2870 }
2871
2872
2873
2874
2876 {
2878 }
2879
2881 {
2883 }
2884
2886 {
2888 }
2889
2891 {
2893
2894 switch ( material_type )
2895 {
2901 }
2902
2903 return "";
2904 }
2905
2907 {
2909
2910 switch ( material_type )
2911 {
2917 }
2918
2919 return "";
2920 }
2921
2922
2924 {
2926 {
2927
2929 {
2930 SetHealth(slot_name,"Health",item.GetHealth());
2931 }
2932 }
2933 }
2934
2936 {
2937 return 111;
2938 }
2939
2941 {
2942 super.SetActions();
2943
2947 }
2948
2950 {
2952 if (!construction)
2953 return;
2954
2956 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2957 {
2960 {
2962 }
2963 }
2964 }
2965
2967 {
2969 if (!construction)
2970 return;
2971
2973 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2974 {
2977 {
2978 construction.HandleEntityFalling(part.
GetPartName());
2979 }
2980 }
2981 }
2982
2985 {
2987 return;
2988
2991
2992 if (DestroyOnFall())
2993 {
2995 {
2997 }
2998 else
2999 {
3001 {
3003 }
3005 }
3006 }
3007 }
3008
3010 {
3011 if (HasAnyAttachmentsOrCargo())
3012 {
3015 }
3016 }
3017
3018
3019
3020
3021
3024 {
3025 return null;
3026 }
3027
3029 {
3031 }
3032
3034 {
3037
3038 Man p;
3039
3040 #ifdef SERVER
3042 g_Game.GetWorld().GetPlayerList(players);
3043 if (players.Count())
3044 p = players[0];
3045 #else
3047 #endif
3048
3050 {
3051 bool excluded = false;
3053 if (excludes)
3054 {
3055 foreach (string exclude : excludes)
3056 {
3058 {
3059 excluded = true;
3060 break;
3061 }
3062 }
3063 }
3064
3065 if (!excluded)
3066 {
3068 }
3069 }
3070
3072 }
3073
3075
3077 [
Obsolete(
"handled in the Construction component directly")]
3079 {
3080 }
3081
3082 [
Obsolete(
"handled in the Construction component directly")]
3084 {
3085 }
3086
3087 [
Obsolete(
"obsolete debug method")]
3089 {
3090 }
3091}
3092
3094{
3095#ifdef BSB_DEBUG
3097#else
3098
3099#endif
3100}
3102{
3103#ifdef BSB_DEBUG_SPAM
3105#else
3106
3107#endif
3108}
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.