1555{
1557
1559
1561
1568
1569
1570
1576
1582
1584
1588
1589
1591 {
1593
1594
1595 RegisterNetSyncVariableInt( "m_SyncParts01" );
1596 RegisterNetSyncVariableInt( "m_SyncParts02" );
1597 RegisterNetSyncVariableInt( "m_SyncParts03" );
1598 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1599 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1600 RegisterNetSyncVariableBool( "m_HasBase" );
1601
1602
1603 ConstructionInit();
1604
1605 if (ConfigIsExisting("hybridAttachments"))
1606 {
1609 }
1610 if (ConfigIsExisting("mountables"))
1611 {
1614 }
1615
1617 SetAllowDamage(true);
1618 }
1619
1621 {
1622 return "disableBaseDamage";
1623 }
1624
1626 {
1627 return true;
1628 }
1629
1631 {
1632 return EInventoryIconVisibility.HIDE_VICINITY;
1633 }
1634
1636 {
1637 super.InitItemSounds();
1638
1642
1647 }
1648
1650 {
1651 return "putDown_FenceKit_SoundSet";
1652 }
1653
1655 {
1656 return "Shelter_Site_Build_Loop_SoundSet";
1657 }
1658
1659
1661 {
1663 {
1664 SetSynchDirty();
1665 }
1666 }
1667
1669 {
1671 super.OnVariablesSynchronized();
1672
1674 }
1675
1677 {
1678
1680
1681
1683
1684
1686 }
1687
1688
1690 {
1691
1692 int offset;
1693 int mask;
1694
1695 if ( part_id >= 1 && part_id <= 31 )
1696 {
1697 offset = part_id - 1;
1698 mask = 1 << offset;
1699
1701 }
1702 else if ( part_id >= 32 && part_id <= 62 )
1703 {
1704 offset = ( part_id % 32 );
1705 mask = 1 << offset;
1706
1708 }
1709 else if ( part_id >= 63 && part_id <= 93 )
1710 {
1711 offset = ( part_id % 63 );
1712 mask = 1 << offset;
1713
1715 }
1716 }
1717
1719 {
1720
1721 int offset;
1722 int mask;
1723
1724 if ( part_id >= 1 && part_id <= 31 )
1725 {
1726 offset = part_id - 1;
1727 mask = 1 << offset;
1728
1730 }
1731 else if ( part_id >= 32 && part_id <= 62 )
1732 {
1733 offset = ( part_id % 32 );
1734 mask = 1 << offset;
1735
1737 }
1738 else if ( part_id >= 63 && part_id <= 93 )
1739 {
1740 offset = ( part_id % 63 );
1741 mask = 1 << offset;
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 return true;
1761 }
1762 }
1763 else if ( part_id >= 32 && part_id <= 62 )
1764 {
1765 offset = ( part_id % 32 );
1766 mask = 1 << offset;
1767
1769 {
1770 return true;
1771 }
1772 }
1773 else if ( part_id >= 63 && part_id <= 93 )
1774 {
1775 offset = ( part_id % 63 );
1776 mask = 1 << offset;
1777
1779 {
1780 return true;
1781 }
1782 }
1783
1784 return false;
1785 }
1786
1788 {
1791 }
1792
1794 {
1795
1798 }
1799
1801 {
1803 {
1806
1807 switch( build_action_id )
1808 {
1812 }
1813 }
1814 }
1815
1816
1818 {
1820 bool is_base = part.
IsBase();
1823 if ( is_part_built_sync )
1824 {
1826 {
1830
1831 if (is_base)
1832 {
1835 }
1836 }
1837 }
1838 else
1839 {
1841 {
1845
1846 if (is_base)
1847 {
1850 }
1851 }
1852 }
1853
1854
1856 }
1857
1858
1860 {
1863
1864 for ( int i = 0; i < construction_parts.Count(); ++i )
1865 {
1866 string key = construction_parts.GetKey( i );
1869 }
1870
1871
1873 }
1874
1876 {
1879
1880 for ( int i = 0; i < construction_parts.Count(); ++i )
1881 {
1882 string key = construction_parts.GetKey( i );
1884
1885 if ( value.
GetId() ==
id )
1886 {
1887 return value;
1888 }
1889 }
1890
1891 return NULL;
1892 }
1893
1894
1895
1897 {
1899 }
1900
1902 {
1904 }
1905
1907 {
1908 return true;
1909 }
1910
1912 {
1913 return false;
1914 }
1915
1916
1918 {
1921 {
1923 }
1924
1925 return construction_kit;
1926 }
1927
1929 {
1932 {
1934 }
1935 }
1936
1938 {
1940 }
1941
1943 {
1944 return "";
1945 }
1946
1948 {
1950 g_Game.ObjectDelete( construction_kit );
1951 }
1952
1953
1955 {
1957 g_Game.ObjectDelete(
this );
1958 }
1959
1960
1962 {
1963 super.EEDelete(parent);
1964
1966 {
1967 areaDamage.Destroy();
1968 }
1969
1970 }
1971
1973 {
1974 super.OnStoreSave( ctx );
1975
1976
1980
1982 }
1983
1985 {
1986 if ( !super.OnStoreLoad( ctx, version ) )
1987 return false;
1988
1989
1990
1992 {
1994 return false;
1995 }
1997 {
1999 return false;
2000 }
2002 {
2004 return false;
2005 }
2006
2007
2009 {
2011 return false;
2012 }
2013
2014
2015 return true;
2016 }
2017
2019 {
2020 super.AfterStoreLoad();
2021
2023 {
2025 }
2026 }
2027
2029 {
2030
2032
2033
2036
2037
2039 }
2040
2042 {
2043 super.OnCreatePhysics();
2044
2045 ConstructionInit();
2047 }
2048
2050 {
2052 return;
2053
2054 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2055 }
2056
2058 {
2060 {
2062 }
2063
2064 super.EEOnAfterLoad();
2065 }
2066
2068 {
2069 super.EEItemAttached( item, slot_name );
2070
2074 }
2075
2077 {
2078 super.EEItemDetached( item, slot_name );
2079
2082 }
2083
2084 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2085 {
2088
2091 }
2092
2093
2095 {
2096 return true;
2097 }
2098
2099
2100
2102 {
2104
2105
2106 if (construtionPart.
IsBase())
2107 {
2109
2110
2112 }
2113
2114
2116
2117
2119
2120
2122
2124
2126
2127
2129
2130
2132 }
2133
2135 {
2136
2138 }
2139
2140
2142 {
2145
2146
2148
2149
2151
2152
2154
2155
2157
2159
2160
2162
2163
2165
2166
2167 if (construtionPart.
IsBase())
2168 {
2169
2171 }
2172 }
2173
2175 {
2176
2178 }
2179
2180
2181 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2182 {
2185
2186
2188
2189
2191
2192
2194
2195
2197
2199
2200
2202
2203
2205
2206
2207 if (construtionPart.
IsBase())
2208 {
2209
2211 }
2212 }
2213
2215 {
2216
2218 }
2219
2220
2222 {
2224
2227 }
2228
2230 {
2232
2234 {
2236 }
2237 else
2238 {
2240 }
2241
2243 }
2244
2246 {
2248
2250 foreach (
string slotName : attachmentSlots)
2251 {
2253 }
2254
2255
2258 else
2260
2262 }
2263
2265 {
2266 string slotNameMounted = slot_name + "_Mounted";
2267 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2268
2269 if (attachment)
2270 {
2271 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2272 if (barbedWire && barbedWire.IsMounted())
2274 else
2276
2277 if (is_locked)
2278 {
2279 SetAnimationPhase(slotNameMounted, 0);
2280 SetAnimationPhase(slot_name, 1);
2281 }
2282 else
2283 {
2284 SetAnimationPhase(slotNameMounted, 1);
2285 SetAnimationPhase(slot_name, 0);
2286 }
2287 }
2288 else
2289 {
2290 SetAnimationPhase(slotNameMounted, 1);
2291 SetAnimationPhase(slot_name, 1);
2292
2294 }
2295 }
2296
2297
2299 {
2302
2305
2308
2309 foreach (
string slotName : attachmentSlots)
2310 {
2312 }
2313
2314
2316 {
2319
2321 }
2322 else
2323 {
2326
2328 }
2329
2332 }
2333
2335 {
2336
2338 return;
2339
2340 string slot_name_mounted = slot_name + "_Mounted";
2341 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2342
2343
2345 RemoveProxyPhysics( slot_name_mounted );
2346 RemoveProxyPhysics( slot_name );
2347
2348 if ( attachment )
2349 {
2351 if ( is_locked )
2352 {
2354 AddProxyPhysics( slot_name_mounted );
2355 }
2356 else
2357 {
2359 AddProxyPhysics( slot_name );
2360 }
2361 }
2362 }
2363
2365 {
2366 SetAffectPathgraph( true, false );
2368 }
2369
2371 {
2372 return true;
2373 }
2374
2376 {
2377 return true;
2378 }
2379
2381 {
2382 if ( attachment )
2383 {
2385 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2386
2387 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2388 }
2389
2390 return false;
2391 }
2392
2394 {
2396 }
2397
2398
2400 {
2401 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2402 if (
g_Game.ConfigIsExisting( config_path ) )
2403 {
2404 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2405 }
2406 }
2407
2409 {
2410 return true;
2411 }
2412
2414 {
2415 return true;
2416 }
2417
2419 {
2420 return true;
2421 }
2422
2423
2425 {
2428 }
2429
2431 {
2433 }
2434
2436 {
2438 }
2439
2441 {
2442 int attachment_count = GetInventory().AttachmentCount();
2443 if ( attachment_count > 0 )
2444 {
2445 if (
HasBase() && attachment_count == 1 )
2446 {
2447 return false;
2448 }
2449
2450 return true;
2451 }
2452
2453 return false;
2454 }
2455
2457 {
2458 return true;
2459 }
2460
2462 {
2463 return false;
2464 }
2465
2466
2468 {
2469 return false;
2470 }
2471
2473 {
2474 return false;
2475 }
2476
2477
2479 {
2480 return false;
2481 }
2482
2483
2484
2486 {
2487 return true;
2488 }
2489
2491 {
2492 return true;
2493 }
2494
2497 {
2498 return false;
2499 }
2500
2501
2503 {
2504 return false;
2505 }
2506
2507
2509 {
2510 return true;
2511 }
2512
2513
2515 {
2516 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2517 {
2518 return false;
2519 }
2520
2521 return true;
2522 }
2523
2525 {
2528
2529 return item;
2530 }
2531
2532
2534 {
2536 {
2537
2539
2540
2543
2545 if ( MemoryPointExists( slot_name + "_min" ) )
2546 {
2547 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2548 }
2549 if ( MemoryPointExists( slot_name + "_max" ) )
2550 {
2551 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2552 }
2553
2554
2557
2558
2561 center = ModelToWorld( center );
2562
2563
2566
2567 areaDamage.SetExtents( extents[0], extents[1] );
2568 areaDamage.SetAreaPosition( center );
2572 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2573 areaDamage.SetAmmoName( "BarbedWireHit" );
2574 areaDamage.Spawn();
2575
2577 }
2578 }
2579
2581 {
2582 if ( angle_deg != 0 )
2583 {
2584
2586
2587
2589 if ( MemoryPointExists( "rotate_axis" ) )
2590 {
2591 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2592 }
2593 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];
2594 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];
2595 center[0] = r_center_x;
2596 center[2] = r_center_z;
2597 }
2598 }
2599
2601 {
2603 {
2606 {
2607 if (areaDamage)
2608 {
2609 areaDamage.Destroy();
2610 }
2611
2613 }
2614 }
2615 }
2616
2618 {
2619 return true;
2620 }
2621
2622
2623
2624
2626 {
2628 }
2629
2631 {
2633 }
2634
2636 {
2638 }
2639
2641 {
2643
2644 switch ( material_type )
2645 {
2651 }
2652
2653 return "";
2654 }
2655
2657 {
2659
2660 switch ( material_type )
2661 {
2667 }
2668
2669 return "";
2670 }
2671
2672
2674 {
2676 {
2677
2679 {
2680 SetHealth(slot_name,"Health",item.GetHealth());
2681 }
2682 }
2683 }
2684
2686 {
2687 return 111;
2688 }
2689
2691 {
2692 super.SetActions();
2693
2697 }
2698
2700 {
2702 if (!construction)
2703 return;
2704
2706 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2707 {
2710 {
2712 }
2713 }
2714 }
2715
2717 {
2719 if (!construction)
2720 return;
2721
2723 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2724 {
2727 {
2728 construction.HandleEntityFalling(part.
GetPartName());
2729 }
2730 }
2731 }
2732
2735 {
2737 return;
2738
2741
2742 if (DestroyOnFall())
2743 {
2745 {
2747 }
2748 else
2749 {
2751 {
2753 }
2755 }
2756 }
2757 }
2758
2760 {
2761 if (HasAnyAttachmentsOrCargo())
2762 {
2765 }
2766 }
2767
2768
2769
2770
2771
2774 {
2775 return null;
2776 }
2777
2779 {
2781 }
2782
2784 {
2787
2788 Man p;
2789
2790 #ifdef SERVER
2792 g_Game.GetWorld().GetPlayerList(players);
2793 if (players.Count())
2794 p = players[0];
2795 #else
2797 #endif
2798
2800 {
2801 bool excluded = false;
2803 if (excludes)
2804 {
2805 foreach (string exclude : excludes)
2806 {
2808 {
2809 excluded = true;
2810 break;
2811 }
2812 }
2813 }
2814
2815 if (!excluded)
2816 {
2818 }
2819 }
2820
2822 }
2823
2825
2827 [
Obsolete(
"handled in the Construction component directly")]
2829 {
2830 }
2831
2832 [
Obsolete(
"handled in the Construction component directly")]
2834 {
2835 }
2836
2837 [
Obsolete(
"obsolete debug method")]
2839 {
2840 }
2841}
2842
2844{
2845#ifdef BSB_DEBUG
2847#else
2848
2849#endif
2850}
2852{
2853#ifdef BSB_DEBUG_SPAM
2855#else
2856
2857#endif
2858}
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.