1427{
1429
1431
1433
1440
1441
1442
1448
1454
1456
1460
1461
1463 {
1465
1466
1467 RegisterNetSyncVariableInt( "m_SyncParts01" );
1468 RegisterNetSyncVariableInt( "m_SyncParts02" );
1469 RegisterNetSyncVariableInt( "m_SyncParts03" );
1470 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1471 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1472 RegisterNetSyncVariableBool( "m_HasBase" );
1473
1474
1475 ConstructionInit();
1476
1477 if (ConfigIsExisting("hybridAttachments"))
1478 {
1481 }
1482 if (ConfigIsExisting("mountables"))
1483 {
1486 }
1487
1489 SetAllowDamage(true);
1490 }
1491
1493 {
1494 return "disableBaseDamage";
1495 }
1496
1498 {
1499 return true;
1500 }
1501
1503 {
1504 return EInventoryIconVisibility.HIDE_VICINITY;
1505 }
1506
1508 {
1509 super.InitItemSounds();
1510
1514
1519 }
1520
1522 {
1523 return "putDown_FenceKit_SoundSet";
1524 }
1525
1527 {
1528 return "Shelter_Site_Build_Loop_SoundSet";
1529 }
1530
1531
1533 {
1535 {
1536 SetSynchDirty();
1537 }
1538 }
1539
1541 {
1543 super.OnVariablesSynchronized();
1544
1546 }
1547
1549 {
1550
1552
1553
1555
1556
1558 }
1559
1560
1562 {
1563
1564 int offset;
1565 int mask;
1566
1567 if ( part_id >= 1 && part_id <= 31 )
1568 {
1569 offset = part_id - 1;
1570 mask = 1 << offset;
1571
1573 }
1574 else if ( part_id >= 32 && part_id <= 62 )
1575 {
1576 offset = ( part_id % 32 );
1577 mask = 1 << offset;
1578
1580 }
1581 else if ( part_id >= 63 && part_id <= 93 )
1582 {
1583 offset = ( part_id % 63 );
1584 mask = 1 << offset;
1585
1587 }
1588 }
1589
1591 {
1592
1593 int offset;
1594 int mask;
1595
1596 if ( part_id >= 1 && part_id <= 31 )
1597 {
1598 offset = part_id - 1;
1599 mask = 1 << offset;
1600
1602 }
1603 else if ( part_id >= 32 && part_id <= 62 )
1604 {
1605 offset = ( part_id % 32 );
1606 mask = 1 << offset;
1607
1609 }
1610 else if ( part_id >= 63 && part_id <= 93 )
1611 {
1612 offset = ( part_id % 63 );
1613 mask = 1 << offset;
1614
1616 }
1617 }
1618
1620 {
1621
1622 int offset;
1623 int mask;
1624
1625 if ( part_id >= 1 && part_id <= 31 )
1626 {
1627 offset = part_id - 1;
1628 mask = 1 << offset;
1629
1631 {
1632 return true;
1633 }
1634 }
1635 else if ( part_id >= 32 && part_id <= 62 )
1636 {
1637 offset = ( part_id % 32 );
1638 mask = 1 << offset;
1639
1641 {
1642 return true;
1643 }
1644 }
1645 else if ( part_id >= 63 && part_id <= 93 )
1646 {
1647 offset = ( part_id % 63 );
1648 mask = 1 << offset;
1649
1651 {
1652 return true;
1653 }
1654 }
1655
1656 return false;
1657 }
1658
1660 {
1663 }
1664
1666 {
1667
1670 }
1671
1673 {
1675 {
1678
1679 switch( build_action_id )
1680 {
1684 }
1685 }
1686 }
1687
1688
1690 {
1692 bool is_base = part.
IsBase();
1695 if ( is_part_built_sync )
1696 {
1698 {
1702
1703 if (is_base)
1704 {
1707 }
1708 }
1709 }
1710 else
1711 {
1713 {
1717
1718 if (is_base)
1719 {
1722 }
1723 }
1724 }
1725
1726
1728 }
1729
1730
1732 {
1735
1736 for ( int i = 0; i < construction_parts.Count(); ++i )
1737 {
1738 string key = construction_parts.GetKey( i );
1741 }
1742
1743
1745 }
1746
1748 {
1751
1752 for ( int i = 0; i < construction_parts.Count(); ++i )
1753 {
1754 string key = construction_parts.GetKey( i );
1756
1757 if ( value.
GetId() ==
id )
1758 {
1759 return value;
1760 }
1761 }
1762
1763 return NULL;
1764 }
1765
1766
1767
1769 {
1771 }
1772
1774 {
1776 }
1777
1779 {
1780 return true;
1781 }
1782
1784 {
1785 return false;
1786 }
1787
1788
1790 {
1793 {
1795 }
1796
1797 return construction_kit;
1798 }
1799
1801 {
1804 {
1806 }
1807 }
1808
1810 {
1812 }
1813
1815 {
1816 return "";
1817 }
1818
1820 {
1822 g_Game.ObjectDelete( construction_kit );
1823 }
1824
1825
1827 {
1829 g_Game.ObjectDelete(
this );
1830 }
1831
1832
1834 {
1835 super.EEDelete(parent);
1836
1838 {
1839 areaDamage.Destroy();
1840 }
1841
1842 }
1843
1845 {
1846 super.OnStoreSave( ctx );
1847
1848
1852
1854 }
1855
1857 {
1858 if ( !super.OnStoreLoad( ctx, version ) )
1859 return false;
1860
1861
1862
1864 {
1866 return false;
1867 }
1869 {
1871 return false;
1872 }
1874 {
1876 return false;
1877 }
1878
1879
1881 {
1883 return false;
1884 }
1885
1886
1887 return true;
1888 }
1889
1891 {
1892 super.AfterStoreLoad();
1893
1895 {
1897 }
1898 }
1899
1901 {
1902
1904
1905
1908
1909
1911 }
1912
1914 {
1915 super.OnCreatePhysics();
1916
1917 ConstructionInit();
1919 }
1920
1922 {
1924 return;
1925
1926 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1927 }
1928
1930 {
1932 {
1934 }
1935
1936 super.EEOnAfterLoad();
1937 }
1938
1940 {
1941 super.EEItemAttached( item, slot_name );
1942
1946 }
1947
1949 {
1950 super.EEItemDetached( item, slot_name );
1951
1954 }
1955
1956 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1957 {
1960
1963 }
1964
1965
1967 {
1968 return true;
1969 }
1970
1971
1972
1974 {
1976
1977
1978 if (construtionPart.
IsBase())
1979 {
1981
1982
1984 }
1985
1986
1988
1989
1991
1992
1994
1996
1998
1999
2001
2002
2004 }
2005
2007 {
2008
2010 }
2011
2012
2014 {
2017
2018
2020
2021
2023
2024
2026
2027
2029
2031
2032
2034
2035
2037
2038
2039 if (construtionPart.
IsBase())
2040 {
2041
2043 }
2044 }
2045
2047 {
2048
2050 }
2051
2052
2053 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2054 {
2057
2058
2060
2061
2063
2064
2066
2067
2069
2071
2072
2074
2075
2077
2078
2079 if (construtionPart.
IsBase())
2080 {
2081
2083 }
2084 }
2085
2087 {
2088
2090 }
2091
2092
2094 {
2096
2099 }
2100
2102 {
2104
2106 {
2108 }
2109 else
2110 {
2112 }
2113
2115 }
2116
2118 {
2120
2122 foreach (
string slotName : attachmentSlots)
2123 {
2125 }
2126
2127
2130 else
2132
2134 }
2135
2137 {
2138 string slotNameMounted = slot_name + "_Mounted";
2139 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2140
2141 if (attachment)
2142 {
2143 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2144 if (barbedWire && barbedWire.IsMounted())
2146 else
2148
2149 if (is_locked)
2150 {
2151 SetAnimationPhase(slotNameMounted, 0);
2152 SetAnimationPhase(slot_name, 1);
2153 }
2154 else
2155 {
2156 SetAnimationPhase(slotNameMounted, 1);
2157 SetAnimationPhase(slot_name, 0);
2158 }
2159 }
2160 else
2161 {
2162 SetAnimationPhase(slotNameMounted, 1);
2163 SetAnimationPhase(slot_name, 1);
2164
2166 }
2167 }
2168
2169
2171 {
2174
2177
2180
2181 foreach (
string slotName : attachmentSlots)
2182 {
2184 }
2185
2186
2188 {
2191
2193 }
2194 else
2195 {
2198
2200 }
2201
2204 }
2205
2207 {
2208
2210 return;
2211
2212 string slot_name_mounted = slot_name + "_Mounted";
2213 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2214
2215
2217 RemoveProxyPhysics( slot_name_mounted );
2218 RemoveProxyPhysics( slot_name );
2219
2220 if ( attachment )
2221 {
2223 if ( is_locked )
2224 {
2226 AddProxyPhysics( slot_name_mounted );
2227 }
2228 else
2229 {
2231 AddProxyPhysics( slot_name );
2232 }
2233 }
2234 }
2235
2237 {
2238 SetAffectPathgraph( true, false );
2240 }
2241
2243 {
2244 return true;
2245 }
2246
2248 {
2249 return true;
2250 }
2251
2253 {
2254 if ( attachment )
2255 {
2257 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2258
2259 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2260 }
2261
2262 return false;
2263 }
2264
2266 {
2268 }
2269
2270
2272 {
2273 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2274 if (
g_Game.ConfigIsExisting( config_path ) )
2275 {
2276 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2277 }
2278 }
2279
2281 {
2282 return true;
2283 }
2284
2286 {
2287 return true;
2288 }
2289
2291 {
2292 return true;
2293 }
2294
2295
2297 {
2300 }
2301
2303 {
2305 }
2306
2308 {
2310 }
2311
2313 {
2314 int attachment_count = GetInventory().AttachmentCount();
2315 if ( attachment_count > 0 )
2316 {
2317 if (
HasBase() && attachment_count == 1 )
2318 {
2319 return false;
2320 }
2321
2322 return true;
2323 }
2324
2325 return false;
2326 }
2327
2329 {
2330 return true;
2331 }
2332
2334 {
2335 return false;
2336 }
2337
2338
2340 {
2341 return false;
2342 }
2343
2345 {
2346 return false;
2347 }
2348
2349
2351 {
2352 return false;
2353 }
2354
2355
2356
2358 {
2359 return true;
2360 }
2361
2363 {
2364 return true;
2365 }
2366
2369 {
2370 return false;
2371 }
2372
2373
2375 {
2376 return false;
2377 }
2378
2379
2381 {
2382 return true;
2383 }
2384
2385
2387 {
2388 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2389 {
2390 return false;
2391 }
2392
2393 return true;
2394 }
2395
2397 {
2400
2401 return item;
2402 }
2403
2404
2406 {
2408 {
2409
2411
2412
2415
2417 if ( MemoryPointExists( slot_name + "_min" ) )
2418 {
2419 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2420 }
2421 if ( MemoryPointExists( slot_name + "_max" ) )
2422 {
2423 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2424 }
2425
2426
2429
2430
2433 center = ModelToWorld( center );
2434
2435
2438
2439 areaDamage.SetExtents( extents[0], extents[1] );
2440 areaDamage.SetAreaPosition( center );
2444 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2445 areaDamage.SetAmmoName( "BarbedWireHit" );
2446 areaDamage.Spawn();
2447
2449 }
2450 }
2451
2453 {
2454 if ( angle_deg != 0 )
2455 {
2456
2458
2459
2461 if ( MemoryPointExists( "rotate_axis" ) )
2462 {
2463 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2464 }
2465 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];
2466 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];
2467 center[0] = r_center_x;
2468 center[2] = r_center_z;
2469 }
2470 }
2471
2473 {
2475 {
2478 {
2479 if (areaDamage)
2480 {
2481 areaDamage.Destroy();
2482 }
2483
2485 }
2486 }
2487 }
2488
2490 {
2491 return true;
2492 }
2493
2494
2495
2496
2498 {
2500 }
2501
2503 {
2505 }
2506
2508 {
2510 }
2511
2513 {
2515
2516 switch ( material_type )
2517 {
2523 }
2524
2525 return "";
2526 }
2527
2529 {
2531
2532 switch ( material_type )
2533 {
2539 }
2540
2541 return "";
2542 }
2543
2544
2546 {
2548 {
2549
2551 {
2552 SetHealth(slot_name,"Health",item.GetHealth());
2553 }
2554 }
2555 }
2556
2558 {
2559 return 111;
2560 }
2561
2563 {
2564 super.SetActions();
2565
2569 }
2570
2572 {
2574 if (!construction)
2575 return;
2576
2578 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2579 {
2582 {
2584 }
2585 }
2586 }
2587
2589 {
2591 if (!construction)
2592 return;
2593
2595 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2596 {
2599 {
2600 construction.HandleEntityFalling(part.
GetPartName());
2601 }
2602 }
2603 }
2604
2607 {
2609 return;
2610
2613
2614 if (DestroyOnFall())
2615 {
2617 {
2619 }
2620 else
2621 {
2623 {
2625 }
2627 }
2628 }
2629 }
2630
2632 {
2633 if (HasAnyAttachmentsOrCargo())
2634 {
2637 }
2638 }
2639
2640
2641
2642
2643
2646 {
2647 return null;
2648 }
2649
2651 {
2653 }
2654
2656 {
2659
2660 Man p;
2661
2662 #ifdef SERVER
2664 g_Game.GetWorld().GetPlayerList(players);
2665 if (players.Count())
2666 p = players[0];
2667 #else
2669 #endif
2670
2672 {
2673 bool excluded = false;
2675 if (excludes)
2676 {
2677 foreach (string exclude : excludes)
2678 {
2680 {
2681 excluded = true;
2682 break;
2683 }
2684 }
2685 }
2686
2687 if (!excluded)
2688 {
2690 }
2691 }
2692
2694 }
2695
2697
2699 [
Obsolete(
"handled in the Construction component directly")]
2701 {
2702 }
2703
2704 [
Obsolete(
"handled in the Construction component directly")]
2706 {
2707 }
2708
2709 [
Obsolete(
"obsolete debug method")]
2711 {
2712 }
2713}
2714
2716{
2717#ifdef BSB_DEBUG
2719#else
2720
2721#endif
2722}
2724{
2725#ifdef BSB_DEBUG_SPAM
2727#else
2728
2729#endif
2730}
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.