1363{
1365
1367
1369
1376
1377
1378
1384
1390
1392
1396
1397
1399 {
1401
1402
1403 RegisterNetSyncVariableInt( "m_SyncParts01" );
1404 RegisterNetSyncVariableInt( "m_SyncParts02" );
1405 RegisterNetSyncVariableInt( "m_SyncParts03" );
1406 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1407 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1408 RegisterNetSyncVariableBool( "m_HasBase" );
1409
1410
1411 ConstructionInit();
1412
1413 if (ConfigIsExisting("hybridAttachments"))
1414 {
1417 }
1418 if (ConfigIsExisting("mountables"))
1419 {
1422 }
1423
1425 SetAllowDamage(true);
1426 }
1427
1429 {
1430 return "disableBaseDamage";
1431 }
1432
1434 {
1435 return true;
1436 }
1437
1439 {
1440 return EInventoryIconVisibility.HIDE_VICINITY;
1441 }
1442
1444 {
1445 super.InitItemSounds();
1446
1450
1455 }
1456
1458 {
1459 return "putDown_FenceKit_SoundSet";
1460 }
1461
1463 {
1464 return "Shelter_Site_Build_Loop_SoundSet";
1465 }
1466
1467
1469 {
1471 {
1472 SetSynchDirty();
1473 }
1474 }
1475
1477 {
1479 super.OnVariablesSynchronized();
1480
1482 }
1483
1485 {
1486
1488
1489
1491
1492
1494 }
1495
1496
1498 {
1499
1500 int offset;
1501 int mask;
1502
1503 if ( part_id >= 1 && part_id <= 31 )
1504 {
1505 offset = part_id - 1;
1506 mask = 1 << offset;
1507
1509 }
1510 else if ( part_id >= 32 && part_id <= 62 )
1511 {
1512 offset = ( part_id % 32 );
1513 mask = 1 << offset;
1514
1516 }
1517 else if ( part_id >= 63 && part_id <= 93 )
1518 {
1519 offset = ( part_id % 63 );
1520 mask = 1 << offset;
1521
1523 }
1524 }
1525
1527 {
1528
1529 int offset;
1530 int mask;
1531
1532 if ( part_id >= 1 && part_id <= 31 )
1533 {
1534 offset = part_id - 1;
1535 mask = 1 << offset;
1536
1538 }
1539 else if ( part_id >= 32 && part_id <= 62 )
1540 {
1541 offset = ( part_id % 32 );
1542 mask = 1 << offset;
1543
1545 }
1546 else if ( part_id >= 63 && part_id <= 93 )
1547 {
1548 offset = ( part_id % 63 );
1549 mask = 1 << offset;
1550
1552 }
1553 }
1554
1556 {
1557
1558 int offset;
1559 int mask;
1560
1561 if ( part_id >= 1 && part_id <= 31 )
1562 {
1563 offset = part_id - 1;
1564 mask = 1 << offset;
1565
1567 {
1568 return true;
1569 }
1570 }
1571 else if ( part_id >= 32 && part_id <= 62 )
1572 {
1573 offset = ( part_id % 32 );
1574 mask = 1 << offset;
1575
1577 {
1578 return true;
1579 }
1580 }
1581 else if ( part_id >= 63 && part_id <= 93 )
1582 {
1583 offset = ( part_id % 63 );
1584 mask = 1 << offset;
1585
1587 {
1588 return true;
1589 }
1590 }
1591
1592 return false;
1593 }
1594
1596 {
1599 }
1600
1602 {
1603
1606 }
1607
1609 {
1611 {
1614
1615 switch( build_action_id )
1616 {
1620 }
1621 }
1622 }
1623
1624
1626 {
1628 bool is_base = part.
IsBase();
1631 if ( is_part_built_sync )
1632 {
1634 {
1638
1639 if (is_base)
1640 {
1643 }
1644 }
1645 }
1646 else
1647 {
1649 {
1653
1654 if (is_base)
1655 {
1658 }
1659 }
1660 }
1661
1662
1664 }
1665
1666
1668 {
1671
1672 for ( int i = 0; i < construction_parts.Count(); ++i )
1673 {
1674 string key = construction_parts.GetKey( i );
1677 }
1678
1679
1681 }
1682
1684 {
1687
1688 for ( int i = 0; i < construction_parts.Count(); ++i )
1689 {
1690 string key = construction_parts.GetKey( i );
1692
1693 if ( value.
GetId() ==
id )
1694 {
1695 return value;
1696 }
1697 }
1698
1699 return NULL;
1700 }
1701
1702
1703
1705 {
1707 }
1708
1710 {
1712 }
1713
1715 {
1716 return true;
1717 }
1718
1720 {
1721 return false;
1722 }
1723
1724
1726 {
1729 {
1731 }
1732
1733 return construction_kit;
1734 }
1735
1737 {
1740 {
1742 }
1743 }
1744
1746 {
1748 }
1749
1751 {
1752 return "";
1753 }
1754
1756 {
1758 g_Game.ObjectDelete( construction_kit );
1759 }
1760
1761
1763 {
1765 g_Game.ObjectDelete(
this );
1766 }
1767
1768
1770 {
1771 super.EEDelete(parent);
1772
1774 {
1775 areaDamage.Destroy();
1776 }
1777
1778 }
1779
1781 {
1782 super.OnStoreSave( ctx );
1783
1784
1788
1790 }
1791
1793 {
1794 if ( !super.OnStoreLoad( ctx, version ) )
1795 return false;
1796
1797
1798
1800 {
1802 return false;
1803 }
1805 {
1807 return false;
1808 }
1810 {
1812 return false;
1813 }
1814
1815
1817 {
1819 return false;
1820 }
1821
1822
1823 return true;
1824 }
1825
1827 {
1828 super.AfterStoreLoad();
1829
1831 {
1833 }
1834 }
1835
1837 {
1838
1840
1841
1844
1845
1847 }
1848
1850 {
1851 super.OnCreatePhysics();
1852
1853 ConstructionInit();
1855 }
1856
1858 {
1860 return;
1861
1862 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1863 }
1864
1866 {
1868 {
1870 }
1871
1872 super.EEOnAfterLoad();
1873 }
1874
1876 {
1877 super.EEItemAttached( item, slot_name );
1878
1882 }
1883
1885 {
1886 super.EEItemDetached( item, slot_name );
1887
1890 }
1891
1892 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1893 {
1896
1899 }
1900
1901
1903 {
1904 return true;
1905 }
1906
1907
1908
1910 {
1912
1913
1914 if (construtionPart.
IsBase())
1915 {
1917
1918
1920 }
1921
1922
1924
1925
1927
1928
1930
1932
1934
1935
1937
1938
1940 }
1941
1943 {
1944
1946 }
1947
1948
1950 {
1953
1954
1956
1957
1959
1960
1962
1963
1965
1967
1968
1970
1971
1973
1974
1975 if (construtionPart.
IsBase())
1976 {
1977
1979 }
1980 }
1981
1983 {
1984
1986 }
1987
1988
1989 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
1990 {
1993
1994
1996
1997
1999
2000
2002
2003
2005
2007
2008
2010
2011
2013
2014
2015 if (construtionPart.
IsBase())
2016 {
2017
2019 }
2020 }
2021
2023 {
2024
2026 }
2027
2028
2030 {
2032
2035 }
2036
2038 {
2040
2042 {
2044 }
2045 else
2046 {
2048 }
2049
2051 }
2052
2054 {
2056
2058 foreach (
string slotName : attachmentSlots)
2059 {
2061 }
2062
2063
2066 else
2068
2070 }
2071
2073 {
2074 string slotNameMounted = slot_name + "_Mounted";
2075 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2076
2077 if (attachment)
2078 {
2079 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2080 if (barbedWire && barbedWire.IsMounted())
2082 else
2084
2085 if (is_locked)
2086 {
2087 SetAnimationPhase(slotNameMounted, 0);
2088 SetAnimationPhase(slot_name, 1);
2089 }
2090 else
2091 {
2092 SetAnimationPhase(slotNameMounted, 1);
2093 SetAnimationPhase(slot_name, 0);
2094 }
2095 }
2096 else
2097 {
2098 SetAnimationPhase(slotNameMounted, 1);
2099 SetAnimationPhase(slot_name, 1);
2100
2102 }
2103 }
2104
2105
2107 {
2110
2113
2116
2117 foreach (
string slotName : attachmentSlots)
2118 {
2120 }
2121
2122
2124 {
2127
2129 }
2130 else
2131 {
2134
2136 }
2137
2140 }
2141
2143 {
2144
2146 return;
2147
2148 string slot_name_mounted = slot_name + "_Mounted";
2149 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2150
2151
2153 RemoveProxyPhysics( slot_name_mounted );
2154 RemoveProxyPhysics( slot_name );
2155
2156 if ( attachment )
2157 {
2159 if ( is_locked )
2160 {
2162 AddProxyPhysics( slot_name_mounted );
2163 }
2164 else
2165 {
2167 AddProxyPhysics( slot_name );
2168 }
2169 }
2170 }
2171
2173 {
2174 SetAffectPathgraph( true, false );
2176 }
2177
2179 {
2180 return true;
2181 }
2182
2184 {
2185 return true;
2186 }
2187
2189 {
2190 if ( attachment )
2191 {
2193 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2194
2195 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2196 }
2197
2198 return false;
2199 }
2200
2202 {
2204 }
2205
2206
2208 {
2209 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2210 if (
g_Game.ConfigIsExisting( config_path ) )
2211 {
2212 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2213 }
2214 }
2215
2217 {
2218 return true;
2219 }
2220
2222 {
2223 return true;
2224 }
2225
2227 {
2228 return true;
2229 }
2230
2231
2233 {
2236 }
2237
2239 {
2241 }
2242
2244 {
2246 }
2247
2249 {
2250 int attachment_count = GetInventory().AttachmentCount();
2251 if ( attachment_count > 0 )
2252 {
2253 if (
HasBase() && attachment_count == 1 )
2254 {
2255 return false;
2256 }
2257
2258 return true;
2259 }
2260
2261 return false;
2262 }
2263
2265 {
2266 return true;
2267 }
2268
2270 {
2271 return false;
2272 }
2273
2274
2276 {
2277 return false;
2278 }
2279
2281 {
2282 return false;
2283 }
2284
2285
2287 {
2288 return false;
2289 }
2290
2291
2292
2294 {
2295 return true;
2296 }
2297
2299 {
2300 return true;
2301 }
2302
2305 {
2306 return false;
2307 }
2308
2309
2311 {
2312 return false;
2313 }
2314
2315
2317 {
2318 return true;
2319 }
2320
2321
2323 {
2324 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2325 {
2326 return false;
2327 }
2328
2329 return true;
2330 }
2331
2333 {
2336
2337 return item;
2338 }
2339
2340
2342 {
2344 {
2345
2347
2348
2351
2353 if ( MemoryPointExists( slot_name + "_min" ) )
2354 {
2355 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2356 }
2357 if ( MemoryPointExists( slot_name + "_max" ) )
2358 {
2359 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2360 }
2361
2362
2365
2366
2369 center = ModelToWorld( center );
2370
2371
2374
2375 areaDamage.SetExtents( extents[0], extents[1] );
2376 areaDamage.SetAreaPosition( center );
2380 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2381 areaDamage.SetAmmoName( "BarbedWireHit" );
2382 areaDamage.Spawn();
2383
2385 }
2386 }
2387
2389 {
2390 if ( angle_deg != 0 )
2391 {
2392
2394
2395
2397 if ( MemoryPointExists( "rotate_axis" ) )
2398 {
2399 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2400 }
2401 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];
2402 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];
2403 center[0] = r_center_x;
2404 center[2] = r_center_z;
2405 }
2406 }
2407
2409 {
2411 {
2414 {
2415 if (areaDamage)
2416 {
2417 areaDamage.Destroy();
2418 }
2419
2421 }
2422 }
2423 }
2424
2426 {
2427 return true;
2428 }
2429
2430
2431
2432
2434 {
2436 }
2437
2439 {
2441 }
2442
2444 {
2446 }
2447
2449 {
2451
2452 switch ( material_type )
2453 {
2459 }
2460
2461 return "";
2462 }
2463
2465 {
2467
2468 switch ( material_type )
2469 {
2475 }
2476
2477 return "";
2478 }
2479
2480
2482 {
2484 {
2485
2487 {
2488 SetHealth(slot_name,"Health",item.GetHealth());
2489 }
2490 }
2491 }
2492
2494 {
2495 return 111;
2496 }
2497
2499 {
2500 super.SetActions();
2501
2505 }
2506
2508 {
2510 if (!construction)
2511 return;
2512
2514 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2515 {
2518 {
2520 }
2521 }
2522 }
2523
2525 {
2527 if (!construction)
2528 return;
2529
2531 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2532 {
2535 {
2536 construction.HandleEntityFalling(part.
GetPartName());
2537 }
2538 }
2539 }
2540
2543 {
2545 return;
2546
2549
2550 if (DestroyOnFall())
2551 {
2553 {
2555 }
2556 else
2557 {
2559 {
2561 }
2563 }
2564 }
2565 }
2566
2568 {
2569 if (HasAnyAttachmentsOrCargo())
2570 {
2573 }
2574 }
2575
2576
2577
2578
2579
2582 {
2583 return null;
2584 }
2585
2587 {
2589 }
2590
2592 {
2595
2596 Man p;
2597
2598 #ifdef SERVER
2600 g_Game.GetWorld().GetPlayerList(players);
2601 if (players.Count())
2602 p = players[0];
2603 #else
2605 #endif
2606
2608 {
2609 bool excluded = false;
2611 if (excludes)
2612 {
2613 foreach (string exclude : excludes)
2614 {
2616 {
2617 excluded = true;
2618 break;
2619 }
2620 }
2621 }
2622
2623 if (!excluded)
2624 {
2626 }
2627 }
2628
2630 }
2631
2633
2635 [
Obsolete(
"handled in the Construction component directly")]
2637 {
2638 }
2639
2640 [
Obsolete(
"handled in the Construction component directly")]
2642 {
2643 }
2644
2645 [
Obsolete(
"obsolete debug method")]
2647 {
2648 }
2649}
2650
2652{
2653#ifdef BSB_DEBUG
2655#else
2656
2657#endif
2658}
2660{
2661#ifdef BSB_DEBUG_SPAM
2663#else
2664
2665#endif
2666}
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.