Files
wwdpublic/Content.Shared/Ame/EntitySystems/AmeFuelContainerSystem.cs
LordCarve ba36e5195f Refactor AME to use ItemSlot for Fuel (#25558)
* Using wrench on AME doesn't first try to put it in.

* Refactor AME to use ItemSlot for fuel.

* Apparently these names want to match.

(cherry picked from commit c47391011d0f7f56dfcba8e4db348f0dc0d58c09)
2024-03-07 01:08:04 +01:00

31 lines
997 B
C#

using Content.Shared.Ame.Components;
using Content.Shared.Examine;
namespace Content.Shared.Ame.EntitySystems;
/// <summary>
/// Adds details about fuel level when examining antimatter engine fuel containers.
/// </summary>
public sealed class AmeFuelContainerSystem : EntitySystem
{
public override void Initialize()
{
base.Initialize();
SubscribeLocalEvent<AmeFuelContainerComponent, ExaminedEvent>(OnFuelExamined);
}
private void OnFuelExamined(EntityUid uid, AmeFuelContainerComponent comp, ExaminedEvent args)
{
if (!args.IsInDetailsRange)
return;
// less than 25%: amount < capacity / 4 = amount * 4 < capacity
var low = comp.FuelAmount * 4 < comp.FuelCapacity;
args.PushMarkup(Loc.GetString("ame-fuel-container-component-on-examine-detailed-message",
("colorName", low ? "darkorange" : "orange"),
("amount", comp.FuelAmount),
("capacity", comp.FuelCapacity)));
}
}