1680{
1682
1684
1686
1693
1694
1695
1701
1707
1709
1713
1714
1716 {
1718
1719
1720 RegisterNetSyncVariableInt( "m_SyncParts01" );
1721 RegisterNetSyncVariableInt( "m_SyncParts02" );
1722 RegisterNetSyncVariableInt( "m_SyncParts03" );
1723 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1724 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1725 RegisterNetSyncVariableBool( "m_HasBase" );
1726
1727
1728 ConstructionInit();
1729
1730 if (ConfigIsExisting("hybridAttachments"))
1731 {
1734 }
1735 if (ConfigIsExisting("mountables"))
1736 {
1739 }
1740
1742 SetAllowDamage(true);
1743 }
1744
1746 {
1747 return "disableBaseDamage";
1748 }
1749
1751 {
1752 return true;
1753 }
1754
1756 {
1757 return EInventoryIconVisibility.HIDE_VICINITY;
1758 }
1759
1761 {
1762 super.InitItemSounds();
1763
1767
1772 }
1773
1775 {
1776 return "putDown_FenceKit_SoundSet";
1777 }
1778
1780 {
1781 return "Shelter_Site_Build_Loop_SoundSet";
1782 }
1783
1784
1786 {
1788 {
1789 SetSynchDirty();
1790 }
1791 }
1792
1794 {
1796 super.OnVariablesSynchronized();
1797
1799 }
1800
1802 {
1803
1805
1806
1808
1809
1811 }
1812
1813
1815 {
1816
1817 int offset;
1818 int mask;
1819
1820 if ( part_id >= 1 && part_id <= 31 )
1821 {
1822 offset = part_id - 1;
1823 mask = 1 << offset;
1824
1826 }
1827 else if ( part_id >= 32 && part_id <= 62 )
1828 {
1829 offset = ( part_id % 32 );
1830 mask = 1 << offset;
1831
1833 }
1834 else if ( part_id >= 63 && part_id <= 93 )
1835 {
1836 offset = ( part_id % 63 );
1837 mask = 1 << offset;
1838
1840 }
1841 }
1842
1844 {
1845
1846 int offset;
1847 int mask;
1848
1849 if ( part_id >= 1 && part_id <= 31 )
1850 {
1851 offset = part_id - 1;
1852 mask = 1 << offset;
1853
1855 }
1856 else if ( part_id >= 32 && part_id <= 62 )
1857 {
1858 offset = ( part_id % 32 );
1859 mask = 1 << offset;
1860
1862 }
1863 else if ( part_id >= 63 && part_id <= 93 )
1864 {
1865 offset = ( part_id % 63 );
1866 mask = 1 << offset;
1867
1869 }
1870 }
1871
1873 {
1874
1875 int offset;
1876 int mask;
1877
1878 if ( part_id >= 1 && part_id <= 31 )
1879 {
1880 offset = part_id - 1;
1881 mask = 1 << offset;
1882
1884 {
1885 return true;
1886 }
1887 }
1888 else if ( part_id >= 32 && part_id <= 62 )
1889 {
1890 offset = ( part_id % 32 );
1891 mask = 1 << offset;
1892
1894 {
1895 return true;
1896 }
1897 }
1898 else if ( part_id >= 63 && part_id <= 93 )
1899 {
1900 offset = ( part_id % 63 );
1901 mask = 1 << offset;
1902
1904 {
1905 return true;
1906 }
1907 }
1908
1909 return false;
1910 }
1911
1913 {
1916 }
1917
1919 {
1920
1923 }
1924
1926 {
1928 {
1931
1932 switch( build_action_id )
1933 {
1937 }
1938 }
1939 }
1940
1941
1943 {
1945 bool is_base = part.
IsBase();
1948 if ( is_part_built_sync )
1949 {
1951 {
1955
1956 if (is_base)
1957 {
1960 }
1961 }
1962 }
1963 else
1964 {
1966 {
1970
1971 if (is_base)
1972 {
1975 }
1976 }
1977 }
1978
1979
1981 }
1982
1983
1985 {
1988
1989 for ( int i = 0; i < construction_parts.Count(); ++i )
1990 {
1991 string key = construction_parts.GetKey( i );
1994 }
1995
1996
1998 }
1999
2001 {
2004
2005 for ( int i = 0; i < construction_parts.Count(); ++i )
2006 {
2007 string key = construction_parts.GetKey( i );
2009
2010 if ( value.
GetId() ==
id )
2011 {
2012 return value;
2013 }
2014 }
2015
2016 return NULL;
2017 }
2018
2019
2020
2022 {
2024 }
2025
2027 {
2029 }
2030
2032 {
2033 return true;
2034 }
2035
2037 {
2038 return false;
2039 }
2040
2041
2043 {
2046 {
2048 }
2049
2050 return construction_kit;
2051 }
2052
2054 {
2057 {
2059 }
2060 }
2061
2063 {
2065 }
2066
2068 {
2069 return "";
2070 }
2071
2073 {
2075 g_Game.ObjectDelete( construction_kit );
2076 }
2077
2078
2080 {
2082 g_Game.ObjectDelete(
this );
2083 }
2084
2085
2087 {
2088 super.EEDelete(parent);
2089
2091 {
2092 areaDamage.Destroy();
2093 }
2094
2095 }
2096
2098 {
2099 super.OnStoreSave( ctx );
2100
2101
2105
2107 }
2108
2110 {
2111 if ( !super.OnStoreLoad( ctx, version ) )
2112 return false;
2113
2114
2115
2117 {
2119 return false;
2120 }
2122 {
2124 return false;
2125 }
2127 {
2129 return false;
2130 }
2131
2132
2134 {
2136 return false;
2137 }
2138
2139
2140 return true;
2141 }
2142
2144 {
2145 super.AfterStoreLoad();
2146
2148 {
2150 }
2151 }
2152
2154 {
2155
2157
2158
2161
2162
2164 }
2165
2167 {
2168 super.OnCreatePhysics();
2169
2170 ConstructionInit();
2172 }
2173
2175 {
2177 return;
2178
2179 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2180 }
2181
2183 {
2185 {
2187 }
2188
2189 super.EEOnAfterLoad();
2190 }
2191
2193 {
2194 super.EEItemAttached( item, slot_name );
2195
2199 }
2200
2202 {
2203 super.EEItemDetached( item, slot_name );
2204
2207 }
2208
2209 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2210 {
2213
2216 }
2217
2218
2220 {
2221 return true;
2222 }
2223
2224
2225
2227 {
2229
2230
2231 if (construtionPart.
IsBase())
2232 {
2234
2235
2237 }
2238
2239
2241
2242
2244
2245
2247
2249
2251
2252
2254
2255
2257 }
2258
2260 {
2261
2263 }
2264
2265
2267 {
2270
2271
2273
2274
2276
2277
2279
2280
2282
2284
2285
2287
2288
2290
2291
2292 if (construtionPart.
IsBase())
2293 {
2294
2296 }
2297 }
2298
2300 {
2301
2303 }
2304
2305
2306 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2307 {
2310
2311
2313
2314
2316
2317
2319
2320
2322
2324
2325
2327
2328
2330
2331
2332 if (construtionPart.
IsBase())
2333 {
2334
2336 }
2337 }
2338
2340 {
2341
2343 }
2344
2345
2347 {
2349
2352 }
2353
2355 {
2357
2359 {
2361 }
2362 else
2363 {
2365 }
2366
2368 }
2369
2371 {
2373
2375 foreach (
string slotName : attachmentSlots)
2376 {
2378 }
2379
2380
2383 else
2385
2387 }
2388
2390 {
2391 string slotNameMounted = slot_name + "_Mounted";
2392 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2393
2394 if (attachment)
2395 {
2396 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2397 if (barbedWire && barbedWire.IsMounted())
2399 else
2401
2402 if (is_locked)
2403 {
2404 SetAnimationPhase(slotNameMounted, 0);
2405 SetAnimationPhase(slot_name, 1);
2406 }
2407 else
2408 {
2409 SetAnimationPhase(slotNameMounted, 1);
2410 SetAnimationPhase(slot_name, 0);
2411 }
2412 }
2413 else
2414 {
2415 SetAnimationPhase(slotNameMounted, 1);
2416 SetAnimationPhase(slot_name, 1);
2417
2419 }
2420 }
2421
2422
2424 {
2427
2430
2433
2434 foreach (
string slotName : attachmentSlots)
2435 {
2437 }
2438
2439
2441 {
2444
2446 }
2447 else
2448 {
2451
2453 }
2454
2457 }
2458
2460 {
2461
2463 return;
2464
2465 string slot_name_mounted = slot_name + "_Mounted";
2466 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2467
2468
2470 RemoveProxyPhysics( slot_name_mounted );
2471 RemoveProxyPhysics( slot_name );
2472
2473 if ( attachment )
2474 {
2476 if ( is_locked )
2477 {
2479 AddProxyPhysics( slot_name_mounted );
2480 }
2481 else
2482 {
2484 AddProxyPhysics( slot_name );
2485 }
2486 }
2487 }
2488
2490 {
2491 SetAffectPathgraph( true, false );
2493 }
2494
2496 {
2497 return true;
2498 }
2499
2501 {
2502 return true;
2503 }
2504
2506 {
2507 if ( attachment )
2508 {
2510 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2511
2512 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2513 }
2514
2515 return false;
2516 }
2517
2519 {
2521 }
2522
2523
2525 {
2526 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2527 if (
g_Game.ConfigIsExisting( config_path ) )
2528 {
2529 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2530 }
2531 }
2532
2534 {
2535 return true;
2536 }
2537
2539 {
2540 return true;
2541 }
2542
2544 {
2545 return true;
2546 }
2547
2548
2550 {
2553 }
2554
2556 {
2558 }
2559
2561 {
2563 }
2564
2566 {
2567 int attachment_count = GetInventory().AttachmentCount();
2568 if ( attachment_count > 0 )
2569 {
2570 if (
HasBase() && attachment_count == 1 )
2571 {
2572 return false;
2573 }
2574
2575 return true;
2576 }
2577
2578 return false;
2579 }
2580
2582 {
2583 return true;
2584 }
2585
2587 {
2588 return false;
2589 }
2590
2591
2593 {
2594 return false;
2595 }
2596
2598 {
2599 return false;
2600 }
2601
2602
2604 {
2605 return false;
2606 }
2607
2608
2609
2611 {
2612 return true;
2613 }
2614
2616 {
2617 return true;
2618 }
2619
2622 {
2623 return false;
2624 }
2625
2626
2628 {
2629 return false;
2630 }
2631
2632
2634 {
2635 return true;
2636 }
2637
2638
2640 {
2641 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2642 {
2643 return false;
2644 }
2645
2646 return true;
2647 }
2648
2650 {
2653
2654 return item;
2655 }
2656
2657
2659 {
2661 {
2662
2664
2665
2668
2670 if ( MemoryPointExists( slot_name + "_min" ) )
2671 {
2672 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2673 }
2674 if ( MemoryPointExists( slot_name + "_max" ) )
2675 {
2676 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2677 }
2678
2679
2682
2683
2686 center = ModelToWorld( center );
2687
2688
2691
2692 areaDamage.SetExtents( extents[0], extents[1] );
2693 areaDamage.SetAreaPosition( center );
2697 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2698 areaDamage.SetAmmoName( "BarbedWireHit" );
2699 areaDamage.Spawn();
2700
2702 }
2703 }
2704
2706 {
2707 if ( angle_deg != 0 )
2708 {
2709
2711
2712
2714 if ( MemoryPointExists( "rotate_axis" ) )
2715 {
2716 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2717 }
2718 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];
2719 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];
2720 center[0] = r_center_x;
2721 center[2] = r_center_z;
2722 }
2723 }
2724
2726 {
2728 {
2731 {
2732 if (areaDamage)
2733 {
2734 areaDamage.Destroy();
2735 }
2736
2738 }
2739 }
2740 }
2741
2743 {
2744 return true;
2745 }
2746
2747
2748
2749
2751 {
2753 }
2754
2756 {
2758 }
2759
2761 {
2763 }
2764
2766 {
2768
2769 switch ( material_type )
2770 {
2776 }
2777
2778 return "";
2779 }
2780
2782 {
2784
2785 switch ( material_type )
2786 {
2792 }
2793
2794 return "";
2795 }
2796
2797
2799 {
2801 {
2802
2804 {
2805 SetHealth(slot_name,"Health",item.GetHealth());
2806 }
2807 }
2808 }
2809
2811 {
2812 return 111;
2813 }
2814
2816 {
2817 super.SetActions();
2818
2822 }
2823
2825 {
2827 if (!construction)
2828 return;
2829
2831 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2832 {
2835 {
2837 }
2838 }
2839 }
2840
2842 {
2844 if (!construction)
2845 return;
2846
2848 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2849 {
2852 {
2853 construction.HandleEntityFalling(part.
GetPartName());
2854 }
2855 }
2856 }
2857
2860 {
2862 return;
2863
2866
2867 if (DestroyOnFall())
2868 {
2870 {
2872 }
2873 else
2874 {
2876 {
2878 }
2880 }
2881 }
2882 }
2883
2885 {
2886 if (HasAnyAttachmentsOrCargo())
2887 {
2890 }
2891 }
2892
2893
2894
2895
2896
2899 {
2900 return null;
2901 }
2902
2904 {
2906 }
2907
2909 {
2912
2913 Man p;
2914
2915 #ifdef SERVER
2917 g_Game.GetWorld().GetPlayerList(players);
2918 if (players.Count())
2919 p = players[0];
2920 #else
2922 #endif
2923
2925 {
2926 bool excluded = false;
2928 if (excludes)
2929 {
2930 foreach (string exclude : excludes)
2931 {
2933 {
2934 excluded = true;
2935 break;
2936 }
2937 }
2938 }
2939
2940 if (!excluded)
2941 {
2943 }
2944 }
2945
2947 }
2948
2950
2952 [
Obsolete(
"handled in the Construction component directly")]
2954 {
2955 }
2956
2957 [
Obsolete(
"handled in the Construction component directly")]
2959 {
2960 }
2961
2962 [
Obsolete(
"obsolete debug method")]
2964 {
2965 }
2966}
2967
2969{
2970#ifdef BSB_DEBUG
2972#else
2973
2974#endif
2975}
2977{
2978#ifdef BSB_DEBUG_SPAM
2980#else
2981
2982#endif
2983}
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.