Desperate detours

- Fixed constant updates firing from stockpile switches
- Fixed navigation not factoring in red signals leading to occupied blocks
- Fixed navigation not updating when waiting for a red chain signal near a station
- Fixed train carriages with passengers not spawning in correctly
- Railway Casing -> Train Casing
This commit is contained in:
simibubi 2022-05-23 23:08:47 +02:00
parent cafe7a8b9b
commit 142e2f6dab
25 changed files with 71 additions and 68 deletions

View file

@ -544,23 +544,23 @@ bf2b0310500213ff853c748c236eb5d01f61658e assets/create/blockstates/yellow_toolbo
6801fa1f466f172700e573e5b8ee8ee5f9ca4583 assets/create/blockstates/yellow_valve_handle.json
7f39521b211441f5c3e06d60c5978cebe16cacfb assets/create/blockstates/zinc_block.json
b7181bcd8182b2f17088e5aa881f374c9c65470c assets/create/blockstates/zinc_ore.json
bc34b2c5574a903a43729369b32c8981a4098ac1 assets/create/lang/en_ud.json
8ff43211f8611542dc2b80125eabe13153bc1fbf assets/create/lang/en_us.json
8bf1cfb8b68fd54b9cb796360beba73d83b2ec7f assets/create/lang/unfinished/de_de.json
0ce3a240ac9fa0b44674cf886a71dfe43f2bd164 assets/create/lang/unfinished/es_cl.json
3b28c641fdb7ff5eee3b81ffc7b6f37ce38194e3 assets/create/lang/unfinished/es_es.json
c15da57f79901b1cddbf6fa3d94e953480ab9467 assets/create/lang/unfinished/fr_fr.json
c2e763d4e611143f9a42c0a6a0b8cfa58f254b37 assets/create/lang/unfinished/it_it.json
5a173ee5e1f6b5a6ffeff2b301c28e9f75eb762c assets/create/lang/unfinished/ja_jp.json
a1d09b3588d98762d0fa56fece59e600507311da assets/create/lang/unfinished/ko_kr.json
9ad05595229b0ac2ef8d8b21d43dc86396167485 assets/create/lang/unfinished/nl_nl.json
76052baa07a1c9d34a5e98e75e1c7f8a935076c9 assets/create/lang/unfinished/pl_pl.json
f7dd233fa675c1c2c1ff6c4402c16744c6189616 assets/create/lang/unfinished/pt_br.json
541b9a302d8ddf3827f29a7ab67b482e345bc207 assets/create/lang/unfinished/pt_pt.json
69ba5f485d16706f5438856162fcc337d23c5400 assets/create/lang/unfinished/ro_ro.json
64431b39b4cfa1fe1988ec8c4f36145e66714847 assets/create/lang/unfinished/ru_ru.json
54faaacfdf8aa4ee3575fbc9ee6e81b5f9bcffe0 assets/create/lang/unfinished/zh_cn.json
e8db253724c9b2eeb07b4587d3efb10811941df5 assets/create/lang/unfinished/zh_tw.json
218909cbc3671e376253d8af1d930be6b1ad8988 assets/create/lang/en_ud.json
47eaa8bf35cecdd519345b64a4ea64f85a05cf4e assets/create/lang/en_us.json
10c52355535ca985fc573090090f2ef635b69ded assets/create/lang/unfinished/de_de.json
b319f91f29cfa0610266ec04cf81d6bcb67655fe assets/create/lang/unfinished/es_cl.json
3e81086283e90d64cdf82acda4d2585fe8b47dd2 assets/create/lang/unfinished/es_es.json
7cd6da27541e2bb9ec6d9254e8f5dcb4bd182d2c assets/create/lang/unfinished/fr_fr.json
9eb92a896d3aff2ff09a705b02bf68bbf6a8143d assets/create/lang/unfinished/it_it.json
6c4349c4964946b229bd9d4c159ceb5b32e9571a assets/create/lang/unfinished/ja_jp.json
0a10d8eb065f0d857514d913bbe7c8b6f4c5a625 assets/create/lang/unfinished/ko_kr.json
579b19fc309057bd3c5d77783d2326be1f57b4cb assets/create/lang/unfinished/nl_nl.json
aa1a27591572ef8bef422766dba95bd824b90ff1 assets/create/lang/unfinished/pl_pl.json
7efbd473e0aee14a439527706a2c40dbfc96b811 assets/create/lang/unfinished/pt_br.json
3f4c4cc0078717645bb9f844999e0d92e7ba5b02 assets/create/lang/unfinished/pt_pt.json
f686b3e2df2feb232713545ff846b93f3e4fe45b assets/create/lang/unfinished/ro_ro.json
95d8fe9d0744eda905dd2b7d6aa73203d8a3f82a assets/create/lang/unfinished/ru_ru.json
23dea7cab680a529ec7689cc5bbfea1248dd59e5 assets/create/lang/unfinished/zh_cn.json
ebba34f4159bb1f4437fa52b11bf73aea9945fb0 assets/create/lang/unfinished/zh_tw.json
487a511a01b2a4531fb672f917922312db78f958 assets/create/models/block/acacia_window.json
b48060cba1a382f373a05bf0039054053eccf076 assets/create/models/block/acacia_window_pane_noside.json
3066db1bf03cffa1a9c7fbacf47ae586632f4eb3 assets/create/models/block/acacia_window_pane_noside_alt.json

