1456{
1458
1460
1462
1469
1470
1471
1477
1483
1485
1489
1490
1492 {
1494
1495
1496 RegisterNetSyncVariableInt( "m_SyncParts01" );
1497 RegisterNetSyncVariableInt( "m_SyncParts02" );
1498 RegisterNetSyncVariableInt( "m_SyncParts03" );
1499 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1500 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1501 RegisterNetSyncVariableBool( "m_HasBase" );
1502
1503
1504 ConstructionInit();
1505
1506 if (ConfigIsExisting("hybridAttachments"))
1507 {
1510 }
1511 if (ConfigIsExisting("mountables"))
1512 {
1515 }
1516
1518 SetAllowDamage(true);
1519 }
1520
1522 {
1523 return "disableBaseDamage";
1524 }
1525
1527 {
1528 return true;
1529 }
1530
1532 {
1533 return EInventoryIconVisibility.HIDE_VICINITY;
1534 }
1535
1537 {
1538 super.InitItemSounds();
1539
1543
1548 }
1549
1551 {
1552 return "putDown_FenceKit_SoundSet";
1553 }
1554
1556 {
1557 return "Shelter_Site_Build_Loop_SoundSet";
1558 }
1559
1560
1562 {
1564 {
1565 SetSynchDirty();
1566 }
1567 }
1568
1570 {
1572 super.OnVariablesSynchronized();
1573
1575 }
1576
1578 {
1579
1581
1582
1584
1585
1587 }
1588
1589
1591 {
1592
1593 int offset;
1594 int mask;
1595
1596 if ( part_id >= 1 && part_id <= 31 )
1597 {
1598 offset = part_id - 1;
1599 mask = 1 << offset;
1600
1602 }
1603 else if ( part_id >= 32 && part_id <= 62 )
1604 {
1605 offset = ( part_id % 32 );
1606 mask = 1 << offset;
1607
1609 }
1610 else if ( part_id >= 63 && part_id <= 93 )
1611 {
1612 offset = ( part_id % 63 );
1613 mask = 1 << offset;
1614
1616 }
1617 }
1618
1620 {
1621
1622 int offset;
1623 int mask;
1624
1625 if ( part_id >= 1 && part_id <= 31 )
1626 {
1627 offset = part_id - 1;
1628 mask = 1 << offset;
1629
1631 }
1632 else if ( part_id >= 32 && part_id <= 62 )
1633 {
1634 offset = ( part_id % 32 );
1635 mask = 1 << offset;
1636
1638 }
1639 else if ( part_id >= 63 && part_id <= 93 )
1640 {
1641 offset = ( part_id % 63 );
1642 mask = 1 << offset;
1643
1645 }
1646 }
1647
1649 {
1650
1651 int offset;
1652 int mask;
1653
1654 if ( part_id >= 1 && part_id <= 31 )
1655 {
1656 offset = part_id - 1;
1657 mask = 1 << offset;
1658
1660 {
1661 return true;
1662 }
1663 }
1664 else if ( part_id >= 32 && part_id <= 62 )
1665 {
1666 offset = ( part_id % 32 );
1667 mask = 1 << offset;
1668
1670 {
1671 return true;
1672 }
1673 }
1674 else if ( part_id >= 63 && part_id <= 93 )
1675 {
1676 offset = ( part_id % 63 );
1677 mask = 1 << offset;
1678
1680 {
1681 return true;
1682 }
1683 }
1684
1685 return false;
1686 }
1687
1689 {
1692 }
1693
1695 {
1696
1699 }
1700
1702 {
1704 {
1707
1708 switch( build_action_id )
1709 {
1713 }
1714 }
1715 }
1716
1717
1719 {
1721 bool is_base = part.
IsBase();
1724 if ( is_part_built_sync )
1725 {
1727 {
1731
1732 if (is_base)
1733 {
1736 }
1737 }
1738 }
1739 else
1740 {
1742 {
1746
1747 if (is_base)
1748 {
1751 }
1752 }
1753 }
1754
1755
1757 }
1758
1759
1761 {
1764
1765 for ( int i = 0; i < construction_parts.Count(); ++i )
1766 {
1767 string key = construction_parts.GetKey( i );
1770 }
1771
1772
1774 }
1775
1777 {
1780
1781 for ( int i = 0; i < construction_parts.Count(); ++i )
1782 {
1783 string key = construction_parts.GetKey( i );
1785
1786 if ( value.
GetId() ==
id )
1787 {
1788 return value;
1789 }
1790 }
1791
1792 return NULL;
1793 }
1794
1795
1796
1798 {
1800 }
1801
1803 {
1805 }
1806
1808 {
1809 return true;
1810 }
1811
1813 {
1814 return false;
1815 }
1816
1817
1819 {
1822 {
1824 }
1825
1826 return construction_kit;
1827 }
1828
1830 {
1833 {
1835 }
1836 }
1837
1839 {
1841 }
1842
1844 {
1845 return "";
1846 }
1847
1849 {
1851 g_Game.ObjectDelete( construction_kit );
1852 }
1853
1854
1856 {
1858 g_Game.ObjectDelete(
this );
1859 }
1860
1861
1863 {
1864 super.EEDelete(parent);
1865
1867 {
1868 areaDamage.Destroy();
1869 }
1870
1871 }
1872
1874 {
1875 super.OnStoreSave( ctx );
1876
1877
1881
1883 }
1884
1886 {
1887 if ( !super.OnStoreLoad( ctx, version ) )
1888 return false;
1889
1890
1891
1893 {
1895 return false;
1896 }
1898 {
1900 return false;
1901 }
1903 {
1905 return false;
1906 }
1907
1908
1910 {
1912 return false;
1913 }
1914
1915
1916 return true;
1917 }
1918
1920 {
1921 super.AfterStoreLoad();
1922
1924 {
1926 }
1927 }
1928
1930 {
1931
1933
1934
1937
1938
1940 }
1941
1943 {
1944 super.OnCreatePhysics();
1945
1946 ConstructionInit();
1948 }
1949
1951 {
1953 return;
1954
1955 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1956 }
1957
1959 {
1961 {
1963 }
1964
1965 super.EEOnAfterLoad();
1966 }
1967
1969 {
1970 super.EEItemAttached( item, slot_name );
1971
1975 }
1976
1978 {
1979 super.EEItemDetached( item, slot_name );
1980
1983 }
1984
1985 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
1986 {
1989
1992 }
1993
1994
1996 {
1997 return true;
1998 }
1999
2000
2001
2003 {
2005
2006
2007 if (construtionPart.
IsBase())
2008 {
2010
2011
2013 }
2014
2015
2017
2018
2020
2021
2023
2025
2027
2028
2030
2031
2033 }
2034
2036 {
2037
2039 }
2040
2041
2043 {
2046
2047
2049
2050
2052
2053
2055
2056
2058
2060
2061
2063
2064
2066
2067
2068 if (construtionPart.
IsBase())
2069 {
2070
2072 }
2073 }
2074
2076 {
2077
2079 }
2080
2081
2082 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2083 {
2086
2087
2089
2090
2092
2093
2095
2096
2098
2100
2101
2103
2104
2106
2107
2108 if (construtionPart.
IsBase())
2109 {
2110
2112 }
2113 }
2114
2116 {
2117
2119 }
2120
2121
2123 {
2125
2128 }
2129
2131 {
2133
2135 {
2137 }
2138 else
2139 {
2141 }
2142
2144 }
2145
2147 {
2149
2151 foreach (
string slotName : attachmentSlots)
2152 {
2154 }
2155
2156
2159 else
2161
2163 }
2164
2166 {
2167 string slotNameMounted = slot_name + "_Mounted";
2168 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2169
2170 if (attachment)
2171 {
2172 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2173 if (barbedWire && barbedWire.IsMounted())
2175 else
2177
2178 if (is_locked)
2179 {
2180 SetAnimationPhase(slotNameMounted, 0);
2181 SetAnimationPhase(slot_name, 1);
2182 }
2183 else
2184 {
2185 SetAnimationPhase(slotNameMounted, 1);
2186 SetAnimationPhase(slot_name, 0);
2187 }
2188 }
2189 else
2190 {
2191 SetAnimationPhase(slotNameMounted, 1);
2192 SetAnimationPhase(slot_name, 1);
2193
2195 }
2196 }
2197
2198
2200 {
2203
2206
2209
2210 foreach (
string slotName : attachmentSlots)
2211 {
2213 }
2214
2215
2217 {
2220
2222 }
2223 else
2224 {
2227
2229 }
2230
2233 }
2234
2236 {
2237
2239 return;
2240
2241 string slot_name_mounted = slot_name + "_Mounted";
2242 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2243
2244
2246 RemoveProxyPhysics( slot_name_mounted );
2247 RemoveProxyPhysics( slot_name );
2248
2249 if ( attachment )
2250 {
2252 if ( is_locked )
2253 {
2255 AddProxyPhysics( slot_name_mounted );
2256 }
2257 else
2258 {
2260 AddProxyPhysics( slot_name );
2261 }
2262 }
2263 }
2264
2266 {
2267 SetAffectPathgraph( true, false );
2269 }
2270
2272 {
2273 return true;
2274 }
2275
2277 {
2278 return true;
2279 }
2280
2282 {
2283 if ( attachment )
2284 {
2286 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2287
2288 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2289 }
2290
2291 return false;
2292 }
2293
2295 {
2297 }
2298
2299
2301 {
2302 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2303 if (
g_Game.ConfigIsExisting( config_path ) )
2304 {
2305 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2306 }
2307 }
2308
2310 {
2311 return true;
2312 }
2313
2315 {
2316 return true;
2317 }
2318
2320 {
2321 return true;
2322 }
2323
2324
2326 {
2329 }
2330
2332 {
2334 }
2335
2337 {
2339 }
2340
2342 {
2343 int attachment_count = GetInventory().AttachmentCount();
2344 if ( attachment_count > 0 )
2345 {
2346 if (
HasBase() && attachment_count == 1 )
2347 {
2348 return false;
2349 }
2350
2351 return true;
2352 }
2353
2354 return false;
2355 }
2356
2358 {
2359 return true;
2360 }
2361
2363 {
2364 return false;
2365 }
2366
2367
2369 {
2370 return false;
2371 }
2372
2374 {
2375 return false;
2376 }
2377
2378
2380 {
2381 return false;
2382 }
2383
2384
2385
2387 {
2388 return true;
2389 }
2390
2392 {
2393 return true;
2394 }
2395
2398 {
2399 return false;
2400 }
2401
2402
2404 {
2405 return false;
2406 }
2407
2408
2410 {
2411 return true;
2412 }
2413
2414
2416 {
2417 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2418 {
2419 return false;
2420 }
2421
2422 return true;
2423 }
2424
2426 {
2429
2430 return item;
2431 }
2432
2433
2435 {
2437 {
2438
2440
2441
2444
2446 if ( MemoryPointExists( slot_name + "_min" ) )
2447 {
2448 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2449 }
2450 if ( MemoryPointExists( slot_name + "_max" ) )
2451 {
2452 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2453 }
2454
2455
2458
2459
2462 center = ModelToWorld( center );
2463
2464
2467
2468 areaDamage.SetExtents( extents[0], extents[1] );
2469 areaDamage.SetAreaPosition( center );
2473 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2474 areaDamage.SetAmmoName( "BarbedWireHit" );
2475 areaDamage.Spawn();
2476
2478 }
2479 }
2480
2482 {
2483 if ( angle_deg != 0 )
2484 {
2485
2487
2488
2490 if ( MemoryPointExists( "rotate_axis" ) )
2491 {
2492 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2493 }
2494 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];
2495 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];
2496 center[0] = r_center_x;
2497 center[2] = r_center_z;
2498 }
2499 }
2500
2502 {
2504 {
2507 {
2508 if (areaDamage)
2509 {
2510 areaDamage.Destroy();
2511 }
2512
2514 }
2515 }
2516 }
2517
2519 {
2520 return true;
2521 }
2522
2523
2524
2525
2527 {
2529 }
2530
2532 {
2534 }
2535
2537 {
2539 }
2540
2542 {
2544
2545 switch ( material_type )
2546 {
2552 }
2553
2554 return "";
2555 }
2556
2558 {
2560
2561 switch ( material_type )
2562 {
2568 }
2569
2570 return "";
2571 }
2572
2573
2575 {
2577 {
2578
2580 {
2581 SetHealth(slot_name,"Health",item.GetHealth());
2582 }
2583 }
2584 }
2585
2587 {
2588 return 111;
2589 }
2590
2592 {
2593 super.SetActions();
2594
2598 }
2599
2601 {
2603 if (!construction)
2604 return;
2605
2607 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2608 {
2611 {
2613 }
2614 }
2615 }
2616
2618 {
2620 if (!construction)
2621 return;
2622
2624 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2625 {
2628 {
2629 construction.HandleEntityFalling(part.
GetPartName());
2630 }
2631 }
2632 }
2633
2636 {
2638 return;
2639
2642
2643 if (DestroyOnFall())
2644 {
2646 {
2648 }
2649 else
2650 {
2652 {
2654 }
2656 }
2657 }
2658 }
2659
2661 {
2662 if (HasAnyAttachmentsOrCargo())
2663 {
2666 }
2667 }
2668
2669
2670
2671
2672
2675 {
2676 return null;
2677 }
2678
2680 {
2682 }
2683
2685 {
2688
2689 Man p;
2690
2691 #ifdef SERVER
2693 g_Game.GetWorld().GetPlayerList(players);
2694 if (players.Count())
2695 p = players[0];
2696 #else
2698 #endif
2699
2701 {
2702 bool excluded = false;
2704 if (excludes)
2705 {
2706 foreach (string exclude : excludes)
2707 {
2709 {
2710 excluded = true;
2711 break;
2712 }
2713 }
2714 }
2715
2716 if (!excluded)
2717 {
2719 }
2720 }
2721
2723 }
2724
2726
2728 [
Obsolete(
"handled in the Construction component directly")]
2730 {
2731 }
2732
2733 [
Obsolete(
"handled in the Construction component directly")]
2735 {
2736 }
2737
2738 [
Obsolete(
"obsolete debug method")]
2740 {
2741 }
2742}
2743
2745{
2746#ifdef BSB_DEBUG
2748#else
2749
2750#endif
2751}
2753{
2754#ifdef BSB_DEBUG_SPAM
2756#else
2757
2758#endif
2759}
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.