Make disposal units also flush air (#2686)
* Make disposal units also flush air * Make disposals use tile.AssumeAir instead of tile.Air.Merge Co-authored-by: Vera Aguilera Puerto <6766154+Zumorica@users.noreply.github.com>
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Random;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
@@ -20,16 +18,19 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
|
||||
public override string Name => "DisposalEntry";
|
||||
|
||||
public bool TryInsert(IReadOnlyCollection<IEntity> entities)
|
||||
public bool TryInsert(DisposalUnitComponent from)
|
||||
{
|
||||
var holder = Owner.EntityManager.SpawnEntity(HolderPrototypeId, Owner.Transform.MapPosition);
|
||||
var holderComponent = holder.GetComponent<DisposalHolderComponent>();
|
||||
|
||||
foreach (var entity in entities)
|
||||
foreach (var entity in from.ContainedEntities)
|
||||
{
|
||||
holderComponent.TryInsert(entity);
|
||||
}
|
||||
|
||||
holderComponent.Air.Merge(from.Air);
|
||||
from.Air.Clear();
|
||||
|
||||
return TryInsert(holderComponent);
|
||||
}
|
||||
|
||||
@@ -57,10 +58,10 @@ namespace Content.Server.GameObjects.Components.Disposal
|
||||
{
|
||||
if (holder.PreviousTube != null && DirectionTo(holder.PreviousTube) == ConnectableDirections()[0])
|
||||
{
|
||||
var invalidDirections = new Direction[] { ConnectableDirections()[0], Direction.Invalid };
|
||||
var invalidDirections = new[] { ConnectableDirections()[0], Direction.Invalid };
|
||||
var directions = Enum.GetValues(typeof(Direction))
|
||||
.Cast<Direction>().Except(invalidDirections).ToList();
|
||||
return _random.Pick<Direction>(directions);
|
||||
return _random.Pick(directions);
|
||||
}
|
||||
|
||||
return ConnectableDirections()[0];
|
||||
|
||||
Reference in New Issue
Block a user