Refactor disposals to ECS (#4418)

* ECS up disposals

Also significantly reduced its CPU usage.

* Make update significantly less S L O W

* Start units pressurised

* Client-side flush lerping

* Fix powered not toggling UI

* Fix flush button

* InteractUsing

* Minor optimisations

* Fix collisions

* Make visual state ECS

* Almost done with shared

* Most stuff moved

* Optimise item sleeping
This commit is contained in:
metalgearsloth
2021-08-12 13:40:38 +10:00
committed by GitHub
parent b17555903f
commit 4da74d0ee4
21 changed files with 756 additions and 1856 deletions

View File

@@ -3,7 +3,7 @@ using System.Linq;
using System.Threading.Tasks;
using Content.Server.Disposal.Tube.Components;
using Content.Server.Disposal.Unit.Components;
using Content.Server.GameObjects.Components;
using Content.Server.Disposal.Unit.EntitySystems;
using Content.Server.Power.Components;
using NUnit.Framework;
using Robust.Shared.GameObjects;
@@ -24,7 +24,7 @@ namespace Content.IntegrationTests.Tests.Disposal
foreach (var entity in entities)
{
var insertTask = unit.TryInsert(entity);
Assert.That(unit.CanInsert(entity), Is.EqualTo(result));
Assert.That(EntitySystem.Get<DisposalUnitSystem>().CanInsert(unit, entity), Is.EqualTo(result));
insertTask.ContinueWith(task =>
{
Assert.That(task.Result, Is.EqualTo(result));
@@ -56,7 +56,7 @@ namespace Content.IntegrationTests.Tests.Disposal
Assert.That(unit.ContainedEntities, Is.SupersetOf(entities));
Assert.That(entities.Length, Is.EqualTo(unit.ContainedEntities.Count));
Assert.That(result, Is.EqualTo(unit.TryFlush()));
Assert.That(result, Is.EqualTo(EntitySystem.Get<DisposalUnitSystem>().TryFlush(unit)));
Assert.That(result || entities.Length == 0, Is.EqualTo(unit.ContainedEntities.Count == 0));
}
@@ -127,7 +127,7 @@ namespace Content.IntegrationTests.Tests.Disposal
// Can't insert, unanchored and unpowered
var physics = disposalUnit.GetComponent<IPhysBody>();
physics.BodyType = BodyType.Dynamic;
Assert.False(unit.Anchored);
Assert.False(unit.Owner.Transform.Anchored);
UnitInsertContains(unit, false, human, wrench, disposalUnit, disposalTrunk);
// Anchor the disposal unit