1368{
1370
1372
1374
1381
1382
1383
1389
1395
1397
1401
1402
1404 {
1406
1407
1408 RegisterNetSyncVariableInt( "m_SyncParts01" );
1409 RegisterNetSyncVariableInt( "m_SyncParts02" );
1410 RegisterNetSyncVariableInt( "m_SyncParts03" );
1411 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1412 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1413 RegisterNetSyncVariableBool( "m_HasBase" );
1414
1415
1416 ConstructionInit();
1417
1418 if (ConfigIsExisting("hybridAttachments"))
1419 {
1422 }
1423 if (ConfigIsExisting("mountables"))
1424 {
1427 }
1428
1430 SetAllowDamage(true);
1431 }
1432
1434 {
1435 return "disableBaseDamage";
1436 }
1437
1439 {
1440 return true;
1441 }
1442
1444 {
1445 return EInventoryIconVisibility.HIDE_VICINITY;
1446 }
1447
1449 {
1450 super.InitItemSounds();
1451
1455
1460 }
1461
1463 {
1464 return "putDown_FenceKit_SoundSet";
1465 }
1466
1468 {
1469 return "Shelter_Site_Build_Loop_SoundSet";
1470 }
1471
1472
1474 {
1476 {
1477 SetSynchDirty();
1478 }
1479 }
1480
1482 {
1484 super.OnVariablesSynchronized();
1485
1487 }
1488
1490 {
1491
1493
1494
1496
1497
1499 }
1500
1501
1503 {
1504
1505 int offset;
1506 int mask;
1507
1508 if ( part_id >= 1 && part_id <= 31 )
1509 {
1510 offset = part_id - 1;
1511 mask = 1 << offset;
1512
1514 }
1515 else if ( part_id >= 32 && part_id <= 62 )
1516 {
1517 offset = ( part_id % 32 );
1518 mask = 1 << offset;
1519
1521 }
1522 else if ( part_id >= 63 && part_id <= 93 )
1523 {
1524 offset = ( part_id % 63 );
1525 mask = 1 << offset;
1526
1528 }
1529 }
1530
1532 {
1533
1534 int offset;
1535 int mask;
1536
1537 if ( part_id >= 1 && part_id <= 31 )
1538 {
1539 offset = part_id - 1;
1540 mask = 1 << offset;
1541
1543 }
1544 else if ( part_id >= 32 && part_id <= 62 )
1545 {
1546 offset = ( part_id % 32 );
1547 mask = 1 << offset;
1548
1550 }
1551 else if ( part_id >= 63 && part_id <= 93 )
1552 {
1553 offset = ( part_id % 63 );
1554 mask = 1 << offset;
1555
1557 }
1558 }
1559
1561 {
1562
1563 int offset;
1564 int mask;
1565
1566 if ( part_id >= 1 && part_id <= 31 )
1567 {
1568 offset = part_id - 1;
1569 mask = 1 << offset;
1570
1572 {
1573 return true;
1574 }
1575 }
1576 else if ( part_id >= 32 && part_id <= 62 )
1577 {
1578 offset = ( part_id % 32 );
1579 mask = 1 << offset;
1580
1582 {
1583 return true;
1584 }
1585 }
1586 else if ( part_id >= 63 && part_id <= 93 )
1587 {
1588 offset = ( part_id % 63 );
1589 mask = 1 << offset;
1590
1592 {
1593 return true;
1594 }
1595 }
1596
1597 return false;
1598 }
1599
1601 {
1604 }
1605
1607 {
1608
1611 }
1612
1614 {
1616 {
1619
1620 switch( build_action_id )
1621 {
1625 }
1626 }
1627 }
1628
1629
1631 {
1633 bool is_base = part.
IsBase();
1636 if ( is_part_built_sync )
1637 {
1639 {
1643
1644 if (is_base)
1645 {
1648 }
1649 }
1650 }
1651 else
1652 {
1654 {
1658
1659 if (is_base)
1660 {
1663 }
1664 }
1665 }
1666
1667
1669 }
1670
1671
1673 {
1676
1677 for ( int i = 0; i < construction_parts.Count(); ++i )
1678 {
1679 string key = construction_parts.GetKey( i );
1682 }
1683
1684
1686 }
1687
1689 {
1692
1693 for ( int i = 0; i < construction_parts.Count(); ++i )
1694 {
1695 string key = construction_parts.GetKey( i );
1697
1698 if ( value.
GetId() ==
id )
1699 {
1700 return value;
1701 }
1702 }
1703
1704 return NULL;
1705 }
1706
1707
1708
1710 {
1712 }
1713
1715 {
1717 }
1718
1720 {
1721 return true;
1722 }
1723
1725 {
1726 return false;
1727 }
1728
1729
1731 {
1734 {
1736 }
1737
1738 return construction_kit;
1739 }
1740
1742 {
1745 {
1747 }
1748 }
1749
1751 {
1753 }
1754
1756 {
1757 return "";
1758 }
1759
1761 {
1763 g_Game.ObjectDelete( construction_kit );
1764 }
1765
1766
1768 {
1770 g_Game.ObjectDelete(
this );
1771 }
1772
1773
1775 {
1776 super.EEDelete(parent);
1777
1779 {
1780 areaDamage.Destroy();
1781 }
1782
1783 }
1784
1786 {
1787 super.OnStoreSave( ctx );
1788
1789
1793
1795 }
1796
1798 {
1799 if ( !super.OnStoreLoad( ctx, version ) )
1800 return false;
1801
1802
1803
1805 {
1807 return false;
1808 }
1810 {
1812 return false;
1813 }
1815 {
1817 return false;
1818 }
1819
1820
1822 {
1824 return false;
1825 }
1826
1827
1828 return true;
1829 }
1830
1832 {
1833 super.AfterStoreLoad();
1834
1836 {
1838 }
1839 }
1840
1842 {
1843
1845
1846
1849
1850
1852 }
1853
1855 {
1856 super.OnCreatePhysics();
1857
1858 ConstructionInit();
1860 }
1861
1863 {
1865 return;
1866
1867 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1868 }
1869
1871 {
1873 {
1875 }
1876
1877 super.EEOnAfterLoad();
1878 }
1879
1881 {
1882 super.EEItemAttached( item, slot_name );
1883
1887 }
1888
1890 {
1891 super.EEItemDetached( item, slot_name );
1892
1895 }
1896
1897 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1898 {
1901
1904 }
1905
1906
1908 {
1909 return true;
1910 }
1911
1912
1913
1915 {
1917
1918
1919 if (construtionPart.
IsBase())
1920 {
1922
1923
1925 }
1926
1927
1929
1930
1932
1933
1935
1937
1939
1940
1942
1943
1945 }
1946
1948 {
1949
1951 }
1952
1953
1955 {
1958
1959
1961
1962
1964
1965
1967
1968
1970
1972
1973
1975
1976
1978
1979
1980 if (construtionPart.
IsBase())
1981 {
1982
1984 }
1985 }
1986
1988 {
1989
1991 }
1992
1993
1994 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
1995 {
1998
1999
2001
2002
2004
2005
2007
2008
2010
2012
2013
2015
2016
2018
2019
2020 if (construtionPart.
IsBase())
2021 {
2022
2024 }
2025 }
2026
2028 {
2029
2031 }
2032
2033
2035 {
2037
2040 }
2041
2043 {
2045
2047 {
2049 }
2050 else
2051 {
2053 }
2054
2056 }
2057
2059 {
2061
2063 foreach (
string slotName : attachmentSlots)
2064 {
2066 }
2067
2068
2071 else
2073
2075 }
2076
2078 {
2079 string slotNameMounted = slot_name + "_Mounted";
2080 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2081
2082 if (attachment)
2083 {
2084 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2085 if (barbedWire && barbedWire.IsMounted())
2087 else
2089
2090 if (is_locked)
2091 {
2092 SetAnimationPhase(slotNameMounted, 0);
2093 SetAnimationPhase(slot_name, 1);
2094 }
2095 else
2096 {
2097 SetAnimationPhase(slotNameMounted, 1);
2098 SetAnimationPhase(slot_name, 0);
2099 }
2100 }
2101 else
2102 {
2103 SetAnimationPhase(slotNameMounted, 1);
2104 SetAnimationPhase(slot_name, 1);
2105
2107 }
2108 }
2109
2110
2112 {
2115
2118
2121
2122 foreach (
string slotName : attachmentSlots)
2123 {
2125 }
2126
2127
2129 {
2132
2134 }
2135 else
2136 {
2139
2141 }
2142
2145 }
2146
2148 {
2149
2151 return;
2152
2153 string slot_name_mounted = slot_name + "_Mounted";
2154 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2155
2156
2158 RemoveProxyPhysics( slot_name_mounted );
2159 RemoveProxyPhysics( slot_name );
2160
2161 if ( attachment )
2162 {
2164 if ( is_locked )
2165 {
2167 AddProxyPhysics( slot_name_mounted );
2168 }
2169 else
2170 {
2172 AddProxyPhysics( slot_name );
2173 }
2174 }
2175 }
2176
2178 {
2179 SetAffectPathgraph( true, false );
2181 }
2182
2184 {
2185 return true;
2186 }
2187
2189 {
2190 return true;
2191 }
2192
2194 {
2195 if ( attachment )
2196 {
2198 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2199
2200 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2201 }
2202
2203 return false;
2204 }
2205
2207 {
2209 }
2210
2211
2213 {
2214 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2215 if (
g_Game.ConfigIsExisting( config_path ) )
2216 {
2217 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2218 }
2219 }
2220
2222 {
2223 return true;
2224 }
2225
2227 {
2228 return true;
2229 }
2230
2232 {
2233 return true;
2234 }
2235
2236
2238 {
2241 }
2242
2244 {
2246 }
2247
2249 {
2251 }
2252
2254 {
2255 int attachment_count = GetInventory().AttachmentCount();
2256 if ( attachment_count > 0 )
2257 {
2258 if (
HasBase() && attachment_count == 1 )
2259 {
2260 return false;
2261 }
2262
2263 return true;
2264 }
2265
2266 return false;
2267 }
2268
2270 {
2271 return true;
2272 }
2273
2275 {
2276 return false;
2277 }
2278
2279
2281 {
2282 return false;
2283 }
2284
2286 {
2287 return false;
2288 }
2289
2290
2292 {
2293 return false;
2294 }
2295
2296
2297
2299 {
2300 return true;
2301 }
2302
2304 {
2305 return true;
2306 }
2307
2310 {
2311 return false;
2312 }
2313
2314
2316 {
2317 return false;
2318 }
2319
2320
2322 {
2323 return true;
2324 }
2325
2326
2328 {
2329 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2330 {
2331 return false;
2332 }
2333
2334 return true;
2335 }
2336
2338 {
2341
2342 return item;
2343 }
2344
2345
2347 {
2349 {
2350
2352
2353
2356
2358 if ( MemoryPointExists( slot_name + "_min" ) )
2359 {
2360 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2361 }
2362 if ( MemoryPointExists( slot_name + "_max" ) )
2363 {
2364 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2365 }
2366
2367
2370
2371
2374 center = ModelToWorld( center );
2375
2376
2379
2380 areaDamage.SetExtents( extents[0], extents[1] );
2381 areaDamage.SetAreaPosition( center );
2385 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2386 areaDamage.SetAmmoName( "BarbedWireHit" );
2387 areaDamage.Spawn();
2388
2390 }
2391 }
2392
2394 {
2395 if ( angle_deg != 0 )
2396 {
2397
2399
2400
2402 if ( MemoryPointExists( "rotate_axis" ) )
2403 {
2404 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2405 }
2406 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];
2407 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];
2408 center[0] = r_center_x;
2409 center[2] = r_center_z;
2410 }
2411 }
2412
2414 {
2416 {
2419 {
2420 if (areaDamage)
2421 {
2422 areaDamage.Destroy();
2423 }
2424
2426 }
2427 }
2428 }
2429
2431 {
2432 return true;
2433 }
2434
2435
2436
2437
2439 {
2441 }
2442
2444 {
2446 }
2447
2449 {
2451 }
2452
2454 {
2456
2457 switch ( material_type )
2458 {
2464 }
2465
2466 return "";
2467 }
2468
2470 {
2472
2473 switch ( material_type )
2474 {
2480 }
2481
2482 return "";
2483 }
2484
2485
2487 {
2489 {
2490
2492 {
2493 SetHealth(slot_name,"Health",item.GetHealth());
2494 }
2495 }
2496 }
2497
2499 {
2500 return 111;
2501 }
2502
2504 {
2505 super.SetActions();
2506
2510 }
2511
2513 {
2515 if (!construction)
2516 return;
2517
2519 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2520 {
2523 {
2525 }
2526 }
2527 }
2528
2530 {
2532 if (!construction)
2533 return;
2534
2536 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2537 {
2540 {
2541 construction.HandleEntityFalling(part.
GetPartName());
2542 }
2543 }
2544 }
2545
2548 {
2550 return;
2551
2554
2555 if (DestroyOnFall())
2556 {
2558 {
2560 }
2561 else
2562 {
2564 {
2566 }
2568 }
2569 }
2570 }
2571
2573 {
2574 if (HasAnyAttachmentsOrCargo())
2575 {
2578 }
2579 }
2580
2581
2582
2583
2584
2587 {
2588 return null;
2589 }
2590
2592 {
2594 }
2595
2597 {
2600
2601 Man p;
2602
2603 #ifdef SERVER
2605 g_Game.GetWorld().GetPlayerList(players);
2606 if (players.Count())
2607 p = players[0];
2608 #else
2610 #endif
2611
2613 {
2614 bool excluded = false;
2616 if (excludes)
2617 {
2618 foreach (string exclude : excludes)
2619 {
2621 {
2622 excluded = true;
2623 break;
2624 }
2625 }
2626 }
2627
2628 if (!excluded)
2629 {
2631 }
2632 }
2633
2635 }
2636
2638
2640 [
Obsolete(
"handled in the Construction component directly")]
2642 {
2643 }
2644
2645 [
Obsolete(
"handled in the Construction component directly")]
2647 {
2648 }
2649
2650 [
Obsolete(
"obsolete debug method")]
2652 {
2653 }
2654}
2655
2657{
2658#ifdef BSB_DEBUG
2660#else
2661
2662#endif
2663}
2665{
2666#ifdef BSB_DEBUG_SPAM
2668#else
2669
2670#endif
2671}
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.