1538{
1540
1542
1544
1551
1552
1553
1559
1565
1567
1571
1572
1574 {
1576
1577
1578 RegisterNetSyncVariableInt( "m_SyncParts01" );
1579 RegisterNetSyncVariableInt( "m_SyncParts02" );
1580 RegisterNetSyncVariableInt( "m_SyncParts03" );
1581 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1582 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1583 RegisterNetSyncVariableBool( "m_HasBase" );
1584
1585
1586 ConstructionInit();
1587
1588 if (ConfigIsExisting("hybridAttachments"))
1589 {
1592 }
1593 if (ConfigIsExisting("mountables"))
1594 {
1597 }
1598
1600 SetAllowDamage(true);
1601 }
1602
1604 {
1605 return "disableBaseDamage";
1606 }
1607
1609 {
1610 return true;
1611 }
1612
1614 {
1615 return EInventoryIconVisibility.HIDE_VICINITY;
1616 }
1617
1619 {
1620 super.InitItemSounds();
1621
1625
1630 }
1631
1633 {
1634 return "putDown_FenceKit_SoundSet";
1635 }
1636
1638 {
1639 return "Shelter_Site_Build_Loop_SoundSet";
1640 }
1641
1642
1644 {
1646 {
1647 SetSynchDirty();
1648 }
1649 }
1650
1652 {
1654 super.OnVariablesSynchronized();
1655
1657 }
1658
1660 {
1661
1663
1664
1666
1667
1669 }
1670
1671
1673 {
1674
1675 int offset;
1676 int mask;
1677
1678 if ( part_id >= 1 && part_id <= 31 )
1679 {
1680 offset = part_id - 1;
1681 mask = 1 << offset;
1682
1684 }
1685 else if ( part_id >= 32 && part_id <= 62 )
1686 {
1687 offset = ( part_id % 32 );
1688 mask = 1 << offset;
1689
1691 }
1692 else if ( part_id >= 63 && part_id <= 93 )
1693 {
1694 offset = ( part_id % 63 );
1695 mask = 1 << offset;
1696
1698 }
1699 }
1700
1702 {
1703
1704 int offset;
1705 int mask;
1706
1707 if ( part_id >= 1 && part_id <= 31 )
1708 {
1709 offset = part_id - 1;
1710 mask = 1 << offset;
1711
1713 }
1714 else if ( part_id >= 32 && part_id <= 62 )
1715 {
1716 offset = ( part_id % 32 );
1717 mask = 1 << offset;
1718
1720 }
1721 else if ( part_id >= 63 && part_id <= 93 )
1722 {
1723 offset = ( part_id % 63 );
1724 mask = 1 << offset;
1725
1727 }
1728 }
1729
1731 {
1732
1733 int offset;
1734 int mask;
1735
1736 if ( part_id >= 1 && part_id <= 31 )
1737 {
1738 offset = part_id - 1;
1739 mask = 1 << offset;
1740
1742 {
1743 return true;
1744 }
1745 }
1746 else if ( part_id >= 32 && part_id <= 62 )
1747 {
1748 offset = ( part_id % 32 );
1749 mask = 1 << offset;
1750
1752 {
1753 return true;
1754 }
1755 }
1756 else if ( part_id >= 63 && part_id <= 93 )
1757 {
1758 offset = ( part_id % 63 );
1759 mask = 1 << offset;
1760
1762 {
1763 return true;
1764 }
1765 }
1766
1767 return false;
1768 }
1769
1771 {
1774 }
1775
1777 {
1778
1781 }
1782
1784 {
1786 {
1789
1790 switch( build_action_id )
1791 {
1795 }
1796 }
1797 }
1798
1799
1801 {
1803 bool is_base = part.
IsBase();
1806 if ( is_part_built_sync )
1807 {
1809 {
1813
1814 if (is_base)
1815 {
1818 }
1819 }
1820 }
1821 else
1822 {
1824 {
1828
1829 if (is_base)
1830 {
1833 }
1834 }
1835 }
1836
1837
1839 }
1840
1841
1843 {
1846
1847 for ( int i = 0; i < construction_parts.Count(); ++i )
1848 {
1849 string key = construction_parts.GetKey( i );
1852 }
1853
1854
1856 }
1857
1859 {
1862
1863 for ( int i = 0; i < construction_parts.Count(); ++i )
1864 {
1865 string key = construction_parts.GetKey( i );
1867
1868 if ( value.
GetId() ==
id )
1869 {
1870 return value;
1871 }
1872 }
1873
1874 return NULL;
1875 }
1876
1877
1878
1880 {
1882 }
1883
1885 {
1887 }
1888
1890 {
1891 return true;
1892 }
1893
1895 {
1896 return false;
1897 }
1898
1899
1901 {
1904 {
1906 }
1907
1908 return construction_kit;
1909 }
1910
1912 {
1915 {
1917 }
1918 }
1919
1921 {
1923 }
1924
1926 {
1927 return "";
1928 }
1929
1931 {
1933 g_Game.ObjectDelete( construction_kit );
1934 }
1935
1936
1938 {
1940 g_Game.ObjectDelete(
this );
1941 }
1942
1943
1945 {
1946 super.EEDelete(parent);
1947
1949 {
1950 areaDamage.Destroy();
1951 }
1952
1953 }
1954
1956 {
1957 super.OnStoreSave( ctx );
1958
1959
1963
1965 }
1966
1968 {
1969 if ( !super.OnStoreLoad( ctx, version ) )
1970 return false;
1971
1972
1973
1975 {
1977 return false;
1978 }
1980 {
1982 return false;
1983 }
1985 {
1987 return false;
1988 }
1989
1990
1992 {
1994 return false;
1995 }
1996
1997
1998 return true;
1999 }
2000
2002 {
2003 super.AfterStoreLoad();
2004
2006 {
2008 }
2009 }
2010
2012 {
2013
2015
2016
2019
2020
2022 }
2023
2025 {
2026 super.OnCreatePhysics();
2027
2028 ConstructionInit();
2030 }
2031
2033 {
2035 return;
2036
2037 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2038 }
2039
2041 {
2043 {
2045 }
2046
2047 super.EEOnAfterLoad();
2048 }
2049
2051 {
2052 super.EEItemAttached( item, slot_name );
2053
2057 }
2058
2060 {
2061 super.EEItemDetached( item, slot_name );
2062
2065 }
2066
2067 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2068 {
2071
2074 }
2075
2076
2078 {
2079 return true;
2080 }
2081
2082
2083
2085 {
2087
2088
2089 if (construtionPart.
IsBase())
2090 {
2092
2093
2095 }
2096
2097
2099
2100
2102
2103
2105
2107
2109
2110
2112
2113
2115 }
2116
2118 {
2119
2121 }
2122
2123
2125 {
2128
2129
2131
2132
2134
2135
2137
2138
2140
2142
2143
2145
2146
2148
2149
2150 if (construtionPart.
IsBase())
2151 {
2152
2154 }
2155 }
2156
2158 {
2159
2161 }
2162
2163
2164 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2165 {
2168
2169
2171
2172
2174
2175
2177
2178
2180
2182
2183
2185
2186
2188
2189
2190 if (construtionPart.
IsBase())
2191 {
2192
2194 }
2195 }
2196
2198 {
2199
2201 }
2202
2203
2205 {
2207
2210 }
2211
2213 {
2215
2217 {
2219 }
2220 else
2221 {
2223 }
2224
2226 }
2227
2229 {
2231
2233 foreach (
string slotName : attachmentSlots)
2234 {
2236 }
2237
2238
2241 else
2243
2245 }
2246
2248 {
2249 string slotNameMounted = slot_name + "_Mounted";
2250 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2251
2252 if (attachment)
2253 {
2254 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2255 if (barbedWire && barbedWire.IsMounted())
2257 else
2259
2260 if (is_locked)
2261 {
2262 SetAnimationPhase(slotNameMounted, 0);
2263 SetAnimationPhase(slot_name, 1);
2264 }
2265 else
2266 {
2267 SetAnimationPhase(slotNameMounted, 1);
2268 SetAnimationPhase(slot_name, 0);
2269 }
2270 }
2271 else
2272 {
2273 SetAnimationPhase(slotNameMounted, 1);
2274 SetAnimationPhase(slot_name, 1);
2275
2277 }
2278 }
2279
2280
2282 {
2285
2288
2291
2292 foreach (
string slotName : attachmentSlots)
2293 {
2295 }
2296
2297
2299 {
2302
2304 }
2305 else
2306 {
2309
2311 }
2312
2315 }
2316
2318 {
2319
2321 return;
2322
2323 string slot_name_mounted = slot_name + "_Mounted";
2324 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2325
2326
2328 RemoveProxyPhysics( slot_name_mounted );
2329 RemoveProxyPhysics( slot_name );
2330
2331 if ( attachment )
2332 {
2334 if ( is_locked )
2335 {
2337 AddProxyPhysics( slot_name_mounted );
2338 }
2339 else
2340 {
2342 AddProxyPhysics( slot_name );
2343 }
2344 }
2345 }
2346
2348 {
2349 SetAffectPathgraph( true, false );
2351 }
2352
2354 {
2355 return true;
2356 }
2357
2359 {
2360 return true;
2361 }
2362
2364 {
2365 if ( attachment )
2366 {
2368 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2369
2370 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2371 }
2372
2373 return false;
2374 }
2375
2377 {
2379 }
2380
2381
2383 {
2384 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2385 if (
g_Game.ConfigIsExisting( config_path ) )
2386 {
2387 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2388 }
2389 }
2390
2392 {
2393 return true;
2394 }
2395
2397 {
2398 return true;
2399 }
2400
2402 {
2403 return true;
2404 }
2405
2406
2408 {
2411 }
2412
2414 {
2416 }
2417
2419 {
2421 }
2422
2424 {
2425 int attachment_count = GetInventory().AttachmentCount();
2426 if ( attachment_count > 0 )
2427 {
2428 if (
HasBase() && attachment_count == 1 )
2429 {
2430 return false;
2431 }
2432
2433 return true;
2434 }
2435
2436 return false;
2437 }
2438
2440 {
2441 return true;
2442 }
2443
2445 {
2446 return false;
2447 }
2448
2449
2451 {
2452 return false;
2453 }
2454
2456 {
2457 return false;
2458 }
2459
2460
2462 {
2463 return false;
2464 }
2465
2466
2467
2469 {
2470 return true;
2471 }
2472
2474 {
2475 return true;
2476 }
2477
2480 {
2481 return false;
2482 }
2483
2484
2486 {
2487 return false;
2488 }
2489
2490
2492 {
2493 return true;
2494 }
2495
2496
2498 {
2499 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2500 {
2501 return false;
2502 }
2503
2504 return true;
2505 }
2506
2508 {
2511
2512 return item;
2513 }
2514
2515
2517 {
2519 {
2520
2522
2523
2526
2528 if ( MemoryPointExists( slot_name + "_min" ) )
2529 {
2530 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2531 }
2532 if ( MemoryPointExists( slot_name + "_max" ) )
2533 {
2534 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2535 }
2536
2537
2540
2541
2544 center = ModelToWorld( center );
2545
2546
2549
2550 areaDamage.SetExtents( extents[0], extents[1] );
2551 areaDamage.SetAreaPosition( center );
2555 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2556 areaDamage.SetAmmoName( "BarbedWireHit" );
2557 areaDamage.Spawn();
2558
2560 }
2561 }
2562
2564 {
2565 if ( angle_deg != 0 )
2566 {
2567
2569
2570
2572 if ( MemoryPointExists( "rotate_axis" ) )
2573 {
2574 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2575 }
2576 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];
2577 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];
2578 center[0] = r_center_x;
2579 center[2] = r_center_z;
2580 }
2581 }
2582
2584 {
2586 {
2589 {
2590 if (areaDamage)
2591 {
2592 areaDamage.Destroy();
2593 }
2594
2596 }
2597 }
2598 }
2599
2601 {
2602 return true;
2603 }
2604
2605
2606
2607
2609 {
2611 }
2612
2614 {
2616 }
2617
2619 {
2621 }
2622
2624 {
2626
2627 switch ( material_type )
2628 {
2634 }
2635
2636 return "";
2637 }
2638
2640 {
2642
2643 switch ( material_type )
2644 {
2650 }
2651
2652 return "";
2653 }
2654
2655
2657 {
2659 {
2660
2662 {
2663 SetHealth(slot_name,"Health",item.GetHealth());
2664 }
2665 }
2666 }
2667
2669 {
2670 return 111;
2671 }
2672
2674 {
2675 super.SetActions();
2676
2680 }
2681
2683 {
2685 if (!construction)
2686 return;
2687
2689 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2690 {
2693 {
2695 }
2696 }
2697 }
2698
2700 {
2702 if (!construction)
2703 return;
2704
2706 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2707 {
2710 {
2711 construction.HandleEntityFalling(part.
GetPartName());
2712 }
2713 }
2714 }
2715
2718 {
2720 return;
2721
2724
2725 if (DestroyOnFall())
2726 {
2728 {
2730 }
2731 else
2732 {
2734 {
2736 }
2738 }
2739 }
2740 }
2741
2743 {
2744 if (HasAnyAttachmentsOrCargo())
2745 {
2748 }
2749 }
2750
2751
2752
2753
2754
2757 {
2758 return null;
2759 }
2760
2762 {
2764 }
2765
2767 {
2770
2771 Man p;
2772
2773 #ifdef SERVER
2775 g_Game.GetWorld().GetPlayerList(players);
2776 if (players.Count())
2777 p = players[0];
2778 #else
2780 #endif
2781
2783 {
2784 bool excluded = false;
2786 if (excludes)
2787 {
2788 foreach (string exclude : excludes)
2789 {
2791 {
2792 excluded = true;
2793 break;
2794 }
2795 }
2796 }
2797
2798 if (!excluded)
2799 {
2801 }
2802 }
2803
2805 }
2806
2808
2810 [
Obsolete(
"handled in the Construction component directly")]
2812 {
2813 }
2814
2815 [
Obsolete(
"handled in the Construction component directly")]
2817 {
2818 }
2819
2820 [
Obsolete(
"obsolete debug method")]
2822 {
2823 }
2824}
2825
2827{
2828#ifdef BSB_DEBUG
2830#else
2831
2832#endif
2833}
2835{
2836#ifdef BSB_DEBUG_SPAM
2838#else
2839
2840#endif
2841}
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.