1959{
1961
1963
1965
1972
1973
1974
1980
1986
1988
1992
1993
1995 {
1997
1998
1999 RegisterNetSyncVariableInt( "m_SyncParts01" );
2000 RegisterNetSyncVariableInt( "m_SyncParts02" );
2001 RegisterNetSyncVariableInt( "m_SyncParts03" );
2002 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2003 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2004 RegisterNetSyncVariableBool( "m_HasBase" );
2005
2006
2007 ConstructionInit();
2008
2009 if (ConfigIsExisting("hybridAttachments"))
2010 {
2013 }
2014 if (ConfigIsExisting("mountables"))
2015 {
2018 }
2019
2021 SetAllowDamage(true);
2022 }
2023
2025 {
2026 return "disableBaseDamage";
2027 }
2028
2030 {
2031 return true;
2032 }
2033
2035 {
2036 return EInventoryIconVisibility.HIDE_VICINITY;
2037 }
2038
2040 {
2041 super.InitItemSounds();
2042
2046
2051 }
2052
2054 {
2055 return "putDown_FenceKit_SoundSet";
2056 }
2057
2059 {
2060 return "Shelter_Site_Build_Loop_SoundSet";
2061 }
2062
2063
2065 {
2067 {
2068 SetSynchDirty();
2069 }
2070 }
2071
2073 {
2075 super.OnVariablesSynchronized();
2076
2078 }
2079
2081 {
2082
2084
2085
2087
2088
2090 }
2091
2092
2094 {
2095
2096 int offset;
2097 int mask;
2098
2099 if ( part_id >= 1 && part_id <= 31 )
2100 {
2101 offset = part_id - 1;
2102 mask = 1 << offset;
2103
2105 }
2106 else if ( part_id >= 32 && part_id <= 62 )
2107 {
2108 offset = ( part_id % 32 );
2109 mask = 1 << offset;
2110
2112 }
2113 else if ( part_id >= 63 && part_id <= 93 )
2114 {
2115 offset = ( part_id % 63 );
2116 mask = 1 << offset;
2117
2119 }
2120 }
2121
2123 {
2124
2125 int offset;
2126 int mask;
2127
2128 if ( part_id >= 1 && part_id <= 31 )
2129 {
2130 offset = part_id - 1;
2131 mask = 1 << offset;
2132
2134 }
2135 else if ( part_id >= 32 && part_id <= 62 )
2136 {
2137 offset = ( part_id % 32 );
2138 mask = 1 << offset;
2139
2141 }
2142 else if ( part_id >= 63 && part_id <= 93 )
2143 {
2144 offset = ( part_id % 63 );
2145 mask = 1 << offset;
2146
2148 }
2149 }
2150
2152 {
2153
2154 int offset;
2155 int mask;
2156
2157 if ( part_id >= 1 && part_id <= 31 )
2158 {
2159 offset = part_id - 1;
2160 mask = 1 << offset;
2161
2163 {
2164 return true;
2165 }
2166 }
2167 else if ( part_id >= 32 && part_id <= 62 )
2168 {
2169 offset = ( part_id % 32 );
2170 mask = 1 << offset;
2171
2173 {
2174 return true;
2175 }
2176 }
2177 else if ( part_id >= 63 && part_id <= 93 )
2178 {
2179 offset = ( part_id % 63 );
2180 mask = 1 << offset;
2181
2183 {
2184 return true;
2185 }
2186 }
2187
2188 return false;
2189 }
2190
2192 {
2195 }
2196
2198 {
2199
2202 }
2203
2205 {
2207 {
2210
2211 switch( build_action_id )
2212 {
2216 }
2217 }
2218 }
2219
2220
2222 {
2224 bool is_base = part.
IsBase();
2227 if ( is_part_built_sync )
2228 {
2230 {
2234
2235 if (is_base)
2236 {
2239 }
2240 }
2241 }
2242 else
2243 {
2245 {
2249
2250 if (is_base)
2251 {
2254 }
2255 }
2256 }
2257
2258
2260 }
2261
2262
2264 {
2267
2268 for ( int i = 0; i < construction_parts.Count(); ++i )
2269 {
2270 string key = construction_parts.GetKey( i );
2273 }
2274
2275
2277 }
2278
2280 {
2283
2284 for ( int i = 0; i < construction_parts.Count(); ++i )
2285 {
2286 string key = construction_parts.GetKey( i );
2288
2289 if ( value.
GetId() ==
id )
2290 {
2291 return value;
2292 }
2293 }
2294
2295 return NULL;
2296 }
2297
2298
2299
2301 {
2303 }
2304
2306 {
2308 }
2309
2311 {
2312 return true;
2313 }
2314
2316 {
2317 return false;
2318 }
2319
2320
2322 {
2325 {
2327 }
2328
2329 return construction_kit;
2330 }
2331
2333 {
2336 {
2338 }
2339 }
2340
2342 {
2344 }
2345
2347 {
2348 return "";
2349 }
2350
2352 {
2354 g_Game.ObjectDelete( construction_kit );
2355 }
2356
2357
2359 {
2361 g_Game.ObjectDelete(
this );
2362 }
2363
2364
2366 {
2367 super.EEDelete(parent);
2368
2370 {
2371 areaDamage.Destroy();
2372 }
2373
2374 }
2375
2377 {
2378 super.OnStoreSave( ctx );
2379
2380
2384
2386 }
2387
2389 {
2390 if ( !super.OnStoreLoad( ctx, version ) )
2391 return false;
2392
2393
2394
2396 {
2398 return false;
2399 }
2401 {
2403 return false;
2404 }
2406 {
2408 return false;
2409 }
2410
2411
2413 {
2415 return false;
2416 }
2417
2418
2419 return true;
2420 }
2421
2423 {
2424 super.AfterStoreLoad();
2425
2427 {
2429 }
2430 }
2431
2433 {
2434
2436
2437
2440
2441
2443 }
2444
2446 {
2447 super.OnCreatePhysics();
2448
2449 ConstructionInit();
2451 }
2452
2454 {
2456 return;
2457
2458 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2459 }
2460
2462 {
2464 {
2466 }
2467
2468 super.EEOnAfterLoad();
2469 }
2470
2472 {
2473 super.EEItemAttached( item, slot_name );
2474
2478 }
2479
2481 {
2482 super.EEItemDetached( item, slot_name );
2483
2486 }
2487
2488 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2489 {
2492
2495 }
2496
2497
2499 {
2500 return true;
2501 }
2502
2503
2504
2506 {
2508
2509
2510 if (construtionPart.
IsBase())
2511 {
2513
2514
2516 }
2517
2518
2520
2521
2523
2524
2526
2528
2530
2531
2533
2534
2536 }
2537
2539 {
2540
2542 }
2543
2544
2546 {
2549
2550
2552
2553
2555
2556
2558
2559
2561
2563
2564
2566
2567
2569
2570
2571 if (construtionPart.
IsBase())
2572 {
2573
2575 }
2576 }
2577
2579 {
2580
2582 }
2583
2584
2585 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2586 {
2589
2590
2592
2593
2595
2596
2598
2599
2601
2603
2604
2606
2607
2609
2610
2611 if (construtionPart.
IsBase())
2612 {
2613
2615 }
2616 }
2617
2619 {
2620
2622 }
2623
2624
2626 {
2628
2631 }
2632
2634 {
2636
2638 {
2640 }
2641 else
2642 {
2644 }
2645
2647 }
2648
2650 {
2652
2654 foreach (
string slotName : attachmentSlots)
2655 {
2657 }
2658
2659
2662 else
2664
2666 }
2667
2669 {
2670 string slotNameMounted = slot_name + "_Mounted";
2671 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2672
2673 if (attachment)
2674 {
2675 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2676 if (barbedWire && barbedWire.IsMounted())
2678 else
2680
2681 if (is_locked)
2682 {
2683 SetAnimationPhase(slotNameMounted, 0);
2684 SetAnimationPhase(slot_name, 1);
2685 }
2686 else
2687 {
2688 SetAnimationPhase(slotNameMounted, 1);
2689 SetAnimationPhase(slot_name, 0);
2690 }
2691 }
2692 else
2693 {
2694 SetAnimationPhase(slotNameMounted, 1);
2695 SetAnimationPhase(slot_name, 1);
2696
2698 }
2699 }
2700
2701
2703 {
2706
2709
2712
2713 foreach (
string slotName : attachmentSlots)
2714 {
2716 }
2717
2718
2720 {
2723
2725 }
2726 else
2727 {
2730
2732 }
2733
2736 }
2737
2739 {
2740
2742 return;
2743
2744 string slot_name_mounted = slot_name + "_Mounted";
2745 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2746
2747
2749 RemoveProxyPhysics( slot_name_mounted );
2750 RemoveProxyPhysics( slot_name );
2751
2752 if ( attachment )
2753 {
2755 if ( is_locked )
2756 {
2758 AddProxyPhysics( slot_name_mounted );
2759 }
2760 else
2761 {
2763 AddProxyPhysics( slot_name );
2764 }
2765 }
2766 }
2767
2769 {
2770 SetAffectPathgraph( true, false );
2772 }
2773
2775 {
2776 return true;
2777 }
2778
2780 {
2781 return true;
2782 }
2783
2785 {
2786 if ( attachment )
2787 {
2789 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2790
2791 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2792 }
2793
2794 return false;
2795 }
2796
2798 {
2800 }
2801
2802
2804 {
2805 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2806 if (
g_Game.ConfigIsExisting( config_path ) )
2807 {
2808 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2809 }
2810 }
2811
2813 {
2814 return true;
2815 }
2816
2818 {
2819 return true;
2820 }
2821
2823 {
2824 return true;
2825 }
2826
2827
2829 {
2832 }
2833
2835 {
2837 }
2838
2840 {
2842 }
2843
2845 {
2846 int attachment_count = GetInventory().AttachmentCount();
2847 if ( attachment_count > 0 )
2848 {
2849 if (
HasBase() && attachment_count == 1 )
2850 {
2851 return false;
2852 }
2853
2854 return true;
2855 }
2856
2857 return false;
2858 }
2859
2861 {
2862 return true;
2863 }
2864
2866 {
2867 return false;
2868 }
2869
2870
2872 {
2873 return false;
2874 }
2875
2877 {
2878 return false;
2879 }
2880
2881
2883 {
2884 return false;
2885 }
2886
2887
2888
2890 {
2891 return true;
2892 }
2893
2895 {
2896 return true;
2897 }
2898
2901 {
2902 return false;
2903 }
2904
2905
2907 {
2908 return false;
2909 }
2910
2911
2913 {
2914 return true;
2915 }
2916
2917
2919 {
2920 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2921 {
2922 return false;
2923 }
2924
2925 return true;
2926 }
2927
2929 {
2932
2933 return item;
2934 }
2935
2936
2938 {
2940 {
2941
2943
2944
2947
2949 if ( MemoryPointExists( slot_name + "_min" ) )
2950 {
2951 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2952 }
2953 if ( MemoryPointExists( slot_name + "_max" ) )
2954 {
2955 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2956 }
2957
2958
2961
2962
2965 center = ModelToWorld( center );
2966
2967
2970
2971 areaDamage.SetExtents( extents[0], extents[1] );
2972 areaDamage.SetAreaPosition( center );
2976 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2977 areaDamage.SetAmmoName( "BarbedWireHit" );
2978 areaDamage.Spawn();
2979
2981 }
2982 }
2983
2985 {
2986 if ( angle_deg != 0 )
2987 {
2988
2990
2991
2993 if ( MemoryPointExists( "rotate_axis" ) )
2994 {
2995 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2996 }
2997 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];
2998 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];
2999 center[0] = r_center_x;
3000 center[2] = r_center_z;
3001 }
3002 }
3003
3005 {
3007 {
3010 {
3011 if (areaDamage)
3012 {
3013 areaDamage.Destroy();
3014 }
3015
3017 }
3018 }
3019 }
3020
3022 {
3023 return true;
3024 }
3025
3026
3027
3028
3030 {
3032 }
3033
3035 {
3037 }
3038
3040 {
3042 }
3043
3045 {
3047
3048 switch ( material_type )
3049 {
3055 }
3056
3057 return "";
3058 }
3059
3061 {
3063
3064 switch ( material_type )
3065 {
3071 }
3072
3073 return "";
3074 }
3075
3076
3078 {
3080 {
3081
3083 {
3084 SetHealth(slot_name,"Health",item.GetHealth());
3085 }
3086 }
3087 }
3088
3090 {
3091 return 111;
3092 }
3093
3095 {
3096 super.SetActions();
3097
3101 }
3102
3104 {
3106 if (!construction)
3107 return;
3108
3110 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3111 {
3114 {
3116 }
3117 }
3118 }
3119
3121 {
3123 if (!construction)
3124 return;
3125
3127 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3128 {
3131 {
3132 construction.HandleEntityFalling(part.
GetPartName());
3133 }
3134 }
3135 }
3136
3139 {
3141 return;
3142
3145
3146 if (DestroyOnFall())
3147 {
3149 {
3151 }
3152 else
3153 {
3155 {
3157 }
3159 }
3160 }
3161 }
3162
3164 {
3165 if (HasAnyAttachmentsOrCargo())
3166 {
3169 }
3170 }
3171
3172
3173
3174
3175
3178 {
3179 return null;
3180 }
3181
3183 {
3185 }
3186
3188 {
3191
3192 Man p;
3193
3194 #ifdef SERVER
3196 g_Game.GetWorld().GetPlayerList(players);
3197 if (players.Count())
3198 p = players[0];
3199 #else
3201 #endif
3202
3204 {
3205 bool excluded = false;
3207 if (excludes)
3208 {
3209 foreach (string exclude : excludes)
3210 {
3212 {
3213 excluded = true;
3214 break;
3215 }
3216 }
3217 }
3218
3219 if (!excluded)
3220 {
3222 }
3223 }
3224
3226 }
3227
3229
3231 [
Obsolete(
"handled in the Construction component directly")]
3233 {
3234 }
3235
3236 [
Obsolete(
"handled in the Construction component directly")]
3238 {
3239 }
3240
3241 [
Obsolete(
"obsolete debug method")]
3243 {
3244 }
3245}
3246
3248{
3249#ifdef BSB_DEBUG
3251#else
3252
3253#endif
3254}
3256{
3257#ifdef BSB_DEBUG_SPAM
3259#else
3260
3261#endif
3262}
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.