Fixed NPE crash when trying to transport into orbit from hyperspace
Improved usability in transporter jammed status report
This commit is contained in:
parent
084b03c935
commit
ffb6472051
5 changed files with 29 additions and 6 deletions
|
@ -731,14 +731,16 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
|
|||
if (vRequest.y < 0) {
|
||||
final CelestialObject celestialObjectChild = CelestialObjectManager.getClosestChild(world, pos.getX(), pos.getZ());
|
||||
if (celestialObjectChild == null) {
|
||||
reasonJammed = "Not in orbit of a planet";
|
||||
reasonJammed = "Not in orbit of a planet!\nIncrease target Y coordinate.";
|
||||
} else {
|
||||
vRequest.translate(celestialObjectChild.getEntryOffset());
|
||||
globalPositionRemoteNew = new GlobalPosition(celestialObjectChild.dimensionId, vRequest.x, (vRequest.y + 1024) % 256, vRequest.z);
|
||||
}
|
||||
} else if (vRequest.y > 256) {
|
||||
if (celestialObjectLocal == null) {
|
||||
reasonJammed = "Unknown dimension, no reachable orbit";
|
||||
reasonJammed = "Unknown local celestial object!\nThere's no orbit to reach from here.\nReduce target Y coordinate.";
|
||||
} else if (celestialObjectLocal.parent == null) {
|
||||
reasonJammed = "No parent dimension!\nThere's no orbit to reach from here.\nReduce target Y coordinate.";
|
||||
} else {
|
||||
vRequest.translateBack(celestialObjectLocal.getEntryOffset());
|
||||
globalPositionRemoteNew = new GlobalPosition(celestialObjectLocal.parent.dimensionId, vRequest.x, vRequest.y % 256, vRequest.z);
|
||||
|
@ -806,7 +808,7 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
|
|||
&& celestialObjectLocal.isHyperspace() )
|
||||
|| celestialObjectRemote.isHyperspace() ) {
|
||||
isJammed = true;
|
||||
reasonJammed = "Blocked by warp field barrier";
|
||||
reasonJammed = "Blocked by warp field barrier!\nExit hyperspace to use transporter room.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -827,7 +829,8 @@ public class TileEntityTransporterCore extends TileEntityAbstractEnergyCoreOrCon
|
|||
celestialObjectRemote.dimensionId,
|
||||
this));
|
||||
isJammed = true;
|
||||
reasonJammed = String.format("Unable to initialize dimension %d", celestialObjectRemote.dimensionId);
|
||||
reasonJammed = String.format("Unable to initialize dimension %d",
|
||||
celestialObjectRemote.dimensionId);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -161,6 +161,15 @@ local function writeLn(text)
|
|||
w.setCursorPos(1, y + 1)
|
||||
end
|
||||
|
||||
local function writeMultiLine(text)
|
||||
local textToParse = text or ""
|
||||
for line in string.gmatch(textToParse, "[^\n]+") do
|
||||
if line ~= "" then
|
||||
w.writeLn(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function writeCentered(y, text)
|
||||
local unused
|
||||
if text == nil then
|
||||
|
@ -1270,6 +1279,7 @@ w = {
|
|||
clear = clear,
|
||||
clearLine = clearLine,
|
||||
writeLn = writeLn,
|
||||
writeMultiLine = writeMultiLine,
|
||||
writeCentered = writeCentered,
|
||||
writeFullLine = writeFullLine,
|
||||
page_begin = page_begin,
|
||||
|
|
|
@ -153,7 +153,7 @@ function transporter_page()
|
|||
if isJammed then
|
||||
w.setColorBad()
|
||||
end
|
||||
w.write(state)
|
||||
w.writeMultiLine(state)
|
||||
w.setColorNormal()
|
||||
w.write(".")
|
||||
end
|
||||
|
|
|
@ -172,6 +172,15 @@ local function writeLn(text)
|
|||
end
|
||||
end
|
||||
|
||||
local function writeMultiLine(text)
|
||||
local textToParse = text or ""
|
||||
for line in string.gmatch(textToParse, "[^\n]+") do
|
||||
if line ~= "" then
|
||||
w.writeLn(line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function writeCentered(y, text)
|
||||
local unused
|
||||
if text == nil then
|
||||
|
@ -1251,6 +1260,7 @@ w = {
|
|||
clear = clear,
|
||||
clearLine = clearLine,
|
||||
writeLn = writeLn,
|
||||
writeMultiLine = writeMultiLine,
|
||||
writeCentered = writeCentered,
|
||||
writeFullLine = writeFullLine,
|
||||
page_begin = page_begin,
|
||||
|
|
|
@ -152,7 +152,7 @@ function transporter_page()
|
|||
if isJammed then
|
||||
w.setColorBad()
|
||||
end
|
||||
w.write(state)
|
||||
w.writeMultiLine(state)
|
||||
w.setColorNormal()
|
||||
w.write(".")
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue