2072{
2074
2076
2078
2085
2086
2087
2093
2099
2101
2105
2106
2108 {
2110
2111
2112 RegisterNetSyncVariableInt( "m_SyncParts01" );
2113 RegisterNetSyncVariableInt( "m_SyncParts02" );
2114 RegisterNetSyncVariableInt( "m_SyncParts03" );
2115 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2116 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2117 RegisterNetSyncVariableBool( "m_HasBase" );
2118
2119
2120 ConstructionInit();
2121
2122 if (ConfigIsExisting("hybridAttachments"))
2123 {
2126 }
2127 if (ConfigIsExisting("mountables"))
2128 {
2131 }
2132
2134 SetAllowDamage(true);
2135 }
2136
2138 {
2139 return "disableBaseDamage";
2140 }
2141
2143 {
2144 return true;
2145 }
2146
2148 {
2149 return EInventoryIconVisibility.HIDE_VICINITY;
2150 }
2151
2153 {
2154 super.InitItemSounds();
2155
2159
2164 }
2165
2167 {
2168 return "putDown_FenceKit_SoundSet";
2169 }
2170
2172 {
2173 return "Shelter_Site_Build_Loop_SoundSet";
2174 }
2175
2176
2178 {
2180 {
2181 SetSynchDirty();
2182 }
2183 }
2184
2186 {
2188 super.OnVariablesSynchronized();
2189
2191 }
2192
2194 {
2195
2197
2198
2200
2201
2203 }
2204
2205
2207 {
2208
2209 int offset;
2210 int mask;
2211
2212 if ( part_id >= 1 && part_id <= 31 )
2213 {
2214 offset = part_id - 1;
2215 mask = 1 << offset;
2216
2218 }
2219 else if ( part_id >= 32 && part_id <= 62 )
2220 {
2221 offset = ( part_id % 32 );
2222 mask = 1 << offset;
2223
2225 }
2226 else if ( part_id >= 63 && part_id <= 93 )
2227 {
2228 offset = ( part_id % 63 );
2229 mask = 1 << offset;
2230
2232 }
2233 }
2234
2236 {
2237
2238 int offset;
2239 int mask;
2240
2241 if ( part_id >= 1 && part_id <= 31 )
2242 {
2243 offset = part_id - 1;
2244 mask = 1 << offset;
2245
2247 }
2248 else if ( part_id >= 32 && part_id <= 62 )
2249 {
2250 offset = ( part_id % 32 );
2251 mask = 1 << offset;
2252
2254 }
2255 else if ( part_id >= 63 && part_id <= 93 )
2256 {
2257 offset = ( part_id % 63 );
2258 mask = 1 << offset;
2259
2261 }
2262 }
2263
2265 {
2266
2267 int offset;
2268 int mask;
2269
2270 if ( part_id >= 1 && part_id <= 31 )
2271 {
2272 offset = part_id - 1;
2273 mask = 1 << offset;
2274
2276 {
2277 return true;
2278 }
2279 }
2280 else if ( part_id >= 32 && part_id <= 62 )
2281 {
2282 offset = ( part_id % 32 );
2283 mask = 1 << offset;
2284
2286 {
2287 return true;
2288 }
2289 }
2290 else if ( part_id >= 63 && part_id <= 93 )
2291 {
2292 offset = ( part_id % 63 );
2293 mask = 1 << offset;
2294
2296 {
2297 return true;
2298 }
2299 }
2300
2301 return false;
2302 }
2303
2305 {
2308 }
2309
2311 {
2312
2315 }
2316
2318 {
2320 {
2323
2324 switch( build_action_id )
2325 {
2329 }
2330 }
2331 }
2332
2333
2335 {
2337 bool is_base = part.
IsBase();
2340 if ( is_part_built_sync )
2341 {
2343 {
2347
2348 if (is_base)
2349 {
2352 }
2353 }
2354 }
2355 else
2356 {
2358 {
2362
2363 if (is_base)
2364 {
2367 }
2368 }
2369 }
2370
2371
2373 }
2374
2375
2377 {
2380
2381 for ( int i = 0; i < construction_parts.Count(); ++i )
2382 {
2383 string key = construction_parts.GetKey( i );
2386 }
2387
2388
2390 }
2391
2393 {
2396
2397 for ( int i = 0; i < construction_parts.Count(); ++i )
2398 {
2399 string key = construction_parts.GetKey( i );
2401
2402 if ( value.
GetId() ==
id )
2403 {
2404 return value;
2405 }
2406 }
2407
2408 return NULL;
2409 }
2410
2411
2412
2414 {
2416 }
2417
2419 {
2421 }
2422
2424 {
2425 return true;
2426 }
2427
2429 {
2430 return false;
2431 }
2432
2433
2435 {
2438 {
2440 }
2441
2442 return construction_kit;
2443 }
2444
2446 {
2449 {
2451 }
2452 }
2453
2455 {
2457 }
2458
2460 {
2461 return "";
2462 }
2463
2465 {
2467 g_Game.ObjectDelete( construction_kit );
2468 }
2469
2470
2472 {
2474 g_Game.ObjectDelete(
this );
2475 }
2476
2477
2479 {
2480 super.EEDelete(parent);
2481
2483 {
2484 areaDamage.Destroy();
2485 }
2486
2487 }
2488
2490 {
2491 super.OnStoreSave( ctx );
2492
2493
2497
2499 }
2500
2502 {
2503 if ( !super.OnStoreLoad( ctx, version ) )
2504 return false;
2505
2506
2507
2509 {
2511 return false;
2512 }
2514 {
2516 return false;
2517 }
2519 {
2521 return false;
2522 }
2523
2524
2526 {
2528 return false;
2529 }
2530
2531
2532 return true;
2533 }
2534
2536 {
2537 super.AfterStoreLoad();
2538
2540 {
2542 }
2543 }
2544
2546 {
2547
2549
2550
2553
2554
2556 }
2557
2559 {
2560 super.OnCreatePhysics();
2561
2562 ConstructionInit();
2564 }
2565
2567 {
2569 return;
2570
2571 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2572 }
2573
2575 {
2577 {
2579 }
2580
2581 super.EEOnAfterLoad();
2582 }
2583
2585 {
2586 super.EEItemAttached( item, slot_name );
2587
2591 }
2592
2594 {
2595 super.EEItemDetached( item, slot_name );
2596
2599 }
2600
2601 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2602 {
2605
2608 }
2609
2610
2612 {
2613 return true;
2614 }
2615
2616
2617
2619 {
2621
2622
2623 if (construtionPart.
IsBase())
2624 {
2626
2627
2629 }
2630
2631
2633
2634
2636
2637
2639
2641
2643
2644
2646
2647
2649 }
2650
2652 {
2653
2655 }
2656
2657
2659 {
2662
2663
2665
2666
2668
2669
2671
2672
2674
2676
2677
2679
2680
2682
2683
2684 if (construtionPart.
IsBase())
2685 {
2686
2688 }
2689 }
2690
2692 {
2693
2695 }
2696
2697
2698 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2699 {
2702
2703
2705
2706
2708
2709
2711
2712
2714
2716
2717
2719
2720
2722
2723
2724 if (construtionPart.
IsBase())
2725 {
2726
2728 }
2729 }
2730
2732 {
2733
2735 }
2736
2737
2739 {
2741
2744 }
2745
2747 {
2749
2751 {
2753 }
2754 else
2755 {
2757 }
2758
2760 }
2761
2763 {
2765
2767 foreach (
string slotName : attachmentSlots)
2768 {
2770 }
2771
2772
2775 else
2777
2779 }
2780
2782 {
2783 string slotNameMounted = slot_name + "_Mounted";
2784 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2785
2786 if (attachment)
2787 {
2788 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2789 if (barbedWire && barbedWire.IsMounted())
2791 else
2793
2794 if (is_locked)
2795 {
2796 SetAnimationPhase(slotNameMounted, 0);
2797 SetAnimationPhase(slot_name, 1);
2798 }
2799 else
2800 {
2801 SetAnimationPhase(slotNameMounted, 1);
2802 SetAnimationPhase(slot_name, 0);
2803 }
2804 }
2805 else
2806 {
2807 SetAnimationPhase(slotNameMounted, 1);
2808 SetAnimationPhase(slot_name, 1);
2809
2811 }
2812 }
2813
2814
2816 {
2819
2822
2825
2826 foreach (
string slotName : attachmentSlots)
2827 {
2829 }
2830
2831
2833 {
2836
2838 }
2839 else
2840 {
2843
2845 }
2846
2849 }
2850
2852 {
2853
2855 return;
2856
2857 string slot_name_mounted = slot_name + "_Mounted";
2858 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2859
2860
2862 RemoveProxyPhysics( slot_name_mounted );
2863 RemoveProxyPhysics( slot_name );
2864
2865 if ( attachment )
2866 {
2868 if ( is_locked )
2869 {
2871 AddProxyPhysics( slot_name_mounted );
2872 }
2873 else
2874 {
2876 AddProxyPhysics( slot_name );
2877 }
2878 }
2879 }
2880
2882 {
2883 SetAffectPathgraph( true, false );
2885 }
2886
2888 {
2889 return true;
2890 }
2891
2893 {
2894 return true;
2895 }
2896
2898 {
2899 if ( attachment )
2900 {
2902 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2903
2904 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2905 }
2906
2907 return false;
2908 }
2909
2911 {
2913 }
2914
2915
2917 {
2918 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2919 if (
g_Game.ConfigIsExisting( config_path ) )
2920 {
2921 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2922 }
2923 }
2924
2926 {
2927 return true;
2928 }
2929
2931 {
2932 return true;
2933 }
2934
2936 {
2937 return true;
2938 }
2939
2940
2942 {
2945 }
2946
2948 {
2950 }
2951
2953 {
2955 }
2956
2958 {
2959 int attachment_count = GetInventory().AttachmentCount();
2960 if ( attachment_count > 0 )
2961 {
2962 if (
HasBase() && attachment_count == 1 )
2963 {
2964 return false;
2965 }
2966
2967 return true;
2968 }
2969
2970 return false;
2971 }
2972
2974 {
2975 return true;
2976 }
2977
2979 {
2980 return false;
2981 }
2982
2983
2985 {
2986 return false;
2987 }
2988
2990 {
2991 return false;
2992 }
2993
2994
2996 {
2997 return false;
2998 }
2999
3000
3001
3003 {
3004 return true;
3005 }
3006
3008 {
3009 return true;
3010 }
3011
3014 {
3015 return false;
3016 }
3017
3018
3020 {
3021 return false;
3022 }
3023
3024
3026 {
3027 return true;
3028 }
3029
3030
3032 {
3033 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
3034 {
3035 return false;
3036 }
3037
3038 return true;
3039 }
3040
3042 {
3045
3046 return item;
3047 }
3048
3049
3051 {
3053 {
3054
3056
3057
3060
3062 if ( MemoryPointExists( slot_name + "_min" ) )
3063 {
3064 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
3065 }
3066 if ( MemoryPointExists( slot_name + "_max" ) )
3067 {
3068 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
3069 }
3070
3071
3074
3075
3078 center = ModelToWorld( center );
3079
3080
3083
3084 areaDamage.SetExtents( extents[0], extents[1] );
3085 areaDamage.SetAreaPosition( center );
3089 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3090 areaDamage.SetAmmoName( "BarbedWireHit" );
3091 areaDamage.Spawn();
3092
3094 }
3095 }
3096
3098 {
3099 if ( angle_deg != 0 )
3100 {
3101
3103
3104
3106 if ( MemoryPointExists( "rotate_axis" ) )
3107 {
3108 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3109 }
3110 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];
3111 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];
3112 center[0] = r_center_x;
3113 center[2] = r_center_z;
3114 }
3115 }
3116
3118 {
3120 {
3123 {
3124 if (areaDamage)
3125 {
3126 areaDamage.Destroy();
3127 }
3128
3130 }
3131 }
3132 }
3133
3135 {
3136 return true;
3137 }
3138
3139
3140
3141
3143 {
3145 }
3146
3148 {
3150 }
3151
3153 {
3155 }
3156
3158 {
3160
3161 switch ( material_type )
3162 {
3168 }
3169
3170 return "";
3171 }
3172
3174 {
3176
3177 switch ( material_type )
3178 {
3184 }
3185
3186 return "";
3187 }
3188
3189
3191 {
3193 {
3194
3196 {
3197 SetHealth(slot_name,"Health",item.GetHealth());
3198 }
3199 }
3200 }
3201
3203 {
3204 return 111;
3205 }
3206
3208 {
3209 super.SetActions();
3210
3214 }
3215
3217 {
3219 if (!construction)
3220 return;
3221
3223 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3224 {
3227 {
3229 }
3230 }
3231 }
3232
3234 {
3236 if (!construction)
3237 return;
3238
3240 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3241 {
3244 {
3245 construction.HandleEntityFalling(part.
GetPartName());
3246 }
3247 }
3248 }
3249
3252 {
3254 return;
3255
3258
3259 if (DestroyOnFall())
3260 {
3262 {
3264 }
3265 else
3266 {
3268 {
3270 }
3272 }
3273 }
3274 }
3275
3277 {
3278 if (HasAnyAttachmentsOrCargo())
3279 {
3282 }
3283 }
3284
3285
3286
3287
3288
3291 {
3292 return null;
3293 }
3294
3296 {
3298 }
3299
3301 {
3304
3305 Man p;
3306
3307 #ifdef SERVER
3309 g_Game.GetWorld().GetPlayerList(players);
3310 if (players.Count())
3311 p = players[0];
3312 #else
3314 #endif
3315
3317 {
3318 bool excluded = false;
3320 if (excludes)
3321 {
3322 foreach (string exclude : excludes)
3323 {
3325 {
3326 excluded = true;
3327 break;
3328 }
3329 }
3330 }
3331
3332 if (!excluded)
3333 {
3335 }
3336 }
3337
3339 }
3340
3342
3344 [
Obsolete(
"handled in the Construction component directly")]
3346 {
3347 }
3348
3349 [
Obsolete(
"handled in the Construction component directly")]
3351 {
3352 }
3353
3354 [
Obsolete(
"obsolete debug method")]
3356 {
3357 }
3358}
3359
3361{
3362#ifdef BSB_DEBUG
3364#else
3365
3366#endif
3367}
3369{
3370#ifdef BSB_DEBUG_SPAM
3372#else
3373
3374#endif
3375}
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.