From 8db5adb38778207a146c16f1883d58e473ae7731 Mon Sep 17 00:00:00 2001 From: FL-OZ <58238103+FL-OZ@users.noreply.github.com> Date: Sun, 31 May 2020 12:36:14 -0500 Subject: [PATCH] Floor tile fixes (#1055) Co-authored-by: FL-OZ --- .../Items/FloorTileItemComponent.cs | 14 +-- Resources/Prototypes/Entities/Items/tiles.yml | 85 +++++++++++-------- Resources/Prototypes/Tiles/floors.yml | 2 + Resources/Prototypes/Tiles/wood.yml | 2 +- 4 files changed, 62 insertions(+), 41 deletions(-) diff --git a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs index 9f472658cd..2915567b63 100644 --- a/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs +++ b/Content.Server/GameObjects/Components/Items/FloorTileItemComponent.cs @@ -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(); + _stack = Owner.GetComponent(); } 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().Play("/Audio/items/genhit.ogg", Owner); - if(Stack.Count < 1){ + _entitySystemManager.GetEntitySystem().Play("/Audio/items/genhit.ogg", eventArgs.ClickLocation, AudioParams.Default); + if(_stack.Count < 1){ Owner.Delete(); } } diff --git a/Resources/Prototypes/Entities/Items/tiles.yml b/Resources/Prototypes/Entities/Items/tiles.yml index 2116f4ec34..df78d53925 100644 --- a/Resources/Prototypes/Entities/Items/tiles.yml +++ b/Resources/Prototypes/Entities/Items/tiles.yml @@ -1,29 +1,47 @@ - type: entity - name: Carpet Floor Tile parent: BaseItem - id: FloorTileItemCarpet - description: Those could work as a pretty decent throwing weapon. + id: FloorTileItemBase + description: These could work as a pretty decent throwing weapon. + abstract: true components: - type: Sprite sprite: Objects/Tiles/tile.rsi - state: tile_carpet + state: tile_steel - type: Icon sprite: Objects/Tiles/tile.rsi - state: tile_carpet - - type: Item - Size: 25 + state: tile_steel - type: FloorTile - output: floor_carpet + output: floor_steel - type: Stack - stacktype: FloorTileCarpet + stacktype: FloorTileSteel count: 1 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 name: Wood Floor Tile - parent: BaseItem + parent: FloorTileItemBase id: FloorTileItemWood - description: Those could work as a pretty decent throwing weapon. components: - type: Sprite sprite: Objects/Tiles/tile.rsi @@ -31,8 +49,6 @@ - type: Icon sprite: Objects/Tiles/tile.rsi state: tile_wood - - type: Item - Size: 25 - type: FloorTile output: floor_wood - type: Stack @@ -42,9 +58,8 @@ - type: entity name: White Floor Tile - parent: BaseItem + parent: FloorTileItemBase id: FloorTileItemWhite - description: Those could work as a pretty decent throwing weapon. components: - type: Sprite sprite: Objects/Tiles/tile.rsi @@ -52,8 +67,6 @@ - type: Icon sprite: Objects/Tiles/tile.rsi state: tile_white - - type: Item - Size: 25 - type: FloorTile output: floor_white - type: Stack @@ -63,9 +76,8 @@ - type: entity name: Dark Floor Tile - parent: BaseItem + parent: FloorTileItemBase id: FloorTileItemDark - description: Those could work as a pretty decent throwing weapon. components: - type: Sprite sprite: Objects/Tiles/tile.rsi @@ -73,8 +85,6 @@ - type: Icon sprite: Objects/Tiles/tile.rsi state: tile_dark - - type: Item - Size: 25 - type: FloorTile output: floor_dark - type: Stack @@ -83,22 +93,29 @@ max: 8 - type: entity - name: Steel Floor Tile - parent: BaseItem - id: FloorTileItemSteel - description: Those could work as a pretty decent throwing weapon. + name: Floor Tile Techmaint + parent: FloorTileItemBase + id: FloorTileItemTechmaint components: - type: Sprite sprite: Objects/Tiles/tile.rsi - state: tile_steel + state: tile_dark_techfloor_grid - type: Icon sprite: Objects/Tiles/tile.rsi - state: tile_steel - - type: Item - Size: 25 + state: tile_dark_techfloor_grid - type: FloorTile - output: floor_steel - - type: Stack - stacktype: FloorTileSteel - count: 1 - max: 8 + output: floor_techmaint + +- type: entity + name: Floor Tile Freezer + 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 diff --git a/Resources/Prototypes/Tiles/floors.yml b/Resources/Prototypes/Tiles/floors.yml index 098f0e5cf3..8fab802f48 100644 --- a/Resources/Prototypes/Tiles/floors.yml +++ b/Resources/Prototypes/Tiles/floors.yml @@ -47,6 +47,7 @@ can_crowbar: true footstep_sounds: footstep_floor friction: 0.35 + item_drop: FloorTileItemFreezer - type: tile name: floor_hydro @@ -168,6 +169,7 @@ can_crowbar: true footstep_sounds: footstep_floor friction: 0.5 + item_drop: FloorTileItemTechmaint - type: tile name: floor_white diff --git a/Resources/Prototypes/Tiles/wood.yml b/Resources/Prototypes/Tiles/wood.yml index fcf3ca1959..705c309579 100644 --- a/Resources/Prototypes/Tiles/wood.yml +++ b/Resources/Prototypes/Tiles/wood.yml @@ -9,4 +9,4 @@ can_crowbar: true footstep_sounds: footstep_wood friction: 0.35 - item_drop: FloorTileItemCarpet + item_drop: FloorTileItemWood