1644{
1646
1648
1650
1657
1658
1659
1665
1671
1673
1677
1678
1680 {
1682
1683
1684 RegisterNetSyncVariableInt( "m_SyncParts01" );
1685 RegisterNetSyncVariableInt( "m_SyncParts02" );
1686 RegisterNetSyncVariableInt( "m_SyncParts03" );
1687 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1688 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1689 RegisterNetSyncVariableBool( "m_HasBase" );
1690
1691
1692 ConstructionInit();
1693
1694 if (ConfigIsExisting("hybridAttachments"))
1695 {
1698 }
1699 if (ConfigIsExisting("mountables"))
1700 {
1703 }
1704
1706 SetAllowDamage(true);
1707 }
1708
1710 {
1711 return "disableBaseDamage";
1712 }
1713
1715 {
1716 return true;
1717 }
1718
1720 {
1721 return EInventoryIconVisibility.HIDE_VICINITY;
1722 }
1723
1725 {
1726 super.InitItemSounds();
1727
1731
1736 }
1737
1739 {
1740 return "putDown_FenceKit_SoundSet";
1741 }
1742
1744 {
1745 return "Shelter_Site_Build_Loop_SoundSet";
1746 }
1747
1748
1750 {
1752 {
1753 SetSynchDirty();
1754 }
1755 }
1756
1758 {
1760 super.OnVariablesSynchronized();
1761
1763 }
1764
1766 {
1767
1769
1770
1772
1773
1775 }
1776
1777
1779 {
1780
1781 int offset;
1782 int mask;
1783
1784 if ( part_id >= 1 && part_id <= 31 )
1785 {
1786 offset = part_id - 1;
1787 mask = 1 << offset;
1788
1790 }
1791 else if ( part_id >= 32 && part_id <= 62 )
1792 {
1793 offset = ( part_id % 32 );
1794 mask = 1 << offset;
1795
1797 }
1798 else if ( part_id >= 63 && part_id <= 93 )
1799 {
1800 offset = ( part_id % 63 );
1801 mask = 1 << offset;
1802
1804 }
1805 }
1806
1808 {
1809
1810 int offset;
1811 int mask;
1812
1813 if ( part_id >= 1 && part_id <= 31 )
1814 {
1815 offset = part_id - 1;
1816 mask = 1 << offset;
1817
1819 }
1820 else if ( part_id >= 32 && part_id <= 62 )
1821 {
1822 offset = ( part_id % 32 );
1823 mask = 1 << offset;
1824
1826 }
1827 else if ( part_id >= 63 && part_id <= 93 )
1828 {
1829 offset = ( part_id % 63 );
1830 mask = 1 << offset;
1831
1833 }
1834 }
1835
1837 {
1838
1839 int offset;
1840 int mask;
1841
1842 if ( part_id >= 1 && part_id <= 31 )
1843 {
1844 offset = part_id - 1;
1845 mask = 1 << offset;
1846
1848 {
1849 return true;
1850 }
1851 }
1852 else if ( part_id >= 32 && part_id <= 62 )
1853 {
1854 offset = ( part_id % 32 );
1855 mask = 1 << offset;
1856
1858 {
1859 return true;
1860 }
1861 }
1862 else if ( part_id >= 63 && part_id <= 93 )
1863 {
1864 offset = ( part_id % 63 );
1865 mask = 1 << offset;
1866
1868 {
1869 return true;
1870 }
1871 }
1872
1873 return false;
1874 }
1875
1877 {
1880 }
1881
1883 {
1884
1887 }
1888
1890 {
1892 {
1895
1896 switch( build_action_id )
1897 {
1901 }
1902 }
1903 }
1904
1905
1907 {
1909 bool is_base = part.
IsBase();
1912 if ( is_part_built_sync )
1913 {
1915 {
1919
1920 if (is_base)
1921 {
1924 }
1925 }
1926 }
1927 else
1928 {
1930 {
1934
1935 if (is_base)
1936 {
1939 }
1940 }
1941 }
1942
1943
1945 }
1946
1947
1949 {
1952
1953 for ( int i = 0; i < construction_parts.Count(); ++i )
1954 {
1955 string key = construction_parts.GetKey( i );
1958 }
1959
1960
1962 }
1963
1965 {
1968
1969 for ( int i = 0; i < construction_parts.Count(); ++i )
1970 {
1971 string key = construction_parts.GetKey( i );
1973
1974 if ( value.
GetId() ==
id )
1975 {
1976 return value;
1977 }
1978 }
1979
1980 return NULL;
1981 }
1982
1983
1984
1986 {
1988 }
1989
1991 {
1993 }
1994
1996 {
1997 return true;
1998 }
1999
2001 {
2002 return false;
2003 }
2004
2005
2007 {
2010 {
2012 }
2013
2014 return construction_kit;
2015 }
2016
2018 {
2021 {
2023 }
2024 }
2025
2027 {
2029 }
2030
2032 {
2033 return "";
2034 }
2035
2037 {
2039 g_Game.ObjectDelete( construction_kit );
2040 }
2041
2042
2044 {
2046 g_Game.ObjectDelete(
this );
2047 }
2048
2049
2051 {
2052 super.EEDelete(parent);
2053
2055 {
2056 areaDamage.Destroy();
2057 }
2058
2059 }
2060
2062 {
2063 super.OnStoreSave( ctx );
2064
2065
2069
2071 }
2072
2074 {
2075 if ( !super.OnStoreLoad( ctx, version ) )
2076 return false;
2077
2078
2079
2081 {
2083 return false;
2084 }
2086 {
2088 return false;
2089 }
2091 {
2093 return false;
2094 }
2095
2096
2098 {
2100 return false;
2101 }
2102
2103
2104 return true;
2105 }
2106
2108 {
2109 super.AfterStoreLoad();
2110
2112 {
2114 }
2115 }
2116
2118 {
2119
2121
2122
2125
2126
2128 }
2129
2131 {
2132 super.OnCreatePhysics();
2133
2134 ConstructionInit();
2136 }
2137
2139 {
2141 return;
2142
2143 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2144 }
2145
2147 {
2149 {
2151 }
2152
2153 super.EEOnAfterLoad();
2154 }
2155
2157 {
2158 super.EEItemAttached( item, slot_name );
2159
2163 }
2164
2166 {
2167 super.EEItemDetached( item, slot_name );
2168
2171 }
2172
2173 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2174 {
2177
2180 }
2181
2182
2184 {
2185 return true;
2186 }
2187
2188
2189
2191 {
2193
2194
2195 if (construtionPart.
IsBase())
2196 {
2198
2199
2201 }
2202
2203
2205
2206
2208
2209
2211
2213
2215
2216
2218
2219
2221 }
2222
2224 {
2225
2227 }
2228
2229
2231 {
2234
2235
2237
2238
2240
2241
2243
2244
2246
2248
2249
2251
2252
2254
2255
2256 if (construtionPart.
IsBase())
2257 {
2258
2260 }
2261 }
2262
2264 {
2265
2267 }
2268
2269
2270 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2271 {
2274
2275
2277
2278
2280
2281
2283
2284
2286
2288
2289
2291
2292
2294
2295
2296 if (construtionPart.
IsBase())
2297 {
2298
2300 }
2301 }
2302
2304 {
2305
2307 }
2308
2309
2311 {
2313
2316 }
2317
2319 {
2321
2323 {
2325 }
2326 else
2327 {
2329 }
2330
2332 }
2333
2335 {
2337
2339 foreach (
string slotName : attachmentSlots)
2340 {
2342 }
2343
2344
2347 else
2349
2351 }
2352
2354 {
2355 string slotNameMounted = slot_name + "_Mounted";
2356 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2357
2358 if (attachment)
2359 {
2360 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2361 if (barbedWire && barbedWire.IsMounted())
2363 else
2365
2366 if (is_locked)
2367 {
2368 SetAnimationPhase(slotNameMounted, 0);
2369 SetAnimationPhase(slot_name, 1);
2370 }
2371 else
2372 {
2373 SetAnimationPhase(slotNameMounted, 1);
2374 SetAnimationPhase(slot_name, 0);
2375 }
2376 }
2377 else
2378 {
2379 SetAnimationPhase(slotNameMounted, 1);
2380 SetAnimationPhase(slot_name, 1);
2381
2383 }
2384 }
2385
2386
2388 {
2391
2394
2397
2398 foreach (
string slotName : attachmentSlots)
2399 {
2401 }
2402
2403
2405 {
2408
2410 }
2411 else
2412 {
2415
2417 }
2418
2421 }
2422
2424 {
2425
2427 return;
2428
2429 string slot_name_mounted = slot_name + "_Mounted";
2430 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2431
2432
2434 RemoveProxyPhysics( slot_name_mounted );
2435 RemoveProxyPhysics( slot_name );
2436
2437 if ( attachment )
2438 {
2440 if ( is_locked )
2441 {
2443 AddProxyPhysics( slot_name_mounted );
2444 }
2445 else
2446 {
2448 AddProxyPhysics( slot_name );
2449 }
2450 }
2451 }
2452
2454 {
2455 SetAffectPathgraph( true, false );
2457 }
2458
2460 {
2461 return true;
2462 }
2463
2465 {
2466 return true;
2467 }
2468
2470 {
2471 if ( attachment )
2472 {
2474 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2475
2476 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2477 }
2478
2479 return false;
2480 }
2481
2483 {
2485 }
2486
2487
2489 {
2490 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2491 if (
g_Game.ConfigIsExisting( config_path ) )
2492 {
2493 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2494 }
2495 }
2496
2498 {
2499 return true;
2500 }
2501
2503 {
2504 return true;
2505 }
2506
2508 {
2509 return true;
2510 }
2511
2512
2514 {
2517 }
2518
2520 {
2522 }
2523
2525 {
2527 }
2528
2530 {
2531 int attachment_count = GetInventory().AttachmentCount();
2532 if ( attachment_count > 0 )
2533 {
2534 if (
HasBase() && attachment_count == 1 )
2535 {
2536 return false;
2537 }
2538
2539 return true;
2540 }
2541
2542 return false;
2543 }
2544
2546 {
2547 return true;
2548 }
2549
2551 {
2552 return false;
2553 }
2554
2555
2557 {
2558 return false;
2559 }
2560
2562 {
2563 return false;
2564 }
2565
2566
2568 {
2569 return false;
2570 }
2571
2572
2573
2575 {
2576 return true;
2577 }
2578
2580 {
2581 return true;
2582 }
2583
2586 {
2587 return false;
2588 }
2589
2590
2592 {
2593 return false;
2594 }
2595
2596
2598 {
2599 return true;
2600 }
2601
2602
2604 {
2605 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2606 {
2607 return false;
2608 }
2609
2610 return true;
2611 }
2612
2614 {
2617
2618 return item;
2619 }
2620
2621
2623 {
2625 {
2626
2628
2629
2632
2634 if ( MemoryPointExists( slot_name + "_min" ) )
2635 {
2636 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2637 }
2638 if ( MemoryPointExists( slot_name + "_max" ) )
2639 {
2640 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2641 }
2642
2643
2646
2647
2650 center = ModelToWorld( center );
2651
2652
2655
2656 areaDamage.SetExtents( extents[0], extents[1] );
2657 areaDamage.SetAreaPosition( center );
2661 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2662 areaDamage.SetAmmoName( "BarbedWireHit" );
2663 areaDamage.Spawn();
2664
2666 }
2667 }
2668
2670 {
2671 if ( angle_deg != 0 )
2672 {
2673
2675
2676
2678 if ( MemoryPointExists( "rotate_axis" ) )
2679 {
2680 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2681 }
2682 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];
2683 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];
2684 center[0] = r_center_x;
2685 center[2] = r_center_z;
2686 }
2687 }
2688
2690 {
2692 {
2695 {
2696 if (areaDamage)
2697 {
2698 areaDamage.Destroy();
2699 }
2700
2702 }
2703 }
2704 }
2705
2707 {
2708 return true;
2709 }
2710
2711
2712
2713
2715 {
2717 }
2718
2720 {
2722 }
2723
2725 {
2727 }
2728
2730 {
2732
2733 switch ( material_type )
2734 {
2740 }
2741
2742 return "";
2743 }
2744
2746 {
2748
2749 switch ( material_type )
2750 {
2756 }
2757
2758 return "";
2759 }
2760
2761
2763 {
2765 {
2766
2768 {
2769 SetHealth(slot_name,"Health",item.GetHealth());
2770 }
2771 }
2772 }
2773
2775 {
2776 return 111;
2777 }
2778
2780 {
2781 super.SetActions();
2782
2786 }
2787
2789 {
2791 if (!construction)
2792 return;
2793
2795 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2796 {
2799 {
2801 }
2802 }
2803 }
2804
2806 {
2808 if (!construction)
2809 return;
2810
2812 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2813 {
2816 {
2817 construction.HandleEntityFalling(part.
GetPartName());
2818 }
2819 }
2820 }
2821
2824 {
2826 return;
2827
2830
2831 if (DestroyOnFall())
2832 {
2834 {
2836 }
2837 else
2838 {
2840 {
2842 }
2844 }
2845 }
2846 }
2847
2849 {
2850 if (HasAnyAttachmentsOrCargo())
2851 {
2854 }
2855 }
2856
2857
2858
2859
2860
2863 {
2864 return null;
2865 }
2866
2868 {
2870 }
2871
2873 {
2876
2877 Man p;
2878
2879 #ifdef SERVER
2881 g_Game.GetWorld().GetPlayerList(players);
2882 if (players.Count())
2883 p = players[0];
2884 #else
2886 #endif
2887
2889 {
2890 bool excluded = false;
2892 if (excludes)
2893 {
2894 foreach (string exclude : excludes)
2895 {
2897 {
2898 excluded = true;
2899 break;
2900 }
2901 }
2902 }
2903
2904 if (!excluded)
2905 {
2907 }
2908 }
2909
2911 }
2912
2914
2916 [
Obsolete(
"handled in the Construction component directly")]
2918 {
2919 }
2920
2921 [
Obsolete(
"handled in the Construction component directly")]
2923 {
2924 }
2925
2926 [
Obsolete(
"obsolete debug method")]
2928 {
2929 }
2930}
2931
2933{
2934#ifdef BSB_DEBUG
2936#else
2937
2938#endif
2939}
2941{
2942#ifdef BSB_DEBUG_SPAM
2944#else
2945
2946#endif
2947}
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.