1814{
1816
1818
1820
1827
1828
1829
1835
1841
1843
1847
1848
1850 {
1852
1853
1854 RegisterNetSyncVariableInt( "m_SyncParts01" );
1855 RegisterNetSyncVariableInt( "m_SyncParts02" );
1856 RegisterNetSyncVariableInt( "m_SyncParts03" );
1857 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1858 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1859 RegisterNetSyncVariableBool( "m_HasBase" );
1860
1861
1862 ConstructionInit();
1863
1864 if (ConfigIsExisting("hybridAttachments"))
1865 {
1868 }
1869 if (ConfigIsExisting("mountables"))
1870 {
1873 }
1874
1876 SetAllowDamage(true);
1877 }
1878
1880 {
1881 return "disableBaseDamage";
1882 }
1883
1885 {
1886 return true;
1887 }
1888
1890 {
1891 return EInventoryIconVisibility.HIDE_VICINITY;
1892 }
1893
1895 {
1896 super.InitItemSounds();
1897
1901
1906 }
1907
1909 {
1910 return "putDown_FenceKit_SoundSet";
1911 }
1912
1914 {
1915 return "Shelter_Site_Build_Loop_SoundSet";
1916 }
1917
1918
1920 {
1922 {
1923 SetSynchDirty();
1924 }
1925 }
1926
1928 {
1930 super.OnVariablesSynchronized();
1931
1933 }
1934
1936 {
1937
1939
1940
1942
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 else if ( part_id >= 32 && part_id <= 62 )
1962 {
1963 offset = ( part_id % 32 );
1964 mask = 1 << offset;
1965
1967 }
1968 else if ( part_id >= 63 && part_id <= 93 )
1969 {
1970 offset = ( part_id % 63 );
1971 mask = 1 << offset;
1972
1974 }
1975 }
1976
1978 {
1979
1980 int offset;
1981 int mask;
1982
1983 if ( part_id >= 1 && part_id <= 31 )
1984 {
1985 offset = part_id - 1;
1986 mask = 1 << offset;
1987
1989 }
1990 else if ( part_id >= 32 && part_id <= 62 )
1991 {
1992 offset = ( part_id % 32 );
1993 mask = 1 << offset;
1994
1996 }
1997 else if ( part_id >= 63 && part_id <= 93 )
1998 {
1999 offset = ( part_id % 63 );
2000 mask = 1 << offset;
2001
2003 }
2004 }
2005
2007 {
2008
2009 int offset;
2010 int mask;
2011
2012 if ( part_id >= 1 && part_id <= 31 )
2013 {
2014 offset = part_id - 1;
2015 mask = 1 << offset;
2016
2018 {
2019 return true;
2020 }
2021 }
2022 else if ( part_id >= 32 && part_id <= 62 )
2023 {
2024 offset = ( part_id % 32 );
2025 mask = 1 << offset;
2026
2028 {
2029 return true;
2030 }
2031 }
2032 else if ( part_id >= 63 && part_id <= 93 )
2033 {
2034 offset = ( part_id % 63 );
2035 mask = 1 << offset;
2036
2038 {
2039 return true;
2040 }
2041 }
2042
2043 return false;
2044 }
2045
2047 {
2050 }
2051
2053 {
2054
2057 }
2058
2060 {
2062 {
2065
2066 switch( build_action_id )
2067 {
2071 }
2072 }
2073 }
2074
2075
2077 {
2079 bool is_base = part.
IsBase();
2082 if ( is_part_built_sync )
2083 {
2085 {
2089
2090 if (is_base)
2091 {
2094 }
2095 }
2096 }
2097 else
2098 {
2100 {
2104
2105 if (is_base)
2106 {
2109 }
2110 }
2111 }
2112
2113
2115 }
2116
2117
2119 {
2122
2123 for ( int i = 0; i < construction_parts.Count(); ++i )
2124 {
2125 string key = construction_parts.GetKey( i );
2128 }
2129
2130
2132 }
2133
2135 {
2138
2139 for ( int i = 0; i < construction_parts.Count(); ++i )
2140 {
2141 string key = construction_parts.GetKey( i );
2143
2144 if ( value.
GetId() ==
id )
2145 {
2146 return value;
2147 }
2148 }
2149
2150 return NULL;
2151 }
2152
2153
2154
2156 {
2158 }
2159
2161 {
2163 }
2164
2166 {
2167 return true;
2168 }
2169
2171 {
2172 return false;
2173 }
2174
2175
2177 {
2180 {
2182 }
2183
2184 return construction_kit;
2185 }
2186
2188 {
2191 {
2193 }
2194 }
2195
2197 {
2199 }
2200
2202 {
2203 return "";
2204 }
2205
2207 {
2209 g_Game.ObjectDelete( construction_kit );
2210 }
2211
2212
2214 {
2216 g_Game.ObjectDelete(
this );
2217 }
2218
2219
2221 {
2222 super.EEDelete(parent);
2223
2225 {
2226 areaDamage.Destroy();
2227 }
2228
2229 }
2230
2232 {
2233 super.OnStoreSave( ctx );
2234
2235
2239
2241 }
2242
2244 {
2245 if ( !super.OnStoreLoad( ctx, version ) )
2246 return false;
2247
2248
2249
2251 {
2253 return false;
2254 }
2256 {
2258 return false;
2259 }
2261 {
2263 return false;
2264 }
2265
2266
2268 {
2270 return false;
2271 }
2272
2273
2274 return true;
2275 }
2276
2278 {
2279 super.AfterStoreLoad();
2280
2282 {
2284 }
2285 }
2286
2288 {
2289
2291
2292
2295
2296
2298 }
2299
2301 {
2302 super.OnCreatePhysics();
2303
2304 ConstructionInit();
2306 }
2307
2309 {
2311 return;
2312
2313 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2314 }
2315
2317 {
2319 {
2321 }
2322
2323 super.EEOnAfterLoad();
2324 }
2325
2327 {
2328 super.EEItemAttached( item, slot_name );
2329
2333 }
2334
2336 {
2337 super.EEItemDetached( item, slot_name );
2338
2341 }
2342
2343 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2344 {
2347
2350 }
2351
2352
2354 {
2355 return true;
2356 }
2357
2358
2359
2361 {
2363
2364
2365 if (construtionPart.
IsBase())
2366 {
2368
2369
2371 }
2372
2373
2375
2376
2378
2379
2381
2383
2385
2386
2388
2389
2391 }
2392
2394 {
2395
2397 }
2398
2399
2401 {
2404
2405
2407
2408
2410
2411
2413
2414
2416
2418
2419
2421
2422
2424
2425
2426 if (construtionPart.
IsBase())
2427 {
2428
2430 }
2431 }
2432
2434 {
2435
2437 }
2438
2439
2440 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2441 {
2444
2445
2447
2448
2450
2451
2453
2454
2456
2458
2459
2461
2462
2464
2465
2466 if (construtionPart.
IsBase())
2467 {
2468
2470 }
2471 }
2472
2474 {
2475
2477 }
2478
2479
2481 {
2483
2486 }
2487
2489 {
2491
2493 {
2495 }
2496 else
2497 {
2499 }
2500
2502 }
2503
2505 {
2507
2509 foreach (
string slotName : attachmentSlots)
2510 {
2512 }
2513
2514
2517 else
2519
2521 }
2522
2524 {
2525 string slotNameMounted = slot_name + "_Mounted";
2526 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2527
2528 if (attachment)
2529 {
2530 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2531 if (barbedWire && barbedWire.IsMounted())
2533 else
2535
2536 if (is_locked)
2537 {
2538 SetAnimationPhase(slotNameMounted, 0);
2539 SetAnimationPhase(slot_name, 1);
2540 }
2541 else
2542 {
2543 SetAnimationPhase(slotNameMounted, 1);
2544 SetAnimationPhase(slot_name, 0);
2545 }
2546 }
2547 else
2548 {
2549 SetAnimationPhase(slotNameMounted, 1);
2550 SetAnimationPhase(slot_name, 1);
2551
2553 }
2554 }
2555
2556
2558 {
2561
2564
2567
2568 foreach (
string slotName : attachmentSlots)
2569 {
2571 }
2572
2573
2575 {
2578
2580 }
2581 else
2582 {
2585
2587 }
2588
2591 }
2592
2594 {
2595
2597 return;
2598
2599 string slot_name_mounted = slot_name + "_Mounted";
2600 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2601
2602
2604 RemoveProxyPhysics( slot_name_mounted );
2605 RemoveProxyPhysics( slot_name );
2606
2607 if ( attachment )
2608 {
2610 if ( is_locked )
2611 {
2613 AddProxyPhysics( slot_name_mounted );
2614 }
2615 else
2616 {
2618 AddProxyPhysics( slot_name );
2619 }
2620 }
2621 }
2622
2624 {
2625 SetAffectPathgraph( true, false );
2627 }
2628
2630 {
2631 return true;
2632 }
2633
2635 {
2636 return true;
2637 }
2638
2640 {
2641 if ( attachment )
2642 {
2644 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2645
2646 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2647 }
2648
2649 return false;
2650 }
2651
2653 {
2655 }
2656
2657
2659 {
2660 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2661 if (
g_Game.ConfigIsExisting( config_path ) )
2662 {
2663 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2664 }
2665 }
2666
2668 {
2669 return true;
2670 }
2671
2673 {
2674 return true;
2675 }
2676
2678 {
2679 return true;
2680 }
2681
2682
2684 {
2687 }
2688
2690 {
2692 }
2693
2695 {
2697 }
2698
2700 {
2701 int attachment_count = GetInventory().AttachmentCount();
2702 if ( attachment_count > 0 )
2703 {
2704 if (
HasBase() && attachment_count == 1 )
2705 {
2706 return false;
2707 }
2708
2709 return true;
2710 }
2711
2712 return false;
2713 }
2714
2716 {
2717 return true;
2718 }
2719
2721 {
2722 return false;
2723 }
2724
2725
2727 {
2728 return false;
2729 }
2730
2732 {
2733 return false;
2734 }
2735
2736
2738 {
2739 return false;
2740 }
2741
2742
2743
2745 {
2746 return true;
2747 }
2748
2750 {
2751 return true;
2752 }
2753
2756 {
2757 return false;
2758 }
2759
2760
2762 {
2763 return false;
2764 }
2765
2766
2768 {
2769 return true;
2770 }
2771
2772
2774 {
2775 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2776 {
2777 return false;
2778 }
2779
2780 return true;
2781 }
2782
2784 {
2787
2788 return item;
2789 }
2790
2791
2793 {
2795 {
2796
2798
2799
2802
2804 if ( MemoryPointExists( slot_name + "_min" ) )
2805 {
2806 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2807 }
2808 if ( MemoryPointExists( slot_name + "_max" ) )
2809 {
2810 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2811 }
2812
2813
2816
2817
2820 center = ModelToWorld( center );
2821
2822
2825
2826 areaDamage.SetExtents( extents[0], extents[1] );
2827 areaDamage.SetAreaPosition( center );
2831 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2832 areaDamage.SetAmmoName( "BarbedWireHit" );
2833 areaDamage.Spawn();
2834
2836 }
2837 }
2838
2840 {
2841 if ( angle_deg != 0 )
2842 {
2843
2845
2846
2848 if ( MemoryPointExists( "rotate_axis" ) )
2849 {
2850 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2851 }
2852 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];
2853 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];
2854 center[0] = r_center_x;
2855 center[2] = r_center_z;
2856 }
2857 }
2858
2860 {
2862 {
2865 {
2866 if (areaDamage)
2867 {
2868 areaDamage.Destroy();
2869 }
2870
2872 }
2873 }
2874 }
2875
2877 {
2878 return true;
2879 }
2880
2881
2882
2883
2885 {
2887 }
2888
2890 {
2892 }
2893
2895 {
2897 }
2898
2900 {
2902
2903 switch ( material_type )
2904 {
2910 }
2911
2912 return "";
2913 }
2914
2916 {
2918
2919 switch ( material_type )
2920 {
2926 }
2927
2928 return "";
2929 }
2930
2931
2933 {
2935 {
2936
2938 {
2939 SetHealth(slot_name,"Health",item.GetHealth());
2940 }
2941 }
2942 }
2943
2945 {
2946 return 111;
2947 }
2948
2950 {
2951 super.SetActions();
2952
2956 }
2957
2959 {
2961 if (!construction)
2962 return;
2963
2965 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2966 {
2969 {
2971 }
2972 }
2973 }
2974
2976 {
2978 if (!construction)
2979 return;
2980
2982 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2983 {
2986 {
2987 construction.HandleEntityFalling(part.
GetPartName());
2988 }
2989 }
2990 }
2991
2994 {
2996 return;
2997
3000
3001 if (DestroyOnFall())
3002 {
3004 {
3006 }
3007 else
3008 {
3010 {
3012 }
3014 }
3015 }
3016 }
3017
3019 {
3020 if (HasAnyAttachmentsOrCargo())
3021 {
3024 }
3025 }
3026
3027
3028
3029
3030
3033 {
3034 return null;
3035 }
3036
3038 {
3040 }
3041
3043 {
3046
3047 Man p;
3048
3049 #ifdef SERVER
3051 g_Game.GetWorld().GetPlayerList(players);
3052 if (players.Count())
3053 p = players[0];
3054 #else
3056 #endif
3057
3059 {
3060 bool excluded = false;
3062 if (excludes)
3063 {
3064 foreach (string exclude : excludes)
3065 {
3067 {
3068 excluded = true;
3069 break;
3070 }
3071 }
3072 }
3073
3074 if (!excluded)
3075 {
3077 }
3078 }
3079
3081 }
3082
3084
3086 [
Obsolete(
"handled in the Construction component directly")]
3088 {
3089 }
3090
3091 [
Obsolete(
"handled in the Construction component directly")]
3093 {
3094 }
3095
3096 [
Obsolete(
"obsolete debug method")]
3098 {
3099 }
3100}
3101
3103{
3104#ifdef BSB_DEBUG
3106#else
3107
3108#endif
3109}
3111{
3112#ifdef BSB_DEBUG_SPAM
3114#else
3115
3116#endif
3117}
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.