Fix Antimatter engine maths and overplacing (#2736)

* Antimatter engine parts can't be placed overlapping

* Antimatter engine stability maths fixed

* Antimatter engine: Clean up some unused stuff
This commit is contained in:
20kdc
2020-12-16 13:31:47 +00:00
committed by GitHub
parent 27d5019df0
commit 91f2f4f599
4 changed files with 51 additions and 18 deletions

View File

@@ -1,4 +1,5 @@
using System.Threading.Tasks;
using System.Linq;
using Content.Server.GameObjects.Components.Interactable;
using Content.Server.Interfaces.GameObjects.Components.Items;
using Content.Shared.GameObjects.Components.Interactable;
@@ -35,8 +36,12 @@ namespace Content.Server.GameObjects.Components.Power.AME
{
var mapGrid = _mapManager.GetGrid(args.ClickLocation.GetGridId(_serverEntityManager));
var tile = mapGrid.GetTileRef(args.ClickLocation);
var snapPos = mapGrid.SnapGridCellFor(args.ClickLocation, SnapGridOffset.Center);
if (mapGrid.GetSnapGridCell(snapPos, SnapGridOffset.Center).Any(sc => sc.Owner.HasComponent<AMEShieldComponent>()))
{
Owner.PopupMessage(args.User, Loc.GetString("Shielding is already there!"));
return true;
}
var ent = _serverEntityManager.SpawnEntity("AMEShielding", mapGrid.GridTileToLocal(snapPos));
ent.Transform.LocalRotation = Owner.Transform.LocalRotation;