diff --git a/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs b/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs index 0b96fbd45a..e0ac302e65 100644 --- a/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs +++ b/Content.Server/Shuttles/EntitySystems/ThrusterSystem.cs @@ -7,11 +7,13 @@ using Content.Server.Damage.Systems; using Content.Server.Power.Components; using Content.Server.Shuttles.Components; using Content.Shared.Damage; +using Content.Shared.Examine; using Content.Shared.Interaction; using Content.Shared.Maps; using Content.Shared.Physics; using Content.Shared.Shuttles.Components; using Robust.Shared.GameObjects; +using Robust.Shared.Localization; using Robust.Shared.Log; using Robust.Shared.Map; using Robust.Shared.Maths; @@ -53,9 +55,39 @@ namespace Content.Server.Shuttles.EntitySystems SubscribeLocalEvent(OnStartCollide); SubscribeLocalEvent(OnEndCollide); + SubscribeLocalEvent(OnThrusterExamine); + _mapManager.TileChanged += OnTileChange; } + private void OnThrusterExamine(EntityUid uid, ThrusterComponent component, ExaminedEvent args) + { + // Powered is already handled by other power components + var enabled = Loc.GetString("thruster-comp-enabled", + ("enabledColor", component.Enabled ? "green": "red"), + ("enabled", component.Enabled ? "on": "off")); + + args.PushMarkup(enabled); + + var xform = EntityManager.GetComponent(uid); + + if (xform.Anchored) + { + var nozzleDir = Loc.GetString("thruster-comp-nozzle-direction", + ("direction", xform.LocalRotation.Opposite().ToWorldVec().GetDir().ToString().ToLowerInvariant())); + + args.PushMarkup(nozzleDir); + + var exposed = NozzleExposed(xform); + + var nozzleText = Loc.GetString("thruster-comp-nozzle-exposed", + ("exposedColor", exposed ? "green" : "red"), + ("exposed", exposed ? "is": "is not")); + + args.PushMarkup(nozzleText); + } + } + public override void Shutdown() { base.Shutdown(); @@ -294,6 +326,11 @@ namespace Content.Server.Shuttles.EntitySystems if (component.Type == ThrusterType.Angular) return true; + return NozzleExposed(xform); + } + + private bool NozzleExposed(TransformComponent xform) + { var (x, y) = xform.LocalPosition + xform.LocalRotation.Opposite().ToWorldVec(); var tile = _mapManager.GetGrid(xform.GridID).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y))); diff --git a/Resources/Locale/en-US/shuttles/thruster.ftl b/Resources/Locale/en-US/shuttles/thruster.ftl new file mode 100644 index 0000000000..8e58f08dfb --- /dev/null +++ b/Resources/Locale/en-US/shuttles/thruster.ftl @@ -0,0 +1,3 @@ +thruster-comp-enabled = The thruster is turned [color={$enabledColor}]{$enabled}[/color]. +thruster-comp-nozzle-direction = The nozzle is facing [color=yellow]{$direction}[/color]. +thruster-comp-nozzle-exposed = The nozzle [color={$exposedColor}]{$exposed} exposed[/color] to space.