1634{
1636
1638
1640
1647
1648
1649
1655
1661
1663
1667
1668
1670 {
1672
1673
1674 RegisterNetSyncVariableInt( "m_SyncParts01" );
1675 RegisterNetSyncVariableInt( "m_SyncParts02" );
1676 RegisterNetSyncVariableInt( "m_SyncParts03" );
1677 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1678 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1679 RegisterNetSyncVariableBool( "m_HasBase" );
1680
1681
1682 ConstructionInit();
1683
1684 if (ConfigIsExisting("hybridAttachments"))
1685 {
1688 }
1689 if (ConfigIsExisting("mountables"))
1690 {
1693 }
1694
1696 SetAllowDamage(true);
1697 }
1698
1700 {
1701 return "disableBaseDamage";
1702 }
1703
1705 {
1706 return true;
1707 }
1708
1710 {
1711 return EInventoryIconVisibility.HIDE_VICINITY;
1712 }
1713
1715 {
1716 super.InitItemSounds();
1717
1721
1726 }
1727
1729 {
1730 return "putDown_FenceKit_SoundSet";
1731 }
1732
1734 {
1735 return "Shelter_Site_Build_Loop_SoundSet";
1736 }
1737
1738
1740 {
1742 {
1743 SetSynchDirty();
1744 }
1745 }
1746
1748 {
1750 super.OnVariablesSynchronized();
1751
1753 }
1754
1756 {
1757
1759
1760
1762
1763
1765 }
1766
1767
1769 {
1770
1771 int offset;
1772 int mask;
1773
1774 if ( part_id >= 1 && part_id <= 31 )
1775 {
1776 offset = part_id - 1;
1777 mask = 1 << offset;
1778
1780 }
1781 else if ( part_id >= 32 && part_id <= 62 )
1782 {
1783 offset = ( part_id % 32 );
1784 mask = 1 << offset;
1785
1787 }
1788 else if ( part_id >= 63 && part_id <= 93 )
1789 {
1790 offset = ( part_id % 63 );
1791 mask = 1 << offset;
1792
1794 }
1795 }
1796
1798 {
1799
1800 int offset;
1801 int mask;
1802
1803 if ( part_id >= 1 && part_id <= 31 )
1804 {
1805 offset = part_id - 1;
1806 mask = 1 << offset;
1807
1809 }
1810 else if ( part_id >= 32 && part_id <= 62 )
1811 {
1812 offset = ( part_id % 32 );
1813 mask = 1 << offset;
1814
1816 }
1817 else if ( part_id >= 63 && part_id <= 93 )
1818 {
1819 offset = ( part_id % 63 );
1820 mask = 1 << offset;
1821
1823 }
1824 }
1825
1827 {
1828
1829 int offset;
1830 int mask;
1831
1832 if ( part_id >= 1 && part_id <= 31 )
1833 {
1834 offset = part_id - 1;
1835 mask = 1 << offset;
1836
1838 {
1839 return true;
1840 }
1841 }
1842 else if ( part_id >= 32 && part_id <= 62 )
1843 {
1844 offset = ( part_id % 32 );
1845 mask = 1 << offset;
1846
1848 {
1849 return true;
1850 }
1851 }
1852 else if ( part_id >= 63 && part_id <= 93 )
1853 {
1854 offset = ( part_id % 63 );
1855 mask = 1 << offset;
1856
1858 {
1859 return true;
1860 }
1861 }
1862
1863 return false;
1864 }
1865
1867 {
1870 }
1871
1873 {
1874
1877 }
1878
1880 {
1882 {
1885
1886 switch( build_action_id )
1887 {
1891 }
1892 }
1893 }
1894
1895
1897 {
1899 bool is_base = part.
IsBase();
1902 if ( is_part_built_sync )
1903 {
1905 {
1909
1910 if (is_base)
1911 {
1914 }
1915 }
1916 }
1917 else
1918 {
1920 {
1924
1925 if (is_base)
1926 {
1929 }
1930 }
1931 }
1932
1933
1935 }
1936
1937
1939 {
1942
1943 for ( int i = 0; i < construction_parts.Count(); ++i )
1944 {
1945 string key = construction_parts.GetKey( i );
1948 }
1949
1950
1952 }
1953
1955 {
1958
1959 for ( int i = 0; i < construction_parts.Count(); ++i )
1960 {
1961 string key = construction_parts.GetKey( i );
1963
1964 if ( value.
GetId() ==
id )
1965 {
1966 return value;
1967 }
1968 }
1969
1970 return NULL;
1971 }
1972
1973
1974
1976 {
1978 }
1979
1981 {
1983 }
1984
1986 {
1987 return true;
1988 }
1989
1991 {
1992 return false;
1993 }
1994
1995
1997 {
2000 {
2002 }
2003
2004 return construction_kit;
2005 }
2006
2008 {
2011 {
2013 }
2014 }
2015
2017 {
2019 }
2020
2022 {
2023 return "";
2024 }
2025
2027 {
2029 g_Game.ObjectDelete( construction_kit );
2030 }
2031
2032
2034 {
2036 g_Game.ObjectDelete(
this );
2037 }
2038
2039
2041 {
2042 super.EEDelete(parent);
2043
2045 {
2046 areaDamage.Destroy();
2047 }
2048
2049 }
2050
2052 {
2053 super.OnStoreSave( ctx );
2054
2055
2059
2061 }
2062
2064 {
2065 if ( !super.OnStoreLoad( ctx, version ) )
2066 return false;
2067
2068
2069
2071 {
2073 return false;
2074 }
2076 {
2078 return false;
2079 }
2081 {
2083 return false;
2084 }
2085
2086
2088 {
2090 return false;
2091 }
2092
2093
2094 return true;
2095 }
2096
2098 {
2099 super.AfterStoreLoad();
2100
2102 {
2104 }
2105 }
2106
2108 {
2109
2111
2112
2115
2116
2118 }
2119
2121 {
2122 super.OnCreatePhysics();
2123
2124 ConstructionInit();
2126 }
2127
2129 {
2131 return;
2132
2133 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2134 }
2135
2137 {
2139 {
2141 }
2142
2143 super.EEOnAfterLoad();
2144 }
2145
2147 {
2148 super.EEItemAttached( item, slot_name );
2149
2153 }
2154
2156 {
2157 super.EEItemDetached( item, slot_name );
2158
2161 }
2162
2163 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2164 {
2167
2170 }
2171
2172
2174 {
2175 return true;
2176 }
2177
2178
2179
2181 {
2183
2184
2185 if (construtionPart.
IsBase())
2186 {
2188
2189
2191 }
2192
2193
2195
2196
2198
2199
2201
2203
2205
2206
2208
2209
2211 }
2212
2214 {
2215
2217 }
2218
2219
2221 {
2224
2225
2227
2228
2230
2231
2233
2234
2236
2238
2239
2241
2242
2244
2245
2246 if (construtionPart.
IsBase())
2247 {
2248
2250 }
2251 }
2252
2254 {
2255
2257 }
2258
2259
2260 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2261 {
2264
2265
2267
2268
2270
2271
2273
2274
2276
2278
2279
2281
2282
2284
2285
2286 if (construtionPart.
IsBase())
2287 {
2288
2290 }
2291 }
2292
2294 {
2295
2297 }
2298
2299
2301 {
2303
2306 }
2307
2309 {
2311
2313 {
2315 }
2316 else
2317 {
2319 }
2320
2322 }
2323
2325 {
2327
2329 foreach (
string slotName : attachmentSlots)
2330 {
2332 }
2333
2334
2337 else
2339
2341 }
2342
2344 {
2345 string slotNameMounted = slot_name + "_Mounted";
2346 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2347
2348 if (attachment)
2349 {
2350 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2351 if (barbedWire && barbedWire.IsMounted())
2353 else
2355
2356 if (is_locked)
2357 {
2358 SetAnimationPhase(slotNameMounted, 0);
2359 SetAnimationPhase(slot_name, 1);
2360 }
2361 else
2362 {
2363 SetAnimationPhase(slotNameMounted, 1);
2364 SetAnimationPhase(slot_name, 0);
2365 }
2366 }
2367 else
2368 {
2369 SetAnimationPhase(slotNameMounted, 1);
2370 SetAnimationPhase(slot_name, 1);
2371
2373 }
2374 }
2375
2376
2378 {
2381
2384
2387
2388 foreach (
string slotName : attachmentSlots)
2389 {
2391 }
2392
2393
2395 {
2398
2400 }
2401 else
2402 {
2405
2407 }
2408
2411 }
2412
2414 {
2415
2417 return;
2418
2419 string slot_name_mounted = slot_name + "_Mounted";
2420 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2421
2422
2424 RemoveProxyPhysics( slot_name_mounted );
2425 RemoveProxyPhysics( slot_name );
2426
2427 if ( attachment )
2428 {
2430 if ( is_locked )
2431 {
2433 AddProxyPhysics( slot_name_mounted );
2434 }
2435 else
2436 {
2438 AddProxyPhysics( slot_name );
2439 }
2440 }
2441 }
2442
2444 {
2445 SetAffectPathgraph( true, false );
2447 }
2448
2450 {
2451 return true;
2452 }
2453
2455 {
2456 return true;
2457 }
2458
2460 {
2461 if ( attachment )
2462 {
2464 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2465
2466 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2467 }
2468
2469 return false;
2470 }
2471
2473 {
2475 }
2476
2477
2479 {
2480 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2481 if (
g_Game.ConfigIsExisting( config_path ) )
2482 {
2483 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2484 }
2485 }
2486
2488 {
2489 return true;
2490 }
2491
2493 {
2494 return true;
2495 }
2496
2498 {
2499 return true;
2500 }
2501
2502
2504 {
2507 }
2508
2510 {
2512 }
2513
2515 {
2517 }
2518
2520 {
2521 int attachment_count = GetInventory().AttachmentCount();
2522 if ( attachment_count > 0 )
2523 {
2524 if (
HasBase() && attachment_count == 1 )
2525 {
2526 return false;
2527 }
2528
2529 return true;
2530 }
2531
2532 return false;
2533 }
2534
2536 {
2537 return true;
2538 }
2539
2541 {
2542 return false;
2543 }
2544
2545
2547 {
2548 return false;
2549 }
2550
2552 {
2553 return false;
2554 }
2555
2556
2558 {
2559 return false;
2560 }
2561
2562
2563
2565 {
2566 return true;
2567 }
2568
2570 {
2571 return true;
2572 }
2573
2576 {
2577 return false;
2578 }
2579
2580
2582 {
2583 return false;
2584 }
2585
2586
2588 {
2589 return true;
2590 }
2591
2592
2594 {
2595 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2596 {
2597 return false;
2598 }
2599
2600 return true;
2601 }
2602
2604 {
2607
2608 return item;
2609 }
2610
2611
2613 {
2615 {
2616
2618
2619
2622
2624 if ( MemoryPointExists( slot_name + "_min" ) )
2625 {
2626 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2627 }
2628 if ( MemoryPointExists( slot_name + "_max" ) )
2629 {
2630 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2631 }
2632
2633
2636
2637
2640 center = ModelToWorld( center );
2641
2642
2645
2646 areaDamage.SetExtents( extents[0], extents[1] );
2647 areaDamage.SetAreaPosition( center );
2651 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2652 areaDamage.SetAmmoName( "BarbedWireHit" );
2653 areaDamage.Spawn();
2654
2656 }
2657 }
2658
2660 {
2661 if ( angle_deg != 0 )
2662 {
2663
2665
2666
2668 if ( MemoryPointExists( "rotate_axis" ) )
2669 {
2670 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2671 }
2672 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];
2673 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];
2674 center[0] = r_center_x;
2675 center[2] = r_center_z;
2676 }
2677 }
2678
2680 {
2682 {
2685 {
2686 if (areaDamage)
2687 {
2688 areaDamage.Destroy();
2689 }
2690
2692 }
2693 }
2694 }
2695
2697 {
2698 return true;
2699 }
2700
2701
2702
2703
2705 {
2707 }
2708
2710 {
2712 }
2713
2715 {
2717 }
2718
2720 {
2722
2723 switch ( material_type )
2724 {
2730 }
2731
2732 return "";
2733 }
2734
2736 {
2738
2739 switch ( material_type )
2740 {
2746 }
2747
2748 return "";
2749 }
2750
2751
2753 {
2755 {
2756
2758 {
2759 SetHealth(slot_name,"Health",item.GetHealth());
2760 }
2761 }
2762 }
2763
2765 {
2766 return 111;
2767 }
2768
2770 {
2771 super.SetActions();
2772
2776 }
2777
2779 {
2781 if (!construction)
2782 return;
2783
2785 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2786 {
2789 {
2791 }
2792 }
2793 }
2794
2796 {
2798 if (!construction)
2799 return;
2800
2802 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2803 {
2806 {
2807 construction.HandleEntityFalling(part.
GetPartName());
2808 }
2809 }
2810 }
2811
2814 {
2816 return;
2817
2820
2821 if (DestroyOnFall())
2822 {
2824 {
2826 }
2827 else
2828 {
2830 {
2832 }
2834 }
2835 }
2836 }
2837
2839 {
2840 if (HasAnyAttachmentsOrCargo())
2841 {
2844 }
2845 }
2846
2847
2848
2849
2850
2853 {
2854 return null;
2855 }
2856
2858 {
2860 }
2861
2863 {
2866
2867 Man p;
2868
2869 #ifdef SERVER
2871 g_Game.GetWorld().GetPlayerList(players);
2872 if (players.Count())
2873 p = players[0];
2874 #else
2876 #endif
2877
2879 {
2880 bool excluded = false;
2882 if (excludes)
2883 {
2884 foreach (string exclude : excludes)
2885 {
2887 {
2888 excluded = true;
2889 break;
2890 }
2891 }
2892 }
2893
2894 if (!excluded)
2895 {
2897 }
2898 }
2899
2901 }
2902
2904
2906 [
Obsolete(
"handled in the Construction component directly")]
2908 {
2909 }
2910
2911 [
Obsolete(
"handled in the Construction component directly")]
2913 {
2914 }
2915
2916 [
Obsolete(
"obsolete debug method")]
2918 {
2919 }
2920}
2921
2923{
2924#ifdef BSB_DEBUG
2926#else
2927
2928#endif
2929}
2931{
2932#ifdef BSB_DEBUG_SPAM
2934#else
2935
2936#endif
2937}
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.