View file

@ -392,7 +392,7 @@
"block.create.purple_toolbox": "xoq\u05DFoo\u27D8 \u01DD\u05DFd\u0279n\u0500",
"block.create.purple_valve_handle": "\u01DD\u05DFpu\u0250H \u01DD\u028C\u05DF\u0250\u039B \u01DD\u05DFd\u0279n\u0500",
"block.create.radial_chassis": "s\u0131ss\u0250\u0265\u0186 \u05DF\u0250\u0131p\u0250\u1D1A",
"block.create.railway_casing": "bu\u0131s\u0250\u0186 \u028E\u0250\u028D\u05DF\u0131\u0250\u1D1A",
"block.create.railway_casing": "bu\u0131s\u0250\u0186 u\u0131\u0250\u0279\u27D8",
"block.create.raw_zinc_block": "\u0254u\u0131Z \u028D\u0250\u1D1A \u025Fo \u029E\u0254o\u05DF\u15FA",
"block.create.red_nixie_tube": "\u01DDqn\u27D8 \u01DD\u0131x\u0131N p\u01DD\u1D1A",
"block.create.red_sail": "\u05DF\u0131\u0250S p\u01DD\u1D1A",

View file

@ -395,7 +395,7 @@
"block.create.purple_toolbox": "Purple Toolbox",
"block.create.purple_valve_handle": "Purple Valve Handle",
"block.create.radial_chassis": "Radial Chassis",
"block.create.railway_casing": "Railway Casing",
"block.create.railway_casing": "Train Casing",
"block.create.raw_zinc_block": "Block of Raw Zinc",
"block.create.red_nixie_tube": "Red Nixie Tube",
"block.create.red_sail": "Red Sail",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Violetter Werkzeugkasten",
"block.create.purple_valve_handle": "Violetter Ventilgriff",
"block.create.radial_chassis": "Drehgerüst",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "Rohzinkblock",
"block.create.red_nixie_tube": "Rote Nixie-Röhre",
"block.create.red_sail": "Rote Segel",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Caja de Herramientas Morada",
"block.create.purple_valve_handle": "Válvula Morada",
"block.create.radial_chassis": "Chasis Radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "Tubo Nixie Rojo",
"block.create.red_sail": "Vela Roja",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Caja de herramientas púrpura",
"block.create.purple_valve_handle": "Asa de válvula morada",
"block.create.radial_chassis": "Chasis radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "Bloque de cinc en bruto",
"block.create.red_nixie_tube": "Tubo Nixie rojo",
"block.create.red_sail": "Vela roja",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "UNLOCALIZED: Purple Valve Handle",
"block.create.radial_chassis": "Châssis radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "UNLOCALIZED: Red Nixie Tube",
"block.create.red_sail": "UNLOCALIZED: Red Sail",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "Maniglia per valvola viola",
"block.create.radial_chassis": "Telaio radiale",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "UNLOCALIZED: Red Nixie Tube",
"block.create.red_sail": "Vela rossa",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "紫色の工具箱",
"block.create.purple_valve_handle": "紫色のバルブハンドル",
"block.create.radial_chassis": "ラジアルシャーシ",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "亜鉛の原石ブロック",
"block.create.red_nixie_tube": "赤色のニキシー管",
"block.create.red_sail": "赤色の帆",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "보라색 공구상자",
"block.create.purple_valve_handle": "보라색 밸브 손잡이",
"block.create.radial_chassis": "원형 섀시",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "아연 원석 블록",
"block.create.red_nixie_tube": "빨간색 닉시관",
"block.create.red_sail": "빨간색 날개",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "UNLOCALIZED: Purple Valve Handle",
"block.create.radial_chassis": "Rotation Frame",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "UNLOCALIZED: Red Nixie Tube",
"block.create.red_sail": "UNLOCALIZED: Red Sail",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "Fioletowe pokrętło",
"block.create.radial_chassis": "Stelaż promienisty",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "Czerwona lampa cyfrowa",
"block.create.red_sail": "Czerwony żagiel",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Caixa de ferramentas roxa",
"block.create.purple_valve_handle": "válvula roxa",
"block.create.radial_chassis": "Chassis Radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "Bloco de zinco bruto",
"block.create.red_nixie_tube": "Tubo nixie vermelho",
"block.create.red_sail": "Vela vermelha",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Caixa de ferramentas roxa",
"block.create.purple_valve_handle": "válvula roxa",
"block.create.radial_chassis": "Chassis Radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "Bloco de zinco bruto",
"block.create.red_nixie_tube": "Tubo nixie vermelho",
"block.create.red_sail": "Vela vermelha",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "Trusă De Scule Violetă",
"block.create.purple_valve_handle": "Mâner De Supapă Violet",
"block.create.radial_chassis": "Șasiu Radial",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "Bloc De Zinc Brut",
"block.create.red_nixie_tube": "Tub Nixie Roșu",
"block.create.red_sail": "Velă Roșie",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "Фиолетовый ручной вентиль",
"block.create.radial_chassis": "Радиальное шасси",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "Красный газоразрядный индикатор",
"block.create.red_sail": "Красный парус",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "紫色工具箱",
"block.create.purple_valve_handle": "紫色阀门手轮",
"block.create.radial_chassis": "旋转底盘",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "粗锌块",
"block.create.red_nixie_tube": "红色辉光管",
"block.create.red_sail": "红色风帆",

