Crowbar floor tiles and placement (#429)
* Adds tile removing behavior to CrowbarComponent. Add FloorTileItemComponent. Add genhit.ogg Add tile.png for testing * fixes * Gives ContentTileDefinition a default value for tile item to drop. Adds a few more tileitems. * Changes per review request * move stack.use and if statement
@@ -42,6 +42,10 @@ namespace Content.Server.GameObjects.Components.Interactable.Tools
|
||||
var underplating = _tileDefinitionManager["underplating"];
|
||||
mapGrid.SetTile(eventArgs.ClickLocation, new Tile(underplating.TileId));
|
||||
_entitySystemManager.GetEntitySystem<AudioSystem>().Play("/Audio/items/crowbar.ogg", Owner);
|
||||
//Actually spawn the relevant tile item at the right position and give it some offset to the corner.
|
||||
var tileItem = Owner.EntityManager.SpawnEntity(tileDef.ItemDropPrototypeName);
|
||||
tileItem.Transform.GridPosition = coordinates;
|
||||
tileItem.Transform.WorldPosition += (0.2f, 0.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
using Content.Server.GameObjects.Components.Stack;
|
||||
using Content.Server.GameObjects.EntitySystems;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Server.GameObjects.EntitySystems;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Localization;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Serialization;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Server.GameObjects.Components.Items
|
||||
{
|
||||
[RegisterComponent]
|
||||
public class FloorTileItemComponent : Component, IAfterAttack
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
|
||||
[Dependency] private readonly IEntitySystemManager _entitySystemManager;
|
||||
[Dependency] private readonly IMapManager _mapManager;
|
||||
#pragma warning restore 649
|
||||
|
||||
public override string Name => "FloorTile";
|
||||
private StackComponent Stack;
|
||||
public string _outputTile;
|
||||
|
||||
|
||||
public override void ExposeData(ObjectSerializer serializer)
|
||||
{
|
||||
base.ExposeData(serializer);
|
||||
serializer.DataField(ref _outputTile, "output", "floor_steel");
|
||||
}
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
Stack = Owner.GetComponent<StackComponent>();
|
||||
}
|
||||
public void AfterAttack(AfterAttackEventArgs eventArgs)
|
||||
{
|
||||
var attacked = eventArgs.Attacked;
|
||||
var mapGrid = _mapManager.GetGrid(eventArgs.ClickLocation.GridID);
|
||||
var tile = mapGrid.GetTileRef(eventArgs.ClickLocation);
|
||||
|
||||
var coordinates = mapGrid.GridTileToLocal(tile.GridIndices);
|
||||
float distance = coordinates.Distance(_mapManager, Owner.Transform.GridPosition);
|
||||
|
||||
if (distance > InteractionSystem.InteractionRange)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tileDef = (ContentTileDefinition)_tileDefinitionManager[tile.Tile.TypeId];
|
||||
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){
|
||||
Owner.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -132,5 +132,6 @@ namespace Content.Server.GameObjects.Components.Stack
|
||||
Cable,
|
||||
Ointment,
|
||||
Brutepack,
|
||||
FloorTileSteel
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ using Robust.Shared.Interfaces.Map;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Serialization;
|
||||
|
||||
namespace Content.Shared.Maps
|
||||
{
|
||||
@@ -21,6 +23,7 @@ namespace Content.Shared.Maps
|
||||
public bool CanCrowbar { get; private set; }
|
||||
public string FootstepSounds { get; private set; }
|
||||
public float Friction { get; set; }
|
||||
public string ItemDropPrototypeName { get; private set; }
|
||||
|
||||
public void AssignTileId(ushort id)
|
||||
{
|
||||
@@ -60,6 +63,16 @@ namespace Content.Shared.Maps
|
||||
{
|
||||
Friction = 0;
|
||||
}
|
||||
|
||||
if (mapping.TryGetNode("item_drop", out node))
|
||||
{
|
||||
ItemDropPrototypeName = node.ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemDropPrototypeName = "FloorTileItemSteel";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
BIN
Resources/Audio/items/genhit.ogg
Normal file
83
Resources/Prototypes/Entities/items/tiles.yml
Normal file
@@ -0,0 +1,83 @@
|
||||
- type: entity
|
||||
name: Carpet Floor Tile
|
||||
parent: BaseItem
|
||||
id: FloorTileItemCarpet
|
||||
description: Those could work as a pretty decent throwing weapon.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_carpet
|
||||
- type: Icon
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_carpet
|
||||
- type: Item
|
||||
Size: 25
|
||||
- type: FloorTile
|
||||
output: floor_carpet
|
||||
- type: Stack
|
||||
stacktype: FloorTileCarpet
|
||||
count: 1
|
||||
max: 8
|
||||
|
||||
- type: entity
|
||||
name: White Floor Tile
|
||||
parent: BaseItem
|
||||
id: FloorTileItemWhite
|
||||
description: Those could work as a pretty decent throwing weapon.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_white
|
||||
- type: Icon
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_white
|
||||
- type: Item
|
||||
Size: 25
|
||||
- type: FloorTile
|
||||
output: floor_white
|
||||
- type: Stack
|
||||
stacktype: FloorTileWhite
|
||||
count: 1
|
||||
max: 8
|
||||
|
||||
- type: entity
|
||||
name: Dark Floor Tile
|
||||
parent: BaseItem
|
||||
id: FloorTileItemDark
|
||||
description: Those could work as a pretty decent throwing weapon.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_dark
|
||||
- type: Icon
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_dark
|
||||
- type: Item
|
||||
Size: 25
|
||||
- type: FloorTile
|
||||
output: floor_dark
|
||||
- type: Stack
|
||||
stacktype: FloorTileDark
|
||||
count: 1
|
||||
max: 8
|
||||
|
||||
- type: entity
|
||||
name: Steel Floor Tile
|
||||
parent: BaseItem
|
||||
id: FloorTileItemSteel
|
||||
description: Those could work as a pretty decent throwing weapon.
|
||||
components:
|
||||
- type: Sprite
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_steel
|
||||
- type: Icon
|
||||
sprite: Objects/Tiles/tile.rsi
|
||||
state: tile_steel
|
||||
- type: Item
|
||||
Size: 25
|
||||
- type: FloorTile
|
||||
output: floor_steel
|
||||
- type: Stack
|
||||
stacktype: FloorTileSteel
|
||||
count: 1
|
||||
max: 8
|
||||
@@ -7,6 +7,7 @@
|
||||
footstep_sounds: footstep_carpet
|
||||
friction: 0.35
|
||||
subfloor: plating
|
||||
item_drop: FloorTileItemCarpet
|
||||
|
||||
- type: tile
|
||||
name: floor_dark
|
||||
@@ -17,6 +18,7 @@
|
||||
footstep_sounds: footstep_floor
|
||||
friction: 0.35
|
||||
subfloor: plating
|
||||
item_drop: FloorTileItemDark
|
||||
|
||||
- type: tile
|
||||
name: floor_elevator_shaft
|
||||
@@ -117,6 +119,7 @@
|
||||
footstep_sounds: footstep_floor
|
||||
friction: 0.35
|
||||
subfloor: plating
|
||||
item_drop: FloorTileItemSteel
|
||||
|
||||
- type: tile
|
||||
name: floor_steel_dirty
|
||||
@@ -147,6 +150,7 @@
|
||||
footstep_sounds: footstep_floor
|
||||
friction: 0.1
|
||||
subfloor: underplating
|
||||
item_drop: FloorTileItemWhite
|
||||
|
||||
- type: tile
|
||||
name: floor_asteroid_sand
|
||||
|
||||
BIN
Resources/Textures/Objects/Tiles/tile.rsi/.png
Normal file
|
After Width: | Height: | Size: 211 B |
1
Resources/Textures/Objects/Tiles/tile.rsi/meta.json
Normal file
@@ -0,0 +1 @@
|
||||
{"version": 1, "size": {"x": 32, "y": 32}, "states": [{"name": "", "directions": 1, "delays": [[1.0]]}, {"name": "tile", "directions": 1, "delays": [[1.0]]}, {"name": "tile-white-techfloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_bcarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_blucarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_cafe", "directions": 1, "delays": [[1.0]]}, {"name": "tile_carpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_bluecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_brownperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_brownplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_cargo", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_cyancorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_danger", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_golden", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_grayperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_grayplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_monofloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_orangecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_panels", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_techfloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_techfloor_grid", "directions": 1, "delays": [[1.0]]}, {"name": "tile_dark_violetcorener", "directions": 1, "delays": [[1.0]]}, {"name": "tile_gaycarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_grass", "directions": 1, "delays": [[1.0]]}, {"name": "tile_oracarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_purcarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_sblucarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_bar_dance", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_bar_flat", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_bar_light", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_bluecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_brownperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_brownplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_cargo", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_cyancorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_danger", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_golden", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_grayperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_grayplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_monofloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_orangecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_panels", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_techfloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_techfloor_grid", "directions": 1, "delays": [[1.0]]}, {"name": "tile_steel_violetcorener", "directions": 1, "delays": [[1.0]]}, {"name": "tile_techmaint", "directions": 1, "delays": [[1.0]]}, {"name": "tile_techmaint_cargo", "directions": 1, "delays": [[1.0]]}, {"name": "tile_techmaint_panels", "directions": 1, "delays": [[1.0]]}, {"name": "tile_techmaint_perforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_turcarpet", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_bluecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_brownperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_brownplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_cargo", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_cyancorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_danger", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_golden", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_grayperforated", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_grayplatform", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_monofloor", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_orangecorner", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_panels", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_techfloor_grid", "directions": 1, "delays": [[1.0]]}, {"name": "tile_white_violetcorener", "directions": 1, "delays": [[1.0]]}, {"name": "tile_wood", "directions": 1, "delays": [[1.0]]}]}
|
||||
|
After Width: | Height: | Size: 237 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile.png
Normal file
|
After Width: | Height: | Size: 182 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_bcarpet.png
Normal file
|
After Width: | Height: | Size: 203 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_blucarpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_cafe.png
Normal file
|
After Width: | Height: | Size: 232 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_carpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_dark.png
Normal file
|
After Width: | Height: | Size: 198 B |
|
After Width: | Height: | Size: 229 B |
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 210 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_dark_cargo.png
Normal file
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 221 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_dark_danger.png
Normal file
|
After Width: | Height: | Size: 249 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_dark_golden.png
Normal file
|
After Width: | Height: | Size: 249 B |
|
After Width: | Height: | Size: 260 B |
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 217 B |
|
After Width: | Height: | Size: 225 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_dark_panels.png
Normal file
|
After Width: | Height: | Size: 312 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 223 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_gaycarpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_grass.png
Normal file
|
After Width: | Height: | Size: 386 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_oracarpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_purcarpet.png
Normal file
|
After Width: | Height: | Size: 203 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_sblucarpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_steel.png
Normal file
|
After Width: | Height: | Size: 204 B |
|
After Width: | Height: | Size: 385 B |
|
After Width: | Height: | Size: 224 B |
|
After Width: | Height: | Size: 269 B |
|
After Width: | Height: | Size: 241 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 207 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_steel_cargo.png
Normal file
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 237 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_steel_danger.png
Normal file
|
After Width: | Height: | Size: 257 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_steel_golden.png
Normal file
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 257 B |
|
After Width: | Height: | Size: 207 B |
|
After Width: | Height: | Size: 225 B |
|
After Width: | Height: | Size: 237 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_steel_panels.png
Normal file
|
After Width: | Height: | Size: 315 B |
|
After Width: | Height: | Size: 235 B |
|
After Width: | Height: | Size: 173 B |
|
After Width: | Height: | Size: 236 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_techmaint.png
Normal file
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 210 B |
|
After Width: | Height: | Size: 255 B |
|
After Width: | Height: | Size: 242 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_turcarpet.png
Normal file
|
After Width: | Height: | Size: 202 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_white.png
Normal file
|
After Width: | Height: | Size: 203 B |
|
After Width: | Height: | Size: 234 B |
|
After Width: | Height: | Size: 247 B |
|
After Width: | Height: | Size: 198 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_white_cargo.png
Normal file
|
After Width: | Height: | Size: 214 B |
|
After Width: | Height: | Size: 234 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_white_danger.png
Normal file
|
After Width: | Height: | Size: 259 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_white_golden.png
Normal file
|
After Width: | Height: | Size: 252 B |
|
After Width: | Height: | Size: 245 B |
|
After Width: | Height: | Size: 196 B |
|
After Width: | Height: | Size: 226 B |
|
After Width: | Height: | Size: 233 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_white_panels.png
Normal file
|
After Width: | Height: | Size: 325 B |
|
After Width: | Height: | Size: 172 B |
|
After Width: | Height: | Size: 241 B |
BIN
Resources/Textures/Objects/Tiles/tile.rsi/tile_wood.png
Normal file
|
After Width: | Height: | Size: 314 B |