1779{
1781
1783
1785
1792
1793
1794
1800
1806
1808
1812
1813
1815 {
1817
1818
1819 RegisterNetSyncVariableInt( "m_SyncParts01" );
1820 RegisterNetSyncVariableInt( "m_SyncParts02" );
1821 RegisterNetSyncVariableInt( "m_SyncParts03" );
1822 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1823 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1824 RegisterNetSyncVariableBool( "m_HasBase" );
1825
1826
1827 ConstructionInit();
1828
1829 if (ConfigIsExisting("hybridAttachments"))
1830 {
1833 }
1834 if (ConfigIsExisting("mountables"))
1835 {
1838 }
1839
1841 SetAllowDamage(true);
1842 }
1843
1845 {
1846 return "disableBaseDamage";
1847 }
1848
1850 {
1851 return true;
1852 }
1853
1855 {
1856 return EInventoryIconVisibility.HIDE_VICINITY;
1857 }
1858
1860 {
1861 super.InitItemSounds();
1862
1866
1871 }
1872
1874 {
1875 return "putDown_FenceKit_SoundSet";
1876 }
1877
1879 {
1880 return "Shelter_Site_Build_Loop_SoundSet";
1881 }
1882
1883
1885 {
1887 {
1888 SetSynchDirty();
1889 }
1890 }
1891
1893 {
1895 super.OnVariablesSynchronized();
1896
1898 }
1899
1901 {
1902
1904
1905
1907
1908
1910 }
1911
1912
1914 {
1915
1916 int offset;
1917 int mask;
1918
1919 if ( part_id >= 1 && part_id <= 31 )
1920 {
1921 offset = part_id - 1;
1922 mask = 1 << offset;
1923
1925 }
1926 else if ( part_id >= 32 && part_id <= 62 )
1927 {
1928 offset = ( part_id % 32 );
1929 mask = 1 << offset;
1930
1932 }
1933 else if ( part_id >= 63 && part_id <= 93 )
1934 {
1935 offset = ( part_id % 63 );
1936 mask = 1 << offset;
1937
1939 }
1940 }
1941
1943 {
1944
1945 int offset;
1946 int mask;
1947
1948 if ( part_id >= 1 && part_id <= 31 )
1949 {
1950 offset = part_id - 1;
1951 mask = 1 << offset;
1952
1954 }
1955 else if ( part_id >= 32 && part_id <= 62 )
1956 {
1957 offset = ( part_id % 32 );
1958 mask = 1 << offset;
1959
1961 }
1962 else if ( part_id >= 63 && part_id <= 93 )
1963 {
1964 offset = ( part_id % 63 );
1965 mask = 1 << offset;
1966
1968 }
1969 }
1970
1972 {
1973
1974 int offset;
1975 int mask;
1976
1977 if ( part_id >= 1 && part_id <= 31 )
1978 {
1979 offset = part_id - 1;
1980 mask = 1 << offset;
1981
1983 {
1984 return true;
1985 }
1986 }
1987 else if ( part_id >= 32 && part_id <= 62 )
1988 {
1989 offset = ( part_id % 32 );
1990 mask = 1 << offset;
1991
1993 {
1994 return true;
1995 }
1996 }
1997 else if ( part_id >= 63 && part_id <= 93 )
1998 {
1999 offset = ( part_id % 63 );
2000 mask = 1 << offset;
2001
2003 {
2004 return true;
2005 }
2006 }
2007
2008 return false;
2009 }
2010
2012 {
2015 }
2016
2018 {
2019
2022 }
2023
2025 {
2027 {
2030
2031 switch( build_action_id )
2032 {
2036 }
2037 }
2038 }
2039
2040
2042 {
2044 bool is_base = part.
IsBase();
2047 if ( is_part_built_sync )
2048 {
2050 {
2054
2055 if (is_base)
2056 {
2059 }
2060 }
2061 }
2062 else
2063 {
2065 {
2069
2070 if (is_base)
2071 {
2074 }
2075 }
2076 }
2077
2078
2080 }
2081
2082
2084 {
2087
2088 for ( int i = 0; i < construction_parts.Count(); ++i )
2089 {
2090 string key = construction_parts.GetKey( i );
2093 }
2094
2095
2097 }
2098
2100 {
2103
2104 for ( int i = 0; i < construction_parts.Count(); ++i )
2105 {
2106 string key = construction_parts.GetKey( i );
2108
2109 if ( value.
GetId() ==
id )
2110 {
2111 return value;
2112 }
2113 }
2114
2115 return NULL;
2116 }
2117
2118
2119
2121 {
2123 }
2124
2126 {
2128 }
2129
2131 {
2132 return true;
2133 }
2134
2136 {
2137 return false;
2138 }
2139
2140
2142 {
2145 {
2147 }
2148
2149 return construction_kit;
2150 }
2151
2153 {
2156 {
2158 }
2159 }
2160
2162 {
2164 }
2165
2167 {
2168 return "";
2169 }
2170
2172 {
2174 g_Game.ObjectDelete( construction_kit );
2175 }
2176
2177
2179 {
2181 g_Game.ObjectDelete(
this );
2182 }
2183
2184
2186 {
2187 super.EEDelete(parent);
2188
2190 {
2191 areaDamage.Destroy();
2192 }
2193
2194 }
2195
2197 {
2198 super.OnStoreSave( ctx );
2199
2200
2204
2206 }
2207
2209 {
2210 if ( !super.OnStoreLoad( ctx, version ) )
2211 return false;
2212
2213
2214
2216 {
2218 return false;
2219 }
2221 {
2223 return false;
2224 }
2226 {
2228 return false;
2229 }
2230
2231
2233 {
2235 return false;
2236 }
2237
2238
2239 return true;
2240 }
2241
2243 {
2244 super.AfterStoreLoad();
2245
2247 {
2249 }
2250 }
2251
2253 {
2254
2256
2257
2260
2261
2263 }
2264
2266 {
2267 super.OnCreatePhysics();
2268
2269 ConstructionInit();
2271 }
2272
2274 {
2276 return;
2277
2278 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2279 }
2280
2282 {
2284 {
2286 }
2287
2288 super.EEOnAfterLoad();
2289 }
2290
2292 {
2293 super.EEItemAttached( item, slot_name );
2294
2298 }
2299
2301 {
2302 super.EEItemDetached( item, slot_name );
2303
2306 }
2307
2308 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2309 {
2312
2315 }
2316
2317
2319 {
2320 return true;
2321 }
2322
2323
2324
2326 {
2328
2329
2330 if (construtionPart.
IsBase())
2331 {
2333
2334
2336 }
2337
2338
2340
2341
2343
2344
2346
2348
2350
2351
2353
2354
2356 }
2357
2359 {
2360
2362 }
2363
2364
2366 {
2369
2370
2372
2373
2375
2376
2378
2379
2381
2383
2384
2386
2387
2389
2390
2391 if (construtionPart.
IsBase())
2392 {
2393
2395 }
2396 }
2397
2399 {
2400
2402 }
2403
2404
2405 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2406 {
2409
2410
2412
2413
2415
2416
2418
2419
2421
2423
2424
2426
2427
2429
2430
2431 if (construtionPart.
IsBase())
2432 {
2433
2435 }
2436 }
2437
2439 {
2440
2442 }
2443
2444
2446 {
2448
2451 }
2452
2454 {
2456
2458 {
2460 }
2461 else
2462 {
2464 }
2465
2467 }
2468
2470 {
2472
2474 foreach (
string slotName : attachmentSlots)
2475 {
2477 }
2478
2479
2482 else
2484
2486 }
2487
2489 {
2490 string slotNameMounted = slot_name + "_Mounted";
2491 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2492
2493 if (attachment)
2494 {
2495 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2496 if (barbedWire && barbedWire.IsMounted())
2498 else
2500
2501 if (is_locked)
2502 {
2503 SetAnimationPhase(slotNameMounted, 0);
2504 SetAnimationPhase(slot_name, 1);
2505 }
2506 else
2507 {
2508 SetAnimationPhase(slotNameMounted, 1);
2509 SetAnimationPhase(slot_name, 0);
2510 }
2511 }
2512 else
2513 {
2514 SetAnimationPhase(slotNameMounted, 1);
2515 SetAnimationPhase(slot_name, 1);
2516
2518 }
2519 }
2520
2521
2523 {
2526
2529
2532
2533 foreach (
string slotName : attachmentSlots)
2534 {
2536 }
2537
2538
2540 {
2543
2545 }
2546 else
2547 {
2550
2552 }
2553
2556 }
2557
2559 {
2560
2562 return;
2563
2564 string slot_name_mounted = slot_name + "_Mounted";
2565 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2566
2567
2569 RemoveProxyPhysics( slot_name_mounted );
2570 RemoveProxyPhysics( slot_name );
2571
2572 if ( attachment )
2573 {
2575 if ( is_locked )
2576 {
2578 AddProxyPhysics( slot_name_mounted );
2579 }
2580 else
2581 {
2583 AddProxyPhysics( slot_name );
2584 }
2585 }
2586 }
2587
2589 {
2590 SetAffectPathgraph( true, false );
2592 }
2593
2595 {
2596 return true;
2597 }
2598
2600 {
2601 return true;
2602 }
2603
2605 {
2606 if ( attachment )
2607 {
2609 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2610
2611 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2612 }
2613
2614 return false;
2615 }
2616
2618 {
2620 }
2621
2622
2624 {
2625 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2626 if (
g_Game.ConfigIsExisting( config_path ) )
2627 {
2628 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2629 }
2630 }
2631
2633 {
2634 return true;
2635 }
2636
2638 {
2639 return true;
2640 }
2641
2643 {
2644 return true;
2645 }
2646
2647
2649 {
2652 }
2653
2655 {
2657 }
2658
2660 {
2662 }
2663
2665 {
2666 int attachment_count = GetInventory().AttachmentCount();
2667 if ( attachment_count > 0 )
2668 {
2669 if (
HasBase() && attachment_count == 1 )
2670 {
2671 return false;
2672 }
2673
2674 return true;
2675 }
2676
2677 return false;
2678 }
2679
2681 {
2682 return true;
2683 }
2684
2686 {
2687 return false;
2688 }
2689
2690
2692 {
2693 return false;
2694 }
2695
2697 {
2698 return false;
2699 }
2700
2701
2703 {
2704 return false;
2705 }
2706
2707
2708
2710 {
2711 return true;
2712 }
2713
2715 {
2716 return true;
2717 }
2718
2721 {
2722 return false;
2723 }
2724
2725
2727 {
2728 return false;
2729 }
2730
2731
2733 {
2734 return true;
2735 }
2736
2737
2739 {
2740 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2741 {
2742 return false;
2743 }
2744
2745 return true;
2746 }
2747
2749 {
2752
2753 return item;
2754 }
2755
2756
2758 {
2760 {
2761
2763
2764
2767
2769 if ( MemoryPointExists( slot_name + "_min" ) )
2770 {
2771 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2772 }
2773 if ( MemoryPointExists( slot_name + "_max" ) )
2774 {
2775 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2776 }
2777
2778
2781
2782
2785 center = ModelToWorld( center );
2786
2787
2790
2791 areaDamage.SetExtents( extents[0], extents[1] );
2792 areaDamage.SetAreaPosition( center );
2796 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2797 areaDamage.SetAmmoName( "BarbedWireHit" );
2798 areaDamage.Spawn();
2799
2801 }
2802 }
2803
2805 {
2806 if ( angle_deg != 0 )
2807 {
2808
2810
2811
2813 if ( MemoryPointExists( "rotate_axis" ) )
2814 {
2815 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2816 }
2817 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];
2818 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];
2819 center[0] = r_center_x;
2820 center[2] = r_center_z;
2821 }
2822 }
2823
2825 {
2827 {
2830 {
2831 if (areaDamage)
2832 {
2833 areaDamage.Destroy();
2834 }
2835
2837 }
2838 }
2839 }
2840
2842 {
2843 return true;
2844 }
2845
2846
2847
2848
2850 {
2852 }
2853
2855 {
2857 }
2858
2860 {
2862 }
2863
2865 {
2867
2868 switch ( material_type )
2869 {
2875 }
2876
2877 return "";
2878 }
2879
2881 {
2883
2884 switch ( material_type )
2885 {
2891 }
2892
2893 return "";
2894 }
2895
2896
2898 {
2900 {
2901
2903 {
2904 SetHealth(slot_name,"Health",item.GetHealth());
2905 }
2906 }
2907 }
2908
2910 {
2911 return 111;
2912 }
2913
2915 {
2916 super.SetActions();
2917
2921 }
2922
2924 {
2926 if (!construction)
2927 return;
2928
2930 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2931 {
2934 {
2936 }
2937 }
2938 }
2939
2941 {
2943 if (!construction)
2944 return;
2945
2947 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2948 {
2951 {
2952 construction.HandleEntityFalling(part.
GetPartName());
2953 }
2954 }
2955 }
2956
2959 {
2961 return;
2962
2965
2966 if (DestroyOnFall())
2967 {
2969 {
2971 }
2972 else
2973 {
2975 {
2977 }
2979 }
2980 }
2981 }
2982
2984 {
2985 if (HasAnyAttachmentsOrCargo())
2986 {
2989 }
2990 }
2991
2992
2993
2994
2995
2998 {
2999 return null;
3000 }
3001
3003 {
3005 }
3006
3008 {
3011
3012 Man p;
3013
3014 #ifdef SERVER
3016 g_Game.GetWorld().GetPlayerList(players);
3017 if (players.Count())
3018 p = players[0];
3019 #else
3021 #endif
3022
3024 {
3025 bool excluded = false;
3027 if (excludes)
3028 {
3029 foreach (string exclude : excludes)
3030 {
3032 {
3033 excluded = true;
3034 break;
3035 }
3036 }
3037 }
3038
3039 if (!excluded)
3040 {
3042 }
3043 }
3044
3046 }
3047
3049
3051 [
Obsolete(
"handled in the Construction component directly")]
3053 {
3054 }
3055
3056 [
Obsolete(
"handled in the Construction component directly")]
3058 {
3059 }
3060
3061 [
Obsolete(
"obsolete debug method")]
3063 {
3064 }
3065}
3066
3068{
3069#ifdef BSB_DEBUG
3071#else
3072
3073#endif
3074}
3076{
3077#ifdef BSB_DEBUG_SPAM
3079#else
3080
3081#endif
3082}
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.