2002{
2004
2006
2008
2015
2016
2017
2023
2029
2031
2035
2036
2038 {
2040
2041
2042 RegisterNetSyncVariableInt( "m_SyncParts01" );
2043 RegisterNetSyncVariableInt( "m_SyncParts02" );
2044 RegisterNetSyncVariableInt( "m_SyncParts03" );
2045 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2046 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2047 RegisterNetSyncVariableBool( "m_HasBase" );
2048
2049
2050 ConstructionInit();
2051
2052 if (ConfigIsExisting("hybridAttachments"))
2053 {
2056 }
2057 if (ConfigIsExisting("mountables"))
2058 {
2061 }
2062
2064 SetAllowDamage(true);
2065 }
2066
2068 {
2069 return "disableBaseDamage";
2070 }
2071
2073 {
2074 return true;
2075 }
2076
2078 {
2079 return EInventoryIconVisibility.HIDE_VICINITY;
2080 }
2081
2083 {
2084 super.InitItemSounds();
2085
2089
2094 }
2095
2097 {
2098 return "putDown_FenceKit_SoundSet";
2099 }
2100
2102 {
2103 return "Shelter_Site_Build_Loop_SoundSet";
2104 }
2105
2106
2108 {
2110 {
2111 SetSynchDirty();
2112 }
2113 }
2114
2116 {
2118 super.OnVariablesSynchronized();
2119
2121 }
2122
2124 {
2125
2127
2128
2130
2131
2133 }
2134
2135
2137 {
2138
2139 int offset;
2140 int mask;
2141
2142 if ( part_id >= 1 && part_id <= 31 )
2143 {
2144 offset = part_id - 1;
2145 mask = 1 << offset;
2146
2148 }
2149 else if ( part_id >= 32 && part_id <= 62 )
2150 {
2151 offset = ( part_id % 32 );
2152 mask = 1 << offset;
2153
2155 }
2156 else if ( part_id >= 63 && part_id <= 93 )
2157 {
2158 offset = ( part_id % 63 );
2159 mask = 1 << offset;
2160
2162 }
2163 }
2164
2166 {
2167
2168 int offset;
2169 int mask;
2170
2171 if ( part_id >= 1 && part_id <= 31 )
2172 {
2173 offset = part_id - 1;
2174 mask = 1 << offset;
2175
2177 }
2178 else if ( part_id >= 32 && part_id <= 62 )
2179 {
2180 offset = ( part_id % 32 );
2181 mask = 1 << offset;
2182
2184 }
2185 else if ( part_id >= 63 && part_id <= 93 )
2186 {
2187 offset = ( part_id % 63 );
2188 mask = 1 << offset;
2189
2191 }
2192 }
2193
2195 {
2196
2197 int offset;
2198 int mask;
2199
2200 if ( part_id >= 1 && part_id <= 31 )
2201 {
2202 offset = part_id - 1;
2203 mask = 1 << offset;
2204
2206 {
2207 return true;
2208 }
2209 }
2210 else if ( part_id >= 32 && part_id <= 62 )
2211 {
2212 offset = ( part_id % 32 );
2213 mask = 1 << offset;
2214
2216 {
2217 return true;
2218 }
2219 }
2220 else if ( part_id >= 63 && part_id <= 93 )
2221 {
2222 offset = ( part_id % 63 );
2223 mask = 1 << offset;
2224
2226 {
2227 return true;
2228 }
2229 }
2230
2231 return false;
2232 }
2233
2235 {
2238 }
2239
2241 {
2242
2245 }
2246
2248 {
2250 {
2253
2254 switch( build_action_id )
2255 {
2259 }
2260 }
2261 }
2262
2263
2265 {
2267 bool is_base = part.
IsBase();
2270 if ( is_part_built_sync )
2271 {
2273 {
2277
2278 if (is_base)
2279 {
2282 }
2283 }
2284 }
2285 else
2286 {
2288 {
2292
2293 if (is_base)
2294 {
2297 }
2298 }
2299 }
2300
2301
2303 }
2304
2305
2307 {
2310
2311 for ( int i = 0; i < construction_parts.Count(); ++i )
2312 {
2313 string key = construction_parts.GetKey( i );
2316 }
2317
2318
2320 }
2321
2323 {
2326
2327 for ( int i = 0; i < construction_parts.Count(); ++i )
2328 {
2329 string key = construction_parts.GetKey( i );
2331
2332 if ( value.
GetId() ==
id )
2333 {
2334 return value;
2335 }
2336 }
2337
2338 return NULL;
2339 }
2340
2341
2342
2344 {
2346 }
2347
2349 {
2351 }
2352
2354 {
2355 return true;
2356 }
2357
2359 {
2360 return false;
2361 }
2362
2363
2365 {
2368 {
2370 }
2371
2372 return construction_kit;
2373 }
2374
2376 {
2379 {
2381 }
2382 }
2383
2385 {
2387 }
2388
2390 {
2391 return "";
2392 }
2393
2395 {
2397 g_Game.ObjectDelete( construction_kit );
2398 }
2399
2400
2402 {
2404 g_Game.ObjectDelete(
this );
2405 }
2406
2407
2409 {
2410 super.EEDelete(parent);
2411
2413 {
2414 areaDamage.Destroy();
2415 }
2416
2417 }
2418
2420 {
2421 super.OnStoreSave( ctx );
2422
2423
2427
2429 }
2430
2432 {
2433 if ( !super.OnStoreLoad( ctx, version ) )
2434 return false;
2435
2436
2437
2439 {
2441 return false;
2442 }
2444 {
2446 return false;
2447 }
2449 {
2451 return false;
2452 }
2453
2454
2456 {
2458 return false;
2459 }
2460
2461
2462 return true;
2463 }
2464
2466 {
2467 super.AfterStoreLoad();
2468
2470 {
2472 }
2473 }
2474
2476 {
2477
2479
2480
2483
2484
2486 }
2487
2489 {
2490 super.OnCreatePhysics();
2491
2492 ConstructionInit();
2494 }
2495
2497 {
2499 return;
2500
2501 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2502 }
2503
2505 {
2507 {
2509 }
2510
2511 super.EEOnAfterLoad();
2512 }
2513
2515 {
2516 super.EEItemAttached( item, slot_name );
2517
2521 }
2522
2524 {
2525 super.EEItemDetached( item, slot_name );
2526
2529 }
2530
2531 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2532 {
2535
2538 }
2539
2540
2542 {
2543 return true;
2544 }
2545
2546
2547
2549 {
2551
2552
2553 if (construtionPart.
IsBase())
2554 {
2556
2557
2559 }
2560
2561
2563
2564
2566
2567
2569
2571
2573
2574
2576
2577
2579 }
2580
2582 {
2583
2585 }
2586
2587
2589 {
2592
2593
2595
2596
2598
2599
2601
2602
2604
2606
2607
2609
2610
2612
2613
2614 if (construtionPart.
IsBase())
2615 {
2616
2618 }
2619 }
2620
2622 {
2623
2625 }
2626
2627
2628 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2629 {
2632
2633
2635
2636
2638
2639
2641
2642
2644
2646
2647
2649
2650
2652
2653
2654 if (construtionPart.
IsBase())
2655 {
2656
2658 }
2659 }
2660
2662 {
2663
2665 }
2666
2667
2669 {
2671
2674 }
2675
2677 {
2679
2681 {
2683 }
2684 else
2685 {
2687 }
2688
2690 }
2691
2693 {
2695
2697 foreach (
string slotName : attachmentSlots)
2698 {
2700 }
2701
2702
2705 else
2707
2709 }
2710
2712 {
2713 string slotNameMounted = slot_name + "_Mounted";
2714 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2715
2716 if (attachment)
2717 {
2718 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2719 if (barbedWire && barbedWire.IsMounted())
2721 else
2723
2724 if (is_locked)
2725 {
2726 SetAnimationPhase(slotNameMounted, 0);
2727 SetAnimationPhase(slot_name, 1);
2728 }
2729 else
2730 {
2731 SetAnimationPhase(slotNameMounted, 1);
2732 SetAnimationPhase(slot_name, 0);
2733 }
2734 }
2735 else
2736 {
2737 SetAnimationPhase(slotNameMounted, 1);
2738 SetAnimationPhase(slot_name, 1);
2739
2741 }
2742 }
2743
2744
2746 {
2749
2752
2755
2756 foreach (
string slotName : attachmentSlots)
2757 {
2759 }
2760
2761
2763 {
2766
2768 }
2769 else
2770 {
2773
2775 }
2776
2779 }
2780
2782 {
2783
2785 return;
2786
2787 string slot_name_mounted = slot_name + "_Mounted";
2788 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2789
2790
2792 RemoveProxyPhysics( slot_name_mounted );
2793 RemoveProxyPhysics( slot_name );
2794
2795 if ( attachment )
2796 {
2798 if ( is_locked )
2799 {
2801 AddProxyPhysics( slot_name_mounted );
2802 }
2803 else
2804 {
2806 AddProxyPhysics( slot_name );
2807 }
2808 }
2809 }
2810
2812 {
2813 SetAffectPathgraph( true, false );
2815 }
2816
2818 {
2819 return true;
2820 }
2821
2823 {
2824 return true;
2825 }
2826
2828 {
2829 if ( attachment )
2830 {
2832 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2833
2834 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2835 }
2836
2837 return false;
2838 }
2839
2841 {
2843 }
2844
2845
2847 {
2848 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2849 if (
g_Game.ConfigIsExisting( config_path ) )
2850 {
2851 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2852 }
2853 }
2854
2856 {
2857 return true;
2858 }
2859
2861 {
2862 return true;
2863 }
2864
2866 {
2867 return true;
2868 }
2869
2870
2872 {
2875 }
2876
2878 {
2880 }
2881
2883 {
2885 }
2886
2888 {
2889 int attachment_count = GetInventory().AttachmentCount();
2890 if ( attachment_count > 0 )
2891 {
2892 if (
HasBase() && attachment_count == 1 )
2893 {
2894 return false;
2895 }
2896
2897 return true;
2898 }
2899
2900 return false;
2901 }
2902
2904 {
2905 return true;
2906 }
2907
2909 {
2910 return false;
2911 }
2912
2913
2915 {
2916 return false;
2917 }
2918
2920 {
2921 return false;
2922 }
2923
2924
2926 {
2927 return false;
2928 }
2929
2930
2931
2933 {
2934 return true;
2935 }
2936
2938 {
2939 return true;
2940 }
2941
2944 {
2945 return false;
2946 }
2947
2948
2950 {
2951 return false;
2952 }
2953
2954
2956 {
2957 return true;
2958 }
2959
2960
2962 {
2963 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2964 {
2965 return false;
2966 }
2967
2968 return true;
2969 }
2970
2972 {
2975
2976 return item;
2977 }
2978
2979
2981 {
2983 {
2984
2986
2987
2990
2992 if ( MemoryPointExists( slot_name + "_min" ) )
2993 {
2994 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2995 }
2996 if ( MemoryPointExists( slot_name + "_max" ) )
2997 {
2998 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2999 }
3000
3001
3004
3005
3008 center = ModelToWorld( center );
3009
3010
3013
3014 areaDamage.SetExtents( extents[0], extents[1] );
3015 areaDamage.SetAreaPosition( center );
3019 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
3020 areaDamage.SetAmmoName( "BarbedWireHit" );
3021 areaDamage.Spawn();
3022
3024 }
3025 }
3026
3028 {
3029 if ( angle_deg != 0 )
3030 {
3031
3033
3034
3036 if ( MemoryPointExists( "rotate_axis" ) )
3037 {
3038 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3039 }
3040 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];
3041 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];
3042 center[0] = r_center_x;
3043 center[2] = r_center_z;
3044 }
3045 }
3046
3048 {
3050 {
3053 {
3054 if (areaDamage)
3055 {
3056 areaDamage.Destroy();
3057 }
3058
3060 }
3061 }
3062 }
3063
3065 {
3066 return true;
3067 }
3068
3069
3070
3071
3073 {
3075 }
3076
3078 {
3080 }
3081
3083 {
3085 }
3086
3088 {
3090
3091 switch ( material_type )
3092 {
3098 }
3099
3100 return "";
3101 }
3102
3104 {
3106
3107 switch ( material_type )
3108 {
3114 }
3115
3116 return "";
3117 }
3118
3119
3121 {
3123 {
3124
3126 {
3127 SetHealth(slot_name,"Health",item.GetHealth());
3128 }
3129 }
3130 }
3131
3133 {
3134 return 111;
3135 }
3136
3138 {
3139 super.SetActions();
3140
3144 }
3145
3147 {
3149 if (!construction)
3150 return;
3151
3153 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3154 {
3157 {
3159 }
3160 }
3161 }
3162
3164 {
3166 if (!construction)
3167 return;
3168
3170 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3171 {
3174 {
3175 construction.HandleEntityFalling(part.
GetPartName());
3176 }
3177 }
3178 }
3179
3182 {
3184 return;
3185
3188
3189 if (DestroyOnFall())
3190 {
3192 {
3194 }
3195 else
3196 {
3198 {
3200 }
3202 }
3203 }
3204 }
3205
3207 {
3208 if (HasAnyAttachmentsOrCargo())
3209 {
3212 }
3213 }
3214
3215
3216
3217
3218
3221 {
3222 return null;
3223 }
3224
3226 {
3228 }
3229
3231 {
3234
3235 Man p;
3236
3237 #ifdef SERVER
3239 g_Game.GetWorld().GetPlayerList(players);
3240 if (players.Count())
3241 p = players[0];
3242 #else
3244 #endif
3245
3247 {
3248 bool excluded = false;
3250 if (excludes)
3251 {
3252 foreach (string exclude : excludes)
3253 {
3255 {
3256 excluded = true;
3257 break;
3258 }
3259 }
3260 }
3261
3262 if (!excluded)
3263 {
3265 }
3266 }
3267
3269 }
3270
3272
3274 [
Obsolete(
"handled in the Construction component directly")]
3276 {
3277 }
3278
3279 [
Obsolete(
"handled in the Construction component directly")]
3281 {
3282 }
3283
3284 [
Obsolete(
"obsolete debug method")]
3286 {
3287 }
3288}
3289
3291{
3292#ifdef BSB_DEBUG
3294#else
3295
3296#endif
3297}
3299{
3300#ifdef BSB_DEBUG_SPAM
3302#else
3303
3304#endif
3305}
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.