From 4f2c45c36efd34fdf6128d19583c71455e28af75 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Tue, 3 Oct 2023 06:56:57 -0400 Subject: [PATCH 1/5] Move where yawFront and yawRear are corrected for small movements --- .../entity/physics/SimulationState.java | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java b/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java index 316771b8d..b4ae9e31a 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java @@ -348,14 +348,6 @@ private void moveAlongTrack(double distance) { } } - // Fix bogeys pointing in opposite directions - if (DegreeFuncs.delta(yawFront, yaw) > 90) { - yawFront = yaw; - } - if (DegreeFuncs.delta(yawRear, yaw) > 90) { - yawRear = yaw; - } - boolean isReversed = distance < 0; if (isReversed) { distance = -distance; @@ -391,6 +383,12 @@ private void moveAlongTrack(double distance) { yawFront = yaw; yawRear = yaw; } + + // Fix bogeys pointing in opposite directions + if (DegreeFuncs.delta(yawFront, yaw) > 90 || DegreeFuncs.delta(yawFront, yawRear) > 90) { + yawFront = yaw; + yawRear = yaw; + } } public double forcesNewtons() { From 1c61d9ac32a2e58ac1f95e3c265feb626c434c05 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Tue, 3 Oct 2023 08:33:34 -0400 Subject: [PATCH 2/5] Simplify dirty state propogation by keeping consist --- .../entity/EntityCoupleableRollingStock.java | 6 ++ .../entity/physics/Consist.java | 2 + .../entity/physics/Simulation.java | 61 +------------------ .../entity/physics/SimulationState.java | 5 ++ 4 files changed, 15 insertions(+), 59 deletions(-) diff --git a/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java b/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java index ee9212fda..8e9e97ac9 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/EntityCoupleableRollingStock.java @@ -229,17 +229,23 @@ public final void setCoupledUUID(CouplerType coupler, UUID id) { .sendToObserving(this); } + EntityCoupleableRollingStock coupled = id != null ? findByUUID(id) : null; + switch (coupler) { case FRONT: coupledFront = id; if (coupledFront == null) { lastKnownFront = null; + } else if (coupled != null){ + lastKnownFront = new Vec3i(coupled.getPosition()); } break; case BACK: coupledBack = id; if (coupledBack == null) { lastKnownRear = null; + } else if (coupled != null){ + lastKnownFront = new Vec3i(coupled.getPosition()); } break; } diff --git a/src/main/java/cam72cam/immersiverailroading/entity/physics/Consist.java b/src/main/java/cam72cam/immersiverailroading/entity/physics/Consist.java index 46e8d8d04..e5fa5c8e3 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/physics/Consist.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/physics/Consist.java @@ -469,6 +469,8 @@ public static Map iterate(Map stat // Propagate dirty flag boolean canBeUnloaded = consist.stream().allMatch(p -> p.state.velocity == 0 && state.forcesNewtons() < state.frictionNewtons()); consist.forEach(p -> p.state.canBeUnloaded = canBeUnloaded); + List ids = consist.stream().map(x -> x.state.config.id).collect(Collectors.toList()); + consist.forEach(p -> p.state.consist = ids); boolean dirty = consist.stream().anyMatch(p -> p.state.dirty); diff --git a/src/main/java/cam72cam/immersiverailroading/entity/physics/Simulation.java b/src/main/java/cam72cam/immersiverailroading/entity/physics/Simulation.java index 02bcdaad6..eca79447b 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/physics/Simulation.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/physics/Simulation.java @@ -74,73 +74,16 @@ public static void simulate(World world) { state.update(entity); stateMaps.get(i).put(entity.getUUID(), state); if (state.dirty) { - dirty.add(entity.getUUID()); + dirty.addAll(state.consist); } } } if (i < 40) { - stateMaps.get(i).get(entity.getUUID()).dirty = true; + dirty.addAll(stateMaps.get(i).get(entity.getUUID()).consist); } } } - // This finds the full list of dirty stock that needs to be recomputed. - // It is *highly* optimized to run in under 0.5ms per 100 pieces of stock. - // It could be tuned further, but I suspect this is good enough for now - for (int i = 0; i < allStock.size(); i++) { - int lastSize = dirty.size(); - - for (UUID uuid : stateMaps.get(0).keySet()) { - boolean isDirty = dirty.contains(uuid); - - // This makes an assumption that stock only has a single value for a coupler in 40 ticks - // Worst case is the potential for a missed dirty flag which will interact with the Mismatch check - UUID front = null; - UUID rear = null; - - for (Map stateMap : stateMaps) { - if (front != null && rear != null) { - break; - } - - SimulationState state = stateMap.get(uuid); - if (state != null) { - if (front == null && state.interactingFront != null) { - front = state.interactingFront; - } - if (rear == null && state.interactingRear != null) { - rear = state.interactingRear; - } - } - } - - if (!isDirty) { - if (front != null && dirty.contains(front)) { - dirty.add(uuid); - isDirty = true; - } - } - if (!isDirty) { - if (rear != null && dirty.contains(rear)) { - dirty.add(uuid); - isDirty = true; - } - } - - if (isDirty) { - if (front != null && !dirty.contains(front)) { - dirty.add(front); - } - if (rear != null && !dirty.contains(rear)) { - dirty.add(rear); - } - } - } - if (lastSize == dirty.size()) { - break; - } - } - for (UUID uuid : dirty) { SimulationState state = stateMaps.get(0).get(uuid); if (state != null) { diff --git a/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java b/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java index b4ae9e31a..e8c13ec51 100644 --- a/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java +++ b/src/main/java/cam72cam/immersiverailroading/entity/physics/SimulationState.java @@ -67,6 +67,7 @@ public class SimulationState { public boolean frontPulling; public boolean rearPushing; public boolean rearPulling; + public List consist; public static class Configuration { public UUID id; @@ -199,6 +200,8 @@ public SimulationState(EntityCoupleableRollingStock stock) { calculateBlockCollisions(Collections.emptyList()); blocksToBreak = Collections.emptyList(); + + consist = Collections.singletonList(config.id); } private SimulationState(SimulationState prev) { @@ -229,6 +232,8 @@ private SimulationState(SimulationState prev) { interferingResistance = prev.interferingResistance; blocksToBreak = Collections.emptyList(); directResistance = prev.directResistance; + + consist = prev.consist; } public void calculateCouplerPositions() { From 2db0d35861fdfe22247464ee35679c9b4d79c8d1 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Wed, 4 Oct 2023 11:11:04 -0400 Subject: [PATCH 3/5] Only run full build suite on master --- .github/workflows/branch.yml | 43 ++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 5 ++++- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/branch.yml diff --git a/.github/workflows/branch.yml b/.github/workflows/branch.yml new file mode 100644 index 000000000..755acc027 --- /dev/null +++ b/.github/workflows/branch.yml @@ -0,0 +1,43 @@ +name: Immersive Railroading Build Pipeline + +on: + push: + branches-ignore: + - 'master' + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + branch: [1.12.2-forge, 1.16.5-forge] + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: keyscan + run: mkdir -p ~/.ssh/ && ssh-keyscan -t rsa teamopenindustry.cc >> ~/.ssh/known_hosts + - name: Install deps + run: sudo apt install -y pngquant findutils xvfb + - name: Setup Universal Mod Core (and helpers) + env: + BRANCH: ${{ matrix.branch }} + run: java -jar UMCSetup.jar ${BRANCH} https + - name: Gradle compile + run: ./gradlew classes + - name: Process images + run: find src/main/resources/assets/immersiverailroading/ | grep png | xargs -I foo pngquant -s1 -f --ext .png foo + - name: Run Data (optionalish) + run: xvfb-run --auto-servernum ./gradlew runData || xvfb-run --auto-servernum ./gradlew runData || true + - name: Gradle build + run: ./gradlew build + - name: Gradle publish + env: + MAVENCI_PASS: ${{ secrets.MAVENCI_PASS }} + run: ./gradlew publish + - uses: actions/upload-artifact@v2 + with: + name: Immersive Railroading ${{matrix.branch}} + path: build/libs/ImmersiveRailroading-${{matrix.branch}}-* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6826bbe03..83071f8a7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,6 +1,9 @@ name: Immersive Railroading Build Pipeline -on: [push] +on: + push: + branches: + - 'master' jobs: build: From d73991aff91c43a5310703fef623a631d30d8370 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Wed, 4 Oct 2023 12:55:10 -0400 Subject: [PATCH 4/5] Implement option to select original vs advanced guis --- .../gui/overlay/GuiBuilder.java | 47 ++--- .../gui/default/cab_car.caml | 163 +++++++++--------- .../gui/default/common/settings.caml | 25 +++ .../gui/default/diesel.caml | 150 +--------------- .../gui/default/diesel_v0.caml | 139 +++++++++++++++ .../gui/default/diesel_v1.caml | 142 +++++++++++++++ .../gui/default/handcar.caml | 89 +++++----- .../gui/default/independent.caml | 45 +++-- .../gui/default/steam.caml | 68 +------- .../gui/default/steam_v0.caml | 161 +++++++++++++++++ .../gui/default/steam_v1.caml | 63 +++++++ 11 files changed, 734 insertions(+), 358 deletions(-) create mode 100644 src/main/resources/assets/immersiverailroading/gui/default/diesel_v0.caml create mode 100644 src/main/resources/assets/immersiverailroading/gui/default/diesel_v1.caml create mode 100644 src/main/resources/assets/immersiverailroading/gui/default/steam_v0.caml create mode 100644 src/main/resources/assets/immersiverailroading/gui/default/steam_v1.caml diff --git a/src/main/java/cam72cam/immersiverailroading/gui/overlay/GuiBuilder.java b/src/main/java/cam72cam/immersiverailroading/gui/overlay/GuiBuilder.java index 7b23040ea..41488bcd7 100644 --- a/src/main/java/cam72cam/immersiverailroading/gui/overlay/GuiBuilder.java +++ b/src/main/java/cam72cam/immersiverailroading/gui/overlay/GuiBuilder.java @@ -36,8 +36,8 @@ public class GuiBuilder { private final Vertical screen_y; private final Identifier image; - private final int imageWidth; - private final int imageHeight; + private final int width; + private final int height; private final String text; private final float textHeight; @@ -130,17 +130,6 @@ protected GuiBuilder(DataBlock data) throws IOException { this.screen_x = Horizontal.from(data.getValue("screen_x").asString()); this.screen_y = Vertical.from(data.getValue("screen_y").asString()); - // Image stuff - this.image = data.getValue("image").asIdentifier(null); - if (image != null) { - BufferedImage tmp = ImageIO.read(this.image.getResourceStream()); - imageWidth = tmp.getWidth(); - imageHeight = tmp.getHeight(); - } else { - imageWidth = 0; - imageHeight = 0; - } - // Text stuff DataBlock txt = data.getBlock("text"); if (txt != null) { @@ -151,6 +140,20 @@ protected GuiBuilder(DataBlock data) throws IOException { textHeight = 0; } + // Image stuff + this.image = data.getValue("image").asIdentifier(null); + if (image != null) { + BufferedImage tmp = ImageIO.read(this.image.getResourceStream()); + width = tmp.getWidth(); + height = tmp.getHeight(); + } else if (text != null) { + width = (int) (textHeight/4 * text.length()); // Guesstimate + height = (int) textHeight; + } else { + width = 0; + height = 0; + } + // Controls String readout = data.getValue("readout").asString(); this.readout = readout != null ? Readouts.valueOf(readout.toUpperCase(Locale.ROOT)) : null; @@ -329,9 +332,9 @@ private void render(EntityRollingStock stock, RenderState state, int maxx, int m if (image != null) { DirectDraw draw = new DirectDraw(); draw.vertex(0, 0, 0).uv(0, 0); - draw.vertex(0, imageHeight, 0).uv(0, 1); - draw.vertex(imageWidth, imageHeight, 0).uv(1, 1); - draw.vertex(imageWidth, 0, 0).uv(1, 0); + draw.vertex(0, height, 0).uv(0, 1); + draw.vertex(width, height, 0).uv(1, 1); + draw.vertex(width, 0, 0).uv(1, 0); draw.draw(state.clone() .texture(Texture.wrap(image)) .alpha_test(false) @@ -374,7 +377,7 @@ private GuiBuilder find(EntityRollingStock stock, Matrix4 matrix, int maxx, int } } - if (image != null && interactable()) { + if (interactable() && (image != null || text != null)) { if (control == null && setting == null && texture_variant == null) { if (readout == null) { return null; @@ -397,10 +400,10 @@ private GuiBuilder find(EntityRollingStock stock, Matrix4 matrix, int maxx, int } } int border = 2; - Vec3d cornerA = matrix.apply(new Vec3d(-border, -border, 0)); - Vec3d cornerB = matrix.apply(new Vec3d(-border, imageHeight + border, 0)); - Vec3d cornerC = matrix.apply(new Vec3d(imageWidth + border, -border, 0)); - Vec3d cornerD = matrix.apply(new Vec3d(imageWidth + border, imageHeight + border, 0)); + Vec3d cornerA = matrix.apply(new Vec3d((image == null ? -width : 0)-border, -border, 0)); + Vec3d cornerB = matrix.apply(new Vec3d((image == null ? -width : 0)-border, height + border, 0)); + Vec3d cornerC = matrix.apply(new Vec3d(width + border, -border, 0)); + Vec3d cornerD = matrix.apply(new Vec3d(width + border, height + border, 0)); Polygon poly = new Polygon( new int[]{(int) cornerA.x, (int) cornerB.x, (int) cornerC.x, (int) cornerD.x}, @@ -455,7 +458,7 @@ private void onMouseMove(EntityRollingStock stock, Matrix4 matrix, GuiBuilder ta temp.scale(scalex != null ? scalex * checkValue : 1, scaley != null ? scaley * checkValue : 1, 1); } - Vec3d checkMiddle = temp.apply(new Vec3d(imageWidth/2f, imageHeight/2f, 0)); + Vec3d checkMiddle = temp.apply(new Vec3d(width /2f, height /2f, 0)); double delta = checkMiddle.distanceTo(new Vec3d(x, y, 0)); if (delta < closestDelta) { closestDelta = delta; diff --git a/src/main/resources/assets/immersiverailroading/gui/default/cab_car.caml b/src/main/resources/assets/immersiverailroading/gui/default/cab_car.caml index 4c4baa3a2..bb9b0eca3 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/cab_car.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/cab_car.caml @@ -1,80 +1,89 @@ element: - # left panel - x = 10 - y = -95 - image = "immersiverailroading:gui/overlay_handcar.png" - element: - # ind brake - x = 17 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "INDEPENDENT_BRAKE" - translate = - x = 0 - y = -50 - element: - # brake pressure - x = 11 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "BRAKE_PRESSURE" - translate = - x = 0 - y = -50 - color = - 0.0 = "0xDDa22020" - element: - # train brake - x = 11 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "TRAIN_BRAKE" - translate = - x = 0 - y = -50 - element: - # throttle - x = 32 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "THROTTLE" - translate = - x = 0 - y = -50 - element: - # reverser - x = 38 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "REVERSER" - translate = - x = 0 - y = -50 - element: - # speed readout - text = - value = "stat.speed" - height = 6 - x = 30 - y = 8 - element: - # top labels - y = 19 - element: - x = 20 - text = - value = "label.brake" - height = 4 - element: - x = 38 - text = - value = "label.throttle" - height = 4 + import: "immersiverailroading:gui/default/common/settings.caml" + +element: + import: "immersiverailroading:gui/default/common/opacity.caml" element: - # bottom labels - y = 78 + import: "immersiverailroading:gui/default/common/scale.caml" + screen_x = LEFT + screen_y = BOTTOM element: - x = 38 - text = - value = "label.reverser" - height = 4 + # left panel + x = 10 + y = -95 + image = "immersiverailroading:gui/overlay_handcar.png" + element: + # ind brake + x = 17 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "INDEPENDENT_BRAKE" + translate = + x = 0 + y = -50 + element: + # brake pressure + x = 11 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "BRAKE_PRESSURE" + translate = + x = 0 + y = -50 + color = + 0.0 = "0xDDa22020" + element: + # train brake + x = 11 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "TRAIN_BRAKE" + translate = + x = 0 + y = -50 + element: + # throttle + x = 32 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "THROTTLE" + translate = + x = 0 + y = -50 + element: + # reverser + x = 38 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "REVERSER" + translate = + x = 0 + y = -50 + element: + # speed readout + text = + value = "stat.speed" + height = 6 + x = 30 + y = 8 + element: + # top labels + y = 19 + element: + x = 20 + text = + value = "label.brake" + height = 4 + element: + x = 38 + text = + value = "label.throttle" + height = 4 + element: + # bottom labels + y = 78 + element: + x = 38 + text = + value = "label.reverser" + height = 4 diff --git a/src/main/resources/assets/immersiverailroading/gui/default/common/settings.caml b/src/main/resources/assets/immersiverailroading/gui/default/common/settings.caml index 298912a50..5dfe8f89b 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/common/settings.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/common/settings.caml @@ -72,3 +72,28 @@ element: translate = x = 200 + + element: + x = 25 + y = 90 + + element: + text = + value = "Original GUI" + height = 6 + setting = "legacy_gui" + toggle = true + color = + 0.0 = "0xFFFFFFFF" + 1.0 = "0xFF999999" + element: + x = 50 + setting = "legacy_gui" + text = + value = "Advanced GUI" + height = 6 + toggle = true + invert = true + color = + 0.0 = "0xFFFFFFFF" + 1.0 = "0xFF999999" diff --git a/src/main/resources/assets/immersiverailroading/gui/default/diesel.caml b/src/main/resources/assets/immersiverailroading/gui/default/diesel.caml index 9ef8cc910..cdfe3aefb 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/diesel.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/diesel.caml @@ -1,149 +1,17 @@ element: import: "immersiverailroading:gui/default/common/settings.caml" -element: - screen_x = RIGHT - screen_y = BOTTOM +element: import: "immersiverailroading:gui/default/common/opacity.caml" element: - import: "immersiverailroading:gui/default/common/scale.caml" - - element: - image = "immersiverailroading:gui/default/diesel/diesel_base.png" - x = -120 - y = -190 - - element: - x = 55 - element: - y = 2.5 - image = "immersiverailroading:gui/default/diesel/dial.png" - import: "immersiverailroading:gui/default/diesel/gauge_speed_face.caml" - - element: - y = 65 - image = "immersiverailroading:gui/default/diesel/dial.png" - import: "immersiverailroading:gui/default/diesel/gauge_brake_face.caml" - - element: - y = 127.5 - image = "immersiverailroading:gui/default/diesel/dial.png" - import: "immersiverailroading:gui/default/diesel/gauge_temperature_face.caml" - - - element: - element: - x = 5 - y = 80 - image = "immersiverailroading:gui/default/diesel/horn.png" - - readout = HORN - - rotate = - x = 0 - y = 10 - degrees = 10 - - element: - x = 5 - y = 95 - image = "immersiverailroading:gui/default/diesel/button.png" + setting = "legacy_gui" + translucent = true + invert = true + import: "immersiverailroading:gui/default/diesel_v0.caml" - readout = ENGINE - toggle = true - color = - 0.0 = 0xFF006000 - 1.0 = 0xFF008000 - - element: - x = 35 - y = 95 - image = "immersiverailroading:gui/default/diesel/button.png" - - readout = BELL - toggle = true - color = - 0.0 = 0xFFAAAA00 - 1.0 = 0xFFCCCC00 - - element: - x = 5 - y = 115 - image = "immersiverailroading:gui/default/diesel/throttle_base.png" - - element: - x = 11.5 - y = 13 - image = "immersiverailroading:gui/default/diesel/throttle_lever.png" - readout = "THROTTLE" - rotate = - x = 1.5 - y = -13 - degrees = -90 - offset = 45 - sound = - engage = "immersiverailroading:sounds/default/lever_engage.ogg" - disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" - - element: - x = 34 - y = 115 - image = "immersiverailroading:gui/default/diesel/reverser_base.png" - - element: - x = 9 - y = 10 - image = "immersiverailroading:gui/default/diesel/reverser_lever.png" - readout = "REVERSER" - rotate = - x = 1 - y = -10 - degrees = -90 - offset = 45 - sound = - engage = "immersiverailroading:sounds/default/lever_engage.ogg" - disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" - - element: - x = 12 - y = 145 - image = "immersiverailroading:gui/default/diesel/brake_stand.png" - - element: - x = 10 - y = 2.5 - image = "immersiverailroading:gui/default/diesel/brake_lever.png" - readout = "TRAIN_BRAKE_LEVER" - rotate = - x = -5 - y = 2.5 - degrees = 30 - offset = -15 - color = - 0.0 = 0xFF806600 - sound = - engage = "immersiverailroading:sounds/default/lever_engage.ogg" - move = "immersiverailroading:sounds/default/pressure.ogg" - disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" - - element: - x = 12 - y = 165 - image = "immersiverailroading:gui/default/diesel/brake_stand.png" - element: - x = 10 - y = 2.5 - image = "immersiverailroading:gui/default/diesel/brake_lever.png" - readout = "INDEPENDENT_BRAKE" - rotate = - x = -5 - y = 2.5 - degrees = -15 - offset = 0 - color = - 0.0 = 0xFF800000 - sound = - engage = "immersiverailroading:sounds/default/lever_engage.ogg" - disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" + element: + setting = "legacy_gui" + translucent = true + import: "immersiverailroading:gui/default/diesel_v1.caml" diff --git a/src/main/resources/assets/immersiverailroading/gui/default/diesel_v0.caml b/src/main/resources/assets/immersiverailroading/gui/default/diesel_v0.caml new file mode 100644 index 000000000..66f0c1512 --- /dev/null +++ b/src/main/resources/assets/immersiverailroading/gui/default/diesel_v0.caml @@ -0,0 +1,139 @@ +element: + screen_x = LEFT + screen_y = BOTTOM + import: "immersiverailroading:gui/default/common/scale.caml" + element: + # left panel + x = 10 + y = -95 + image = "immersiverailroading:gui/overlay_diesel.png" + element: + # fuel level + x = 5 + y = 75 + image = "immersiverailroading:gui/fluid.png" + readout = "LIQUID" + translate = + x = 0 + y = -50 + scale = + y = 1 + color = + 0 = "0xAA79650c" + element: + # engine temp + x = 25 + y = 75 + image = "immersiverailroading:gui/fluid.png" + readout = "TEMPERATURE" + translate = + x = 0 + y = -50 + scale = + y = 1 + color = + 0 = "0x992a81af" + 0.5 = "0x992a933a" + 0.6666 = "0x99d16c15" + 0.9333 = "0x99a21010" + element: + # brake pressure + x = 41 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "BRAKE_PRESSURE" + translate = + x = 0 + y = -50 + color = + 0.0 = "0xDDa22020" + element: + # train brake + x = 41 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "TRAIN_BRAKE" + translate = + x = 0 + y = -50 + element: + # ind brake + x = 47 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "INDEPENDENT_BRAKE" + translate = + x = 0 + y = -50 + element: + # throttle + x = 61 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "THROTTLE" + translate = + x = 0 + y = -50 + element: + # reverser + x = 67 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "REVERSER" + translate = + x = 0 + y = -50 + element: + # speed readout + text = + value = "stat.speed stat.units_speed" + height = 6 + x = 38 + y = 8 + element: + # top labels + y = 19 + element: + x = 10 + text = + value = "stat.liquidstat.units_liquid" + height = 4 + element: + x = 30 + text = + value = "stat.temperaturestat.units_temperature" + height = 4 + element: + x = 48 + text = + value = "label.brake" + height = 4 + element: + x = 69 + text = + value = "label.throttle" + height = 4 + element: + # bottom labels + y = 78 + element: + x = 10 + text = + value = "stat.max_liquidstat.units_liquid" + height = 4 + element: + x = 30 + y = 0 + text = + value = "stat.max_temperaturestat.units_temperature" + height = 4 + element: + x = 48 + text = + value = "" + height = 4 + element: + x = 69 + text = + value = "label.reverser" + height = 4 diff --git a/src/main/resources/assets/immersiverailroading/gui/default/diesel_v1.caml b/src/main/resources/assets/immersiverailroading/gui/default/diesel_v1.caml new file mode 100644 index 000000000..2f1fc845b --- /dev/null +++ b/src/main/resources/assets/immersiverailroading/gui/default/diesel_v1.caml @@ -0,0 +1,142 @@ +element: + screen_x = RIGHT + screen_y = BOTTOM + import: "immersiverailroading:gui/default/common/scale.caml" + + element: + image = "immersiverailroading:gui/default/diesel/diesel_base.png" + x = -120 + y = -190 + + element: + x = 55 + element: + y = 2.5 + image = "immersiverailroading:gui/default/diesel/dial.png" + import: "immersiverailroading:gui/default/diesel/gauge_speed_face.caml" + + element: + y = 65 + image = "immersiverailroading:gui/default/diesel/dial.png" + import: "immersiverailroading:gui/default/diesel/gauge_brake_face.caml" + + element: + y = 127.5 + image = "immersiverailroading:gui/default/diesel/dial.png" + import: "immersiverailroading:gui/default/diesel/gauge_temperature_face.caml" + + + element: + element: + x = 5 + y = 80 + image = "immersiverailroading:gui/default/diesel/horn.png" + + readout = HORN + + rotate = + x = 0 + y = 10 + degrees = 10 + + element: + x = 5 + y = 95 + image = "immersiverailroading:gui/default/diesel/button.png" + + readout = ENGINE + toggle = true + color = + 0.0 = 0xFF006000 + 1.0 = 0xFF008000 + + element: + x = 35 + y = 95 + image = "immersiverailroading:gui/default/diesel/button.png" + + readout = BELL + toggle = true + color = + 0.0 = 0xFFAAAA00 + 1.0 = 0xFFCCCC00 + + element: + x = 5 + y = 115 + image = "immersiverailroading:gui/default/diesel/throttle_base.png" + + element: + x = 11.5 + y = 13 + image = "immersiverailroading:gui/default/diesel/throttle_lever.png" + readout = "THROTTLE" + rotate = + x = 1.5 + y = -13 + degrees = -90 + offset = 45 + sound = + engage = "immersiverailroading:sounds/default/lever_engage.ogg" + disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" + + element: + x = 34 + y = 115 + image = "immersiverailroading:gui/default/diesel/reverser_base.png" + + element: + x = 9 + y = 10 + image = "immersiverailroading:gui/default/diesel/reverser_lever.png" + readout = "REVERSER" + rotate = + x = 1 + y = -10 + degrees = -90 + offset = 45 + sound = + engage = "immersiverailroading:sounds/default/lever_engage.ogg" + disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" + + element: + x = 12 + y = 145 + image = "immersiverailroading:gui/default/diesel/brake_stand.png" + + element: + x = 10 + y = 2.5 + image = "immersiverailroading:gui/default/diesel/brake_lever.png" + readout = "TRAIN_BRAKE_LEVER" + rotate = + x = -5 + y = 2.5 + degrees = 30 + offset = -15 + color = + 0.0 = 0xFF806600 + sound = + engage = "immersiverailroading:sounds/default/lever_engage.ogg" + move = "immersiverailroading:sounds/default/pressure.ogg" + disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" + + element: + x = 12 + y = 165 + image = "immersiverailroading:gui/default/diesel/brake_stand.png" + element: + x = 10 + y = 2.5 + image = "immersiverailroading:gui/default/diesel/brake_lever.png" + readout = "INDEPENDENT_BRAKE" + rotate = + x = -5 + y = 2.5 + degrees = -15 + offset = 0 + color = + 0.0 = 0xFF800000 + sound = + engage = "immersiverailroading:sounds/default/lever_engage.ogg" + disengage = "immersiverailroading:sounds/default/lever_disengage.ogg" diff --git a/src/main/resources/assets/immersiverailroading/gui/default/handcar.caml b/src/main/resources/assets/immersiverailroading/gui/default/handcar.caml index ffc8b30bf..44cc59080 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/handcar.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/handcar.caml @@ -1,43 +1,52 @@ element: - # left panel - x = 10 - y = -95 - image = "immersiverailroading:gui/overlay_handcar.png" - element: - # ind brake - x = 14 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "INDEPENDENT_BRAKE" - translate = - x = 0 - y = -50 - element: - # reverser - x = 35 - y = 74 - image = "immersiverailroading:gui/indicator.png" - readout = "REVERSER" - translate = - x = 0 - y = -50 - element: - # speed readout - text = - value = "stat.speed" - height = 6 - x = 30 - y = 8 + import: "immersiverailroading:gui/default/common/settings.caml" + +element: + import: "immersiverailroading:gui/default/common/opacity.caml" element: - # top labels - y = 19 - element: - x = 20 - text = - value = "label.brake" - height = 4 + import: "immersiverailroading:gui/default/common/scale.caml" + screen_x = LEFT + screen_y = BOTTOM element: - x = 38 - text = - value = "label.throttle" - height = 4 + # left panel + x = 10 + y = -95 + image = "immersiverailroading:gui/overlay_handcar.png" + element: + # ind brake + x = 14 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "INDEPENDENT_BRAKE" + translate = + x = 0 + y = -50 + element: + # reverser + x = 35 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "REVERSER" + translate = + x = 0 + y = -50 + element: + # speed readout + text = + value = "stat.speed" + height = 6 + x = 30 + y = 8 + element: + # top labels + y = 19 + element: + x = 20 + text = + value = "label.brake" + height = 4 + element: + x = 38 + text = + value = "label.throttle" + height = 4 diff --git a/src/main/resources/assets/immersiverailroading/gui/default/independent.caml b/src/main/resources/assets/immersiverailroading/gui/default/independent.caml index 7d2838a51..abde13071 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/independent.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/independent.caml @@ -1,20 +1,29 @@ element: - # left panel - x = 10 - y = -95 - image = "immersiverailroading:gui/overlay_independent.png" - element: - # ind brake - x = 4 - y = 59 - image = "immersiverailroading:gui/indicator.png" - readout = "INDEPENDENT_BRAKE" - translate = - x = 0 - y = -50 + import: "immersiverailroading:gui/default/common/settings.caml" + +element: + import: "immersiverailroading:gui/default/common/opacity.caml" element: - x = 9 - y = 4 - text = - value = "label.brake" - height = 4 + import: "immersiverailroading:gui/default/common/scale.caml" + screen_x = LEFT + screen_y = BOTTOM + element: + # left panel + x = 10 + y = -95 + image = "immersiverailroading:gui/overlay_independent.png" + element: + # ind brake + x = 4 + y = 59 + image = "immersiverailroading:gui/indicator.png" + readout = "INDEPENDENT_BRAKE" + translate = + x = 0 + y = -50 + element: + x = 9 + y = 4 + text = + value = "label.brake" + height = 4 diff --git a/src/main/resources/assets/immersiverailroading/gui/default/steam.caml b/src/main/resources/assets/immersiverailroading/gui/default/steam.caml index dd74b1da1..0dc072dcb 100644 --- a/src/main/resources/assets/immersiverailroading/gui/default/steam.caml +++ b/src/main/resources/assets/immersiverailroading/gui/default/steam.caml @@ -1,69 +1,17 @@ element: import: "immersiverailroading:gui/default/common/settings.caml" + element: import: "immersiverailroading:gui/default/common/opacity.caml" element: - screen_x = RIGHT - screen_y = BOTTOM - import: "immersiverailroading:gui/default/common/scale.caml" - - element: - y = -60 - element: - import: "immersiverailroading:gui/default/steam/dial_right.caml" - import: "immersiverailroading:gui/default/steam/gauge_speed_face.caml" - - element: - y = -120 - element: - import: "immersiverailroading:gui/default/steam/dial_right.caml" - import: "immersiverailroading:gui/default/steam/gauge_brake_face.caml" - - element: - x = -70 - import: "immersiverailroading:gui/default/steam/reverser.caml" - - element: - y = -65 - import: "immersiverailroading:gui/default/steam/brake_lever.caml" - - element: - y = -150 - import: "immersiverailroading:gui/default/steam/throttle.caml" - - element: - screen_x = RIGHT - screen_y = TOP - import: "immersiverailroading:gui/default/common/scale.caml" - - element: - import: "immersiverailroading:gui/default/steam/whistle.caml" + setting = "legacy_gui" + translucent = true + invert = true + import: "immersiverailroading:gui/default/steam_v0.caml" element: - screen_x = LEFT - screen_y = MIDDLE - import: "immersiverailroading:gui/default/common/scale.caml" - - element: - y = -50 - x = -90 - import: "immersiverailroading:gui/default/steam/gauge_water_left.caml" - - element: - screen_x = LEFT - screen_y = TOP - import: "immersiverailroading:gui/default/common/scale.caml" - - element: - x = 0 - element: - import: "immersiverailroading:gui/default/steam/dial_up.caml" - import: "immersiverailroading:gui/default/steam/gauge_boiler_face.caml" - - element: - x = 60 - element: - import: "immersiverailroading:gui/default/steam/dial_up.caml" - import: "immersiverailroading:gui/default/steam/gauge_temperature_face.caml" \ No newline at end of file + setting = "legacy_gui" + translucent = true + import: "immersiverailroading:gui/default/steam_v1.caml" diff --git a/src/main/resources/assets/immersiverailroading/gui/default/steam_v0.caml b/src/main/resources/assets/immersiverailroading/gui/default/steam_v0.caml new file mode 100644 index 000000000..43ed2ea3c --- /dev/null +++ b/src/main/resources/assets/immersiverailroading/gui/default/steam_v0.caml @@ -0,0 +1,161 @@ +element: + screen_x = LEFT + screen_y = BOTTOM + import: "immersiverailroading:gui/default/common/scale.caml" + element: + # left panel + x = 10 + y = -95 + image = "immersiverailroading:gui/overlay_steam.png" + element: + # water level + x = 5 + y = 75 + image = "immersiverailroading:gui/fluid.png" + readout = "LIQUID" + translate = + x = 0 + y = -50 + scale = + y = 1 + color = + 0 = "0xAA0F0FFF" + element: + # steam level + x = 25 + y = 75 + image = "immersiverailroading:gui/fluid.png" + readout = "BOILER_PRESSURE" + translate = + x = 0 + y = -50 + scale = + y = 1 + color = + 0 = "0x99DDDDDD" + element: + # boiler temp + x = 45 + y = 75 + image = "immersiverailroading:gui/fluid.png" + readout = "TEMPERATURE" + translate = + x = 0 + y = -40 + scale = + y = 0.8 + color = + 0 = "0x99d1c715" + 0.95 = "0x99d16c15" + 1.05 = "0x99a21010" + element: + # brake pressure + x = 61 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "BRAKE_PRESSURE" + translate = + x = 0 + y = -50 + color = + 0.0 = "0xDDa22020" + element: + # train brake + x = 61 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "TRAIN_BRAKE" + translate = + x = 0 + y = -50 + element: + # ind brake + x = 67 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "INDEPENDENT_BRAKE" + translate = + x = 0 + y = -50 + element: + # throttle + x = 81 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "THROTTLE" + translate = + x = 0 + y = -50 + element: + # reverser + x = 87 + y = 74 + image = "immersiverailroading:gui/indicator.png" + readout = "REVERSER" + translate = + x = 0 + y = -50 + element: + # speed readout + text = + value = "stat.speed stat.units_speed" + height = 6 + x = 50 + y = 8 + element: + # top labels + y = 19 + element: + x = 10 + text = + value = "stat.liquidstat.units_liquid" + height = 4 + element: + x = 30 + text = + value = "stat.boiler_pressurestat.units_boiler_pressure" + height = 4 + element: + x = 50 + text = + value = "stat.temperaturestat.units_temperature" + height = 4 + element: + x = 68 + text = + value = "label.brake" + height = 4 + element: + x = 89 + text = + value = "label.throttle" + height = 4 + element: + # bottom labels + y = 78 + element: + x = 10 + text = + value = "stat.max_liquidstat.units_liquid" + height = 4 + element: + x = 30 + text = + value = "stat.max_boiler_pressurestat.units_boiler_pressure" + height = 4 + element: + x = 50 + y = 0 + text = + value = "stat.max_temperaturestat.units_temperature" + height = 4 + element: + x = 68 + text = + value = "" + height = 4 + element: + x = 89 + text = + value = "label.reverser" + height = 4 \ No newline at end of file diff --git a/src/main/resources/assets/immersiverailroading/gui/default/steam_v1.caml b/src/main/resources/assets/immersiverailroading/gui/default/steam_v1.caml new file mode 100644 index 000000000..70d3f8e0f --- /dev/null +++ b/src/main/resources/assets/immersiverailroading/gui/default/steam_v1.caml @@ -0,0 +1,63 @@ +element: + screen_x = RIGHT + screen_y = BOTTOM + import: "immersiverailroading:gui/default/common/scale.caml" + + element: + y = -60 + element: + import: "immersiverailroading:gui/default/steam/dial_right.caml" + import: "immersiverailroading:gui/default/steam/gauge_speed_face.caml" + + element: + y = -120 + element: + import: "immersiverailroading:gui/default/steam/dial_right.caml" + import: "immersiverailroading:gui/default/steam/gauge_brake_face.caml" + + element: + x = -70 + import: "immersiverailroading:gui/default/steam/reverser.caml" + + element: + y = -65 + import: "immersiverailroading:gui/default/steam/brake_lever.caml" + + element: + y = -150 + import: "immersiverailroading:gui/default/steam/throttle.caml" + +element: + screen_x = RIGHT + screen_y = TOP + import: "immersiverailroading:gui/default/common/scale.caml" + + element: + import: "immersiverailroading:gui/default/steam/whistle.caml" + +element: + screen_x = LEFT + screen_y = MIDDLE + import: "immersiverailroading:gui/default/common/scale.caml" + + element: + y = -50 + x = -90 + import: "immersiverailroading:gui/default/steam/gauge_water_left.caml" + +element: + screen_x = LEFT + screen_y = TOP + import: "immersiverailroading:gui/default/common/scale.caml" + + element: + x = 0 + element: + import: "immersiverailroading:gui/default/steam/dial_up.caml" + import: "immersiverailroading:gui/default/steam/gauge_boiler_face.caml" + + element: + x = 60 + element: + import: "immersiverailroading:gui/default/steam/dial_up.caml" + import: "immersiverailroading:gui/default/steam/gauge_temperature_face.caml" \ No newline at end of file From bd34c22fef19d1e8f605fcfc442ac1f5e76c7166 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Wed, 4 Oct 2023 13:06:08 -0400 Subject: [PATCH 5/5] Fix minor issue with occasional crash on logout --- .../immersiverailroading/model/part/SwaySimulator.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/cam72cam/immersiverailroading/model/part/SwaySimulator.java b/src/main/java/cam72cam/immersiverailroading/model/part/SwaySimulator.java index 45dbbdb0c..6880e7b39 100644 --- a/src/main/java/cam72cam/immersiverailroading/model/part/SwaySimulator.java +++ b/src/main/java/cam72cam/immersiverailroading/model/part/SwaySimulator.java @@ -111,8 +111,13 @@ public double getRollDegrees() { } public void removed() { - clackFront.stop(); - clackRear.stop(); + // These should never be null, but for some reason they are + if (clackFront != null) { + clackFront.stop(); + } + if (clackRear != null) { + clackRear.stop(); + } } }