1685{
1687
1689
1691
1698
1699
1700
1706
1712
1714
1718
1719
1721 {
1723
1724
1725 RegisterNetSyncVariableInt( "m_SyncParts01" );
1726 RegisterNetSyncVariableInt( "m_SyncParts02" );
1727 RegisterNetSyncVariableInt( "m_SyncParts03" );
1728 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1729 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1730 RegisterNetSyncVariableBool( "m_HasBase" );
1731
1732
1733 ConstructionInit();
1734
1735 if (ConfigIsExisting("hybridAttachments"))
1736 {
1739 }
1740 if (ConfigIsExisting("mountables"))
1741 {
1744 }
1745
1747 SetAllowDamage(true);
1748 }
1749
1751 {
1752 return "disableBaseDamage";
1753 }
1754
1756 {
1757 return true;
1758 }
1759
1761 {
1762 return EInventoryIconVisibility.HIDE_VICINITY;
1763 }
1764
1766 {
1767 super.InitItemSounds();
1768
1772
1777 }
1778
1780 {
1781 return "putDown_FenceKit_SoundSet";
1782 }
1783
1785 {
1786 return "Shelter_Site_Build_Loop_SoundSet";
1787 }
1788
1789
1791 {
1793 {
1794 SetSynchDirty();
1795 }
1796 }
1797
1799 {
1801 super.OnVariablesSynchronized();
1802
1804 }
1805
1807 {
1808
1810
1811
1813
1814
1816 }
1817
1818
1820 {
1821
1822 int offset;
1823 int mask;
1824
1825 if ( part_id >= 1 && part_id <= 31 )
1826 {
1827 offset = part_id - 1;
1828 mask = 1 << offset;
1829
1831 }
1832 else if ( part_id >= 32 && part_id <= 62 )
1833 {
1834 offset = ( part_id % 32 );
1835 mask = 1 << offset;
1836
1838 }
1839 else if ( part_id >= 63 && part_id <= 93 )
1840 {
1841 offset = ( part_id % 63 );
1842 mask = 1 << offset;
1843
1845 }
1846 }
1847
1849 {
1850
1851 int offset;
1852 int mask;
1853
1854 if ( part_id >= 1 && part_id <= 31 )
1855 {
1856 offset = part_id - 1;
1857 mask = 1 << offset;
1858
1860 }
1861 else if ( part_id >= 32 && part_id <= 62 )
1862 {
1863 offset = ( part_id % 32 );
1864 mask = 1 << offset;
1865
1867 }
1868 else if ( part_id >= 63 && part_id <= 93 )
1869 {
1870 offset = ( part_id % 63 );
1871 mask = 1 << offset;
1872
1874 }
1875 }
1876
1878 {
1879
1880 int offset;
1881 int mask;
1882
1883 if ( part_id >= 1 && part_id <= 31 )
1884 {
1885 offset = part_id - 1;
1886 mask = 1 << offset;
1887
1889 {
1890 return true;
1891 }
1892 }
1893 else if ( part_id >= 32 && part_id <= 62 )
1894 {
1895 offset = ( part_id % 32 );
1896 mask = 1 << offset;
1897
1899 {
1900 return true;
1901 }
1902 }
1903 else if ( part_id >= 63 && part_id <= 93 )
1904 {
1905 offset = ( part_id % 63 );
1906 mask = 1 << offset;
1907
1909 {
1910 return true;
1911 }
1912 }
1913
1914 return false;
1915 }
1916
1918 {
1921 }
1922
1924 {
1925
1928 }
1929
1931 {
1933 {
1936
1937 switch( build_action_id )
1938 {
1942 }
1943 }
1944 }
1945
1946
1948 {
1950 bool is_base = part.
IsBase();
1953 if ( is_part_built_sync )
1954 {
1956 {
1960
1961 if (is_base)
1962 {
1965 }
1966 }
1967 }
1968 else
1969 {
1971 {
1975
1976 if (is_base)
1977 {
1980 }
1981 }
1982 }
1983
1984
1986 }
1987
1988
1990 {
1993
1994 for ( int i = 0; i < construction_parts.Count(); ++i )
1995 {
1996 string key = construction_parts.GetKey( i );
1999 }
2000
2001
2003 }
2004
2006 {
2009
2010 for ( int i = 0; i < construction_parts.Count(); ++i )
2011 {
2012 string key = construction_parts.GetKey( i );
2014
2015 if ( value.
GetId() ==
id )
2016 {
2017 return value;
2018 }
2019 }
2020
2021 return NULL;
2022 }
2023
2024
2025
2027 {
2029 }
2030
2032 {
2034 }
2035
2037 {
2038 return true;
2039 }
2040
2042 {
2043 return false;
2044 }
2045
2046
2048 {
2051 {
2053 }
2054
2055 return construction_kit;
2056 }
2057
2059 {
2062 {
2064 }
2065 }
2066
2068 {
2070 }
2071
2073 {
2074 return "";
2075 }
2076
2078 {
2080 g_Game.ObjectDelete( construction_kit );
2081 }
2082
2083
2085 {
2087 g_Game.ObjectDelete(
this );
2088 }
2089
2090
2092 {
2093 super.EEDelete(parent);
2094
2096 {
2097 areaDamage.Destroy();
2098 }
2099
2100 }
2101
2103 {
2104 super.OnStoreSave( ctx );
2105
2106
2110
2112 }
2113
2115 {
2116 if ( !super.OnStoreLoad( ctx, version ) )
2117 return false;
2118
2119
2120
2122 {
2124 return false;
2125 }
2127 {
2129 return false;
2130 }
2132 {
2134 return false;
2135 }
2136
2137
2139 {
2141 return false;
2142 }
2143
2144
2145 return true;
2146 }
2147
2149 {
2150 super.AfterStoreLoad();
2151
2153 {
2155 }
2156 }
2157
2159 {
2160
2162
2163
2166
2167
2169 }
2170
2172 {
2173 super.OnCreatePhysics();
2174
2175 ConstructionInit();
2177 }
2178
2180 {
2182 return;
2183
2184 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2185 }
2186
2188 {
2190 {
2192 }
2193
2194 super.EEOnAfterLoad();
2195 }
2196
2198 {
2199 super.EEItemAttached( item, slot_name );
2200
2204 }
2205
2207 {
2208 super.EEItemDetached( item, slot_name );
2209
2212 }
2213
2214 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2215 {
2218
2221 }
2222
2223
2225 {
2226 return true;
2227 }
2228
2229
2230
2232 {
2234
2235
2236 if (construtionPart.
IsBase())
2237 {
2239
2240
2242 }
2243
2244
2246
2247
2249
2250
2252
2254
2256
2257
2259
2260
2262 }
2263
2265 {
2266
2268 }
2269
2270
2272 {
2275
2276
2278
2279
2281
2282
2284
2285
2287
2289
2290
2292
2293
2295
2296
2297 if (construtionPart.
IsBase())
2298 {
2299
2301 }
2302 }
2303
2305 {
2306
2308 }
2309
2310
2311 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2312 {
2315
2316
2318
2319
2321
2322
2324
2325
2327
2329
2330
2332
2333
2335
2336
2337 if (construtionPart.
IsBase())
2338 {
2339
2341 }
2342 }
2343
2345 {
2346
2348 }
2349
2350
2352 {
2354
2357 }
2358
2360 {
2362
2364 {
2366 }
2367 else
2368 {
2370 }
2371
2373 }
2374
2376 {
2378
2380 foreach (
string slotName : attachmentSlots)
2381 {
2383 }
2384
2385
2388 else
2390
2392 }
2393
2395 {
2396 string slotNameMounted = slot_name + "_Mounted";
2397 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2398
2399 if (attachment)
2400 {
2401 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2402 if (barbedWire && barbedWire.IsMounted())
2404 else
2406
2407 if (is_locked)
2408 {
2409 SetAnimationPhase(slotNameMounted, 0);
2410 SetAnimationPhase(slot_name, 1);
2411 }
2412 else
2413 {
2414 SetAnimationPhase(slotNameMounted, 1);
2415 SetAnimationPhase(slot_name, 0);
2416 }
2417 }
2418 else
2419 {
2420 SetAnimationPhase(slotNameMounted, 1);
2421 SetAnimationPhase(slot_name, 1);
2422
2424 }
2425 }
2426
2427
2429 {
2432
2435
2438
2439 foreach (
string slotName : attachmentSlots)
2440 {
2442 }
2443
2444
2446 {
2449
2451 }
2452 else
2453 {
2456
2458 }
2459
2462 }
2463
2465 {
2466
2468 return;
2469
2470 string slot_name_mounted = slot_name + "_Mounted";
2471 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2472
2473
2475 RemoveProxyPhysics( slot_name_mounted );
2476 RemoveProxyPhysics( slot_name );
2477
2478 if ( attachment )
2479 {
2481 if ( is_locked )
2482 {
2484 AddProxyPhysics( slot_name_mounted );
2485 }
2486 else
2487 {
2489 AddProxyPhysics( slot_name );
2490 }
2491 }
2492 }
2493
2495 {
2496 SetAffectPathgraph( true, false );
2498 }
2499
2501 {
2502 return true;
2503 }
2504
2506 {
2507 return true;
2508 }
2509
2511 {
2512 if ( attachment )
2513 {
2515 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2516
2517 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2518 }
2519
2520 return false;
2521 }
2522
2524 {
2526 }
2527
2528
2530 {
2531 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2532 if (
g_Game.ConfigIsExisting( config_path ) )
2533 {
2534 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2535 }
2536 }
2537
2539 {
2540 return true;
2541 }
2542
2544 {
2545 return true;
2546 }
2547
2549 {
2550 return true;
2551 }
2552
2553
2555 {
2558 }
2559
2561 {
2563 }
2564
2566 {
2568 }
2569
2571 {
2572 int attachment_count = GetInventory().AttachmentCount();
2573 if ( attachment_count > 0 )
2574 {
2575 if (
HasBase() && attachment_count == 1 )
2576 {
2577 return false;
2578 }
2579
2580 return true;
2581 }
2582
2583 return false;
2584 }
2585
2587 {
2588 return true;
2589 }
2590
2592 {
2593 return false;
2594 }
2595
2596
2598 {
2599 return false;
2600 }
2601
2603 {
2604 return false;
2605 }
2606
2607
2609 {
2610 return false;
2611 }
2612
2613
2614
2616 {
2617 return true;
2618 }
2619
2621 {
2622 return true;
2623 }
2624
2627 {
2628 return false;
2629 }
2630
2631
2633 {
2634 return false;
2635 }
2636
2637
2639 {
2640 return true;
2641 }
2642
2643
2645 {
2646 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2647 {
2648 return false;
2649 }
2650
2651 return true;
2652 }
2653
2655 {
2658
2659 return item;
2660 }
2661
2662
2664 {
2666 {
2667
2669
2670
2673
2675 if ( MemoryPointExists( slot_name + "_min" ) )
2676 {
2677 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2678 }
2679 if ( MemoryPointExists( slot_name + "_max" ) )
2680 {
2681 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2682 }
2683
2684
2687
2688
2691 center = ModelToWorld( center );
2692
2693
2696
2697 areaDamage.SetExtents( extents[0], extents[1] );
2698 areaDamage.SetAreaPosition( center );
2702 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2703 areaDamage.SetAmmoName( "BarbedWireHit" );
2704 areaDamage.Spawn();
2705
2707 }
2708 }
2709
2711 {
2712 if ( angle_deg != 0 )
2713 {
2714
2716
2717
2719 if ( MemoryPointExists( "rotate_axis" ) )
2720 {
2721 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2722 }
2723 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];
2724 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];
2725 center[0] = r_center_x;
2726 center[2] = r_center_z;
2727 }
2728 }
2729
2731 {
2733 {
2736 {
2737 if (areaDamage)
2738 {
2739 areaDamage.Destroy();
2740 }
2741
2743 }
2744 }
2745 }
2746
2748 {
2749 return true;
2750 }
2751
2752
2753
2754
2756 {
2758 }
2759
2761 {
2763 }
2764
2766 {
2768 }
2769
2771 {
2773
2774 switch ( material_type )
2775 {
2781 }
2782
2783 return "";
2784 }
2785
2787 {
2789
2790 switch ( material_type )
2791 {
2797 }
2798
2799 return "";
2800 }
2801
2802
2804 {
2806 {
2807
2809 {
2810 SetHealth(slot_name,"Health",item.GetHealth());
2811 }
2812 }
2813 }
2814
2816 {
2817 return 111;
2818 }
2819
2821 {
2822 super.SetActions();
2823
2827 }
2828
2830 {
2832 if (!construction)
2833 return;
2834
2836 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2837 {
2840 {
2842 }
2843 }
2844 }
2845
2847 {
2849 if (!construction)
2850 return;
2851
2853 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2854 {
2857 {
2858 construction.HandleEntityFalling(part.
GetPartName());
2859 }
2860 }
2861 }
2862
2865 {
2867 return;
2868
2871
2872 if (DestroyOnFall())
2873 {
2875 {
2877 }
2878 else
2879 {
2881 {
2883 }
2885 }
2886 }
2887 }
2888
2890 {
2891 if (HasAnyAttachmentsOrCargo())
2892 {
2895 }
2896 }
2897
2898
2899
2900
2901
2904 {
2905 return null;
2906 }
2907
2909 {
2911 }
2912
2914 {
2917
2918 Man p;
2919
2920 #ifdef SERVER
2922 g_Game.GetWorld().GetPlayerList(players);
2923 if (players.Count())
2924 p = players[0];
2925 #else
2927 #endif
2928
2930 {
2931 bool excluded = false;
2933 if (excludes)
2934 {
2935 foreach (string exclude : excludes)
2936 {
2938 {
2939 excluded = true;
2940 break;
2941 }
2942 }
2943 }
2944
2945 if (!excluded)
2946 {
2948 }
2949 }
2950
2952 }
2953
2955
2957 [
Obsolete(
"handled in the Construction component directly")]
2959 {
2960 }
2961
2962 [
Obsolete(
"handled in the Construction component directly")]
2964 {
2965 }
2966
2967 [
Obsolete(
"obsolete debug method")]
2969 {
2970 }
2971}
2972
2974{
2975#ifdef BSB_DEBUG
2977#else
2978
2979#endif
2980}
2982{
2983#ifdef BSB_DEBUG_SPAM
2985#else
2986
2987#endif
2988}
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.