1392{
1394
1396
1398
1405
1406
1407
1413
1419
1421
1425
1426
1428 {
1430
1431
1432 RegisterNetSyncVariableInt( "m_SyncParts01" );
1433 RegisterNetSyncVariableInt( "m_SyncParts02" );
1434 RegisterNetSyncVariableInt( "m_SyncParts03" );
1435 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1436 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1437 RegisterNetSyncVariableBool( "m_HasBase" );
1438
1439
1440 ConstructionInit();
1441
1442 if (ConfigIsExisting("hybridAttachments"))
1443 {
1446 }
1447 if (ConfigIsExisting("mountables"))
1448 {
1451 }
1452
1454 SetAllowDamage(true);
1455 }
1456
1458 {
1459 return "disableBaseDamage";
1460 }
1461
1463 {
1464 return true;
1465 }
1466
1468 {
1469 return EInventoryIconVisibility.HIDE_VICINITY;
1470 }
1471
1473 {
1474 super.InitItemSounds();
1475
1479
1484 }
1485
1487 {
1488 return "putDown_FenceKit_SoundSet";
1489 }
1490
1492 {
1493 return "Shelter_Site_Build_Loop_SoundSet";
1494 }
1495
1496
1498 {
1500 {
1501 SetSynchDirty();
1502 }
1503 }
1504
1506 {
1508 super.OnVariablesSynchronized();
1509
1511 }
1512
1514 {
1515
1517
1518
1520
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 else if ( part_id >= 32 && part_id <= 62 )
1569 {
1570 offset = ( part_id % 32 );
1571 mask = 1 << offset;
1572
1574 }
1575 else if ( part_id >= 63 && part_id <= 93 )
1576 {
1577 offset = ( part_id % 63 );
1578 mask = 1 << offset;
1579
1581 }
1582 }
1583
1585 {
1586
1587 int offset;
1588 int mask;
1589
1590 if ( part_id >= 1 && part_id <= 31 )
1591 {
1592 offset = part_id - 1;
1593 mask = 1 << offset;
1594
1596 {
1597 return true;
1598 }
1599 }
1600 else if ( part_id >= 32 && part_id <= 62 )
1601 {
1602 offset = ( part_id % 32 );
1603 mask = 1 << offset;
1604
1606 {
1607 return true;
1608 }
1609 }
1610 else if ( part_id >= 63 && part_id <= 93 )
1611 {
1612 offset = ( part_id % 63 );
1613 mask = 1 << offset;
1614
1616 {
1617 return true;
1618 }
1619 }
1620
1621 return false;
1622 }
1623
1625 {
1628 }
1629
1631 {
1632
1635 }
1636
1638 {
1640 {
1643
1644 switch( build_action_id )
1645 {
1649 }
1650 }
1651 }
1652
1653
1655 {
1657 bool is_base = part.
IsBase();
1660 if ( is_part_built_sync )
1661 {
1663 {
1667
1668 if (is_base)
1669 {
1672 }
1673 }
1674 }
1675 else
1676 {
1678 {
1682
1683 if (is_base)
1684 {
1687 }
1688 }
1689 }
1690
1691
1693 }
1694
1695
1697 {
1700
1701 for ( int i = 0; i < construction_parts.Count(); ++i )
1702 {
1703 string key = construction_parts.GetKey( i );
1706 }
1707
1708
1710 }
1711
1713 {
1716
1717 for ( int i = 0; i < construction_parts.Count(); ++i )
1718 {
1719 string key = construction_parts.GetKey( i );
1721
1722 if ( value.
GetId() ==
id )
1723 {
1724 return value;
1725 }
1726 }
1727
1728 return NULL;
1729 }
1730
1731
1732
1734 {
1736 }
1737
1739 {
1741 }
1742
1744 {
1745 return true;
1746 }
1747
1749 {
1750 return false;
1751 }
1752
1753
1755 {
1758 {
1760 }
1761
1762 return construction_kit;
1763 }
1764
1766 {
1769 {
1771 }
1772 }
1773
1775 {
1777 }
1778
1780 {
1781 return "";
1782 }
1783
1785 {
1787 g_Game.ObjectDelete( construction_kit );
1788 }
1789
1790
1792 {
1794 g_Game.ObjectDelete(
this );
1795 }
1796
1797
1799 {
1800 super.EEDelete(parent);
1801
1803 {
1804 areaDamage.Destroy();
1805 }
1806
1807 }
1808
1810 {
1811 super.OnStoreSave( ctx );
1812
1813
1817
1819 }
1820
1822 {
1823 if ( !super.OnStoreLoad( ctx, version ) )
1824 return false;
1825
1826
1827
1829 {
1831 return false;
1832 }
1834 {
1836 return false;
1837 }
1839 {
1841 return false;
1842 }
1843
1844
1846 {
1848 return false;
1849 }
1850
1851
1852 return true;
1853 }
1854
1856 {
1857 super.AfterStoreLoad();
1858
1860 {
1862 }
1863 }
1864
1866 {
1867
1869
1870
1873
1874
1876 }
1877
1879 {
1880 super.OnCreatePhysics();
1881
1882 ConstructionInit();
1884 }
1885
1887 {
1889 return;
1890
1891 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1892 }
1893
1895 {
1897 {
1899 }
1900
1901 super.EEOnAfterLoad();
1902 }
1903
1905 {
1906 super.EEItemAttached( item, slot_name );
1907
1911 }
1912
1914 {
1915 super.EEItemDetached( item, slot_name );
1916
1919 }
1920
1921 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1922 {
1925
1928 }
1929
1930
1932 {
1933 return true;
1934 }
1935
1936
1937
1939 {
1941
1942
1943 if (construtionPart.
IsBase())
1944 {
1946
1947
1949 }
1950
1951
1953
1954
1956
1957
1959
1961
1963
1964
1966
1967
1969 }
1970
1972 {
1973
1975 }
1976
1977
1979 {
1982
1983
1985
1986
1988
1989
1991
1992
1994
1996
1997
1999
2000
2002
2003
2004 if (construtionPart.
IsBase())
2005 {
2006
2008 }
2009 }
2010
2012 {
2013
2015 }
2016
2017
2018 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2019 {
2022
2023
2025
2026
2028
2029
2031
2032
2034
2036
2037
2039
2040
2042
2043
2044 if (construtionPart.
IsBase())
2045 {
2046
2048 }
2049 }
2050
2052 {
2053
2055 }
2056
2057
2059 {
2061
2064 }
2065
2067 {
2069
2071 {
2073 }
2074 else
2075 {
2077 }
2078
2080 }
2081
2083 {
2085
2087 foreach (
string slotName : attachmentSlots)
2088 {
2090 }
2091
2092
2095 else
2097
2099 }
2100
2102 {
2103 string slotNameMounted = slot_name + "_Mounted";
2104 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2105
2106 if (attachment)
2107 {
2108 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2109 if (barbedWire && barbedWire.IsMounted())
2111 else
2113
2114 if (is_locked)
2115 {
2116 SetAnimationPhase(slotNameMounted, 0);
2117 SetAnimationPhase(slot_name, 1);
2118 }
2119 else
2120 {
2121 SetAnimationPhase(slotNameMounted, 1);
2122 SetAnimationPhase(slot_name, 0);
2123 }
2124 }
2125 else
2126 {
2127 SetAnimationPhase(slotNameMounted, 1);
2128 SetAnimationPhase(slot_name, 1);
2129
2131 }
2132 }
2133
2134
2136 {
2139
2142
2145
2146 foreach (
string slotName : attachmentSlots)
2147 {
2149 }
2150
2151
2153 {
2156
2158 }
2159 else
2160 {
2163
2165 }
2166
2169 }
2170
2172 {
2173
2175 return;
2176
2177 string slot_name_mounted = slot_name + "_Mounted";
2178 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2179
2180
2182 RemoveProxyPhysics( slot_name_mounted );
2183 RemoveProxyPhysics( slot_name );
2184
2185 if ( attachment )
2186 {
2188 if ( is_locked )
2189 {
2191 AddProxyPhysics( slot_name_mounted );
2192 }
2193 else
2194 {
2196 AddProxyPhysics( slot_name );
2197 }
2198 }
2199 }
2200
2202 {
2203 SetAffectPathgraph( true, false );
2205 }
2206
2208 {
2209 return true;
2210 }
2211
2213 {
2214 return true;
2215 }
2216
2218 {
2219 if ( attachment )
2220 {
2222 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2223
2224 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2225 }
2226
2227 return false;
2228 }
2229
2231 {
2233 }
2234
2235
2237 {
2238 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2239 if (
g_Game.ConfigIsExisting( config_path ) )
2240 {
2241 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2242 }
2243 }
2244
2246 {
2247 return true;
2248 }
2249
2251 {
2252 return true;
2253 }
2254
2256 {
2257 return true;
2258 }
2259
2260
2262 {
2265 }
2266
2268 {
2270 }
2271
2273 {
2275 }
2276
2278 {
2279 int attachment_count = GetInventory().AttachmentCount();
2280 if ( attachment_count > 0 )
2281 {
2282 if (
HasBase() && attachment_count == 1 )
2283 {
2284 return false;
2285 }
2286
2287 return true;
2288 }
2289
2290 return false;
2291 }
2292
2294 {
2295 return true;
2296 }
2297
2299 {
2300 return false;
2301 }
2302
2303
2305 {
2306 return false;
2307 }
2308
2310 {
2311 return false;
2312 }
2313
2314
2316 {
2317 return false;
2318 }
2319
2320
2321
2323 {
2324 return true;
2325 }
2326
2328 {
2329 return true;
2330 }
2331
2334 {
2335 return false;
2336 }
2337
2338
2340 {
2341 return false;
2342 }
2343
2344
2346 {
2347 return true;
2348 }
2349
2350
2352 {
2353 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2354 {
2355 return false;
2356 }
2357
2358 return true;
2359 }
2360
2362 {
2365
2366 return item;
2367 }
2368
2369
2371 {
2373 {
2374
2376
2377
2380
2382 if ( MemoryPointExists( slot_name + "_min" ) )
2383 {
2384 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2385 }
2386 if ( MemoryPointExists( slot_name + "_max" ) )
2387 {
2388 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2389 }
2390
2391
2394
2395
2398 center = ModelToWorld( center );
2399
2400
2403
2404 areaDamage.SetExtents( extents[0], extents[1] );
2405 areaDamage.SetAreaPosition( center );
2409 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2410 areaDamage.SetAmmoName( "BarbedWireHit" );
2411 areaDamage.Spawn();
2412
2414 }
2415 }
2416
2418 {
2419 if ( angle_deg != 0 )
2420 {
2421
2423
2424
2426 if ( MemoryPointExists( "rotate_axis" ) )
2427 {
2428 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2429 }
2430 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];
2431 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];
2432 center[0] = r_center_x;
2433 center[2] = r_center_z;
2434 }
2435 }
2436
2438 {
2440 {
2443 {
2444 if (areaDamage)
2445 {
2446 areaDamage.Destroy();
2447 }
2448
2450 }
2451 }
2452 }
2453
2455 {
2456 return true;
2457 }
2458
2459
2460
2461
2463 {
2465 }
2466
2468 {
2470 }
2471
2473 {
2475 }
2476
2478 {
2480
2481 switch ( material_type )
2482 {
2488 }
2489
2490 return "";
2491 }
2492
2494 {
2496
2497 switch ( material_type )
2498 {
2504 }
2505
2506 return "";
2507 }
2508
2509
2511 {
2513 {
2514
2516 {
2517 SetHealth(slot_name,"Health",item.GetHealth());
2518 }
2519 }
2520 }
2521
2523 {
2524 return 111;
2525 }
2526
2528 {
2529 super.SetActions();
2530
2534 }
2535
2537 {
2539 if (!construction)
2540 return;
2541
2543 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2544 {
2547 {
2549 }
2550 }
2551 }
2552
2554 {
2556 if (!construction)
2557 return;
2558
2560 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2561 {
2564 {
2565 construction.HandleEntityFalling(part.
GetPartName());
2566 }
2567 }
2568 }
2569
2572 {
2574 return;
2575
2578
2579 if (DestroyOnFall())
2580 {
2582 {
2584 }
2585 else
2586 {
2588 {
2590 }
2592 }
2593 }
2594 }
2595
2597 {
2598 if (HasAnyAttachmentsOrCargo())
2599 {
2602 }
2603 }
2604
2605
2606
2607
2608
2611 {
2612 return null;
2613 }
2614
2616 {
2618 }
2619
2621 {
2624
2625 Man p;
2626
2627 #ifdef SERVER
2629 g_Game.GetWorld().GetPlayerList(players);
2630 if (players.Count())
2631 p = players[0];
2632 #else
2634 #endif
2635
2637 {
2638 bool excluded = false;
2640 if (excludes)
2641 {
2642 foreach (string exclude : excludes)
2643 {
2645 {
2646 excluded = true;
2647 break;
2648 }
2649 }
2650 }
2651
2652 if (!excluded)
2653 {
2655 }
2656 }
2657
2659 }
2660
2662
2664 [
Obsolete(
"handled in the Construction component directly")]
2666 {
2667 }
2668
2669 [
Obsolete(
"handled in the Construction component directly")]
2671 {
2672 }
2673
2674 [
Obsolete(
"obsolete debug method")]
2676 {
2677 }
2678}
2679
2681{
2682#ifdef BSB_DEBUG
2684#else
2685
2686#endif
2687}
2689{
2690#ifdef BSB_DEBUG_SPAM
2692#else
2693
2694#endif
2695}
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.