prevent rcd destroying planets (#16120)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-07-16 13:46:35 +00:00
committed by GitHub
parent 00528cced9
commit 5d5151c772
4 changed files with 28 additions and 5 deletions

View File

@@ -237,14 +237,25 @@ public sealed class RCDSystem : EntitySystem
if (tile.Tile.IsEmpty)
return false;
//They tried to decon a turf but the turf is blocked
if (target == null && IsTileBlocked(tile))
//They tried to decon a turf but...
if (target == null)
{
_popup.PopupClient(Loc.GetString("rcd-component-tile-obstructed-message"), uid, user);
return false;
// the turf is blocked
if (IsTileBlocked(tile))
{
_popup.PopupClient(Loc.GetString("rcd-component-tile-obstructed-message"), uid, user);
return false;
}
// the turf can't be destroyed (planet probably)
var tileDef = (ContentTileDefinition) _tileDefMan[tile.Tile.TypeId];
if (tileDef.Indestructible)
{
_popup.PopupClient(Loc.GetString("rcd-component-tile-indestructible-message"), uid, user);
return false;
}
}
//They tried to decon a non-turf but it's not in the whitelist
if (target != null && !_tag.HasTag(target.Value, "RCDDeconstructWhitelist"))
else if (!_tag.HasTag(target.Value, "RCDDeconstructWhitelist"))
{
_popup.PopupClient(Loc.GetString("rcd-component-deconstruct-target-not-on-whitelist-message"), uid, user);
return false;