1912{
1914
1916
1918
1925
1926
1927
1933
1939
1941
1945
1946
1948 {
1950
1951
1952 RegisterNetSyncVariableInt( "m_SyncParts01" );
1953 RegisterNetSyncVariableInt( "m_SyncParts02" );
1954 RegisterNetSyncVariableInt( "m_SyncParts03" );
1955 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1956 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1957 RegisterNetSyncVariableBool( "m_HasBase" );
1958
1959
1960 ConstructionInit();
1961
1962 if (ConfigIsExisting("hybridAttachments"))
1963 {
1966 }
1967 if (ConfigIsExisting("mountables"))
1968 {
1971 }
1972
1974 SetAllowDamage(true);
1975 }
1976
1978 {
1979 return "disableBaseDamage";
1980 }
1981
1983 {
1984 return true;
1985 }
1986
1988 {
1989 return EInventoryIconVisibility.HIDE_VICINITY;
1990 }
1991
1993 {
1994 super.InitItemSounds();
1995
1999
2004 }
2005
2007 {
2008 return "putDown_FenceKit_SoundSet";
2009 }
2010
2012 {
2013 return "Shelter_Site_Build_Loop_SoundSet";
2014 }
2015
2016
2018 {
2020 {
2021 SetSynchDirty();
2022 }
2023 }
2024
2026 {
2028 super.OnVariablesSynchronized();
2029
2031 }
2032
2034 {
2035
2037
2038
2040
2041
2043 }
2044
2045
2047 {
2048
2049 int offset;
2050 int mask;
2051
2052 if ( part_id >= 1 && part_id <= 31 )
2053 {
2054 offset = part_id - 1;
2055 mask = 1 << offset;
2056
2058 }
2059 else if ( part_id >= 32 && part_id <= 62 )
2060 {
2061 offset = ( part_id % 32 );
2062 mask = 1 << offset;
2063
2065 }
2066 else if ( part_id >= 63 && part_id <= 93 )
2067 {
2068 offset = ( part_id % 63 );
2069 mask = 1 << offset;
2070
2072 }
2073 }
2074
2076 {
2077
2078 int offset;
2079 int mask;
2080
2081 if ( part_id >= 1 && part_id <= 31 )
2082 {
2083 offset = part_id - 1;
2084 mask = 1 << offset;
2085
2087 }
2088 else if ( part_id >= 32 && part_id <= 62 )
2089 {
2090 offset = ( part_id % 32 );
2091 mask = 1 << offset;
2092
2094 }
2095 else if ( part_id >= 63 && part_id <= 93 )
2096 {
2097 offset = ( part_id % 63 );
2098 mask = 1 << offset;
2099
2101 }
2102 }
2103
2105 {
2106
2107 int offset;
2108 int mask;
2109
2110 if ( part_id >= 1 && part_id <= 31 )
2111 {
2112 offset = part_id - 1;
2113 mask = 1 << offset;
2114
2116 {
2117 return true;
2118 }
2119 }
2120 else if ( part_id >= 32 && part_id <= 62 )
2121 {
2122 offset = ( part_id % 32 );
2123 mask = 1 << offset;
2124
2126 {
2127 return true;
2128 }
2129 }
2130 else if ( part_id >= 63 && part_id <= 93 )
2131 {
2132 offset = ( part_id % 63 );
2133 mask = 1 << offset;
2134
2136 {
2137 return true;
2138 }
2139 }
2140
2141 return false;
2142 }
2143
2145 {
2148 }
2149
2151 {
2152
2155 }
2156
2158 {
2160 {
2163
2164 switch( build_action_id )
2165 {
2169 }
2170 }
2171 }
2172
2173
2175 {
2177 bool is_base = part.
IsBase();
2180 if ( is_part_built_sync )
2181 {
2183 {
2187
2188 if (is_base)
2189 {
2192 }
2193 }
2194 }
2195 else
2196 {
2198 {
2202
2203 if (is_base)
2204 {
2207 }
2208 }
2209 }
2210
2211
2213 }
2214
2215
2217 {
2220
2221 for ( int i = 0; i < construction_parts.Count(); ++i )
2222 {
2223 string key = construction_parts.GetKey( i );
2226 }
2227
2228
2230 }
2231
2233 {
2236
2237 for ( int i = 0; i < construction_parts.Count(); ++i )
2238 {
2239 string key = construction_parts.GetKey( i );
2241
2242 if ( value.
GetId() ==
id )
2243 {
2244 return value;
2245 }
2246 }
2247
2248 return NULL;
2249 }
2250
2251
2252
2254 {
2256 }
2257
2259 {
2261 }
2262
2264 {
2265 return true;
2266 }
2267
2269 {
2270 return false;
2271 }
2272
2273
2275 {
2278 {
2280 }
2281
2282 return construction_kit;
2283 }
2284
2286 {
2289 {
2291 }
2292 }
2293
2295 {
2297 }
2298
2300 {
2301 return "";
2302 }
2303
2305 {
2307 g_Game.ObjectDelete( construction_kit );
2308 }
2309
2310
2312 {
2314 g_Game.ObjectDelete(
this );
2315 }
2316
2317
2319 {
2320 super.EEDelete(parent);
2321
2323 {
2324 areaDamage.Destroy();
2325 }
2326
2327 }
2328
2330 {
2331 super.OnStoreSave( ctx );
2332
2333
2337
2339 }
2340
2342 {
2343 if ( !super.OnStoreLoad( ctx, version ) )
2344 return false;
2345
2346
2347
2349 {
2351 return false;
2352 }
2354 {
2356 return false;
2357 }
2359 {
2361 return false;
2362 }
2363
2364
2366 {
2368 return false;
2369 }
2370
2371
2372 return true;
2373 }
2374
2376 {
2377 super.AfterStoreLoad();
2378
2380 {
2382 }
2383 }
2384
2386 {
2387
2389
2390
2393
2394
2396 }
2397
2399 {
2400 super.OnCreatePhysics();
2401
2402 ConstructionInit();
2404 }
2405
2407 {
2409 return;
2410
2411 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2412 }
2413
2415 {
2417 {
2419 }
2420
2421 super.EEOnAfterLoad();
2422 }
2423
2425 {
2426 super.EEItemAttached( item, slot_name );
2427
2431 }
2432
2434 {
2435 super.EEItemDetached( item, slot_name );
2436
2439 }
2440
2441 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2442 {
2445
2448 }
2449
2450
2452 {
2453 return true;
2454 }
2455
2456
2457
2459 {
2461
2462
2463 if (construtionPart.
IsBase())
2464 {
2466
2467
2469 }
2470
2471
2473
2474
2476
2477
2479
2481
2483
2484
2486
2487
2489 }
2490
2492 {
2493
2495 }
2496
2497
2499 {
2502
2503
2505
2506
2508
2509
2511
2512
2514
2516
2517
2519
2520
2522
2523
2524 if (construtionPart.
IsBase())
2525 {
2526
2528 }
2529 }
2530
2532 {
2533
2535 }
2536
2537
2538 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2539 {
2542
2543
2545
2546
2548
2549
2551
2552
2554
2556
2557
2559
2560
2562
2563
2564 if (construtionPart.
IsBase())
2565 {
2566
2568 }
2569 }
2570
2572 {
2573
2575 }
2576
2577
2579 {
2581
2584 }
2585
2587 {
2589
2591 {
2593 }
2594 else
2595 {
2597 }
2598
2600 }
2601
2603 {
2605
2607 foreach (
string slotName : attachmentSlots)
2608 {
2610 }
2611
2612
2615 else
2617
2619 }
2620
2622 {
2623 string slotNameMounted = slot_name + "_Mounted";
2624 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2625
2626 if (attachment)
2627 {
2628 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2629 if (barbedWire && barbedWire.IsMounted())
2631 else
2633
2634 if (is_locked)
2635 {
2636 SetAnimationPhase(slotNameMounted, 0);
2637 SetAnimationPhase(slot_name, 1);
2638 }
2639 else
2640 {
2641 SetAnimationPhase(slotNameMounted, 1);
2642 SetAnimationPhase(slot_name, 0);
2643 }
2644 }
2645 else
2646 {
2647 SetAnimationPhase(slotNameMounted, 1);
2648 SetAnimationPhase(slot_name, 1);
2649
2651 }
2652 }
2653
2654
2656 {
2659
2662
2665
2666 foreach (
string slotName : attachmentSlots)
2667 {
2669 }
2670
2671
2673 {
2676
2678 }
2679 else
2680 {
2683
2685 }
2686
2689 }
2690
2692 {
2693
2695 return;
2696
2697 string slot_name_mounted = slot_name + "_Mounted";
2698 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2699
2700
2702 RemoveProxyPhysics( slot_name_mounted );
2703 RemoveProxyPhysics( slot_name );
2704
2705 if ( attachment )
2706 {
2708 if ( is_locked )
2709 {
2711 AddProxyPhysics( slot_name_mounted );
2712 }
2713 else
2714 {
2716 AddProxyPhysics( slot_name );
2717 }
2718 }
2719 }
2720
2722 {
2723 SetAffectPathgraph( true, false );
2725 }
2726
2728 {
2729 return true;
2730 }
2731
2733 {
2734 return true;
2735 }
2736
2738 {
2739 if ( attachment )
2740 {
2742 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2743
2744 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2745 }
2746
2747 return false;
2748 }
2749
2751 {
2753 }
2754
2755
2757 {
2758 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2759 if (
g_Game.ConfigIsExisting( config_path ) )
2760 {
2761 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2762 }
2763 }
2764
2766 {
2767 return true;
2768 }
2769
2771 {
2772 return true;
2773 }
2774
2776 {
2777 return true;
2778 }
2779
2780
2782 {
2785 }
2786
2788 {
2790 }
2791
2793 {
2795 }
2796
2798 {
2799 int attachment_count = GetInventory().AttachmentCount();
2800 if ( attachment_count > 0 )
2801 {
2802 if (
HasBase() && attachment_count == 1 )
2803 {
2804 return false;
2805 }
2806
2807 return true;
2808 }
2809
2810 return false;
2811 }
2812
2814 {
2815 return true;
2816 }
2817
2819 {
2820 return false;
2821 }
2822
2823
2825 {
2826 return false;
2827 }
2828
2830 {
2831 return false;
2832 }
2833
2834
2836 {
2837 return false;
2838 }
2839
2840
2841
2843 {
2844 return true;
2845 }
2846
2848 {
2849 return true;
2850 }
2851
2854 {
2855 return false;
2856 }
2857
2858
2860 {
2861 return false;
2862 }
2863
2864
2866 {
2867 return true;
2868 }
2869
2870
2872 {
2873 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2874 {
2875 return false;
2876 }
2877
2878 return true;
2879 }
2880
2882 {
2885
2886 return item;
2887 }
2888
2889
2891 {
2893 {
2894
2896
2897
2900
2902 if ( MemoryPointExists( slot_name + "_min" ) )
2903 {
2904 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2905 }
2906 if ( MemoryPointExists( slot_name + "_max" ) )
2907 {
2908 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2909 }
2910
2911
2914
2915
2918 center = ModelToWorld( center );
2919
2920
2923
2924 areaDamage.SetExtents( extents[0], extents[1] );
2925 areaDamage.SetAreaPosition( center );
2929 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2930 areaDamage.SetAmmoName( "BarbedWireHit" );
2931 areaDamage.Spawn();
2932
2934 }
2935 }
2936
2938 {
2939 if ( angle_deg != 0 )
2940 {
2941
2943
2944
2946 if ( MemoryPointExists( "rotate_axis" ) )
2947 {
2948 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2949 }
2950 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];
2951 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];
2952 center[0] = r_center_x;
2953 center[2] = r_center_z;
2954 }
2955 }
2956
2958 {
2960 {
2963 {
2964 if (areaDamage)
2965 {
2966 areaDamage.Destroy();
2967 }
2968
2970 }
2971 }
2972 }
2973
2975 {
2976 return true;
2977 }
2978
2979
2980
2981
2983 {
2985 }
2986
2988 {
2990 }
2991
2993 {
2995 }
2996
2998 {
3000
3001 switch ( material_type )
3002 {
3008 }
3009
3010 return "";
3011 }
3012
3014 {
3016
3017 switch ( material_type )
3018 {
3024 }
3025
3026 return "";
3027 }
3028
3029
3031 {
3033 {
3034
3036 {
3037 SetHealth(slot_name,"Health",item.GetHealth());
3038 }
3039 }
3040 }
3041
3043 {
3044 return 111;
3045 }
3046
3048 {
3049 super.SetActions();
3050
3054 }
3055
3057 {
3059 if (!construction)
3060 return;
3061
3063 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3064 {
3067 {
3069 }
3070 }
3071 }
3072
3074 {
3076 if (!construction)
3077 return;
3078
3080 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3081 {
3084 {
3085 construction.HandleEntityFalling(part.
GetPartName());
3086 }
3087 }
3088 }
3089
3092 {
3094 return;
3095
3098
3099 if (DestroyOnFall())
3100 {
3102 {
3104 }
3105 else
3106 {
3108 {
3110 }
3112 }
3113 }
3114 }
3115
3117 {
3118 if (HasAnyAttachmentsOrCargo())
3119 {
3122 }
3123 }
3124
3125
3126
3127
3128
3131 {
3132 return null;
3133 }
3134
3136 {
3138 }
3139
3141 {
3144
3145 Man p;
3146
3147 #ifdef SERVER
3149 g_Game.GetWorld().GetPlayerList(players);
3150 if (players.Count())
3151 p = players[0];
3152 #else
3154 #endif
3155
3157 {
3158 bool excluded = false;
3160 if (excludes)
3161 {
3162 foreach (string exclude : excludes)
3163 {
3165 {
3166 excluded = true;
3167 break;
3168 }
3169 }
3170 }
3171
3172 if (!excluded)
3173 {
3175 }
3176 }
3177
3179 }
3180
3182
3184 [
Obsolete(
"handled in the Construction component directly")]
3186 {
3187 }
3188
3189 [
Obsolete(
"handled in the Construction component directly")]
3191 {
3192 }
3193
3194 [
Obsolete(
"obsolete debug method")]
3196 {
3197 }
3198}
3199
3201{
3202#ifdef BSB_DEBUG
3204#else
3205
3206#endif
3207}
3209{
3210#ifdef BSB_DEBUG_SPAM
3212#else
3213
3214#endif
3215}
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.