Revert "Nyano port of digging (#400)" (#1452)

This reverts commit 089398d2
This commit is contained in:
Null
2024-07-01 21:57:16 +00:00
committed by GitHub
parent 46d6c80e95
commit ee4dd88a53
30 changed files with 3 additions and 370 deletions
@@ -1,102 +0,0 @@
using Content.Shared.Interaction;
using Content.Shared.Maps;
using Content.Shared.Nyanotrasen.Digging;
using Content.Shared.Physics;
using Content.Shared.Tools.Components;
using Content.Shared.Tools.Systems;
using Robust.Shared.Map;
using Robust.Shared.Map.Components;
namespace Content.Server.Digging;
public sealed class DiggingSystem : EntitySystem
{
[Dependency] private readonly TileSystem _tiles = default!;
[Dependency] private readonly SharedMapSystem _maps = default!;
[Dependency] private readonly SharedToolSystem _tools = default!;
[Dependency] private readonly TurfSystem _turfs = default!;
[Dependency] private readonly ITileDefinitionManager _tileDefManager = default!;
[Dependency] private readonly SharedInteractionSystem _interactionSystem = default!;
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<EarthDiggingComponent, AfterInteractEvent>(OnDiggingAfterInteract);
SubscribeLocalEvent<EarthDiggingComponent, EarthDiggingDoAfterEvent>(OnEarthDigComplete);
}
private void OnEarthDigComplete(EntityUid shovel, EarthDiggingComponent comp, EarthDiggingDoAfterEvent args)
{
var coordinates = GetCoordinates(args.Coordinates);
if (!TryComp<EarthDiggingComponent>(shovel, out var _))
return;
var gridUid = coordinates.GetGridUid(EntityManager);
if (gridUid == null)
return;
var grid = Comp<MapGridComponent>(gridUid.Value);
var tile = _maps.GetTileRef(gridUid.Value, grid, coordinates);
if (_tileDefManager[tile.Tile.TypeId] is not ContentTileDefinition tileDef
|| !tileDef.CanShovel
|| string.IsNullOrEmpty(tileDef.BaseTurf)
|| _turfs.IsTileBlocked(tile, CollisionGroup.MobMask))
{
return;
}
_tiles.DigTile(tile);
}
private void OnDiggingAfterInteract(EntityUid uid, EarthDiggingComponent component,
AfterInteractEvent args)
{
if (args.Handled || !args.CanReach || args.Target != null)
return;
if (TryDig(args.User, uid, component, args.ClickLocation))
args.Handled = true;
}
private bool TryDig(EntityUid user, EntityUid shovel, EarthDiggingComponent component,
EntityCoordinates clickLocation)
{
ToolComponent? tool = null;
if (component.ToolComponentNeeded && !TryComp(shovel, out tool))
return false;
var mapUid = clickLocation.GetGridUid(EntityManager);
if (mapUid == null || !TryComp(mapUid, out MapGridComponent? mapGrid))
return false;
var tile = _maps.GetTileRef(mapUid.Value, mapGrid, clickLocation);
var coordinates = _maps.GridTileToLocal(mapUid.Value, mapGrid, tile.GridIndices);
if (!_interactionSystem.InRangeUnobstructed(user, coordinates, popup: false))
return false;
if (_tileDefManager[tile.Tile.TypeId] is not ContentTileDefinition tileDef
|| !tileDef.CanShovel
|| string.IsNullOrEmpty(tileDef.BaseTurf)
|| _tileDefManager[tileDef.BaseTurf] is not ContentTileDefinition
|| _turfs.IsTileBlocked(tile, CollisionGroup.MobMask))
{
return false;
}
var ev = new EarthDiggingDoAfterEvent(GetNetCoordinates(clickLocation));
return _tools.UseTool(
shovel,
user,
target: shovel,
doAfterDelay: component.Delay,
toolQualitiesNeeded: new[] { component.QualityNeeded },
doAfterEv: ev,
toolComponent: tool
);
}
}
@@ -45,10 +45,6 @@ namespace Content.Shared.Maps
[DataField]
public PrototypeFlags<ToolQualityPrototype> DeconstructTools { get; set; } = new();
// Delta V
[DataField("canShovel")] public bool CanShovel { get; private set; }
//Delta V
/// <remarks>
/// Legacy AF but nice to have.
/// </remarks>
-15
View File
@@ -104,22 +104,7 @@ public sealed class TileSystem : EntitySystem
return DeconstructTile(tileRef);
}
// Delta V
public bool DigTile(TileRef tileRef)
{
var tile = tileRef.Tile;
if (tile.IsEmpty)
return false;
var tileDef = (ContentTileDefinition) _tileDefinitionManager[tile.TypeId];
if (!tileDef.CanShovel)
return false;
return DeconstructTile(tileRef);
}
// Delta V
public bool ReplaceTile(TileRef tileref, ContentTileDefinition replacementTile)
{
if (!TryComp<MapGridComponent>(tileref.GridUid, out var grid))
@@ -1,29 +0,0 @@
using Content.Shared.DoAfter;
using Robust.Shared.Map;
using Robust.Shared.Serialization;
namespace Content.Shared.Nyanotrasen.Digging;
[Serializable, NetSerializable]
public sealed partial class EarthDiggingDoAfterEvent : DoAfterEvent
{
public NetCoordinates Coordinates { get; set; }
private EarthDiggingDoAfterEvent(){}
public EarthDiggingDoAfterEvent(NetCoordinates coordinates)
{
Coordinates = coordinates;
}
public override DoAfterEvent Clone()
{
return this;
}
}
[Serializable, NetSerializable]
public sealed class EarthDiggingCancelledEvent : EntityEventArgs
{
public NetEntity Shovel;
}
@@ -1,22 +0,0 @@
using System.Threading;
using Content.Shared.Tools;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
namespace Content.Shared.Nyanotrasen.Digging;
[RegisterComponent]
public sealed partial class EarthDiggingComponent : Component
{
[ViewVariables]
[DataField("toolComponentNeeded")]
public bool ToolComponentNeeded = true;
[ViewVariables]
[DataField("qualityNeeded", customTypeSerializer:typeof(PrototypeIdSerializer<ToolQualityPrototype>))]
public string QualityNeeded = "Digging";
[ViewVariables]
[DataField("delay")]
public float Delay = 2f;
}
@@ -1,4 +0,0 @@
- files: ["shovel_dig.ogg"]
license: "CC-BY-3.0"
copyright: "https://freesound.org/people/cameronmusic/"
source: "https://freesound.org/people/cameronmusic/sounds/138411/"
Binary file not shown.
@@ -562,13 +562,6 @@
Wood: 50
- type: StaticPrice
price: 25
# Delta V: Adds tool quality for digging
- type: Tool
qualities:
- Digging
useSound:
path: /Audio/Nyanotrasen/Items/shovel_dig.ogg
- type: EarthDigging
- type: Shovel
- type: entity
@@ -1,63 +0,0 @@
- type: entity
name: dark grass tile
parent: FloorTileItemBase
id: FloorTileItemGrassDark
components:
- type: Sprite
sprite: /Textures/Nyanotrasen/Objects/Tiles/tiles.rsi
state: grassdark
- type: Item
heldPrefix: grassdark
- type: FloorTile
outputs:
- FloorGrassDark
- type: Stack
stackType: FloorTileGrassDark
- type: entity
name: light grass tile
parent: FloorTileItemBase
id: FloorTileItemGrassLight
components:
- type: Sprite
sprite: /Textures/Nyanotrasen/Objects/Tiles/tiles.rsi
state: grasslight
- type: Item
heldPrefix: grasslight
- type: FloorTile
outputs:
- FloorGrassLight
- type: Stack
stackType: FloorTileGrassLight
- type: entity
name: dirt tile
parent: FloorTileItemBase
id: FloorTileItemDirt
components:
- type: Sprite
sprite: /Textures/Nyanotrasen/Objects/Tiles/tiles.rsi
state: dirt
- type: Item
heldPrefix: dirt
- type: FloorTile
outputs:
- FloorDirt
- type: Stack
stackType: FloorTileDirt
- type: entity
name: bedrock tile
parent: FloorTileItemBase
id: FloorTileItemBedrock
components:
- type: Sprite
sprite: /Textures/Nyanotrasen/Objects/Tiles/tiles.rsi
state: bedrock
- type: Item
heldPrefix: bedrock
- type: FloorTile
outputs:
- FloorBedrock
- type: Stack
stackType: FloorTileBedrock
@@ -1,23 +0,0 @@
- type: stack
id: FloorTileGrassDark
name: dark grass floor tile
spawn: FloorTileItemGrassDark
maxCount: 30
- type: stack
id: FloorTileGrassLight
name: light grass floor tile
spawn: FloorTileItemGrassLight
maxCount: 30
- type: stack
id: FloorTileDirt
name: dirt floor tile
spawn: FloorTileItemDirt
maxCount: 30
- type: stack
id: FloorTileBedrock
name: bedrock floor tile
spawn: FloorTileItemBedrock
maxCount: 30
@@ -1,20 +0,0 @@
- type: tile
id: FloorBedrock
name: tiles-bedrock-floor
sprite: /Textures/Nyanotrasen/Tiles/bedrock.png
variants: 4
placementVariants:
- 1.0
- 1.0
- 1.0
- 1.0
baseTurf: Space
isSubfloor: true
#canCrowbar: true # Come back
# Maybe if there's ever some way to combine grids or prevent overly simple spacing.
# canShovel: true
footstepSounds:
collection: FootstepAsteroid
itemDrop: FloorTileItemBedrock # Delta V
heatCapacity: 10000
weather: true
@@ -1,6 +0,0 @@
- type: tool
id: Digging
name: tool-quality-digging-name
toolName: tool-quality-digging-tool-name
spawn: Shovel
icon: { sprite: Objects/Tools/shovel.rsi, state: icon }
+3 -11
View File
@@ -201,7 +201,7 @@
collection: FootstepHull
itemDrop: FloorTileItemBrassFilled
heatCapacity: 10000
- type: tile
id: FloorBrassReebe
name: tiles-brass-floor-reebe
@@ -1446,7 +1446,6 @@
sprite: /Textures/Tiles/grass.png
baseTurf: FloorDirt
isSubfloor: true
canShovel: true #DV
footstepSounds:
collection: FootstepGrass
itemDrop: FloorTileItemGrass
@@ -1459,7 +1458,6 @@
sprite: /Textures/Tiles/grassjungle.png
baseTurf: FloorDirt
isSubfloor: true
canShovel: true # Delta V
footstepSounds:
collection: FootstepGrass
itemDrop: FloorTileItemGrassJungle
@@ -1478,10 +1476,8 @@
- 1.0
baseTurf: FloorDirt
isSubfloor: true
canShovel: true # Delta V
footstepSounds:
collection: FootstepGrass
itemDrop: FloorTileItemGrassDark # Delta V
heatCapacity: 10000
weather: true
@@ -1497,10 +1493,8 @@
- 1.0
baseTurf: FloorDirt
isSubfloor: true
canShovel: true # Delta V
footstepSounds:
collection: FootstepGrass
itemDrop: FloorTileItemGrassLight
heatCapacity: 10000
weather: true
@@ -1516,12 +1510,10 @@
- 1.0
baseTurf: Plating
isSubfloor: true
canShovel: true # Delta V
footstepSounds:
collection: FootstepAsteroid
itemDrop: FloorTileItemDirt # Delta V
heatCapacity: 10000
weather: True
weather: true
# Asteroid
@@ -1940,4 +1932,4 @@
barestepSounds:
collection: BarestepWood
itemDrop: FloorTileItemWoodLarge
heatCapacity: 10000
heatCapacity: 10000
-1
View File
@@ -118,7 +118,6 @@
West: /Textures/Tiles/Planet/Snow/snow_double_edge_west.png
isSubfloor: true
itemDrop: FloorTileItemSnow # Delta V
canShovel: true # Delta V
footstepSounds:
collection: FootstepSnow
heatCapacity: 10000
Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 438 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 983 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1000 B

@@ -1,63 +0,0 @@
{
"version": 1,
"license": "CC-BY-SA-3.0",
"copyright": "Taken from tgstation at commit https://github.com/tgstation/tgstation/commit/c6e3401f2e7e1e55c57060cdf956a98ef1fefc24, additional copyrights see tiles folder.",
"size": {
"x": 32,
"y": 32
},
"states": [
{
"name": "grassdark"
},
{
"name": "grasslight"
},
{
"name": "dirt"
},
{
"name": "bedrock"
},
{
"name": "grassjungle-inhand-left",
"directions": 4
},
{
"name": "grassjungle-inhand-right",
"directions": 4
},
{
"name": "grassdark-inhand-left",
"directions": 4
},
{
"name": "grassdark-inhand-right",
"directions": 4
},
{
"name": "grasslight-inhand-left",
"directions": 4
},
{
"name": "grasslight-inhand-right",
"directions": 4
},
{
"name": "dirt-inhand-left",
"directions": 4
},
{
"name": "dirt-inhand-right",
"directions": 4
},
{
"name": "bedrock-inhand-left",
"directions": 4
},
{
"name": "bedrock-inhand-right",
"directions": 4
}
]
}
Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 B