1756{
1758
1760
1762
1769
1770
1771
1777
1783
1785
1789
1790
1792 {
1794
1795
1796 RegisterNetSyncVariableInt( "m_SyncParts01" );
1797 RegisterNetSyncVariableInt( "m_SyncParts02" );
1798 RegisterNetSyncVariableInt( "m_SyncParts03" );
1799 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1800 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1801 RegisterNetSyncVariableBool( "m_HasBase" );
1802
1803
1804 ConstructionInit();
1805
1806 if (ConfigIsExisting("hybridAttachments"))
1807 {
1810 }
1811 if (ConfigIsExisting("mountables"))
1812 {
1815 }
1816
1818 SetAllowDamage(true);
1819 }
1820
1822 {
1823 return "disableBaseDamage";
1824 }
1825
1827 {
1828 return true;
1829 }
1830
1832 {
1833 return EInventoryIconVisibility.HIDE_VICINITY;
1834 }
1835
1837 {
1838 super.InitItemSounds();
1839
1843
1848 }
1849
1851 {
1852 return "putDown_FenceKit_SoundSet";
1853 }
1854
1856 {
1857 return "Shelter_Site_Build_Loop_SoundSet";
1858 }
1859
1860
1862 {
1864 {
1865 SetSynchDirty();
1866 }
1867 }
1868
1870 {
1872 super.OnVariablesSynchronized();
1873
1875 }
1876
1878 {
1879
1881
1882
1884
1885
1887 }
1888
1889
1891 {
1892
1893 int offset;
1894 int mask;
1895
1896 if ( part_id >= 1 && part_id <= 31 )
1897 {
1898 offset = part_id - 1;
1899 mask = 1 << offset;
1900
1902 }
1903 else if ( part_id >= 32 && part_id <= 62 )
1904 {
1905 offset = ( part_id % 32 );
1906 mask = 1 << offset;
1907
1909 }
1910 else if ( part_id >= 63 && part_id <= 93 )
1911 {
1912 offset = ( part_id % 63 );
1913 mask = 1 << offset;
1914
1916 }
1917 }
1918
1920 {
1921
1922 int offset;
1923 int mask;
1924
1925 if ( part_id >= 1 && part_id <= 31 )
1926 {
1927 offset = part_id - 1;
1928 mask = 1 << offset;
1929
1931 }
1932 else if ( part_id >= 32 && part_id <= 62 )
1933 {
1934 offset = ( part_id % 32 );
1935 mask = 1 << offset;
1936
1938 }
1939 else if ( part_id >= 63 && part_id <= 93 )
1940 {
1941 offset = ( part_id % 63 );
1942 mask = 1 << offset;
1943
1945 }
1946 }
1947
1949 {
1950
1951 int offset;
1952 int mask;
1953
1954 if ( part_id >= 1 && part_id <= 31 )
1955 {
1956 offset = part_id - 1;
1957 mask = 1 << offset;
1958
1960 {
1961 return true;
1962 }
1963 }
1964 else if ( part_id >= 32 && part_id <= 62 )
1965 {
1966 offset = ( part_id % 32 );
1967 mask = 1 << offset;
1968
1970 {
1971 return true;
1972 }
1973 }
1974 else if ( part_id >= 63 && part_id <= 93 )
1975 {
1976 offset = ( part_id % 63 );
1977 mask = 1 << offset;
1978
1980 {
1981 return true;
1982 }
1983 }
1984
1985 return false;
1986 }
1987
1989 {
1992 }
1993
1995 {
1996
1999 }
2000
2002 {
2004 {
2007
2008 switch( build_action_id )
2009 {
2013 }
2014 }
2015 }
2016
2017
2019 {
2021 bool is_base = part.
IsBase();
2024 if ( is_part_built_sync )
2025 {
2027 {
2031
2032 if (is_base)
2033 {
2036 }
2037 }
2038 }
2039 else
2040 {
2042 {
2046
2047 if (is_base)
2048 {
2051 }
2052 }
2053 }
2054
2055
2057 }
2058
2059
2061 {
2064
2065 for ( int i = 0; i < construction_parts.Count(); ++i )
2066 {
2067 string key = construction_parts.GetKey( i );
2070 }
2071
2072
2074 }
2075
2077 {
2080
2081 for ( int i = 0; i < construction_parts.Count(); ++i )
2082 {
2083 string key = construction_parts.GetKey( i );
2085
2086 if ( value.
GetId() ==
id )
2087 {
2088 return value;
2089 }
2090 }
2091
2092 return NULL;
2093 }
2094
2095
2096
2098 {
2100 }
2101
2103 {
2105 }
2106
2108 {
2109 return true;
2110 }
2111
2113 {
2114 return false;
2115 }
2116
2117
2119 {
2122 {
2124 }
2125
2126 return construction_kit;
2127 }
2128
2130 {
2133 {
2135 }
2136 }
2137
2139 {
2141 }
2142
2144 {
2145 return "";
2146 }
2147
2149 {
2151 g_Game.ObjectDelete( construction_kit );
2152 }
2153
2154
2156 {
2158 g_Game.ObjectDelete(
this );
2159 }
2160
2161
2163 {
2164 super.EEDelete(parent);
2165
2167 {
2168 areaDamage.Destroy();
2169 }
2170
2171 }
2172
2174 {
2175 super.OnStoreSave( ctx );
2176
2177
2181
2183 }
2184
2186 {
2187 if ( !super.OnStoreLoad( ctx, version ) )
2188 return false;
2189
2190
2191
2193 {
2195 return false;
2196 }
2198 {
2200 return false;
2201 }
2203 {
2205 return false;
2206 }
2207
2208
2210 {
2212 return false;
2213 }
2214
2215
2216 return true;
2217 }
2218
2220 {
2221 super.AfterStoreLoad();
2222
2224 {
2226 }
2227 }
2228
2230 {
2231
2233
2234
2237
2238
2240 }
2241
2243 {
2244 super.OnCreatePhysics();
2245
2246 ConstructionInit();
2248 }
2249
2251 {
2253 return;
2254
2255 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2256 }
2257
2259 {
2261 {
2263 }
2264
2265 super.EEOnAfterLoad();
2266 }
2267
2269 {
2270 super.EEItemAttached( item, slot_name );
2271
2275 }
2276
2278 {
2279 super.EEItemDetached( item, slot_name );
2280
2283 }
2284
2285 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2286 {
2289
2292 }
2293
2294
2296 {
2297 return true;
2298 }
2299
2300
2301
2303 {
2305
2306
2307 if (construtionPart.
IsBase())
2308 {
2310
2311
2313 }
2314
2315
2317
2318
2320
2321
2323
2325
2327
2328
2330
2331
2333 }
2334
2336 {
2337
2339 }
2340
2341
2343 {
2346
2347
2349
2350
2352
2353
2355
2356
2358
2360
2361
2363
2364
2366
2367
2368 if (construtionPart.
IsBase())
2369 {
2370
2372 }
2373 }
2374
2376 {
2377
2379 }
2380
2381
2382 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2383 {
2386
2387
2389
2390
2392
2393
2395
2396
2398
2400
2401
2403
2404
2406
2407
2408 if (construtionPart.
IsBase())
2409 {
2410
2412 }
2413 }
2414
2416 {
2417
2419 }
2420
2421
2423 {
2425
2428 }
2429
2431 {
2433
2435 {
2437 }
2438 else
2439 {
2441 }
2442
2444 }
2445
2447 {
2449
2451 foreach (
string slotName : attachmentSlots)
2452 {
2454 }
2455
2456
2459 else
2461
2463 }
2464
2466 {
2467 string slotNameMounted = slot_name + "_Mounted";
2468 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2469
2470 if (attachment)
2471 {
2472 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2473 if (barbedWire && barbedWire.IsMounted())
2475 else
2477
2478 if (is_locked)
2479 {
2480 SetAnimationPhase(slotNameMounted, 0);
2481 SetAnimationPhase(slot_name, 1);
2482 }
2483 else
2484 {
2485 SetAnimationPhase(slotNameMounted, 1);
2486 SetAnimationPhase(slot_name, 0);
2487 }
2488 }
2489 else
2490 {
2491 SetAnimationPhase(slotNameMounted, 1);
2492 SetAnimationPhase(slot_name, 1);
2493
2495 }
2496 }
2497
2498
2500 {
2503
2506
2509
2510 foreach (
string slotName : attachmentSlots)
2511 {
2513 }
2514
2515
2517 {
2520
2522 }
2523 else
2524 {
2527
2529 }
2530
2533 }
2534
2536 {
2537
2539 return;
2540
2541 string slot_name_mounted = slot_name + "_Mounted";
2542 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2543
2544
2546 RemoveProxyPhysics( slot_name_mounted );
2547 RemoveProxyPhysics( slot_name );
2548
2549 if ( attachment )
2550 {
2552 if ( is_locked )
2553 {
2555 AddProxyPhysics( slot_name_mounted );
2556 }
2557 else
2558 {
2560 AddProxyPhysics( slot_name );
2561 }
2562 }
2563 }
2564
2566 {
2567 SetAffectPathgraph( true, false );
2569 }
2570
2572 {
2573 return true;
2574 }
2575
2577 {
2578 return true;
2579 }
2580
2582 {
2583 if ( attachment )
2584 {
2586 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2587
2588 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2589 }
2590
2591 return false;
2592 }
2593
2595 {
2597 }
2598
2599
2601 {
2602 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2603 if (
g_Game.ConfigIsExisting( config_path ) )
2604 {
2605 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2606 }
2607 }
2608
2610 {
2611 return true;
2612 }
2613
2615 {
2616 return true;
2617 }
2618
2620 {
2621 return true;
2622 }
2623
2624
2626 {
2629 }
2630
2632 {
2634 }
2635
2637 {
2639 }
2640
2642 {
2643 int attachment_count = GetInventory().AttachmentCount();
2644 if ( attachment_count > 0 )
2645 {
2646 if (
HasBase() && attachment_count == 1 )
2647 {
2648 return false;
2649 }
2650
2651 return true;
2652 }
2653
2654 return false;
2655 }
2656
2658 {
2659 return true;
2660 }
2661
2663 {
2664 return false;
2665 }
2666
2667
2669 {
2670 return false;
2671 }
2672
2674 {
2675 return false;
2676 }
2677
2678
2680 {
2681 return false;
2682 }
2683
2684
2685
2687 {
2688 return true;
2689 }
2690
2692 {
2693 return true;
2694 }
2695
2698 {
2699 return false;
2700 }
2701
2702
2704 {
2705 return false;
2706 }
2707
2708
2710 {
2711 return true;
2712 }
2713
2714
2716 {
2717 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2718 {
2719 return false;
2720 }
2721
2722 return true;
2723 }
2724
2726 {
2729
2730 return item;
2731 }
2732
2733
2735 {
2737 {
2738
2740
2741
2744
2746 if ( MemoryPointExists( slot_name + "_min" ) )
2747 {
2748 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2749 }
2750 if ( MemoryPointExists( slot_name + "_max" ) )
2751 {
2752 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2753 }
2754
2755
2758
2759
2762 center = ModelToWorld( center );
2763
2764
2767
2768 areaDamage.SetExtents( extents[0], extents[1] );
2769 areaDamage.SetAreaPosition( center );
2773 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2774 areaDamage.SetAmmoName( "BarbedWireHit" );
2775 areaDamage.Spawn();
2776
2778 }
2779 }
2780
2782 {
2783 if ( angle_deg != 0 )
2784 {
2785
2787
2788
2790 if ( MemoryPointExists( "rotate_axis" ) )
2791 {
2792 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2793 }
2794 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];
2795 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];
2796 center[0] = r_center_x;
2797 center[2] = r_center_z;
2798 }
2799 }
2800
2802 {
2804 {
2807 {
2808 if (areaDamage)
2809 {
2810 areaDamage.Destroy();
2811 }
2812
2814 }
2815 }
2816 }
2817
2819 {
2820 return true;
2821 }
2822
2823
2824
2825
2827 {
2829 }
2830
2832 {
2834 }
2835
2837 {
2839 }
2840
2842 {
2844
2845 switch ( material_type )
2846 {
2852 }
2853
2854 return "";
2855 }
2856
2858 {
2860
2861 switch ( material_type )
2862 {
2868 }
2869
2870 return "";
2871 }
2872
2873
2875 {
2877 {
2878
2880 {
2881 SetHealth(slot_name,"Health",item.GetHealth());
2882 }
2883 }
2884 }
2885
2887 {
2888 return 111;
2889 }
2890
2892 {
2893 super.SetActions();
2894
2898 }
2899
2901 {
2903 if (!construction)
2904 return;
2905
2907 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2908 {
2911 {
2913 }
2914 }
2915 }
2916
2918 {
2920 if (!construction)
2921 return;
2922
2924 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2925 {
2928 {
2929 construction.HandleEntityFalling(part.
GetPartName());
2930 }
2931 }
2932 }
2933
2936 {
2938 return;
2939
2942
2943 if (DestroyOnFall())
2944 {
2946 {
2948 }
2949 else
2950 {
2952 {
2954 }
2956 }
2957 }
2958 }
2959
2961 {
2962 if (HasAnyAttachmentsOrCargo())
2963 {
2966 }
2967 }
2968
2969
2970
2971
2972
2975 {
2976 return null;
2977 }
2978
2980 {
2982 }
2983
2985 {
2988
2989 Man p;
2990
2991 #ifdef SERVER
2993 g_Game.GetWorld().GetPlayerList(players);
2994 if (players.Count())
2995 p = players[0];
2996 #else
2998 #endif
2999
3001 {
3002 bool excluded = false;
3004 if (excludes)
3005 {
3006 foreach (string exclude : excludes)
3007 {
3009 {
3010 excluded = true;
3011 break;
3012 }
3013 }
3014 }
3015
3016 if (!excluded)
3017 {
3019 }
3020 }
3021
3023 }
3024
3026
3028 [
Obsolete(
"handled in the Construction component directly")]
3030 {
3031 }
3032
3033 [
Obsolete(
"handled in the Construction component directly")]
3035 {
3036 }
3037
3038 [
Obsolete(
"obsolete debug method")]
3040 {
3041 }
3042}
3043
3045{
3046#ifdef BSB_DEBUG
3048#else
3049
3050#endif
3051}
3053{
3054#ifdef BSB_DEBUG_SPAM
3056#else
3057
3058#endif
3059}
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.