Content changes for mapgrid kill (#12567)

This commit is contained in:
metalgearsloth
2022-11-22 13:12:04 +11:00
committed by GitHub
parent 9170e7ac9d
commit 6c76061887
75 changed files with 192 additions and 123 deletions

View File

@@ -6,6 +6,7 @@ using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
@@ -73,8 +74,7 @@ namespace Content.Server.Chemistry.Components
if (!_entities.TryGetComponent(xform.GridUid, out MapGridComponent? gridComp))
return;
var grid = gridComp.Grid;
var origin = grid.TileIndicesFor(xform.Coordinates);
var origin = gridComp.TileIndicesFor(xform.Coordinates);
DebugTools.Assert(xform.Anchored, "Area effect entity prototypes must be anchored.");
@@ -82,10 +82,10 @@ namespace Content.Server.Chemistry.Components
{
// Currently no support for spreading off or across grids.
var index = origin + dir.ToIntVec();
if (!grid.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
if (!gridComp.TryGetTileRef(index, out var tile) || tile.Tile.IsEmpty)
return;
foreach (var neighbor in grid.GetAnchoredEntities(index))
foreach (var neighbor in gridComp.GetAnchoredEntities(index))
{
if (_entities.TryGetComponent(neighbor,
out SolutionAreaEffectComponent? comp) && comp.Inception == Inception)
@@ -100,7 +100,7 @@ namespace Content.Server.Chemistry.Components
var newEffect = _entities.SpawnEntity(
meta.EntityPrototype.ID,
grid.GridTileToLocal(index));
gridComp.GridTileToLocal(index));
if (!_entities.TryGetComponent(newEffect, out SolutionAreaEffectComponent? effectComponent))
{