Floor tile fixes (#1055)
Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Server.Utility;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.Audio;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
@@ -24,8 +25,8 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "FloorTile";
|
||||
private StackComponent Stack;
|
||||
public string _outputTile;
|
||||
private StackComponent _stack;
|
||||
private string _outputTile;
|
||||
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
@@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Stack = Owner.GetComponent<StackComponent>();
|
||||
_stack = Owner.GetComponent<StackComponent>();
|
||||
}
|
||||
public void AfterInteract(AfterInteractEventArgs eventArgs)
|
||||
{
|
||||
@@ -47,12 +48,13 @@ namespace Content.Server.GameObjects.Components.Items
|
||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||
if (tileDef.IsSubFloor && attacked == null && Stack.Use(1))
|
||||
|
||||
if (tileDef.IsSubFloor && attacked == null && _stack.Use(1))
|
||||
{
|
||||
var desiredTile = _tileDefinitionManager[_outputTile];
|
||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/genhit.ogg", Owner);
|
||||
if(Stack.Count < 1){
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation, AudioParams.Default);
|
||||
if(_stack.Count < 1){
|
||||
Owner.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user