1613{
1615
1617
1619
1626
1627
1628
1634
1640
1642
1646
1647
1649 {
1651
1652
1653 RegisterNetSyncVariableInt( "m_SyncParts01" );
1654 RegisterNetSyncVariableInt( "m_SyncParts02" );
1655 RegisterNetSyncVariableInt( "m_SyncParts03" );
1656 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1657 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1658 RegisterNetSyncVariableBool( "m_HasBase" );
1659
1660
1661 ConstructionInit();
1662
1663 if (ConfigIsExisting("hybridAttachments"))
1664 {
1667 }
1668 if (ConfigIsExisting("mountables"))
1669 {
1672 }
1673
1675 SetAllowDamage(true);
1676 }
1677
1679 {
1680 return "disableBaseDamage";
1681 }
1682
1684 {
1685 return true;
1686 }
1687
1689 {
1690 return EInventoryIconVisibility.HIDE_VICINITY;
1691 }
1692
1694 {
1695 super.InitItemSounds();
1696
1700
1705 }
1706
1708 {
1709 return "putDown_FenceKit_SoundSet";
1710 }
1711
1713 {
1714 return "Shelter_Site_Build_Loop_SoundSet";
1715 }
1716
1717
1719 {
1721 {
1722 SetSynchDirty();
1723 }
1724 }
1725
1727 {
1729 super.OnVariablesSynchronized();
1730
1732 }
1733
1735 {
1736
1738
1739
1741
1742
1744 }
1745
1746
1748 {
1749
1750 int offset;
1751 int mask;
1752
1753 if ( part_id >= 1 && part_id <= 31 )
1754 {
1755 offset = part_id - 1;
1756 mask = 1 << offset;
1757
1759 }
1760 else if ( part_id >= 32 && part_id <= 62 )
1761 {
1762 offset = ( part_id % 32 );
1763 mask = 1 << offset;
1764
1766 }
1767 else if ( part_id >= 63 && part_id <= 93 )
1768 {
1769 offset = ( part_id % 63 );
1770 mask = 1 << offset;
1771
1773 }
1774 }
1775
1777 {
1778
1779 int offset;
1780 int mask;
1781
1782 if ( part_id >= 1 && part_id <= 31 )
1783 {
1784 offset = part_id - 1;
1785 mask = 1 << offset;
1786
1788 }
1789 else if ( part_id >= 32 && part_id <= 62 )
1790 {
1791 offset = ( part_id % 32 );
1792 mask = 1 << offset;
1793
1795 }
1796 else if ( part_id >= 63 && part_id <= 93 )
1797 {
1798 offset = ( part_id % 63 );
1799 mask = 1 << offset;
1800
1802 }
1803 }
1804
1806 {
1807
1808 int offset;
1809 int mask;
1810
1811 if ( part_id >= 1 && part_id <= 31 )
1812 {
1813 offset = part_id - 1;
1814 mask = 1 << offset;
1815
1817 {
1818 return true;
1819 }
1820 }
1821 else if ( part_id >= 32 && part_id <= 62 )
1822 {
1823 offset = ( part_id % 32 );
1824 mask = 1 << offset;
1825
1827 {
1828 return true;
1829 }
1830 }
1831 else if ( part_id >= 63 && part_id <= 93 )
1832 {
1833 offset = ( part_id % 63 );
1834 mask = 1 << offset;
1835
1837 {
1838 return true;
1839 }
1840 }
1841
1842 return false;
1843 }
1844
1846 {
1849 }
1850
1852 {
1853
1856 }
1857
1859 {
1861 {
1864
1865 switch( build_action_id )
1866 {
1870 }
1871 }
1872 }
1873
1874
1876 {
1878 bool is_base = part.
IsBase();
1881 if ( is_part_built_sync )
1882 {
1884 {
1888
1889 if (is_base)
1890 {
1893 }
1894 }
1895 }
1896 else
1897 {
1899 {
1903
1904 if (is_base)
1905 {
1908 }
1909 }
1910 }
1911
1912
1914 }
1915
1916
1918 {
1921
1922 for ( int i = 0; i < construction_parts.Count(); ++i )
1923 {
1924 string key = construction_parts.GetKey( i );
1927 }
1928
1929
1931 }
1932
1934 {
1937
1938 for ( int i = 0; i < construction_parts.Count(); ++i )
1939 {
1940 string key = construction_parts.GetKey( i );
1942
1943 if ( value.
GetId() ==
id )
1944 {
1945 return value;
1946 }
1947 }
1948
1949 return NULL;
1950 }
1951
1952
1953
1955 {
1957 }
1958
1960 {
1962 }
1963
1965 {
1966 return true;
1967 }
1968
1970 {
1971 return false;
1972 }
1973
1974
1976 {
1979 {
1981 }
1982
1983 return construction_kit;
1984 }
1985
1987 {
1990 {
1992 }
1993 }
1994
1996 {
1998 }
1999
2001 {
2002 return "";
2003 }
2004
2006 {
2008 g_Game.ObjectDelete( construction_kit );
2009 }
2010
2011
2013 {
2015 g_Game.ObjectDelete(
this );
2016 }
2017
2018
2020 {
2021 super.EEDelete(parent);
2022
2024 {
2025 areaDamage.Destroy();
2026 }
2027
2028 }
2029
2031 {
2032 super.OnStoreSave( ctx );
2033
2034
2038
2040 }
2041
2043 {
2044 if ( !super.OnStoreLoad( ctx, version ) )
2045 return false;
2046
2047
2048
2050 {
2052 return false;
2053 }
2055 {
2057 return false;
2058 }
2060 {
2062 return false;
2063 }
2064
2065
2067 {
2069 return false;
2070 }
2071
2072
2073 return true;
2074 }
2075
2077 {
2078 super.AfterStoreLoad();
2079
2081 {
2083 }
2084 }
2085
2087 {
2088
2090
2091
2094
2095
2097 }
2098
2100 {
2101 super.OnCreatePhysics();
2102
2103 ConstructionInit();
2105 }
2106
2108 {
2110 return;
2111
2112 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2113 }
2114
2116 {
2118 {
2120 }
2121
2122 super.EEOnAfterLoad();
2123 }
2124
2126 {
2127 super.EEItemAttached( item, slot_name );
2128
2132 }
2133
2135 {
2136 super.EEItemDetached( item, slot_name );
2137
2140 }
2141
2142 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2143 {
2146
2149 }
2150
2151
2153 {
2154 return true;
2155 }
2156
2157
2158
2160 {
2162
2163
2164 if (construtionPart.
IsBase())
2165 {
2167
2168
2170 }
2171
2172
2174
2175
2177
2178
2180
2182
2184
2185
2187
2188
2190 }
2191
2193 {
2194
2196 }
2197
2198
2200 {
2203
2204
2206
2207
2209
2210
2212
2213
2215
2217
2218
2220
2221
2223
2224
2225 if (construtionPart.
IsBase())
2226 {
2227
2229 }
2230 }
2231
2233 {
2234
2236 }
2237
2238
2239 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2240 {
2243
2244
2246
2247
2249
2250
2252
2253
2255
2257
2258
2260
2261
2263
2264
2265 if (construtionPart.
IsBase())
2266 {
2267
2269 }
2270 }
2271
2273 {
2274
2276 }
2277
2278
2280 {
2282
2285 }
2286
2288 {
2290
2292 {
2294 }
2295 else
2296 {
2298 }
2299
2301 }
2302
2304 {
2306
2308 foreach (
string slotName : attachmentSlots)
2309 {
2311 }
2312
2313
2316 else
2318
2320 }
2321
2323 {
2324 string slotNameMounted = slot_name + "_Mounted";
2325 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2326
2327 if (attachment)
2328 {
2329 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2330 if (barbedWire && barbedWire.IsMounted())
2332 else
2334
2335 if (is_locked)
2336 {
2337 SetAnimationPhase(slotNameMounted, 0);
2338 SetAnimationPhase(slot_name, 1);
2339 }
2340 else
2341 {
2342 SetAnimationPhase(slotNameMounted, 1);
2343 SetAnimationPhase(slot_name, 0);
2344 }
2345 }
2346 else
2347 {
2348 SetAnimationPhase(slotNameMounted, 1);
2349 SetAnimationPhase(slot_name, 1);
2350
2352 }
2353 }
2354
2355
2357 {
2360
2363
2366
2367 foreach (
string slotName : attachmentSlots)
2368 {
2370 }
2371
2372
2374 {
2377
2379 }
2380 else
2381 {
2384
2386 }
2387
2390 }
2391
2393 {
2394
2396 return;
2397
2398 string slot_name_mounted = slot_name + "_Mounted";
2399 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2400
2401
2403 RemoveProxyPhysics( slot_name_mounted );
2404 RemoveProxyPhysics( slot_name );
2405
2406 if ( attachment )
2407 {
2409 if ( is_locked )
2410 {
2412 AddProxyPhysics( slot_name_mounted );
2413 }
2414 else
2415 {
2417 AddProxyPhysics( slot_name );
2418 }
2419 }
2420 }
2421
2423 {
2424 SetAffectPathgraph( true, false );
2426 }
2427
2429 {
2430 return true;
2431 }
2432
2434 {
2435 return true;
2436 }
2437
2439 {
2440 if ( attachment )
2441 {
2443 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2444
2445 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2446 }
2447
2448 return false;
2449 }
2450
2452 {
2454 }
2455
2456
2458 {
2459 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2460 if (
g_Game.ConfigIsExisting( config_path ) )
2461 {
2462 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2463 }
2464 }
2465
2467 {
2468 return true;
2469 }
2470
2472 {
2473 return true;
2474 }
2475
2477 {
2478 return true;
2479 }
2480
2481
2483 {
2486 }
2487
2489 {
2491 }
2492
2494 {
2496 }
2497
2499 {
2500 int attachment_count = GetInventory().AttachmentCount();
2501 if ( attachment_count > 0 )
2502 {
2503 if (
HasBase() && attachment_count == 1 )
2504 {
2505 return false;
2506 }
2507
2508 return true;
2509 }
2510
2511 return false;
2512 }
2513
2515 {
2516 return true;
2517 }
2518
2520 {
2521 return false;
2522 }
2523
2524
2526 {
2527 return false;
2528 }
2529
2531 {
2532 return false;
2533 }
2534
2535
2537 {
2538 return false;
2539 }
2540
2541
2542
2544 {
2545 return true;
2546 }
2547
2549 {
2550 return true;
2551 }
2552
2555 {
2556 return false;
2557 }
2558
2559
2561 {
2562 return false;
2563 }
2564
2565
2567 {
2568 return true;
2569 }
2570
2571
2573 {
2574 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2575 {
2576 return false;
2577 }
2578
2579 return true;
2580 }
2581
2583 {
2586
2587 return item;
2588 }
2589
2590
2592 {
2594 {
2595
2597
2598
2601
2603 if ( MemoryPointExists( slot_name + "_min" ) )
2604 {
2605 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2606 }
2607 if ( MemoryPointExists( slot_name + "_max" ) )
2608 {
2609 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2610 }
2611
2612
2615
2616
2619 center = ModelToWorld( center );
2620
2621
2624
2625 areaDamage.SetExtents( extents[0], extents[1] );
2626 areaDamage.SetAreaPosition( center );
2630 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2631 areaDamage.SetAmmoName( "BarbedWireHit" );
2632 areaDamage.Spawn();
2633
2635 }
2636 }
2637
2639 {
2640 if ( angle_deg != 0 )
2641 {
2642
2644
2645
2647 if ( MemoryPointExists( "rotate_axis" ) )
2648 {
2649 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2650 }
2651 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];
2652 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];
2653 center[0] = r_center_x;
2654 center[2] = r_center_z;
2655 }
2656 }
2657
2659 {
2661 {
2664 {
2665 if (areaDamage)
2666 {
2667 areaDamage.Destroy();
2668 }
2669
2671 }
2672 }
2673 }
2674
2676 {
2677 return true;
2678 }
2679
2680
2681
2682
2684 {
2686 }
2687
2689 {
2691 }
2692
2694 {
2696 }
2697
2699 {
2701
2702 switch ( material_type )
2703 {
2709 }
2710
2711 return "";
2712 }
2713
2715 {
2717
2718 switch ( material_type )
2719 {
2725 }
2726
2727 return "";
2728 }
2729
2730
2732 {
2734 {
2735
2737 {
2738 SetHealth(slot_name,"Health",item.GetHealth());
2739 }
2740 }
2741 }
2742
2744 {
2745 return 111;
2746 }
2747
2749 {
2750 super.SetActions();
2751
2755 }
2756
2758 {
2760 if (!construction)
2761 return;
2762
2764 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2765 {
2768 {
2770 }
2771 }
2772 }
2773
2775 {
2777 if (!construction)
2778 return;
2779
2781 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2782 {
2785 {
2786 construction.HandleEntityFalling(part.
GetPartName());
2787 }
2788 }
2789 }
2790
2793 {
2795 return;
2796
2799
2800 if (DestroyOnFall())
2801 {
2803 {
2805 }
2806 else
2807 {
2809 {
2811 }
2813 }
2814 }
2815 }
2816
2818 {
2819 if (HasAnyAttachmentsOrCargo())
2820 {
2823 }
2824 }
2825
2826
2827
2828
2829
2832 {
2833 return null;
2834 }
2835
2837 {
2839 }
2840
2842 {
2845
2846 Man p;
2847
2848 #ifdef SERVER
2850 g_Game.GetWorld().GetPlayerList(players);
2851 if (players.Count())
2852 p = players[0];
2853 #else
2855 #endif
2856
2858 {
2859 bool excluded = false;
2861 if (excludes)
2862 {
2863 foreach (string exclude : excludes)
2864 {
2866 {
2867 excluded = true;
2868 break;
2869 }
2870 }
2871 }
2872
2873 if (!excluded)
2874 {
2876 }
2877 }
2878
2880 }
2881
2883
2885 [
Obsolete(
"handled in the Construction component directly")]
2887 {
2888 }
2889
2890 [
Obsolete(
"handled in the Construction component directly")]
2892 {
2893 }
2894
2895 [
Obsolete(
"obsolete debug method")]
2897 {
2898 }
2899}
2900
2902{
2903#ifdef BSB_DEBUG
2905#else
2906
2907#endif
2908}
2910{
2911#ifdef BSB_DEBUG_SPAM
2913#else
2914
2915#endif
2916}
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.