From c3fd0ef882b537a501aa1f07cc5f2f41db810411 Mon Sep 17 00:00:00 2001 From: Tyler Young Date: Mon, 8 Jun 2020 16:49:05 -0400 Subject: [PATCH] Revert "virtualize all net ids to reduce net traffic" This reverts commit 027c338c5f47ad9e4abc19c9163a40e490af4257. Formatting fix left in. --- .../Components/Cargo/SharedCargoOrderDatabaseComponent.cs | 4 +--- .../Components/Cargo/SharedGalacticMarketComponent.cs | 4 +--- .../Components/Chemistry/SharedInjectorComponent.cs | 3 +-- .../Components/Chemistry/SharedSolutionComponent.cs | 4 +--- .../GameObjects/Components/Damage/DamageableComponent.cs | 3 +-- .../Components/Instruments/SharedInstrumentComponent.cs | 3 +-- .../Components/Interactable/SharedToolComponent.cs | 6 ++---- .../Components/Inventory/SharedInventoryComponent.cs | 3 +-- .../GameObjects/Components/Items/ClothingComponentState.cs | 3 +-- .../GameObjects/Components/Items/ItemComponentState.cs | 7 +++++-- .../GameObjects/Components/Items/ItemCooldownComponent.cs | 3 +-- .../GameObjects/Components/Items/SharedHandsComponent.cs | 3 +-- .../Components/Mobs/SharedCombatModeComponent.cs | 2 +- .../Components/Mobs/SharedHumanoidAppearanceComponent.cs | 4 +--- .../Components/Mobs/SharedOverlayEffectsComponent.cs | 3 +-- .../Components/Mobs/SharedStatusEffectsComponent.cs | 3 +-- .../Components/Observer/SharedGhostComponent.cs | 3 +-- .../GameObjects/Components/PDA/SharedPDAComponent.cs | 3 +-- .../Components/Research/SharedLatheDatabaseComponent.cs | 4 +--- .../Components/Research/SharedMaterialStorageComponent.cs | 4 +--- .../Research/SharedProtolatheDatabaseComponent.cs | 4 +--- .../Research/SharedTechnologyDatabaseComponent.cs | 6 ++---- .../GameObjects/Components/SharedHandheldLightComponent.cs | 4 +--- .../GameObjects/Components/SharedStackComponent.cs | 3 +-- .../Ranged/BallisticMagazineWeaponComponentState.cs | 4 +--- 25 files changed, 31 insertions(+), 62 deletions(-) diff --git a/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs index 4a2b746eb5..cd7debb0ab 100644 --- a/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Cargo/SharedCargoOrderDatabaseComponent.cs @@ -16,9 +16,7 @@ namespace Content.Shared.GameObjects.Components.Cargo public class CargoOrderDatabaseState : ComponentState { public readonly List Orders; - public override uint NetID => ContentNetIDs.CARGO_ORDER_DATABASE; - - public CargoOrderDatabaseState(List orders) + public CargoOrderDatabaseState(List orders) : base(ContentNetIDs.CARGO_ORDER_DATABASE) { Orders = orders; } diff --git a/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs b/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs index 4f6652183d..8f39c13724 100644 --- a/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs +++ b/Content.Shared/GameObjects/Components/Cargo/SharedGalacticMarketComponent.cs @@ -88,9 +88,7 @@ namespace Content.Shared.GameObjects.Components.Cargo public class GalacticMarketState : ComponentState { public List Products; - public override uint NetID => ContentNetIDs.GALACTIC_MARKET; - - public GalacticMarketState(List technologies) + public GalacticMarketState(List technologies) : base(ContentNetIDs.GALACTIC_MARKET) { Products = technologies; } diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs index 9b688229b3..4fbef4ff26 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedInjectorComponent.cs @@ -22,9 +22,8 @@ namespace Content.Shared.GameObjects.Components.Chemistry public ReagentUnit CurrentVolume { get; } public ReagentUnit TotalVolume { get; } public InjectorToggleMode CurrentMode { get; } - public override uint NetID => ContentNetIDs.REAGENT_INJECTOR; - public InjectorComponentState(ReagentUnit currentVolume, ReagentUnit totalVolume, InjectorToggleMode currentMode) + public InjectorComponentState(ReagentUnit currentVolume, ReagentUnit totalVolume, InjectorToggleMode currentMode) : base(ContentNetIDs.REAGENT_INJECTOR) { CurrentVolume = currentVolume; TotalVolume = totalVolume; diff --git a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionComponent.cs b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionComponent.cs index acd9b18324..232bea635e 100644 --- a/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionComponent.cs +++ b/Content.Shared/GameObjects/Components/Chemistry/SharedSolutionComponent.cs @@ -20,9 +20,7 @@ namespace Content.Shared.GameObjects.Components.Chemistry [Serializable, NetSerializable] public class SolutionComponentState : ComponentState { - public override uint NetID => ContentNetIDs.SOLUTION; - - public SolutionComponentState() { } + public SolutionComponentState() : base(ContentNetIDs.SOLUTION) { } } /// diff --git a/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs b/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs index 2a3ab12946..656efbaf82 100644 --- a/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs +++ b/Content.Shared/GameObjects/Components/Damage/DamageableComponent.cs @@ -16,9 +16,8 @@ namespace Content.Shared.GameObjects public class DamageComponentState : ComponentState { public Dictionary CurrentDamage = new Dictionary(); - public override uint NetID => ContentNetIDs.DAMAGEABLE; - public DamageComponentState(Dictionary damage) + public DamageComponentState(Dictionary damage) : base(ContentNetIDs.DAMAGEABLE) { CurrentDamage = damage; } diff --git a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs index f62c02e638..c431a25fc8 100644 --- a/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs +++ b/Content.Shared/GameObjects/Components/Instruments/SharedInstrumentComponent.cs @@ -59,9 +59,8 @@ namespace Content.Shared.GameObjects.Components.Instruments public class InstrumentState : ComponentState { public bool Playing { get; } - public override uint NetID => ContentNetIDs.INSTRUMENTS; - public InstrumentState(bool playing, uint sequencerTick = 0) + public InstrumentState(bool playing, uint sequencerTick = 0) : base(ContentNetIDs.INSTRUMENTS) { Playing = playing; } diff --git a/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs b/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs index 3990088a31..a99f4e029f 100644 --- a/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs +++ b/Content.Shared/GameObjects/Components/Interactable/SharedToolComponent.cs @@ -27,9 +27,8 @@ namespace Content.Shared.GameObjects.Components.Interactable public class MultiToolComponentState : ComponentState { public ToolQuality Quality { get; } - public override uint NetID => ContentNetIDs.MULTITOOLS; - public MultiToolComponentState(ToolQuality quality) + public MultiToolComponentState(ToolQuality quality) : base(ContentNetIDs.MULTITOOLS) { Quality = quality; } @@ -42,9 +41,8 @@ namespace Content.Shared.GameObjects.Components.Interactable public float Fuel { get; } public bool Activated { get; } public ToolQuality Quality { get; } - public override uint NetID => ContentNetIDs.WELDER; - public WelderComponentState(float fuelCapacity, float fuel, bool activated) + public WelderComponentState(float fuelCapacity, float fuel, bool activated) : base(ContentNetIDs.WELDER) { FuelCapacity = fuelCapacity; Fuel = fuel; diff --git a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs index 51aac9a099..cf49d55e09 100644 --- a/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs +++ b/Content.Shared/GameObjects/Components/Inventory/SharedInventoryComponent.cs @@ -51,9 +51,8 @@ namespace Content.Shared.GameObjects protected class InventoryComponentState : ComponentState { public List> Entities { get; } - public override uint NetID => ContentNetIDs.STORAGE; - public InventoryComponentState(List> entities) + public InventoryComponentState(List> entities) : base(ContentNetIDs.STORAGE) { Entities = entities; } diff --git a/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs b/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs index c86723d4f2..42994d9193 100644 --- a/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs +++ b/Content.Shared/GameObjects/Components/Items/ClothingComponentState.cs @@ -7,9 +7,8 @@ namespace Content.Shared.GameObjects.Components.Items public class ClothingComponentState : ItemComponentState { public string ClothingEquippedPrefix { get; set; } - public override uint NetID => ContentNetIDs.CLOTHING; - public ClothingComponentState(string clothingEquippedPrefix, string equippedPrefix) : base(equippedPrefix) + public ClothingComponentState(string clothingEquippedPrefix, string equippedPrefix) : base(equippedPrefix, ContentNetIDs.CLOTHING) { ClothingEquippedPrefix = clothingEquippedPrefix; } diff --git a/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs b/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs index 7d496d826c..bbcff17cf3 100644 --- a/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs +++ b/Content.Shared/GameObjects/Components/Items/ItemComponentState.cs @@ -8,12 +8,15 @@ namespace Content.Shared.GameObjects.Components.Items public class ItemComponentState : ComponentState { public string EquippedPrefix { get; set; } - public override uint NetID => ContentNetIDs.ITEM; - public ItemComponentState(string equippedPrefix) + public ItemComponentState(string equippedPrefix) : base(ContentNetIDs.ITEM) { EquippedPrefix = equippedPrefix; } + protected ItemComponentState(string equippedPrefix, uint netId) : base(netId) + { + EquippedPrefix = equippedPrefix; + } } } diff --git a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs index be498567f5..c2425cc9bc 100644 --- a/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/ItemCooldownComponent.cs @@ -74,9 +74,8 @@ namespace Content.Shared.GameObjects.Components.Items { public TimeSpan? CooldownStart { get; set; } public TimeSpan? CooldownEnd { get; set; } - public override uint NetID => ContentNetIDs.ITEMCOOLDOWN; - public ItemCooldownComponentState() + public ItemCooldownComponentState() : base(ContentNetIDs.ITEMCOOLDOWN) { } } diff --git a/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs b/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs index acc5d1a266..dc3604eae6 100644 --- a/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs +++ b/Content.Shared/GameObjects/Components/Items/SharedHandsComponent.cs @@ -17,9 +17,8 @@ namespace Content.Shared.GameObjects { public readonly Dictionary Hands; public readonly string ActiveIndex; - public override uint NetID => ContentNetIDs.HANDS; - public HandsComponentState(Dictionary hands, string activeIndex) + public HandsComponentState(Dictionary hands, string activeIndex) : base(ContentNetIDs.HANDS) { Hands = hands; ActiveIndex = activeIndex; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs index 9866beff09..bde177ac64 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedCombatModeComponent.cs @@ -57,9 +57,9 @@ namespace Content.Shared.GameObjects.Components.Mobs { public bool IsInCombatMode { get; } public TargetingZone TargetingZone { get; } - public override uint NetID => ContentNetIDs.COMBATMODE; public CombatModeComponentState(bool isInCombatMode, TargetingZone targetingZone) + : base(ContentNetIDs.COMBATMODE) { IsInCombatMode = isInCombatMode; TargetingZone = targetingZone; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs index 1d7064ec7b..91abd4e721 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedHumanoidAppearanceComponent.cs @@ -69,9 +69,7 @@ namespace Content.Shared.GameObjects.Components.Mobs [NetSerializable] private sealed class HumanoidAppearanceComponentState : ComponentState { - public override uint NetID => ContentNetIDs.HUMANOID_APPEARANCE; - - public HumanoidAppearanceComponentState(HumanoidCharacterAppearance appearance, Sex sex) + public HumanoidAppearanceComponentState(HumanoidCharacterAppearance appearance, Sex sex) : base(ContentNetIDs.HUMANOID_APPEARANCE) { Appearance = appearance; Sex = sex; diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedOverlayEffectsComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedOverlayEffectsComponent.cs index 59e47efac7..07b2b839c2 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedOverlayEffectsComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedOverlayEffectsComponent.cs @@ -24,9 +24,8 @@ namespace Content.Shared.GameObjects.Components.Mobs public class OverlayEffectComponentState : ComponentState { public ScreenEffects ScreenEffect; - public override uint NetID => ContentNetIDs.OVERLAYEFFECTS; - public OverlayEffectComponentState(ScreenEffects screenEffect) + public OverlayEffectComponentState(ScreenEffects screenEffect) : base(ContentNetIDs.OVERLAYEFFECTS) { ScreenEffect = screenEffect; } diff --git a/Content.Shared/GameObjects/Components/Mobs/SharedStatusEffectsComponent.cs b/Content.Shared/GameObjects/Components/Mobs/SharedStatusEffectsComponent.cs index ae21409a82..482b24fc17 100644 --- a/Content.Shared/GameObjects/Components/Mobs/SharedStatusEffectsComponent.cs +++ b/Content.Shared/GameObjects/Components/Mobs/SharedStatusEffectsComponent.cs @@ -19,9 +19,8 @@ namespace Content.Shared.GameObjects.Components.Mobs public class StatusEffectComponentState : ComponentState { public Dictionary StatusEffects; - public override uint NetID => ContentNetIDs.STATUSEFFECTS; - public StatusEffectComponentState(Dictionary statusEffects) + public StatusEffectComponentState(Dictionary statusEffects) : base(ContentNetIDs.STATUSEFFECTS) { StatusEffects = statusEffects; } diff --git a/Content.Shared/GameObjects/Components/Observer/SharedGhostComponent.cs b/Content.Shared/GameObjects/Components/Observer/SharedGhostComponent.cs index 41881bd2f3..b838c3b63e 100644 --- a/Content.Shared/GameObjects/Components/Observer/SharedGhostComponent.cs +++ b/Content.Shared/GameObjects/Components/Observer/SharedGhostComponent.cs @@ -14,9 +14,8 @@ namespace Content.Shared.GameObjects.Components.Observer public class GhostComponentState : ComponentState { public bool CanReturnToBody { get; } - public override uint NetID => ContentNetIDs.GHOST; - public GhostComponentState(bool canReturnToBody) + public GhostComponentState(bool canReturnToBody) : base(ContentNetIDs.GHOST) { CanReturnToBody = canReturnToBody; } diff --git a/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs b/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs index e458912746..567f7f8b2c 100644 --- a/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs +++ b/Content.Shared/GameObjects/Components/PDA/SharedPDAComponent.cs @@ -166,11 +166,10 @@ namespace Content.Shared.GameObjects.Components.PDA public UplinkCategory Category; public string Description; public string ListingName; - public override uint NetID => ContentNetIDs.PDA; public UplinkListingData(string listingName,string itemId, int price, UplinkCategory category, - string description) + string description) : base(ContentNetIDs.PDA) { ListingName = listingName; Price = price; diff --git a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs index e3b3c4aa03..fea10d01f4 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedLatheDatabaseComponent.cs @@ -117,9 +117,7 @@ namespace Content.Shared.GameObjects.Components.Research public class LatheDatabaseState : ComponentState { public readonly List Recipes; - public override uint NetID => ContentNetIDs.LATHE_DATABASE; - - public LatheDatabaseState(List recipes) + public LatheDatabaseState(List recipes) : base(ContentNetIDs.LATHE_DATABASE) { Recipes = recipes; } diff --git a/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs index 158bc69c6c..5ded848a25 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedMaterialStorageComponent.cs @@ -69,9 +69,7 @@ namespace Content.Shared.GameObjects.Components.Research public class MaterialStorageState : ComponentState { public readonly Dictionary Storage; - public override uint NetID => ContentNetIDs.MATERIAL_STORAGE; - - public MaterialStorageState(Dictionary storage) + public MaterialStorageState(Dictionary storage) : base(ContentNetIDs.MATERIAL_STORAGE) { Storage = storage; } diff --git a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs index db8ede759f..9fb52757fe 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedProtolatheDatabaseComponent.cs @@ -63,9 +63,7 @@ namespace Content.Shared.GameObjects.Components.Research public class ProtolatheDatabaseState : ComponentState { public readonly List Recipes; - public override uint NetID => ContentNetIDs.PROTOLATHE_DATABASE; - - public ProtolatheDatabaseState(List recipes) + public ProtolatheDatabaseState(List recipes) : base(ContentNetIDs.PROTOLATHE_DATABASE) { Recipes = recipes; } diff --git a/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs b/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs index 94b64e36d5..d76b42260f 100644 --- a/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs +++ b/Content.Shared/GameObjects/Components/Research/SharedTechnologyDatabaseComponent.cs @@ -104,14 +104,12 @@ namespace Content.Shared.GameObjects.Components.Research public class TechnologyDatabaseState : ComponentState { public List Technologies; - public override uint NetID => ContentNetIDs.TECHNOLOGY_DATABASE; - - public TechnologyDatabaseState(List technologies) + public TechnologyDatabaseState(List technologies) : base(ContentNetIDs.TECHNOLOGY_DATABASE) { Technologies = technologies; } - public TechnologyDatabaseState(List technologies) + public TechnologyDatabaseState(List technologies) : base(ContentNetIDs.TECHNOLOGY_DATABASE) { Technologies = new List(); foreach (var technology in technologies) diff --git a/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs b/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs index 7d1d7402f7..ecc9229693 100644 --- a/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedHandheldLightComponent.cs @@ -12,9 +12,7 @@ namespace Content.Shared.GameObjects.Components [Serializable, NetSerializable] protected sealed class HandheldLightComponentState : ComponentState { - public override uint NetID => ContentNetIDs.HANDHELD_LIGHT; - - public HandheldLightComponentState(float? charge) + public HandheldLightComponentState(float? charge) : base(ContentNetIDs.HANDHELD_LIGHT) { Charge = charge; } diff --git a/Content.Shared/GameObjects/Components/SharedStackComponent.cs b/Content.Shared/GameObjects/Components/SharedStackComponent.cs index 6143dfc221..3713108839 100644 --- a/Content.Shared/GameObjects/Components/SharedStackComponent.cs +++ b/Content.Shared/GameObjects/Components/SharedStackComponent.cs @@ -107,9 +107,8 @@ namespace Content.Shared.GameObjects.Components { public int Count { get; } public int MaxCount { get; } - public override uint NetID => ContentNetIDs.STACK; - public StackComponentState(int count, int maxCount) + public StackComponentState(int count, int maxCount) : base(ContentNetIDs.STACK) { Count = count; MaxCount = maxCount; diff --git a/Content.Shared/GameObjects/Components/Weapons/Ranged/BallisticMagazineWeaponComponentState.cs b/Content.Shared/GameObjects/Components/Weapons/Ranged/BallisticMagazineWeaponComponentState.cs index fd8ca4e345..158dbaa5ad 100644 --- a/Content.Shared/GameObjects/Components/Weapons/Ranged/BallisticMagazineWeaponComponentState.cs +++ b/Content.Shared/GameObjects/Components/Weapons/Ranged/BallisticMagazineWeaponComponentState.cs @@ -20,9 +20,7 @@ namespace Content.Shared.GameObjects.Components.Weapons.Ranged /// public (int count, int max)? MagazineCount { get; } - public override uint NetID => ContentNetIDs.BALLISTIC_MAGAZINE_WEAPON; - - public BallisticMagazineWeaponComponentState(bool chambered, (int count, int max)? magazineCount) + public BallisticMagazineWeaponComponentState(bool chambered, (int count, int max)? magazineCount) : base(ContentNetIDs.BALLISTIC_MAGAZINE_WEAPON) { Chambered = chambered; MagazineCount = magazineCount;