1485{
1487
1489
1491
1498
1499
1500
1506
1512
1514
1518
1519
1521 {
1523
1524
1525 RegisterNetSyncVariableInt( "m_SyncParts01" );
1526 RegisterNetSyncVariableInt( "m_SyncParts02" );
1527 RegisterNetSyncVariableInt( "m_SyncParts03" );
1528 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1529 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1530 RegisterNetSyncVariableBool( "m_HasBase" );
1531
1532
1533 ConstructionInit();
1534
1535 if (ConfigIsExisting("hybridAttachments"))
1536 {
1539 }
1540 if (ConfigIsExisting("mountables"))
1541 {
1544 }
1545
1547 SetAllowDamage(true);
1548 }
1549
1551 {
1552 return "disableBaseDamage";
1553 }
1554
1556 {
1557 return true;
1558 }
1559
1561 {
1562 return EInventoryIconVisibility.HIDE_VICINITY;
1563 }
1564
1566 {
1567 super.InitItemSounds();
1568
1572
1577 }
1578
1580 {
1581 return "putDown_FenceKit_SoundSet";
1582 }
1583
1585 {
1586 return "Shelter_Site_Build_Loop_SoundSet";
1587 }
1588
1589
1591 {
1593 {
1594 SetSynchDirty();
1595 }
1596 }
1597
1599 {
1601 super.OnVariablesSynchronized();
1602
1604 }
1605
1607 {
1608
1610
1611
1613
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 else if ( part_id >= 32 && part_id <= 62 )
1662 {
1663 offset = ( part_id % 32 );
1664 mask = 1 << offset;
1665
1667 }
1668 else if ( part_id >= 63 && part_id <= 93 )
1669 {
1670 offset = ( part_id % 63 );
1671 mask = 1 << offset;
1672
1674 }
1675 }
1676
1678 {
1679
1680 int offset;
1681 int mask;
1682
1683 if ( part_id >= 1 && part_id <= 31 )
1684 {
1685 offset = part_id - 1;
1686 mask = 1 << offset;
1687
1689 {
1690 return true;
1691 }
1692 }
1693 else if ( part_id >= 32 && part_id <= 62 )
1694 {
1695 offset = ( part_id % 32 );
1696 mask = 1 << offset;
1697
1699 {
1700 return true;
1701 }
1702 }
1703 else if ( part_id >= 63 && part_id <= 93 )
1704 {
1705 offset = ( part_id % 63 );
1706 mask = 1 << offset;
1707
1709 {
1710 return true;
1711 }
1712 }
1713
1714 return false;
1715 }
1716
1718 {
1721 }
1722
1724 {
1725
1728 }
1729
1731 {
1733 {
1736
1737 switch( build_action_id )
1738 {
1742 }
1743 }
1744 }
1745
1746
1748 {
1750 bool is_base = part.
IsBase();
1753 if ( is_part_built_sync )
1754 {
1756 {
1760
1761 if (is_base)
1762 {
1765 }
1766 }
1767 }
1768 else
1769 {
1771 {
1775
1776 if (is_base)
1777 {
1780 }
1781 }
1782 }
1783
1784
1786 }
1787
1788
1790 {
1793
1794 for ( int i = 0; i < construction_parts.Count(); ++i )
1795 {
1796 string key = construction_parts.GetKey( i );
1799 }
1800
1801
1803 }
1804
1806 {
1809
1810 for ( int i = 0; i < construction_parts.Count(); ++i )
1811 {
1812 string key = construction_parts.GetKey( i );
1814
1815 if ( value.
GetId() ==
id )
1816 {
1817 return value;
1818 }
1819 }
1820
1821 return NULL;
1822 }
1823
1824
1825
1827 {
1829 }
1830
1832 {
1834 }
1835
1837 {
1838 return true;
1839 }
1840
1842 {
1843 return false;
1844 }
1845
1846
1848 {
1851 {
1853 }
1854
1855 return construction_kit;
1856 }
1857
1859 {
1862 {
1864 }
1865 }
1866
1868 {
1870 }
1871
1873 {
1874 return "";
1875 }
1876
1878 {
1880 g_Game.ObjectDelete( construction_kit );
1881 }
1882
1883
1885 {
1887 g_Game.ObjectDelete(
this );
1888 }
1889
1890
1892 {
1893 super.EEDelete(parent);
1894
1896 {
1897 areaDamage.Destroy();
1898 }
1899
1900 }
1901
1903 {
1904 super.OnStoreSave( ctx );
1905
1906
1910
1912 }
1913
1915 {
1916 if ( !super.OnStoreLoad( ctx, version ) )
1917 return false;
1918
1919
1920
1922 {
1924 return false;
1925 }
1927 {
1929 return false;
1930 }
1932 {
1934 return false;
1935 }
1936
1937
1939 {
1941 return false;
1942 }
1943
1944
1945 return true;
1946 }
1947
1949 {
1950 super.AfterStoreLoad();
1951
1953 {
1955 }
1956 }
1957
1959 {
1960
1962
1963
1966
1967
1969 }
1970
1972 {
1973 super.OnCreatePhysics();
1974
1975 ConstructionInit();
1977 }
1978
1980 {
1982 return;
1983
1984 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
1985 }
1986
1988 {
1990 {
1992 }
1993
1994 super.EEOnAfterLoad();
1995 }
1996
1998 {
1999 super.EEItemAttached( item, slot_name );
2000
2004 }
2005
2007 {
2008 super.EEItemDetached( item, slot_name );
2009
2012 }
2013
2014 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2015 {
2018
2021 }
2022
2023
2025 {
2026 return true;
2027 }
2028
2029
2030
2032 {
2034
2035
2036 if (construtionPart.
IsBase())
2037 {
2039
2040
2042 }
2043
2044
2046
2047
2049
2050
2052
2054
2056
2057
2059
2060
2062 }
2063
2065 {
2066
2068 }
2069
2070
2072 {
2075
2076
2078
2079
2081
2082
2084
2085
2087
2089
2090
2092
2093
2095
2096
2097 if (construtionPart.
IsBase())
2098 {
2099
2101 }
2102 }
2103
2105 {
2106
2108 }
2109
2110
2111 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2112 {
2115
2116
2118
2119
2121
2122
2124
2125
2127
2129
2130
2132
2133
2135
2136
2137 if (construtionPart.
IsBase())
2138 {
2139
2141 }
2142 }
2143
2145 {
2146
2148 }
2149
2150
2152 {
2154
2157 }
2158
2160 {
2162
2164 {
2166 }
2167 else
2168 {
2170 }
2171
2173 }
2174
2176 {
2178
2180 foreach (
string slotName : attachmentSlots)
2181 {
2183 }
2184
2185
2188 else
2190
2192 }
2193
2195 {
2196 string slotNameMounted = slot_name + "_Mounted";
2197 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2198
2199 if (attachment)
2200 {
2201 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2202 if (barbedWire && barbedWire.IsMounted())
2204 else
2206
2207 if (is_locked)
2208 {
2209 SetAnimationPhase(slotNameMounted, 0);
2210 SetAnimationPhase(slot_name, 1);
2211 }
2212 else
2213 {
2214 SetAnimationPhase(slotNameMounted, 1);
2215 SetAnimationPhase(slot_name, 0);
2216 }
2217 }
2218 else
2219 {
2220 SetAnimationPhase(slotNameMounted, 1);
2221 SetAnimationPhase(slot_name, 1);
2222
2224 }
2225 }
2226
2227
2229 {
2232
2235
2238
2239 foreach (
string slotName : attachmentSlots)
2240 {
2242 }
2243
2244
2246 {
2249
2251 }
2252 else
2253 {
2256
2258 }
2259
2262 }
2263
2265 {
2266
2268 return;
2269
2270 string slot_name_mounted = slot_name + "_Mounted";
2271 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2272
2273
2275 RemoveProxyPhysics( slot_name_mounted );
2276 RemoveProxyPhysics( slot_name );
2277
2278 if ( attachment )
2279 {
2281 if ( is_locked )
2282 {
2284 AddProxyPhysics( slot_name_mounted );
2285 }
2286 else
2287 {
2289 AddProxyPhysics( slot_name );
2290 }
2291 }
2292 }
2293
2295 {
2296 SetAffectPathgraph( true, false );
2298 }
2299
2301 {
2302 return true;
2303 }
2304
2306 {
2307 return true;
2308 }
2309
2311 {
2312 if ( attachment )
2313 {
2315 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2316
2317 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2318 }
2319
2320 return false;
2321 }
2322
2324 {
2326 }
2327
2328
2330 {
2331 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2332 if (
g_Game.ConfigIsExisting( config_path ) )
2333 {
2334 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2335 }
2336 }
2337
2339 {
2340 return true;
2341 }
2342
2344 {
2345 return true;
2346 }
2347
2349 {
2350 return true;
2351 }
2352
2353
2355 {
2358 }
2359
2361 {
2363 }
2364
2366 {
2368 }
2369
2371 {
2372 int attachment_count = GetInventory().AttachmentCount();
2373 if ( attachment_count > 0 )
2374 {
2375 if (
HasBase() && attachment_count == 1 )
2376 {
2377 return false;
2378 }
2379
2380 return true;
2381 }
2382
2383 return false;
2384 }
2385
2387 {
2388 return true;
2389 }
2390
2392 {
2393 return false;
2394 }
2395
2396
2398 {
2399 return false;
2400 }
2401
2403 {
2404 return false;
2405 }
2406
2407
2409 {
2410 return false;
2411 }
2412
2413
2414
2416 {
2417 return true;
2418 }
2419
2421 {
2422 return true;
2423 }
2424
2427 {
2428 return false;
2429 }
2430
2431
2433 {
2434 return false;
2435 }
2436
2437
2439 {
2440 return true;
2441 }
2442
2443
2445 {
2446 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2447 {
2448 return false;
2449 }
2450
2451 return true;
2452 }
2453
2455 {
2458
2459 return item;
2460 }
2461
2462
2464 {
2466 {
2467
2469
2470
2473
2475 if ( MemoryPointExists( slot_name + "_min" ) )
2476 {
2477 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2478 }
2479 if ( MemoryPointExists( slot_name + "_max" ) )
2480 {
2481 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2482 }
2483
2484
2487
2488
2491 center = ModelToWorld( center );
2492
2493
2496
2497 areaDamage.SetExtents( extents[0], extents[1] );
2498 areaDamage.SetAreaPosition( center );
2502 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2503 areaDamage.SetAmmoName( "BarbedWireHit" );
2504 areaDamage.Spawn();
2505
2507 }
2508 }
2509
2511 {
2512 if ( angle_deg != 0 )
2513 {
2514
2516
2517
2519 if ( MemoryPointExists( "rotate_axis" ) )
2520 {
2521 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2522 }
2523 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];
2524 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];
2525 center[0] = r_center_x;
2526 center[2] = r_center_z;
2527 }
2528 }
2529
2531 {
2533 {
2536 {
2537 if (areaDamage)
2538 {
2539 areaDamage.Destroy();
2540 }
2541
2543 }
2544 }
2545 }
2546
2548 {
2549 return true;
2550 }
2551
2552
2553
2554
2556 {
2558 }
2559
2561 {
2563 }
2564
2566 {
2568 }
2569
2571 {
2573
2574 switch ( material_type )
2575 {
2581 }
2582
2583 return "";
2584 }
2585
2587 {
2589
2590 switch ( material_type )
2591 {
2597 }
2598
2599 return "";
2600 }
2601
2602
2604 {
2606 {
2607
2609 {
2610 SetHealth(slot_name,"Health",item.GetHealth());
2611 }
2612 }
2613 }
2614
2616 {
2617 return 111;
2618 }
2619
2621 {
2622 super.SetActions();
2623
2627 }
2628
2630 {
2632 if (!construction)
2633 return;
2634
2636 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2637 {
2640 {
2642 }
2643 }
2644 }
2645
2647 {
2649 if (!construction)
2650 return;
2651
2653 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2654 {
2657 {
2658 construction.HandleEntityFalling(part.
GetPartName());
2659 }
2660 }
2661 }
2662
2665 {
2667 return;
2668
2671
2672 if (DestroyOnFall())
2673 {
2675 {
2677 }
2678 else
2679 {
2681 {
2683 }
2685 }
2686 }
2687 }
2688
2690 {
2691 if (HasAnyAttachmentsOrCargo())
2692 {
2695 }
2696 }
2697
2698
2699
2700
2701
2704 {
2705 return null;
2706 }
2707
2709 {
2711 }
2712
2714 {
2717
2718 Man p;
2719
2720 #ifdef SERVER
2722 g_Game.GetWorld().GetPlayerList(players);
2723 if (players.Count())
2724 p = players[0];
2725 #else
2727 #endif
2728
2730 {
2731 bool excluded = false;
2733 if (excludes)
2734 {
2735 foreach (string exclude : excludes)
2736 {
2738 {
2739 excluded = true;
2740 break;
2741 }
2742 }
2743 }
2744
2745 if (!excluded)
2746 {
2748 }
2749 }
2750
2752 }
2753
2755
2757 [
Obsolete(
"handled in the Construction component directly")]
2759 {
2760 }
2761
2762 [
Obsolete(
"handled in the Construction component directly")]
2764 {
2765 }
2766
2767 [
Obsolete(
"obsolete debug method")]
2769 {
2770 }
2771}
2772
2774{
2775#ifdef BSB_DEBUG
2777#else
2778
2779#endif
2780}
2782{
2783#ifdef BSB_DEBUG_SPAM
2785#else
2786
2787#endif
2788}
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.