1358{
1360
1362
1364
1371
1372
1373
1379
1385
1387
1391
1392
1394 {
1396
1397
1398 RegisterNetSyncVariableInt( "m_SyncParts01" );
1399 RegisterNetSyncVariableInt( "m_SyncParts02" );
1400 RegisterNetSyncVariableInt( "m_SyncParts03" );
1401 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1402 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1403 RegisterNetSyncVariableBool( "m_HasBase" );
1404
1405
1406 ConstructionInit();
1407
1408 if (ConfigIsExisting("hybridAttachments"))
1409 {
1412 }
1413 if (ConfigIsExisting("mountables"))
1414 {
1417 }
1418
1420 SetAllowDamage(true);
1421 }
1422
1424 {
1425 return "disableBaseDamage";
1426 }
1427
1429 {
1430 return true;
1431 }
1432
1434 {
1435 return EInventoryIconVisibility.HIDE_VICINITY;
1436 }
1437
1439 {
1440 super.InitItemSounds();
1441
1445
1450 }
1451
1453 {
1454 return "putDown_FenceKit_SoundSet";
1455 }
1456
1458 {
1459 return "Shelter_Site_Build_Loop_SoundSet";
1460 }
1461
1462
1464 {
1466 {
1467 SetSynchDirty();
1468 }
1469 }
1470
1472 {
1474 super.OnVariablesSynchronized();
1475
1477 }
1478
1480 {
1481
1483
1484
1486
1487
1489 }
1490
1491
1493 {
1494
1495 int offset;
1496 int mask;
1497
1498 if ( part_id >= 1 && part_id <= 31 )
1499 {
1500 offset = part_id - 1;
1501 mask = 1 << offset;
1502
1504 }
1505 else if ( part_id >= 32 && part_id <= 62 )
1506 {
1507 offset = ( part_id % 32 );
1508 mask = 1 << offset;
1509
1511 }
1512 else if ( part_id >= 63 && part_id <= 93 )
1513 {
1514 offset = ( part_id % 63 );
1515 mask = 1 << offset;
1516
1518 }
1519 }
1520
1522 {
1523
1524 int offset;
1525 int mask;
1526
1527 if ( part_id >= 1 && part_id <= 31 )
1528 {
1529 offset = part_id - 1;
1530 mask = 1 << offset;
1531
1533 }
1534 else if ( part_id >= 32 && part_id <= 62 )
1535 {
1536 offset = ( part_id % 32 );
1537 mask = 1 << offset;
1538
1540 }
1541 else if ( part_id >= 63 && part_id <= 93 )
1542 {
1543 offset = ( part_id % 63 );
1544 mask = 1 << offset;
1545
1547 }
1548 }
1549
1551 {
1552
1553 int offset;
1554 int mask;
1555
1556 if ( part_id >= 1 && part_id <= 31 )
1557 {
1558 offset = part_id - 1;
1559 mask = 1 << offset;
1560
1562 {
1563 return true;
1564 }
1565 }
1566 else if ( part_id >= 32 && part_id <= 62 )
1567 {
1568 offset = ( part_id % 32 );
1569 mask = 1 << offset;
1570
1572 {
1573 return true;
1574 }
1575 }
1576 else if ( part_id >= 63 && part_id <= 93 )
1577 {
1578 offset = ( part_id % 63 );
1579 mask = 1 << offset;
1580
1582 {
1583 return true;
1584 }
1585 }
1586
1587 return false;
1588 }
1589
1591 {
1594 }
1595
1597 {
1598
1601 }
1602
1604 {
1606 {
1609
1610 switch( build_action_id )
1611 {
1615 }
1616 }
1617 }
1618
1619
1621 {
1623 bool is_base = part.
IsBase();
1626 if ( is_part_built_sync )
1627 {
1629 {
1633
1634 if (is_base)
1635 {
1638 }
1639 }
1640 }
1641 else
1642 {
1644 {
1648
1649 if (is_base)
1650 {
1653 }
1654 }
1655 }
1656
1657
1659 }
1660
1661
1663 {
1666
1667 for ( int i = 0; i < construction_parts.Count(); ++i )
1668 {
1669 string key = construction_parts.GetKey( i );
1672 }
1673
1674
1676 }
1677
1679 {
1682
1683 for ( int i = 0; i < construction_parts.Count(); ++i )
1684 {
1685 string key = construction_parts.GetKey( i );
1687
1688 if ( value.
GetId() ==
id )
1689 {
1690 return value;
1691 }
1692 }
1693
1694 return NULL;
1695 }
1696
1697
1698
1700 {
1702 }
1703
1705 {
1707 }
1708
1710 {
1711 return true;
1712 }
1713
1715 {
1716 return false;
1717 }
1718
1719
1721 {
1724 {
1726 }
1727
1728 return construction_kit;
1729 }
1730
1732 {
1735 {
1737 }
1738 }
1739
1741 {
1743 }
1744
1746 {
1747 return "";
1748 }
1749
1751 {
1753 g_Game.ObjectDelete( construction_kit );
1754 }
1755
1756
1758 {
1760 g_Game.ObjectDelete(
this );
1761 }
1762
1763
1765 {
1766 super.EEDelete(parent);
1767
1769 {
1770 areaDamage.Destroy();
1771 }
1772
1773 }
1774
1776 {
1777 super.OnStoreSave( ctx );
1778
1779
1783
1785 }
1786
1788 {
1789 if ( !super.OnStoreLoad( ctx, version ) )
1790 return false;
1791
1792
1793
1795 {
1797 return false;
1798 }
1800 {
1802 return false;
1803 }
1805 {
1807 return false;
1808 }
1809
1810
1812 {
1814 return false;
1815 }
1816
1817
1818 return true;
1819 }
1820
1822 {
1823 super.AfterStoreLoad();
1824
1826 {
1828 }
1829 }
1830
1832 {
1833
1835
1836
1839
1840
1842 }
1843
1845 {
1846 super.OnCreatePhysics();
1847
1848 ConstructionInit();
1850 }
1851
1853 {
1855 return;
1856
1857 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1858 }
1859
1861 {
1863 {
1865 }
1866
1867 super.EEOnAfterLoad();
1868 }
1869
1871 {
1872 super.EEItemAttached( item, slot_name );
1873
1877 }
1878
1880 {
1881 super.EEItemDetached( item, slot_name );
1882
1885 }
1886
1887 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1888 {
1891
1894 }
1895
1896
1898 {
1899 return true;
1900 }
1901
1902
1903
1905 {
1907
1908
1909 if (construtionPart.
IsBase())
1910 {
1912
1913
1915 }
1916
1917
1919
1920
1922
1923
1925
1927
1929
1930
1932
1933
1935 }
1936
1938 {
1939
1941 }
1942
1943
1945 {
1948
1949
1951
1952
1954
1955
1957
1958
1960
1962
1963
1965
1966
1968
1969
1970 if (construtionPart.
IsBase())
1971 {
1972
1974 }
1975 }
1976
1978 {
1979
1981 }
1982
1983
1984 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
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
2025 {
2027
2030 }
2031
2033 {
2035
2037 {
2039 }
2040 else
2041 {
2043 }
2044
2046 }
2047
2049 {
2051
2053 foreach (
string slotName : attachmentSlots)
2054 {
2056 }
2057
2058
2061 else
2063
2065 }
2066
2068 {
2069 string slotNameMounted = slot_name + "_Mounted";
2070 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2071
2072 if (attachment)
2073 {
2074 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2075 if (barbedWire && barbedWire.IsMounted())
2077 else
2079
2080 if (is_locked)
2081 {
2082 SetAnimationPhase(slotNameMounted, 0);
2083 SetAnimationPhase(slot_name, 1);
2084 }
2085 else
2086 {
2087 SetAnimationPhase(slotNameMounted, 1);
2088 SetAnimationPhase(slot_name, 0);
2089 }
2090 }
2091 else
2092 {
2093 SetAnimationPhase(slotNameMounted, 1);
2094 SetAnimationPhase(slot_name, 1);
2095
2097 }
2098 }
2099
2100
2102 {
2105
2108
2111
2112 foreach (
string slotName : attachmentSlots)
2113 {
2115 }
2116
2117
2119 {
2122
2124 }
2125 else
2126 {
2129
2131 }
2132
2135 }
2136
2138 {
2139
2141 return;
2142
2143 string slot_name_mounted = slot_name + "_Mounted";
2144 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2145
2146
2148 RemoveProxyPhysics( slot_name_mounted );
2149 RemoveProxyPhysics( slot_name );
2150
2151 if ( attachment )
2152 {
2154 if ( is_locked )
2155 {
2157 AddProxyPhysics( slot_name_mounted );
2158 }
2159 else
2160 {
2162 AddProxyPhysics( slot_name );
2163 }
2164 }
2165 }
2166
2168 {
2169 SetAffectPathgraph( true, false );
2171 }
2172
2174 {
2175 return true;
2176 }
2177
2179 {
2180 return true;
2181 }
2182
2184 {
2185 if ( attachment )
2186 {
2188 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2189
2190 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2191 }
2192
2193 return false;
2194 }
2195
2197 {
2199 }
2200
2201
2203 {
2204 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2205 if (
g_Game.ConfigIsExisting( config_path ) )
2206 {
2207 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2208 }
2209 }
2210
2212 {
2213 return true;
2214 }
2215
2217 {
2218 return true;
2219 }
2220
2222 {
2223 return true;
2224 }
2225
2226
2228 {
2231 }
2232
2234 {
2236 }
2237
2239 {
2241 }
2242
2244 {
2245 int attachment_count = GetInventory().AttachmentCount();
2246 if ( attachment_count > 0 )
2247 {
2248 if (
HasBase() && attachment_count == 1 )
2249 {
2250 return false;
2251 }
2252
2253 return true;
2254 }
2255
2256 return false;
2257 }
2258
2260 {
2261 return true;
2262 }
2263
2265 {
2266 return false;
2267 }
2268
2269
2271 {
2272 return false;
2273 }
2274
2276 {
2277 return false;
2278 }
2279
2280
2282 {
2283 return false;
2284 }
2285
2286
2287
2289 {
2290 return true;
2291 }
2292
2294 {
2295 return true;
2296 }
2297
2300 {
2301 return false;
2302 }
2303
2304
2306 {
2307 return false;
2308 }
2309
2310
2312 {
2313 return true;
2314 }
2315
2316
2318 {
2319 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2320 {
2321 return false;
2322 }
2323
2324 return true;
2325 }
2326
2328 {
2331
2332 return item;
2333 }
2334
2335
2337 {
2339 {
2340
2342
2343
2346
2348 if ( MemoryPointExists( slot_name + "_min" ) )
2349 {
2350 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2351 }
2352 if ( MemoryPointExists( slot_name + "_max" ) )
2353 {
2354 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2355 }
2356
2357
2360
2361
2364 center = ModelToWorld( center );
2365
2366
2369
2370 areaDamage.SetExtents( extents[0], extents[1] );
2371 areaDamage.SetAreaPosition( center );
2375 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2376 areaDamage.SetAmmoName( "BarbedWireHit" );
2377 areaDamage.Spawn();
2378
2380 }
2381 }
2382
2384 {
2385 if ( angle_deg != 0 )
2386 {
2387
2389
2390
2392 if ( MemoryPointExists( "rotate_axis" ) )
2393 {
2394 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2395 }
2396 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];
2397 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];
2398 center[0] = r_center_x;
2399 center[2] = r_center_z;
2400 }
2401 }
2402
2404 {
2406 {
2409 {
2410 if (areaDamage)
2411 {
2412 areaDamage.Destroy();
2413 }
2414
2416 }
2417 }
2418 }
2419
2421 {
2422 return true;
2423 }
2424
2425
2426
2427
2429 {
2431 }
2432
2434 {
2436 }
2437
2439 {
2441 }
2442
2444 {
2446
2447 switch ( material_type )
2448 {
2454 }
2455
2456 return "";
2457 }
2458
2460 {
2462
2463 switch ( material_type )
2464 {
2470 }
2471
2472 return "";
2473 }
2474
2475
2477 {
2479 {
2480
2482 {
2483 SetHealth(slot_name,"Health",item.GetHealth());
2484 }
2485 }
2486 }
2487
2489 {
2490 return 111;
2491 }
2492
2494 {
2495 super.SetActions();
2496
2500 }
2501
2503 {
2505 if (!construction)
2506 return;
2507
2509 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2510 {
2513 {
2515 }
2516 }
2517 }
2518
2520 {
2522 if (!construction)
2523 return;
2524
2526 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2527 {
2530 {
2531 construction.HandleEntityFalling(part.
GetPartName());
2532 }
2533 }
2534 }
2535
2538 {
2540 return;
2541
2544
2545 if (DestroyOnFall())
2546 {
2548 {
2550 }
2551 else
2552 {
2554 {
2556 }
2558 }
2559 }
2560 }
2561
2563 {
2564 if (HasAnyAttachmentsOrCargo())
2565 {
2568 }
2569 }
2570
2571
2572
2573
2574
2577 {
2578 return null;
2579 }
2580
2582 {
2584 }
2585
2587 {
2590
2591 Man p;
2592
2593 #ifdef SERVER
2595 g_Game.GetWorld().GetPlayerList(players);
2596 if (players.Count())
2597 p = players[0];
2598 #else
2600 #endif
2601
2603 {
2604 bool excluded = false;
2606 if (excludes)
2607 {
2608 foreach (string exclude : excludes)
2609 {
2611 {
2612 excluded = true;
2613 break;
2614 }
2615 }
2616 }
2617
2618 if (!excluded)
2619 {
2621 }
2622 }
2623
2625 }
2626
2628
2630 [
Obsolete(
"handled in the Construction component directly")]
2632 {
2633 }
2634
2635 [
Obsolete(
"handled in the Construction component directly")]
2637 {
2638 }
2639
2640 [
Obsolete(
"obsolete debug method")]
2642 {
2643 }
2644}
2645
2647{
2648#ifdef BSB_DEBUG
2650#else
2651
2652#endif
2653}
2655{
2656#ifdef BSB_DEBUG_SPAM
2658#else
2659
2660#endif
2661}
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.