1832{
1834
1836
1838
1845
1846
1847
1853
1859
1861
1865
1866
1868 {
1870
1871
1872 RegisterNetSyncVariableInt( "m_SyncParts01" );
1873 RegisterNetSyncVariableInt( "m_SyncParts02" );
1874 RegisterNetSyncVariableInt( "m_SyncParts03" );
1875 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1876 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1877 RegisterNetSyncVariableBool( "m_HasBase" );
1878
1879
1880 ConstructionInit();
1881
1882 if (ConfigIsExisting("hybridAttachments"))
1883 {
1886 }
1887 if (ConfigIsExisting("mountables"))
1888 {
1891 }
1892
1894 SetAllowDamage(true);
1895 }
1896
1898 {
1899 return "disableBaseDamage";
1900 }
1901
1903 {
1904 return true;
1905 }
1906
1908 {
1909 return EInventoryIconVisibility.HIDE_VICINITY;
1910 }
1911
1913 {
1914 super.InitItemSounds();
1915
1919
1924 }
1925
1927 {
1928 return "putDown_FenceKit_SoundSet";
1929 }
1930
1932 {
1933 return "Shelter_Site_Build_Loop_SoundSet";
1934 }
1935
1936
1938 {
1940 {
1941 SetSynchDirty();
1942 }
1943 }
1944
1946 {
1948 super.OnVariablesSynchronized();
1949
1951 }
1952
1954 {
1955
1957
1958
1960
1961
1963 }
1964
1965
1967 {
1968
1969 int offset;
1970 int mask;
1971
1972 if ( part_id >= 1 && part_id <= 31 )
1973 {
1974 offset = part_id - 1;
1975 mask = 1 << offset;
1976
1978 }
1979 else if ( part_id >= 32 && part_id <= 62 )
1980 {
1981 offset = ( part_id % 32 );
1982 mask = 1 << offset;
1983
1985 }
1986 else if ( part_id >= 63 && part_id <= 93 )
1987 {
1988 offset = ( part_id % 63 );
1989 mask = 1 << offset;
1990
1992 }
1993 }
1994
1996 {
1997
1998 int offset;
1999 int mask;
2000
2001 if ( part_id >= 1 && part_id <= 31 )
2002 {
2003 offset = part_id - 1;
2004 mask = 1 << offset;
2005
2007 }
2008 else if ( part_id >= 32 && part_id <= 62 )
2009 {
2010 offset = ( part_id % 32 );
2011 mask = 1 << offset;
2012
2014 }
2015 else if ( part_id >= 63 && part_id <= 93 )
2016 {
2017 offset = ( part_id % 63 );
2018 mask = 1 << offset;
2019
2021 }
2022 }
2023
2025 {
2026
2027 int offset;
2028 int mask;
2029
2030 if ( part_id >= 1 && part_id <= 31 )
2031 {
2032 offset = part_id - 1;
2033 mask = 1 << offset;
2034
2036 {
2037 return true;
2038 }
2039 }
2040 else if ( part_id >= 32 && part_id <= 62 )
2041 {
2042 offset = ( part_id % 32 );
2043 mask = 1 << offset;
2044
2046 {
2047 return true;
2048 }
2049 }
2050 else if ( part_id >= 63 && part_id <= 93 )
2051 {
2052 offset = ( part_id % 63 );
2053 mask = 1 << offset;
2054
2056 {
2057 return true;
2058 }
2059 }
2060
2061 return false;
2062 }
2063
2065 {
2068 }
2069
2071 {
2072
2075 }
2076
2078 {
2080 {
2083
2084 switch( build_action_id )
2085 {
2089 }
2090 }
2091 }
2092
2093
2095 {
2097 bool is_base = part.
IsBase();
2100 if ( is_part_built_sync )
2101 {
2103 {
2107
2108 if (is_base)
2109 {
2112 }
2113 }
2114 }
2115 else
2116 {
2118 {
2122
2123 if (is_base)
2124 {
2127 }
2128 }
2129 }
2130
2131
2133 }
2134
2135
2137 {
2140
2141 for ( int i = 0; i < construction_parts.Count(); ++i )
2142 {
2143 string key = construction_parts.GetKey( i );
2146 }
2147
2148
2150 }
2151
2153 {
2156
2157 for ( int i = 0; i < construction_parts.Count(); ++i )
2158 {
2159 string key = construction_parts.GetKey( i );
2161
2162 if ( value.
GetId() ==
id )
2163 {
2164 return value;
2165 }
2166 }
2167
2168 return NULL;
2169 }
2170
2171
2172
2174 {
2176 }
2177
2179 {
2181 }
2182
2184 {
2185 return true;
2186 }
2187
2189 {
2190 return false;
2191 }
2192
2193
2195 {
2198 {
2200 }
2201
2202 return construction_kit;
2203 }
2204
2206 {
2209 {
2211 }
2212 }
2213
2215 {
2217 }
2218
2220 {
2221 return "";
2222 }
2223
2225 {
2227 g_Game.ObjectDelete( construction_kit );
2228 }
2229
2230
2232 {
2234 g_Game.ObjectDelete(
this );
2235 }
2236
2237
2239 {
2240 super.EEDelete(parent);
2241
2243 {
2244 areaDamage.Destroy();
2245 }
2246
2247 }
2248
2250 {
2251 super.OnStoreSave( ctx );
2252
2253
2257
2259 }
2260
2262 {
2263 if ( !super.OnStoreLoad( ctx, version ) )
2264 return false;
2265
2266
2267
2269 {
2271 return false;
2272 }
2274 {
2276 return false;
2277 }
2279 {
2281 return false;
2282 }
2283
2284
2286 {
2288 return false;
2289 }
2290
2291
2292 return true;
2293 }
2294
2296 {
2297 super.AfterStoreLoad();
2298
2300 {
2302 }
2303 }
2304
2306 {
2307
2309
2310
2313
2314
2316 }
2317
2319 {
2320 super.OnCreatePhysics();
2321
2322 ConstructionInit();
2324 }
2325
2327 {
2329 return;
2330
2331 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2332 }
2333
2335 {
2337 {
2339 }
2340
2341 super.EEOnAfterLoad();
2342 }
2343
2345 {
2346 super.EEItemAttached( item, slot_name );
2347
2351 }
2352
2354 {
2355 super.EEItemDetached( item, slot_name );
2356
2359 }
2360
2361 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2362 {
2365
2368 }
2369
2370
2372 {
2373 return true;
2374 }
2375
2376
2377
2379 {
2381
2382
2383 if (construtionPart.
IsBase())
2384 {
2386
2387
2389 }
2390
2391
2393
2394
2396
2397
2399
2401
2403
2404
2406
2407
2409 }
2410
2412 {
2413
2415 }
2416
2417
2419 {
2422
2423
2425
2426
2428
2429
2431
2432
2434
2436
2437
2439
2440
2442
2443
2444 if (construtionPart.
IsBase())
2445 {
2446
2448 }
2449 }
2450
2452 {
2453
2455 }
2456
2457
2458 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2459 {
2462
2463
2465
2466
2468
2469
2471
2472
2474
2476
2477
2479
2480
2482
2483
2484 if (construtionPart.
IsBase())
2485 {
2486
2488 }
2489 }
2490
2492 {
2493
2495 }
2496
2497
2499 {
2501
2504 }
2505
2507 {
2509
2511 {
2513 }
2514 else
2515 {
2517 }
2518
2520 }
2521
2523 {
2525
2527 foreach (
string slotName : attachmentSlots)
2528 {
2530 }
2531
2532
2535 else
2537
2539 }
2540
2542 {
2543 string slotNameMounted = slot_name + "_Mounted";
2544 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2545
2546 if (attachment)
2547 {
2548 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2549 if (barbedWire && barbedWire.IsMounted())
2551 else
2553
2554 if (is_locked)
2555 {
2556 SetAnimationPhase(slotNameMounted, 0);
2557 SetAnimationPhase(slot_name, 1);
2558 }
2559 else
2560 {
2561 SetAnimationPhase(slotNameMounted, 1);
2562 SetAnimationPhase(slot_name, 0);
2563 }
2564 }
2565 else
2566 {
2567 SetAnimationPhase(slotNameMounted, 1);
2568 SetAnimationPhase(slot_name, 1);
2569
2571 }
2572 }
2573
2574
2576 {
2579
2582
2585
2586 foreach (
string slotName : attachmentSlots)
2587 {
2589 }
2590
2591
2593 {
2596
2598 }
2599 else
2600 {
2603
2605 }
2606
2609 }
2610
2612 {
2613
2615 return;
2616
2617 string slot_name_mounted = slot_name + "_Mounted";
2618 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2619
2620
2622 RemoveProxyPhysics( slot_name_mounted );
2623 RemoveProxyPhysics( slot_name );
2624
2625 if ( attachment )
2626 {
2628 if ( is_locked )
2629 {
2631 AddProxyPhysics( slot_name_mounted );
2632 }
2633 else
2634 {
2636 AddProxyPhysics( slot_name );
2637 }
2638 }
2639 }
2640
2642 {
2643 SetAffectPathgraph( true, false );
2645 }
2646
2648 {
2649 return true;
2650 }
2651
2653 {
2654 return true;
2655 }
2656
2658 {
2659 if ( attachment )
2660 {
2662 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2663
2664 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2665 }
2666
2667 return false;
2668 }
2669
2671 {
2673 }
2674
2675
2677 {
2678 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2679 if (
g_Game.ConfigIsExisting( config_path ) )
2680 {
2681 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2682 }
2683 }
2684
2686 {
2687 return true;
2688 }
2689
2691 {
2692 return true;
2693 }
2694
2696 {
2697 return true;
2698 }
2699
2700
2702 {
2705 }
2706
2708 {
2710 }
2711
2713 {
2715 }
2716
2718 {
2719 int attachment_count = GetInventory().AttachmentCount();
2720 if ( attachment_count > 0 )
2721 {
2722 if (
HasBase() && attachment_count == 1 )
2723 {
2724 return false;
2725 }
2726
2727 return true;
2728 }
2729
2730 return false;
2731 }
2732
2734 {
2735 return true;
2736 }
2737
2739 {
2740 return false;
2741 }
2742
2743
2745 {
2746 return false;
2747 }
2748
2750 {
2751 return false;
2752 }
2753
2754
2756 {
2757 return false;
2758 }
2759
2760
2761
2763 {
2764 return true;
2765 }
2766
2768 {
2769 return true;
2770 }
2771
2774 {
2775 return false;
2776 }
2777
2778
2780 {
2781 return false;
2782 }
2783
2784
2786 {
2787 return true;
2788 }
2789
2790
2792 {
2793 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2794 {
2795 return false;
2796 }
2797
2798 return true;
2799 }
2800
2802 {
2805
2806 return item;
2807 }
2808
2809
2811 {
2813 {
2814
2816
2817
2820
2822 if ( MemoryPointExists( slot_name + "_min" ) )
2823 {
2824 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2825 }
2826 if ( MemoryPointExists( slot_name + "_max" ) )
2827 {
2828 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2829 }
2830
2831
2834
2835
2838 center = ModelToWorld( center );
2839
2840
2843
2844 areaDamage.SetExtents( extents[0], extents[1] );
2845 areaDamage.SetAreaPosition( center );
2849 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2850 areaDamage.SetAmmoName( "BarbedWireHit" );
2851 areaDamage.Spawn();
2852
2854 }
2855 }
2856
2858 {
2859 if ( angle_deg != 0 )
2860 {
2861
2863
2864
2866 if ( MemoryPointExists( "rotate_axis" ) )
2867 {
2868 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2869 }
2870 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];
2871 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];
2872 center[0] = r_center_x;
2873 center[2] = r_center_z;
2874 }
2875 }
2876
2878 {
2880 {
2883 {
2884 if (areaDamage)
2885 {
2886 areaDamage.Destroy();
2887 }
2888
2890 }
2891 }
2892 }
2893
2895 {
2896 return true;
2897 }
2898
2899
2900
2901
2903 {
2905 }
2906
2908 {
2910 }
2911
2913 {
2915 }
2916
2918 {
2920
2921 switch ( material_type )
2922 {
2928 }
2929
2930 return "";
2931 }
2932
2934 {
2936
2937 switch ( material_type )
2938 {
2944 }
2945
2946 return "";
2947 }
2948
2949
2951 {
2953 {
2954
2956 {
2957 SetHealth(slot_name,"Health",item.GetHealth());
2958 }
2959 }
2960 }
2961
2963 {
2964 return 111;
2965 }
2966
2968 {
2969 super.SetActions();
2970
2974 }
2975
2977 {
2979 if (!construction)
2980 return;
2981
2983 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2984 {
2987 {
2989 }
2990 }
2991 }
2992
2994 {
2996 if (!construction)
2997 return;
2998
3000 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3001 {
3004 {
3005 construction.HandleEntityFalling(part.
GetPartName());
3006 }
3007 }
3008 }
3009
3012 {
3014 return;
3015
3018
3019 if (DestroyOnFall())
3020 {
3022 {
3024 }
3025 else
3026 {
3028 {
3030 }
3032 }
3033 }
3034 }
3035
3037 {
3038 if (HasAnyAttachmentsOrCargo())
3039 {
3042 }
3043 }
3044
3045
3046
3047
3048
3051 {
3052 return null;
3053 }
3054
3056 {
3058 }
3059
3061 {
3064
3065 Man p;
3066
3067 #ifdef SERVER
3069 g_Game.GetWorld().GetPlayerList(players);
3070 if (players.Count())
3071 p = players[0];
3072 #else
3074 #endif
3075
3077 {
3078 bool excluded = false;
3080 if (excludes)
3081 {
3082 foreach (string exclude : excludes)
3083 {
3085 {
3086 excluded = true;
3087 break;
3088 }
3089 }
3090 }
3091
3092 if (!excluded)
3093 {
3095 }
3096 }
3097
3099 }
3100
3102
3104 [
Obsolete(
"handled in the Construction component directly")]
3106 {
3107 }
3108
3109 [
Obsolete(
"handled in the Construction component directly")]
3111 {
3112 }
3113
3114 [
Obsolete(
"obsolete debug method")]
3116 {
3117 }
3118}
3119
3121{
3122#ifdef BSB_DEBUG
3124#else
3125
3126#endif
3127}
3129{
3130#ifdef BSB_DEBUG_SPAM
3132#else
3133
3134#endif
3135}
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.