From e18d48a9baef5848d1d901110d8b77bdb13e7932 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Sun, 10 Dec 2023 19:14:32 -0500 Subject: [PATCH] Add CARGO_FILL to Readouts and Stats --- .../immersiverailroading/gui/overlay/Readouts.java | 3 +++ .../immersiverailroading/gui/overlay/Stat.java | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/java/cam72cam/immersiverailroading/gui/overlay/Readouts.java b/src/main/java/cam72cam/immersiverailroading/gui/overlay/Readouts.java index c42778006..add52f74e 100644 --- a/src/main/java/cam72cam/immersiverailroading/gui/overlay/Readouts.java +++ b/src/main/java/cam72cam/immersiverailroading/gui/overlay/Readouts.java @@ -31,6 +31,7 @@ public enum Readouts { FRONT_LOCOMOTIVE_ANGLE, REAR_LOCOMOTIVE_ANGLE, CYLINDER_DRAIN, + CARGO_FILL ; public float getValue(EntityRollingStock stock) { @@ -98,6 +99,8 @@ public float getValue(EntityRollingStock stock, float lever) { return rear instanceof LocomotiveModel ? yawToPercent(((LocomotiveModel)rear).getRearLocomotiveYaw((EntityMoveableRollingStock) stock), 90) : 0.5f; case CYLINDER_DRAIN: return stock instanceof LocomotiveSteam && ((LocomotiveSteam) stock).cylinderDrainsEnabled() ? 1 : 0; + case CARGO_FILL: + return stock instanceof Freight ? ((Freight) stock).getPercentCargoFull() / 100f : 0; } return 0; } diff --git a/src/main/java/cam72cam/immersiverailroading/gui/overlay/Stat.java b/src/main/java/cam72cam/immersiverailroading/gui/overlay/Stat.java index cac3a7d0b..6f5fdde3b 100644 --- a/src/main/java/cam72cam/immersiverailroading/gui/overlay/Stat.java +++ b/src/main/java/cam72cam/immersiverailroading/gui/overlay/Stat.java @@ -23,6 +23,9 @@ public enum Stat { BRAKE_PRESSURE, MAX_BRAKE_PRESSURE, UNITS_BRAKE_PRESSURE, + CARGO_FILL, + MAX_CARGO_FILL, + UNITS_CARGO_FILL, ; public String getValue(EntityRollingStock stock) { @@ -107,6 +110,15 @@ public String getValue(EntityRollingStock stock) { return "100"; case UNITS_BRAKE_PRESSURE: return "%"; + case CARGO_FILL: + if (stock instanceof Freight) { + return String.format("%s", ((Freight) stock).getPercentCargoFull()); + } + return ""; + case MAX_CARGO_FILL: + return "100"; + case UNITS_CARGO_FILL: + return "%"; } return ""; }