1822{
1824
1826
1828
1835
1836
1837
1843
1849
1851
1855
1856
1858 {
1860
1861
1862 RegisterNetSyncVariableInt( "m_SyncParts01" );
1863 RegisterNetSyncVariableInt( "m_SyncParts02" );
1864 RegisterNetSyncVariableInt( "m_SyncParts03" );
1865 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1866 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1867 RegisterNetSyncVariableBool( "m_HasBase" );
1868
1869
1870 ConstructionInit();
1871
1872 if (ConfigIsExisting("hybridAttachments"))
1873 {
1876 }
1877 if (ConfigIsExisting("mountables"))
1878 {
1881 }
1882
1884 SetAllowDamage(true);
1885 }
1886
1888 {
1889 return "disableBaseDamage";
1890 }
1891
1893 {
1894 return true;
1895 }
1896
1898 {
1899 return EInventoryIconVisibility.HIDE_VICINITY;
1900 }
1901
1903 {
1904 super.InitItemSounds();
1905
1909
1914 }
1915
1917 {
1918 return "putDown_FenceKit_SoundSet";
1919 }
1920
1922 {
1923 return "Shelter_Site_Build_Loop_SoundSet";
1924 }
1925
1926
1928 {
1930 {
1931 SetSynchDirty();
1932 }
1933 }
1934
1936 {
1938 super.OnVariablesSynchronized();
1939
1941 }
1942
1944 {
1945
1947
1948
1950
1951
1953 }
1954
1955
1957 {
1958
1959 int offset;
1960 int mask;
1961
1962 if ( part_id >= 1 && part_id <= 31 )
1963 {
1964 offset = part_id - 1;
1965 mask = 1 << offset;
1966
1968 }
1969 else if ( part_id >= 32 && part_id <= 62 )
1970 {
1971 offset = ( part_id % 32 );
1972 mask = 1 << offset;
1973
1975 }
1976 else if ( part_id >= 63 && part_id <= 93 )
1977 {
1978 offset = ( part_id % 63 );
1979 mask = 1 << offset;
1980
1982 }
1983 }
1984
1986 {
1987
1988 int offset;
1989 int mask;
1990
1991 if ( part_id >= 1 && part_id <= 31 )
1992 {
1993 offset = part_id - 1;
1994 mask = 1 << offset;
1995
1997 }
1998 else if ( part_id >= 32 && part_id <= 62 )
1999 {
2000 offset = ( part_id % 32 );
2001 mask = 1 << offset;
2002
2004 }
2005 else if ( part_id >= 63 && part_id <= 93 )
2006 {
2007 offset = ( part_id % 63 );
2008 mask = 1 << offset;
2009
2011 }
2012 }
2013
2015 {
2016
2017 int offset;
2018 int mask;
2019
2020 if ( part_id >= 1 && part_id <= 31 )
2021 {
2022 offset = part_id - 1;
2023 mask = 1 << offset;
2024
2026 {
2027 return true;
2028 }
2029 }
2030 else if ( part_id >= 32 && part_id <= 62 )
2031 {
2032 offset = ( part_id % 32 );
2033 mask = 1 << offset;
2034
2036 {
2037 return true;
2038 }
2039 }
2040 else if ( part_id >= 63 && part_id <= 93 )
2041 {
2042 offset = ( part_id % 63 );
2043 mask = 1 << offset;
2044
2046 {
2047 return true;
2048 }
2049 }
2050
2051 return false;
2052 }
2053
2055 {
2058 }
2059
2061 {
2062
2065 }
2066
2068 {
2070 {
2073
2074 switch( build_action_id )
2075 {
2079 }
2080 }
2081 }
2082
2083
2085 {
2087 bool is_base = part.
IsBase();
2090 if ( is_part_built_sync )
2091 {
2093 {
2097
2098 if (is_base)
2099 {
2102 }
2103 }
2104 }
2105 else
2106 {
2108 {
2112
2113 if (is_base)
2114 {
2117 }
2118 }
2119 }
2120
2121
2123 }
2124
2125
2127 {
2130
2131 for ( int i = 0; i < construction_parts.Count(); ++i )
2132 {
2133 string key = construction_parts.GetKey( i );
2136 }
2137
2138
2140 }
2141
2143 {
2146
2147 for ( int i = 0; i < construction_parts.Count(); ++i )
2148 {
2149 string key = construction_parts.GetKey( i );
2151
2152 if ( value.
GetId() ==
id )
2153 {
2154 return value;
2155 }
2156 }
2157
2158 return NULL;
2159 }
2160
2161
2162
2164 {
2166 }
2167
2169 {
2171 }
2172
2174 {
2175 return true;
2176 }
2177
2179 {
2180 return false;
2181 }
2182
2183
2185 {
2188 {
2190 }
2191
2192 return construction_kit;
2193 }
2194
2196 {
2199 {
2201 }
2202 }
2203
2205 {
2207 }
2208
2210 {
2211 return "";
2212 }
2213
2215 {
2217 g_Game.ObjectDelete( construction_kit );
2218 }
2219
2220
2222 {
2224 g_Game.ObjectDelete(
this );
2225 }
2226
2227
2229 {
2230 super.EEDelete(parent);
2231
2233 {
2234 areaDamage.Destroy();
2235 }
2236
2237 }
2238
2240 {
2241 super.OnStoreSave( ctx );
2242
2243
2247
2249 }
2250
2252 {
2253 if ( !super.OnStoreLoad( ctx, version ) )
2254 return false;
2255
2256
2257
2259 {
2261 return false;
2262 }
2264 {
2266 return false;
2267 }
2269 {
2271 return false;
2272 }
2273
2274
2276 {
2278 return false;
2279 }
2280
2281
2282 return true;
2283 }
2284
2286 {
2287 super.AfterStoreLoad();
2288
2290 {
2292 }
2293 }
2294
2296 {
2297
2299
2300
2303
2304
2306 }
2307
2309 {
2310 super.OnCreatePhysics();
2311
2312 ConstructionInit();
2314 }
2315
2317 {
2319 return;
2320
2321 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2322 }
2323
2325 {
2327 {
2329 }
2330
2331 super.EEOnAfterLoad();
2332 }
2333
2335 {
2336 super.EEItemAttached( item, slot_name );
2337
2341 }
2342
2344 {
2345 super.EEItemDetached( item, slot_name );
2346
2349 }
2350
2351 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2352 {
2355
2358 }
2359
2360
2362 {
2363 return true;
2364 }
2365
2366
2367
2369 {
2371
2372
2373 if (construtionPart.
IsBase())
2374 {
2376
2377
2379 }
2380
2381
2383
2384
2386
2387
2389
2391
2393
2394
2396
2397
2399 }
2400
2402 {
2403
2405 }
2406
2407
2409 {
2412
2413
2415
2416
2418
2419
2421
2422
2424
2426
2427
2429
2430
2432
2433
2434 if (construtionPart.
IsBase())
2435 {
2436
2438 }
2439 }
2440
2442 {
2443
2445 }
2446
2447
2448 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2449 {
2452
2453
2455
2456
2458
2459
2461
2462
2464
2466
2467
2469
2470
2472
2473
2474 if (construtionPart.
IsBase())
2475 {
2476
2478 }
2479 }
2480
2482 {
2483
2485 }
2486
2487
2489 {
2491
2494 }
2495
2497 {
2499
2501 {
2503 }
2504 else
2505 {
2507 }
2508
2510 }
2511
2513 {
2515
2517 foreach (
string slotName : attachmentSlots)
2518 {
2520 }
2521
2522
2525 else
2527
2529 }
2530
2532 {
2533 string slotNameMounted = slot_name + "_Mounted";
2534 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2535
2536 if (attachment)
2537 {
2538 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2539 if (barbedWire && barbedWire.IsMounted())
2541 else
2543
2544 if (is_locked)
2545 {
2546 SetAnimationPhase(slotNameMounted, 0);
2547 SetAnimationPhase(slot_name, 1);
2548 }
2549 else
2550 {
2551 SetAnimationPhase(slotNameMounted, 1);
2552 SetAnimationPhase(slot_name, 0);
2553 }
2554 }
2555 else
2556 {
2557 SetAnimationPhase(slotNameMounted, 1);
2558 SetAnimationPhase(slot_name, 1);
2559
2561 }
2562 }
2563
2564
2566 {
2569
2572
2575
2576 foreach (
string slotName : attachmentSlots)
2577 {
2579 }
2580
2581
2583 {
2586
2588 }
2589 else
2590 {
2593
2595 }
2596
2599 }
2600
2602 {
2603
2605 return;
2606
2607 string slot_name_mounted = slot_name + "_Mounted";
2608 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2609
2610
2612 RemoveProxyPhysics( slot_name_mounted );
2613 RemoveProxyPhysics( slot_name );
2614
2615 if ( attachment )
2616 {
2618 if ( is_locked )
2619 {
2621 AddProxyPhysics( slot_name_mounted );
2622 }
2623 else
2624 {
2626 AddProxyPhysics( slot_name );
2627 }
2628 }
2629 }
2630
2632 {
2633 SetAffectPathgraph( true, false );
2635 }
2636
2638 {
2639 return true;
2640 }
2641
2643 {
2644 return true;
2645 }
2646
2648 {
2649 if ( attachment )
2650 {
2652 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2653
2654 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2655 }
2656
2657 return false;
2658 }
2659
2661 {
2663 }
2664
2665
2667 {
2668 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2669 if (
g_Game.ConfigIsExisting( config_path ) )
2670 {
2671 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2672 }
2673 }
2674
2676 {
2677 return true;
2678 }
2679
2681 {
2682 return true;
2683 }
2684
2686 {
2687 return true;
2688 }
2689
2690
2692 {
2695 }
2696
2698 {
2700 }
2701
2703 {
2705 }
2706
2708 {
2709 int attachment_count = GetInventory().AttachmentCount();
2710 if ( attachment_count > 0 )
2711 {
2712 if (
HasBase() && attachment_count == 1 )
2713 {
2714 return false;
2715 }
2716
2717 return true;
2718 }
2719
2720 return false;
2721 }
2722
2724 {
2725 return true;
2726 }
2727
2729 {
2730 return false;
2731 }
2732
2733
2735 {
2736 return false;
2737 }
2738
2740 {
2741 return false;
2742 }
2743
2744
2746 {
2747 return false;
2748 }
2749
2750
2751
2753 {
2754 return true;
2755 }
2756
2758 {
2759 return true;
2760 }
2761
2764 {
2765 return false;
2766 }
2767
2768
2770 {
2771 return false;
2772 }
2773
2774
2776 {
2777 return true;
2778 }
2779
2780
2782 {
2783 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2784 {
2785 return false;
2786 }
2787
2788 return true;
2789 }
2790
2792 {
2795
2796 return item;
2797 }
2798
2799
2801 {
2803 {
2804
2806
2807
2810
2812 if ( MemoryPointExists( slot_name + "_min" ) )
2813 {
2814 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2815 }
2816 if ( MemoryPointExists( slot_name + "_max" ) )
2817 {
2818 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2819 }
2820
2821
2824
2825
2828 center = ModelToWorld( center );
2829
2830
2833
2834 areaDamage.SetExtents( extents[0], extents[1] );
2835 areaDamage.SetAreaPosition( center );
2839 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2840 areaDamage.SetAmmoName( "BarbedWireHit" );
2841 areaDamage.Spawn();
2842
2844 }
2845 }
2846
2848 {
2849 if ( angle_deg != 0 )
2850 {
2851
2853
2854
2856 if ( MemoryPointExists( "rotate_axis" ) )
2857 {
2858 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2859 }
2860 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];
2861 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];
2862 center[0] = r_center_x;
2863 center[2] = r_center_z;
2864 }
2865 }
2866
2868 {
2870 {
2873 {
2874 if (areaDamage)
2875 {
2876 areaDamage.Destroy();
2877 }
2878
2880 }
2881 }
2882 }
2883
2885 {
2886 return true;
2887 }
2888
2889
2890
2891
2893 {
2895 }
2896
2898 {
2900 }
2901
2903 {
2905 }
2906
2908 {
2910
2911 switch ( material_type )
2912 {
2918 }
2919
2920 return "";
2921 }
2922
2924 {
2926
2927 switch ( material_type )
2928 {
2934 }
2935
2936 return "";
2937 }
2938
2939
2941 {
2943 {
2944
2946 {
2947 SetHealth(slot_name,"Health",item.GetHealth());
2948 }
2949 }
2950 }
2951
2953 {
2954 return 111;
2955 }
2956
2958 {
2959 super.SetActions();
2960
2964 }
2965
2967 {
2969 if (!construction)
2970 return;
2971
2973 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2974 {
2977 {
2979 }
2980 }
2981 }
2982
2984 {
2986 if (!construction)
2987 return;
2988
2990 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2991 {
2994 {
2995 construction.HandleEntityFalling(part.
GetPartName());
2996 }
2997 }
2998 }
2999
3002 {
3004 return;
3005
3008
3009 if (DestroyOnFall())
3010 {
3012 {
3014 }
3015 else
3016 {
3018 {
3020 }
3022 }
3023 }
3024 }
3025
3027 {
3028 if (HasAnyAttachmentsOrCargo())
3029 {
3032 }
3033 }
3034
3035
3036
3037
3038
3041 {
3042 return null;
3043 }
3044
3046 {
3048 }
3049
3051 {
3054
3055 Man p;
3056
3057 #ifdef SERVER
3059 g_Game.GetWorld().GetPlayerList(players);
3060 if (players.Count())
3061 p = players[0];
3062 #else
3064 #endif
3065
3067 {
3068 bool excluded = false;
3070 if (excludes)
3071 {
3072 foreach (string exclude : excludes)
3073 {
3075 {
3076 excluded = true;
3077 break;
3078 }
3079 }
3080 }
3081
3082 if (!excluded)
3083 {
3085 }
3086 }
3087
3089 }
3090
3092
3094 [
Obsolete(
"handled in the Construction component directly")]
3096 {
3097 }
3098
3099 [
Obsolete(
"handled in the Construction component directly")]
3101 {
3102 }
3103
3104 [
Obsolete(
"obsolete debug method")]
3106 {
3107 }
3108}
3109
3111{
3112#ifdef BSB_DEBUG
3114#else
3115
3116#endif
3117}
3119{
3120#ifdef BSB_DEBUG_SPAM
3122#else
3123
3124#endif
3125}
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.