1795{
1797
1799
1801
1808
1809
1810
1816
1822
1824
1828
1829
1831 {
1833
1834
1835 RegisterNetSyncVariableInt( "m_SyncParts01" );
1836 RegisterNetSyncVariableInt( "m_SyncParts02" );
1837 RegisterNetSyncVariableInt( "m_SyncParts03" );
1838 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1839 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1840 RegisterNetSyncVariableBool( "m_HasBase" );
1841
1842
1843 ConstructionInit();
1844
1845 if (ConfigIsExisting("hybridAttachments"))
1846 {
1849 }
1850 if (ConfigIsExisting("mountables"))
1851 {
1854 }
1855
1857 SetAllowDamage(true);
1858 }
1859
1861 {
1862 return "disableBaseDamage";
1863 }
1864
1866 {
1867 return true;
1868 }
1869
1871 {
1872 return EInventoryIconVisibility.HIDE_VICINITY;
1873 }
1874
1876 {
1877 super.InitItemSounds();
1878
1882
1887 }
1888
1890 {
1891 return "putDown_FenceKit_SoundSet";
1892 }
1893
1895 {
1896 return "Shelter_Site_Build_Loop_SoundSet";
1897 }
1898
1899
1901 {
1903 {
1904 SetSynchDirty();
1905 }
1906 }
1907
1909 {
1911 super.OnVariablesSynchronized();
1912
1914 }
1915
1917 {
1918
1920
1921
1923
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 else if ( part_id >= 32 && part_id <= 62 )
1972 {
1973 offset = ( part_id % 32 );
1974 mask = 1 << offset;
1975
1977 }
1978 else if ( part_id >= 63 && part_id <= 93 )
1979 {
1980 offset = ( part_id % 63 );
1981 mask = 1 << offset;
1982
1984 }
1985 }
1986
1988 {
1989
1990 int offset;
1991 int mask;
1992
1993 if ( part_id >= 1 && part_id <= 31 )
1994 {
1995 offset = part_id - 1;
1996 mask = 1 << offset;
1997
1999 {
2000 return true;
2001 }
2002 }
2003 else if ( part_id >= 32 && part_id <= 62 )
2004 {
2005 offset = ( part_id % 32 );
2006 mask = 1 << offset;
2007
2009 {
2010 return true;
2011 }
2012 }
2013 else if ( part_id >= 63 && part_id <= 93 )
2014 {
2015 offset = ( part_id % 63 );
2016 mask = 1 << offset;
2017
2019 {
2020 return true;
2021 }
2022 }
2023
2024 return false;
2025 }
2026
2028 {
2031 }
2032
2034 {
2035
2038 }
2039
2041 {
2043 {
2046
2047 switch( build_action_id )
2048 {
2052 }
2053 }
2054 }
2055
2056
2058 {
2060 bool is_base = part.
IsBase();
2063 if ( is_part_built_sync )
2064 {
2066 {
2070
2071 if (is_base)
2072 {
2075 }
2076 }
2077 }
2078 else
2079 {
2081 {
2085
2086 if (is_base)
2087 {
2090 }
2091 }
2092 }
2093
2094
2096 }
2097
2098
2100 {
2103
2104 for ( int i = 0; i < construction_parts.Count(); ++i )
2105 {
2106 string key = construction_parts.GetKey( i );
2109 }
2110
2111
2113 }
2114
2116 {
2119
2120 for ( int i = 0; i < construction_parts.Count(); ++i )
2121 {
2122 string key = construction_parts.GetKey( i );
2124
2125 if ( value.
GetId() ==
id )
2126 {
2127 return value;
2128 }
2129 }
2130
2131 return NULL;
2132 }
2133
2134
2135
2137 {
2139 }
2140
2142 {
2144 }
2145
2147 {
2148 return true;
2149 }
2150
2152 {
2153 return false;
2154 }
2155
2156
2158 {
2161 {
2163 }
2164
2165 return construction_kit;
2166 }
2167
2169 {
2172 {
2174 }
2175 }
2176
2178 {
2180 }
2181
2183 {
2184 return "";
2185 }
2186
2188 {
2190 g_Game.ObjectDelete( construction_kit );
2191 }
2192
2193
2195 {
2197 g_Game.ObjectDelete(
this );
2198 }
2199
2200
2202 {
2203 super.EEDelete(parent);
2204
2206 {
2207 areaDamage.Destroy();
2208 }
2209
2210 }
2211
2213 {
2214 super.OnStoreSave( ctx );
2215
2216
2220
2222 }
2223
2225 {
2226 if ( !super.OnStoreLoad( ctx, version ) )
2227 return false;
2228
2229
2230
2232 {
2234 return false;
2235 }
2237 {
2239 return false;
2240 }
2242 {
2244 return false;
2245 }
2246
2247
2249 {
2251 return false;
2252 }
2253
2254
2255 return true;
2256 }
2257
2259 {
2260 super.AfterStoreLoad();
2261
2263 {
2265 }
2266 }
2267
2269 {
2270
2272
2273
2276
2277
2279 }
2280
2282 {
2283 super.OnCreatePhysics();
2284
2285 ConstructionInit();
2287 }
2288
2290 {
2292 return;
2293
2294 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2295 }
2296
2298 {
2300 {
2302 }
2303
2304 super.EEOnAfterLoad();
2305 }
2306
2308 {
2309 super.EEItemAttached( item, slot_name );
2310
2314 }
2315
2317 {
2318 super.EEItemDetached( item, slot_name );
2319
2322 }
2323
2324 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2325 {
2328
2331 }
2332
2333
2335 {
2336 return true;
2337 }
2338
2339
2340
2342 {
2344
2345
2346 if (construtionPart.
IsBase())
2347 {
2349
2350
2352 }
2353
2354
2356
2357
2359
2360
2362
2364
2366
2367
2369
2370
2372 }
2373
2375 {
2376
2378 }
2379
2380
2382 {
2385
2386
2388
2389
2391
2392
2394
2395
2397
2399
2400
2402
2403
2405
2406
2407 if (construtionPart.
IsBase())
2408 {
2409
2411 }
2412 }
2413
2415 {
2416
2418 }
2419
2420
2421 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2422 {
2425
2426
2428
2429
2431
2432
2434
2435
2437
2439
2440
2442
2443
2445
2446
2447 if (construtionPart.
IsBase())
2448 {
2449
2451 }
2452 }
2453
2455 {
2456
2458 }
2459
2460
2462 {
2464
2467 }
2468
2470 {
2472
2474 {
2476 }
2477 else
2478 {
2480 }
2481
2483 }
2484
2486 {
2488
2490 foreach (
string slotName : attachmentSlots)
2491 {
2493 }
2494
2495
2498 else
2500
2502 }
2503
2505 {
2506 string slotNameMounted = slot_name + "_Mounted";
2507 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2508
2509 if (attachment)
2510 {
2511 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2512 if (barbedWire && barbedWire.IsMounted())
2514 else
2516
2517 if (is_locked)
2518 {
2519 SetAnimationPhase(slotNameMounted, 0);
2520 SetAnimationPhase(slot_name, 1);
2521 }
2522 else
2523 {
2524 SetAnimationPhase(slotNameMounted, 1);
2525 SetAnimationPhase(slot_name, 0);
2526 }
2527 }
2528 else
2529 {
2530 SetAnimationPhase(slotNameMounted, 1);
2531 SetAnimationPhase(slot_name, 1);
2532
2534 }
2535 }
2536
2537
2539 {
2542
2545
2548
2549 foreach (
string slotName : attachmentSlots)
2550 {
2552 }
2553
2554
2556 {
2559
2561 }
2562 else
2563 {
2566
2568 }
2569
2572 }
2573
2575 {
2576
2578 return;
2579
2580 string slot_name_mounted = slot_name + "_Mounted";
2581 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2582
2583
2585 RemoveProxyPhysics( slot_name_mounted );
2586 RemoveProxyPhysics( slot_name );
2587
2588 if ( attachment )
2589 {
2591 if ( is_locked )
2592 {
2594 AddProxyPhysics( slot_name_mounted );
2595 }
2596 else
2597 {
2599 AddProxyPhysics( slot_name );
2600 }
2601 }
2602 }
2603
2605 {
2606 SetAffectPathgraph( true, false );
2608 }
2609
2611 {
2612 return true;
2613 }
2614
2616 {
2617 return true;
2618 }
2619
2621 {
2622 if ( attachment )
2623 {
2625 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2626
2627 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2628 }
2629
2630 return false;
2631 }
2632
2634 {
2636 }
2637
2638
2640 {
2641 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2642 if (
g_Game.ConfigIsExisting( config_path ) )
2643 {
2644 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2645 }
2646 }
2647
2649 {
2650 return true;
2651 }
2652
2654 {
2655 return true;
2656 }
2657
2659 {
2660 return true;
2661 }
2662
2663
2665 {
2668 }
2669
2671 {
2673 }
2674
2676 {
2678 }
2679
2681 {
2682 int attachment_count = GetInventory().AttachmentCount();
2683 if ( attachment_count > 0 )
2684 {
2685 if (
HasBase() && attachment_count == 1 )
2686 {
2687 return false;
2688 }
2689
2690 return true;
2691 }
2692
2693 return false;
2694 }
2695
2697 {
2698 return true;
2699 }
2700
2702 {
2703 return false;
2704 }
2705
2706
2708 {
2709 return false;
2710 }
2711
2713 {
2714 return false;
2715 }
2716
2717
2719 {
2720 return false;
2721 }
2722
2723
2724
2726 {
2727 return true;
2728 }
2729
2731 {
2732 return true;
2733 }
2734
2737 {
2738 return false;
2739 }
2740
2741
2743 {
2744 return false;
2745 }
2746
2747
2749 {
2750 return true;
2751 }
2752
2753
2755 {
2756 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2757 {
2758 return false;
2759 }
2760
2761 return true;
2762 }
2763
2765 {
2768
2769 return item;
2770 }
2771
2772
2774 {
2776 {
2777
2779
2780
2783
2785 if ( MemoryPointExists( slot_name + "_min" ) )
2786 {
2787 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2788 }
2789 if ( MemoryPointExists( slot_name + "_max" ) )
2790 {
2791 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2792 }
2793
2794
2797
2798
2801 center = ModelToWorld( center );
2802
2803
2806
2807 areaDamage.SetExtents( extents[0], extents[1] );
2808 areaDamage.SetAreaPosition( center );
2812 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2813 areaDamage.SetAmmoName( "BarbedWireHit" );
2814 areaDamage.Spawn();
2815
2817 }
2818 }
2819
2821 {
2822 if ( angle_deg != 0 )
2823 {
2824
2826
2827
2829 if ( MemoryPointExists( "rotate_axis" ) )
2830 {
2831 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2832 }
2833 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];
2834 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];
2835 center[0] = r_center_x;
2836 center[2] = r_center_z;
2837 }
2838 }
2839
2841 {
2843 {
2846 {
2847 if (areaDamage)
2848 {
2849 areaDamage.Destroy();
2850 }
2851
2853 }
2854 }
2855 }
2856
2858 {
2859 return true;
2860 }
2861
2862
2863
2864
2866 {
2868 }
2869
2871 {
2873 }
2874
2876 {
2878 }
2879
2881 {
2883
2884 switch ( material_type )
2885 {
2891 }
2892
2893 return "";
2894 }
2895
2897 {
2899
2900 switch ( material_type )
2901 {
2907 }
2908
2909 return "";
2910 }
2911
2912
2914 {
2916 {
2917
2919 {
2920 SetHealth(slot_name,"Health",item.GetHealth());
2921 }
2922 }
2923 }
2924
2926 {
2927 return 111;
2928 }
2929
2931 {
2932 super.SetActions();
2933
2937 }
2938
2940 {
2942 if (!construction)
2943 return;
2944
2946 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2947 {
2950 {
2952 }
2953 }
2954 }
2955
2957 {
2959 if (!construction)
2960 return;
2961
2963 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2964 {
2967 {
2968 construction.HandleEntityFalling(part.
GetPartName());
2969 }
2970 }
2971 }
2972
2975 {
2977 return;
2978
2981
2982 if (DestroyOnFall())
2983 {
2985 {
2987 }
2988 else
2989 {
2991 {
2993 }
2995 }
2996 }
2997 }
2998
3000 {
3001 if (HasAnyAttachmentsOrCargo())
3002 {
3005 }
3006 }
3007
3008
3009
3010
3011
3014 {
3015 return null;
3016 }
3017
3019 {
3021 }
3022
3024 {
3027
3028 Man p;
3029
3030 #ifdef SERVER
3032 g_Game.GetWorld().GetPlayerList(players);
3033 if (players.Count())
3034 p = players[0];
3035 #else
3037 #endif
3038
3040 {
3041 bool excluded = false;
3043 if (excludes)
3044 {
3045 foreach (string exclude : excludes)
3046 {
3048 {
3049 excluded = true;
3050 break;
3051 }
3052 }
3053 }
3054
3055 if (!excluded)
3056 {
3058 }
3059 }
3060
3062 }
3063
3065
3067 [
Obsolete(
"handled in the Construction component directly")]
3069 {
3070 }
3071
3072 [
Obsolete(
"handled in the Construction component directly")]
3074 {
3075 }
3076
3077 [
Obsolete(
"obsolete debug method")]
3079 {
3080 }
3081}
3082
3084{
3085#ifdef BSB_DEBUG
3087#else
3088
3089#endif
3090}
3092{
3093#ifdef BSB_DEBUG_SPAM
3095#else
3096
3097#endif
3098}
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.