1655{
1657
1659
1661
1668
1669
1670
1676
1682
1684
1688
1689
1691 {
1693
1694
1695 RegisterNetSyncVariableInt( "m_SyncParts01" );
1696 RegisterNetSyncVariableInt( "m_SyncParts02" );
1697 RegisterNetSyncVariableInt( "m_SyncParts03" );
1698 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1699 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1700 RegisterNetSyncVariableBool( "m_HasBase" );
1701
1702
1703 ConstructionInit();
1704
1705 if (ConfigIsExisting("hybridAttachments"))
1706 {
1709 }
1710 if (ConfigIsExisting("mountables"))
1711 {
1714 }
1715
1717 SetAllowDamage(true);
1718 }
1719
1721 {
1722 return "disableBaseDamage";
1723 }
1724
1726 {
1727 return true;
1728 }
1729
1731 {
1732 return EInventoryIconVisibility.HIDE_VICINITY;
1733 }
1734
1736 {
1737 super.InitItemSounds();
1738
1742
1747 }
1748
1750 {
1751 return "putDown_FenceKit_SoundSet";
1752 }
1753
1755 {
1756 return "Shelter_Site_Build_Loop_SoundSet";
1757 }
1758
1759
1761 {
1763 {
1764 SetSynchDirty();
1765 }
1766 }
1767
1769 {
1771 super.OnVariablesSynchronized();
1772
1774 }
1775
1777 {
1778
1780
1781
1783
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 else if ( part_id >= 32 && part_id <= 62 )
1803 {
1804 offset = ( part_id % 32 );
1805 mask = 1 << offset;
1806
1808 }
1809 else if ( part_id >= 63 && part_id <= 93 )
1810 {
1811 offset = ( part_id % 63 );
1812 mask = 1 << offset;
1813
1815 }
1816 }
1817
1819 {
1820
1821 int offset;
1822 int mask;
1823
1824 if ( part_id >= 1 && part_id <= 31 )
1825 {
1826 offset = part_id - 1;
1827 mask = 1 << offset;
1828
1830 }
1831 else if ( part_id >= 32 && part_id <= 62 )
1832 {
1833 offset = ( part_id % 32 );
1834 mask = 1 << offset;
1835
1837 }
1838 else if ( part_id >= 63 && part_id <= 93 )
1839 {
1840 offset = ( part_id % 63 );
1841 mask = 1 << offset;
1842
1844 }
1845 }
1846
1848 {
1849
1850 int offset;
1851 int mask;
1852
1853 if ( part_id >= 1 && part_id <= 31 )
1854 {
1855 offset = part_id - 1;
1856 mask = 1 << offset;
1857
1859 {
1860 return true;
1861 }
1862 }
1863 else if ( part_id >= 32 && part_id <= 62 )
1864 {
1865 offset = ( part_id % 32 );
1866 mask = 1 << offset;
1867
1869 {
1870 return true;
1871 }
1872 }
1873 else if ( part_id >= 63 && part_id <= 93 )
1874 {
1875 offset = ( part_id % 63 );
1876 mask = 1 << offset;
1877
1879 {
1880 return true;
1881 }
1882 }
1883
1884 return false;
1885 }
1886
1888 {
1891 }
1892
1894 {
1895
1898 }
1899
1901 {
1903 {
1906
1907 switch( build_action_id )
1908 {
1912 }
1913 }
1914 }
1915
1916
1918 {
1920 bool is_base = part.
IsBase();
1923 if ( is_part_built_sync )
1924 {
1926 {
1930
1931 if (is_base)
1932 {
1935 }
1936 }
1937 }
1938 else
1939 {
1941 {
1945
1946 if (is_base)
1947 {
1950 }
1951 }
1952 }
1953
1954
1956 }
1957
1958
1960 {
1963
1964 for ( int i = 0; i < construction_parts.Count(); ++i )
1965 {
1966 string key = construction_parts.GetKey( i );
1969 }
1970
1971
1973 }
1974
1976 {
1979
1980 for ( int i = 0; i < construction_parts.Count(); ++i )
1981 {
1982 string key = construction_parts.GetKey( i );
1984
1985 if ( value.
GetId() ==
id )
1986 {
1987 return value;
1988 }
1989 }
1990
1991 return NULL;
1992 }
1993
1994
1995
1997 {
1999 }
2000
2002 {
2004 }
2005
2007 {
2008 return true;
2009 }
2010
2012 {
2013 return false;
2014 }
2015
2016
2018 {
2021 {
2023 }
2024
2025 return construction_kit;
2026 }
2027
2029 {
2032 {
2034 }
2035 }
2036
2038 {
2040 }
2041
2043 {
2044 return "";
2045 }
2046
2048 {
2050 g_Game.ObjectDelete( construction_kit );
2051 }
2052
2053
2055 {
2057 g_Game.ObjectDelete(
this );
2058 }
2059
2060
2062 {
2063 super.EEDelete(parent);
2064
2066 {
2067 areaDamage.Destroy();
2068 }
2069
2070 }
2071
2073 {
2074 super.OnStoreSave( ctx );
2075
2076
2080
2082 }
2083
2085 {
2086 if ( !super.OnStoreLoad( ctx, version ) )
2087 return false;
2088
2089
2090
2092 {
2094 return false;
2095 }
2097 {
2099 return false;
2100 }
2102 {
2104 return false;
2105 }
2106
2107
2109 {
2111 return false;
2112 }
2113
2114
2115 return true;
2116 }
2117
2119 {
2120 super.AfterStoreLoad();
2121
2123 {
2125 }
2126 }
2127
2129 {
2130
2132
2133
2136
2137
2139 }
2140
2142 {
2143 super.OnCreatePhysics();
2144
2145 ConstructionInit();
2147 }
2148
2150 {
2152 return;
2153
2154 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2155 }
2156
2158 {
2160 {
2162 }
2163
2164 super.EEOnAfterLoad();
2165 }
2166
2168 {
2169 super.EEItemAttached( item, slot_name );
2170
2174 }
2175
2177 {
2178 super.EEItemDetached( item, slot_name );
2179
2182 }
2183
2184 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2185 {
2188
2191 }
2192
2193
2195 {
2196 return true;
2197 }
2198
2199
2200
2202 {
2204
2205
2206 if (construtionPart.
IsBase())
2207 {
2209
2210
2212 }
2213
2214
2216
2217
2219
2220
2222
2224
2226
2227
2229
2230
2232 }
2233
2235 {
2236
2238 }
2239
2240
2242 {
2245
2246
2248
2249
2251
2252
2254
2255
2257
2259
2260
2262
2263
2265
2266
2267 if (construtionPart.
IsBase())
2268 {
2269
2271 }
2272 }
2273
2275 {
2276
2278 }
2279
2280
2281 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2282 {
2285
2286
2288
2289
2291
2292
2294
2295
2297
2299
2300
2302
2303
2305
2306
2307 if (construtionPart.
IsBase())
2308 {
2309
2311 }
2312 }
2313
2315 {
2316
2318 }
2319
2320
2322 {
2324
2327 }
2328
2330 {
2332
2334 {
2336 }
2337 else
2338 {
2340 }
2341
2343 }
2344
2346 {
2348
2350 foreach (
string slotName : attachmentSlots)
2351 {
2353 }
2354
2355
2358 else
2360
2362 }
2363
2365 {
2366 string slotNameMounted = slot_name + "_Mounted";
2367 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2368
2369 if (attachment)
2370 {
2371 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2372 if (barbedWire && barbedWire.IsMounted())
2374 else
2376
2377 if (is_locked)
2378 {
2379 SetAnimationPhase(slotNameMounted, 0);
2380 SetAnimationPhase(slot_name, 1);
2381 }
2382 else
2383 {
2384 SetAnimationPhase(slotNameMounted, 1);
2385 SetAnimationPhase(slot_name, 0);
2386 }
2387 }
2388 else
2389 {
2390 SetAnimationPhase(slotNameMounted, 1);
2391 SetAnimationPhase(slot_name, 1);
2392
2394 }
2395 }
2396
2397
2399 {
2402
2405
2408
2409 foreach (
string slotName : attachmentSlots)
2410 {
2412 }
2413
2414
2416 {
2419
2421 }
2422 else
2423 {
2426
2428 }
2429
2432 }
2433
2435 {
2436
2438 return;
2439
2440 string slot_name_mounted = slot_name + "_Mounted";
2441 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2442
2443
2445 RemoveProxyPhysics( slot_name_mounted );
2446 RemoveProxyPhysics( slot_name );
2447
2448 if ( attachment )
2449 {
2451 if ( is_locked )
2452 {
2454 AddProxyPhysics( slot_name_mounted );
2455 }
2456 else
2457 {
2459 AddProxyPhysics( slot_name );
2460 }
2461 }
2462 }
2463
2465 {
2466 SetAffectPathgraph( true, false );
2468 }
2469
2471 {
2472 return true;
2473 }
2474
2476 {
2477 return true;
2478 }
2479
2481 {
2482 if ( attachment )
2483 {
2485 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2486
2487 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2488 }
2489
2490 return false;
2491 }
2492
2494 {
2496 }
2497
2498
2500 {
2501 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2502 if (
g_Game.ConfigIsExisting( config_path ) )
2503 {
2504 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2505 }
2506 }
2507
2509 {
2510 return true;
2511 }
2512
2514 {
2515 return true;
2516 }
2517
2519 {
2520 return true;
2521 }
2522
2523
2525 {
2528 }
2529
2531 {
2533 }
2534
2536 {
2538 }
2539
2541 {
2542 int attachment_count = GetInventory().AttachmentCount();
2543 if ( attachment_count > 0 )
2544 {
2545 if (
HasBase() && attachment_count == 1 )
2546 {
2547 return false;
2548 }
2549
2550 return true;
2551 }
2552
2553 return false;
2554 }
2555
2557 {
2558 return true;
2559 }
2560
2562 {
2563 return false;
2564 }
2565
2566
2568 {
2569 return false;
2570 }
2571
2573 {
2574 return false;
2575 }
2576
2577
2579 {
2580 return false;
2581 }
2582
2583
2584
2586 {
2587 return true;
2588 }
2589
2591 {
2592 return true;
2593 }
2594
2597 {
2598 return false;
2599 }
2600
2601
2603 {
2604 return false;
2605 }
2606
2607
2609 {
2610 return true;
2611 }
2612
2613
2615 {
2616 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2617 {
2618 return false;
2619 }
2620
2621 return true;
2622 }
2623
2625 {
2628
2629 return item;
2630 }
2631
2632
2634 {
2636 {
2637
2639
2640
2643
2645 if ( MemoryPointExists( slot_name + "_min" ) )
2646 {
2647 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2648 }
2649 if ( MemoryPointExists( slot_name + "_max" ) )
2650 {
2651 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2652 }
2653
2654
2657
2658
2661 center = ModelToWorld( center );
2662
2663
2666
2667 areaDamage.SetExtents( extents[0], extents[1] );
2668 areaDamage.SetAreaPosition( center );
2672 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2673 areaDamage.SetAmmoName( "BarbedWireHit" );
2674 areaDamage.Spawn();
2675
2677 }
2678 }
2679
2681 {
2682 if ( angle_deg != 0 )
2683 {
2684
2686
2687
2689 if ( MemoryPointExists( "rotate_axis" ) )
2690 {
2691 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2692 }
2693 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];
2694 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];
2695 center[0] = r_center_x;
2696 center[2] = r_center_z;
2697 }
2698 }
2699
2701 {
2703 {
2706 {
2707 if (areaDamage)
2708 {
2709 areaDamage.Destroy();
2710 }
2711
2713 }
2714 }
2715 }
2716
2718 {
2719 return true;
2720 }
2721
2722
2723
2724
2726 {
2728 }
2729
2731 {
2733 }
2734
2736 {
2738 }
2739
2741 {
2743
2744 switch ( material_type )
2745 {
2751 }
2752
2753 return "";
2754 }
2755
2757 {
2759
2760 switch ( material_type )
2761 {
2767 }
2768
2769 return "";
2770 }
2771
2772
2774 {
2776 {
2777
2779 {
2780 SetHealth(slot_name,"Health",item.GetHealth());
2781 }
2782 }
2783 }
2784
2786 {
2787 return 111;
2788 }
2789
2791 {
2792 super.SetActions();
2793
2797 }
2798
2800 {
2802 if (!construction)
2803 return;
2804
2806 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2807 {
2810 {
2812 }
2813 }
2814 }
2815
2817 {
2819 if (!construction)
2820 return;
2821
2823 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2824 {
2827 {
2828 construction.HandleEntityFalling(part.
GetPartName());
2829 }
2830 }
2831 }
2832
2835 {
2837 return;
2838
2841
2842 if (DestroyOnFall())
2843 {
2845 {
2847 }
2848 else
2849 {
2851 {
2853 }
2855 }
2856 }
2857 }
2858
2860 {
2861 if (HasAnyAttachmentsOrCargo())
2862 {
2865 }
2866 }
2867
2868
2869
2870
2871
2874 {
2875 return null;
2876 }
2877
2879 {
2881 }
2882
2884 {
2887
2888 Man p;
2889
2890 #ifdef SERVER
2892 g_Game.GetWorld().GetPlayerList(players);
2893 if (players.Count())
2894 p = players[0];
2895 #else
2897 #endif
2898
2900 {
2901 bool excluded = false;
2903 if (excludes)
2904 {
2905 foreach (string exclude : excludes)
2906 {
2908 {
2909 excluded = true;
2910 break;
2911 }
2912 }
2913 }
2914
2915 if (!excluded)
2916 {
2918 }
2919 }
2920
2922 }
2923
2925
2927 [
Obsolete(
"handled in the Construction component directly")]
2929 {
2930 }
2931
2932 [
Obsolete(
"handled in the Construction component directly")]
2934 {
2935 }
2936
2937 [
Obsolete(
"obsolete debug method")]
2939 {
2940 }
2941}
2942
2944{
2945#ifdef BSB_DEBUG
2947#else
2948
2949#endif
2950}
2952{
2953#ifdef BSB_DEBUG_SPAM
2955#else
2956
2957#endif
2958}
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.