1722{
1724
1726
1728
1735
1736
1737
1743
1749
1751
1755
1756
1758 {
1760
1761
1762 RegisterNetSyncVariableInt( "m_SyncParts01" );
1763 RegisterNetSyncVariableInt( "m_SyncParts02" );
1764 RegisterNetSyncVariableInt( "m_SyncParts03" );
1765 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1766 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1767 RegisterNetSyncVariableBool( "m_HasBase" );
1768
1769
1770 ConstructionInit();
1771
1772 if (ConfigIsExisting("hybridAttachments"))
1773 {
1776 }
1777 if (ConfigIsExisting("mountables"))
1778 {
1781 }
1782
1784 SetAllowDamage(true);
1785 }
1786
1788 {
1789 return "disableBaseDamage";
1790 }
1791
1793 {
1794 return true;
1795 }
1796
1798 {
1799 return EInventoryIconVisibility.HIDE_VICINITY;
1800 }
1801
1803 {
1804 super.InitItemSounds();
1805
1809
1814 }
1815
1817 {
1818 return "putDown_FenceKit_SoundSet";
1819 }
1820
1822 {
1823 return "Shelter_Site_Build_Loop_SoundSet";
1824 }
1825
1826
1828 {
1830 {
1831 SetSynchDirty();
1832 }
1833 }
1834
1836 {
1838 super.OnVariablesSynchronized();
1839
1841 }
1842
1844 {
1845
1847
1848
1850
1851
1853 }
1854
1855
1857 {
1858
1859 int offset;
1860 int mask;
1861
1862 if ( part_id >= 1 && part_id <= 31 )
1863 {
1864 offset = part_id - 1;
1865 mask = 1 << offset;
1866
1868 }
1869 else if ( part_id >= 32 && part_id <= 62 )
1870 {
1871 offset = ( part_id % 32 );
1872 mask = 1 << offset;
1873
1875 }
1876 else if ( part_id >= 63 && part_id <= 93 )
1877 {
1878 offset = ( part_id % 63 );
1879 mask = 1 << offset;
1880
1882 }
1883 }
1884
1886 {
1887
1888 int offset;
1889 int mask;
1890
1891 if ( part_id >= 1 && part_id <= 31 )
1892 {
1893 offset = part_id - 1;
1894 mask = 1 << offset;
1895
1897 }
1898 else if ( part_id >= 32 && part_id <= 62 )
1899 {
1900 offset = ( part_id % 32 );
1901 mask = 1 << offset;
1902
1904 }
1905 else if ( part_id >= 63 && part_id <= 93 )
1906 {
1907 offset = ( part_id % 63 );
1908 mask = 1 << offset;
1909
1911 }
1912 }
1913
1915 {
1916
1917 int offset;
1918 int mask;
1919
1920 if ( part_id >= 1 && part_id <= 31 )
1921 {
1922 offset = part_id - 1;
1923 mask = 1 << offset;
1924
1926 {
1927 return true;
1928 }
1929 }
1930 else if ( part_id >= 32 && part_id <= 62 )
1931 {
1932 offset = ( part_id % 32 );
1933 mask = 1 << offset;
1934
1936 {
1937 return true;
1938 }
1939 }
1940 else if ( part_id >= 63 && part_id <= 93 )
1941 {
1942 offset = ( part_id % 63 );
1943 mask = 1 << offset;
1944
1946 {
1947 return true;
1948 }
1949 }
1950
1951 return false;
1952 }
1953
1955 {
1958 }
1959
1961 {
1962
1965 }
1966
1968 {
1970 {
1973
1974 switch( build_action_id )
1975 {
1979 }
1980 }
1981 }
1982
1983
1985 {
1987 bool is_base = part.
IsBase();
1990 if ( is_part_built_sync )
1991 {
1993 {
1997
1998 if (is_base)
1999 {
2002 }
2003 }
2004 }
2005 else
2006 {
2008 {
2012
2013 if (is_base)
2014 {
2017 }
2018 }
2019 }
2020
2021
2023 }
2024
2025
2027 {
2030
2031 for ( int i = 0; i < construction_parts.Count(); ++i )
2032 {
2033 string key = construction_parts.GetKey( i );
2036 }
2037
2038
2040 }
2041
2043 {
2046
2047 for ( int i = 0; i < construction_parts.Count(); ++i )
2048 {
2049 string key = construction_parts.GetKey( i );
2051
2052 if ( value.
GetId() ==
id )
2053 {
2054 return value;
2055 }
2056 }
2057
2058 return NULL;
2059 }
2060
2061
2062
2064 {
2066 }
2067
2069 {
2071 }
2072
2074 {
2075 return true;
2076 }
2077
2079 {
2080 return false;
2081 }
2082
2083
2085 {
2088 {
2090 }
2091
2092 return construction_kit;
2093 }
2094
2096 {
2099 {
2101 }
2102 }
2103
2105 {
2107 }
2108
2110 {
2111 return "";
2112 }
2113
2115 {
2117 g_Game.ObjectDelete( construction_kit );
2118 }
2119
2120
2122 {
2124 g_Game.ObjectDelete(
this );
2125 }
2126
2127
2129 {
2130 super.EEDelete(parent);
2131
2133 {
2134 areaDamage.Destroy();
2135 }
2136
2137 }
2138
2140 {
2141 super.OnStoreSave( ctx );
2142
2143
2147
2149 }
2150
2152 {
2153 if ( !super.OnStoreLoad( ctx, version ) )
2154 return false;
2155
2156
2157
2159 {
2161 return false;
2162 }
2164 {
2166 return false;
2167 }
2169 {
2171 return false;
2172 }
2173
2174
2176 {
2178 return false;
2179 }
2180
2181
2182 return true;
2183 }
2184
2186 {
2187 super.AfterStoreLoad();
2188
2190 {
2192 }
2193 }
2194
2196 {
2197
2199
2200
2203
2204
2206 }
2207
2209 {
2210 super.OnCreatePhysics();
2211
2212 ConstructionInit();
2214 }
2215
2217 {
2219 return;
2220
2221 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2222 }
2223
2225 {
2227 {
2229 }
2230
2231 super.EEOnAfterLoad();
2232 }
2233
2235 {
2236 super.EEItemAttached( item, slot_name );
2237
2241 }
2242
2244 {
2245 super.EEItemDetached( item, slot_name );
2246
2249 }
2250
2251 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2252 {
2255
2258 }
2259
2260
2262 {
2263 return true;
2264 }
2265
2266
2267
2269 {
2271
2272
2273 if (construtionPart.
IsBase())
2274 {
2276
2277
2279 }
2280
2281
2283
2284
2286
2287
2289
2291
2293
2294
2296
2297
2299 }
2300
2302 {
2303
2305 }
2306
2307
2309 {
2312
2313
2315
2316
2318
2319
2321
2322
2324
2326
2327
2329
2330
2332
2333
2334 if (construtionPart.
IsBase())
2335 {
2336
2338 }
2339 }
2340
2342 {
2343
2345 }
2346
2347
2348 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2349 {
2352
2353
2355
2356
2358
2359
2361
2362
2364
2366
2367
2369
2370
2372
2373
2374 if (construtionPart.
IsBase())
2375 {
2376
2378 }
2379 }
2380
2382 {
2383
2385 }
2386
2387
2389 {
2391
2394 }
2395
2397 {
2399
2401 {
2403 }
2404 else
2405 {
2407 }
2408
2410 }
2411
2413 {
2415
2417 foreach (
string slotName : attachmentSlots)
2418 {
2420 }
2421
2422
2425 else
2427
2429 }
2430
2432 {
2433 string slotNameMounted = slot_name + "_Mounted";
2434 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2435
2436 if (attachment)
2437 {
2438 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2439 if (barbedWire && barbedWire.IsMounted())
2441 else
2443
2444 if (is_locked)
2445 {
2446 SetAnimationPhase(slotNameMounted, 0);
2447 SetAnimationPhase(slot_name, 1);
2448 }
2449 else
2450 {
2451 SetAnimationPhase(slotNameMounted, 1);
2452 SetAnimationPhase(slot_name, 0);
2453 }
2454 }
2455 else
2456 {
2457 SetAnimationPhase(slotNameMounted, 1);
2458 SetAnimationPhase(slot_name, 1);
2459
2461 }
2462 }
2463
2464
2466 {
2469
2472
2475
2476 foreach (
string slotName : attachmentSlots)
2477 {
2479 }
2480
2481
2483 {
2486
2488 }
2489 else
2490 {
2493
2495 }
2496
2499 }
2500
2502 {
2503
2505 return;
2506
2507 string slot_name_mounted = slot_name + "_Mounted";
2508 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2509
2510
2512 RemoveProxyPhysics( slot_name_mounted );
2513 RemoveProxyPhysics( slot_name );
2514
2515 if ( attachment )
2516 {
2518 if ( is_locked )
2519 {
2521 AddProxyPhysics( slot_name_mounted );
2522 }
2523 else
2524 {
2526 AddProxyPhysics( slot_name );
2527 }
2528 }
2529 }
2530
2532 {
2533 SetAffectPathgraph( true, false );
2535 }
2536
2538 {
2539 return true;
2540 }
2541
2543 {
2544 return true;
2545 }
2546
2548 {
2549 if ( attachment )
2550 {
2552 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2553
2554 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2555 }
2556
2557 return false;
2558 }
2559
2561 {
2563 }
2564
2565
2567 {
2568 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2569 if (
g_Game.ConfigIsExisting( config_path ) )
2570 {
2571 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2572 }
2573 }
2574
2576 {
2577 return true;
2578 }
2579
2581 {
2582 return true;
2583 }
2584
2586 {
2587 return true;
2588 }
2589
2590
2592 {
2595 }
2596
2598 {
2600 }
2601
2603 {
2605 }
2606
2608 {
2609 int attachment_count = GetInventory().AttachmentCount();
2610 if ( attachment_count > 0 )
2611 {
2612 if (
HasBase() && attachment_count == 1 )
2613 {
2614 return false;
2615 }
2616
2617 return true;
2618 }
2619
2620 return false;
2621 }
2622
2624 {
2625 return true;
2626 }
2627
2629 {
2630 return false;
2631 }
2632
2633
2635 {
2636 return false;
2637 }
2638
2640 {
2641 return false;
2642 }
2643
2644
2646 {
2647 return false;
2648 }
2649
2650
2651
2653 {
2654 return true;
2655 }
2656
2658 {
2659 return true;
2660 }
2661
2664 {
2665 return false;
2666 }
2667
2668
2670 {
2671 return false;
2672 }
2673
2674
2676 {
2677 return true;
2678 }
2679
2680
2682 {
2683 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2684 {
2685 return false;
2686 }
2687
2688 return true;
2689 }
2690
2692 {
2695
2696 return item;
2697 }
2698
2699
2701 {
2703 {
2704
2706
2707
2710
2712 if ( MemoryPointExists( slot_name + "_min" ) )
2713 {
2714 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2715 }
2716 if ( MemoryPointExists( slot_name + "_max" ) )
2717 {
2718 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2719 }
2720
2721
2724
2725
2728 center = ModelToWorld( center );
2729
2730
2733
2734 areaDamage.SetExtents( extents[0], extents[1] );
2735 areaDamage.SetAreaPosition( center );
2739 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2740 areaDamage.SetAmmoName( "BarbedWireHit" );
2741 areaDamage.Spawn();
2742
2744 }
2745 }
2746
2748 {
2749 if ( angle_deg != 0 )
2750 {
2751
2753
2754
2756 if ( MemoryPointExists( "rotate_axis" ) )
2757 {
2758 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2759 }
2760 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];
2761 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];
2762 center[0] = r_center_x;
2763 center[2] = r_center_z;
2764 }
2765 }
2766
2768 {
2770 {
2773 {
2774 if (areaDamage)
2775 {
2776 areaDamage.Destroy();
2777 }
2778
2780 }
2781 }
2782 }
2783
2785 {
2786 return true;
2787 }
2788
2789
2790
2791
2793 {
2795 }
2796
2798 {
2800 }
2801
2803 {
2805 }
2806
2808 {
2810
2811 switch ( material_type )
2812 {
2818 }
2819
2820 return "";
2821 }
2822
2824 {
2826
2827 switch ( material_type )
2828 {
2834 }
2835
2836 return "";
2837 }
2838
2839
2841 {
2843 {
2844
2846 {
2847 SetHealth(slot_name,"Health",item.GetHealth());
2848 }
2849 }
2850 }
2851
2853 {
2854 return 111;
2855 }
2856
2858 {
2859 super.SetActions();
2860
2864 }
2865
2867 {
2869 if (!construction)
2870 return;
2871
2873 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2874 {
2877 {
2879 }
2880 }
2881 }
2882
2884 {
2886 if (!construction)
2887 return;
2888
2890 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2891 {
2894 {
2895 construction.HandleEntityFalling(part.
GetPartName());
2896 }
2897 }
2898 }
2899
2902 {
2904 return;
2905
2908
2909 if (DestroyOnFall())
2910 {
2912 {
2914 }
2915 else
2916 {
2918 {
2920 }
2922 }
2923 }
2924 }
2925
2927 {
2928 if (HasAnyAttachmentsOrCargo())
2929 {
2932 }
2933 }
2934
2935
2936
2937
2938
2941 {
2942 return null;
2943 }
2944
2946 {
2948 }
2949
2951 {
2954
2955 Man p;
2956
2957 #ifdef SERVER
2959 g_Game.GetWorld().GetPlayerList(players);
2960 if (players.Count())
2961 p = players[0];
2962 #else
2964 #endif
2965
2967 {
2968 bool excluded = false;
2970 if (excludes)
2971 {
2972 foreach (string exclude : excludes)
2973 {
2975 {
2976 excluded = true;
2977 break;
2978 }
2979 }
2980 }
2981
2982 if (!excluded)
2983 {
2985 }
2986 }
2987
2989 }
2990
2992
2994 [
Obsolete(
"handled in the Construction component directly")]
2996 {
2997 }
2998
2999 [
Obsolete(
"handled in the Construction component directly")]
3001 {
3002 }
3003
3004 [
Obsolete(
"obsolete debug method")]
3006 {
3007 }
3008}
3009
3011{
3012#ifdef BSB_DEBUG
3014#else
3015
3016#endif
3017}
3019{
3020#ifdef BSB_DEBUG_SPAM
3022#else
3023
3024#endif
3025}
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.