1952{
1954
1956
1958
1965
1966
1967
1973
1979
1981
1985
1986
1988 {
1990
1991
1992 RegisterNetSyncVariableInt( "m_SyncParts01" );
1993 RegisterNetSyncVariableInt( "m_SyncParts02" );
1994 RegisterNetSyncVariableInt( "m_SyncParts03" );
1995 RegisterNetSyncVariableInt( "m_InteractedPartId" );
1996 RegisterNetSyncVariableInt( "m_PerformedActionId" );
1997 RegisterNetSyncVariableBool( "m_HasBase" );
1998
1999
2000 ConstructionInit();
2001
2002 if (ConfigIsExisting("hybridAttachments"))
2003 {
2006 }
2007 if (ConfigIsExisting("mountables"))
2008 {
2011 }
2012
2014 SetAllowDamage(true);
2015 }
2016
2018 {
2019 return "disableBaseDamage";
2020 }
2021
2023 {
2024 return true;
2025 }
2026
2028 {
2029 return EInventoryIconVisibility.HIDE_VICINITY;
2030 }
2031
2033 {
2034 super.InitItemSounds();
2035
2039
2044 }
2045
2047 {
2048 return "putDown_FenceKit_SoundSet";
2049 }
2050
2052 {
2053 return "Shelter_Site_Build_Loop_SoundSet";
2054 }
2055
2056
2058 {
2060 {
2061 SetSynchDirty();
2062 }
2063 }
2064
2066 {
2068 super.OnVariablesSynchronized();
2069
2071 }
2072
2074 {
2075
2077
2078
2080
2081
2083 }
2084
2085
2087 {
2088
2089 int offset;
2090 int mask;
2091
2092 if ( part_id >= 1 && part_id <= 31 )
2093 {
2094 offset = part_id - 1;
2095 mask = 1 << offset;
2096
2098 }
2099 else if ( part_id >= 32 && part_id <= 62 )
2100 {
2101 offset = ( part_id % 32 );
2102 mask = 1 << offset;
2103
2105 }
2106 else if ( part_id >= 63 && part_id <= 93 )
2107 {
2108 offset = ( part_id % 63 );
2109 mask = 1 << offset;
2110
2112 }
2113 }
2114
2116 {
2117
2118 int offset;
2119 int mask;
2120
2121 if ( part_id >= 1 && part_id <= 31 )
2122 {
2123 offset = part_id - 1;
2124 mask = 1 << offset;
2125
2127 }
2128 else if ( part_id >= 32 && part_id <= 62 )
2129 {
2130 offset = ( part_id % 32 );
2131 mask = 1 << offset;
2132
2134 }
2135 else if ( part_id >= 63 && part_id <= 93 )
2136 {
2137 offset = ( part_id % 63 );
2138 mask = 1 << offset;
2139
2141 }
2142 }
2143
2145 {
2146
2147 int offset;
2148 int mask;
2149
2150 if ( part_id >= 1 && part_id <= 31 )
2151 {
2152 offset = part_id - 1;
2153 mask = 1 << offset;
2154
2156 {
2157 return true;
2158 }
2159 }
2160 else if ( part_id >= 32 && part_id <= 62 )
2161 {
2162 offset = ( part_id % 32 );
2163 mask = 1 << offset;
2164
2166 {
2167 return true;
2168 }
2169 }
2170 else if ( part_id >= 63 && part_id <= 93 )
2171 {
2172 offset = ( part_id % 63 );
2173 mask = 1 << offset;
2174
2176 {
2177 return true;
2178 }
2179 }
2180
2181 return false;
2182 }
2183
2185 {
2188 }
2189
2191 {
2192
2195 }
2196
2198 {
2200 {
2203
2204 switch( build_action_id )
2205 {
2209 }
2210 }
2211 }
2212
2213
2215 {
2217 bool is_base = part.
IsBase();
2220 if ( is_part_built_sync )
2221 {
2223 {
2227
2228 if (is_base)
2229 {
2232 }
2233 }
2234 }
2235 else
2236 {
2238 {
2242
2243 if (is_base)
2244 {
2247 }
2248 }
2249 }
2250
2251
2253 }
2254
2255
2257 {
2260
2261 for ( int i = 0; i < construction_parts.Count(); ++i )
2262 {
2263 string key = construction_parts.GetKey( i );
2266 }
2267
2268
2270 }
2271
2273 {
2276
2277 for ( int i = 0; i < construction_parts.Count(); ++i )
2278 {
2279 string key = construction_parts.GetKey( i );
2281
2282 if ( value.
GetId() ==
id )
2283 {
2284 return value;
2285 }
2286 }
2287
2288 return NULL;
2289 }
2290
2291
2292
2294 {
2296 }
2297
2299 {
2301 }
2302
2304 {
2305 return true;
2306 }
2307
2309 {
2310 return false;
2311 }
2312
2313
2315 {
2318 {
2320 }
2321
2322 return construction_kit;
2323 }
2324
2326 {
2329 {
2331 }
2332 }
2333
2335 {
2337 }
2338
2340 {
2341 return "";
2342 }
2343
2345 {
2347 g_Game.ObjectDelete( construction_kit );
2348 }
2349
2350
2352 {
2354 g_Game.ObjectDelete(
this );
2355 }
2356
2357
2359 {
2360 super.EEDelete(parent);
2361
2363 {
2364 areaDamage.Destroy();
2365 }
2366
2367 }
2368
2370 {
2371 super.OnStoreSave( ctx );
2372
2373
2377
2379 }
2380
2382 {
2383 if ( !super.OnStoreLoad( ctx, version ) )
2384 return false;
2385
2386
2387
2389 {
2391 return false;
2392 }
2394 {
2396 return false;
2397 }
2399 {
2401 return false;
2402 }
2403
2404
2406 {
2408 return false;
2409 }
2410
2411
2412 return true;
2413 }
2414
2416 {
2417 super.AfterStoreLoad();
2418
2420 {
2422 }
2423 }
2424
2426 {
2427
2429
2430
2433
2434
2436 }
2437
2439 {
2440 super.OnCreatePhysics();
2441
2442 ConstructionInit();
2444 }
2445
2447 {
2449 return;
2450
2451 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2452 }
2453
2455 {
2457 {
2459 }
2460
2461 super.EEOnAfterLoad();
2462 }
2463
2465 {
2466 super.EEItemAttached( item, slot_name );
2467
2471 }
2472
2474 {
2475 super.EEItemDetached( item, slot_name );
2476
2479 }
2480
2481 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2482 {
2485
2488 }
2489
2490
2492 {
2493 return true;
2494 }
2495
2496
2497
2499 {
2501
2502
2503 if (construtionPart.
IsBase())
2504 {
2506
2507
2509 }
2510
2511
2513
2514
2516
2517
2519
2521
2523
2524
2526
2527
2529 }
2530
2532 {
2533
2535 }
2536
2537
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
2578 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2579 {
2582
2583
2585
2586
2588
2589
2591
2592
2594
2596
2597
2599
2600
2602
2603
2604 if (construtionPart.
IsBase())
2605 {
2606
2608 }
2609 }
2610
2612 {
2613
2615 }
2616
2617
2619 {
2621
2624 }
2625
2627 {
2629
2631 {
2633 }
2634 else
2635 {
2637 }
2638
2640 }
2641
2643 {
2645
2647 foreach (
string slotName : attachmentSlots)
2648 {
2650 }
2651
2652
2655 else
2657
2659 }
2660
2662 {
2663 string slotNameMounted = slot_name + "_Mounted";
2664 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2665
2666 if (attachment)
2667 {
2668 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2669 if (barbedWire && barbedWire.IsMounted())
2671 else
2673
2674 if (is_locked)
2675 {
2676 SetAnimationPhase(slotNameMounted, 0);
2677 SetAnimationPhase(slot_name, 1);
2678 }
2679 else
2680 {
2681 SetAnimationPhase(slotNameMounted, 1);
2682 SetAnimationPhase(slot_name, 0);
2683 }
2684 }
2685 else
2686 {
2687 SetAnimationPhase(slotNameMounted, 1);
2688 SetAnimationPhase(slot_name, 1);
2689
2691 }
2692 }
2693
2694
2696 {
2699
2702
2705
2706 foreach (
string slotName : attachmentSlots)
2707 {
2709 }
2710
2711
2713 {
2716
2718 }
2719 else
2720 {
2723
2725 }
2726
2729 }
2730
2732 {
2733
2735 return;
2736
2737 string slot_name_mounted = slot_name + "_Mounted";
2738 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2739
2740
2742 RemoveProxyPhysics( slot_name_mounted );
2743 RemoveProxyPhysics( slot_name );
2744
2745 if ( attachment )
2746 {
2748 if ( is_locked )
2749 {
2751 AddProxyPhysics( slot_name_mounted );
2752 }
2753 else
2754 {
2756 AddProxyPhysics( slot_name );
2757 }
2758 }
2759 }
2760
2762 {
2763 SetAffectPathgraph( true, false );
2765 }
2766
2768 {
2769 return true;
2770 }
2771
2773 {
2774 return true;
2775 }
2776
2778 {
2779 if ( attachment )
2780 {
2782 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2783
2784 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2785 }
2786
2787 return false;
2788 }
2789
2791 {
2793 }
2794
2795
2797 {
2798 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2799 if (
g_Game.ConfigIsExisting( config_path ) )
2800 {
2801 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2802 }
2803 }
2804
2806 {
2807 return true;
2808 }
2809
2811 {
2812 return true;
2813 }
2814
2816 {
2817 return true;
2818 }
2819
2820
2822 {
2825 }
2826
2828 {
2830 }
2831
2833 {
2835 }
2836
2838 {
2839 int attachment_count = GetInventory().AttachmentCount();
2840 if ( attachment_count > 0 )
2841 {
2842 if (
HasBase() && attachment_count == 1 )
2843 {
2844 return false;
2845 }
2846
2847 return true;
2848 }
2849
2850 return false;
2851 }
2852
2854 {
2855 return true;
2856 }
2857
2859 {
2860 return false;
2861 }
2862
2863
2865 {
2866 return false;
2867 }
2868
2870 {
2871 return false;
2872 }
2873
2874
2876 {
2877 return false;
2878 }
2879
2880
2881
2883 {
2884 return true;
2885 }
2886
2888 {
2889 return true;
2890 }
2891
2894 {
2895 return false;
2896 }
2897
2898
2900 {
2901 return false;
2902 }
2903
2904
2906 {
2907 return true;
2908 }
2909
2910
2912 {
2913 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2914 {
2915 return false;
2916 }
2917
2918 return true;
2919 }
2920
2922 {
2925
2926 return item;
2927 }
2928
2929
2931 {
2933 {
2934
2936
2937
2940
2942 if ( MemoryPointExists( slot_name + "_min" ) )
2943 {
2944 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2945 }
2946 if ( MemoryPointExists( slot_name + "_max" ) )
2947 {
2948 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2949 }
2950
2951
2954
2955
2958 center = ModelToWorld( center );
2959
2960
2963
2964 areaDamage.SetExtents( extents[0], extents[1] );
2965 areaDamage.SetAreaPosition( center );
2969 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2970 areaDamage.SetAmmoName( "BarbedWireHit" );
2971 areaDamage.Spawn();
2972
2974 }
2975 }
2976
2978 {
2979 if ( angle_deg != 0 )
2980 {
2981
2983
2984
2986 if ( MemoryPointExists( "rotate_axis" ) )
2987 {
2988 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
2989 }
2990 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];
2991 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];
2992 center[0] = r_center_x;
2993 center[2] = r_center_z;
2994 }
2995 }
2996
2998 {
3000 {
3003 {
3004 if (areaDamage)
3005 {
3006 areaDamage.Destroy();
3007 }
3008
3010 }
3011 }
3012 }
3013
3015 {
3016 return true;
3017 }
3018
3019
3020
3021
3023 {
3025 }
3026
3028 {
3030 }
3031
3033 {
3035 }
3036
3038 {
3040
3041 switch ( material_type )
3042 {
3048 }
3049
3050 return "";
3051 }
3052
3054 {
3056
3057 switch ( material_type )
3058 {
3064 }
3065
3066 return "";
3067 }
3068
3069
3071 {
3073 {
3074
3076 {
3077 SetHealth(slot_name,"Health",item.GetHealth());
3078 }
3079 }
3080 }
3081
3083 {
3084 return 111;
3085 }
3086
3088 {
3089 super.SetActions();
3090
3094 }
3095
3097 {
3099 if (!construction)
3100 return;
3101
3103 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3104 {
3107 {
3109 }
3110 }
3111 }
3112
3114 {
3116 if (!construction)
3117 return;
3118
3120 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3121 {
3124 {
3125 construction.HandleEntityFalling(part.
GetPartName());
3126 }
3127 }
3128 }
3129
3132 {
3134 return;
3135
3138
3139 if (DestroyOnFall())
3140 {
3142 {
3144 }
3145 else
3146 {
3148 {
3150 }
3152 }
3153 }
3154 }
3155
3157 {
3158 if (HasAnyAttachmentsOrCargo())
3159 {
3162 }
3163 }
3164
3165
3166
3167
3168
3171 {
3172 return null;
3173 }
3174
3176 {
3178 }
3179
3181 {
3184
3185 Man p;
3186
3187 #ifdef SERVER
3189 g_Game.GetWorld().GetPlayerList(players);
3190 if (players.Count())
3191 p = players[0];
3192 #else
3194 #endif
3195
3197 {
3198 bool excluded = false;
3200 if (excludes)
3201 {
3202 foreach (string exclude : excludes)
3203 {
3205 {
3206 excluded = true;
3207 break;
3208 }
3209 }
3210 }
3211
3212 if (!excluded)
3213 {
3215 }
3216 }
3217
3219 }
3220
3222
3224 [
Obsolete(
"handled in the Construction component directly")]
3226 {
3227 }
3228
3229 [
Obsolete(
"handled in the Construction component directly")]
3231 {
3232 }
3233
3234 [
Obsolete(
"obsolete debug method")]
3236 {
3237 }
3238}
3239
3241{
3242#ifdef BSB_DEBUG
3244#else
3245
3246#endif
3247}
3249{
3250#ifdef BSB_DEBUG_SPAM
3252#else
3253
3254#endif
3255}
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.