View file

@ -396,7 +396,7 @@
"block.create.purple_toolbox": "UNLOCALIZED: Purple Toolbox",
"block.create.purple_valve_handle": "紫色閥門開關",
"block.create.radial_chassis": "旋轉底盤",
"block.create.railway_casing": "UNLOCALIZED: Railway Casing",
"block.create.railway_casing": "UNLOCALIZED: Train Casing",
"block.create.raw_zinc_block": "UNLOCALIZED: Block of Raw Zinc",
"block.create.red_nixie_tube": "紅色真空管",
"block.create.red_sail": "紅色風帆",

View file

@ -1458,6 +1458,7 @@ public class AllBlocks {
() -> AllSpriteShifts.RAILWAY_CASING))
.properties(p -> p.color(MaterialColor.TERRACOTTA_CYAN))
.properties(p -> p.sound(SoundType.NETHERITE_BLOCK))
.lang("Train Casing")
.register();
public static final BlockEntry<StationBlock> TRACK_STATION = REGISTRATE.block("track_station", StationBlock::new)

View file

@ -55,11 +55,11 @@ public class StockpileSwitchBlock extends HorizontalDirectionalBlock implements
@Override
public void onNeighborChange(BlockState state, LevelReader world, BlockPos pos, BlockPos neighbor) {
if (world.isClientSide())
return;
if (!isObserving(state, pos, neighbor))
return;
updateObservedInventory(state, world, pos);
// if (world.isClientSide())
// return;
// if (!isObserving(state, pos, neighbor))
// return;
// updateObservedInventory(state, world, pos);
}
@Override

View file

