1967{
1969
1971
1973
1980
1981
1982
1988
1994
1996
2000
2001
2003 {
2005
2006
2007 RegisterNetSyncVariableInt( "m_SyncParts01" );
2008 RegisterNetSyncVariableInt( "m_SyncParts02" );
2009 RegisterNetSyncVariableInt( "m_SyncParts03" );
2010 RegisterNetSyncVariableInt( "m_InteractedPartId" );
2011 RegisterNetSyncVariableInt( "m_PerformedActionId" );
2012 RegisterNetSyncVariableBool( "m_HasBase" );
2013
2014
2015 ConstructionInit();
2016
2017 if (ConfigIsExisting("hybridAttachments"))
2018 {
2021 }
2022 if (ConfigIsExisting("mountables"))
2023 {
2026 }
2027
2029 SetAllowDamage(true);
2030 }
2031
2033 {
2034 return "disableBaseDamage";
2035 }
2036
2038 {
2039 return true;
2040 }
2041
2043 {
2044 return EInventoryIconVisibility.HIDE_VICINITY;
2045 }
2046
2048 {
2049 super.InitItemSounds();
2050
2054
2059 }
2060
2062 {
2063 return "putDown_FenceKit_SoundSet";
2064 }
2065
2067 {
2068 return "Shelter_Site_Build_Loop_SoundSet";
2069 }
2070
2071
2073 {
2075 {
2076 SetSynchDirty();
2077 }
2078 }
2079
2081 {
2083 super.OnVariablesSynchronized();
2084
2086 }
2087
2089 {
2090
2092
2093
2095
2096
2098 }
2099
2100
2102 {
2103
2104 int offset;
2105 int mask;
2106
2107 if ( part_id >= 1 && part_id <= 31 )
2108 {
2109 offset = part_id - 1;
2110 mask = 1 << offset;
2111
2113 }
2114 else if ( part_id >= 32 && part_id <= 62 )
2115 {
2116 offset = ( part_id % 32 );
2117 mask = 1 << offset;
2118
2120 }
2121 else if ( part_id >= 63 && part_id <= 93 )
2122 {
2123 offset = ( part_id % 63 );
2124 mask = 1 << offset;
2125
2127 }
2128 }
2129
2131 {
2132
2133 int offset;
2134 int mask;
2135
2136 if ( part_id >= 1 && part_id <= 31 )
2137 {
2138 offset = part_id - 1;
2139 mask = 1 << offset;
2140
2142 }
2143 else if ( part_id >= 32 && part_id <= 62 )
2144 {
2145 offset = ( part_id % 32 );
2146 mask = 1 << offset;
2147
2149 }
2150 else if ( part_id >= 63 && part_id <= 93 )
2151 {
2152 offset = ( part_id % 63 );
2153 mask = 1 << offset;
2154
2156 }
2157 }
2158
2160 {
2161
2162 int offset;
2163 int mask;
2164
2165 if ( part_id >= 1 && part_id <= 31 )
2166 {
2167 offset = part_id - 1;
2168 mask = 1 << offset;
2169
2171 {
2172 return true;
2173 }
2174 }
2175 else if ( part_id >= 32 && part_id <= 62 )
2176 {
2177 offset = ( part_id % 32 );
2178 mask = 1 << offset;
2179
2181 {
2182 return true;
2183 }
2184 }
2185 else if ( part_id >= 63 && part_id <= 93 )
2186 {
2187 offset = ( part_id % 63 );
2188 mask = 1 << offset;
2189
2191 {
2192 return true;
2193 }
2194 }
2195
2196 return false;
2197 }
2198
2200 {
2203 }
2204
2206 {
2207
2210 }
2211
2213 {
2215 {
2218
2219 switch( build_action_id )
2220 {
2224 }
2225 }
2226 }
2227
2228
2230 {
2232 bool is_base = part.
IsBase();
2235 if ( is_part_built_sync )
2236 {
2238 {
2242
2243 if (is_base)
2244 {
2247 }
2248 }
2249 }
2250 else
2251 {
2253 {
2257
2258 if (is_base)
2259 {
2262 }
2263 }
2264 }
2265
2266
2268 }
2269
2270
2272 {
2275
2276 for ( int i = 0; i < construction_parts.Count(); ++i )
2277 {
2278 string key = construction_parts.GetKey( i );
2281 }
2282
2283
2285 }
2286
2288 {
2291
2292 for ( int i = 0; i < construction_parts.Count(); ++i )
2293 {
2294 string key = construction_parts.GetKey( i );
2296
2297 if ( value.
GetId() ==
id )
2298 {
2299 return value;
2300 }
2301 }
2302
2303 return NULL;
2304 }
2305
2306
2307
2309 {
2311 }
2312
2314 {
2316 }
2317
2319 {
2320 return true;
2321 }
2322
2324 {
2325 return false;
2326 }
2327
2328
2330 {
2333 {
2335 }
2336
2337 return construction_kit;
2338 }
2339
2341 {
2344 {
2346 }
2347 }
2348
2350 {
2352 }
2353
2355 {
2356 return "";
2357 }
2358
2360 {
2362 g_Game.ObjectDelete( construction_kit );
2363 }
2364
2365
2367 {
2369 g_Game.ObjectDelete(
this );
2370 }
2371
2372
2374 {
2375 super.EEDelete(parent);
2376
2378 {
2379 areaDamage.Destroy();
2380 }
2381
2382 }
2383
2385 {
2386 super.OnStoreSave( ctx );
2387
2388
2392
2394 }
2395
2397 {
2398 if ( !super.OnStoreLoad( ctx, version ) )
2399 return false;
2400
2401
2402
2404 {
2406 return false;
2407 }
2409 {
2411 return false;
2412 }
2414 {
2416 return false;
2417 }
2418
2419
2421 {
2423 return false;
2424 }
2425
2426
2427 return true;
2428 }
2429
2431 {
2432 super.AfterStoreLoad();
2433
2435 {
2437 }
2438 }
2439
2441 {
2442
2444
2445
2448
2449
2451 }
2452
2454 {
2455 super.OnCreatePhysics();
2456
2457 ConstructionInit();
2459 }
2460
2462 {
2464 return;
2465
2466 super.EEHealthLevelChanged(oldLevel,newLevel,zone);
2467 }
2468
2470 {
2472 {
2474 }
2475
2476 super.EEOnAfterLoad();
2477 }
2478
2480 {
2481 super.EEItemAttached( item, slot_name );
2482
2486 }
2487
2489 {
2490 super.EEItemDetached( item, slot_name );
2491
2494 }
2495
2496 protected void OnSetSlotLock(
int slotId,
bool locked,
bool was_locked )
2497 {
2500
2503 }
2504
2505
2507 {
2508 return true;
2509 }
2510
2511
2512
2514 {
2516
2517
2518 if (construtionPart.
IsBase())
2519 {
2521
2522
2524 }
2525
2526
2528
2529
2531
2532
2534
2536
2538
2539
2541
2542
2544 }
2545
2547 {
2548
2550 }
2551
2552
2554 {
2557
2558
2560
2561
2563
2564
2566
2567
2569
2571
2572
2574
2575
2577
2578
2579 if (construtionPart.
IsBase())
2580 {
2581
2583 }
2584 }
2585
2587 {
2588
2590 }
2591
2592
2593 void OnPartDestroyedServer(Man player,
string part_name,
int action_id,
bool destroyed_by_connected_part =
false)
2594 {
2597
2598
2600
2601
2603
2604
2606
2607
2609
2611
2612
2614
2615
2617
2618
2619 if (construtionPart.
IsBase())
2620 {
2621
2623 }
2624 }
2625
2627 {
2628
2630 }
2631
2632
2634 {
2636
2639 }
2640
2642 {
2644
2646 {
2648 }
2649 else
2650 {
2652 }
2653
2655 }
2656
2658 {
2660
2662 foreach (
string slotName : attachmentSlots)
2663 {
2665 }
2666
2667
2670 else
2672
2674 }
2675
2677 {
2678 string slotNameMounted = slot_name + "_Mounted";
2679 EntityAI attachment = FindAttachmentBySlotName(slot_name);
2680
2681 if (attachment)
2682 {
2683 BarbedWire barbedWire = BarbedWire.Cast(attachment);
2684 if (barbedWire && barbedWire.IsMounted())
2686 else
2688
2689 if (is_locked)
2690 {
2691 SetAnimationPhase(slotNameMounted, 0);
2692 SetAnimationPhase(slot_name, 1);
2693 }
2694 else
2695 {
2696 SetAnimationPhase(slotNameMounted, 1);
2697 SetAnimationPhase(slot_name, 0);
2698 }
2699 }
2700 else
2701 {
2702 SetAnimationPhase(slotNameMounted, 1);
2703 SetAnimationPhase(slot_name, 1);
2704
2706 }
2707 }
2708
2709
2711 {
2714
2717
2720
2721 foreach (
string slotName : attachmentSlots)
2722 {
2724 }
2725
2726
2728 {
2731
2733 }
2734 else
2735 {
2738
2740 }
2741
2744 }
2745
2747 {
2748
2750 return;
2751
2752 string slot_name_mounted = slot_name + "_Mounted";
2753 EntityAI attachment = FindAttachmentBySlotName( slot_name );
2754
2755
2757 RemoveProxyPhysics( slot_name_mounted );
2758 RemoveProxyPhysics( slot_name );
2759
2760 if ( attachment )
2761 {
2763 if ( is_locked )
2764 {
2766 AddProxyPhysics( slot_name_mounted );
2767 }
2768 else
2769 {
2771 AddProxyPhysics( slot_name );
2772 }
2773 }
2774 }
2775
2777 {
2778 SetAffectPathgraph( true, false );
2780 }
2781
2783 {
2784 return true;
2785 }
2786
2788 {
2789 return true;
2790 }
2791
2793 {
2794 if ( attachment )
2795 {
2797 attachment.GetInventory().GetCurrentInventoryLocation( inventory_location );
2798
2799 return GetInventory().GetSlotLock( inventory_location.
GetSlot() );
2800 }
2801
2802 return false;
2803 }
2804
2806 {
2808 }
2809
2810
2812 {
2813 string config_path = "CfgVehicles" + " " + entity.GetType() + " " + "attachments";
2814 if (
g_Game.ConfigIsExisting( config_path ) )
2815 {
2816 g_Game.ConfigGetTextArray( config_path, attachment_slots );
2817 }
2818 }
2819
2821 {
2822 return true;
2823 }
2824
2826 {
2827 return true;
2828 }
2829
2831 {
2832 return true;
2833 }
2834
2835
2837 {
2840 }
2841
2843 {
2845 }
2846
2848 {
2850 }
2851
2853 {
2854 int attachment_count = GetInventory().AttachmentCount();
2855 if ( attachment_count > 0 )
2856 {
2857 if (
HasBase() && attachment_count == 1 )
2858 {
2859 return false;
2860 }
2861
2862 return true;
2863 }
2864
2865 return false;
2866 }
2867
2869 {
2870 return true;
2871 }
2872
2874 {
2875 return false;
2876 }
2877
2878
2880 {
2881 return false;
2882 }
2883
2885 {
2886 return false;
2887 }
2888
2889
2891 {
2892 return false;
2893 }
2894
2895
2896
2898 {
2899 return true;
2900 }
2901
2903 {
2904 return true;
2905 }
2906
2909 {
2910 return false;
2911 }
2912
2913
2915 {
2916 return false;
2917 }
2918
2919
2921 {
2922 return true;
2923 }
2924
2925
2927 {
2928 if (
HasBase() || GetInventory().AttachmentCount() > 0 )
2929 {
2930 return false;
2931 }
2932
2933 return true;
2934 }
2935
2937 {
2940
2941 return item;
2942 }
2943
2944
2946 {
2948 {
2949
2951
2952
2955
2957 if ( MemoryPointExists( slot_name + "_min" ) )
2958 {
2959 min_max[0] = GetMemoryPointPos( slot_name + "_min" );
2960 }
2961 if ( MemoryPointExists( slot_name + "_max" ) )
2962 {
2963 min_max[1] = GetMemoryPointPos( slot_name + "_max" );
2964 }
2965
2966
2969
2970
2973 center = ModelToWorld( center );
2974
2975
2978
2979 areaDamage.SetExtents( extents[0], extents[1] );
2980 areaDamage.SetAreaPosition( center );
2984 areaDamage.SetHitZones( { "Torso","LeftHand","LeftLeg","LeftFoot","RightHand","RightLeg","RightFoot" } );
2985 areaDamage.SetAmmoName( "BarbedWireHit" );
2986 areaDamage.Spawn();
2987
2989 }
2990 }
2991
2993 {
2994 if ( angle_deg != 0 )
2995 {
2996
2998
2999
3001 if ( MemoryPointExists( "rotate_axis" ) )
3002 {
3003 rotate_axis = ModelToWorld( GetMemoryPointPos( "rotate_axis" ) );
3004 }
3005 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];
3006 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];
3007 center[0] = r_center_x;
3008 center[2] = r_center_z;
3009 }
3010 }
3011
3013 {
3015 {
3018 {
3019 if (areaDamage)
3020 {
3021 areaDamage.Destroy();
3022 }
3023
3025 }
3026 }
3027 }
3028
3030 {
3031 return true;
3032 }
3033
3034
3035
3036
3038 {
3040 }
3041
3043 {
3045 }
3046
3048 {
3050 }
3051
3053 {
3055
3056 switch ( material_type )
3057 {
3063 }
3064
3065 return "";
3066 }
3067
3069 {
3071
3072 switch ( material_type )
3073 {
3079 }
3080
3081 return "";
3082 }
3083
3084
3086 {
3088 {
3089
3091 {
3092 SetHealth(slot_name,"Health",item.GetHealth());
3093 }
3094 }
3095 }
3096
3098 {
3099 return 111;
3100 }
3101
3103 {
3104 super.SetActions();
3105
3109 }
3110
3112 {
3114 if (!construction)
3115 return;
3116
3118 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3119 {
3122 {
3124 }
3125 }
3126 }
3127
3129 {
3131 if (!construction)
3132 return;
3133
3135 for ( int i = constructionParts.Count() - 1; i >= 0; --i )
3136 {
3139 {
3140 construction.HandleEntityFalling(part.
GetPartName());
3141 }
3142 }
3143 }
3144
3147 {
3149 return;
3150
3153
3154 if (DestroyOnFall())
3155 {
3157 {
3159 }
3160 else
3161 {
3163 {
3165 }
3167 }
3168 }
3169 }
3170
3172 {
3173 if (HasAnyAttachmentsOrCargo())
3174 {
3177 }
3178 }
3179
3180
3181
3182
3183
3186 {
3187 return null;
3188 }
3189
3191 {
3193 }
3194
3196 {
3199
3200 Man p;
3201
3202 #ifdef SERVER
3204 g_Game.GetWorld().GetPlayerList(players);
3205 if (players.Count())
3206 p = players[0];
3207 #else
3209 #endif
3210
3212 {
3213 bool excluded = false;
3215 if (excludes)
3216 {
3217 foreach (string exclude : excludes)
3218 {
3220 {
3221 excluded = true;
3222 break;
3223 }
3224 }
3225 }
3226
3227 if (!excluded)
3228 {
3230 }
3231 }
3232
3234 }
3235
3237
3239 [
Obsolete(
"handled in the Construction component directly")]
3241 {
3242 }
3243
3244 [
Obsolete(
"handled in the Construction component directly")]
3246 {
3247 }
3248
3249 [
Obsolete(
"obsolete debug method")]
3251 {
3252 }
3253}
3254
3256{
3257#ifdef BSB_DEBUG
3259#else
3260
3261#endif
3262}
3264{
3265#ifdef BSB_DEBUG_SPAM
3267#else
3268
3269#endif
3270}
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.