1525{
1527
1529
1531
1538
1539
1540
1546
1552
1554
1558
1559
1561 {
1563
1564
1565 RegisterNetSyncVariableInt( "m_SyncParts01" );
1566 RegisterNetSyncVariableInt( "m_SyncParts02" );
1567 RegisterNetSyncVariableInt( "m_SyncParts03" );
1568 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1569 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1570 RegisterNetSyncVariableBool( "m_HasBase" );
1571
1572
1573 ConstructionInit();
1574
1575 if (ConfigIsExisting("hybridAttachments"))
1576 {
1579 }
1580 if (ConfigIsExisting("mountables"))
1581 {
1584 }
1585
1587 SetAllowDamage(true);
1588 }
1589
1591 {
1592 return "disableBaseDamage";
1593 }
1594
1596 {
1597 return true;
1598 }
1599
1601 {
1602 return EInventoryIconVisibility.HIDE_VICINITY;
1603 }
1604
1606 {
1607 super.InitItemSounds();
1608
1612
1617 }
1618
1620 {
1621 return "putDown_FenceKit_SoundSet";
1622 }
1623
1625 {
1626 return "Shelter_Site_Build_Loop_SoundSet";
1627 }
1628
1629
1631 {
1633 {
1634 SetSynchDirty();
1635 }
1636 }
1637
1639 {
1641 super.OnVariablesSynchronized();
1642
1644 }
1645
1647 {
1648
1650
1651
1653
1654
1656 }
1657
1658
1660 {
1661
1662 int offset;
1663 int mask;
1664
1665 if ( part_id >= 1 && part_id <= 31 )
1666 {
1667 offset = part_id - 1;
1668 mask = 1 << offset;
1669
1671 }
1672 else if ( part_id >= 32 && part_id <= 62 )
1673 {
1674 offset = ( part_id % 32 );
1675 mask = 1 << offset;
1676
1678 }
1679 else if ( part_id >= 63 && part_id <= 93 )
1680 {
1681 offset = ( part_id % 63 );
1682 mask = 1 << offset;
1683
1685 }
1686 }
1687
1689 {
1690
1691 int offset;
1692 int mask;
1693
1694 if ( part_id >= 1 && part_id <= 31 )
1695 {
1696 offset = part_id - 1;
1697 mask = 1 << offset;
1698
1700 }
1701 else if ( part_id >= 32 && part_id <= 62 )
1702 {
1703 offset = ( part_id % 32 );
1704 mask = 1 << offset;
1705
1707 }
1708 else if ( part_id >= 63 && part_id <= 93 )
1709 {
1710 offset = ( part_id % 63 );
1711 mask = 1 << offset;
1712
1714 }
1715 }
1716
1718 {
1719
1720 int offset;
1721 int mask;
1722
1723 if ( part_id >= 1 && part_id <= 31 )
1724 {
1725 offset = part_id - 1;
1726 mask = 1 << offset;
1727
1729 {
1730 return true;
1731 }
1732 }
1733 else if ( part_id >= 32 && part_id <= 62 )
1734 {
1735 offset = ( part_id % 32 );
1736 mask = 1 << offset;
1737
1739 {
1740 return true;
1741 }
1742 }
1743 else if ( part_id >= 63 && part_id <= 93 )
1744 {
1745 offset = ( part_id % 63 );
1746 mask = 1 << offset;
1747
1749 {
1750 return true;
1751 }
1752 }
1753
1754 return false;
1755 }
1756
1758 {
1761 }
1762
1764 {
1765
1768 }
1769
1771 {
1773 {
1776
1777 switch( build_action_id )
1778 {
1782 }
1783 }
1784 }
1785
1786
1788 {
1790 bool is_base = part.
IsBase();
1793 if ( is_part_built_sync )
1794 {
1796 {
1800
1801 if (is_base)
1802 {
1805 }
1806 }
1807 }
1808 else
1809 {
1811 {
1815
1816 if (is_base)
1817 {
1820 }
1821 }
1822 }
1823
1824
1826 }
1827
1828
1830 {
1833
1834 for ( int i = 0; i < construction_parts.Count(); ++i )
1835 {
1836 string key = construction_parts.GetKey( i );
1839 }
1840
1841
1843 }
1844
1846 {
1849
1850 for ( int i = 0; i < construction_parts.Count(); ++i )
1851 {
1852 string key = construction_parts.GetKey( i );
1854
1855 if ( value.
GetId() ==
id )
1856 {
1857 return value;
1858 }
1859 }
1860
1861 return NULL;
1862 }
1863
1864
1865
1867 {
1869 }
1870
1872 {
1874 }
1875
1877 {
1878 return true;
1879 }
1880
1882 {
1883 return false;
1884 }
1885
1886
1888 {
1891 {
1893 }
1894
1895 return construction_kit;
1896 }
1897
1899 {
1902 {
1904 }
1905 }
1906
1908 {
1910 }
1911
1913 {
1914 return "";
1915 }
1916
1918 {
1920 g_Game.ObjectDelete( construction_kit );
1921 }
1922
1923
1925 {
1927 g_Game.ObjectDelete(
this );
1928 }
1929
1930
1932 {
1933 super.EEDelete(parent);
1934
1936 {
1937 areaDamage.Destroy();
1938 }
1939
1940 }
1941
1943 {
1944 super.OnStoreSave( ctx );
1945
1946
1950
1952 }
1953
1955 {
1956 if ( !super.OnStoreLoad( ctx, version ) )
1957 return false;
1958
1959
1960
1962 {
1964 return false;
1965 }
1967 {
1969 return false;
1970 }
1972 {
1974 return false;
1975 }
1976
1977
1979 {
1981 return false;
1982 }
1983
1984
1985 return true;
1986 }
1987
1989 {
1990 super.AfterStoreLoad();
1991
1993 {
1995 }
1996 }
1997
1999 {
2000
2002
2003
2006
2007
2009 }
2010
2012 {
2013 super.OnCreatePhysics();
2014
2015 ConstructionInit();
2017 }
2018
2020 {
2022 return;
2023
2024 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2025 }
2026
2028 {
2030 {
2032 }
2033
2034 super.EEOnAfterLoad();
2035 }
2036
2038 {
2039 super.EEItemAttached( item, slot_name );
2040
2044 }
2045
2047 {
2048 super.EEItemDetached( item, slot_name );
2049
2052 }
2053
2054 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2055 {
2058
2061 }
2062
2063
2065 {
2066 return true;
2067 }
2068
2069
2070
2072 {
2074
2075
2076 if (construtionPart.
IsBase())
2077 {
2079
2080
2082 }
2083
2084
2086
2087
2089
2090
2092
2094
2096
2097
2099
2100
2102 }
2103
2105 {
2106
2108 }
2109
2110
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
2151 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2152 {
2155
2156
2158
2159
2161
2162
2164
2165
2167
2169
2170
2172
2173
2175
2176
2177 if (construtionPart.
IsBase())
2178 {
2179
2181 }
2182 }
2183
2185 {
2186
2188 }
2189
2190
2192 {
2194
2197 }
2198
2200 {
2202
2204 {
2206 }
2207 else
2208 {
2210 }
2211
2213 }
2214
2216 {
2218
2220 foreach (
string slotName : attachmentSlots)
2221 {
2223 }
2224
2225
2228 else
2230
2232 }
2233
2235 {
2236 string slotNameMounted = slot_name + "_Mounted";
2237 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2238
2239 if (attachment)
2240 {
2241 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2242 if (barbedWire && barbedWire.IsMounted())
2244 else
2246
2247 if (is_locked)
2248 {
2249 SetAnimationPhase(slotNameMounted, 0);
2250 SetAnimationPhase(slot_name, 1);
2251 }
2252 else
2253 {
2254 SetAnimationPhase(slotNameMounted, 1);
2255 SetAnimationPhase(slot_name, 0);
2256 }
2257 }
2258 else
2259 {
2260 SetAnimationPhase(slotNameMounted, 1);
2261 SetAnimationPhase(slot_name, 1);
2262
2264 }
2265 }
2266
2267
2269 {
2272
2275
2278
2279 foreach (
string slotName : attachmentSlots)
2280 {
2282 }
2283
2284
2286 {
2289
2291 }
2292 else
2293 {
2296
2298 }
2299
2302 }
2303
2305 {
2306
2308 return;
2309
2310 string slot_name_mounted = slot_name + "_Mounted";
2311 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2312
2313
2315 RemoveProxyPhysics( slot_name_mounted );
2316 RemoveProxyPhysics( slot_name );
2317
2318 if ( attachment )
2319 {
2321 if ( is_locked )
2322 {
2324 AddProxyPhysics( slot_name_mounted );
2325 }
2326 else
2327 {
2329 AddProxyPhysics( slot_name );
2330 }
2331 }
2332 }
2333
2335 {
2336 SetAffectPathgraph( true, false );
2338 }
2339
2341 {
2342 return true;
2343 }
2344
2346 {
2347 return true;
2348 }
2349
2351 {
2352 if ( attachment )
2353 {
2355 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2356
2357 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2358 }
2359
2360 return false;
2361 }
2362
2364 {
2366 }
2367
2368
2370 {
2371 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2372 if (
g_Game.ConfigIsExisting( config_path ) )
2373 {
2374 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2375 }
2376 }
2377
2379 {
2380 return true;
2381 }
2382
2384 {
2385 return true;
2386 }
2387
2389 {
2390 return true;
2391 }
2392
2393
2395 {
2398 }
2399
2401 {
2403 }
2404
2406 {
2408 }
2409
2411 {
2412 int attachment_count = GetInventory().AttachmentCount();
2413 if ( attachment_count > 0 )
2414 {
2415 if (
HasBase() && attachment_count == 1 )
2416 {
2417 return false;
2418 }
2419
2420 return true;
2421 }
2422
2423 return false;
2424 }
2425
2427 {
2428 return true;
2429 }
2430
2432 {
2433 return false;
2434 }
2435
2436
2438 {
2439 return false;
2440 }
2441
2443 {
2444 return false;
2445 }
2446
2447
2449 {
2450 return false;
2451 }
2452
2453
2454
2456 {
2457 return true;
2458 }
2459
2461 {
2462 return true;
2463 }
2464
2467 {
2468 return false;
2469 }
2470
2471
2473 {
2474 return false;
2475 }
2476
2477
2479 {
2480 return true;
2481 }
2482
2483
2485 {
2486 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2487 {
2488 return false;
2489 }
2490
2491 return true;
2492 }
2493
2495 {
2498
2499 return item;
2500 }
2501
2502
2504 {
2506 {
2507
2509
2510
2513
2515 if ( MemoryPointExists( slot_name + "_min" ) )
2516 {
2517 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2518 }
2519 if ( MemoryPointExists( slot_name + "_max" ) )
2520 {
2521 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2522 }
2523
2524
2527
2528
2531 center = ModelToWorld( center );
2532
2533
2536
2537 areaDamage.SetExtents( extents[0], extents[1] );
2538 areaDamage.SetAreaPosition( center );
2542 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2543 areaDamage.SetAmmoName( "BarbedWireHit" );
2544 areaDamage.Spawn();
2545
2547 }
2548 }
2549
2551 {
2552 if ( angle_deg != 0 )
2553 {
2554
2556
2557
2559 if ( MemoryPointExists( "rotate_axis" ) )
2560 {
2561 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2562 }
2563 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];
2564 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];
2565 center[0] = r_center_x;
2566 center[2] = r_center_z;
2567 }
2568 }
2569
2571 {
2573 {
2576 {
2577 if (areaDamage)
2578 {
2579 areaDamage.Destroy();
2580 }
2581
2583 }
2584 }
2585 }
2586
2588 {
2589 return true;
2590 }
2591
2592
2593
2594
2596 {
2598 }
2599
2601 {
2603 }
2604
2606 {
2608 }
2609
2611 {
2613
2614 switch ( material_type )
2615 {
2621 }
2622
2623 return "";
2624 }
2625
2627 {
2629
2630 switch ( material_type )
2631 {
2637 }
2638
2639 return "";
2640 }
2641
2642
2644 {
2646 {
2647
2649 {
2650 SetHealth(slot_name,"Health",item.GetHealth());
2651 }
2652 }
2653 }
2654
2656 {
2657 return 111;
2658 }
2659
2661 {
2662 super.SetActions();
2663
2667 }
2668
2670 {
2672 if (!construction)
2673 return;
2674
2676 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2677 {
2680 {
2682 }
2683 }
2684 }
2685
2687 {
2689 if (!construction)
2690 return;
2691
2693 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2694 {
2697 {
2698 construction.HandleEntityFalling(part.
GetPartName());
2699 }
2700 }
2701 }
2702
2705 {
2707 return;
2708
2711
2712 if (DestroyOnFall())
2713 {
2715 {
2717 }
2718 else
2719 {
2721 {
2723 }
2725 }
2726 }
2727 }
2728
2730 {
2731 if (HasAnyAttachmentsOrCargo())
2732 {
2735 }
2736 }
2737
2738
2739
2740
2741
2744 {
2745 return null;
2746 }
2747
2749 {
2751 }
2752
2754 {
2757
2758 Man p;
2759
2760 #ifdef SERVER
2762 g_Game.GetWorld().GetPlayerList(players);
2763 if (players.Count())
2764 p = players[0];
2765 #else
2767 #endif
2768
2770 {
2771 bool excluded = false;
2773 if (excludes)
2774 {
2775 foreach (string exclude : excludes)
2776 {
2778 {
2779 excluded = true;
2780 break;
2781 }
2782 }
2783 }
2784
2785 if (!excluded)
2786 {
2788 }
2789 }
2790
2792 }
2793
2795
2797 [
Obsolete(
"handled in the Construction component directly")]
2799 {
2800 }
2801
2802 [
Obsolete(
"handled in the Construction component directly")]
2804 {
2805 }
2806
2807 [
Obsolete(
"obsolete debug method")]
2809 {
2810 }
2811}
2812
2814{
2815#ifdef BSB_DEBUG
2817#else
2818
2819#endif
2820}
2822{
2823#ifdef BSB_DEBUG_SPAM
2825#else
2826
2827#endif
2828}
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.