@ -1,7 +1,6 @@
package com.simibubi.create.content.logistics.trains.entity;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@ -40,7 +39,6 @@ import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.util.Mth;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.Entity.RemovalReason;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
@ -102,18 +100,9 @@ public class Carriage {
contraption.onEntityInitialize(level, entity);
updateContraptionAnchors();
getDimensional(level).alignEntity(entity);
List<Entity> players = new ArrayList<>();
for (Entity passenger : entity.getPassengers())
if (!(passenger instanceof Player))
passenger.remove(RemovalReason.UNLOADED_WITH_PLAYER);
else
players.add(passenger);
for (Entity player : players)
player.stopRiding();
serialisedEntity = entity.serializeNBT();
DimensionalCarriageEntity dimensional = getDimensional(level);
dimensional.alignEntity(entity);
dimensional.removeAndSaveEntity(entity, false);
}
public DimensionalCarriageEntity getDimensional(Level level) {
@ -772,16 +761,15 @@ public class Carriage {
}
private void createEntity(Level level, boolean loadPassengers) {
Entity entity = EntityType.loadEntityRecursive(serialisedEntity, level, e -> {
e.moveTo(positionAnchor);
return e;
});
Entity entity = EntityType.create(serialisedEntity, level)
.orElse(null);
if (!(entity instanceof CarriageContraptionEntity cce)) {
train.invalid = true;
return;
}
entity.moveTo(positionAnchor);
this.entity = new WeakReference<>(cce);
cce.setGraph(train.graph == null ? null : train.graph.id);
@ -789,7 +777,7 @@ public class Carriage {
cce.syncCarriage();
if (level instanceof ServerLevel sl)
sl.tryAddFreshEntityWithPassengers(entity);
sl.addFreshEntity(entity);
updatePassengerLoadout();
}

View file

@ -25,7 +25,6 @@ import com.simibubi.create.content.logistics.trains.TrackGraph;
import com.simibubi.create.content.logistics.trains.entity.Carriage.DimensionalCarriageEntity;
import com.simibubi.create.content.logistics.trains.entity.TravellingPoint.SteerDirection;
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.GlobalStation;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.Color;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Lang;

View file

@ -32,7 +32,6 @@ import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.SignalEdgeGroup;
import com.simibubi.create.content.logistics.trains.management.edgePoint.signal.TrackEdgePoint;
import com.simibubi.create.content.logistics.trains.management.edgePoint.station.GlobalStation;
import com.simibubi.create.foundation.config.AllConfigs;
import com.simibubi.create.foundation.utility.Couple;
import com.simibubi.create.foundation.utility.Iterate;
import com.simibubi.create.foundation.utility.NBTHelper;
@ -222,8 +221,10 @@ public class Navigation {
// dont leave until green light
if (targetDistance > 1 / 32f && train.getCurrentStation() != null) {
if (waitingForSignal != null && distanceToSignal < preDepartureLookAhead)
if (waitingForSignal != null && distanceToSignal < preDepartureLookAhead) {
ticksWaitingForSignal++;
return;
}
train.leaveStation();
}
@ -576,6 +577,7 @@ public class Navigation {
double distanceToNode2 = forward ? initialEdge.getLength() - startingPoint.position : startingPoint.position;
frontier.add(new FrontierEntry(distanceToNode2, 0, initialNode1, initialNode2, initialEdge));
int signalWeight = Mth.clamp(ticksWaitingForSignal * 2, Train.Penalties.RED_SIGNAL, 200);
Search: while (!frontier.isEmpty()) {
FrontierEntry entry = frontier.poll();
@ -604,6 +606,18 @@ public class Navigation {
continue Search;
if (!point.canNavigateVia(node2))
continue Search;
if (point instanceof SignalBoundary signal) {
UUID group = signal.getGroup(node2);
if (group == null)
continue;
SignalEdgeGroup signalEdgeGroup = Create.RAILWAYS.signalEdgeGroups.get(group);
if (signalEdgeGroup == null)
continue;
if (signalEdgeGroup.isOccupiedUnless(signal)) {
penalty += signalWeight;
signalWeight /= 2;
}
}
if (point instanceof GlobalStation station) {
Train presentTrain = station.getPresentTrain();
boolean isOwnStation = presentTrain == train;

View file

@ -845,7 +845,8 @@ public class Train {
public static class Penalties {
static final int STATION = 200, STATION_WITH_TRAIN = 300;
static final int MANUAL_TRAIN = 200, IDLE_TRAIN = 700, ARRIVING_TRAIN = 50, WAITING_TRAIN = 50, ANY_TRAIN = 25;
static final int MANUAL_TRAIN = 200, IDLE_TRAIN = 700, ARRIVING_TRAIN = 50, WAITING_TRAIN = 50, ANY_TRAIN = 25,
RED_SIGNAL = 25;
}
public int getNavigationPenalty() {

View file

@ -220,7 +220,7 @@ public class AssemblyScreen extends AbstractStationScreen {
new TextComponent(bogeyCount == 0 ? "No Bogeys" : bogeyCount + (bogeyCount == 1 ? " Bogey" : " Bogeys"));
font.draw(ms, text, x + 97 - font.width(text) / 2, y + 47, 0x7A7A7A);
font.drawWordWrap(new TextComponent("Use Railway Casing on highlighted Tracks to create bogeys."), x + 28, y + 62, 134,
font.drawWordWrap(new TextComponent("Use Train Casing on highlighted Tracks to create bogeys."), x + 28, y + 62, 134,
0x7A7A7A);
font.drawWordWrap(new TextComponent("Remove bogeys by breaking the block on top."), x + 28, y + 94, 134,
0x7A7A7A);