From c7aff54e6b6813fdf30ce92e26504e1c04949df9 Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 13 Aug 2024 13:52:45 +0200 Subject: [PATCH 1/4] fix: issues with InterSignalBox --- .../signals/enums/PathwayRequestResult.java | 3 +-- .../DelayableInterSignalBoxPathway.java | 3 ++- .../signals/signalbox/InterSignalBoxPathway.java | 16 +++++++++------- .../signals/signalbox/SignalBoxGrid.java | 4 ++++ .../signals/signalbox/SignalBoxPathway.java | 4 ++++ 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/troblecodings/signals/enums/PathwayRequestResult.java b/src/main/java/com/troblecodings/signals/enums/PathwayRequestResult.java index 9399788b3..43a7f8654 100644 --- a/src/main/java/com/troblecodings/signals/enums/PathwayRequestResult.java +++ b/src/main/java/com/troblecodings/signals/enums/PathwayRequestResult.java @@ -34,8 +34,7 @@ public PathwayData getPathwayData() { } public boolean canBeAddedToSaver() { - return this == ALREADY_USED || this == NO_PATH - || !(data != null && !data.isInterSignalBoxPathway()); + return this == ALREADY_USED || this == NO_PATH; } public boolean isPass() { diff --git a/src/main/java/com/troblecodings/signals/signalbox/DelayableInterSignalBoxPathway.java b/src/main/java/com/troblecodings/signals/signalbox/DelayableInterSignalBoxPathway.java index 1cc822f7f..fb83dea53 100644 --- a/src/main/java/com/troblecodings/signals/signalbox/DelayableInterSignalBoxPathway.java +++ b/src/main/java/com/troblecodings/signals/signalbox/DelayableInterSignalBoxPathway.java @@ -40,7 +40,8 @@ public void updatePathwaySignals() { final Map distantSignalPositions = data .getOtherSignals(); this.isExecutingSignalSet = false; - pathwayToBlock.isExecutingSignalSet = false; + if (pathwayToBlock != null) + pathwayToBlock.isExecutingSignalSet = false; synchronized (distantSignalPositions) { setSignals(getLastSignalInfo()); } diff --git a/src/main/java/com/troblecodings/signals/signalbox/InterSignalBoxPathway.java b/src/main/java/com/troblecodings/signals/signalbox/InterSignalBoxPathway.java index d3c66fe5c..57fb0847c 100644 --- a/src/main/java/com/troblecodings/signals/signalbox/InterSignalBoxPathway.java +++ b/src/main/java/com/troblecodings/signals/signalbox/InterSignalBoxPathway.java @@ -151,6 +151,8 @@ protected SignalStateInfo getLastSignalInfo() { @Override protected void setSignals(final SignalStateInfo lastSignal) { + if (tile == null) + return; final StateInfo identifier = new StateInfo(tile.getWorld(), tile.getPos()); if (lastSignal != null && pathwayToReset != null) { final Signal signal = SignalBoxHandler.getSignal(identifier, lastSignal.pos); @@ -188,20 +190,20 @@ public boolean tryBlock(final BlockPos position) { protected void updateSignalStates() { final List redSignals = new ArrayList<>(); final List greenSignals = new ArrayList<>(); - final MainSignalIdentifier lastSignal = data.getEndSignal(); - if (lastSignal != null) { + final MainSignalIdentifier startSignal = data.getStartSignal(); + if (startSignal != null) { if (isBlocked) return; - final SignalState previous = lastSignal.state; - lastSignal.state = SignalState.GREEN; - if (!lastSignal.state.equals(previous)) - greenSignals.add(lastSignal); + final SignalState previous = startSignal.state; + startSignal.state = SignalState.GREEN; + if (!startSignal.state.equals(previous)) + greenSignals.add(startSignal); } final Map distantSignalPositions = data.getOtherSignals(); distantSignalPositions.values().forEach(position -> { final SignalBoxPathway next = getNextPathway(); final SignalState previous = position.state; - if (lastSignal != null && next != null && !next.isEmptyOrBroken()) { + if (startSignal != null && next != null && !next.isEmptyOrBroken()) { if (!next.isExecutingSignalSet) position.state = SignalState.GREEN; } else if (pathwayToBlock != null) { diff --git a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxGrid.java b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxGrid.java index 867219657..dbf280826 100644 --- a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxGrid.java +++ b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxGrid.java @@ -309,6 +309,10 @@ public List> getNextPathways() { public boolean addNextPathway(final Point start, final Point end) { final Map.Entry entry = Maps.immutableEntry(start, end); if (!nextPathways.contains(entry)) { + final SignalBoxPathway pw = startsToPath.get(start); + if (pw != null && pw.isInterSignalBoxPathway()) { + return false; + } if (executingForEach) { toAdd.add(entry); } else { diff --git a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxPathway.java b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxPathway.java index 53b706ec3..e68fd84d5 100644 --- a/src/main/java/com/troblecodings/signals/signalbox/SignalBoxPathway.java +++ b/src/main/java/com/troblecodings/signals/signalbox/SignalBoxPathway.java @@ -663,6 +663,10 @@ public boolean isShuntingPath() { public PathType getPathType() { return data.getPathType(); } + + public boolean isInterSignalBoxPathway() { + return this instanceof InterSignalBoxPathway; + } public SignalBoxGrid getGrid() { return grid; From 143ae84fd44825568fb20e21509bbd09ad04a471 Mon Sep 17 00:00:00 2001 From: Cedric Date: Tue, 13 Aug 2024 14:35:55 +0200 Subject: [PATCH 2/4] fix: Zs3V on when it should be off --- .../opensignals/signalconfigs/change/hv_hv_config.json | 9 +++++---- .../opensignals/signalconfigs/change/hv_ks_config.json | 7 ++++--- .../assets/opensignals/signalconfigs/change/hv_sema.json | 9 +++++---- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/main/resources/assets/opensignals/signalconfigs/change/hv_hv_config.json b/src/main/resources/assets/opensignals/signalconfigs/change/hv_hv_config.json index fc70e993f..4a4ea3f96 100644 --- a/src/main/resources/assets/opensignals/signalconfigs/change/hv_hv_config.json +++ b/src/main/resources/assets/opensignals/signalconfigs/change/hv_hv_config.json @@ -7,10 +7,6 @@ "slow": "config(stopsignal.HP2) || config(hphome.HP2)" }, "values": { - "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], - "map(drive)": ["distantsignal.VR1"], - "map(slow)": ["distantsignal.VR2"], - "signalRepeater(true)": ["vrlight.true"], "(config(zs3.Z1) || config(zs3plate.Z1))": ["zs3v.Z1"], "(config(zs3.Z2) || config(zs3plate.Z2))": ["zs3v.Z2"], @@ -28,6 +24,11 @@ "(config(zs3.Z14) || config(zs3plate.Z14))": ["zs3v.Z14"], "(config(zs3.Z15) || config(zs3plate.Z15))": ["zs3v.Z15"], + "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], + "map(drive)": ["distantsignal.VR1"], + "map(slow)": ["distantsignal.VR2"], + "signalRepeater(true)": ["vrlight.true"], + "speed(<.1) || speed(>.15)": ["stopsignal.HP1", "hphome.HP1", "hpblock.HP1"], "speed(==.1)": ["zs3.Z1", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], "speed(==.2)": ["zs3.Z2", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], diff --git a/src/main/resources/assets/opensignals/signalconfigs/change/hv_ks_config.json b/src/main/resources/assets/opensignals/signalconfigs/change/hv_ks_config.json index 8b755f9f8..36e38b66b 100644 --- a/src/main/resources/assets/opensignals/signalconfigs/change/hv_ks_config.json +++ b/src/main/resources/assets/opensignals/signalconfigs/change/hv_ks_config.json @@ -6,9 +6,6 @@ "drive": "config(kombisignal.KS1) || config(kombisignal_main.KS1) || config(kombisignal.KS1_BLINK) || config(kombisignal.KS1_BLINK_LIGHT) || config(kombisignal.KS2) || config(kombisignal.KS2_LIGHT)" }, "values": { - "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], - "map(drive)": ["distantsignal.VR1"], - "signalRepeater(true)": ["vrlight.true"], "(config(zs3.Z1) || config(zs3plate.Z1))": ["zs3v.Z1", "distantsignal.VR2"], "(config(zs3.Z2) || config(zs3plate.Z2))": ["zs3v.Z2", "distantsignal.VR2"], @@ -26,6 +23,10 @@ "(config(zs3.Z14) || config(zs3plate.Z14))": ["zs3v.Z14", "distantsignal.VR1"], "(config(zs3.Z15) || config(zs3plate.Z15))": ["zs3v.Z15", "distantsignal.VR1"], + "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], + "map(drive)": ["distantsignal.VR1"], + "signalRepeater(true)": ["vrlight.true"], + "speed(<.1) || speed(>.15)": ["stopsignal.HP1", "hphome.HP1", "hpblock.HP1"], "speed(==.1)": ["zs3.Z1", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], "speed(==.2)": ["zs3.Z2", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], diff --git a/src/main/resources/assets/opensignals/signalconfigs/change/hv_sema.json b/src/main/resources/assets/opensignals/signalconfigs/change/hv_sema.json index 67dba660a..6c0d12655 100644 --- a/src/main/resources/assets/opensignals/signalconfigs/change/hv_sema.json +++ b/src/main/resources/assets/opensignals/signalconfigs/change/hv_sema.json @@ -7,10 +7,6 @@ "slow": "config(wing1.TRUE) && config(wing2.TRUE)" }, "values": { - "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], - "map(drive)": ["distantsignal.VR1"], - "map(slow)": ["distantsignal.VR2"], - "signalRepeater(true)": ["vrlight.true"], "(config(zs3.Z1) || config(zs3plate.Z1))": ["zs3v.Z1"], "(config(zs3.Z2) || config(zs3plate.Z2))": ["zs3v.Z2"], @@ -28,6 +24,11 @@ "(config(zs3.Z14) || config(zs3plate.Z14))": ["zs3v.Z14"], "(config(zs3.Z15) || config(zs3plate.Z15))": ["zs3v.Z15"], + "map(stop)": ["distantsignal.VR0", "zs3v.OFF"], + "map(drive)": ["distantsignal.VR1"], + "map(slow)": ["distantsignal.VR2"], + "signalRepeater(true)": ["vrlight.true"], + "speed(<.1) || speed(>.15)": ["stopsignal.HP1", "hphome.HP1", "hpblock.HP1"], "speed(==.1)": ["zs3.Z1", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], "speed(==.2)": ["zs3.Z2", "stopsignal.HP2", "hphome.HP2", "hpblock.HP1"], From 1a63e9c5f98c149597a4fe5b0f9b7d7c22f00680 Mon Sep 17 00:00:00 2001 From: Cedric <103828586+Uhutown@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:09:49 +0200 Subject: [PATCH 3/4] update version --- .github/workflows/gradle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index abee88066..a193db65f 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -30,7 +30,7 @@ jobs: if: endswith(github.ref_name, 'master') && github.ref_protected && github.ref_type == 'branch' runs-on: ubuntu-latest env: - APPVEYOR_BUILD_VERSION: '3.6.0' + APPVEYOR_BUILD_VERSION: '3.6.1' CURSETOKEN: ${{ secrets.CURSETOKEN }} steps: - uses: actions/checkout@v3 From f78a6a6f033fb1bd8f35f13356d5b7e19c41226d Mon Sep 17 00:00:00 2001 From: Cedric <103828586+Uhutown@users.noreply.github.com> Date: Tue, 13 Aug 2024 15:10:51 +0200 Subject: [PATCH 4/4] Update changelog.md --- changelog.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/changelog.md b/changelog.md index 5579c2882..385086434 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## [1.12.2 - 3.6.1] +* fix: issues with InterSignalBoxPathways +* fix: issue with Zs3V in HV + ## [1.12.2 - 3.6.0] * feat: added black dots mast sign