AmeFuelContainerSystem.cs 997 B

123456789101112131415161718192021222324252627282930
  1. using Content.Shared.Ame.Components;
  2. using Content.Shared.Examine;
  3. namespace Content.Shared.Ame.EntitySystems;
  4. /// <summary>
  5. /// Adds details about fuel level when examining antimatter engine fuel containers.
  6. /// </summary>
  7. public sealed class AmeFuelContainerSystem : EntitySystem
  8. {
  9. public override void Initialize()
  10. {
  11. base.Initialize();
  12. SubscribeLocalEvent<AmeFuelContainerComponent, ExaminedEvent>(OnFuelExamined);
  13. }
  14. private void OnFuelExamined(EntityUid uid, AmeFuelContainerComponent comp, ExaminedEvent args)
  15. {
  16. if (!args.IsInDetailsRange)
  17. return;
  18. // less than 25%: amount < capacity / 4 = amount * 4 < capacity
  19. var low = comp.FuelAmount * 4 < comp.FuelCapacity;
  20. args.PushMarkup(Loc.GetString("ame-fuel-container-component-on-examine-detailed-message",
  21. ("colorName", low ? "darkorange" : "orange"),
  22. ("amount", comp.FuelAmount),
  23. ("capacity", comp.FuelCapacity)));
  24. }
  25. }