Add examine text for thrusters (#5469)
This commit is contained in:
@@ -7,11 +7,13 @@ using Content.Server.Damage.Systems;
|
|||||||
using Content.Server.Power.Components;
|
using Content.Server.Power.Components;
|
||||||
using Content.Server.Shuttles.Components;
|
using Content.Server.Shuttles.Components;
|
||||||
using Content.Shared.Damage;
|
using Content.Shared.Damage;
|
||||||
|
using Content.Shared.Examine;
|
||||||
using Content.Shared.Interaction;
|
using Content.Shared.Interaction;
|
||||||
using Content.Shared.Maps;
|
using Content.Shared.Maps;
|
||||||
using Content.Shared.Physics;
|
using Content.Shared.Physics;
|
||||||
using Content.Shared.Shuttles.Components;
|
using Content.Shared.Shuttles.Components;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
|
using Robust.Shared.Localization;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Maths;
|
using Robust.Shared.Maths;
|
||||||
@@ -53,9 +55,39 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
SubscribeLocalEvent<ThrusterComponent, StartCollideEvent>(OnStartCollide);
|
||||||
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
|
SubscribeLocalEvent<ThrusterComponent, EndCollideEvent>(OnEndCollide);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<ThrusterComponent, ExaminedEvent>(OnThrusterExamine);
|
||||||
|
|
||||||
_mapManager.TileChanged += OnTileChange;
|
_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<TransformComponent>(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()
|
public override void Shutdown()
|
||||||
{
|
{
|
||||||
base.Shutdown();
|
base.Shutdown();
|
||||||
@@ -294,6 +326,11 @@ namespace Content.Server.Shuttles.EntitySystems
|
|||||||
if (component.Type == ThrusterType.Angular)
|
if (component.Type == ThrusterType.Angular)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
return NozzleExposed(xform);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool NozzleExposed(TransformComponent xform)
|
||||||
|
{
|
||||||
var (x, y) = xform.LocalPosition + xform.LocalRotation.Opposite().ToWorldVec();
|
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)));
|
var tile = _mapManager.GetGrid(xform.GridID).GetTileRef(new Vector2i((int) Math.Floor(x), (int) Math.Floor(y)));
|
||||||
|
|
||||||
|
|||||||
3
Resources/Locale/en-US/shuttles/thruster.ftl
Normal file
3
Resources/Locale/en-US/shuttles/thruster.ftl
Normal file
@@ -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.
|
||||||
Reference in New Issue
Block a user