Cleans up warnings in disposals (#17419)
This commit is contained in:
@@ -3,7 +3,10 @@ using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Disposal.Tube;
|
||||
using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.Disposal.Unit.Components;
|
||||
using Content.Shared.Body.Components;
|
||||
using Content.Shared.Item;
|
||||
using JetBrains.Annotations;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Physics.Systems;
|
||||
@@ -18,6 +21,50 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
[Dependency] private readonly DisposalTubeSystem _disposalTubeSystem = default!;
|
||||
[Dependency] private readonly AtmosphereSystem _atmosphereSystem = default!;
|
||||
[Dependency] private readonly SharedPhysicsSystem _physicsSystem = default!;
|
||||
[Dependency] private readonly SharedContainerSystem _containerSystem = default!;
|
||||
[Dependency] private readonly SharedTransformSystem _xformSystem = default!;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
|
||||
SubscribeLocalEvent<DisposalHolderComponent, ComponentStartup>(OnComponentStartup);
|
||||
}
|
||||
|
||||
private void OnComponentStartup(EntityUid uid, DisposalHolderComponent holder, ComponentStartup args)
|
||||
{
|
||||
holder.Container = _containerSystem.EnsureContainer<Container>(uid, nameof(DisposalHolderComponent));
|
||||
}
|
||||
|
||||
public bool TryInsert(EntityUid uid, EntityUid toInsert, DisposalHolderComponent? holder = null)
|
||||
{
|
||||
if (!Resolve(uid, ref holder))
|
||||
return false;
|
||||
if (!CanInsert(uid, toInsert, holder))
|
||||
return false;
|
||||
|
||||
if (!holder.Container.Insert(toInsert, EntityManager))
|
||||
return false;
|
||||
|
||||
if (TryComp<PhysicsComponent>(toInsert, out var physBody))
|
||||
_physicsSystem.SetCanCollide(toInsert, false, body: physBody);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool CanInsert(EntityUid uid, EntityUid toInsert, DisposalHolderComponent? holder = null)
|
||||
{
|
||||
if (!Resolve(uid, ref holder))
|
||||
return false;
|
||||
|
||||
if (!holder.Container.CanInsert(toInsert))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return HasComp<ItemComponent>(toInsert) ||
|
||||
HasComp<BodyComponent>(toInsert);
|
||||
}
|
||||
|
||||
public void ExitDisposals(EntityUid uid, DisposalHolderComponent? holder = null, TransformComponent? holderTransform = null)
|
||||
{
|
||||
@@ -28,7 +75,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return;
|
||||
if (holder.IsExitingDisposals)
|
||||
{
|
||||
Logger.ErrorS("c.s.disposal.holder", "Tried exiting disposals twice. This should never happen.");
|
||||
Log.Error("Tried exiting disposals twice. This should never happen.");
|
||||
return;
|
||||
}
|
||||
holder.IsExitingDisposals = true;
|
||||
@@ -65,7 +112,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
if (duc != null)
|
||||
duc.Container.Insert(entity, EntityManager, xform, meta: meta);
|
||||
else
|
||||
xform.AttachToGridOrMap();
|
||||
_xformSystem.AttachToGridOrMap(entity, xform);
|
||||
|
||||
if (EntityManager.TryGetComponent(entity, out PhysicsComponent? physics))
|
||||
{
|
||||
@@ -78,7 +125,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
_disposalUnitSystem.TryEjectContents(disposalId.Value, duc);
|
||||
}
|
||||
|
||||
if (_atmosphereSystem.GetContainingMixture(uid, false, true) is {} environment)
|
||||
if (_atmosphereSystem.GetContainingMixture(uid, false, true) is { } environment)
|
||||
{
|
||||
_atmosphereSystem.Merge(environment, holder.Air);
|
||||
holder.Air.Clear();
|
||||
@@ -94,7 +141,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return false;
|
||||
if (holder.IsExitingDisposals)
|
||||
{
|
||||
Logger.ErrorS("c.s.disposal.holder", "Tried entering tube after exiting disposals. This should never happen.");
|
||||
Log.Error("Tried entering tube after exiting disposals. This should never happen.");
|
||||
return false;
|
||||
}
|
||||
if (!Resolve(toUid, ref to, ref toTransform))
|
||||
@@ -106,11 +153,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
foreach (var ent in holder.Container.ContainedEntities)
|
||||
{
|
||||
var comp = EnsureComp<BeingDisposedComponent>(ent);
|
||||
comp.Holder = holder.Owner;
|
||||
comp.Holder = holderUid;
|
||||
}
|
||||
|
||||
// Insert into next tube
|
||||
if (!to.Contents.Insert(holder.Owner))
|
||||
if (!to.Contents.Insert(holderUid))
|
||||
{
|
||||
ExitDisposals(holderUid, holder, holderTransform);
|
||||
return false;
|
||||
@@ -121,7 +168,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
holder.PreviousTube = holder.CurrentTube;
|
||||
holder.PreviousDirection = holder.CurrentDirection;
|
||||
}
|
||||
holder.CurrentTube = to;
|
||||
holder.CurrentTube = toUid;
|
||||
var ev = new GetDisposalsNextDirectionEvent(holder);
|
||||
RaiseLocalEvent(toUid, ref ev);
|
||||
holder.CurrentDirection = ev.Next;
|
||||
@@ -140,13 +187,14 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
foreach (var comp in EntityManager.EntityQuery<DisposalHolderComponent>())
|
||||
var query = EntityQueryEnumerator<DisposalHolderComponent>();
|
||||
while (query.MoveNext(out var uid, out var holder))
|
||||
{
|
||||
UpdateComp(comp, frameTime);
|
||||
UpdateComp(uid, holder, frameTime);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateComp(DisposalHolderComponent holder, float frameTime)
|
||||
private void UpdateComp(EntityUid uid, DisposalHolderComponent holder, float frameTime)
|
||||
{
|
||||
while (frameTime > 0)
|
||||
{
|
||||
@@ -159,40 +207,39 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
holder.TimeLeft -= time;
|
||||
frameTime -= time;
|
||||
|
||||
var currentTube = holder.CurrentTube;
|
||||
if (currentTube == null || currentTube.Deleted)
|
||||
if (!EntityManager.EntityExists(holder.CurrentTube))
|
||||
{
|
||||
ExitDisposals((holder).Owner);
|
||||
ExitDisposals(uid, holder);
|
||||
break;
|
||||
}
|
||||
|
||||
var currentTube = holder.CurrentTube!.Value;
|
||||
if (holder.TimeLeft > 0)
|
||||
{
|
||||
var progress = 1 - holder.TimeLeft / holder.StartingTime;
|
||||
var origin = EntityManager.GetComponent<TransformComponent>(currentTube.Owner).Coordinates;
|
||||
var origin = Transform(currentTube).Coordinates;
|
||||
var destination = holder.CurrentDirection.ToVec();
|
||||
var newPosition = destination * progress;
|
||||
|
||||
// This is some supreme shit code.
|
||||
EntityManager.GetComponent<TransformComponent>(holder.Owner).Coordinates = origin.Offset(newPosition).WithEntityId(currentTube.Owner);
|
||||
|
||||
_xformSystem.SetCoordinates(uid, origin.Offset(newPosition).WithEntityId(currentTube));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Past this point, we are performing inter-tube transfer!
|
||||
// Remove current tube content
|
||||
currentTube.Contents.Remove(holder.Owner, reparent: false, force: true);
|
||||
Comp<DisposalTubeComponent>(currentTube).Contents.Remove(uid, reparent: false, force: true);
|
||||
|
||||
// Find next tube
|
||||
var nextTube = _disposalTubeSystem.NextTubeFor(currentTube.Owner, holder.CurrentDirection);
|
||||
if (nextTube == null || nextTube.Deleted)
|
||||
var nextTube = _disposalTubeSystem.NextTubeFor(currentTube, holder.CurrentDirection);
|
||||
if (!EntityManager.EntityExists(nextTube))
|
||||
{
|
||||
ExitDisposals((holder).Owner);
|
||||
ExitDisposals(uid, holder);
|
||||
break;
|
||||
}
|
||||
|
||||
// Perform remainder of entry process
|
||||
if (!EnterTube((holder).Owner, nextTube.Owner, holder))
|
||||
if (!EnterTube(uid, nextTube!.Value, holder))
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using Content.Server.Administration.Logs;
|
||||
using Content.Server.Atmos.EntitySystems;
|
||||
using Content.Server.Disposal.Tube;
|
||||
using Content.Server.Disposal.Tube.Components;
|
||||
using Content.Server.Disposal.Unit.Components;
|
||||
using Content.Server.Popups;
|
||||
@@ -29,6 +30,7 @@ using Robust.Shared.Containers;
|
||||
using Robust.Shared.Map.Components;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
@@ -48,6 +50,9 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
[Dependency] private readonly TransformSystem _transformSystem = default!;
|
||||
[Dependency] private readonly UserInterfaceSystem _ui = default!;
|
||||
[Dependency] private readonly PowerReceiverSystem _power = default!;
|
||||
[Dependency] private readonly DisposalTubeSystem _disposalTubeSystem = default!;
|
||||
[Dependency] private readonly IGameTiming _gameTiming = default!;
|
||||
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
@@ -92,11 +97,13 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
if (component.Container.ContainedEntities.Count > 0)
|
||||
{
|
||||
// Verbs to flush the unit
|
||||
AlternativeVerb flushVerb = new();
|
||||
flushVerb.Act = () => Engage(uid, component);
|
||||
flushVerb.Text = Loc.GetString("disposal-flush-verb-get-data-text");
|
||||
flushVerb.Icon = new SpriteSpecifier.Texture(new ("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png"));
|
||||
flushVerb.Priority = 1;
|
||||
AlternativeVerb flushVerb = new()
|
||||
{
|
||||
Act = () => Engage(uid, component),
|
||||
Text = Loc.GetString("disposal-flush-verb-get-data-text"),
|
||||
Icon = new SpriteSpecifier.Texture(new("/Textures/Interface/VerbIcons/delete_transparent.svg.192dpi.png")),
|
||||
Priority = 1,
|
||||
};
|
||||
args.Verbs.Add(flushVerb);
|
||||
|
||||
// Verb to eject the contents
|
||||
@@ -143,7 +150,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
if (!_actionBlockerSystem.CanDrop(args.User))
|
||||
return;
|
||||
|
||||
if (!CanInsert(component, args.Using.Value))
|
||||
if (!CanInsert(uid, component, args.Using.Value))
|
||||
return;
|
||||
|
||||
InteractionVerb insertVerb = new()
|
||||
@@ -186,10 +193,11 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
base.Update(frameTime);
|
||||
foreach (var (_, comp) in EntityQuery<ActiveDisposalUnitComponent, DisposalUnitComponent>())
|
||||
|
||||
var query = EntityQueryEnumerator<ActiveDisposalUnitComponent, DisposalUnitComponent>();
|
||||
while (query.MoveNext(out var uid, out var _, out var unit))
|
||||
{
|
||||
var uid = comp.Owner;
|
||||
if (!Update(uid, comp, frameTime))
|
||||
if (!Update(uid, unit, frameTime))
|
||||
continue;
|
||||
|
||||
RemComp<ActiveDisposalUnitComponent>(uid);
|
||||
@@ -199,7 +207,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
#region UI Handlers
|
||||
private void OnUiButtonPressed(EntityUid uid, DisposalUnitComponent component, SharedDisposalUnitComponent.UiButtonPressedMessage args)
|
||||
{
|
||||
if (args.Session.AttachedEntity is not {Valid: true} player)
|
||||
if (args.Session.AttachedEntity is not { Valid: true } player)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -218,7 +226,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
_power.TogglePower(uid, user: args.Session.AttachedEntity);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
throw new ArgumentOutOfRangeException($"{ToPrettyString(player):player} attempted to hit a nonexistant button on {ToPrettyString(uid)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,7 +267,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CanInsert(component, args.Used) || !_handsSystem.TryDropIntoContainer(args.User, args.Used, component.Container))
|
||||
if (!CanInsert(uid, component, args.Used) || !_handsSystem.TryDropIntoContainer(args.User, args.Used, component.Container))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -274,7 +282,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
/// </summary>
|
||||
private void HandleThrowCollide(EntityUid uid, DisposalUnitComponent component, ThrowHitByEvent args)
|
||||
{
|
||||
if (!CanInsert(component, args.Thrown) ||
|
||||
if (!CanInsert(uid, component, args.Thrown) ||
|
||||
_robustRandom.NextDouble() > 0.75 ||
|
||||
!component.Container.Insert(args.Thrown))
|
||||
{
|
||||
@@ -295,7 +303,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
if (!HasComp<AnchorableComponent>(uid))
|
||||
{
|
||||
Logger.WarningS("VitalComponentMissing", $"Disposal unit {uid} is missing an {nameof(AnchorableComponent)}");
|
||||
Log.Warning($"Disposal unit {uid} is missing an {nameof(AnchorableComponent)}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -307,8 +315,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
}
|
||||
|
||||
_ui.TryCloseAll(uid, SharedDisposalUnitComponent.DisposalUnitUiKey.Key);
|
||||
component.AutomaticEngageToken?.Cancel();
|
||||
component.AutomaticEngageToken = null;
|
||||
component.NextFlush = TimeSpan.MaxValue;
|
||||
|
||||
component.Container = null!;
|
||||
RemComp<ActiveDisposalUnitComponent>(uid);
|
||||
@@ -324,11 +331,10 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
// TODO: Need to check the other stuff.
|
||||
if (!args.Powered)
|
||||
{
|
||||
component.AutomaticEngageToken?.Cancel();
|
||||
component.AutomaticEngageToken = null;
|
||||
component.NextFlush = TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
HandleStateChange(uid, component, args.Powered && component.State == SharedDisposalUnitComponent.PressureState.Pressurizing);
|
||||
HandleStateChange(uid, component, args.Powered && (component.State == SharedDisposalUnitComponent.PressureState.Pressurizing || component.NextFlush != TimeSpan.MaxValue));
|
||||
UpdateVisualState(uid, component);
|
||||
UpdateInterface(uid, component, args.Powered);
|
||||
|
||||
@@ -341,7 +347,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
/// <summary>
|
||||
/// Add or remove this disposal from the active ones for updating.
|
||||
/// </summary>
|
||||
public void HandleStateChange(EntityUid uid, DisposalUnitComponent component, bool active)
|
||||
public void HandleStateChange(EntityUid uid, DisposalUnitComponent _, bool active)
|
||||
{
|
||||
if (active)
|
||||
{
|
||||
@@ -416,20 +422,27 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
if (component.State == SharedDisposalUnitComponent.PressureState.Pressurizing)
|
||||
{
|
||||
var oldTimeElapsed = oldPressure / PressurePerSecond;
|
||||
if (oldTimeElapsed < component.FlushTime && (oldTimeElapsed + frameTime) >= component.FlushTime)
|
||||
if (oldTimeElapsed < component.FlushTime && oldTimeElapsed + frameTime >= component.FlushTime)
|
||||
{
|
||||
// We've crossed over the amount of time it takes to flush. This will switch the
|
||||
// visuals over to a 'Charging' state.
|
||||
UpdateVisualState(uid, component);
|
||||
}
|
||||
}
|
||||
else if (component.State == SharedDisposalUnitComponent.PressureState.Ready && component.NextFlush < _gameTiming.CurTime)
|
||||
{
|
||||
if (!TryFlush(uid, component) && component.AutoFlushing)
|
||||
TryQueueEngage(uid, component);
|
||||
else
|
||||
component.AutoFlushing = false;
|
||||
}
|
||||
|
||||
Box2? disposalsBounds = null;
|
||||
var count = component.RecentlyEjected.Count;
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (!TryComp(uid, out PhysicsComponent? disposalsBody))
|
||||
if (!HasComp<PhysicsComponent>(uid))
|
||||
{
|
||||
component.RecentlyEjected.Clear();
|
||||
}
|
||||
@@ -442,8 +455,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
for (var i = component.RecentlyEjected.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var ejectedId = component.RecentlyEjected[i];
|
||||
if (Exists(ejectedId) &&
|
||||
TryComp(ejectedId, out PhysicsComponent? body))
|
||||
if (HasComp<PhysicsComponent>(ejectedId))
|
||||
{
|
||||
// TODO: We need to use a specific collision method (which sloth hasn't coded yet) for actual bounds overlaps.
|
||||
// TODO: Come do this sloth :^)
|
||||
@@ -460,7 +472,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
if (count != component.RecentlyEjected.Count)
|
||||
Dirty(component);
|
||||
|
||||
return state == SharedDisposalUnitComponent.PressureState.Ready && component.RecentlyEjected.Count == 0;
|
||||
return state == SharedDisposalUnitComponent.PressureState.Ready && component.NextFlush == TimeSpan.MaxValue && component.RecentlyEjected.Count == 0;
|
||||
}
|
||||
|
||||
public bool TryInsert(EntityUid unitId, EntityUid toInsertId, EntityUid? userId, DisposalUnitComponent? unit = null)
|
||||
@@ -474,7 +486,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CanInsert(unit, toInsertId))
|
||||
if (!CanInsert(unitId, unit, toInsertId))
|
||||
return false;
|
||||
|
||||
var delay = userId == toInsertId ? unit.EntryDelay : unit.DraggedEntryDelay;
|
||||
@@ -507,6 +519,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return false;
|
||||
}
|
||||
|
||||
component.NextFlush = TimeSpan.MaxValue;
|
||||
|
||||
//Allows the MailingUnitSystem to add tags or prevent flushing
|
||||
var beforeFlushArgs = new BeforeDisposalFlushEvent();
|
||||
RaiseLocalEvent(uid, beforeFlushArgs);
|
||||
@@ -534,17 +548,16 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
var entryComponent = Comp<DisposalEntryComponent>(entry);
|
||||
var indices = _transformSystem.GetGridOrMapTilePosition(uid, xform);
|
||||
|
||||
if (_atmosSystem.GetTileMixture(xform.GridUid, xform.MapUid, indices, true) is {Temperature: > 0} environment)
|
||||
if (_atmosSystem.GetTileMixture(xform.GridUid, xform.MapUid, indices, true) is { Temperature: > 0f } environment)
|
||||
{
|
||||
var transferMoles = 0.1f * (0.25f * Atmospherics.OneAtmosphere * 1.01f - air.Pressure) * air.Volume / (environment.Temperature * Atmospherics.R);
|
||||
|
||||
component.Air = environment.Remove(transferMoles);
|
||||
}
|
||||
|
||||
entryComponent.TryInsert(component, beforeFlushArgs.Tags);
|
||||
_disposalTubeSystem.TryInsert(entry, component, beforeFlushArgs.Tags);
|
||||
|
||||
component.AutomaticEngageToken?.Cancel();
|
||||
component.AutomaticEngageToken = null;
|
||||
component.NextFlush = TimeSpan.MaxValue;
|
||||
|
||||
if (!component.DisablePressure)
|
||||
{
|
||||
@@ -642,8 +655,7 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
if (component.Container.ContainedEntities.Count == 0)
|
||||
{
|
||||
component.AutomaticEngageToken?.Cancel();
|
||||
component.AutomaticEngageToken = null;
|
||||
component.NextFlush = TimeSpan.MaxValue;
|
||||
}
|
||||
|
||||
if (!component.RecentlyEjected.Contains(toRemove))
|
||||
@@ -669,7 +681,8 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
|
||||
if (CanFlush(uid, component))
|
||||
{
|
||||
uid.SpawnTimer(component.FlushDelay, () => TryFlush(uid, component));
|
||||
component.NextFlush = _gameTiming.CurTime + component.FlushDelay;
|
||||
EnsureComp<ActiveDisposalUnitComponent>(uid);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -691,9 +704,9 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
}
|
||||
}
|
||||
|
||||
public override bool CanInsert(SharedDisposalUnitComponent component, EntityUid entity)
|
||||
public override bool CanInsert(EntityUid uid, SharedDisposalUnitComponent component, EntityUid entity)
|
||||
{
|
||||
if (!base.CanInsert(component, entity) || component is not DisposalUnitComponent serverComp)
|
||||
if (!base.CanInsert(uid, component, entity) || component is not DisposalUnitComponent serverComp)
|
||||
return false;
|
||||
|
||||
return serverComp.Container.CanInsert(entity);
|
||||
@@ -709,15 +722,10 @@ namespace Content.Server.Disposal.Unit.EntitySystems
|
||||
return;
|
||||
}
|
||||
|
||||
component.AutomaticEngageToken = new CancellationTokenSource();
|
||||
component.NextFlush = _gameTiming.CurTime + component.AutomaticEngageTime;
|
||||
component.AutoFlushing = true;
|
||||
|
||||
uid.SpawnTimer(component.AutomaticEngageTime, () =>
|
||||
{
|
||||
if (!TryFlush(uid, component))
|
||||
{
|
||||
TryQueueEngage(uid, component);
|
||||
}
|
||||
}, component.AutomaticEngageToken.Token);
|
||||
EnsureComp<ActiveDisposalUnitComponent>(uid);
|
||||
}
|
||||
|
||||
public void AfterInsert(EntityUid uid, DisposalUnitComponent component, EntityUid inserted, EntityUid? user = null)
|
||||
|
||||
Reference in New Issue
Block a user