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

@@ -75,6 +75,11 @@ namespace Content.Shared.Maps
/// </summary> /// </summary>
[DataField("weather")] public bool Weather = false; [DataField("weather")] public bool Weather = false;
/// <summary>
/// Is this tile immune to RCD deconstruct.
/// </summary>
[DataField("indestructible")] public bool Indestructible = false;
public void AssignTileId(ushort id) public void AssignTileId(ushort id)
{ {
TileId = id; TileId = id;

View File

@@ -237,14 +237,25 @@ public sealed class RCDSystem : EntitySystem
if (tile.Tile.IsEmpty) if (tile.Tile.IsEmpty)
return false; return false;
//They tried to decon a turf but the turf is blocked //They tried to decon a turf but...
if (target == null && IsTileBlocked(tile)) if (target == null)
{
// the turf is blocked
if (IsTileBlocked(tile))
{ {
_popup.PopupClient(Loc.GetString("rcd-component-tile-obstructed-message"), uid, user); _popup.PopupClient(Loc.GetString("rcd-component-tile-obstructed-message"), uid, user);
return false; 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 //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); _popup.PopupClient(Loc.GetString("rcd-component-deconstruct-target-not-on-whitelist-message"), uid, user);
return false; return false;

View File

@@ -11,6 +11,7 @@ rcd-component-change-mode = The RCD is now set to {$mode} mode.
rcd-component-no-ammo-message = The RCD is out of ammo! rcd-component-no-ammo-message = The RCD is out of ammo!
rcd-component-tile-obstructed-message = That tile is obstructed! rcd-component-tile-obstructed-message = That tile is obstructed!
rcd-component-tile-indestructible-message = That tile can't be destroyed!
rcd-component-deconstruct-target-not-on-whitelist-message = You can't deconstruct that! rcd-component-deconstruct-target-not-on-whitelist-message = You can't deconstruct that!
rcd-component-cannot-build-floor-tile-not-empty-message = You can only build a floor on space! rcd-component-cannot-build-floor-tile-not-empty-message = You can only build a floor on space!
rcd-component-cannot-build-wall-tile-not-empty-message = You cannot build a wall on space! rcd-component-cannot-build-wall-tile-not-empty-message = You cannot build a wall on space!

View File

@@ -8,6 +8,7 @@
collection: FootstepAsteroid collection: FootstepAsteroid
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
# Desert # Desert
- type: tile - type: tile
@@ -22,6 +23,7 @@
collection: FootstepAsteroid collection: FootstepAsteroid
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
- type: tile - type: tile
id: FloorLowDesert id: FloorLowDesert
@@ -35,6 +37,7 @@
collection: FootstepAsteroid collection: FootstepAsteroid
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
# Grass # Grass
- type: tile - type: tile
@@ -60,6 +63,7 @@
itemDrop: FloorTileItemGrass itemDrop: FloorTileItemGrass
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
# Lava # Lava
- type: tile - type: tile
@@ -72,6 +76,7 @@
collection: FootstepAsteroid collection: FootstepAsteroid
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
# Snow # Snow
- type: tile - type: tile
@@ -91,5 +96,6 @@
friction: 0.20 friction: 0.20
heatCapacity: 10000 heatCapacity: 10000
weather: true weather: true
indestructible: true
# Wasteland # Wasteland