1710{
1712
1714
1716
1723
1724
1725
1731
1737
1739
1743
1744
1746 {
1748
1749
1750 RegisterNetSyncVariableInt( "m_SyncParts01" );
1751 RegisterNetSyncVariableInt( "m_SyncParts02" );
1752 RegisterNetSyncVariableInt( "m_SyncParts03" );
1753 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1754 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1755 RegisterNetSyncVariableBool( "m_HasBase" );
1756
1757
1758 ConstructionInit();
1759
1760 if (ConfigIsExisting("hybridAttachments"))
1761 {
1764 }
1765 if (ConfigIsExisting("mountables"))
1766 {
1769 }
1770
1772 SetAllowDamage(true);
1773 }
1774
1776 {
1777 return "disableBaseDamage";
1778 }
1779
1781 {
1782 return true;
1783 }
1784
1786 {
1787 return EInventoryIconVisibility.HIDE_VICINITY;
1788 }
1789
1791 {
1792 super.InitItemSounds();
1793
1797
1802 }
1803
1805 {
1806 return "putDown_FenceKit_SoundSet";
1807 }
1808
1810 {
1811 return "Shelter_Site_Build_Loop_SoundSet";
1812 }
1813
1814
1816 {
1818 {
1819 SetSynchDirty();
1820 }
1821 }
1822
1824 {
1826 super.OnVariablesSynchronized();
1827
1829 }
1830
1832 {
1833
1835
1836
1838
1839
1841 }
1842
1843
1845 {
1846
1847 int offset;
1848 int mask;
1849
1850 if ( part_id >= 1 && part_id <= 31 )
1851 {
1852 offset = part_id - 1;
1853 mask = 1 << offset;
1854
1856 }
1857 else if ( part_id >= 32 && part_id <= 62 )
1858 {
1859 offset = ( part_id % 32 );
1860 mask = 1 << offset;
1861
1863 }
1864 else if ( part_id >= 63 && part_id <= 93 )
1865 {
1866 offset = ( part_id % 63 );
1867 mask = 1 << offset;
1868
1870 }
1871 }
1872
1874 {
1875
1876 int offset;
1877 int mask;
1878
1879 if ( part_id >= 1 && part_id <= 31 )
1880 {
1881 offset = part_id - 1;
1882 mask = 1 << offset;
1883
1885 }
1886 else if ( part_id >= 32 && part_id <= 62 )
1887 {
1888 offset = ( part_id % 32 );
1889 mask = 1 << offset;
1890
1892 }
1893 else if ( part_id >= 63 && part_id <= 93 )
1894 {
1895 offset = ( part_id % 63 );
1896 mask = 1 << offset;
1897
1899 }
1900 }
1901
1903 {
1904
1905 int offset;
1906 int mask;
1907
1908 if ( part_id >= 1 && part_id <= 31 )
1909 {
1910 offset = part_id - 1;
1911 mask = 1 << offset;
1912
1914 {
1915 return true;
1916 }
1917 }
1918 else if ( part_id >= 32 && part_id <= 62 )
1919 {
1920 offset = ( part_id % 32 );
1921 mask = 1 << offset;
1922
1924 {
1925 return true;
1926 }
1927 }
1928 else if ( part_id >= 63 && part_id <= 93 )
1929 {
1930 offset = ( part_id % 63 );
1931 mask = 1 << offset;
1932
1934 {
1935 return true;
1936 }
1937 }
1938
1939 return false;
1940 }
1941
1943 {
1946 }
1947
1949 {
1950
1953 }
1954
1956 {
1958 {
1961
1962 switch( build_action_id )
1963 {
1967 }
1968 }
1969 }
1970
1971
1973 {
1975 bool is_base = part.
IsBase();
1978 if ( is_part_built_sync )
1979 {
1981 {
1985
1986 if (is_base)
1987 {
1990 }
1991 }
1992 }
1993 else
1994 {
1996 {
2000
2001 if (is_base)
2002 {
2005 }
2006 }
2007 }
2008
2009
2011 }
2012
2013
2015 {
2018
2019 for ( int i = 0; i < construction_parts.Count(); ++i )
2020 {
2021 string key = construction_parts.GetKey( i );
2024 }
2025
2026
2028 }
2029
2031 {
2034
2035 for ( int i = 0; i < construction_parts.Count(); ++i )
2036 {
2037 string key = construction_parts.GetKey( i );
2039
2040 if ( value.
GetId() ==
id )
2041 {
2042 return value;
2043 }
2044 }
2045
2046 return NULL;
2047 }
2048
2049
2050
2052 {
2054 }
2055
2057 {
2059 }
2060
2062 {
2063 return true;
2064 }
2065
2067 {
2068 return false;
2069 }
2070
2071
2073 {
2076 {
2078 }
2079
2080 return construction_kit;
2081 }
2082
2084 {
2087 {
2089 }
2090 }
2091
2093 {
2095 }
2096
2098 {
2099 return "";
2100 }
2101
2103 {
2105 g_Game.ObjectDelete( construction_kit );
2106 }
2107
2108
2110 {
2112 g_Game.ObjectDelete(
this );
2113 }
2114
2115
2117 {
2118 super.EEDelete(parent);
2119
2121 {
2122 areaDamage.Destroy();
2123 }
2124
2125 }
2126
2128 {
2129 super.OnStoreSave( ctx );
2130
2131
2135
2137 }
2138
2140 {
2141 if ( !super.OnStoreLoad( ctx, version ) )
2142 return false;
2143
2144
2145
2147 {
2149 return false;
2150 }
2152 {
2154 return false;
2155 }
2157 {
2159 return false;
2160 }
2161
2162
2164 {
2166 return false;
2167 }
2168
2169
2170 return true;
2171 }
2172
2174 {
2175 super.AfterStoreLoad();
2176
2178 {
2180 }
2181 }
2182
2184 {
2185
2187
2188
2191
2192
2194 }
2195
2197 {
2198 super.OnCreatePhysics();
2199
2200 ConstructionInit();
2202 }
2203
2205 {
2207 return;
2208
2209 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2210 }
2211
2213 {
2215 {
2217 }
2218
2219 super.EEOnAfterLoad();
2220 }
2221
2223 {
2224 super.EEItemAttached( item, slot_name );
2225
2229 }
2230
2232 {
2233 super.EEItemDetached( item, slot_name );
2234
2237 }
2238
2239 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2240 {
2243
2246 }
2247
2248
2250 {
2251 return true;
2252 }
2253
2254
2255
2257 {
2259
2260
2261 if (construtionPart.
IsBase())
2262 {
2264
2265
2267 }
2268
2269
2271
2272
2274
2275
2277
2279
2281
2282
2284
2285
2287 }
2288
2290 {
2291
2293 }
2294
2295
2297 {
2300
2301
2303
2304
2306
2307
2309
2310
2312
2314
2315
2317
2318
2320
2321
2322 if (construtionPart.
IsBase())
2323 {
2324
2326 }
2327 }
2328
2330 {
2331
2333 }
2334
2335
2336 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2337 {
2340
2341
2343
2344
2346
2347
2349
2350
2352
2354
2355
2357
2358
2360
2361
2362 if (construtionPart.
IsBase())
2363 {
2364
2366 }
2367 }
2368
2370 {
2371
2373 }
2374
2375
2377 {
2379
2382 }
2383
2385 {
2387
2389 {
2391 }
2392 else
2393 {
2395 }
2396
2398 }
2399
2401 {
2403
2405 foreach (
string slotName : attachmentSlots)
2406 {
2408 }
2409
2410
2413 else
2415
2417 }
2418
2420 {
2421 string slotNameMounted = slot_name + "_Mounted";
2422 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2423
2424 if (attachment)
2425 {
2426 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2427 if (barbedWire && barbedWire.IsMounted())
2429 else
2431
2432 if (is_locked)
2433 {
2434 SetAnimationPhase(slotNameMounted, 0);
2435 SetAnimationPhase(slot_name, 1);
2436 }
2437 else
2438 {
2439 SetAnimationPhase(slotNameMounted, 1);
2440 SetAnimationPhase(slot_name, 0);
2441 }
2442 }
2443 else
2444 {
2445 SetAnimationPhase(slotNameMounted, 1);
2446 SetAnimationPhase(slot_name, 1);
2447
2449 }
2450 }
2451
2452
2454 {
2457
2460
2463
2464 foreach (
string slotName : attachmentSlots)
2465 {
2467 }
2468
2469
2471 {
2474
2476 }
2477 else
2478 {
2481
2483 }
2484
2487 }
2488
2490 {
2491
2493 return;
2494
2495 string slot_name_mounted = slot_name + "_Mounted";
2496 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2497
2498
2500 RemoveProxyPhysics( slot_name_mounted );
2501 RemoveProxyPhysics( slot_name );
2502
2503 if ( attachment )
2504 {
2506 if ( is_locked )
2507 {
2509 AddProxyPhysics( slot_name_mounted );
2510 }
2511 else
2512 {
2514 AddProxyPhysics( slot_name );
2515 }
2516 }
2517 }
2518
2520 {
2521 SetAffectPathgraph( true, false );
2523 }
2524
2526 {
2527 return true;
2528 }
2529
2531 {
2532 return true;
2533 }
2534
2536 {
2537 if ( attachment )
2538 {
2540 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2541
2542 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2543 }
2544
2545 return false;
2546 }
2547
2549 {
2551 }
2552
2553
2555 {
2556 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2557 if (
g_Game.ConfigIsExisting( config_path ) )
2558 {
2559 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2560 }
2561 }
2562
2564 {
2565 return true;
2566 }
2567
2569 {
2570 return true;
2571 }
2572
2574 {
2575 return true;
2576 }
2577
2578
2580 {
2583 }
2584
2586 {
2588 }
2589
2591 {
2593 }
2594
2596 {
2597 int attachment_count = GetInventory().AttachmentCount();
2598 if ( attachment_count > 0 )
2599 {
2600 if (
HasBase() && attachment_count == 1 )
2601 {
2602 return false;
2603 }
2604
2605 return true;
2606 }
2607
2608 return false;
2609 }
2610
2612 {
2613 return true;
2614 }
2615
2617 {
2618 return false;
2619 }
2620
2621
2623 {
2624 return false;
2625 }
2626
2628 {
2629 return false;
2630 }
2631
2632
2634 {
2635 return false;
2636 }
2637
2638
2639
2641 {
2642 return true;
2643 }
2644
2646 {
2647 return true;
2648 }
2649
2652 {
2653 return false;
2654 }
2655
2656
2658 {
2659 return false;
2660 }
2661
2662
2664 {
2665 return true;
2666 }
2667
2668
2670 {
2671 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2672 {
2673 return false;
2674 }
2675
2676 return true;
2677 }
2678
2680 {
2683
2684 return item;
2685 }
2686
2687
2689 {
2691 {
2692
2694
2695
2698
2700 if ( MemoryPointExists( slot_name + "_min" ) )
2701 {
2702 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2703 }
2704 if ( MemoryPointExists( slot_name + "_max" ) )
2705 {
2706 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2707 }
2708
2709
2712
2713
2716 center = ModelToWorld( center );
2717
2718
2721
2722 areaDamage.SetExtents( extents[0], extents[1] );
2723 areaDamage.SetAreaPosition( center );
2727 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2728 areaDamage.SetAmmoName( "BarbedWireHit" );
2729 areaDamage.Spawn();
2730
2732 }
2733 }
2734
2736 {
2737 if ( angle_deg != 0 )
2738 {
2739
2741
2742
2744 if ( MemoryPointExists( "rotate_axis" ) )
2745 {
2746 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2747 }
2748 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];
2749 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];
2750 center[0] = r_center_x;
2751 center[2] = r_center_z;
2752 }
2753 }
2754
2756 {
2758 {
2761 {
2762 if (areaDamage)
2763 {
2764 areaDamage.Destroy();
2765 }
2766
2768 }
2769 }
2770 }
2771
2773 {
2774 return true;
2775 }
2776
2777
2778
2779
2781 {
2783 }
2784
2786 {
2788 }
2789
2791 {
2793 }
2794
2796 {
2798
2799 switch ( material_type )
2800 {
2806 }
2807
2808 return "";
2809 }
2810
2812 {
2814
2815 switch ( material_type )
2816 {
2822 }
2823
2824 return "";
2825 }
2826
2827
2829 {
2831 {
2832
2834 {
2835 SetHealth(slot_name,"Health",item.GetHealth());
2836 }
2837 }
2838 }
2839
2841 {
2842 return 111;
2843 }
2844
2846 {
2847 super.SetActions();
2848
2852 }
2853
2855 {
2857 if (!construction)
2858 return;
2859
2861 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2862 {
2865 {
2867 }
2868 }
2869 }
2870
2872 {
2874 if (!construction)
2875 return;
2876
2878 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2879 {
2882 {
2883 construction.HandleEntityFalling(part.
GetPartName());
2884 }
2885 }
2886 }
2887
2890 {
2892 return;
2893
2896
2897 if (DestroyOnFall())
2898 {
2900 {
2902 }
2903 else
2904 {
2906 {
2908 }
2910 }
2911 }
2912 }
2913
2915 {
2916 if (HasAnyAttachmentsOrCargo())
2917 {
2920 }
2921 }
2922
2923
2924
2925
2926
2929 {
2930 return null;
2931 }
2932
2934 {
2936 }
2937
2939 {
2942
2943 Man p;
2944
2945 #ifdef SERVER
2947 g_Game.GetWorld().GetPlayerList(players);
2948 if (players.Count())
2949 p = players[0];
2950 #else
2952 #endif
2953
2955 {
2956 bool excluded = false;
2958 if (excludes)
2959 {
2960 foreach (string exclude : excludes)
2961 {
2963 {
2964 excluded = true;
2965 break;
2966 }
2967 }
2968 }
2969
2970 if (!excluded)
2971 {
2973 }
2974 }
2975
2977 }
2978
2980
2982 [
Obsolete(
"handled in the Construction component directly")]
2984 {
2985 }
2986
2987 [
Obsolete(
"handled in the Construction component directly")]
2989 {
2990 }
2991
2992 [
Obsolete(
"obsolete debug method")]
2994 {
2995 }
2996}
2997
2999{
3000#ifdef BSB_DEBUG
3002#else
3003
3004#endif
3005}
3007{
3008#ifdef BSB_DEBUG_SPAM
3010#else
3011
3012#endif
3013}
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.