1406{
1408
1410
1412
1419
1420
1421
1427
1433
1435
1439
1440
1442 {
1444
1445
1446 RegisterNetSyncVariableInt( "m_SyncParts01" );
1447 RegisterNetSyncVariableInt( "m_SyncParts02" );
1448 RegisterNetSyncVariableInt( "m_SyncParts03" );
1449 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1450 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1451 RegisterNetSyncVariableBool( "m_HasBase" );
1452
1453
1454 ConstructionInit();
1455
1456 if (ConfigIsExisting("hybridAttachments"))
1457 {
1460 }
1461 if (ConfigIsExisting("mountables"))
1462 {
1465 }
1466
1468 SetAllowDamage(true);
1469 }
1470
1472 {
1473 return "disableBaseDamage";
1474 }
1475
1477 {
1478 return true;
1479 }
1480
1482 {
1483 return EInventoryIconVisibility.HIDE_VICINITY;
1484 }
1485
1487 {
1488 super.InitItemSounds();
1489
1493
1498 }
1499
1501 {
1502 return "putDown_FenceKit_SoundSet";
1503 }
1504
1506 {
1507 return "Shelter_Site_Build_Loop_SoundSet";
1508 }
1509
1510
1512 {
1514 {
1515 SetSynchDirty();
1516 }
1517 }
1518
1520 {
1522 super.OnVariablesSynchronized();
1523
1525 }
1526
1528 {
1529
1531
1532
1534
1535
1537 }
1538
1539
1541 {
1542
1543 int offset;
1544 int mask;
1545
1546 if ( part_id >= 1 && part_id <= 31 )
1547 {
1548 offset = part_id - 1;
1549 mask = 1 << offset;
1550
1552 }
1553 else if ( part_id >= 32 && part_id <= 62 )
1554 {
1555 offset = ( part_id % 32 );
1556 mask = 1 << offset;
1557
1559 }
1560 else if ( part_id >= 63 && part_id <= 93 )
1561 {
1562 offset = ( part_id % 63 );
1563 mask = 1 << offset;
1564
1566 }
1567 }
1568
1570 {
1571
1572 int offset;
1573 int mask;
1574
1575 if ( part_id >= 1 && part_id <= 31 )
1576 {
1577 offset = part_id - 1;
1578 mask = 1 << offset;
1579
1581 }
1582 else if ( part_id >= 32 && part_id <= 62 )
1583 {
1584 offset = ( part_id % 32 );
1585 mask = 1 << offset;
1586
1588 }
1589 else if ( part_id >= 63 && part_id <= 93 )
1590 {
1591 offset = ( part_id % 63 );
1592 mask = 1 << offset;
1593
1595 }
1596 }
1597
1599 {
1600
1601 int offset;
1602 int mask;
1603
1604 if ( part_id >= 1 && part_id <= 31 )
1605 {
1606 offset = part_id - 1;
1607 mask = 1 << offset;
1608
1610 {
1611 return true;
1612 }
1613 }
1614 else if ( part_id >= 32 && part_id <= 62 )
1615 {
1616 offset = ( part_id % 32 );
1617 mask = 1 << offset;
1618
1620 {
1621 return true;
1622 }
1623 }
1624 else if ( part_id >= 63 && part_id <= 93 )
1625 {
1626 offset = ( part_id % 63 );
1627 mask = 1 << offset;
1628
1630 {
1631 return true;
1632 }
1633 }
1634
1635 return false;
1636 }
1637
1639 {
1642 }
1643
1645 {
1646
1649 }
1650
1652 {
1654 {
1657
1658 switch( build_action_id )
1659 {
1663 }
1664 }
1665 }
1666
1667
1669 {
1671 bool is_base = part.
IsBase();
1674 if ( is_part_built_sync )
1675 {
1677 {
1681
1682 if (is_base)
1683 {
1686 }
1687 }
1688 }
1689 else
1690 {
1692 {
1696
1697 if (is_base)
1698 {
1701 }
1702 }
1703 }
1704
1705
1707 }
1708
1709
1711 {
1714
1715 for ( int i = 0; i < construction_parts.Count(); ++i )
1716 {
1717 string key = construction_parts.GetKey( i );
1720 }
1721
1722
1724 }
1725
1727 {
1730
1731 for ( int i = 0; i < construction_parts.Count(); ++i )
1732 {
1733 string key = construction_parts.GetKey( i );
1735
1736 if ( value.
GetId() ==
id )
1737 {
1738 return value;
1739 }
1740 }
1741
1742 return NULL;
1743 }
1744
1745
1746
1748 {
1750 }
1751
1753 {
1755 }
1756
1758 {
1759 return true;
1760 }
1761
1763 {
1764 return false;
1765 }
1766
1767
1769 {
1772 {
1774 }
1775
1776 return construction_kit;
1777 }
1778
1780 {
1783 {
1785 }
1786 }
1787
1789 {
1791 }
1792
1794 {
1795 return "";
1796 }
1797
1799 {
1801 g_Game.ObjectDelete( construction_kit );
1802 }
1803
1804
1806 {
1808 g_Game.ObjectDelete(
this );
1809 }
1810
1811
1813 {
1814 super.EEDelete(parent);
1815
1817 {
1818 areaDamage.Destroy();
1819 }
1820
1821 }
1822
1824 {
1825 super.OnStoreSave( ctx );
1826
1827
1831
1833 }
1834
1836 {
1837 if ( !super.OnStoreLoad( ctx, version ) )
1838 return false;
1839
1840
1841
1843 {
1845 return false;
1846 }
1848 {
1850 return false;
1851 }
1853 {
1855 return false;
1856 }
1857
1858
1860 {
1862 return false;
1863 }
1864
1865
1866 return true;
1867 }
1868
1870 {
1871 super.AfterStoreLoad();
1872
1874 {
1876 }
1877 }
1878
1880 {
1881
1883
1884
1887
1888
1890 }
1891
1893 {
1894 super.OnCreatePhysics();
1895
1896 ConstructionInit();
1898 }
1899
1901 {
1903 return;
1904
1905 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1906 }
1907
1909 {
1911 {
1913 }
1914
1915 super.EEOnAfterLoad();
1916 }
1917
1919 {
1920 super.EEItemAttached( item, slot_name );
1921
1925 }
1926
1928 {
1929 super.EEItemDetached( item, slot_name );
1930
1933 }
1934
1935 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1936 {
1939
1942 }
1943
1944
1946 {
1947 return true;
1948 }
1949
1950
1951
1953 {
1955
1956
1957 if (construtionPart.
IsBase())
1958 {
1960
1961
1963 }
1964
1965
1967
1968
1970
1971
1973
1975
1977
1978
1980
1981
1983 }
1984
1986 {
1987
1989 }
1990
1991
1993 {
1996
1997
1999
2000
2002
2003
2005
2006
2008
2010
2011
2013
2014
2016
2017
2018 if (construtionPart.
IsBase())
2019 {
2020
2022 }
2023 }
2024
2026 {
2027
2029 }
2030
2031
2032 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2033 {
2036
2037
2039
2040
2042
2043
2045
2046
2048
2050
2051
2053
2054
2056
2057
2058 if (construtionPart.
IsBase())
2059 {
2060
2062 }
2063 }
2064
2066 {
2067
2069 }
2070
2071
2073 {
2075
2078 }
2079
2081 {
2083
2085 {
2087 }
2088 else
2089 {
2091 }
2092
2094 }
2095
2097 {
2099
2101 foreach (
string slotName : attachmentSlots)
2102 {
2104 }
2105
2106
2109 else
2111
2113 }
2114
2116 {
2117 string slotNameMounted = slot_name + "_Mounted";
2118 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2119
2120 if (attachment)
2121 {
2122 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2123 if (barbedWire && barbedWire.IsMounted())
2125 else
2127
2128 if (is_locked)
2129 {
2130 SetAnimationPhase(slotNameMounted, 0);
2131 SetAnimationPhase(slot_name, 1);
2132 }
2133 else
2134 {
2135 SetAnimationPhase(slotNameMounted, 1);
2136 SetAnimationPhase(slot_name, 0);
2137 }
2138 }
2139 else
2140 {
2141 SetAnimationPhase(slotNameMounted, 1);
2142 SetAnimationPhase(slot_name, 1);
2143
2145 }
2146 }
2147
2148
2150 {
2153
2156
2159
2160 foreach (
string slotName : attachmentSlots)
2161 {
2163 }
2164
2165
2167 {
2170
2172 }
2173 else
2174 {
2177
2179 }
2180
2183 }
2184
2186 {
2187
2189 return;
2190
2191 string slot_name_mounted = slot_name + "_Mounted";
2192 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2193
2194
2196 RemoveProxyPhysics( slot_name_mounted );
2197 RemoveProxyPhysics( slot_name );
2198
2199 if ( attachment )
2200 {
2202 if ( is_locked )
2203 {
2205 AddProxyPhysics( slot_name_mounted );
2206 }
2207 else
2208 {
2210 AddProxyPhysics( slot_name );
2211 }
2212 }
2213 }
2214
2216 {
2217 SetAffectPathgraph( true, false );
2219 }
2220
2222 {
2223 return true;
2224 }
2225
2227 {
2228 return true;
2229 }
2230
2232 {
2233 if ( attachment )
2234 {
2236 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2237
2238 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2239 }
2240
2241 return false;
2242 }
2243
2245 {
2247 }
2248
2249
2251 {
2252 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2253 if (
g_Game.ConfigIsExisting( config_path ) )
2254 {
2255 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2256 }
2257 }
2258
2260 {
2261 return true;
2262 }
2263
2265 {
2266 return true;
2267 }
2268
2270 {
2271 return true;
2272 }
2273
2274
2276 {
2279 }
2280
2282 {
2284 }
2285
2287 {
2289 }
2290
2292 {
2293 int attachment_count = GetInventory().AttachmentCount();
2294 if ( attachment_count > 0 )
2295 {
2296 if (
HasBase() && attachment_count == 1 )
2297 {
2298 return false;
2299 }
2300
2301 return true;
2302 }
2303
2304 return false;
2305 }
2306
2308 {
2309 return true;
2310 }
2311
2313 {
2314 return false;
2315 }
2316
2317
2319 {
2320 return false;
2321 }
2322
2324 {
2325 return false;
2326 }
2327
2328
2330 {
2331 return false;
2332 }
2333
2334
2335
2337 {
2338 return true;
2339 }
2340
2342 {
2343 return true;
2344 }
2345
2348 {
2349 return false;
2350 }
2351
2352
2354 {
2355 return false;
2356 }
2357
2358
2360 {
2361 return true;
2362 }
2363
2364
2366 {
2367 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2368 {
2369 return false;
2370 }
2371
2372 return true;
2373 }
2374
2376 {
2379
2380 return item;
2381 }
2382
2383
2385 {
2387 {
2388
2390
2391
2394
2396 if ( MemoryPointExists( slot_name + "_min" ) )
2397 {
2398 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2399 }
2400 if ( MemoryPointExists( slot_name + "_max" ) )
2401 {
2402 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2403 }
2404
2405
2408
2409
2412 center = ModelToWorld( center );
2413
2414
2417
2418 areaDamage.SetExtents( extents[0], extents[1] );
2419 areaDamage.SetAreaPosition( center );
2423 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2424 areaDamage.SetAmmoName( "BarbedWireHit" );
2425 areaDamage.Spawn();
2426
2428 }
2429 }
2430
2432 {
2433 if ( angle_deg != 0 )
2434 {
2435
2437
2438
2440 if ( MemoryPointExists( "rotate_axis" ) )
2441 {
2442 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2443 }
2444 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];
2445 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];
2446 center[0] = r_center_x;
2447 center[2] = r_center_z;
2448 }
2449 }
2450
2452 {
2454 {
2457 {
2458 if (areaDamage)
2459 {
2460 areaDamage.Destroy();
2461 }
2462
2464 }
2465 }
2466 }
2467
2469 {
2470 return true;
2471 }
2472
2473
2474
2475
2477 {
2479 }
2480
2482 {
2484 }
2485
2487 {
2489 }
2490
2492 {
2494
2495 switch ( material_type )
2496 {
2502 }
2503
2504 return "";
2505 }
2506
2508 {
2510
2511 switch ( material_type )
2512 {
2518 }
2519
2520 return "";
2521 }
2522
2523
2525 {
2527 {
2528
2530 {
2531 SetHealth(slot_name,"Health",item.GetHealth());
2532 }
2533 }
2534 }
2535
2537 {
2538 return 111;
2539 }
2540
2542 {
2543 super.SetActions();
2544
2548 }
2549
2551 {
2553 if (!construction)
2554 return;
2555
2557 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2558 {
2561 {
2563 }
2564 }
2565 }
2566
2568 {
2570 if (!construction)
2571 return;
2572
2574 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2575 {
2578 {
2579 construction.HandleEntityFalling(part.
GetPartName());
2580 }
2581 }
2582 }
2583
2586 {
2588 return;
2589
2592
2593 if (DestroyOnFall())
2594 {
2596 {
2598 }
2599 else
2600 {
2602 {
2604 }
2606 }
2607 }
2608 }
2609
2611 {
2612 if (HasAnyAttachmentsOrCargo())
2613 {
2616 }
2617 }
2618
2619
2620
2621
2622
2625 {
2626 return null;
2627 }
2628
2630 {
2632 }
2633
2635 {
2638
2639 Man p;
2640
2641 #ifdef SERVER
2643 g_Game.GetWorld().GetPlayerList(players);
2644 if (players.Count())
2645 p = players[0];
2646 #else
2648 #endif
2649
2651 {
2652 bool excluded = false;
2654 if (excludes)
2655 {
2656 foreach (string exclude : excludes)
2657 {
2659 {
2660 excluded = true;
2661 break;
2662 }
2663 }
2664 }
2665
2666 if (!excluded)
2667 {
2669 }
2670 }
2671
2673 }
2674
2676
2678 [
Obsolete(
"handled in the Construction component directly")]
2680 {
2681 }
2682
2683 [
Obsolete(
"handled in the Construction component directly")]
2685 {
2686 }
2687
2688 [
Obsolete(
"obsolete debug method")]
2690 {
2691 }
2692}
2693
2695{
2696#ifdef BSB_DEBUG
2698#else
2699
2700#endif
2701}
2703{
2704#ifdef BSB_DEBUG_SPAM
2706#else
2707
2708#endif
2709}
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.