1387{
1389
1391
1393
1400
1401
1402
1408
1414
1416
1420
1421
1423 {
1425
1426
1427 RegisterNetSyncVariableInt( "m_SyncParts01" );
1428 RegisterNetSyncVariableInt( "m_SyncParts02" );
1429 RegisterNetSyncVariableInt( "m_SyncParts03" );
1430 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1431 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1432 RegisterNetSyncVariableBool( "m_HasBase" );
1433
1434
1435 ConstructionInit();
1436
1437 if (ConfigIsExisting("hybridAttachments"))
1438 {
1441 }
1442 if (ConfigIsExisting("mountables"))
1443 {
1446 }
1447
1449 SetAllowDamage(true);
1450 }
1451
1453 {
1454 return "disableBaseDamage";
1455 }
1456
1458 {
1459 return true;
1460 }
1461
1463 {
1464 return EInventoryIconVisibility.HIDE_VICINITY;
1465 }
1466
1468 {
1469 super.InitItemSounds();
1470
1474
1479 }
1480
1482 {
1483 return "putDown_FenceKit_SoundSet";
1484 }
1485
1487 {
1488 return "Shelter_Site_Build_Loop_SoundSet";
1489 }
1490
1491
1493 {
1495 {
1496 SetSynchDirty();
1497 }
1498 }
1499
1501 {
1503 super.OnVariablesSynchronized();
1504
1506 }
1507
1509 {
1510
1512
1513
1515
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 else if ( part_id >= 32 && part_id <= 62 )
1564 {
1565 offset = ( part_id % 32 );
1566 mask = 1 << offset;
1567
1569 }
1570 else if ( part_id >= 63 && part_id <= 93 )
1571 {
1572 offset = ( part_id % 63 );
1573 mask = 1 << offset;
1574
1576 }
1577 }
1578
1580 {
1581
1582 int offset;
1583 int mask;
1584
1585 if ( part_id >= 1 && part_id <= 31 )
1586 {
1587 offset = part_id - 1;
1588 mask = 1 << offset;
1589
1591 {
1592 return true;
1593 }
1594 }
1595 else if ( part_id >= 32 && part_id <= 62 )
1596 {
1597 offset = ( part_id % 32 );
1598 mask = 1 << offset;
1599
1601 {
1602 return true;
1603 }
1604 }
1605 else if ( part_id >= 63 && part_id <= 93 )
1606 {
1607 offset = ( part_id % 63 );
1608 mask = 1 << offset;
1609
1611 {
1612 return true;
1613 }
1614 }
1615
1616 return false;
1617 }
1618
1620 {
1623 }
1624
1626 {
1627
1630 }
1631
1633 {
1635 {
1638
1639 switch( build_action_id )
1640 {
1644 }
1645 }
1646 }
1647
1648
1650 {
1652 bool is_base = part.
IsBase();
1655 if ( is_part_built_sync )
1656 {
1658 {
1662
1663 if (is_base)
1664 {
1667 }
1668 }
1669 }
1670 else
1671 {
1673 {
1677
1678 if (is_base)
1679 {
1682 }
1683 }
1684 }
1685
1686
1688 }
1689
1690
1692 {
1695
1696 for ( int i = 0; i < construction_parts.Count(); ++i )
1697 {
1698 string key = construction_parts.GetKey( i );
1701 }
1702
1703
1705 }
1706
1708 {
1711
1712 for ( int i = 0; i < construction_parts.Count(); ++i )
1713 {
1714 string key = construction_parts.GetKey( i );
1716
1717 if ( value.
GetId() ==
id )
1718 {
1719 return value;
1720 }
1721 }
1722
1723 return NULL;
1724 }
1725
1726
1727
1729 {
1731 }
1732
1734 {
1736 }
1737
1739 {
1740 return true;
1741 }
1742
1744 {
1745 return false;
1746 }
1747
1748
1750 {
1753 {
1755 }
1756
1757 return construction_kit;
1758 }
1759
1761 {
1764 {
1766 }
1767 }
1768
1770 {
1772 }
1773
1775 {
1776 return "";
1777 }
1778
1780 {
1782 g_Game.ObjectDelete( construction_kit );
1783 }
1784
1785
1787 {
1789 g_Game.ObjectDelete(
this );
1790 }
1791
1792
1794 {
1795 super.EEDelete(parent);
1796
1798 {
1799 areaDamage.Destroy();
1800 }
1801
1802 }
1803
1805 {
1806 super.OnStoreSave( ctx );
1807
1808
1812
1814 }
1815
1817 {
1818 if ( !super.OnStoreLoad( ctx, version ) )
1819 return false;
1820
1821
1822
1824 {
1826 return false;
1827 }
1829 {
1831 return false;
1832 }
1834 {
1836 return false;
1837 }
1838
1839
1841 {
1843 return false;
1844 }
1845
1846
1847 return true;
1848 }
1849
1851 {
1852 super.AfterStoreLoad();
1853
1855 {
1857 }
1858 }
1859
1861 {
1862
1864
1865
1868
1869
1871 }
1872
1874 {
1875 super.OnCreatePhysics();
1876
1877 ConstructionInit();
1879 }
1880
1882 {
1884 return;
1885
1886 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1887 }
1888
1890 {
1892 {
1894 }
1895
1896 super.EEOnAfterLoad();
1897 }
1898
1900 {
1901 super.EEItemAttached( item, slot_name );
1902
1906 }
1907
1909 {
1910 super.EEItemDetached( item, slot_name );
1911
1914 }
1915
1916 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1917 {
1920
1923 }
1924
1925
1927 {
1928 return true;
1929 }
1930
1931
1932
1934 {
1936
1937
1938 if (construtionPart.
IsBase())
1939 {
1941
1942
1944 }
1945
1946
1948
1949
1951
1952
1954
1956
1958
1959
1961
1962
1964 }
1965
1967 {
1968
1970 }
1971
1972
1974 {
1977
1978
1980
1981
1983
1984
1986
1987
1989
1991
1992
1994
1995
1997
1998
1999 if (construtionPart.
IsBase())
2000 {
2001
2003 }
2004 }
2005
2007 {
2008
2010 }
2011
2012
2013 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2014 {
2017
2018
2020
2021
2023
2024
2026
2027
2029
2031
2032
2034
2035
2037
2038
2039 if (construtionPart.
IsBase())
2040 {
2041
2043 }
2044 }
2045
2047 {
2048
2050 }
2051
2052
2054 {
2056
2059 }
2060
2062 {
2064
2066 {
2068 }
2069 else
2070 {
2072 }
2073
2075 }
2076
2078 {
2080
2082 foreach (
string slotName : attachmentSlots)
2083 {
2085 }
2086
2087
2090 else
2092
2094 }
2095
2097 {
2098 string slotNameMounted = slot_name + "_Mounted";
2099 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2100
2101 if (attachment)
2102 {
2103 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2104 if (barbedWire && barbedWire.IsMounted())
2106 else
2108
2109 if (is_locked)
2110 {
2111 SetAnimationPhase(slotNameMounted, 0);
2112 SetAnimationPhase(slot_name, 1);
2113 }
2114 else
2115 {
2116 SetAnimationPhase(slotNameMounted, 1);
2117 SetAnimationPhase(slot_name, 0);
2118 }
2119 }
2120 else
2121 {
2122 SetAnimationPhase(slotNameMounted, 1);
2123 SetAnimationPhase(slot_name, 1);
2124
2126 }
2127 }
2128
2129
2131 {
2134
2137
2140
2141 foreach (
string slotName : attachmentSlots)
2142 {
2144 }
2145
2146
2148 {
2151
2153 }
2154 else
2155 {
2158
2160 }
2161
2164 }
2165
2167 {
2168
2170 return;
2171
2172 string slot_name_mounted = slot_name + "_Mounted";
2173 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2174
2175
2177 RemoveProxyPhysics( slot_name_mounted );
2178 RemoveProxyPhysics( slot_name );
2179
2180 if ( attachment )
2181 {
2183 if ( is_locked )
2184 {
2186 AddProxyPhysics( slot_name_mounted );
2187 }
2188 else
2189 {
2191 AddProxyPhysics( slot_name );
2192 }
2193 }
2194 }
2195
2197 {
2198 SetAffectPathgraph( true, false );
2200 }
2201
2203 {
2204 return true;
2205 }
2206
2208 {
2209 return true;
2210 }
2211
2213 {
2214 if ( attachment )
2215 {
2217 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2218
2219 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2220 }
2221
2222 return false;
2223 }
2224
2226 {
2228 }
2229
2230
2232 {
2233 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2234 if (
g_Game.ConfigIsExisting( config_path ) )
2235 {
2236 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2237 }
2238 }
2239
2241 {
2242 return true;
2243 }
2244
2246 {
2247 return true;
2248 }
2249
2251 {
2252 return true;
2253 }
2254
2255
2257 {
2260 }
2261
2263 {
2265 }
2266
2268 {
2270 }
2271
2273 {
2274 int attachment_count = GetInventory().AttachmentCount();
2275 if ( attachment_count > 0 )
2276 {
2277 if (
HasBase() && attachment_count == 1 )
2278 {
2279 return false;
2280 }
2281
2282 return true;
2283 }
2284
2285 return false;
2286 }
2287
2289 {
2290 return true;
2291 }
2292
2294 {
2295 return false;
2296 }
2297
2298
2300 {
2301 return false;
2302 }
2303
2305 {
2306 return false;
2307 }
2308
2309
2311 {
2312 return false;
2313 }
2314
2315
2316
2318 {
2319 return true;
2320 }
2321
2323 {
2324 return true;
2325 }
2326
2329 {
2330 return false;
2331 }
2332
2333
2335 {
2336 return false;
2337 }
2338
2339
2341 {
2342 return true;
2343 }
2344
2345
2347 {
2348 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2349 {
2350 return false;
2351 }
2352
2353 return true;
2354 }
2355
2357 {
2360
2361 return item;
2362 }
2363
2364
2366 {
2368 {
2369
2371
2372
2375
2377 if ( MemoryPointExists( slot_name + "_min" ) )
2378 {
2379 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2380 }
2381 if ( MemoryPointExists( slot_name + "_max" ) )
2382 {
2383 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2384 }
2385
2386
2389
2390
2393 center = ModelToWorld( center );
2394
2395
2398
2399 areaDamage.SetExtents( extents[0], extents[1] );
2400 areaDamage.SetAreaPosition( center );
2404 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2405 areaDamage.SetAmmoName( "BarbedWireHit" );
2406 areaDamage.Spawn();
2407
2409 }
2410 }
2411
2413 {
2414 if ( angle_deg != 0 )
2415 {
2416
2418
2419
2421 if ( MemoryPointExists( "rotate_axis" ) )
2422 {
2423 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2424 }
2425 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];
2426 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];
2427 center[0] = r_center_x;
2428 center[2] = r_center_z;
2429 }
2430 }
2431
2433 {
2435 {
2438 {
2439 if (areaDamage)
2440 {
2441 areaDamage.Destroy();
2442 }
2443
2445 }
2446 }
2447 }
2448
2450 {
2451 return true;
2452 }
2453
2454
2455
2456
2458 {
2460 }
2461
2463 {
2465 }
2466
2468 {
2470 }
2471
2473 {
2475
2476 switch ( material_type )
2477 {
2483 }
2484
2485 return "";
2486 }
2487
2489 {
2491
2492 switch ( material_type )
2493 {
2499 }
2500
2501 return "";
2502 }
2503
2504
2506 {
2508 {
2509
2511 {
2512 SetHealth(slot_name,"Health",item.GetHealth());
2513 }
2514 }
2515 }
2516
2518 {
2519 return 111;
2520 }
2521
2523 {
2524 super.SetActions();
2525
2529 }
2530
2532 {
2534 if (!construction)
2535 return;
2536
2538 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2539 {
2542 {
2544 }
2545 }
2546 }
2547
2549 {
2551 if (!construction)
2552 return;
2553
2555 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2556 {
2559 {
2560 construction.HandleEntityFalling(part.
GetPartName());
2561 }
2562 }
2563 }
2564
2567 {
2569 return;
2570
2573
2574 if (DestroyOnFall())
2575 {
2577 {
2579 }
2580 else
2581 {
2583 {
2585 }
2587 }
2588 }
2589 }
2590
2592 {
2593 if (HasAnyAttachmentsOrCargo())
2594 {
2597 }
2598 }
2599
2600
2601
2602
2603
2606 {
2607 return null;
2608 }
2609
2611 {
2613 }
2614
2616 {
2619
2620 Man p;
2621
2622 #ifdef SERVER
2624 g_Game.GetWorld().GetPlayerList(players);
2625 if (players.Count())
2626 p = players[0];
2627 #else
2629 #endif
2630
2632 {
2633 bool excluded = false;
2635 if (excludes)
2636 {
2637 foreach (string exclude : excludes)
2638 {
2640 {
2641 excluded = true;
2642 break;
2643 }
2644 }
2645 }
2646
2647 if (!excluded)
2648 {
2650 }
2651 }
2652
2654 }
2655
2657
2659 [
Obsolete(
"handled in the Construction component directly")]
2661 {
2662 }
2663
2664 [
Obsolete(
"handled in the Construction component directly")]
2666 {
2667 }
2668
2669 [
Obsolete(
"obsolete debug method")]
2671 {
2672 }
2673}
2674
2676{
2677#ifdef BSB_DEBUG
2679#else
2680
2681#endif
2682}
2684{
2685#ifdef BSB_DEBUG_SPAM
2687#else
2688
2689#endif
2690}
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.