Removed Catwalk. Replaced with FootstepModifierComponent (#2496)
Co-authored-by: Metal Gear Sloth <metalgearsloth@gmail.com>
This commit is contained in:
@@ -35,7 +35,6 @@
|
|||||||
"Smes",
|
"Smes",
|
||||||
"LightBulb",
|
"LightBulb",
|
||||||
"Healing",
|
"Healing",
|
||||||
"Catwalk",
|
|
||||||
"RangedMagazine",
|
"RangedMagazine",
|
||||||
"Ammo",
|
"Ammo",
|
||||||
"HitscanWeaponCapacitor",
|
"HitscanWeaponCapacitor",
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
using Robust.Shared.GameObjects;
|
|
||||||
|
|
||||||
namespace Content.Server.GameObjects.Components
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Literally just a marker component for footsteps for now.
|
|
||||||
/// </summary>
|
|
||||||
[RegisterComponent]
|
|
||||||
public sealed class CatwalkComponent : Component
|
|
||||||
{
|
|
||||||
public override string Name => "Catwalk";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -56,7 +56,8 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
|
|
||||||
public override void Update(float frameTime)
|
public override void Update(float frameTime)
|
||||||
{
|
{
|
||||||
foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager.EntityQuery<IMoverComponent, IPhysicsComponent>())
|
foreach (var (moverComponent, collidableComponent) in EntityManager.ComponentManager
|
||||||
|
.EntityQuery<IMoverComponent, IPhysicsComponent>(false))
|
||||||
{
|
{
|
||||||
var entity = moverComponent.Owner;
|
var entity = moverComponent.Owner;
|
||||||
UpdateKinematics(entity.Transform, moverComponent, collidableComponent);
|
UpdateKinematics(entity.Transform, moverComponent, collidableComponent);
|
||||||
@@ -141,24 +142,19 @@ namespace Content.Server.GameObjects.EntitySystems
|
|||||||
var grid = _mapManager.GetGrid(coordinates.GetGridId(EntityManager));
|
var grid = _mapManager.GetGrid(coordinates.GetGridId(EntityManager));
|
||||||
var tile = grid.GetTileRef(coordinates);
|
var tile = grid.GetTileRef(coordinates);
|
||||||
|
|
||||||
// If the coordinates have a catwalk, it's always catwalk.
|
// If the coordinates have a FootstepModifier component
|
||||||
string soundCollectionName;
|
// i.e. component that emit sound on footsteps emit that sound
|
||||||
var catwalk = false;
|
string? soundCollectionName = null;
|
||||||
foreach (var maybeCatwalk in grid.GetSnapGridCell(tile.GridIndices, SnapGridOffset.Center))
|
foreach (var maybeFootstep in grid.GetSnapGridCell(tile.GridIndices, SnapGridOffset.Center))
|
||||||
{
|
{
|
||||||
if (maybeCatwalk.Owner.HasComponent<CatwalkComponent>())
|
if (maybeFootstep.Owner.TryGetComponent(out FootstepModifierComponent? footstep))
|
||||||
{
|
{
|
||||||
catwalk = true;
|
soundCollectionName = footstep._soundCollectionName;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if there is no FootstepModifierComponent, determine sound based on tiles
|
||||||
if (catwalk)
|
if (soundCollectionName == null)
|
||||||
{
|
|
||||||
// Catwalk overrides tile sound.s
|
|
||||||
soundCollectionName = "footstep_catwalk";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// Walking on a tile.
|
// Walking on a tile.
|
||||||
var def = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
|
var def = (ContentTileDefinition) _tileDefinitionManager[tile.Tile.TypeId];
|
||||||
|
|||||||
@@ -22,7 +22,8 @@
|
|||||||
- type: IconSmooth
|
- type: IconSmooth
|
||||||
key: catwalk
|
key: catwalk
|
||||||
base: catwalk_
|
base: catwalk_
|
||||||
- type: Catwalk
|
- type: FootstepModifier
|
||||||
|
footstepSoundCollection: footstep_catwalk
|
||||||
- type: Construction
|
- type: Construction
|
||||||
graph: Catwalk
|
graph: Catwalk
|
||||||
node: Catwalk
|
node: Catwalk
|
||||||
|
|||||||
Reference in New Issue
Block a user