2036{
2038
2040
2042
2049
2050
2051
2057
2063
2065
2069
2070
2072 {
2074
2075
2076 RegisterNetSyncVariableInt( "m_SyncParts01" );
2077 RegisterNetSyncVariableInt( "m_SyncParts02" );
2078 RegisterNetSyncVariableInt( "m_SyncParts03" );
2079 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2080 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2081 RegisterNetSyncVariableBool( "m_HasBase" );
2082
2083
2084 ConstructionInit();
2085
2086 if (ConfigIsExisting("hybridAttachments"))
2087 {
2090 }
2091 if (ConfigIsExisting("mountables"))
2092 {
2095 }
2096
2098 SetAllowDamage(true);
2099 }
2100
2102 {
2103 return "disableBaseDamage";
2104 }
2105
2107 {
2108 return true;
2109 }
2110
2112 {
2113 return EInventoryIconVisibility.HIDE_VICINITY;
2114 }
2115
2117 {
2118 super.InitItemSounds();
2119
2123
2128 }
2129
2131 {
2132 return "putDown_FenceKit_SoundSet";
2133 }
2134
2136 {
2137 return "Shelter_Site_Build_Loop_SoundSet";
2138 }
2139
2140
2142 {
2144 {
2145 SetSynchDirty();
2146 }
2147 }
2148
2150 {
2152 super.OnVariablesSynchronized();
2153
2155 }
2156
2158 {
2159
2161
2162
2164
2165
2167 }
2168
2169
2171 {
2172
2173 int offset;
2174 int mask;
2175
2176 if ( part_id >= 1 && part_id <= 31 )
2177 {
2178 offset = part_id - 1;
2179 mask = 1 << offset;
2180
2182 }
2183 else if ( part_id >= 32 && part_id <= 62 )
2184 {
2185 offset = ( part_id % 32 );
2186 mask = 1 << offset;
2187
2189 }
2190 else if ( part_id >= 63 && part_id <= 93 )
2191 {
2192 offset = ( part_id % 63 );
2193 mask = 1 << offset;
2194
2196 }
2197 }
2198
2200 {
2201
2202 int offset;
2203 int mask;
2204
2205 if ( part_id >= 1 && part_id <= 31 )
2206 {
2207 offset = part_id - 1;
2208 mask = 1 << offset;
2209
2211 }
2212 else if ( part_id >= 32 && part_id <= 62 )
2213 {
2214 offset = ( part_id % 32 );
2215 mask = 1 << offset;
2216
2218 }
2219 else if ( part_id >= 63 && part_id <= 93 )
2220 {
2221 offset = ( part_id % 63 );
2222 mask = 1 << offset;
2223
2225 }
2226 }
2227
2229 {
2230
2231 int offset;
2232 int mask;
2233
2234 if ( part_id >= 1 && part_id <= 31 )
2235 {
2236 offset = part_id - 1;
2237 mask = 1 << offset;
2238
2240 {
2241 return true;
2242 }
2243 }
2244 else if ( part_id >= 32 && part_id <= 62 )
2245 {
2246 offset = ( part_id % 32 );
2247 mask = 1 << offset;
2248
2250 {
2251 return true;
2252 }
2253 }
2254 else if ( part_id >= 63 && part_id <= 93 )
2255 {
2256 offset = ( part_id % 63 );
2257 mask = 1 << offset;
2258
2260 {
2261 return true;
2262 }
2263 }
2264
2265 return false;
2266 }
2267
2269 {
2272 }
2273
2275 {
2276
2279 }
2280
2282 {
2284 {
2287
2288 switch( build_action_id )
2289 {
2293 }
2294 }
2295 }
2296
2297
2299 {
2301 bool is_base = part.
IsBase();
2304 if ( is_part_built_sync )
2305 {
2307 {
2311
2312 if (is_base)
2313 {
2316 }
2317 }
2318 }
2319 else
2320 {
2322 {
2326
2327 if (is_base)
2328 {
2331 }
2332 }
2333 }
2334
2335
2337 }
2338
2339
2341 {
2344
2345 for ( int i = 0; i < construction_parts.Count(); ++i )
2346 {
2347 string key = construction_parts.GetKey( i );
2350 }
2351
2352
2354 }
2355
2357 {
2360
2361 for ( int i = 0; i < construction_parts.Count(); ++i )
2362 {
2363 string key = construction_parts.GetKey( i );
2365
2366 if ( value.
GetId() ==
id )
2367 {
2368 return value;
2369 }
2370 }
2371
2372 return NULL;
2373 }
2374
2375
2376
2378 {
2380 }
2381
2383 {
2385 }
2386
2388 {
2389 return true;
2390 }
2391
2393 {
2394 return false;
2395 }
2396
2397
2399 {
2402 {
2404 }
2405
2406 return construction_kit;
2407 }
2408
2410 {
2413 {
2415 }
2416 }
2417
2419 {
2421 }
2422
2424 {
2425 return "";
2426 }
2427
2429 {
2431 g_Game.ObjectDelete( construction_kit );
2432 }
2433
2434
2436 {
2438 g_Game.ObjectDelete(
this );
2439 }
2440
2441
2443 {
2444 super.EEDelete(parent);
2445
2447 {
2448 areaDamage.Destroy();
2449 }
2450
2451 }
2452
2454 {
2455 super.OnStoreSave( ctx );
2456
2457
2461
2463 }
2464
2466 {
2467 if ( !super.OnStoreLoad( ctx, version ) )
2468 return false;
2469
2470
2471
2473 {
2475 return false;
2476 }
2478 {
2480 return false;
2481 }
2483 {
2485 return false;
2486 }
2487
2488
2490 {
2492 return false;
2493 }
2494
2495
2496 return true;
2497 }
2498
2500 {
2501 super.AfterStoreLoad();
2502
2504 {
2506 }
2507 }
2508
2510 {
2511
2513
2514
2517
2518
2520 }
2521
2523 {
2524 super.OnCreatePhysics();
2525
2526 ConstructionInit();
2528 }
2529
2531 {
2533 return;
2534
2535 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2536 }
2537
2539 {
2541 {
2543 }
2544
2545 super.EEOnAfterLoad();
2546 }
2547
2549 {
2550 super.EEItemAttached( item, slot_name );
2551
2555 }
2556
2558 {
2559 super.EEItemDetached( item, slot_name );
2560
2563 }
2564
2565 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2566 {
2569
2572 }
2573
2574
2576 {
2577 return true;
2578 }
2579
2580
2581
2583 {
2585
2586
2587 if (construtionPart.
IsBase())
2588 {
2590
2591
2593 }
2594
2595
2597
2598
2600
2601
2603
2605
2607
2608
2610
2611
2613 }
2614
2616 {
2617
2619 }
2620
2621
2623 {
2626
2627
2629
2630
2632
2633
2635
2636
2638
2640
2641
2643
2644
2646
2647
2648 if (construtionPart.
IsBase())
2649 {
2650
2652 }
2653 }
2654
2656 {
2657
2659 }
2660
2661
2662 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2663 {
2666
2667
2669
2670
2672
2673
2675
2676
2678
2680
2681
2683
2684
2686
2687
2688 if (construtionPart.
IsBase())
2689 {
2690
2692 }
2693 }
2694
2696 {
2697
2699 }
2700
2701
2703 {
2705
2708 }
2709
2711 {
2713
2715 {
2717 }
2718 else
2719 {
2721 }
2722
2724 }
2725
2727 {
2729
2731 foreach (
string slotName : attachmentSlots)
2732 {
2734 }
2735
2736
2739 else
2741
2743 }
2744
2746 {
2747 string slotNameMounted = slot_name + "_Mounted";
2748 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2749
2750 if (attachment)
2751 {
2752 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2753 if (barbedWire && barbedWire.IsMounted())
2755 else
2757
2758 if (is_locked)
2759 {
2760 SetAnimationPhase(slotNameMounted, 0);
2761 SetAnimationPhase(slot_name, 1);
2762 }
2763 else
2764 {
2765 SetAnimationPhase(slotNameMounted, 1);
2766 SetAnimationPhase(slot_name, 0);
2767 }
2768 }
2769 else
2770 {
2771 SetAnimationPhase(slotNameMounted, 1);
2772 SetAnimationPhase(slot_name, 1);
2773
2775 }
2776 }
2777
2778
2780 {
2783
2786
2789
2790 foreach (
string slotName : attachmentSlots)
2791 {
2793 }
2794
2795
2797 {
2800
2802 }
2803 else
2804 {
2807
2809 }
2810
2813 }
2814
2816 {
2817
2819 return;
2820
2821 string slot_name_mounted = slot_name + "_Mounted";
2822 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2823
2824
2826 RemoveProxyPhysics( slot_name_mounted );
2827 RemoveProxyPhysics( slot_name );
2828
2829 if ( attachment )
2830 {
2832 if ( is_locked )
2833 {
2835 AddProxyPhysics( slot_name_mounted );
2836 }
2837 else
2838 {
2840 AddProxyPhysics( slot_name );
2841 }
2842 }
2843 }
2844
2846 {
2847 SetAffectPathgraph( true, false );
2849 }
2850
2852 {
2853 return true;
2854 }
2855
2857 {
2858 return true;
2859 }
2860
2862 {
2863 if ( attachment )
2864 {
2866 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2867
2868 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2869 }
2870
2871 return false;
2872 }
2873
2875 {
2877 }
2878
2879
2881 {
2882 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2883 if (
g_Game.ConfigIsExisting( config_path ) )
2884 {
2885 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2886 }
2887 }
2888
2890 {
2891 return true;
2892 }
2893
2895 {
2896 return true;
2897 }
2898
2900 {
2901 return true;
2902 }
2903
2904
2906 {
2909 }
2910
2912 {
2914 }
2915
2917 {
2919 }
2920
2922 {
2923 int attachment_count = GetInventory().AttachmentCount();
2924 if ( attachment_count > 0 )
2925 {
2926 if (
HasBase() && attachment_count == 1 )
2927 {
2928 return false;
2929 }
2930
2931 return true;
2932 }
2933
2934 return false;
2935 }
2936
2938 {
2939 return true;
2940 }
2941
2943 {
2944 return false;
2945 }
2946
2947
2949 {
2950 return false;
2951 }
2952
2954 {
2955 return false;
2956 }
2957
2958
2960 {
2961 return false;
2962 }
2963
2964
2965
2967 {
2968 return true;
2969 }
2970
2972 {
2973 return true;
2974 }
2975
2978 {
2979 return false;
2980 }
2981
2982
2984 {
2985 return false;
2986 }
2987
2988
2990 {
2991 return true;
2992 }
2993
2994
2996 {
2997 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2998 {
2999 return false;
3000 }
3001
3002 return true;
3003 }
3004
3006 {
3009
3010 return item;
3011 }
3012
3013
3015 {
3017 {
3018
3020
3021
3024
3026 if ( MemoryPointExists( slot_name + "_min" ) )
3027 {
3028 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3029 }
3030 if ( MemoryPointExists( slot_name + "_max" ) )
3031 {
3032 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3033 }
3034
3035
3038
3039
3042 center = ModelToWorld( center );
3043
3044
3047
3048 areaDamage.SetExtents( extents[0], extents[1] );
3049 areaDamage.SetAreaPosition( center );
3053 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3054 areaDamage.SetAmmoName( "BarbedWireHit" );
3055 areaDamage.Spawn();
3056
3058 }
3059 }
3060
3062 {
3063 if ( angle_deg != 0 )
3064 {
3065
3067
3068
3070 if ( MemoryPointExists( "rotate_axis" ) )
3071 {
3072 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3073 }
3074 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];
3075 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];
3076 center[0] = r_center_x;
3077 center[2] = r_center_z;
3078 }
3079 }
3080
3082 {
3084 {
3087 {
3088 if (areaDamage)
3089 {
3090 areaDamage.Destroy();
3091 }
3092
3094 }
3095 }
3096 }
3097
3099 {
3100 return true;
3101 }
3102
3103
3104
3105
3107 {
3109 }
3110
3112 {
3114 }
3115
3117 {
3119 }
3120
3122 {
3124
3125 switch ( material_type )
3126 {
3132 }
3133
3134 return "";
3135 }
3136
3138 {
3140
3141 switch ( material_type )
3142 {
3148 }
3149
3150 return "";
3151 }
3152
3153
3155 {
3157 {
3158
3160 {
3161 SetHealth(slot_name,"Health",item.GetHealth());
3162 }
3163 }
3164 }
3165
3167 {
3168 return 111;
3169 }
3170
3172 {
3173 super.SetActions();
3174
3178 }
3179
3181 {
3183 if (!construction)
3184 return;
3185
3187 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3188 {
3191 {
3193 }
3194 }
3195 }
3196
3198 {
3200 if (!construction)
3201 return;
3202
3204 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3205 {
3208 {
3209 construction.HandleEntityFalling(part.
GetPartName());
3210 }
3211 }
3212 }
3213
3216 {
3218 return;
3219
3222
3223 if (DestroyOnFall())
3224 {
3226 {
3228 }
3229 else
3230 {
3232 {
3234 }
3236 }
3237 }
3238 }
3239
3241 {
3242 if (HasAnyAttachmentsOrCargo())
3243 {
3246 }
3247 }
3248
3249
3250
3251
3252
3255 {
3256 return null;
3257 }
3258
3260 {
3262 }
3263
3265 {
3268
3269 Man p;
3270
3271 #ifdef SERVER
3273 g_Game.GetWorld().GetPlayerList(players);
3274 if (players.Count())
3275 p = players[0];
3276 #else
3278 #endif
3279
3281 {
3282 bool excluded = false;
3284 if (excludes)
3285 {
3286 foreach (string exclude : excludes)
3287 {
3289 {
3290 excluded = true;
3291 break;
3292 }
3293 }
3294 }
3295
3296 if (!excluded)
3297 {
3299 }
3300 }
3301
3303 }
3304
3306
3308 [
Obsolete(
"handled in the Construction component directly")]
3310 {
3311 }
3312
3313 [
Obsolete(
"handled in the Construction component directly")]
3315 {
3316 }
3317
3318 [
Obsolete(
"obsolete debug method")]
3320 {
3321 }
3322}
3323
3325{
3326#ifdef BSB_DEBUG
3328#else
3329
3330#endif
3331}
3333{
3334#ifdef BSB_DEBUG_SPAM
3336#else
3337
3338#endif
3339}
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.