From a772b505acd1efa20a11a58f259b3027e89c0c56 Mon Sep 17 00:00:00 2001 From: Acruid Date: Wed, 29 Jul 2020 15:49:44 -0700 Subject: [PATCH] IComponentManager API changes. --- .../ComponentManagerGetAllComponents.cs | 4 ++-- .../EntitySystems/SubFloorHideSystem.cs | 2 +- Content.Server/Administration/WarpCommand.cs | 6 +++--- .../GameObjects/EntitySystems/DoorSystem.cs | 15 ++++----------- .../Movement/SharedSlipperyComponent.cs | 2 +- .../GameObjects/EntitySystems/SlipperySystem.cs | 15 +++------------ RobustToolbox | 2 +- 7 files changed, 15 insertions(+), 31 deletions(-) diff --git a/Content.Benchmarks/ComponentManagerGetAllComponents.cs b/Content.Benchmarks/ComponentManagerGetAllComponents.cs index a2db430944..3b1c3e1c6d 100644 --- a/Content.Benchmarks/ComponentManagerGetAllComponents.cs +++ b/Content.Benchmarks/ComponentManagerGetAllComponents.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using BenchmarkDotNet.Attributes; using Moq; @@ -80,7 +80,7 @@ namespace Content.Benchmarks { var count = 0; - foreach (var _ in _componentManager.GetAllComponents()) + foreach (var _ in _componentManager.EntityQuery()) { count += 1; } diff --git a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs index 9a51fb4d8e..1cc538fd68 100644 --- a/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs +++ b/Content.Client/GameObjects/EntitySystems/SubFloorHideSystem.cs @@ -36,7 +36,7 @@ namespace Content.Client.GameObjects.EntitySystems private void UpdateAll() { - foreach (var comp in EntityManager.ComponentManager.GetAllComponents()) + foreach (var comp in EntityManager.ComponentManager.EntityQuery()) { var gridId = comp.Owner.Transform.GridID; var grid = _mapManager.GetGrid(gridId); diff --git a/Content.Server/Administration/WarpCommand.cs b/Content.Server/Administration/WarpCommand.cs index 6152f4ee64..4942c6599b 100644 --- a/Content.Server/Administration/WarpCommand.cs +++ b/Content.Server/Administration/WarpCommand.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Content.Server.GameObjects.Components.Markers; using Robust.Server.Interfaces.Console; @@ -39,7 +39,7 @@ namespace Content.Server.Administration if (location == "?") { var locations = string.Join(", ", - comp.GetAllComponents() + comp.EntityQuery() .Select(p => p.Location) .Where(p => p != null) .OrderBy(p => p) @@ -59,7 +59,7 @@ namespace Content.Server.Administration var currentMap = player.AttachedEntity.Transform.MapID; var currentGrid = player.AttachedEntity.Transform.GridID; - var found = comp.GetAllComponents() + var found = comp.EntityQuery() .Where(p => p.Location == location) .Select(p => p.Owner.Transform.GridPosition) .OrderBy(p => p, Comparer.Create((a, b) => diff --git a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs index fbe47ad5cc..d9c6a782d8 100644 --- a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs @@ -1,21 +1,14 @@ -using Content.Server.GameObjects; -using Robust.Shared.GameObjects; -using Robust.Shared.GameObjects.Systems; +using Robust.Shared.GameObjects.Systems; -namespace Content.Server.Interfaces.GameObjects.Components.Interaction +namespace Content.Server.GameObjects.EntitySystems { class DoorSystem : EntitySystem { - public override void Initialize() - { - EntityQuery = new TypeEntityQuery(typeof(ServerDoorComponent)); - } - + /// public override void Update(float frameTime) { - foreach (var entity in RelevantEntities) + foreach (var comp in ComponentManager.EntityQuery()) { - var comp = entity.GetComponent(); comp.OnUpdate(frameTime); } } diff --git a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs index f467ac7642..510216449c 100644 --- a/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs +++ b/Content.Shared/GameObjects/Components/Movement/SharedSlipperyComponent.cs @@ -95,7 +95,7 @@ namespace Content.Shared.GameObjects.Components.Movement TrySlip(collidedWith); } - public void Update(float frameTime) + public void Update() { foreach (var uid in _slipped.ToArray()) { diff --git a/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs b/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs index 9a00451224..e5ad22f7ec 100644 --- a/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs +++ b/Content.Shared/GameObjects/EntitySystems/SlipperySystem.cs @@ -1,6 +1,5 @@ using Content.Shared.GameObjects.Components.Movement; using JetBrains.Annotations; -using Robust.Shared.GameObjects; using Robust.Shared.GameObjects.Systems; namespace Content.Shared.GameObjects.EntitySystems @@ -8,20 +7,12 @@ namespace Content.Shared.GameObjects.EntitySystems [UsedImplicitly] public class SlipperySystem : EntitySystem { - public override void Initialize() - { - base.Initialize(); - - EntityQuery = new TypeEntityQuery(typeof(SharedSlipperyComponent)); - } - + /// public override void Update(float frameTime) { - base.Update(frameTime); - - foreach (var entity in RelevantEntities) + foreach (var slipperyComp in ComponentManager.EntityQuery()) { - entity.GetComponent().Update(frameTime); + slipperyComp.Update(); } } } diff --git a/RobustToolbox b/RobustToolbox index 1de41531ce..350e05c152 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 1de41531ce6b86c183f37076488e949fcc7b796c +Subproject commit 350e05c152ceefcc63f0a77ac136abbd8cd1122b