1398{
1400
1402
1404
1411
1412
1413
1419
1425
1427
1431
1432
1434 {
1436
1437
1438 RegisterNetSyncVariableInt( "m_SyncParts01" );
1439 RegisterNetSyncVariableInt( "m_SyncParts02" );
1440 RegisterNetSyncVariableInt( "m_SyncParts03" );
1441 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1442 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1443 RegisterNetSyncVariableBool( "m_HasBase" );
1444
1445
1446 ConstructionInit();
1447
1448 if (ConfigIsExisting("hybridAttachments"))
1449 {
1452 }
1453 if (ConfigIsExisting("mountables"))
1454 {
1457 }
1458
1460 SetAllowDamage(true);
1461 }
1462
1464 {
1465 return "disableBaseDamage";
1466 }
1467
1469 {
1470 return true;
1471 }
1472
1474 {
1475 return EInventoryIconVisibility.HIDE_VICINITY;
1476 }
1477
1479 {
1480 super.InitItemSounds();
1481
1485
1490 }
1491
1493 {
1494 return "putDown_FenceKit_SoundSet";
1495 }
1496
1498 {
1499 return "Shelter_Site_Build_Loop_SoundSet";
1500 }
1501
1502
1504 {
1506 {
1507 SetSynchDirty();
1508 }
1509 }
1510
1512 {
1514 super.OnVariablesSynchronized();
1515
1517 }
1518
1520 {
1521
1523
1524
1526
1527
1529 }
1530
1531
1533 {
1534
1535 int offset;
1536 int mask;
1537
1538 if ( part_id >= 1 && part_id <= 31 )
1539 {
1540 offset = part_id - 1;
1541 mask = 1 << offset;
1542
1544 }
1545 else if ( part_id >= 32 && part_id <= 62 )
1546 {
1547 offset = ( part_id % 32 );
1548 mask = 1 << offset;
1549
1551 }
1552 else if ( part_id >= 63 && part_id <= 93 )
1553 {
1554 offset = ( part_id % 63 );
1555 mask = 1 << offset;
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 return true;
1604 }
1605 }
1606 else if ( part_id >= 32 && part_id <= 62 )
1607 {
1608 offset = ( part_id % 32 );
1609 mask = 1 << offset;
1610
1612 {
1613 return true;
1614 }
1615 }
1616 else if ( part_id >= 63 && part_id <= 93 )
1617 {
1618 offset = ( part_id % 63 );
1619 mask = 1 << offset;
1620
1622 {
1623 return true;
1624 }
1625 }
1626
1627 return false;
1628 }
1629
1631 {
1634 }
1635
1637 {
1638
1641 }
1642
1644 {
1646 {
1649
1650 switch( build_action_id )
1651 {
1655 }
1656 }
1657 }
1658
1659
1661 {
1663 bool is_base = part.
IsBase();
1666 if ( is_part_built_sync )
1667 {
1669 {
1673
1674 if (is_base)
1675 {
1678 }
1679 }
1680 }
1681 else
1682 {
1684 {
1688
1689 if (is_base)
1690 {
1693 }
1694 }
1695 }
1696
1697
1699 }
1700
1701
1703 {
1706
1707 for ( int i = 0; i < construction_parts.Count(); ++i )
1708 {
1709 string key = construction_parts.GetKey( i );
1712 }
1713
1714
1716 }
1717
1719 {
1722
1723 for ( int i = 0; i < construction_parts.Count(); ++i )
1724 {
1725 string key = construction_parts.GetKey( i );
1727
1728 if ( value.
GetId() ==
id )
1729 {
1730 return value;
1731 }
1732 }
1733
1734 return NULL;
1735 }
1736
1737
1738
1740 {
1742 }
1743
1745 {
1747 }
1748
1750 {
1751 return true;
1752 }
1753
1755 {
1756 return false;
1757 }
1758
1759
1761 {
1764 {
1766 }
1767
1768 return construction_kit;
1769 }
1770
1772 {
1775 {
1777 }
1778 }
1779
1781 {
1783 }
1784
1786 {
1787 return "";
1788 }
1789
1791 {
1793 g_Game.ObjectDelete( construction_kit );
1794 }
1795
1796
1798 {
1800 g_Game.ObjectDelete(
this );
1801 }
1802
1803
1805 {
1806 super.EEDelete(parent);
1807
1809 {
1810 areaDamage.Destroy();
1811 }
1812
1813 }
1814
1816 {
1817 super.OnStoreSave( ctx );
1818
1819
1823
1825 }
1826
1828 {
1829 if ( !super.OnStoreLoad( ctx, version ) )
1830 return false;
1831
1832
1833
1835 {
1837 return false;
1838 }
1840 {
1842 return false;
1843 }
1845 {
1847 return false;
1848 }
1849
1850
1852 {
1854 return false;
1855 }
1856
1857
1858 return true;
1859 }
1860
1862 {
1863 super.AfterStoreLoad();
1864
1866 {
1868 }
1869 }
1870
1872 {
1873
1875
1876
1879
1880
1882 }
1883
1885 {
1886 super.OnCreatePhysics();
1887
1888 ConstructionInit();
1890 }
1891
1893 {
1895 return;
1896
1897 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1898 }
1899
1901 {
1903 {
1905 }
1906
1907 super.EEOnAfterLoad();
1908 }
1909
1911 {
1912 super.EEItemAttached( item, slot_name );
1913
1917 }
1918
1920 {
1921 super.EEItemDetached( item, slot_name );
1922
1925 }
1926
1927 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1928 {
1931
1934 }
1935
1936
1938 {
1939 return true;
1940 }
1941
1942
1943
1945 {
1947
1948
1949 if (construtionPart.
IsBase())
1950 {
1952
1953
1955 }
1956
1957
1959
1960
1962
1963
1965
1967
1969
1970
1972
1973
1975 }
1976
1978 {
1979
1981 }
1982
1983
1985 {
1988
1989
1991
1992
1994
1995
1997
1998
2000
2002
2003
2005
2006
2008
2009
2010 if (construtionPart.
IsBase())
2011 {
2012
2014 }
2015 }
2016
2018 {
2019
2021 }
2022
2023
2024 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2025 {
2028
2029
2031
2032
2034
2035
2037
2038
2040
2042
2043
2045
2046
2048
2049
2050 if (construtionPart.
IsBase())
2051 {
2052
2054 }
2055 }
2056
2058 {
2059
2061 }
2062
2063
2065 {
2067
2070 }
2071
2073 {
2075
2077 {
2079 }
2080 else
2081 {
2083 }
2084
2086 }
2087
2089 {
2091
2093 foreach (
string slotName : attachmentSlots)
2094 {
2096 }
2097
2098
2101 else
2103
2105 }
2106
2108 {
2109 string slotNameMounted = slot_name + "_Mounted";
2110 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2111
2112 if (attachment)
2113 {
2114 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2115 if (barbedWire && barbedWire.IsMounted())
2117 else
2119
2120 if (is_locked)
2121 {
2122 SetAnimationPhase(slotNameMounted, 0);
2123 SetAnimationPhase(slot_name, 1);
2124 }
2125 else
2126 {
2127 SetAnimationPhase(slotNameMounted, 1);
2128 SetAnimationPhase(slot_name, 0);
2129 }
2130 }
2131 else
2132 {
2133 SetAnimationPhase(slotNameMounted, 1);
2134 SetAnimationPhase(slot_name, 1);
2135
2137 }
2138 }
2139
2140
2142 {
2145
2148
2151
2152 foreach (
string slotName : attachmentSlots)
2153 {
2155 }
2156
2157
2159 {
2162
2164 }
2165 else
2166 {
2169
2171 }
2172
2175 }
2176
2178 {
2179
2181 return;
2182
2183 string slot_name_mounted = slot_name + "_Mounted";
2184 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2185
2186
2188 RemoveProxyPhysics( slot_name_mounted );
2189 RemoveProxyPhysics( slot_name );
2190
2191 if ( attachment )
2192 {
2194 if ( is_locked )
2195 {
2197 AddProxyPhysics( slot_name_mounted );
2198 }
2199 else
2200 {
2202 AddProxyPhysics( slot_name );
2203 }
2204 }
2205 }
2206
2208 {
2209 SetAffectPathgraph( true, false );
2211 }
2212
2214 {
2215 return true;
2216 }
2217
2219 {
2220 return true;
2221 }
2222
2224 {
2225 if ( attachment )
2226 {
2228 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2229
2230 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2231 }
2232
2233 return false;
2234 }
2235
2237 {
2239 }
2240
2241
2243 {
2244 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2245 if (
g_Game.ConfigIsExisting( config_path ) )
2246 {
2247 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2248 }
2249 }
2250
2252 {
2253 return true;
2254 }
2255
2257 {
2258 return true;
2259 }
2260
2262 {
2263 return true;
2264 }
2265
2266
2268 {
2271 }
2272
2274 {
2276 }
2277
2279 {
2281 }
2282
2284 {
2285 int attachment_count = GetInventory().AttachmentCount();
2286 if ( attachment_count > 0 )
2287 {
2288 if (
HasBase() && attachment_count == 1 )
2289 {
2290 return false;
2291 }
2292
2293 return true;
2294 }
2295
2296 return false;
2297 }
2298
2300 {
2301 return true;
2302 }
2303
2305 {
2306 return false;
2307 }
2308
2309
2311 {
2312 return false;
2313 }
2314
2316 {
2317 return false;
2318 }
2319
2320
2322 {
2323 return false;
2324 }
2325
2326
2327
2329 {
2330 return true;
2331 }
2332
2334 {
2335 return true;
2336 }
2337
2340 {
2341 return false;
2342 }
2343
2344
2346 {
2347 return false;
2348 }
2349
2350
2352 {
2353 return true;
2354 }
2355
2356
2358 {
2359 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2360 {
2361 return false;
2362 }
2363
2364 return true;
2365 }
2366
2368 {
2371
2372 return item;
2373 }
2374
2375
2377 {
2379 {
2380
2382
2383
2386
2388 if ( MemoryPointExists( slot_name + "_min" ) )
2389 {
2390 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2391 }
2392 if ( MemoryPointExists( slot_name + "_max" ) )
2393 {
2394 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2395 }
2396
2397
2400
2401
2404 center = ModelToWorld( center );
2405
2406
2409
2410 areaDamage.SetExtents( extents[0], extents[1] );
2411 areaDamage.SetAreaPosition( center );
2415 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2416 areaDamage.SetAmmoName( "BarbedWireHit" );
2417 areaDamage.Spawn();
2418
2420 }
2421 }
2422
2424 {
2425 if ( angle_deg != 0 )
2426 {
2427
2429
2430
2432 if ( MemoryPointExists( "rotate_axis" ) )
2433 {
2434 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2435 }
2436 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];
2437 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];
2438 center[0] = r_center_x;
2439 center[2] = r_center_z;
2440 }
2441 }
2442
2444 {
2446 {
2449 {
2450 if (areaDamage)
2451 {
2452 areaDamage.Destroy();
2453 }
2454
2456 }
2457 }
2458 }
2459
2461 {
2462 return true;
2463 }
2464
2465
2466
2467
2469 {
2471 }
2472
2474 {
2476 }
2477
2479 {
2481 }
2482
2484 {
2486
2487 switch ( material_type )
2488 {
2494 }
2495
2496 return "";
2497 }
2498
2500 {
2502
2503 switch ( material_type )
2504 {
2510 }
2511
2512 return "";
2513 }
2514
2515
2517 {
2519 {
2520
2522 {
2523 SetHealth(slot_name,"Health",item.GetHealth());
2524 }
2525 }
2526 }
2527
2529 {
2530 return 111;
2531 }
2532
2534 {
2535 super.SetActions();
2536
2540 }
2541
2543 {
2545 if (!construction)
2546 return;
2547
2549 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2550 {
2553 {
2555 }
2556 }
2557 }
2558
2560 {
2562 if (!construction)
2563 return;
2564
2566 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2567 {
2570 {
2571 construction.HandleEntityFalling(part.
GetPartName());
2572 }
2573 }
2574 }
2575
2578 {
2580 return;
2581
2584
2585 if (DestroyOnFall())
2586 {
2588 {
2590 }
2591 else
2592 {
2594 {
2596 }
2598 }
2599 }
2600 }
2601
2603 {
2604 if (HasAnyAttachmentsOrCargo())
2605 {
2608 }
2609 }
2610
2611
2612
2613
2614
2617 {
2618 return null;
2619 }
2620
2622 {
2624 }
2625
2627 {
2630
2631 Man p;
2632
2633 #ifdef SERVER
2635 g_Game.GetWorld().GetPlayerList(players);
2636 if (players.Count())
2637 p = players[0];
2638 #else
2640 #endif
2641
2643 {
2644 bool excluded = false;
2646 if (excludes)
2647 {
2648 foreach (string exclude : excludes)
2649 {
2651 {
2652 excluded = true;
2653 break;
2654 }
2655 }
2656 }
2657
2658 if (!excluded)
2659 {
2661 }
2662 }
2663
2665 }
2666
2668
2670 [
Obsolete(
"handled in the Construction component directly")]
2672 {
2673 }
2674
2675 [
Obsolete(
"handled in the Construction component directly")]
2677 {
2678 }
2679
2680 [
Obsolete(
"obsolete debug method")]
2682 {
2683 }
2684}
2685
2687{
2688#ifdef BSB_DEBUG
2690#else
2691
2692#endif
2693}
2695{
2696#ifdef BSB_DEBUG_SPAM
2698#else
2699
2700#endif
2701}
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.