diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 36c090ce24..9e25ed3229 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -94,7 +94,12 @@ + + + + + diff --git a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs index e9e0795b4b..e61f943b7d 100644 --- a/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs +++ b/Content.Server/GameObjects/Components/Doors/ServerDoorComponent.cs @@ -96,7 +96,7 @@ namespace Content.Server.GameObjects } private const float AUTO_CLOSE_DELAY = 5; - public override void Update(float frameTime) + public void OnUpdate(float frameTime) { if (!Opened) { diff --git a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs index a34795f072..dd2afbf552 100644 --- a/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs +++ b/Content.Server/GameObjects/Components/Interactable/Tools/WelderComponent.cs @@ -80,7 +80,7 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools } } - public override void Update(float frameTime) + public void OnUpdate(float frameTime) { if (!Activated) { diff --git a/Content.Server/GameObjects/Components/Power/ApcComponent.cs b/Content.Server/GameObjects/Components/Power/ApcComponent.cs index 605e7abd78..c68ed7f4e4 100644 --- a/Content.Server/GameObjects/Components/Power/ApcComponent.cs +++ b/Content.Server/GameObjects/Components/Power/ApcComponent.cs @@ -1,4 +1,4 @@ -using Content.Shared.GameObjects.Components.Power; +using Content.Shared.GameObjects.Components.Power; using SS14.Server.GameObjects; using SS14.Shared.GameObjects; @@ -20,7 +20,7 @@ namespace Content.Server.GameObjects.Components.Power Appearance = Owner.GetComponent(); } - public override void Update(float frameTime) + public void OnUpdate() { var newState = CalcChargeState(); if (newState != LastChargeState) diff --git a/Content.Server/GameObjects/Components/Power/SMESComponent.cs b/Content.Server/GameObjects/Components/Power/SMESComponent.cs index fdfb23701d..490c2dad70 100644 --- a/Content.Server/GameObjects/Components/Power/SMESComponent.cs +++ b/Content.Server/GameObjects/Components/Power/SMESComponent.cs @@ -28,7 +28,7 @@ namespace Content.Server.GameObjects.Components.Power Appearance = Owner.GetComponent(); } - public override void Update(float frameTime) + public void OnUpdate() { var newLevel = CalcChargeLevel(); if (newLevel != LastChargeLevel) diff --git a/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs b/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs index 557ca72ab7..7f42f12d81 100644 --- a/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs +++ b/Content.Server/GameObjects/Components/Temperature/TemperatureComponent.cs @@ -45,10 +45,8 @@ namespace Content.Server.GameObjects } /// - public override void Update(float frameTime) + public void OnUpdate(float frameTime) { - base.Update(frameTime); - int fireDamage = (int)Math.Floor(Math.Max(0, CurrentTemperature - _fireDamageThreshold) / _fireDamageCoefficient); _secondsSinceLastDamageUpdate += frameTime; diff --git a/Content.Server/GameObjects/EntitySystems/DoorSystem.cs b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs new file mode 100644 index 0000000000..8b68c014df --- /dev/null +++ b/Content.Server/GameObjects/EntitySystems/DoorSystem.cs @@ -0,0 +1,22 @@ +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; + +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) + { + var comp = entity.GetComponent(); + comp.OnUpdate(frameTime); + } + } + } +} diff --git a/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs new file mode 100644 index 0000000000..74b1a1f96a --- /dev/null +++ b/Content.Server/GameObjects/EntitySystems/PowerApcSystem.cs @@ -0,0 +1,23 @@ +using Content.Server.GameObjects.Components.Power; +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; + +namespace Content.Server.GameObjects.EntitySystems +{ + class PowerApcSystem : EntitySystem + { + public override void Initialize() + { + EntityQuery = new TypeEntityQuery(typeof(ApcComponent)); + } + + public override void Update(float frameTime) + { + foreach (var entity in RelevantEntities) + { + var comp = entity.GetComponent(); + comp.OnUpdate(); + } + } + } +} diff --git a/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs new file mode 100644 index 0000000000..48ab06ba66 --- /dev/null +++ b/Content.Server/GameObjects/EntitySystems/PowerSmesSystem.cs @@ -0,0 +1,23 @@ +using Content.Server.GameObjects.Components.Power; +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; + +namespace Content.Server.GameObjects.EntitySystems +{ + internal class PowerSmesSystem : EntitySystem + { + public override void Initialize() + { + EntityQuery = new TypeEntityQuery(typeof(SmesComponent)); + } + + public override void Update(float frameTime) + { + foreach (var entity in RelevantEntities) + { + var comp = entity.GetComponent(); + comp.OnUpdate(); + } + } + } +} diff --git a/Content.Server/GameObjects/EntitySystems/PowerSystem.cs b/Content.Server/GameObjects/EntitySystems/PowerSystem.cs index 7de5fab966..51e187292e 100644 --- a/Content.Server/GameObjects/EntitySystems/PowerSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/PowerSystem.cs @@ -2,11 +2,8 @@ using SS14.Shared.GameObjects.System; using SS14.Shared.Interfaces.GameObjects; using SS14.Shared.IoC; -using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using SS14.Shared.GameObjects; namespace Content.Shared.GameObjects.EntitySystems { @@ -18,6 +15,11 @@ namespace Content.Shared.GameObjects.EntitySystems private int _lastUid = 0; + public PowerSystem() + { + EntityQuery = new TypeEntityQuery(typeof(PowerDeviceComponent)); + } + public override void Initialize() { base.Initialize(); @@ -61,8 +63,9 @@ namespace Content.Shared.GameObjects.EntitySystems } // Draw power for devices not connected to anything. - foreach (var device in componentManager.GetComponents()) + foreach (var entity in EntityManager.GetEntities(EntityQuery)) { + var device = entity.GetComponent(); device.ProcessInternalPower(frametime); } } diff --git a/Content.Server/GameObjects/EntitySystems/WelderSystem.cs b/Content.Server/GameObjects/EntitySystems/WelderSystem.cs new file mode 100644 index 0000000000..7dd9c57370 --- /dev/null +++ b/Content.Server/GameObjects/EntitySystems/WelderSystem.cs @@ -0,0 +1,23 @@ +using Content.Server.GameObjects.Components.Interactable.Tools; +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; + +namespace Content.Server.GameObjects.EntitySystems +{ + class WelderSystem : EntitySystem + { + public override void Initialize() + { + EntityQuery = new TypeEntityQuery(typeof(WelderComponent)); + } + + public override void Update(float frameTime) + { + foreach (var entity in RelevantEntities) + { + var comp = entity.GetComponent(); + comp.OnUpdate(frameTime); + } + } + } +} diff --git a/Content.Server/GameObjects/TemperatureSystem.cs b/Content.Server/GameObjects/TemperatureSystem.cs new file mode 100644 index 0000000000..6bd84c491e --- /dev/null +++ b/Content.Server/GameObjects/TemperatureSystem.cs @@ -0,0 +1,22 @@ +using SS14.Shared.GameObjects; +using SS14.Shared.GameObjects.System; + +namespace Content.Server.GameObjects +{ + class TemperatureSystem : EntitySystem + { + public override void Initialize() + { + EntityQuery = new TypeEntityQuery(typeof(TemperatureComponent)); + } + + public override void Update(float frameTime) + { + foreach (var entity in RelevantEntities) + { + var comp = entity.GetComponent(); + comp.OnUpdate(frameTime); + } + } + } +}