Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiles can now be modified by arbitrary tool qualities #12738

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Content.IntegrationTests/Tests/EntityTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ await server.WaitPost(() =>

grid = mapManager.CreateGrid(mapId);

var tileDefinition = tileDefinitionManager["UnderPlating"];
var tileDefinition = tileDefinitionManager["Plating"];
var tile = new Tile(tileDefinition.TileId);
var coordinates = grid.ToCoordinates();

Expand Down Expand Up @@ -236,7 +236,7 @@ await server.WaitPost(() =>

grid = mapManager.CreateGrid(mapId);

var tileDefinition = tileDefinitionManager["UnderPlating"];
var tileDefinition = tileDefinitionManager["Plating"];
var tile = new Tile(tileDefinition.TileId);

grid.SetTile(Vector2i.Zero, tile);
Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/Fluids/PuddleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ await server.WaitPost(() =>
sGridId = sGrid.GridEntityId;
metaSystem.SetEntityPaused(sGridId, true); // See https://github.com/space-wizards/RobustToolbox/issues/1444

var tileDefinition = sTileDefinitionManager["UnderPlating"];
var tileDefinition = sTileDefinitionManager["Plating"];
var tile = new Tile(tileDefinition.TileId);
sCoordinates = sGrid.ToCoordinates();

Expand Down
2 changes: 1 addition & 1 deletion Content.IntegrationTests/Tests/PrototypeSaveTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ await server.WaitPost(() =>

grid = mapManager.CreateGrid(mapId);

var tileDefinition = tileDefinitionManager["UnderPlating"];
var tileDefinition = tileDefinitionManager["Plating"];
var tile = new Tile(tileDefinition.TileId);
var coordinates = grid.ToCoordinates();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ private void PryTile(MapGridComponent mapGrid, Vector2i tile)
if (!mapGrid.TryGetTileRef(tile, out var tileRef))
return;

tileRef.PryTile(_mapManager, _tileDefinitionManager, EntityManager, _robustRandom);
tileRef.TryDeconstructToSubFloor(_mapManager, _tileDefinitionManager, EntityManager, _robustRandom);
}
}
4 changes: 2 additions & 2 deletions Content.Server/Chemistry/TileReactions/PryTileReaction.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Content.Shared.Maps;
Expand All @@ -13,7 +13,7 @@ public sealed class PryTileReaction : ITileReaction
{
public FixedPoint2 TileReact(TileRef tile, ReagentPrototype reagent, FixedPoint2 reactVolume)
{
tile.PryTile();
tile.TryDeconstructToSubFloor();
return reactVolume;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -446,10 +446,10 @@ public void DamageFloorTile(TileRef tileRef,
effectiveIntensity -= type.TileBreakRerollReduction;

// does this have a base-turf that we can break it down to?
if (tileDef.BaseTurfs.Count == 0)
if (string.IsNullOrEmpty(tileDef.BaseTurf))
break;

if (_tileDefinitionManager[tileDef.BaseTurfs[^1]] is not ContentTileDefinition newDef)
if (_tileDefinitionManager[tileDef.BaseTurf] is not ContentTileDefinition newDef)
break;

if (newDef.IsSpace && !canCreateVacuum)
Expand Down
5 changes: 3 additions & 2 deletions Content.Server/Interaction/TilePryCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ public void Execute(IConsoleShell shell, string argStr, string[] args)
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
var tileDef = (ContentTileDefinition) tileDefinitionManager[tile.Tile.TypeId];

if (!tileDef.CanCrowbar) continue;
if (!tileDef.DeconstructToolQualities.Contains("Prying"))
continue;

var underplating = tileDefinitionManager["UnderPlating"];
var underplating = tileDefinitionManager["Plating"];
mapGrid.SetTile(coordinates, new Tile(underplating.TileId));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ private void OnDefileAction(EntityUid uid, RevenantComponent component, Revenant
{
if (!tiles.TryGetValue(i, out var value))
continue;
value.PryTile();
value.TryDeconstructToSubFloor();
}

var lookup = _lookup.GetEntitiesInRange(uid, component.DefileRadius, LookupFlags.Approximate | LookupFlags.Anchored);
Expand Down
8 changes: 1 addition & 7 deletions Content.Server/Tiles/FloorTileSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,7 @@ private void OnAfterInteract(EntityUid uid, FloorTileComponent component, AfterI

public bool HasBaseTurf(ContentTileDefinition tileDef, string baseTurf)
{
foreach (var tileBaseTurf in tileDef.BaseTurfs)
{
if (baseTurf == tileBaseTurf)
return true;
}

return false;
return tileDef.BaseTurf == baseTurf;
}

private void PlaceAt(MapGridComponent mapGrid, EntityCoordinates location, ushort tileId, SoundSpecifier placeSound, float offset = 0)
Expand Down
26 changes: 0 additions & 26 deletions Content.Server/Tools/Components/LatticeCuttingComponent.cs

This file was deleted.

24 changes: 0 additions & 24 deletions Content.Server/Tools/Components/TilePryingComponent.cs

This file was deleted.

22 changes: 22 additions & 0 deletions Content.Server/Tools/Components/ToolWorksWIthTilesComponent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System.Threading;
using Content.Shared.Tools;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;

namespace Content.Server.Tools.Components;

[RegisterComponent]
public sealed class ToolWorksWithTilesComponent : Component
{
[ViewVariables]
[DataField("requiresUnobstructed")]
public bool RequiresUnobstructed = false;

[ViewVariables]
[DataField("delay")]
public float Delay = 0.25f;

/// <summary>
/// Used for do_afters.
/// </summary>
public CancellationTokenSource? CancelTokenSource = null;
}
108 changes: 0 additions & 108 deletions Content.Server/Tools/ToolSystem.LatticeCutting.cs

This file was deleted.

Loading