1787{
1789
1791
1793
1800
1801
1802
1808
1814
1816
1820
1821
1823 {
1825
1826
1827 RegisterNetSyncVariableInt( "m_SyncParts01" );
1828 RegisterNetSyncVariableInt( "m_SyncParts02" );
1829 RegisterNetSyncVariableInt( "m_SyncParts03" );
1830 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1831 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1832 RegisterNetSyncVariableBool( "m_HasBase" );
1833
1834
1835 ConstructionInit();
1836
1837 if (ConfigIsExisting("hybridAttachments"))
1838 {
1841 }
1842 if (ConfigIsExisting("mountables"))
1843 {
1846 }
1847
1849 SetAllowDamage(true);
1850 }
1851
1853 {
1854 return "disableBaseDamage";
1855 }
1856
1858 {
1859 return true;
1860 }
1861
1863 {
1864 return EInventoryIconVisibility.HIDE_VICINITY;
1865 }
1866
1868 {
1869 super.InitItemSounds();
1870
1874
1879 }
1880
1882 {
1883 return "putDown_FenceKit_SoundSet";
1884 }
1885
1887 {
1888 return "Shelter_Site_Build_Loop_SoundSet";
1889 }
1890
1891
1893 {
1895 {
1896 SetSynchDirty();
1897 }
1898 }
1899
1901 {
1903 super.OnVariablesSynchronized();
1904
1906 }
1907
1909 {
1910
1912
1913
1915
1916
1918 }
1919
1920
1922 {
1923
1924 int offset;
1925 int mask;
1926
1927 if ( part_id >= 1 && part_id <= 31 )
1928 {
1929 offset = part_id - 1;
1930 mask = 1 << offset;
1931
1933 }
1934 else if ( part_id >= 32 && part_id <= 62 )
1935 {
1936 offset = ( part_id % 32 );
1937 mask = 1 << offset;
1938
1940 }
1941 else if ( part_id >= 63 && part_id <= 93 )
1942 {
1943 offset = ( part_id % 63 );
1944 mask = 1 << offset;
1945
1947 }
1948 }
1949
1951 {
1952
1953 int offset;
1954 int mask;
1955
1956 if ( part_id >= 1 && part_id <= 31 )
1957 {
1958 offset = part_id - 1;
1959 mask = 1 << offset;
1960
1962 }
1963 else if ( part_id >= 32 && part_id <= 62 )
1964 {
1965 offset = ( part_id % 32 );
1966 mask = 1 << offset;
1967
1969 }
1970 else if ( part_id >= 63 && part_id <= 93 )
1971 {
1972 offset = ( part_id % 63 );
1973 mask = 1 << offset;
1974
1976 }
1977 }
1978
1980 {
1981
1982 int offset;
1983 int mask;
1984
1985 if ( part_id >= 1 && part_id <= 31 )
1986 {
1987 offset = part_id - 1;
1988 mask = 1 << offset;
1989
1991 {
1992 return true;
1993 }
1994 }
1995 else if ( part_id >= 32 && part_id <= 62 )
1996 {
1997 offset = ( part_id % 32 );
1998 mask = 1 << offset;
1999
2001 {
2002 return true;
2003 }
2004 }
2005 else if ( part_id >= 63 && part_id <= 93 )
2006 {
2007 offset = ( part_id % 63 );
2008 mask = 1 << offset;
2009
2011 {
2012 return true;
2013 }
2014 }
2015
2016 return false;
2017 }
2018
2020 {
2023 }
2024
2026 {
2027
2030 }
2031
2033 {
2035 {
2038
2039 switch( build_action_id )
2040 {
2044 }
2045 }
2046 }
2047
2048
2050 {
2052 bool is_base = part.
IsBase();
2055 if ( is_part_built_sync )
2056 {
2058 {
2062
2063 if (is_base)
2064 {
2067 }
2068 }
2069 }
2070 else
2071 {
2073 {
2077
2078 if (is_base)
2079 {
2082 }
2083 }
2084 }
2085
2086
2088 }
2089
2090
2092 {
2095
2096 for ( int i = 0; i < construction_parts.Count(); ++i )
2097 {
2098 string key = construction_parts.GetKey( i );
2101 }
2102
2103
2105 }
2106
2108 {
2111
2112 for ( int i = 0; i < construction_parts.Count(); ++i )
2113 {
2114 string key = construction_parts.GetKey( i );
2116
2117 if ( value.
GetId() ==
id )
2118 {
2119 return value;
2120 }
2121 }
2122
2123 return NULL;
2124 }
2125
2126
2127
2129 {
2131 }
2132
2134 {
2136 }
2137
2139 {
2140 return true;
2141 }
2142
2144 {
2145 return false;
2146 }
2147
2148
2150 {
2153 {
2155 }
2156
2157 return construction_kit;
2158 }
2159
2161 {
2164 {
2166 }
2167 }
2168
2170 {
2172 }
2173
2175 {
2176 return "";
2177 }
2178
2180 {
2182 g_Game.ObjectDelete( construction_kit );
2183 }
2184
2185
2187 {
2189 g_Game.ObjectDelete(
this );
2190 }
2191
2192
2194 {
2195 super.EEDelete(parent);
2196
2198 {
2199 areaDamage.Destroy();
2200 }
2201
2202 }
2203
2205 {
2206 super.OnStoreSave( ctx );
2207
2208
2212
2214 }
2215
2217 {
2218 if ( !super.OnStoreLoad( ctx, version ) )
2219 return false;
2220
2221
2222
2224 {
2226 return false;
2227 }
2229 {
2231 return false;
2232 }
2234 {
2236 return false;
2237 }
2238
2239
2241 {
2243 return false;
2244 }
2245
2246
2247 return true;
2248 }
2249
2251 {
2252 super.AfterStoreLoad();
2253
2255 {
2257 }
2258 }
2259
2261 {
2262
2264
2265
2268
2269
2271 }
2272
2274 {
2275 super.OnCreatePhysics();
2276
2277 ConstructionInit();
2279 }
2280
2282 {
2284 return;
2285
2286 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2287 }
2288
2290 {
2292 {
2294 }
2295
2296 super.EEOnAfterLoad();
2297 }
2298
2300 {
2301 super.EEItemAttached( item, slot_name );
2302
2306 }
2307
2309 {
2310 super.EEItemDetached( item, slot_name );
2311
2314 }
2315
2316 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2317 {
2320
2323 }
2324
2325
2327 {
2328 return true;
2329 }
2330
2331
2332
2334 {
2336
2337
2338 if (construtionPart.
IsBase())
2339 {
2341
2342
2344 }
2345
2346
2348
2349
2351
2352
2354
2356
2358
2359
2361
2362
2364 }
2365
2367 {
2368
2370 }
2371
2372
2374 {
2377
2378
2380
2381
2383
2384
2386
2387
2389
2391
2392
2394
2395
2397
2398
2399 if (construtionPart.
IsBase())
2400 {
2401
2403 }
2404 }
2405
2407 {
2408
2410 }
2411
2412
2413 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2414 {
2417
2418
2420
2421
2423
2424
2426
2427
2429
2431
2432
2434
2435
2437
2438
2439 if (construtionPart.
IsBase())
2440 {
2441
2443 }
2444 }
2445
2447 {
2448
2450 }
2451
2452
2454 {
2456
2459 }
2460
2462 {
2464
2466 {
2468 }
2469 else
2470 {
2472 }
2473
2475 }
2476
2478 {
2480
2482 foreach (
string slotName : attachmentSlots)
2483 {
2485 }
2486
2487
2490 else
2492
2494 }
2495
2497 {
2498 string slotNameMounted = slot_name + "_Mounted";
2499 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2500
2501 if (attachment)
2502 {
2503 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2504 if (barbedWire && barbedWire.IsMounted())
2506 else
2508
2509 if (is_locked)
2510 {
2511 SetAnimationPhase(slotNameMounted, 0);
2512 SetAnimationPhase(slot_name, 1);
2513 }
2514 else
2515 {
2516 SetAnimationPhase(slotNameMounted, 1);
2517 SetAnimationPhase(slot_name, 0);
2518 }
2519 }
2520 else
2521 {
2522 SetAnimationPhase(slotNameMounted, 1);
2523 SetAnimationPhase(slot_name, 1);
2524
2526 }
2527 }
2528
2529
2531 {
2534
2537
2540
2541 foreach (
string slotName : attachmentSlots)
2542 {
2544 }
2545
2546
2548 {
2551
2553 }
2554 else
2555 {
2558
2560 }
2561
2564 }
2565
2567 {
2568
2570 return;
2571
2572 string slot_name_mounted = slot_name + "_Mounted";
2573 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2574
2575
2577 RemoveProxyPhysics( slot_name_mounted );
2578 RemoveProxyPhysics( slot_name );
2579
2580 if ( attachment )
2581 {
2583 if ( is_locked )
2584 {
2586 AddProxyPhysics( slot_name_mounted );
2587 }
2588 else
2589 {
2591 AddProxyPhysics( slot_name );
2592 }
2593 }
2594 }
2595
2597 {
2598 SetAffectPathgraph( true, false );
2600 }
2601
2603 {
2604 return true;
2605 }
2606
2608 {
2609 return true;
2610 }
2611
2613 {
2614 if ( attachment )
2615 {
2617 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2618
2619 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2620 }
2621
2622 return false;
2623 }
2624
2626 {
2628 }
2629
2630
2632 {
2633 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2634 if (
g_Game.ConfigIsExisting( config_path ) )
2635 {
2636 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2637 }
2638 }
2639
2641 {
2642 return true;
2643 }
2644
2646 {
2647 return true;
2648 }
2649
2651 {
2652 return true;
2653 }
2654
2655
2657 {
2660 }
2661
2663 {
2665 }
2666
2668 {
2670 }
2671
2673 {
2674 int attachment_count = GetInventory().AttachmentCount();
2675 if ( attachment_count > 0 )
2676 {
2677 if (
HasBase() && attachment_count == 1 )
2678 {
2679 return false;
2680 }
2681
2682 return true;
2683 }
2684
2685 return false;
2686 }
2687
2689 {
2690 return true;
2691 }
2692
2694 {
2695 return false;
2696 }
2697
2698
2700 {
2701 return false;
2702 }
2703
2705 {
2706 return false;
2707 }
2708
2709
2711 {
2712 return false;
2713 }
2714
2715
2716
2718 {
2719 return true;
2720 }
2721
2723 {
2724 return true;
2725 }
2726
2729 {
2730 return false;
2731 }
2732
2733
2735 {
2736 return false;
2737 }
2738
2739
2741 {
2742 return true;
2743 }
2744
2745
2747 {
2748 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2749 {
2750 return false;
2751 }
2752
2753 return true;
2754 }
2755
2757 {
2760
2761 return item;
2762 }
2763
2764
2766 {
2768 {
2769
2771
2772
2775
2777 if ( MemoryPointExists( slot_name + "_min" ) )
2778 {
2779 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2780 }
2781 if ( MemoryPointExists( slot_name + "_max" ) )
2782 {
2783 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2784 }
2785
2786
2789
2790
2793 center = ModelToWorld( center );
2794
2795
2798
2799 areaDamage.SetExtents( extents[0], extents[1] );
2800 areaDamage.SetAreaPosition( center );
2804 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2805 areaDamage.SetAmmoName( "BarbedWireHit" );
2806 areaDamage.Spawn();
2807
2809 }
2810 }
2811
2813 {
2814 if ( angle_deg != 0 )
2815 {
2816
2818
2819
2821 if ( MemoryPointExists( "rotate_axis" ) )
2822 {
2823 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2824 }
2825 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];
2826 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];
2827 center[0] = r_center_x;
2828 center[2] = r_center_z;
2829 }
2830 }
2831
2833 {
2835 {
2838 {
2839 if (areaDamage)
2840 {
2841 areaDamage.Destroy();
2842 }
2843
2845 }
2846 }
2847 }
2848
2850 {
2851 return true;
2852 }
2853
2854
2855
2856
2858 {
2860 }
2861
2863 {
2865 }
2866
2868 {
2870 }
2871
2873 {
2875
2876 switch ( material_type )
2877 {
2883 }
2884
2885 return "";
2886 }
2887
2889 {
2891
2892 switch ( material_type )
2893 {
2899 }
2900
2901 return "";
2902 }
2903
2904
2906 {
2908 {
2909
2911 {
2912 SetHealth(slot_name,"Health",item.GetHealth());
2913 }
2914 }
2915 }
2916
2918 {
2919 return 111;
2920 }
2921
2923 {
2924 super.SetActions();
2925
2929 }
2930
2932 {
2934 if (!construction)
2935 return;
2936
2938 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2939 {
2942 {
2944 }
2945 }
2946 }
2947
2949 {
2951 if (!construction)
2952 return;
2953
2955 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2956 {
2959 {
2960 construction.HandleEntityFalling(part.
GetPartName());
2961 }
2962 }
2963 }
2964
2967 {
2969 return;
2970
2973
2974 if (DestroyOnFall())
2975 {
2977 {
2979 }
2980 else
2981 {
2983 {
2985 }
2987 }
2988 }
2989 }
2990
2992 {
2993 if (HasAnyAttachmentsOrCargo())
2994 {
2997 }
2998 }
2999
3000
3001
3002
3003
3006 {
3007 return null;
3008 }
3009
3011 {
3013 }
3014
3016 {
3019
3020 Man p;
3021
3022 #ifdef SERVER
3024 g_Game.GetWorld().GetPlayerList(players);
3025 if (players.Count())
3026 p = players[0];
3027 #else
3029 #endif
3030
3032 {
3033 bool excluded = false;
3035 if (excludes)
3036 {
3037 foreach (string exclude : excludes)
3038 {
3040 {
3041 excluded = true;
3042 break;
3043 }
3044 }
3045 }
3046
3047 if (!excluded)
3048 {
3050 }
3051 }
3052
3054 }
3055
3057
3059 [
Obsolete(
"handled in the Construction component directly")]
3061 {
3062 }
3063
3064 [
Obsolete(
"handled in the Construction component directly")]
3066 {
3067 }
3068
3069 [
Obsolete(
"obsolete debug method")]
3071 {
3072 }
3073}
3074
3076{
3077#ifdef BSB_DEBUG
3079#else
3080
3081#endif
3082}
3084{
3085#ifdef BSB_DEBUG_SPAM
3087#else
3088
3089#endif
3090}
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.