1414{
1416
1418
1420
1427
1428
1429
1435
1441
1443
1447
1448
1450 {
1452
1453
1454 RegisterNetSyncVariableInt( "m_SyncParts01" );
1455 RegisterNetSyncVariableInt( "m_SyncParts02" );
1456 RegisterNetSyncVariableInt( "m_SyncParts03" );
1457 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1458 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1459 RegisterNetSyncVariableBool( "m_HasBase" );
1460
1461
1462 ConstructionInit();
1463
1464 if (ConfigIsExisting("hybridAttachments"))
1465 {
1468 }
1469 if (ConfigIsExisting("mountables"))
1470 {
1473 }
1474
1476 SetAllowDamage(true);
1477 }
1478
1480 {
1481 return "disableBaseDamage";
1482 }
1483
1485 {
1486 return true;
1487 }
1488
1490 {
1491 return EInventoryIconVisibility.HIDE_VICINITY;
1492 }
1493
1495 {
1496 super.InitItemSounds();
1497
1501
1506 }
1507
1509 {
1510 return "putDown_FenceKit_SoundSet";
1511 }
1512
1514 {
1515 return "Shelter_Site_Build_Loop_SoundSet";
1516 }
1517
1518
1520 {
1522 {
1523 SetSynchDirty();
1524 }
1525 }
1526
1528 {
1530 super.OnVariablesSynchronized();
1531
1533 }
1534
1536 {
1537
1539
1540
1542
1543
1545 }
1546
1547
1549 {
1550
1551 int offset;
1552 int mask;
1553
1554 if ( part_id >= 1 && part_id <= 31 )
1555 {
1556 offset = part_id - 1;
1557 mask = 1 << offset;
1558
1560 }
1561 else if ( part_id >= 32 && part_id <= 62 )
1562 {
1563 offset = ( part_id % 32 );
1564 mask = 1 << offset;
1565
1567 }
1568 else if ( part_id >= 63 && part_id <= 93 )
1569 {
1570 offset = ( part_id % 63 );
1571 mask = 1 << offset;
1572
1574 }
1575 }
1576
1578 {
1579
1580 int offset;
1581 int mask;
1582
1583 if ( part_id >= 1 && part_id <= 31 )
1584 {
1585 offset = part_id - 1;
1586 mask = 1 << offset;
1587
1589 }
1590 else if ( part_id >= 32 && part_id <= 62 )
1591 {
1592 offset = ( part_id % 32 );
1593 mask = 1 << offset;
1594
1596 }
1597 else if ( part_id >= 63 && part_id <= 93 )
1598 {
1599 offset = ( part_id % 63 );
1600 mask = 1 << offset;
1601
1603 }
1604 }
1605
1607 {
1608
1609 int offset;
1610 int mask;
1611
1612 if ( part_id >= 1 && part_id <= 31 )
1613 {
1614 offset = part_id - 1;
1615 mask = 1 << offset;
1616
1618 {
1619 return true;
1620 }
1621 }
1622 else if ( part_id >= 32 && part_id <= 62 )
1623 {
1624 offset = ( part_id % 32 );
1625 mask = 1 << offset;
1626
1628 {
1629 return true;
1630 }
1631 }
1632 else if ( part_id >= 63 && part_id <= 93 )
1633 {
1634 offset = ( part_id % 63 );
1635 mask = 1 << offset;
1636
1638 {
1639 return true;
1640 }
1641 }
1642
1643 return false;
1644 }
1645
1647 {
1650 }
1651
1653 {
1654
1657 }
1658
1660 {
1662 {
1665
1666 switch( build_action_id )
1667 {
1671 }
1672 }
1673 }
1674
1675
1677 {
1679 bool is_base = part.
IsBase();
1682 if ( is_part_built_sync )
1683 {
1685 {
1689
1690 if (is_base)
1691 {
1694 }
1695 }
1696 }
1697 else
1698 {
1700 {
1704
1705 if (is_base)
1706 {
1709 }
1710 }
1711 }
1712
1713
1715 }
1716
1717
1719 {
1722
1723 for ( int i = 0; i < construction_parts.Count(); ++i )
1724 {
1725 string key = construction_parts.GetKey( i );
1728 }
1729
1730
1732 }
1733
1735 {
1738
1739 for ( int i = 0; i < construction_parts.Count(); ++i )
1740 {
1741 string key = construction_parts.GetKey( i );
1743
1744 if ( value.
GetId() ==
id )
1745 {
1746 return value;
1747 }
1748 }
1749
1750 return NULL;
1751 }
1752
1753
1754
1756 {
1758 }
1759
1761 {
1763 }
1764
1766 {
1767 return true;
1768 }
1769
1771 {
1772 return false;
1773 }
1774
1775
1777 {
1780 {
1782 }
1783
1784 return construction_kit;
1785 }
1786
1788 {
1791 {
1793 }
1794 }
1795
1797 {
1799 }
1800
1802 {
1803 return "";
1804 }
1805
1807 {
1809 g_Game.ObjectDelete( construction_kit );
1810 }
1811
1812
1814 {
1816 g_Game.ObjectDelete(
this );
1817 }
1818
1819
1821 {
1822 super.EEDelete(parent);
1823
1825 {
1826 areaDamage.Destroy();
1827 }
1828
1829 }
1830
1832 {
1833 super.OnStoreSave( ctx );
1834
1835
1839
1841 }
1842
1844 {
1845 if ( !super.OnStoreLoad( ctx, version ) )
1846 return false;
1847
1848
1849
1851 {
1853 return false;
1854 }
1856 {
1858 return false;
1859 }
1861 {
1863 return false;
1864 }
1865
1866
1868 {
1870 return false;
1871 }
1872
1873
1874 return true;
1875 }
1876
1878 {
1879 super.AfterStoreLoad();
1880
1882 {
1884 }
1885 }
1886
1888 {
1889
1891
1892
1895
1896
1898 }
1899
1901 {
1902 super.OnCreatePhysics();
1903
1904 ConstructionInit();
1906 }
1907
1909 {
1911 return;
1912
1913 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1914 }
1915
1917 {
1919 {
1921 }
1922
1923 super.EEOnAfterLoad();
1924 }
1925
1927 {
1928 super.EEItemAttached( item, slot_name );
1929
1933 }
1934
1936 {
1937 super.EEItemDetached( item, slot_name );
1938
1941 }
1942
1943 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1944 {
1947
1950 }
1951
1952
1954 {
1955 return true;
1956 }
1957
1958
1959
1961 {
1963
1964
1965 if (construtionPart.
IsBase())
1966 {
1968
1969
1971 }
1972
1973
1975
1976
1978
1979
1981
1983
1985
1986
1988
1989
1991 }
1992
1994 {
1995
1997 }
1998
1999
2001 {
2004
2005
2007
2008
2010
2011
2013
2014
2016
2018
2019
2021
2022
2024
2025
2026 if (construtionPart.
IsBase())
2027 {
2028
2030 }
2031 }
2032
2034 {
2035
2037 }
2038
2039
2040 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2041 {
2044
2045
2047
2048
2050
2051
2053
2054
2056
2058
2059
2061
2062
2064
2065
2066 if (construtionPart.
IsBase())
2067 {
2068
2070 }
2071 }
2072
2074 {
2075
2077 }
2078
2079
2081 {
2083
2086 }
2087
2089 {
2091
2093 {
2095 }
2096 else
2097 {
2099 }
2100
2102 }
2103
2105 {
2107
2109 foreach (
string slotName : attachmentSlots)
2110 {
2112 }
2113
2114
2117 else
2119
2121 }
2122
2124 {
2125 string slotNameMounted = slot_name + "_Mounted";
2126 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2127
2128 if (attachment)
2129 {
2130 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2131 if (barbedWire && barbedWire.IsMounted())
2133 else
2135
2136 if (is_locked)
2137 {
2138 SetAnimationPhase(slotNameMounted, 0);
2139 SetAnimationPhase(slot_name, 1);
2140 }
2141 else
2142 {
2143 SetAnimationPhase(slotNameMounted, 1);
2144 SetAnimationPhase(slot_name, 0);
2145 }
2146 }
2147 else
2148 {
2149 SetAnimationPhase(slotNameMounted, 1);
2150 SetAnimationPhase(slot_name, 1);
2151
2153 }
2154 }
2155
2156
2158 {
2161
2164
2167
2168 foreach (
string slotName : attachmentSlots)
2169 {
2171 }
2172
2173
2175 {
2178
2180 }
2181 else
2182 {
2185
2187 }
2188
2191 }
2192
2194 {
2195
2197 return;
2198
2199 string slot_name_mounted = slot_name + "_Mounted";
2200 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2201
2202
2204 RemoveProxyPhysics( slot_name_mounted );
2205 RemoveProxyPhysics( slot_name );
2206
2207 if ( attachment )
2208 {
2210 if ( is_locked )
2211 {
2213 AddProxyPhysics( slot_name_mounted );
2214 }
2215 else
2216 {
2218 AddProxyPhysics( slot_name );
2219 }
2220 }
2221 }
2222
2224 {
2225 SetAffectPathgraph( true, false );
2227 }
2228
2230 {
2231 return true;
2232 }
2233
2235 {
2236 return true;
2237 }
2238
2240 {
2241 if ( attachment )
2242 {
2244 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2245
2246 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2247 }
2248
2249 return false;
2250 }
2251
2253 {
2255 }
2256
2257
2259 {
2260 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2261 if (
g_Game.ConfigIsExisting( config_path ) )
2262 {
2263 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2264 }
2265 }
2266
2268 {
2269 return true;
2270 }
2271
2273 {
2274 return true;
2275 }
2276
2278 {
2279 return true;
2280 }
2281
2282
2284 {
2287 }
2288
2290 {
2292 }
2293
2295 {
2297 }
2298
2300 {
2301 int attachment_count = GetInventory().AttachmentCount();
2302 if ( attachment_count > 0 )
2303 {
2304 if (
HasBase() && attachment_count == 1 )
2305 {
2306 return false;
2307 }
2308
2309 return true;
2310 }
2311
2312 return false;
2313 }
2314
2316 {
2317 return true;
2318 }
2319
2321 {
2322 return false;
2323 }
2324
2325
2327 {
2328 return false;
2329 }
2330
2332 {
2333 return false;
2334 }
2335
2336
2338 {
2339 return false;
2340 }
2341
2342
2343
2345 {
2346 return true;
2347 }
2348
2350 {
2351 return true;
2352 }
2353
2356 {
2357 return false;
2358 }
2359
2360
2362 {
2363 return false;
2364 }
2365
2366
2368 {
2369 return true;
2370 }
2371
2372
2374 {
2375 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2376 {
2377 return false;
2378 }
2379
2380 return true;
2381 }
2382
2384 {
2387
2388 return item;
2389 }
2390
2391
2393 {
2395 {
2396
2398
2399
2402
2404 if ( MemoryPointExists( slot_name + "_min" ) )
2405 {
2406 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2407 }
2408 if ( MemoryPointExists( slot_name + "_max" ) )
2409 {
2410 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2411 }
2412
2413
2416
2417
2420 center = ModelToWorld( center );
2421
2422
2425
2426 areaDamage.SetExtents( extents[0], extents[1] );
2427 areaDamage.SetAreaPosition( center );
2431 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2432 areaDamage.SetAmmoName( "BarbedWireHit" );
2433 areaDamage.Spawn();
2434
2436 }
2437 }
2438
2440 {
2441 if ( angle_deg != 0 )
2442 {
2443
2445
2446
2448 if ( MemoryPointExists( "rotate_axis" ) )
2449 {
2450 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2451 }
2452 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];
2453 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];
2454 center[0] = r_center_x;
2455 center[2] = r_center_z;
2456 }
2457 }
2458
2460 {
2462 {
2465 {
2466 if (areaDamage)
2467 {
2468 areaDamage.Destroy();
2469 }
2470
2472 }
2473 }
2474 }
2475
2477 {
2478 return true;
2479 }
2480
2481
2482
2483
2485 {
2487 }
2488
2490 {
2492 }
2493
2495 {
2497 }
2498
2500 {
2502
2503 switch ( material_type )
2504 {
2510 }
2511
2512 return "";
2513 }
2514
2516 {
2518
2519 switch ( material_type )
2520 {
2526 }
2527
2528 return "";
2529 }
2530
2531
2533 {
2535 {
2536
2538 {
2539 SetHealth(slot_name,"Health",item.GetHealth());
2540 }
2541 }
2542 }
2543
2545 {
2546 return 111;
2547 }
2548
2550 {
2551 super.SetActions();
2552
2556 }
2557
2559 {
2561 if (!construction)
2562 return;
2563
2565 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2566 {
2569 {
2571 }
2572 }
2573 }
2574
2576 {
2578 if (!construction)
2579 return;
2580
2582 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2583 {
2586 {
2587 construction.HandleEntityFalling(part.
GetPartName());
2588 }
2589 }
2590 }
2591
2594 {
2596 return;
2597
2600
2601 if (DestroyOnFall())
2602 {
2604 {
2606 }
2607 else
2608 {
2610 {
2612 }
2614 }
2615 }
2616 }
2617
2619 {
2620 if (HasAnyAttachmentsOrCargo())
2621 {
2624 }
2625 }
2626
2627
2628
2629
2630
2633 {
2634 return null;
2635 }
2636
2638 {
2640 }
2641
2643 {
2646
2647 Man p;
2648
2649 #ifdef SERVER
2651 g_Game.GetWorld().GetPlayerList(players);
2652 if (players.Count())
2653 p = players[0];
2654 #else
2656 #endif
2657
2659 {
2660 bool excluded = false;
2662 if (excludes)
2663 {
2664 foreach (string exclude : excludes)
2665 {
2667 {
2668 excluded = true;
2669 break;
2670 }
2671 }
2672 }
2673
2674 if (!excluded)
2675 {
2677 }
2678 }
2679
2681 }
2682
2684
2686 [
Obsolete(
"handled in the Construction component directly")]
2688 {
2689 }
2690
2691 [
Obsolete(
"handled in the Construction component directly")]
2693 {
2694 }
2695
2696 [
Obsolete(
"obsolete debug method")]
2698 {
2699 }
2700}
2701
2703{
2704#ifdef BSB_DEBUG
2706#else
2707
2708#endif
2709}
2711{
2712#ifdef BSB_DEBUG_SPAM
2714#else
2715
2716#endif
2717}
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.