Allow protected grids to be repaired (#36989)
* Allow protected grids to be repaired * Probably implement it --------- Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -126,14 +126,14 @@ public sealed class FloorTileSystem : EntitySystem
|
||||
if (mapGrid != null)
|
||||
{
|
||||
var gridUid = location.EntityId;
|
||||
var tile = _map.GetTileRef(gridUid, mapGrid, location);
|
||||
|
||||
if (!CanPlaceTile(gridUid, mapGrid, out var reason))
|
||||
if (!CanPlaceTile(gridUid, mapGrid, tile.GridIndices, out var reason))
|
||||
{
|
||||
_popup.PopupClient(reason, args.User, args.User);
|
||||
return;
|
||||
}
|
||||
|
||||
var tile = _map.GetTileRef(gridUid, mapGrid, location);
|
||||
var baseTurf = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
|
||||
|
||||
if (HasBaseTurf(currentTileDefinition, baseTurf.ID))
|
||||
@@ -182,12 +182,12 @@ public sealed class FloorTileSystem : EntitySystem
|
||||
_audio.PlayPredicted(placeSound, location, user);
|
||||
}
|
||||
|
||||
public bool CanPlaceTile(EntityUid gridUid, MapGridComponent component, [NotNullWhen(false)] out string? reason)
|
||||
public bool CanPlaceTile(EntityUid gridUid, MapGridComponent component, Vector2i gridIndices, [NotNullWhen(false)] out string? reason)
|
||||
{
|
||||
var ev = new FloorTileAttemptEvent();
|
||||
var ev = new FloorTileAttemptEvent(gridIndices);
|
||||
RaiseLocalEvent(gridUid, ref ev);
|
||||
|
||||
if (HasComp<ProtectedGridComponent>(gridUid) || ev.Cancelled)
|
||||
if (ev.Cancelled)
|
||||
{
|
||||
reason = Loc.GetString("invalid-floor-placement");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user