1531{
1533
1535
1537
1544
1545
1546
1552
1558
1560
1564
1565
1567 {
1569
1570
1571 RegisterNetSyncVariableInt( "m_SyncParts01" );
1572 RegisterNetSyncVariableInt( "m_SyncParts02" );
1573 RegisterNetSyncVariableInt( "m_SyncParts03" );
1574 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1575 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1576 RegisterNetSyncVariableBool( "m_HasBase" );
1577
1578
1579 ConstructionInit();
1580
1581 if (ConfigIsExisting("hybridAttachments"))
1582 {
1585 }
1586 if (ConfigIsExisting("mountables"))
1587 {
1590 }
1591
1593 SetAllowDamage(true);
1594 }
1595
1597 {
1598 return "disableBaseDamage";
1599 }
1600
1602 {
1603 return true;
1604 }
1605
1607 {
1608 return EInventoryIconVisibility.HIDE_VICINITY;
1609 }
1610
1612 {
1613 super.InitItemSounds();
1614
1618
1623 }
1624
1626 {
1627 return "putDown_FenceKit_SoundSet";
1628 }
1629
1631 {
1632 return "Shelter_Site_Build_Loop_SoundSet";
1633 }
1634
1635
1637 {
1639 {
1640 SetSynchDirty();
1641 }
1642 }
1643
1645 {
1647 super.OnVariablesSynchronized();
1648
1650 }
1651
1653 {
1654
1656
1657
1659
1660
1662 }
1663
1664
1666 {
1667
1668 int offset;
1669 int mask;
1670
1671 if ( part_id >= 1 && part_id <= 31 )
1672 {
1673 offset = part_id - 1;
1674 mask = 1 << offset;
1675
1677 }
1678 else if ( part_id >= 32 && part_id <= 62 )
1679 {
1680 offset = ( part_id % 32 );
1681 mask = 1 << offset;
1682
1684 }
1685 else if ( part_id >= 63 && part_id <= 93 )
1686 {
1687 offset = ( part_id % 63 );
1688 mask = 1 << offset;
1689
1691 }
1692 }
1693
1695 {
1696
1697 int offset;
1698 int mask;
1699
1700 if ( part_id >= 1 && part_id <= 31 )
1701 {
1702 offset = part_id - 1;
1703 mask = 1 << offset;
1704
1706 }
1707 else if ( part_id >= 32 && part_id <= 62 )
1708 {
1709 offset = ( part_id % 32 );
1710 mask = 1 << offset;
1711
1713 }
1714 else if ( part_id >= 63 && part_id <= 93 )
1715 {
1716 offset = ( part_id % 63 );
1717 mask = 1 << offset;
1718
1720 }
1721 }
1722
1724 {
1725
1726 int offset;
1727 int mask;
1728
1729 if ( part_id >= 1 && part_id <= 31 )
1730 {
1731 offset = part_id - 1;
1732 mask = 1 << offset;
1733
1735 {
1736 return true;
1737 }
1738 }
1739 else if ( part_id >= 32 && part_id <= 62 )
1740 {
1741 offset = ( part_id % 32 );
1742 mask = 1 << offset;
1743
1745 {
1746 return true;
1747 }
1748 }
1749 else if ( part_id >= 63 && part_id <= 93 )
1750 {
1751 offset = ( part_id % 63 );
1752 mask = 1 << offset;
1753
1755 {
1756 return true;
1757 }
1758 }
1759
1760 return false;
1761 }
1762
1764 {
1767 }
1768
1770 {
1771
1774 }
1775
1777 {
1779 {
1782
1783 switch( build_action_id )
1784 {
1788 }
1789 }
1790 }
1791
1792
1794 {
1796 bool is_base = part.
IsBase();
1799 if ( is_part_built_sync )
1800 {
1802 {
1806
1807 if (is_base)
1808 {
1811 }
1812 }
1813 }
1814 else
1815 {
1817 {
1821
1822 if (is_base)
1823 {
1826 }
1827 }
1828 }
1829
1830
1832 }
1833
1834
1836 {
1839
1840 for ( int i = 0; i < construction_parts.Count(); ++i )
1841 {
1842 string key = construction_parts.GetKey( i );
1845 }
1846
1847
1849 }
1850
1852 {
1855
1856 for ( int i = 0; i < construction_parts.Count(); ++i )
1857 {
1858 string key = construction_parts.GetKey( i );
1860
1861 if ( value.
GetId() ==
id )
1862 {
1863 return value;
1864 }
1865 }
1866
1867 return NULL;
1868 }
1869
1870
1871
1873 {
1875 }
1876
1878 {
1880 }
1881
1883 {
1884 return true;
1885 }
1886
1888 {
1889 return false;
1890 }
1891
1892
1894 {
1897 {
1899 }
1900
1901 return construction_kit;
1902 }
1903
1905 {
1908 {
1910 }
1911 }
1912
1914 {
1916 }
1917
1919 {
1920 return "";
1921 }
1922
1924 {
1926 g_Game.ObjectDelete( construction_kit );
1927 }
1928
1929
1931 {
1933 g_Game.ObjectDelete(
this );
1934 }
1935
1936
1938 {
1939 super.EEDelete(parent);
1940
1942 {
1943 areaDamage.Destroy();
1944 }
1945
1946 }
1947
1949 {
1950 super.OnStoreSave( ctx );
1951
1952
1956
1958 }
1959
1961 {
1962 if ( !super.OnStoreLoad( ctx, version ) )
1963 return false;
1964
1965
1966
1968 {
1970 return false;
1971 }
1973 {
1975 return false;
1976 }
1978 {
1980 return false;
1981 }
1982
1983
1985 {
1987 return false;
1988 }
1989
1990
1991 return true;
1992 }
1993
1995 {
1996 super.AfterStoreLoad();
1997
1999 {
2001 }
2002 }
2003
2005 {
2006
2008
2009
2012
2013
2015 }
2016
2018 {
2019 super.OnCreatePhysics();
2020
2021 ConstructionInit();
2023 }
2024
2026 {
2028 return;
2029
2030 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2031 }
2032
2034 {
2036 {
2038 }
2039
2040 super.EEOnAfterLoad();
2041 }
2042
2044 {
2045 super.EEItemAttached( item, slot_name );
2046
2050 }
2051
2053 {
2054 super.EEItemDetached( item, slot_name );
2055
2058 }
2059
2060 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2061 {
2064
2067 }
2068
2069
2071 {
2072 return true;
2073 }
2074
2075
2076
2078 {
2080
2081
2082 if (construtionPart.
IsBase())
2083 {
2085
2086
2088 }
2089
2090
2092
2093
2095
2096
2098
2100
2102
2103
2105
2106
2108 }
2109
2111 {
2112
2114 }
2115
2116
2118 {
2121
2122
2124
2125
2127
2128
2130
2131
2133
2135
2136
2138
2139
2141
2142
2143 if (construtionPart.
IsBase())
2144 {
2145
2147 }
2148 }
2149
2151 {
2152
2154 }
2155
2156
2157 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2158 {
2161
2162
2164
2165
2167
2168
2170
2171
2173
2175
2176
2178
2179
2181
2182
2183 if (construtionPart.
IsBase())
2184 {
2185
2187 }
2188 }
2189
2191 {
2192
2194 }
2195
2196
2198 {
2200
2203 }
2204
2206 {
2208
2210 {
2212 }
2213 else
2214 {
2216 }
2217
2219 }
2220
2222 {
2224
2226 foreach (
string slotName : attachmentSlots)
2227 {
2229 }
2230
2231
2234 else
2236
2238 }
2239
2241 {
2242 string slotNameMounted = slot_name + "_Mounted";
2243 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2244
2245 if (attachment)
2246 {
2247 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2248 if (barbedWire && barbedWire.IsMounted())
2250 else
2252
2253 if (is_locked)
2254 {
2255 SetAnimationPhase(slotNameMounted, 0);
2256 SetAnimationPhase(slot_name, 1);
2257 }
2258 else
2259 {
2260 SetAnimationPhase(slotNameMounted, 1);
2261 SetAnimationPhase(slot_name, 0);
2262 }
2263 }
2264 else
2265 {
2266 SetAnimationPhase(slotNameMounted, 1);
2267 SetAnimationPhase(slot_name, 1);
2268
2270 }
2271 }
2272
2273
2275 {
2278
2281
2284
2285 foreach (
string slotName : attachmentSlots)
2286 {
2288 }
2289
2290
2292 {
2295
2297 }
2298 else
2299 {
2302
2304 }
2305
2308 }
2309
2311 {
2312
2314 return;
2315
2316 string slot_name_mounted = slot_name + "_Mounted";
2317 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2318
2319
2321 RemoveProxyPhysics( slot_name_mounted );
2322 RemoveProxyPhysics( slot_name );
2323
2324 if ( attachment )
2325 {
2327 if ( is_locked )
2328 {
2330 AddProxyPhysics( slot_name_mounted );
2331 }
2332 else
2333 {
2335 AddProxyPhysics( slot_name );
2336 }
2337 }
2338 }
2339
2341 {
2342 SetAffectPathgraph( true, false );
2344 }
2345
2347 {
2348 return true;
2349 }
2350
2352 {
2353 return true;
2354 }
2355
2357 {
2358 if ( attachment )
2359 {
2361 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2362
2363 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2364 }
2365
2366 return false;
2367 }
2368
2370 {
2372 }
2373
2374
2376 {
2377 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2378 if (
g_Game.ConfigIsExisting( config_path ) )
2379 {
2380 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2381 }
2382 }
2383
2385 {
2386 return true;
2387 }
2388
2390 {
2391 return true;
2392 }
2393
2395 {
2396 return true;
2397 }
2398
2399
2401 {
2404 }
2405
2407 {
2409 }
2410
2412 {
2414 }
2415
2417 {
2418 int attachment_count = GetInventory().AttachmentCount();
2419 if ( attachment_count > 0 )
2420 {
2421 if (
HasBase() && attachment_count == 1 )
2422 {
2423 return false;
2424 }
2425
2426 return true;
2427 }
2428
2429 return false;
2430 }
2431
2433 {
2434 return true;
2435 }
2436
2438 {
2439 return false;
2440 }
2441
2442
2444 {
2445 return false;
2446 }
2447
2449 {
2450 return false;
2451 }
2452
2453
2455 {
2456 return false;
2457 }
2458
2459
2460
2462 {
2463 return true;
2464 }
2465
2467 {
2468 return true;
2469 }
2470
2473 {
2474 return false;
2475 }
2476
2477
2479 {
2480 return false;
2481 }
2482
2483
2485 {
2486 return true;
2487 }
2488
2489
2491 {
2492 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2493 {
2494 return false;
2495 }
2496
2497 return true;
2498 }
2499
2501 {
2504
2505 return item;
2506 }
2507
2508
2510 {
2512 {
2513
2515
2516
2519
2521 if ( MemoryPointExists( slot_name + "_min" ) )
2522 {
2523 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2524 }
2525 if ( MemoryPointExists( slot_name + "_max" ) )
2526 {
2527 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2528 }
2529
2530
2533
2534
2537 center = ModelToWorld( center );
2538
2539
2542
2543 areaDamage.SetExtents( extents[0], extents[1] );
2544 areaDamage.SetAreaPosition( center );
2548 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2549 areaDamage.SetAmmoName( "BarbedWireHit" );
2550 areaDamage.Spawn();
2551
2553 }
2554 }
2555
2557 {
2558 if ( angle_deg != 0 )
2559 {
2560
2562
2563
2565 if ( MemoryPointExists( "rotate_axis" ) )
2566 {
2567 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2568 }
2569 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];
2570 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];
2571 center[0] = r_center_x;
2572 center[2] = r_center_z;
2573 }
2574 }
2575
2577 {
2579 {
2582 {
2583 if (areaDamage)
2584 {
2585 areaDamage.Destroy();
2586 }
2587
2589 }
2590 }
2591 }
2592
2594 {
2595 return true;
2596 }
2597
2598
2599
2600
2602 {
2604 }
2605
2607 {
2609 }
2610
2612 {
2614 }
2615
2617 {
2619
2620 switch ( material_type )
2621 {
2627 }
2628
2629 return "";
2630 }
2631
2633 {
2635
2636 switch ( material_type )
2637 {
2643 }
2644
2645 return "";
2646 }
2647
2648
2650 {
2652 {
2653
2655 {
2656 SetHealth(slot_name,"Health",item.GetHealth());
2657 }
2658 }
2659 }
2660
2662 {
2663 return 111;
2664 }
2665
2667 {
2668 super.SetActions();
2669
2673 }
2674
2676 {
2678 if (!construction)
2679 return;
2680
2682 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2683 {
2686 {
2688 }
2689 }
2690 }
2691
2693 {
2695 if (!construction)
2696 return;
2697
2699 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2700 {
2703 {
2704 construction.HandleEntityFalling(part.
GetPartName());
2705 }
2706 }
2707 }
2708
2711 {
2713 return;
2714
2717
2718 if (DestroyOnFall())
2719 {
2721 {
2723 }
2724 else
2725 {
2727 {
2729 }
2731 }
2732 }
2733 }
2734
2736 {
2737 if (HasAnyAttachmentsOrCargo())
2738 {
2741 }
2742 }
2743
2744
2745
2746
2747
2750 {
2751 return null;
2752 }
2753
2755 {
2757 }
2758
2760 {
2763
2764 Man p;
2765
2766 #ifdef SERVER
2768 g_Game.GetWorld().GetPlayerList(players);
2769 if (players.Count())
2770 p = players[0];
2771 #else
2773 #endif
2774
2776 {
2777 bool excluded = false;
2779 if (excludes)
2780 {
2781 foreach (string exclude : excludes)
2782 {
2784 {
2785 excluded = true;
2786 break;
2787 }
2788 }
2789 }
2790
2791 if (!excluded)
2792 {
2794 }
2795 }
2796
2798 }
2799
2801
2803 [
Obsolete(
"handled in the Construction component directly")]
2805 {
2806 }
2807
2808 [
Obsolete(
"handled in the Construction component directly")]
2810 {
2811 }
2812
2813 [
Obsolete(
"obsolete debug method")]
2815 {
2816 }
2817}
2818
2820{
2821#ifdef BSB_DEBUG
2823#else
2824
2825#endif
2826}
2828{
2829#ifdef BSB_DEBUG_SPAM
2831#else
2832
2833#endif
2834}
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.