1649{
1651
1653
1655
1662
1663
1664
1670
1676
1678
1682
1683
1685 {
1687
1688
1689 RegisterNetSyncVariableInt( "m_SyncParts01" );
1690 RegisterNetSyncVariableInt( "m_SyncParts02" );
1691 RegisterNetSyncVariableInt( "m_SyncParts03" );
1692 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1693 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1694 RegisterNetSyncVariableBool( "m_HasBase" );
1695
1696
1697 ConstructionInit();
1698
1699 if (ConfigIsExisting("hybridAttachments"))
1700 {
1703 }
1704 if (ConfigIsExisting("mountables"))
1705 {
1708 }
1709
1711 SetAllowDamage(true);
1712 }
1713
1715 {
1716 return "disableBaseDamage";
1717 }
1718
1720 {
1721 return true;
1722 }
1723
1725 {
1726 return EInventoryIconVisibility.HIDE_VICINITY;
1727 }
1728
1730 {
1731 super.InitItemSounds();
1732
1736
1741 }
1742
1744 {
1745 return "putDown_FenceKit_SoundSet";
1746 }
1747
1749 {
1750 return "Shelter_Site_Build_Loop_SoundSet";
1751 }
1752
1753
1755 {
1757 {
1758 SetSynchDirty();
1759 }
1760 }
1761
1763 {
1765 super.OnVariablesSynchronized();
1766
1768 }
1769
1771 {
1772
1774
1775
1777
1778
1780 }
1781
1782
1784 {
1785
1786 int offset;
1787 int mask;
1788
1789 if ( part_id >= 1 && part_id <= 31 )
1790 {
1791 offset = part_id - 1;
1792 mask = 1 << offset;
1793
1795 }
1796 else if ( part_id >= 32 && part_id <= 62 )
1797 {
1798 offset = ( part_id % 32 );
1799 mask = 1 << offset;
1800
1802 }
1803 else if ( part_id >= 63 && part_id <= 93 )
1804 {
1805 offset = ( part_id % 63 );
1806 mask = 1 << offset;
1807
1809 }
1810 }
1811
1813 {
1814
1815 int offset;
1816 int mask;
1817
1818 if ( part_id >= 1 && part_id <= 31 )
1819 {
1820 offset = part_id - 1;
1821 mask = 1 << offset;
1822
1824 }
1825 else if ( part_id >= 32 && part_id <= 62 )
1826 {
1827 offset = ( part_id % 32 );
1828 mask = 1 << offset;
1829
1831 }
1832 else if ( part_id >= 63 && part_id <= 93 )
1833 {
1834 offset = ( part_id % 63 );
1835 mask = 1 << offset;
1836
1838 }
1839 }
1840
1842 {
1843
1844 int offset;
1845 int mask;
1846
1847 if ( part_id >= 1 && part_id <= 31 )
1848 {
1849 offset = part_id - 1;
1850 mask = 1 << offset;
1851
1853 {
1854 return true;
1855 }
1856 }
1857 else if ( part_id >= 32 && part_id <= 62 )
1858 {
1859 offset = ( part_id % 32 );
1860 mask = 1 << offset;
1861
1863 {
1864 return true;
1865 }
1866 }
1867 else if ( part_id >= 63 && part_id <= 93 )
1868 {
1869 offset = ( part_id % 63 );
1870 mask = 1 << offset;
1871
1873 {
1874 return true;
1875 }
1876 }
1877
1878 return false;
1879 }
1880
1882 {
1885 }
1886
1888 {
1889
1892 }
1893
1895 {
1897 {
1900
1901 switch( build_action_id )
1902 {
1906 }
1907 }
1908 }
1909
1910
1912 {
1914 bool is_base = part.
IsBase();
1917 if ( is_part_built_sync )
1918 {
1920 {
1924
1925 if (is_base)
1926 {
1929 }
1930 }
1931 }
1932 else
1933 {
1935 {
1939
1940 if (is_base)
1941 {
1944 }
1945 }
1946 }
1947
1948
1950 }
1951
1952
1954 {
1957
1958 for ( int i = 0; i < construction_parts.Count(); ++i )
1959 {
1960 string key = construction_parts.GetKey( i );
1963 }
1964
1965
1967 }
1968
1970 {
1973
1974 for ( int i = 0; i < construction_parts.Count(); ++i )
1975 {
1976 string key = construction_parts.GetKey( i );
1978
1979 if ( value.
GetId() ==
id )
1980 {
1981 return value;
1982 }
1983 }
1984
1985 return NULL;
1986 }
1987
1988
1989
1991 {
1993 }
1994
1996 {
1998 }
1999
2001 {
2002 return true;
2003 }
2004
2006 {
2007 return false;
2008 }
2009
2010
2012 {
2015 {
2017 }
2018
2019 return construction_kit;
2020 }
2021
2023 {
2026 {
2028 }
2029 }
2030
2032 {
2034 }
2035
2037 {
2038 return "";
2039 }
2040
2042 {
2044 g_Game.ObjectDelete( construction_kit );
2045 }
2046
2047
2049 {
2051 g_Game.ObjectDelete(
this );
2052 }
2053
2054
2056 {
2057 super.EEDelete(parent);
2058
2060 {
2061 areaDamage.Destroy();
2062 }
2063
2064 }
2065
2067 {
2068 super.OnStoreSave( ctx );
2069
2070
2074
2076 }
2077
2079 {
2080 if ( !super.OnStoreLoad( ctx, version ) )
2081 return false;
2082
2083
2084
2086 {
2088 return false;
2089 }
2091 {
2093 return false;
2094 }
2096 {
2098 return false;
2099 }
2100
2101
2103 {
2105 return false;
2106 }
2107
2108
2109 return true;
2110 }
2111
2113 {
2114 super.AfterStoreLoad();
2115
2117 {
2119 }
2120 }
2121
2123 {
2124
2126
2127
2130
2131
2133 }
2134
2136 {
2137 super.OnCreatePhysics();
2138
2139 ConstructionInit();
2141 }
2142
2144 {
2146 return;
2147
2148 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2149 }
2150
2152 {
2154 {
2156 }
2157
2158 super.EEOnAfterLoad();
2159 }
2160
2162 {
2163 super.EEItemAttached( item, slot_name );
2164
2168 }
2169
2171 {
2172 super.EEItemDetached( item, slot_name );
2173
2176 }
2177
2178 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2179 {
2182
2185 }
2186
2187
2189 {
2190 return true;
2191 }
2192
2193
2194
2196 {
2198
2199
2200 if (construtionPart.
IsBase())
2201 {
2203
2204
2206 }
2207
2208
2210
2211
2213
2214
2216
2218
2220
2221
2223
2224
2226 }
2227
2229 {
2230
2232 }
2233
2234
2236 {
2239
2240
2242
2243
2245
2246
2248
2249
2251
2253
2254
2256
2257
2259
2260
2261 if (construtionPart.
IsBase())
2262 {
2263
2265 }
2266 }
2267
2269 {
2270
2272 }
2273
2274
2275 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2276 {
2279
2280
2282
2283
2285
2286
2288
2289
2291
2293
2294
2296
2297
2299
2300
2301 if (construtionPart.
IsBase())
2302 {
2303
2305 }
2306 }
2307
2309 {
2310
2312 }
2313
2314
2316 {
2318
2321 }
2322
2324 {
2326
2328 {
2330 }
2331 else
2332 {
2334 }
2335
2337 }
2338
2340 {
2342
2344 foreach (
string slotName : attachmentSlots)
2345 {
2347 }
2348
2349
2352 else
2354
2356 }
2357
2359 {
2360 string slotNameMounted = slot_name + "_Mounted";
2361 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2362
2363 if (attachment)
2364 {
2365 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2366 if (barbedWire && barbedWire.IsMounted())
2368 else
2370
2371 if (is_locked)
2372 {
2373 SetAnimationPhase(slotNameMounted, 0);
2374 SetAnimationPhase(slot_name, 1);
2375 }
2376 else
2377 {
2378 SetAnimationPhase(slotNameMounted, 1);
2379 SetAnimationPhase(slot_name, 0);
2380 }
2381 }
2382 else
2383 {
2384 SetAnimationPhase(slotNameMounted, 1);
2385 SetAnimationPhase(slot_name, 1);
2386
2388 }
2389 }
2390
2391
2393 {
2396
2399
2402
2403 foreach (
string slotName : attachmentSlots)
2404 {
2406 }
2407
2408
2410 {
2413
2415 }
2416 else
2417 {
2420
2422 }
2423
2426 }
2427
2429 {
2430
2432 return;
2433
2434 string slot_name_mounted = slot_name + "_Mounted";
2435 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2436
2437
2439 RemoveProxyPhysics( slot_name_mounted );
2440 RemoveProxyPhysics( slot_name );
2441
2442 if ( attachment )
2443 {
2445 if ( is_locked )
2446 {
2448 AddProxyPhysics( slot_name_mounted );
2449 }
2450 else
2451 {
2453 AddProxyPhysics( slot_name );
2454 }
2455 }
2456 }
2457
2459 {
2460 SetAffectPathgraph( true, false );
2462 }
2463
2465 {
2466 return true;
2467 }
2468
2470 {
2471 return true;
2472 }
2473
2475 {
2476 if ( attachment )
2477 {
2479 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2480
2481 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2482 }
2483
2484 return false;
2485 }
2486
2488 {
2490 }
2491
2492
2494 {
2495 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2496 if (
g_Game.ConfigIsExisting( config_path ) )
2497 {
2498 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2499 }
2500 }
2501
2503 {
2504 return true;
2505 }
2506
2508 {
2509 return true;
2510 }
2511
2513 {
2514 return true;
2515 }
2516
2517
2519 {
2522 }
2523
2525 {
2527 }
2528
2530 {
2532 }
2533
2535 {
2536 int attachment_count = GetInventory().AttachmentCount();
2537 if ( attachment_count > 0 )
2538 {
2539 if (
HasBase() && attachment_count == 1 )
2540 {
2541 return false;
2542 }
2543
2544 return true;
2545 }
2546
2547 return false;
2548 }
2549
2551 {
2552 return true;
2553 }
2554
2556 {
2557 return false;
2558 }
2559
2560
2562 {
2563 return false;
2564 }
2565
2567 {
2568 return false;
2569 }
2570
2571
2573 {
2574 return false;
2575 }
2576
2577
2578
2580 {
2581 return true;
2582 }
2583
2585 {
2586 return true;
2587 }
2588
2591 {
2592 return false;
2593 }
2594
2595
2597 {
2598 return false;
2599 }
2600
2601
2603 {
2604 return true;
2605 }
2606
2607
2609 {
2610 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2611 {
2612 return false;
2613 }
2614
2615 return true;
2616 }
2617
2619 {
2622
2623 return item;
2624 }
2625
2626
2628 {
2630 {
2631
2633
2634
2637
2639 if ( MemoryPointExists( slot_name + "_min" ) )
2640 {
2641 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2642 }
2643 if ( MemoryPointExists( slot_name + "_max" ) )
2644 {
2645 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2646 }
2647
2648
2651
2652
2655 center = ModelToWorld( center );
2656
2657
2660
2661 areaDamage.SetExtents( extents[0], extents[1] );
2662 areaDamage.SetAreaPosition( center );
2666 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2667 areaDamage.SetAmmoName( "BarbedWireHit" );
2668 areaDamage.Spawn();
2669
2671 }
2672 }
2673
2675 {
2676 if ( angle_deg != 0 )
2677 {
2678
2680
2681
2683 if ( MemoryPointExists( "rotate_axis" ) )
2684 {
2685 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2686 }
2687 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];
2688 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];
2689 center[0] = r_center_x;
2690 center[2] = r_center_z;
2691 }
2692 }
2693
2695 {
2697 {
2700 {
2701 if (areaDamage)
2702 {
2703 areaDamage.Destroy();
2704 }
2705
2707 }
2708 }
2709 }
2710
2712 {
2713 return true;
2714 }
2715
2716
2717
2718
2720 {
2722 }
2723
2725 {
2727 }
2728
2730 {
2732 }
2733
2735 {
2737
2738 switch ( material_type )
2739 {
2745 }
2746
2747 return "";
2748 }
2749
2751 {
2753
2754 switch ( material_type )
2755 {
2761 }
2762
2763 return "";
2764 }
2765
2766
2768 {
2770 {
2771
2773 {
2774 SetHealth(slot_name,"Health",item.GetHealth());
2775 }
2776 }
2777 }
2778
2780 {
2781 return 111;
2782 }
2783
2785 {
2786 super.SetActions();
2787
2791 }
2792
2794 {
2796 if (!construction)
2797 return;
2798
2800 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2801 {
2804 {
2806 }
2807 }
2808 }
2809
2811 {
2813 if (!construction)
2814 return;
2815
2817 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2818 {
2821 {
2822 construction.HandleEntityFalling(part.
GetPartName());
2823 }
2824 }
2825 }
2826
2829 {
2831 return;
2832
2835
2836 if (DestroyOnFall())
2837 {
2839 {
2841 }
2842 else
2843 {
2845 {
2847 }
2849 }
2850 }
2851 }
2852
2854 {
2855 if (HasAnyAttachmentsOrCargo())
2856 {
2859 }
2860 }
2861
2862
2863
2864
2865
2868 {
2869 return null;
2870 }
2871
2873 {
2875 }
2876
2878 {
2881
2882 Man p;
2883
2884 #ifdef SERVER
2886 g_Game.GetWorld().GetPlayerList(players);
2887 if (players.Count())
2888 p = players[0];
2889 #else
2891 #endif
2892
2894 {
2895 bool excluded = false;
2897 if (excludes)
2898 {
2899 foreach (string exclude : excludes)
2900 {
2902 {
2903 excluded = true;
2904 break;
2905 }
2906 }
2907 }
2908
2909 if (!excluded)
2910 {
2912 }
2913 }
2914
2916 }
2917
2919
2921 [
Obsolete(
"handled in the Construction component directly")]
2923 {
2924 }
2925
2926 [
Obsolete(
"handled in the Construction component directly")]
2928 {
2929 }
2930
2931 [
Obsolete(
"obsolete debug method")]
2933 {
2934 }
2935}
2936
2938{
2939#ifdef BSB_DEBUG
2941#else
2942
2943#endif
2944}
2946{
2947#ifdef BSB_DEBUG_SPAM
2949#else
2950
2951#endif
2952}
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.