mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-01 08:37:26 +00:00
* returned nyano code for low fuel alert * added surrounding dependencies * Added localisation for ame alert * reworked a bit * updated a remark * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * renamed a function * added DeltaV comments * another comment * migrated localisation * migrated to partial class and code clean up * time warped into 2025, using protoID * removed the <T> * removed unused namespace --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
35 lines
1.3 KiB
C#
35 lines
1.3 KiB
C#
using Content.Server.Ame.Components;
|
|
using Content.Shared.Ame.Components;
|
|
using Content.Server.Radio.EntitySystems;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Server.Ame.EntitySystems;
|
|
|
|
public sealed partial class AmeControllerSystem
|
|
{
|
|
[Dependency] private readonly RadioSystem _radio = default!;
|
|
[Dependency] private readonly IPrototypeManager _proto = default!;
|
|
|
|
private void AlertLowFuel(EntityUid uid, AmeControllerComponent controller, AmeFuelContainerComponent fuelJar)
|
|
{
|
|
if (fuelJar.FuelAmount > controller.FuelAlertLevel)
|
|
{
|
|
controller.FuelAlertCountdown = 0; // In case of refueling, this sets the countdown to immidiately trigger on next alert.
|
|
return;
|
|
}
|
|
|
|
controller.FuelAlertCountdown -= controller.InjectionAmount;
|
|
|
|
if (controller.FuelAlertCountdown > 0)
|
|
return;
|
|
|
|
controller.FuelAlertCountdown = controller.FuelAlertLevel / controller.FuelAlertFrequency;
|
|
|
|
var fuelRatio = fuelJar.FuelAmount / (float)fuelJar.FuelCapacity;
|
|
_radio.SendRadioMessage(uid,
|
|
Loc.GetString("ame-controller-component-low-fuel-warning",
|
|
("percentage", Math.Round(fuelRatio * 100f))),
|
|
_proto.Index(controller.AlertChannel), uid);
|
|
}
|
|
}
|