1597{
1599
1601
1603
1610
1611
1612
1618
1624
1626
1630
1631
1633 {
1635
1636
1637 RegisterNetSyncVariableInt( "m_SyncParts01" );
1638 RegisterNetSyncVariableInt( "m_SyncParts02" );
1639 RegisterNetSyncVariableInt( "m_SyncParts03" );
1640 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1641 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1642 RegisterNetSyncVariableBool( "m_HasBase" );
1643
1644
1645 ConstructionInit();
1646
1647 if (ConfigIsExisting("hybridAttachments"))
1648 {
1651 }
1652 if (ConfigIsExisting("mountables"))
1653 {
1656 }
1657
1659 SetAllowDamage(true);
1660 }
1661
1663 {
1664 return "disableBaseDamage";
1665 }
1666
1668 {
1669 return true;
1670 }
1671
1673 {
1674 return EInventoryIconVisibility.HIDE_VICINITY;
1675 }
1676
1678 {
1679 super.InitItemSounds();
1680
1684
1689 }
1690
1692 {
1693 return "putDown_FenceKit_SoundSet";
1694 }
1695
1697 {
1698 return "Shelter_Site_Build_Loop_SoundSet";
1699 }
1700
1701
1703 {
1705 {
1706 SetSynchDirty();
1707 }
1708 }
1709
1711 {
1713 super.OnVariablesSynchronized();
1714
1716 }
1717
1719 {
1720
1722
1723
1725
1726
1728 }
1729
1730
1732 {
1733
1734 int offset;
1735 int mask;
1736
1737 if ( part_id >= 1 && part_id <= 31 )
1738 {
1739 offset = part_id - 1;
1740 mask = 1 << offset;
1741
1743 }
1744 else if ( part_id >= 32 && part_id <= 62 )
1745 {
1746 offset = ( part_id % 32 );
1747 mask = 1 << offset;
1748
1750 }
1751 else if ( part_id >= 63 && part_id <= 93 )
1752 {
1753 offset = ( part_id % 63 );
1754 mask = 1 << offset;
1755
1757 }
1758 }
1759
1761 {
1762
1763 int offset;
1764 int mask;
1765
1766 if ( part_id >= 1 && part_id <= 31 )
1767 {
1768 offset = part_id - 1;
1769 mask = 1 << offset;
1770
1772 }
1773 else if ( part_id >= 32 && part_id <= 62 )
1774 {
1775 offset = ( part_id % 32 );
1776 mask = 1 << offset;
1777
1779 }
1780 else if ( part_id >= 63 && part_id <= 93 )
1781 {
1782 offset = ( part_id % 63 );
1783 mask = 1 << offset;
1784
1786 }
1787 }
1788
1790 {
1791
1792 int offset;
1793 int mask;
1794
1795 if ( part_id >= 1 && part_id <= 31 )
1796 {
1797 offset = part_id - 1;
1798 mask = 1 << offset;
1799
1801 {
1802 return true;
1803 }
1804 }
1805 else if ( part_id >= 32 && part_id <= 62 )
1806 {
1807 offset = ( part_id % 32 );
1808 mask = 1 << offset;
1809
1811 {
1812 return true;
1813 }
1814 }
1815 else if ( part_id >= 63 && part_id <= 93 )
1816 {
1817 offset = ( part_id % 63 );
1818 mask = 1 << offset;
1819
1821 {
1822 return true;
1823 }
1824 }
1825
1826 return false;
1827 }
1828
1830 {
1833 }
1834
1836 {
1837
1840 }
1841
1843 {
1845 {
1848
1849 switch( build_action_id )
1850 {
1854 }
1855 }
1856 }
1857
1858
1860 {
1862 bool is_base = part.
IsBase();
1865 if ( is_part_built_sync )
1866 {
1868 {
1872
1873 if (is_base)
1874 {
1877 }
1878 }
1879 }
1880 else
1881 {
1883 {
1887
1888 if (is_base)
1889 {
1892 }
1893 }
1894 }
1895
1896
1898 }
1899
1900
1902 {
1905
1906 for ( int i = 0; i < construction_parts.Count(); ++i )
1907 {
1908 string key = construction_parts.GetKey( i );
1911 }
1912
1913
1915 }
1916
1918 {
1921
1922 for ( int i = 0; i < construction_parts.Count(); ++i )
1923 {
1924 string key = construction_parts.GetKey( i );
1926
1927 if ( value.
GetId() ==
id )
1928 {
1929 return value;
1930 }
1931 }
1932
1933 return NULL;
1934 }
1935
1936
1937
1939 {
1941 }
1942
1944 {
1946 }
1947
1949 {
1950 return true;
1951 }
1952
1954 {
1955 return false;
1956 }
1957
1958
1960 {
1963 {
1965 }
1966
1967 return construction_kit;
1968 }
1969
1971 {
1974 {
1976 }
1977 }
1978
1980 {
1982 }
1983
1985 {
1986 return "";
1987 }
1988
1990 {
1992 g_Game.ObjectDelete( construction_kit );
1993 }
1994
1995
1997 {
1999 g_Game.ObjectDelete(
this );
2000 }
2001
2002
2004 {
2005 super.EEDelete(parent);
2006
2008 {
2009 areaDamage.Destroy();
2010 }
2011
2012 }
2013
2015 {
2016 super.OnStoreSave( ctx );
2017
2018
2022
2024 }
2025
2027 {
2028 if ( !super.OnStoreLoad( ctx, version ) )
2029 return false;
2030
2031
2032
2034 {
2036 return false;
2037 }
2039 {
2041 return false;
2042 }
2044 {
2046 return false;
2047 }
2048
2049
2051 {
2053 return false;
2054 }
2055
2056
2057 return true;
2058 }
2059
2061 {
2062 super.AfterStoreLoad();
2063
2065 {
2067 }
2068 }
2069
2071 {
2072
2074
2075
2078
2079
2081 }
2082
2084 {
2085 super.OnCreatePhysics();
2086
2087 ConstructionInit();
2089 }
2090
2092 {
2094 return;
2095
2096 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2097 }
2098
2100 {
2102 {
2104 }
2105
2106 super.EEOnAfterLoad();
2107 }
2108
2110 {
2111 super.EEItemAttached( item, slot_name );
2112
2116 }
2117
2119 {
2120 super.EEItemDetached( item, slot_name );
2121
2124 }
2125
2126 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2127 {
2130
2133 }
2134
2135
2137 {
2138 return true;
2139 }
2140
2141
2142
2144 {
2146
2147
2148 if (construtionPart.
IsBase())
2149 {
2151
2152
2154 }
2155
2156
2158
2159
2161
2162
2164
2166
2168
2169
2171
2172
2174 }
2175
2177 {
2178
2180 }
2181
2182
2184 {
2187
2188
2190
2191
2193
2194
2196
2197
2199
2201
2202
2204
2205
2207
2208
2209 if (construtionPart.
IsBase())
2210 {
2211
2213 }
2214 }
2215
2217 {
2218
2220 }
2221
2222
2223 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2224 {
2227
2228
2230
2231
2233
2234
2236
2237
2239
2241
2242
2244
2245
2247
2248
2249 if (construtionPart.
IsBase())
2250 {
2251
2253 }
2254 }
2255
2257 {
2258
2260 }
2261
2262
2264 {
2266
2269 }
2270
2272 {
2274
2276 {
2278 }
2279 else
2280 {
2282 }
2283
2285 }
2286
2288 {
2290
2292 foreach (
string slotName : attachmentSlots)
2293 {
2295 }
2296
2297
2300 else
2302
2304 }
2305
2307 {
2308 string slotNameMounted = slot_name + "_Mounted";
2309 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2310
2311 if (attachment)
2312 {
2313 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2314 if (barbedWire && barbedWire.IsMounted())
2316 else
2318
2319 if (is_locked)
2320 {
2321 SetAnimationPhase(slotNameMounted, 0);
2322 SetAnimationPhase(slot_name, 1);
2323 }
2324 else
2325 {
2326 SetAnimationPhase(slotNameMounted, 1);
2327 SetAnimationPhase(slot_name, 0);
2328 }
2329 }
2330 else
2331 {
2332 SetAnimationPhase(slotNameMounted, 1);
2333 SetAnimationPhase(slot_name, 1);
2334
2336 }
2337 }
2338
2339
2341 {
2344
2347
2350
2351 foreach (
string slotName : attachmentSlots)
2352 {
2354 }
2355
2356
2358 {
2361
2363 }
2364 else
2365 {
2368
2370 }
2371
2374 }
2375
2377 {
2378
2380 return;
2381
2382 string slot_name_mounted = slot_name + "_Mounted";
2383 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2384
2385
2387 RemoveProxyPhysics( slot_name_mounted );
2388 RemoveProxyPhysics( slot_name );
2389
2390 if ( attachment )
2391 {
2393 if ( is_locked )
2394 {
2396 AddProxyPhysics( slot_name_mounted );
2397 }
2398 else
2399 {
2401 AddProxyPhysics( slot_name );
2402 }
2403 }
2404 }
2405
2407 {
2408 SetAffectPathgraph( true, false );
2410 }
2411
2413 {
2414 return true;
2415 }
2416
2418 {
2419 return true;
2420 }
2421
2423 {
2424 if ( attachment )
2425 {
2427 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2428
2429 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2430 }
2431
2432 return false;
2433 }
2434
2436 {
2438 }
2439
2440
2442 {
2443 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2444 if (
g_Game.ConfigIsExisting( config_path ) )
2445 {
2446 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2447 }
2448 }
2449
2451 {
2452 return true;
2453 }
2454
2456 {
2457 return true;
2458 }
2459
2461 {
2462 return true;
2463 }
2464
2465
2467 {
2470 }
2471
2473 {
2475 }
2476
2478 {
2480 }
2481
2483 {
2484 int attachment_count = GetInventory().AttachmentCount();
2485 if ( attachment_count > 0 )
2486 {
2487 if (
HasBase() && attachment_count == 1 )
2488 {
2489 return false;
2490 }
2491
2492 return true;
2493 }
2494
2495 return false;
2496 }
2497
2499 {
2500 return true;
2501 }
2502
2504 {
2505 return false;
2506 }
2507
2508
2510 {
2511 return false;
2512 }
2513
2515 {
2516 return false;
2517 }
2518
2519
2521 {
2522 return false;
2523 }
2524
2525
2526
2528 {
2529 return true;
2530 }
2531
2533 {
2534 return true;
2535 }
2536
2539 {
2540 return false;
2541 }
2542
2543
2545 {
2546 return false;
2547 }
2548
2549
2551 {
2552 return true;
2553 }
2554
2555
2557 {
2558 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2559 {
2560 return false;
2561 }
2562
2563 return true;
2564 }
2565
2567 {
2570
2571 return item;
2572 }
2573
2574
2576 {
2578 {
2579
2581
2582
2585
2587 if ( MemoryPointExists( slot_name + "_min" ) )
2588 {
2589 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2590 }
2591 if ( MemoryPointExists( slot_name + "_max" ) )
2592 {
2593 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2594 }
2595
2596
2599
2600
2603 center = ModelToWorld( center );
2604
2605
2608
2609 areaDamage.SetExtents( extents[0], extents[1] );
2610 areaDamage.SetAreaPosition( center );
2614 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2615 areaDamage.SetAmmoName( "BarbedWireHit" );
2616 areaDamage.Spawn();
2617
2619 }
2620 }
2621
2623 {
2624 if ( angle_deg != 0 )
2625 {
2626
2628
2629
2631 if ( MemoryPointExists( "rotate_axis" ) )
2632 {
2633 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2634 }
2635 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];
2636 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];
2637 center[0] = r_center_x;
2638 center[2] = r_center_z;
2639 }
2640 }
2641
2643 {
2645 {
2648 {
2649 if (areaDamage)
2650 {
2651 areaDamage.Destroy();
2652 }
2653
2655 }
2656 }
2657 }
2658
2660 {
2661 return true;
2662 }
2663
2664
2665
2666
2668 {
2670 }
2671
2673 {
2675 }
2676
2678 {
2680 }
2681
2683 {
2685
2686 switch ( material_type )
2687 {
2693 }
2694
2695 return "";
2696 }
2697
2699 {
2701
2702 switch ( material_type )
2703 {
2709 }
2710
2711 return "";
2712 }
2713
2714
2716 {
2718 {
2719
2721 {
2722 SetHealth(slot_name,"Health",item.GetHealth());
2723 }
2724 }
2725 }
2726
2728 {
2729 return 111;
2730 }
2731
2733 {
2734 super.SetActions();
2735
2739 }
2740
2742 {
2744 if (!construction)
2745 return;
2746
2748 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2749 {
2752 {
2754 }
2755 }
2756 }
2757
2759 {
2761 if (!construction)
2762 return;
2763
2765 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2766 {
2769 {
2770 construction.HandleEntityFalling(part.
GetPartName());
2771 }
2772 }
2773 }
2774
2777 {
2779 return;
2780
2783
2784 if (DestroyOnFall())
2785 {
2787 {
2789 }
2790 else
2791 {
2793 {
2795 }
2797 }
2798 }
2799 }
2800
2802 {
2803 if (HasAnyAttachmentsOrCargo())
2804 {
2807 }
2808 }
2809
2810
2811
2812
2813
2816 {
2817 return null;
2818 }
2819
2821 {
2823 }
2824
2826 {
2829
2830 Man p;
2831
2832 #ifdef SERVER
2834 g_Game.GetWorld().GetPlayerList(players);
2835 if (players.Count())
2836 p = players[0];
2837 #else
2839 #endif
2840
2842 {
2843 bool excluded = false;
2845 if (excludes)
2846 {
2847 foreach (string exclude : excludes)
2848 {
2850 {
2851 excluded = true;
2852 break;
2853 }
2854 }
2855 }
2856
2857 if (!excluded)
2858 {
2860 }
2861 }
2862
2864 }
2865
2867
2869 [
Obsolete(
"handled in the Construction component directly")]
2871 {
2872 }
2873
2874 [
Obsolete(
"handled in the Construction component directly")]
2876 {
2877 }
2878
2879 [
Obsolete(
"obsolete debug method")]
2881 {
2882 }
2883}
2884
2886{
2887#ifdef BSB_DEBUG
2889#else
2890
2891#endif
2892}
2894{
2895#ifdef BSB_DEBUG_SPAM
2897#else
2898
2899#endif
2900}
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.