1766{
1768
1770
1772
1779
1780
1781
1787
1793
1795
1799
1800
1802 {
1804
1805
1806 RegisterNetSyncVariableInt( "m_SyncParts01" );
1807 RegisterNetSyncVariableInt( "m_SyncParts02" );
1808 RegisterNetSyncVariableInt( "m_SyncParts03" );
1809 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1810 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1811 RegisterNetSyncVariableBool( "m_HasBase" );
1812
1813
1814 ConstructionInit();
1815
1816 if (ConfigIsExisting("hybridAttachments"))
1817 {
1820 }
1821 if (ConfigIsExisting("mountables"))
1822 {
1825 }
1826
1828 SetAllowDamage(true);
1829 }
1830
1832 {
1833 return "disableBaseDamage";
1834 }
1835
1837 {
1838 return true;
1839 }
1840
1842 {
1843 return EInventoryIconVisibility.HIDE_VICINITY;
1844 }
1845
1847 {
1848 super.InitItemSounds();
1849
1853
1858 }
1859
1861 {
1862 return "putDown_FenceKit_SoundSet";
1863 }
1864
1866 {
1867 return "Shelter_Site_Build_Loop_SoundSet";
1868 }
1869
1870
1872 {
1874 {
1875 SetSynchDirty();
1876 }
1877 }
1878
1880 {
1882 super.OnVariablesSynchronized();
1883
1885 }
1886
1888 {
1889
1891
1892
1894
1895
1897 }
1898
1899
1901 {
1902
1903 int offset;
1904 int mask;
1905
1906 if ( part_id >= 1 && part_id <= 31 )
1907 {
1908 offset = part_id - 1;
1909 mask = 1 << offset;
1910
1912 }
1913 else if ( part_id >= 32 && part_id <= 62 )
1914 {
1915 offset = ( part_id % 32 );
1916 mask = 1 << offset;
1917
1919 }
1920 else if ( part_id >= 63 && part_id <= 93 )
1921 {
1922 offset = ( part_id % 63 );
1923 mask = 1 << offset;
1924
1926 }
1927 }
1928
1930 {
1931
1932 int offset;
1933 int mask;
1934
1935 if ( part_id >= 1 && part_id <= 31 )
1936 {
1937 offset = part_id - 1;
1938 mask = 1 << offset;
1939
1941 }
1942 else if ( part_id >= 32 && part_id <= 62 )
1943 {
1944 offset = ( part_id % 32 );
1945 mask = 1 << offset;
1946
1948 }
1949 else if ( part_id >= 63 && part_id <= 93 )
1950 {
1951 offset = ( part_id % 63 );
1952 mask = 1 << offset;
1953
1955 }
1956 }
1957
1959 {
1960
1961 int offset;
1962 int mask;
1963
1964 if ( part_id >= 1 && part_id <= 31 )
1965 {
1966 offset = part_id - 1;
1967 mask = 1 << offset;
1968
1970 {
1971 return true;
1972 }
1973 }
1974 else if ( part_id >= 32 && part_id <= 62 )
1975 {
1976 offset = ( part_id % 32 );
1977 mask = 1 << offset;
1978
1980 {
1981 return true;
1982 }
1983 }
1984 else if ( part_id >= 63 && part_id <= 93 )
1985 {
1986 offset = ( part_id % 63 );
1987 mask = 1 << offset;
1988
1990 {
1991 return true;
1992 }
1993 }
1994
1995 return false;
1996 }
1997
1999 {
2002 }
2003
2005 {
2006
2009 }
2010
2012 {
2014 {
2017
2018 switch( build_action_id )
2019 {
2023 }
2024 }
2025 }
2026
2027
2029 {
2031 bool is_base = part.
IsBase();
2034 if ( is_part_built_sync )
2035 {
2037 {
2041
2042 if (is_base)
2043 {
2046 }
2047 }
2048 }
2049 else
2050 {
2052 {
2056
2057 if (is_base)
2058 {
2061 }
2062 }
2063 }
2064
2065
2067 }
2068
2069
2071 {
2074
2075 for ( int i = 0; i < construction_parts.Count(); ++i )
2076 {
2077 string key = construction_parts.GetKey( i );
2080 }
2081
2082
2084 }
2085
2087 {
2090
2091 for ( int i = 0; i < construction_parts.Count(); ++i )
2092 {
2093 string key = construction_parts.GetKey( i );
2095
2096 if ( value.
GetId() ==
id )
2097 {
2098 return value;
2099 }
2100 }
2101
2102 return NULL;
2103 }
2104
2105
2106
2108 {
2110 }
2111
2113 {
2115 }
2116
2118 {
2119 return true;
2120 }
2121
2123 {
2124 return false;
2125 }
2126
2127
2129 {
2132 {
2134 }
2135
2136 return construction_kit;
2137 }
2138
2140 {
2143 {
2145 }
2146 }
2147
2149 {
2151 }
2152
2154 {
2155 return "";
2156 }
2157
2159 {
2161 g_Game.ObjectDelete( construction_kit );
2162 }
2163
2164
2166 {
2168 g_Game.ObjectDelete(
this );
2169 }
2170
2171
2173 {
2174 super.EEDelete(parent);
2175
2177 {
2178 areaDamage.Destroy();
2179 }
2180
2181 }
2182
2184 {
2185 super.OnStoreSave( ctx );
2186
2187
2191
2193 }
2194
2196 {
2197 if ( !super.OnStoreLoad( ctx, version ) )
2198 return false;
2199
2200
2201
2203 {
2205 return false;
2206 }
2208 {
2210 return false;
2211 }
2213 {
2215 return false;
2216 }
2217
2218
2220 {
2222 return false;
2223 }
2224
2225
2226 return true;
2227 }
2228
2230 {
2231 super.AfterStoreLoad();
2232
2234 {
2236 }
2237 }
2238
2240 {
2241
2243
2244
2247
2248
2250 }
2251
2253 {
2254 super.OnCreatePhysics();
2255
2256 ConstructionInit();
2258 }
2259
2261 {
2263 return;
2264
2265 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2266 }
2267
2269 {
2271 {
2273 }
2274
2275 super.EEOnAfterLoad();
2276 }
2277
2279 {
2280 super.EEItemAttached( item, slot_name );
2281
2285 }
2286
2288 {
2289 super.EEItemDetached( item, slot_name );
2290
2293 }
2294
2295 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2296 {
2299
2302 }
2303
2304
2306 {
2307 return true;
2308 }
2309
2310
2311
2313 {
2315
2316
2317 if (construtionPart.
IsBase())
2318 {
2320
2321
2323 }
2324
2325
2327
2328
2330
2331
2333
2335
2337
2338
2340
2341
2343 }
2344
2346 {
2347
2349 }
2350
2351
2353 {
2356
2357
2359
2360
2362
2363
2365
2366
2368
2370
2371
2373
2374
2376
2377
2378 if (construtionPart.
IsBase())
2379 {
2380
2382 }
2383 }
2384
2386 {
2387
2389 }
2390
2391
2392 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2393 {
2396
2397
2399
2400
2402
2403
2405
2406
2408
2410
2411
2413
2414
2416
2417
2418 if (construtionPart.
IsBase())
2419 {
2420
2422 }
2423 }
2424
2426 {
2427
2429 }
2430
2431
2433 {
2435
2438 }
2439
2441 {
2443
2445 {
2447 }
2448 else
2449 {
2451 }
2452
2454 }
2455
2457 {
2459
2461 foreach (
string slotName : attachmentSlots)
2462 {
2464 }
2465
2466
2469 else
2471
2473 }
2474
2476 {
2477 string slotNameMounted = slot_name + "_Mounted";
2478 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2479
2480 if (attachment)
2481 {
2482 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2483 if (barbedWire && barbedWire.IsMounted())
2485 else
2487
2488 if (is_locked)
2489 {
2490 SetAnimationPhase(slotNameMounted, 0);
2491 SetAnimationPhase(slot_name, 1);
2492 }
2493 else
2494 {
2495 SetAnimationPhase(slotNameMounted, 1);
2496 SetAnimationPhase(slot_name, 0);
2497 }
2498 }
2499 else
2500 {
2501 SetAnimationPhase(slotNameMounted, 1);
2502 SetAnimationPhase(slot_name, 1);
2503
2505 }
2506 }
2507
2508
2510 {
2513
2516
2519
2520 foreach (
string slotName : attachmentSlots)
2521 {
2523 }
2524
2525
2527 {
2530
2532 }
2533 else
2534 {
2537
2539 }
2540
2543 }
2544
2546 {
2547
2549 return;
2550
2551 string slot_name_mounted = slot_name + "_Mounted";
2552 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2553
2554
2556 RemoveProxyPhysics( slot_name_mounted );
2557 RemoveProxyPhysics( slot_name );
2558
2559 if ( attachment )
2560 {
2562 if ( is_locked )
2563 {
2565 AddProxyPhysics( slot_name_mounted );
2566 }
2567 else
2568 {
2570 AddProxyPhysics( slot_name );
2571 }
2572 }
2573 }
2574
2576 {
2577 SetAffectPathgraph( true, false );
2579 }
2580
2582 {
2583 return true;
2584 }
2585
2587 {
2588 return true;
2589 }
2590
2592 {
2593 if ( attachment )
2594 {
2596 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2597
2598 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2599 }
2600
2601 return false;
2602 }
2603
2605 {
2607 }
2608
2609
2611 {
2612 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2613 if (
g_Game.ConfigIsExisting( config_path ) )
2614 {
2615 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2616 }
2617 }
2618
2620 {
2621 return true;
2622 }
2623
2625 {
2626 return true;
2627 }
2628
2630 {
2631 return true;
2632 }
2633
2634
2636 {
2639 }
2640
2642 {
2644 }
2645
2647 {
2649 }
2650
2652 {
2653 int attachment_count = GetInventory().AttachmentCount();
2654 if ( attachment_count > 0 )
2655 {
2656 if (
HasBase() && attachment_count == 1 )
2657 {
2658 return false;
2659 }
2660
2661 return true;
2662 }
2663
2664 return false;
2665 }
2666
2668 {
2669 return true;
2670 }
2671
2673 {
2674 return false;
2675 }
2676
2677
2679 {
2680 return false;
2681 }
2682
2684 {
2685 return false;
2686 }
2687
2688
2690 {
2691 return false;
2692 }
2693
2694
2695
2697 {
2698 return true;
2699 }
2700
2702 {
2703 return true;
2704 }
2705
2708 {
2709 return false;
2710 }
2711
2712
2714 {
2715 return false;
2716 }
2717
2718
2720 {
2721 return true;
2722 }
2723
2724
2726 {
2727 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2728 {
2729 return false;
2730 }
2731
2732 return true;
2733 }
2734
2736 {
2739
2740 return item;
2741 }
2742
2743
2745 {
2747 {
2748
2750
2751
2754
2756 if ( MemoryPointExists( slot_name + "_min" ) )
2757 {
2758 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2759 }
2760 if ( MemoryPointExists( slot_name + "_max" ) )
2761 {
2762 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2763 }
2764
2765
2768
2769
2772 center = ModelToWorld( center );
2773
2774
2777
2778 areaDamage.SetExtents( extents[0], extents[1] );
2779 areaDamage.SetAreaPosition( center );
2783 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2784 areaDamage.SetAmmoName( "BarbedWireHit" );
2785 areaDamage.Spawn();
2786
2788 }
2789 }
2790
2792 {
2793 if ( angle_deg != 0 )
2794 {
2795
2797
2798
2800 if ( MemoryPointExists( "rotate_axis" ) )
2801 {
2802 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2803 }
2804 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];
2805 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];
2806 center[0] = r_center_x;
2807 center[2] = r_center_z;
2808 }
2809 }
2810
2812 {
2814 {
2817 {
2818 if (areaDamage)
2819 {
2820 areaDamage.Destroy();
2821 }
2822
2824 }
2825 }
2826 }
2827
2829 {
2830 return true;
2831 }
2832
2833
2834
2835
2837 {
2839 }
2840
2842 {
2844 }
2845
2847 {
2849 }
2850
2852 {
2854
2855 switch ( material_type )
2856 {
2862 }
2863
2864 return "";
2865 }
2866
2868 {
2870
2871 switch ( material_type )
2872 {
2878 }
2879
2880 return "";
2881 }
2882
2883
2885 {
2887 {
2888
2890 {
2891 SetHealth(slot_name,"Health",item.GetHealth());
2892 }
2893 }
2894 }
2895
2897 {
2898 return 111;
2899 }
2900
2902 {
2903 super.SetActions();
2904
2908 }
2909
2911 {
2913 if (!construction)
2914 return;
2915
2917 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2918 {
2921 {
2923 }
2924 }
2925 }
2926
2928 {
2930 if (!construction)
2931 return;
2932
2934 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2935 {
2938 {
2939 construction.HandleEntityFalling(part.
GetPartName());
2940 }
2941 }
2942 }
2943
2946 {
2948 return;
2949
2952
2953 if (DestroyOnFall())
2954 {
2956 {
2958 }
2959 else
2960 {
2962 {
2964 }
2966 }
2967 }
2968 }
2969
2971 {
2972 if (HasAnyAttachmentsOrCargo())
2973 {
2976 }
2977 }
2978
2979
2980
2981
2982
2985 {
2986 return null;
2987 }
2988
2990 {
2992 }
2993
2995 {
2998
2999 Man p;
3000
3001 #ifdef SERVER
3003 g_Game.GetWorld().GetPlayerList(players);
3004 if (players.Count())
3005 p = players[0];
3006 #else
3008 #endif
3009
3011 {
3012 bool excluded = false;
3014 if (excludes)
3015 {
3016 foreach (string exclude : excludes)
3017 {
3019 {
3020 excluded = true;
3021 break;
3022 }
3023 }
3024 }
3025
3026 if (!excluded)
3027 {
3029 }
3030 }
3031
3033 }
3034
3036
3038 [
Obsolete(
"handled in the Construction component directly")]
3040 {
3041 }
3042
3043 [
Obsolete(
"handled in the Construction component directly")]
3045 {
3046 }
3047
3048 [
Obsolete(
"obsolete debug method")]
3050 {
3051 }
3052}
3053
3055{
3056#ifdef BSB_DEBUG
3058#else
3059
3060#endif
3061}
3063{
3064#ifdef BSB_DEBUG_SPAM
3066#else
3067
3068#endif
3069}
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.