Floor tile fixes (#1055)

Co-authored-by: FL-OZ <anotherscuffed@gmail.com>
This commit is contained in:
FL-OZ
2020-05-31 12:36:14 -05:00
committed by GitHub
parent bffe4df16f
commit 8db5adb387
4 changed files with 62 additions and 41 deletions

View File

@@ -3,6 +3,7 @@ using Content.Server.GameObjects.EntitySystems;
using Content.Server.Utility; using Content.Server.Utility;
using Content.Shared.Maps; using Content.Shared.Maps;
using Robust.Server.GameObjects.EntitySystems; using Robust.Server.GameObjects.EntitySystems;
using Robust.Shared.Audio;
using Robust.Shared.GameObjects; using Robust.Shared.GameObjects;
using Robust.Shared.Interfaces.GameObjects; using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;
@@ -24,8 +25,8 @@ namespace Content.Server.GameObjects.Components.Items
#pragma warning restore 649 #pragma warning restore 649
public override string Name => "FloorTile"; public override string Name => "FloorTile";
private StackComponent Stack; private StackComponent _stack;
public string _outputTile; private string _outputTile;
public override void ExposeData(ObjectSerializer serializer) public override void ExposeData(ObjectSerializer serializer)
@@ -37,7 +38,7 @@ namespace Content.Server.GameObjects.Components.Items
public override void Initialize() public override void Initialize()
{ {
base.Initialize(); base.Initialize();
Stack = Owner.GetComponent<StackComponent>(); _stack = Owner.GetComponent<StackComponent>();
} }
public void AfterInteract(AfterInteractEventArgs eventArgs) public void AfterInteract(AfterInteractEventArgs eventArgs)
{ {
@@ -47,12 +48,13 @@ namespace Content.Server.GameObjects.Components.Items
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID); var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation); var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId]; 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]; var desiredTile = _tileDefinitionManager[_outputTile];
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId)); mapGrid.SetTile(eventArgs.ClickLocation, new Tile(desiredTile.TileId));
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/genhit.ogg", Owner); _entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation, AudioParams.Default);
if(Stack.Count < 1){ if(_stack.Count < 1){
Owner.Delete(); Owner.Delete();
} }
} }

View File

@@ -1,29 +1,47 @@
- type: entity - type: entity
name: Carpet Floor Tile
parent: BaseItem parent: BaseItem
id: FloorTileItemCarpet id: FloorTileItemBase
description: Those could work as a pretty decent throwing weapon. description: These could work as a pretty decent throwing weapon.
abstract: true
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_carpet state: tile_steel
- type: Icon - type: Icon
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_carpet state: tile_steel
- type: Item
Size: 25
- type: FloorTile - type: FloorTile
output: floor_carpet output: floor_steel
- type: Stack - type: Stack
stacktype: FloorTileCarpet stacktype: FloorTileSteel
count: 1 count: 1
max: 8 max: 8
- type: entity
name: Steel Floor Tile
parent: FloorTileItemBase
id: FloorTileItemSteel
- type: entity
name: Carpet Floor Tile
parent: FloorTileItemBase
id: FloorTileItemCarpet
components:
- type: Sprite
sprite: Objects/Tiles/tile.rsi
state: tile_carpet
- type: Icon
sprite: Objects/Tiles/tile.rsi
state: tile_carpet
- type: FloorTile
output: floor_carpet
- type: Stack
stacktype: FloorTileCarpet
- type: entity - type: entity
name: Wood Floor Tile name: Wood Floor Tile
parent: BaseItem parent: FloorTileItemBase
id: FloorTileItemWood id: FloorTileItemWood
description: Those could work as a pretty decent throwing weapon.
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
@@ -31,8 +49,6 @@
- type: Icon - type: Icon
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_wood state: tile_wood
- type: Item
Size: 25
- type: FloorTile - type: FloorTile
output: floor_wood output: floor_wood
- type: Stack - type: Stack
@@ -42,9 +58,8 @@
- type: entity - type: entity
name: White Floor Tile name: White Floor Tile
parent: BaseItem parent: FloorTileItemBase
id: FloorTileItemWhite id: FloorTileItemWhite
description: Those could work as a pretty decent throwing weapon.
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
@@ -52,8 +67,6 @@
- type: Icon - type: Icon
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_white state: tile_white
- type: Item
Size: 25
- type: FloorTile - type: FloorTile
output: floor_white output: floor_white
- type: Stack - type: Stack
@@ -63,9 +76,8 @@
- type: entity - type: entity
name: Dark Floor Tile name: Dark Floor Tile
parent: BaseItem parent: FloorTileItemBase
id: FloorTileItemDark id: FloorTileItemDark
description: Those could work as a pretty decent throwing weapon.
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
@@ -73,8 +85,6 @@
- type: Icon - type: Icon
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_dark state: tile_dark
- type: Item
Size: 25
- type: FloorTile - type: FloorTile
output: floor_dark output: floor_dark
- type: Stack - type: Stack
@@ -83,22 +93,29 @@
max: 8 max: 8
- type: entity - type: entity
name: Steel Floor Tile name: Floor Tile Techmaint
parent: BaseItem parent: FloorTileItemBase
id: FloorTileItemSteel id: FloorTileItemTechmaint
description: Those could work as a pretty decent throwing weapon.
components: components:
- type: Sprite - type: Sprite
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_steel state: tile_dark_techfloor_grid
- type: Icon - type: Icon
sprite: Objects/Tiles/tile.rsi sprite: Objects/Tiles/tile.rsi
state: tile_steel state: tile_dark_techfloor_grid
- type: Item
Size: 25
- type: FloorTile - type: FloorTile
output: floor_steel output: floor_techmaint
- type: Stack
stacktype: FloorTileSteel - type: entity
count: 1 name: Floor Tile Freezer
max: 8 parent: FloorTileItemBase
id: FloorTileItemFreezer
components:
- type: Sprite
sprite: Objects/Tiles/tile.rsi
state: tile_cafe #this is close enough for now.
- type: Icon
sprite: Objects/Tiles/tile.rsi
state: tile_cafe
- type: FloorTile
output: floor_freezer

View File

@@ -47,6 +47,7 @@
can_crowbar: true can_crowbar: true
footstep_sounds: footstep_floor footstep_sounds: footstep_floor
friction: 0.35 friction: 0.35
item_drop: FloorTileItemFreezer
- type: tile - type: tile
name: floor_hydro name: floor_hydro
@@ -168,6 +169,7 @@
can_crowbar: true can_crowbar: true
footstep_sounds: footstep_floor footstep_sounds: footstep_floor
friction: 0.5 friction: 0.5
item_drop: FloorTileItemTechmaint
- type: tile - type: tile
name: floor_white name: floor_white

View File

@@ -9,4 +9,4 @@
can_crowbar: true can_crowbar: true
footstep_sounds: footstep_wood footstep_sounds: footstep_wood
friction: 0.35 friction: 0.35
item_drop: FloorTileItemCarpet item_drop: FloorTileItemWood