1692{
1694
1696
1698
1705
1706
1707
1713
1719
1721
1725
1726
1728 {
1730
1731
1732 RegisterNetSyncVariableInt( "m_SyncParts01" );
1733 RegisterNetSyncVariableInt( "m_SyncParts02" );
1734 RegisterNetSyncVariableInt( "m_SyncParts03" );
1735 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1736 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1737 RegisterNetSyncVariableBool( "m_HasBase" );
1738
1739
1740 ConstructionInit();
1741
1742 if (ConfigIsExisting("hybridAttachments"))
1743 {
1746 }
1747 if (ConfigIsExisting("mountables"))
1748 {
1751 }
1752
1754 SetAllowDamage(true);
1755 }
1756
1758 {
1759 return "disableBaseDamage";
1760 }
1761
1763 {
1764 return true;
1765 }
1766
1768 {
1769 return EInventoryIconVisibility.HIDE_VICINITY;
1770 }
1771
1773 {
1774 super.InitItemSounds();
1775
1779
1784 }
1785
1787 {
1788 return "putDown_FenceKit_SoundSet";
1789 }
1790
1792 {
1793 return "Shelter_Site_Build_Loop_SoundSet";
1794 }
1795
1796
1798 {
1800 {
1801 SetSynchDirty();
1802 }
1803 }
1804
1806 {
1808 super.OnVariablesSynchronized();
1809
1811 }
1812
1814 {
1815
1817
1818
1820
1821
1823 }
1824
1825
1827 {
1828
1829 int offset;
1830 int mask;
1831
1832 if ( part_id >= 1 && part_id <= 31 )
1833 {
1834 offset = part_id - 1;
1835 mask = 1 << offset;
1836
1838 }
1839 else if ( part_id >= 32 && part_id <= 62 )
1840 {
1841 offset = ( part_id % 32 );
1842 mask = 1 << offset;
1843
1845 }
1846 else if ( part_id >= 63 && part_id <= 93 )
1847 {
1848 offset = ( part_id % 63 );
1849 mask = 1 << offset;
1850
1852 }
1853 }
1854
1856 {
1857
1858 int offset;
1859 int mask;
1860
1861 if ( part_id >= 1 && part_id <= 31 )
1862 {
1863 offset = part_id - 1;
1864 mask = 1 << offset;
1865
1867 }
1868 else if ( part_id >= 32 && part_id <= 62 )
1869 {
1870 offset = ( part_id % 32 );
1871 mask = 1 << offset;
1872
1874 }
1875 else if ( part_id >= 63 && part_id <= 93 )
1876 {
1877 offset = ( part_id % 63 );
1878 mask = 1 << offset;
1879
1881 }
1882 }
1883
1885 {
1886
1887 int offset;
1888 int mask;
1889
1890 if ( part_id >= 1 && part_id <= 31 )
1891 {
1892 offset = part_id - 1;
1893 mask = 1 << offset;
1894
1896 {
1897 return true;
1898 }
1899 }
1900 else if ( part_id >= 32 && part_id <= 62 )
1901 {
1902 offset = ( part_id % 32 );
1903 mask = 1 << offset;
1904
1906 {
1907 return true;
1908 }
1909 }
1910 else if ( part_id >= 63 && part_id <= 93 )
1911 {
1912 offset = ( part_id % 63 );
1913 mask = 1 << offset;
1914
1916 {
1917 return true;
1918 }
1919 }
1920
1921 return false;
1922 }
1923
1925 {
1928 }
1929
1931 {
1932
1935 }
1936
1938 {
1940 {
1943
1944 switch( build_action_id )
1945 {
1949 }
1950 }
1951 }
1952
1953
1955 {
1957 bool is_base = part.
IsBase();
1960 if ( is_part_built_sync )
1961 {
1963 {
1967
1968 if (is_base)
1969 {
1972 }
1973 }
1974 }
1975 else
1976 {
1978 {
1982
1983 if (is_base)
1984 {
1987 }
1988 }
1989 }
1990
1991
1993 }
1994
1995
1997 {
2000
2001 for ( int i = 0; i < construction_parts.Count(); ++i )
2002 {
2003 string key = construction_parts.GetKey( i );
2006 }
2007
2008
2010 }
2011
2013 {
2016
2017 for ( int i = 0; i < construction_parts.Count(); ++i )
2018 {
2019 string key = construction_parts.GetKey( i );
2021
2022 if ( value.
GetId() ==
id )
2023 {
2024 return value;
2025 }
2026 }
2027
2028 return NULL;
2029 }
2030
2031
2032
2034 {
2036 }
2037
2039 {
2041 }
2042
2044 {
2045 return true;
2046 }
2047
2049 {
2050 return false;
2051 }
2052
2053
2055 {
2058 {
2060 }
2061
2062 return construction_kit;
2063 }
2064
2066 {
2069 {
2071 }
2072 }
2073
2075 {
2077 }
2078
2080 {
2081 return "";
2082 }
2083
2085 {
2087 g_Game.ObjectDelete( construction_kit );
2088 }
2089
2090
2092 {
2094 g_Game.ObjectDelete(
this );
2095 }
2096
2097
2099 {
2100 super.EEDelete(parent);
2101
2103 {
2104 areaDamage.Destroy();
2105 }
2106
2107 }
2108
2110 {
2111 super.OnStoreSave( ctx );
2112
2113
2117
2119 }
2120
2122 {
2123 if ( !super.OnStoreLoad( ctx, version ) )
2124 return false;
2125
2126
2127
2129 {
2131 return false;
2132 }
2134 {
2136 return false;
2137 }
2139 {
2141 return false;
2142 }
2143
2144
2146 {
2148 return false;
2149 }
2150
2151
2152 return true;
2153 }
2154
2156 {
2157 super.AfterStoreLoad();
2158
2160 {
2162 }
2163 }
2164
2166 {
2167
2169
2170
2173
2174
2176 }
2177
2179 {
2180 super.OnCreatePhysics();
2181
2182 ConstructionInit();
2184 }
2185
2187 {
2189 return;
2190
2191 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2192 }
2193
2195 {
2197 {
2199 }
2200
2201 super.EEOnAfterLoad();
2202 }
2203
2205 {
2206 super.EEItemAttached( item, slot_name );
2207
2211 }
2212
2214 {
2215 super.EEItemDetached( item, slot_name );
2216
2219 }
2220
2221 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2222 {
2225
2228 }
2229
2230
2232 {
2233 return true;
2234 }
2235
2236
2237
2239 {
2241
2242
2243 if (construtionPart.
IsBase())
2244 {
2246
2247
2249 }
2250
2251
2253
2254
2256
2257
2259
2261
2263
2264
2266
2267
2269 }
2270
2272 {
2273
2275 }
2276
2277
2279 {
2282
2283
2285
2286
2288
2289
2291
2292
2294
2296
2297
2299
2300
2302
2303
2304 if (construtionPart.
IsBase())
2305 {
2306
2308 }
2309 }
2310
2312 {
2313
2315 }
2316
2317
2318 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2319 {
2322
2323
2325
2326
2328
2329
2331
2332
2334
2336
2337
2339
2340
2342
2343
2344 if (construtionPart.
IsBase())
2345 {
2346
2348 }
2349 }
2350
2352 {
2353
2355 }
2356
2357
2359 {
2361
2364 }
2365
2367 {
2369
2371 {
2373 }
2374 else
2375 {
2377 }
2378
2380 }
2381
2383 {
2385
2387 foreach (
string slotName : attachmentSlots)
2388 {
2390 }
2391
2392
2395 else
2397
2399 }
2400
2402 {
2403 string slotNameMounted = slot_name + "_Mounted";
2404 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2405
2406 if (attachment)
2407 {
2408 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2409 if (barbedWire && barbedWire.IsMounted())
2411 else
2413
2414 if (is_locked)
2415 {
2416 SetAnimationPhase(slotNameMounted, 0);
2417 SetAnimationPhase(slot_name, 1);
2418 }
2419 else
2420 {
2421 SetAnimationPhase(slotNameMounted, 1);
2422 SetAnimationPhase(slot_name, 0);
2423 }
2424 }
2425 else
2426 {
2427 SetAnimationPhase(slotNameMounted, 1);
2428 SetAnimationPhase(slot_name, 1);
2429
2431 }
2432 }
2433
2434
2436 {
2439
2442
2445
2446 foreach (
string slotName : attachmentSlots)
2447 {
2449 }
2450
2451
2453 {
2456
2458 }
2459 else
2460 {
2463
2465 }
2466
2469 }
2470
2472 {
2473
2475 return;
2476
2477 string slot_name_mounted = slot_name + "_Mounted";
2478 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2479
2480
2482 RemoveProxyPhysics( slot_name_mounted );
2483 RemoveProxyPhysics( slot_name );
2484
2485 if ( attachment )
2486 {
2488 if ( is_locked )
2489 {
2491 AddProxyPhysics( slot_name_mounted );
2492 }
2493 else
2494 {
2496 AddProxyPhysics( slot_name );
2497 }
2498 }
2499 }
2500
2502 {
2503 SetAffectPathgraph( true, false );
2505 }
2506
2508 {
2509 return true;
2510 }
2511
2513 {
2514 return true;
2515 }
2516
2518 {
2519 if ( attachment )
2520 {
2522 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2523
2524 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2525 }
2526
2527 return false;
2528 }
2529
2531 {
2533 }
2534
2535
2537 {
2538 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2539 if (
g_Game.ConfigIsExisting( config_path ) )
2540 {
2541 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2542 }
2543 }
2544
2546 {
2547 return true;
2548 }
2549
2551 {
2552 return true;
2553 }
2554
2556 {
2557 return true;
2558 }
2559
2560
2562 {
2565 }
2566
2568 {
2570 }
2571
2573 {
2575 }
2576
2578 {
2579 int attachment_count = GetInventory().AttachmentCount();
2580 if ( attachment_count > 0 )
2581 {
2582 if (
HasBase() && attachment_count == 1 )
2583 {
2584 return false;
2585 }
2586
2587 return true;
2588 }
2589
2590 return false;
2591 }
2592
2594 {
2595 return true;
2596 }
2597
2599 {
2600 return false;
2601 }
2602
2603
2605 {
2606 return false;
2607 }
2608
2610 {
2611 return false;
2612 }
2613
2614
2616 {
2617 return false;
2618 }
2619
2620
2621
2623 {
2624 return true;
2625 }
2626
2628 {
2629 return true;
2630 }
2631
2634 {
2635 return false;
2636 }
2637
2638
2640 {
2641 return false;
2642 }
2643
2644
2646 {
2647 return true;
2648 }
2649
2650
2652 {
2653 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2654 {
2655 return false;
2656 }
2657
2658 return true;
2659 }
2660
2662 {
2665
2666 return item;
2667 }
2668
2669
2671 {
2673 {
2674
2676
2677
2680
2682 if ( MemoryPointExists( slot_name + "_min" ) )
2683 {
2684 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2685 }
2686 if ( MemoryPointExists( slot_name + "_max" ) )
2687 {
2688 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2689 }
2690
2691
2694
2695
2698 center = ModelToWorld( center );
2699
2700
2703
2704 areaDamage.SetExtents( extents[0], extents[1] );
2705 areaDamage.SetAreaPosition( center );
2709 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2710 areaDamage.SetAmmoName( "BarbedWireHit" );
2711 areaDamage.Spawn();
2712
2714 }
2715 }
2716
2718 {
2719 if ( angle_deg != 0 )
2720 {
2721
2723
2724
2726 if ( MemoryPointExists( "rotate_axis" ) )
2727 {
2728 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2729 }
2730 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];
2731 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];
2732 center[0] = r_center_x;
2733 center[2] = r_center_z;
2734 }
2735 }
2736
2738 {
2740 {
2743 {
2744 if (areaDamage)
2745 {
2746 areaDamage.Destroy();
2747 }
2748
2750 }
2751 }
2752 }
2753
2755 {
2756 return true;
2757 }
2758
2759
2760
2761
2763 {
2765 }
2766
2768 {
2770 }
2771
2773 {
2775 }
2776
2778 {
2780
2781 switch ( material_type )
2782 {
2788 }
2789
2790 return "";
2791 }
2792
2794 {
2796
2797 switch ( material_type )
2798 {
2804 }
2805
2806 return "";
2807 }
2808
2809
2811 {
2813 {
2814
2816 {
2817 SetHealth(slot_name,"Health",item.GetHealth());
2818 }
2819 }
2820 }
2821
2823 {
2824 return 111;
2825 }
2826
2828 {
2829 super.SetActions();
2830
2834 }
2835
2837 {
2839 if (!construction)
2840 return;
2841
2843 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2844 {
2847 {
2849 }
2850 }
2851 }
2852
2854 {
2856 if (!construction)
2857 return;
2858
2860 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2861 {
2864 {
2865 construction.HandleEntityFalling(part.
GetPartName());
2866 }
2867 }
2868 }
2869
2872 {
2874 return;
2875
2878
2879 if (DestroyOnFall())
2880 {
2882 {
2884 }
2885 else
2886 {
2888 {
2890 }
2892 }
2893 }
2894 }
2895
2897 {
2898 if (HasAnyAttachmentsOrCargo())
2899 {
2902 }
2903 }
2904
2905
2906
2907
2908
2911 {
2912 return null;
2913 }
2914
2916 {
2918 }
2919
2921 {
2924
2925 Man p;
2926
2927 #ifdef SERVER
2929 g_Game.GetWorld().GetPlayerList(players);
2930 if (players.Count())
2931 p = players[0];
2932 #else
2934 #endif
2935
2937 {
2938 bool excluded = false;
2940 if (excludes)
2941 {
2942 foreach (string exclude : excludes)
2943 {
2945 {
2946 excluded = true;
2947 break;
2948 }
2949 }
2950 }
2951
2952 if (!excluded)
2953 {
2955 }
2956 }
2957
2959 }
2960
2962
2964 [
Obsolete(
"handled in the Construction component directly")]
2966 {
2967 }
2968
2969 [
Obsolete(
"handled in the Construction component directly")]
2971 {
2972 }
2973
2974 [
Obsolete(
"obsolete debug method")]
2976 {
2977 }
2978}
2979
2981{
2982#ifdef BSB_DEBUG
2984#else
2985
2986#endif
2987}
2989{
2990#ifdef BSB_DEBUG_SPAM
2992#else
2993
2994#endif
2995}
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.