1839{
1841
1843
1845
1852
1853
1854
1860
1866
1868
1872
1873
1875 {
1877
1878
1879 RegisterNetSyncVariableInt( "m_SyncParts01" );
1880 RegisterNetSyncVariableInt( "m_SyncParts02" );
1881 RegisterNetSyncVariableInt( "m_SyncParts03" );
1882 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1883 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1884 RegisterNetSyncVariableBool( "m_HasBase" );
1885
1886
1887 ConstructionInit();
1888
1889 if (ConfigIsExisting("hybridAttachments"))
1890 {
1893 }
1894 if (ConfigIsExisting("mountables"))
1895 {
1898 }
1899
1901 SetAllowDamage(true);
1902 }
1903
1905 {
1906 return "disableBaseDamage";
1907 }
1908
1910 {
1911 return true;
1912 }
1913
1915 {
1916 return EInventoryIconVisibility.HIDE_VICINITY;
1917 }
1918
1920 {
1921 super.InitItemSounds();
1922
1926
1931 }
1932
1934 {
1935 return "putDown_FenceKit_SoundSet";
1936 }
1937
1939 {
1940 return "Shelter_Site_Build_Loop_SoundSet";
1941 }
1942
1943
1945 {
1947 {
1948 SetSynchDirty();
1949 }
1950 }
1951
1953 {
1955 super.OnVariablesSynchronized();
1956
1958 }
1959
1961 {
1962
1964
1965
1967
1968
1970 }
1971
1972
1974 {
1975
1976 int offset;
1977 int mask;
1978
1979 if ( part_id >= 1 && part_id <= 31 )
1980 {
1981 offset = part_id - 1;
1982 mask = 1 << offset;
1983
1985 }
1986 else if ( part_id >= 32 && part_id <= 62 )
1987 {
1988 offset = ( part_id % 32 );
1989 mask = 1 << offset;
1990
1992 }
1993 else if ( part_id >= 63 && part_id <= 93 )
1994 {
1995 offset = ( part_id % 63 );
1996 mask = 1 << offset;
1997
1999 }
2000 }
2001
2003 {
2004
2005 int offset;
2006 int mask;
2007
2008 if ( part_id >= 1 && part_id <= 31 )
2009 {
2010 offset = part_id - 1;
2011 mask = 1 << offset;
2012
2014 }
2015 else if ( part_id >= 32 && part_id <= 62 )
2016 {
2017 offset = ( part_id % 32 );
2018 mask = 1 << offset;
2019
2021 }
2022 else if ( part_id >= 63 && part_id <= 93 )
2023 {
2024 offset = ( part_id % 63 );
2025 mask = 1 << offset;
2026
2028 }
2029 }
2030
2032 {
2033
2034 int offset;
2035 int mask;
2036
2037 if ( part_id >= 1 && part_id <= 31 )
2038 {
2039 offset = part_id - 1;
2040 mask = 1 << offset;
2041
2043 {
2044 return true;
2045 }
2046 }
2047 else if ( part_id >= 32 && part_id <= 62 )
2048 {
2049 offset = ( part_id % 32 );
2050 mask = 1 << offset;
2051
2053 {
2054 return true;
2055 }
2056 }
2057 else if ( part_id >= 63 && part_id <= 93 )
2058 {
2059 offset = ( part_id % 63 );
2060 mask = 1 << offset;
2061
2063 {
2064 return true;
2065 }
2066 }
2067
2068 return false;
2069 }
2070
2072 {
2075 }
2076
2078 {
2079
2082 }
2083
2085 {
2087 {
2090
2091 switch( build_action_id )
2092 {
2096 }
2097 }
2098 }
2099
2100
2102 {
2104 bool is_base = part.
IsBase();
2107 if ( is_part_built_sync )
2108 {
2110 {
2114
2115 if (is_base)
2116 {
2119 }
2120 }
2121 }
2122 else
2123 {
2125 {
2129
2130 if (is_base)
2131 {
2134 }
2135 }
2136 }
2137
2138
2140 }
2141
2142
2144 {
2147
2148 for ( int i = 0; i < construction_parts.Count(); ++i )
2149 {
2150 string key = construction_parts.GetKey( i );
2153 }
2154
2155
2157 }
2158
2160 {
2163
2164 for ( int i = 0; i < construction_parts.Count(); ++i )
2165 {
2166 string key = construction_parts.GetKey( i );
2168
2169 if ( value.
GetId() ==
id )
2170 {
2171 return value;
2172 }
2173 }
2174
2175 return NULL;
2176 }
2177
2178
2179
2181 {
2183 }
2184
2186 {
2188 }
2189
2191 {
2192 return true;
2193 }
2194
2196 {
2197 return false;
2198 }
2199
2200
2202 {
2205 {
2207 }
2208
2209 return construction_kit;
2210 }
2211
2213 {
2216 {
2218 }
2219 }
2220
2222 {
2224 }
2225
2227 {
2228 return "";
2229 }
2230
2232 {
2234 g_Game.ObjectDelete( construction_kit );
2235 }
2236
2237
2239 {
2241 g_Game.ObjectDelete(
this );
2242 }
2243
2244
2246 {
2247 super.EEDelete(parent);
2248
2250 {
2251 areaDamage.Destroy();
2252 }
2253
2254 }
2255
2257 {
2258 super.OnStoreSave( ctx );
2259
2260
2264
2266 }
2267
2269 {
2270 if ( !super.OnStoreLoad( ctx, version ) )
2271 return false;
2272
2273
2274
2276 {
2278 return false;
2279 }
2281 {
2283 return false;
2284 }
2286 {
2288 return false;
2289 }
2290
2291
2293 {
2295 return false;
2296 }
2297
2298
2299 return true;
2300 }
2301
2303 {
2304 super.AfterStoreLoad();
2305
2307 {
2309 }
2310 }
2311
2313 {
2314
2316
2317
2320
2321
2323 }
2324
2326 {
2327 super.OnCreatePhysics();
2328
2329 ConstructionInit();
2331 }
2332
2334 {
2336 return;
2337
2338 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2339 }
2340
2342 {
2344 {
2346 }
2347
2348 super.EEOnAfterLoad();
2349 }
2350
2352 {
2353 super.EEItemAttached( item, slot_name );
2354
2358 }
2359
2361 {
2362 super.EEItemDetached( item, slot_name );
2363
2366 }
2367
2368 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2369 {
2372
2375 }
2376
2377
2379 {
2380 return true;
2381 }
2382
2383
2384
2386 {
2388
2389
2390 if (construtionPart.
IsBase())
2391 {
2393
2394
2396 }
2397
2398
2400
2401
2403
2404
2406
2408
2410
2411
2413
2414
2416 }
2417
2419 {
2420
2422 }
2423
2424
2426 {
2429
2430
2432
2433
2435
2436
2438
2439
2441
2443
2444
2446
2447
2449
2450
2451 if (construtionPart.
IsBase())
2452 {
2453
2455 }
2456 }
2457
2459 {
2460
2462 }
2463
2464
2465 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2466 {
2469
2470
2472
2473
2475
2476
2478
2479
2481
2483
2484
2486
2487
2489
2490
2491 if (construtionPart.
IsBase())
2492 {
2493
2495 }
2496 }
2497
2499 {
2500
2502 }
2503
2504
2506 {
2508
2511 }
2512
2514 {
2516
2518 {
2520 }
2521 else
2522 {
2524 }
2525
2527 }
2528
2530 {
2532
2534 foreach (
string slotName : attachmentSlots)
2535 {
2537 }
2538
2539
2542 else
2544
2546 }
2547
2549 {
2550 string slotNameMounted = slot_name + "_Mounted";
2551 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2552
2553 if (attachment)
2554 {
2555 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2556 if (barbedWire && barbedWire.IsMounted())
2558 else
2560
2561 if (is_locked)
2562 {
2563 SetAnimationPhase(slotNameMounted, 0);
2564 SetAnimationPhase(slot_name, 1);
2565 }
2566 else
2567 {
2568 SetAnimationPhase(slotNameMounted, 1);
2569 SetAnimationPhase(slot_name, 0);
2570 }
2571 }
2572 else
2573 {
2574 SetAnimationPhase(slotNameMounted, 1);
2575 SetAnimationPhase(slot_name, 1);
2576
2578 }
2579 }
2580
2581
2583 {
2586
2589
2592
2593 foreach (
string slotName : attachmentSlots)
2594 {
2596 }
2597
2598
2600 {
2603
2605 }
2606 else
2607 {
2610
2612 }
2613
2616 }
2617
2619 {
2620
2622 return;
2623
2624 string slot_name_mounted = slot_name + "_Mounted";
2625 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2626
2627
2629 RemoveProxyPhysics( slot_name_mounted );
2630 RemoveProxyPhysics( slot_name );
2631
2632 if ( attachment )
2633 {
2635 if ( is_locked )
2636 {
2638 AddProxyPhysics( slot_name_mounted );
2639 }
2640 else
2641 {
2643 AddProxyPhysics( slot_name );
2644 }
2645 }
2646 }
2647
2649 {
2650 SetAffectPathgraph( true, false );
2652 }
2653
2655 {
2656 return true;
2657 }
2658
2660 {
2661 return true;
2662 }
2663
2665 {
2666 if ( attachment )
2667 {
2669 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2670
2671 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2672 }
2673
2674 return false;
2675 }
2676
2678 {
2680 }
2681
2682
2684 {
2685 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2686 if (
g_Game.ConfigIsExisting( config_path ) )
2687 {
2688 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2689 }
2690 }
2691
2693 {
2694 return true;
2695 }
2696
2698 {
2699 return true;
2700 }
2701
2703 {
2704 return true;
2705 }
2706
2707
2709 {
2712 }
2713
2715 {
2717 }
2718
2720 {
2722 }
2723
2725 {
2726 int attachment_count = GetInventory().AttachmentCount();
2727 if ( attachment_count > 0 )
2728 {
2729 if (
HasBase() && attachment_count == 1 )
2730 {
2731 return false;
2732 }
2733
2734 return true;
2735 }
2736
2737 return false;
2738 }
2739
2741 {
2742 return true;
2743 }
2744
2746 {
2747 return false;
2748 }
2749
2750
2752 {
2753 return false;
2754 }
2755
2757 {
2758 return false;
2759 }
2760
2761
2763 {
2764 return false;
2765 }
2766
2767
2768
2770 {
2771 return true;
2772 }
2773
2775 {
2776 return true;
2777 }
2778
2781 {
2782 return false;
2783 }
2784
2785
2787 {
2788 return false;
2789 }
2790
2791
2793 {
2794 return true;
2795 }
2796
2797
2799 {
2800 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2801 {
2802 return false;
2803 }
2804
2805 return true;
2806 }
2807
2809 {
2812
2813 return item;
2814 }
2815
2816
2818 {
2820 {
2821
2823
2824
2827
2829 if ( MemoryPointExists( slot_name + "_min" ) )
2830 {
2831 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2832 }
2833 if ( MemoryPointExists( slot_name + "_max" ) )
2834 {
2835 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2836 }
2837
2838
2841
2842
2845 center = ModelToWorld( center );
2846
2847
2850
2851 areaDamage.SetExtents( extents[0], extents[1] );
2852 areaDamage.SetAreaPosition( center );
2856 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2857 areaDamage.SetAmmoName( "BarbedWireHit" );
2858 areaDamage.Spawn();
2859
2861 }
2862 }
2863
2865 {
2866 if ( angle_deg != 0 )
2867 {
2868
2870
2871
2873 if ( MemoryPointExists( "rotate_axis" ) )
2874 {
2875 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2876 }
2877 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];
2878 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];
2879 center[0] = r_center_x;
2880 center[2] = r_center_z;
2881 }
2882 }
2883
2885 {
2887 {
2890 {
2891 if (areaDamage)
2892 {
2893 areaDamage.Destroy();
2894 }
2895
2897 }
2898 }
2899 }
2900
2902 {
2903 return true;
2904 }
2905
2906
2907
2908
2910 {
2912 }
2913
2915 {
2917 }
2918
2920 {
2922 }
2923
2925 {
2927
2928 switch ( material_type )
2929 {
2935 }
2936
2937 return "";
2938 }
2939
2941 {
2943
2944 switch ( material_type )
2945 {
2951 }
2952
2953 return "";
2954 }
2955
2956
2958 {
2960 {
2961
2963 {
2964 SetHealth(slot_name,"Health",item.GetHealth());
2965 }
2966 }
2967 }
2968
2970 {
2971 return 111;
2972 }
2973
2975 {
2976 super.SetActions();
2977
2981 }
2982
2984 {
2986 if (!construction)
2987 return;
2988
2990 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
2991 {
2994 {
2996 }
2997 }
2998 }
2999
3001 {
3003 if (!construction)
3004 return;
3005
3007 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3008 {
3011 {
3012 construction.HandleEntityFalling(part.
GetPartName());
3013 }
3014 }
3015 }
3016
3019 {
3021 return;
3022
3025
3026 if (DestroyOnFall())
3027 {
3029 {
3031 }
3032 else
3033 {
3035 {
3037 }
3039 }
3040 }
3041 }
3042
3044 {
3045 if (HasAnyAttachmentsOrCargo())
3046 {
3049 }
3050 }
3051
3052
3053
3054
3055
3058 {
3059 return null;
3060 }
3061
3063 {
3065 }
3066
3068 {
3071
3072 Man p;
3073
3074 #ifdef SERVER
3076 g_Game.GetWorld().GetPlayerList(players);
3077 if (players.Count())
3078 p = players[0];
3079 #else
3081 #endif
3082
3084 {
3085 bool excluded = false;
3087 if (excludes)
3088 {
3089 foreach (string exclude : excludes)
3090 {
3092 {
3093 excluded = true;
3094 break;
3095 }
3096 }
3097 }
3098
3099 if (!excluded)
3100 {
3102 }
3103 }
3104
3106 }
3107
3109
3111 [
Obsolete(
"handled in the Construction component directly")]
3113 {
3114 }
3115
3116 [
Obsolete(
"handled in the Construction component directly")]
3118 {
3119 }
3120
3121 [
Obsolete(
"obsolete debug method")]
3123 {
3124 }
3125}
3126
3128{
3129#ifdef BSB_DEBUG
3131#else
3132
3133#endif
3134}
3136{
3137#ifdef BSB_DEBUG_SPAM
3139#else
3140
3141#endif
3142}
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.