diff --git a/Content.Shared/Alert/AlertType.cs b/Content.Shared/Alert/AlertType.cs index 941e908db6d..dc323dc64a8 100644 --- a/Content.Shared/Alert/AlertType.cs +++ b/Content.Shared/Alert/AlertType.cs @@ -37,6 +37,7 @@ public enum AlertType : byte Internals, Toxins, Muted, + Walking, VowOfSilence, VowBroken, Essence, diff --git a/Content.Shared/Movement/Components/CanWalkComponent.cs b/Content.Shared/Movement/Components/CanWalkComponent.cs new file mode 100644 index 00000000000..fab851595c7 --- /dev/null +++ b/Content.Shared/Movement/Components/CanWalkComponent.cs @@ -0,0 +1,11 @@ +using Robust.Shared.GameStates; + +namespace Content.Shared.Movement.Components; + +/// +/// Indicates if the entity can toggle walking or not. +/// +[NetworkedComponent, RegisterComponent] +public sealed partial class CanWalkComponent : Component +{ +} diff --git a/Content.Shared/Movement/Components/InputMoverComponent.cs b/Content.Shared/Movement/Components/InputMoverComponent.cs index f1e34c90df4..263190d46fd 100644 --- a/Content.Shared/Movement/Components/InputMoverComponent.cs +++ b/Content.Shared/Movement/Components/InputMoverComponent.cs @@ -1,9 +1,11 @@ using System.Numerics; +using Content.Shared.Alert; using Content.Shared.Movement.Systems; using Robust.Shared.GameStates; using Robust.Shared.Serialization; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom; using Robust.Shared.Timing; +using Robust.Shared.Prototypes; namespace Content.Shared.Movement.Components { @@ -74,6 +76,9 @@ public sealed partial class InputMoverComponent : Component [ViewVariables(VVAccess.ReadWrite)] public bool CanMove = true; + + [DataField] + public ProtoId WalkingAlert = "Walking"; } [Serializable, NetSerializable] diff --git a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs index bce3aeff527..891bd518b1c 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.Input.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.Input.cs @@ -1,4 +1,5 @@ using System.Numerics; +using Content.Shared.Alert; using Content.Shared.CCVar; using Content.Shared.Follower.Components; using Content.Shared.Input; @@ -333,6 +334,7 @@ private void OnInputInit(EntityUid uid, InputMoverComponent component, Component component.RelativeEntity = xform.GridUid ?? xform.MapUid; component.TargetRelativeRotation = Angle.Zero; + WalkingAlert(uid, !component.Sprinting); } private void HandleRunChange(EntityUid uid, ushort subTick, bool walking) @@ -344,6 +346,7 @@ private void HandleRunChange(EntityUid uid, ushort subTick, bool walking) // if we swap to relay then stop our existing input if we ever change back. if (moverComp != null) { + WalkingAlert(uid, walking); SetMoveInput(moverComp, MoveButtons.None); } @@ -460,10 +463,11 @@ private void ResetSubtick(InputMoverComponent component) component.LastInputSubTick = 0; } + public void SetSprinting(EntityUid entity, InputMoverComponent component, ushort subTick, bool walking) { // Logger.Info($"[{_gameTiming.CurTick}/{subTick}] Sprint: {enabled}"); - + WalkingAlert(entity, walking); SetMoveInput(entity, component, subTick, walking, MoveButtons.Walk); } diff --git a/Content.Shared/Movement/Systems/SharedMoverController.cs b/Content.Shared/Movement/Systems/SharedMoverController.cs index 79d2e9f2551..4c2c91db6a1 100644 --- a/Content.Shared/Movement/Systems/SharedMoverController.cs +++ b/Content.Shared/Movement/Systems/SharedMoverController.cs @@ -1,5 +1,6 @@ using System.Diagnostics.CodeAnalysis; using System.Numerics; +using Content.Shared.Alert; using Content.Shared.Bed.Sleep; using Content.Shared.CCVar; using Content.Shared.Friction; @@ -25,6 +26,7 @@ using Robust.Shared.Utility; using PullableComponent = Content.Shared.Movement.Pulling.Components.PullableComponent; + namespace Content.Shared.Movement.Systems { /// @@ -33,6 +35,7 @@ namespace Content.Shared.Movement.Systems /// public abstract partial class SharedMoverController : VirtualController { + [Dependency] private readonly AlertsSystem _alerts = default!; [Dependency] private readonly IConfigurationManager _configManager = default!; [Dependency] protected readonly IGameTiming Timing = default!; [Dependency] private readonly IMapManager _mapManager = default!; @@ -165,6 +168,7 @@ protected void HandleMobMovement( var (walkDir, sprintDir) = GetVelocityInput(mover); var touching = false; + // Handle wall-pushes. if (weightless) { @@ -285,6 +289,14 @@ protected void HandleMobMovement( PhysicsSystem.SetAngularVelocity(physicsUid, 0, body: physicsComponent); } + public void WalkingAlert(EntityUid player, bool walking) + { + if (HasComp(player)) + { + _alerts.ShowAlert(player, AlertType.Walking, walking ? (short) 0 : (short) 1); + } + } + public void LerpRotation(EntityUid uid, InputMoverComponent mover, float frameTime) { var angleDiff = Angle.ShortestDistance(mover.RelativeRotation, mover.TargetRelativeRotation); diff --git a/Resources/Locale/en-US/alerts/alerts.ftl b/Resources/Locale/en-US/alerts/alerts.ftl index 5f880e8dacd..ff2c0d9ee29 100644 --- a/Resources/Locale/en-US/alerts/alerts.ftl +++ b/Resources/Locale/en-US/alerts/alerts.ftl @@ -111,5 +111,8 @@ alerts-revenant-essence-desc = The power of souls. It sustains you and is used f alerts-revenant-corporeal-name = Corporeal alerts-revenant-corporeal-desc = You have manifested physically. People around you can see and hurt you. +alerts-walking-name = Walking +alerts-walking-desc = Indicates how fast you're moving. + alerts-offer-name = Offer alerts-offer-desc = Someone offers you an item. diff --git a/Resources/Prototypes/Alerts/alerts.yml b/Resources/Prototypes/Alerts/alerts.yml index 24f34bc5182..75d4ca8a862 100644 --- a/Resources/Prototypes/Alerts/alerts.yml +++ b/Resources/Prototypes/Alerts/alerts.yml @@ -429,6 +429,18 @@ name: alerts-pacified-name description: alerts-pacified-desc +- type: alert + id: Walking + icons: + - sprite: /Textures/Interface/Alerts/walking.rsi + state: walking0 + - sprite: /Textures/Interface/Alerts/walking.rsi + state: walking1 + name: alerts-walking-name + description: alerts-walking-desc + minSeverity: 0 + maxSeverity: 1 + - type: alert id: Debug1 icons: diff --git a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml index 196abcfab76..a75be106f3c 100644 --- a/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml +++ b/Resources/Prototypes/Entities/Mobs/Cyborgs/base_borg_chassis.yml @@ -220,6 +220,7 @@ understands: - GalacticCommon - RobotTalk + - type: CanWalk - type: entity id: BaseBorgChassisNT diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml index ec917607abc..5d8753e669e 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/animals.yml @@ -1309,6 +1309,7 @@ tags: - VimPilot - DoorBumpOpener + - type: CanWalk - type: entity name: monkey diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml b/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml index 01fce382e37..f19879c9eaa 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/elemental.yml @@ -292,6 +292,7 @@ solution: bloodstream - type: DrainableSolution solution: bloodstream + - type: CanWalk - type: entity name: Reagent Slime Spawner diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml b/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml index 42da84323f6..db594873fe3 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/regalrat.yml @@ -126,6 +126,7 @@ understands: - GalacticCommon - Mouse + - type: CanWalk - type: entity id: MobRatKingBuff diff --git a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml index c4d88e80705..690a4c5d291 100644 --- a/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml +++ b/Resources/Prototypes/Entities/Mobs/NPCs/slimes.yml @@ -128,6 +128,7 @@ speechSounds: Slime - type: TypingIndicator proto: slime + - type: CanWalk - type: entity name: blue slime diff --git a/Resources/Prototypes/Entities/Mobs/Species/base.yml b/Resources/Prototypes/Entities/Mobs/Species/base.yml index eeb6dfc852c..9f3269abda6 100644 --- a/Resources/Prototypes/Entities/Mobs/Species/base.yml +++ b/Resources/Prototypes/Entities/Mobs/Species/base.yml @@ -229,6 +229,7 @@ - CanPilot - FootstepSound - DoorBumpOpener + - type: CanWalk - type: entity save: false diff --git a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml index 5a2587ff710..ffa4e7ade7a 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Mech/mechs.yml @@ -95,6 +95,7 @@ - type: GuideHelp guides: - Robotics + - type: CanWalk - type: entity id: MechRipley diff --git a/Resources/Textures/Interface/Alerts/walking.rsi/meta.json b/Resources/Textures/Interface/Alerts/walking.rsi/meta.json new file mode 100644 index 00000000000..d328b01a45f --- /dev/null +++ b/Resources/Textures/Interface/Alerts/walking.rsi/meta.json @@ -0,0 +1,17 @@ +{ + "version": 1, + "license": "CC-BY-SA-3.0", + "copyright": "Walking/Running icons modified by Mocho, original taken from /tg/station https://github.com/tgstation/tgstation/pull/52691/commits/6a1261187c108c8f151c99ebfa567bd1ec34044c", + "size": { + "x": 32, + "y": 32 + }, + "states": [ + { + "name": "walking0" + }, + { + "name": "walking1" + } + ] +} diff --git a/Resources/Textures/Interface/Alerts/walking.rsi/walking0.png b/Resources/Textures/Interface/Alerts/walking.rsi/walking0.png new file mode 100644 index 00000000000..1d1f048fb91 Binary files /dev/null and b/Resources/Textures/Interface/Alerts/walking.rsi/walking0.png differ diff --git a/Resources/Textures/Interface/Alerts/walking.rsi/walking1.png b/Resources/Textures/Interface/Alerts/walking.rsi/walking1.png new file mode 100644 index 00000000000..3980ee73b5d Binary files /dev/null and b/Resources/Textures/Interface/Alerts/walking.rsi/walking1.png differ