Merge pull request #154 from asiekierka/gtnh-oc-1.8.9

Update to upstream 1.8.9a
This commit is contained in:
Maya 2025-06-03 09:59:11 -06:00 committed by GitHub
commit 538faeada2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 54 additions and 23 deletions

View File

@ -1,10 +1,11 @@
## Fixes/improvements
* [#3769] Add default user agent configuration option; change OpenComputers' default user agent to "opencomputers/$version".
* [#3759] Add V1 and V2 to the robot name list. (AutumnalModding)
* [#3727] Fix more regressions related to OpenOS error handling. (jasonS05, kcinnajlol)
* Fix client-side memory leak on anything RedstoneAware (Glease)
* [#3621] Fix `os.time()` being off by one hour
* [#3682] Add error handling to the `flash` OpenOS program
* [#3764] Fix left and right names being swapped in the Rack GUI
* [#3779] Fix `os.sleep(0)` causing `too long without yielding` (Ocawesome101)
* (1.12) [#3774] Fix Jukebox driver (kebufu)
## List of contributors
asie, AutumnalModding, Glease, jasonS05, kcinnajlol
asie, kebufu, Ocawesome101

View File

@ -53,5 +53,5 @@ dependencies {
testImplementation("org.mockito:mockito-all:1.10.19")
testImplementation("org.scalatest:scalatest_2.11:2.2.6")
testImplementation("junit:junit:4.13")
testImplementation("junit:junit:4.13.2")
}

View File

@ -248,6 +248,7 @@ oc:gui.Rack.Right=Right
oc:gui.Rack.Enabled=Enabled
oc:gui.Rack.Disabled=Disabled
oc:gui.Rack.RelayModeTooltip=Relay Mode
oc:gui.Rack.OrientationTooltip=Note: If facing the front[nl]of the Rack, the right[nl]side of the Rack is to[nl]your left.
oc:gui.Rack.Top=Top
oc:gui.Switch.PacketsPerCycle=Packets / cycle
oc:gui.Switch.QueueSize=Queue size

View File

@ -15,6 +15,8 @@ end
local function printRom()
local eeprom = component.eeprom
io.write(eeprom.get())
return nil
end
local function readRom()
@ -37,6 +39,8 @@ local function readRom()
if not options.q then
io.write("All done!\nThe label is '" .. eeprom.getLabel() .. "'.\n")
end
return nil
end
local function writeRom()
@ -60,7 +64,10 @@ local function writeRom()
io.write("Please do NOT power down or restart your computer during this operation!\n")
end
eeprom.set(bios)
local result, reason = eeprom.set(bios)
if reason then
return nil, reason
end
local label = args[2]
if not options.q and not label then
@ -68,7 +75,11 @@ local function writeRom()
label = io.read()
end
if label and #label > 0 then
eeprom.setLabel(label)
local result, reason = eeprom.setLabel(label)
if reason then
return nil, reason
end
if not options.q then
io.write("Set label to '" .. eeprom.getLabel() .. "'.\n")
end
@ -77,12 +88,19 @@ local function writeRom()
if not options.q then
io.write("All done! You can remove the EEPROM and re-insert the previous one now.\n")
end
return nil
end
local result, reason
if options.l then
printRom()
result, reason = printRom()
elseif options.r then
readRom()
result, reason = readRom()
else
writeRom()
result, reason = writeRom()
end
if reason then
io.stderr:write(reason..'\n')
return 1
end

View File

@ -1,7 +1,7 @@
-- called from /init.lua
local raw_loadfile = ...
_G._OSVERSION = "OpenOS 1.8.8"
_G._OSVERSION = "OpenOS 1.8.9"
-- luacheck: globals component computer unicode _OSVERSION
local component = component

View File

@ -143,7 +143,7 @@ function event.pullFiltered(...)
local deadline = computer.uptime() + (seconds or math.huge)
repeat
local waitTime = deadline - computer.uptime()
if waitTime <= 0 then
if waitTime < 0 then
break
end
local signal = table.pack(computer.pullSignal(waitTime))

View File

@ -147,6 +147,8 @@ object Localization {
def RelayDisabled = localizeImmediately("gui.Rack.Disabled")
def RelayModeTooltip: String = localizeImmediately("gui.Rack.RelayModeTooltip")
def OrientationTooltip: String = localizeImmediately("gui.Rack.OrientationTooltip")
}
object Switch {

View File

@ -81,8 +81,8 @@ class Rack(playerInventory: InventoryPlayer, val rack: tileentity.Rack) extends
def sideName(side: ForgeDirection) = side match {
case ForgeDirection.UP => Localization.Rack.Top
case ForgeDirection.DOWN => Localization.Rack.Bottom
case ForgeDirection.EAST => Localization.Rack.Left
case ForgeDirection.WEST => Localization.Rack.Right
case ForgeDirection.EAST => Localization.Rack.Left
case ForgeDirection.NORTH => Localization.Rack.Back
case _ => Localization.Rack.None
}
@ -250,6 +250,13 @@ class Rack(playerInventory: InventoryPlayer, val rack: tileentity.Rack) extends
x, y, 0x404040)
}
if (mouseX >= guiLeft + 122 && mouseY >= guiTop + 20 && mouseX < guiLeft + 158 && mouseY < guiTop + 20 + 5 * 11) {
val tooltip = new java.util.ArrayList[String]
tooltip.addAll(asJavaCollection(Localization.Rack.OrientationTooltip.lines.toIterable))
copiedDrawHoveringText(tooltip, mouseX - guiLeft, mouseY - guiTop, fontRendererObj)
}
if (relayButton.func_146115_a) {
val tooltip = new java.util.ArrayList[String]
tooltip.addAll(asJavaCollection(Localization.Rack.RelayModeTooltip.lines.toIterable))

View File

@ -76,7 +76,7 @@ class EEPROM extends prefab.ManagedEnvironment with DeviceInfo {
return result(Unit, "storage is readonly")
}
label = args.optString(0, "EEPROM").trim.take(24)
if (label.length == 0) label = "EEPROM"
if (label.isEmpty) label = "EEPROM"
result(label)
}

View File

@ -67,10 +67,11 @@ class OSAPI(owner: NativeLuaArchitecture) extends NativeLuaAPI(owner) {
if (lua.isNoneOrNil(1)) {
// Game time is in ticks, so that each day has 24000 ticks, meaning
// one hour is game time divided by one thousand. Also, Minecraft
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
// add those five hours. Thus:
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
lua.pushNumber(((machine.worldTime + 5000) * 60 * 60) / 1000.0)
// starts days at 6 o'clock; os.time() reflects UTC while os.date()
// reflects the local time zone, but Minecraft has no concept of
// time zones, so this detail can be ignored. Thus:
// timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
lua.pushNumber(((machine.worldTime + 6000) * 60 * 60) / 1000.0)
}
else {
def getField(key: String, d: Int) = {

View File

@ -51,10 +51,11 @@ class OSAPI(owner: LuaJLuaArchitecture) extends LuaJAPI(owner) {
if (args.isnoneornil(1)) {
// Game time is in ticks, so that each day has 24000 ticks, meaning
// one hour is game time divided by one thousand. Also, Minecraft
// starts days at 6 o'clock, versus the 1 o'clock of timestamps so we
// add those five hours. Thus:
// timestamp = (time + 5000) * 60[kh] * 60[km] / 1000[s]
LuaValue.valueOf((machine.worldTime + 5000) * 60 * 60 / 1000)
// starts days at 6 o'clock; os.time() reflects UTC while os.date()
// reflects the local time zone, but Minecraft has no concept of
// time zones, so this detail can be ignored. Thus:
// timestamp = (time + 6000) * 60[kh] * 60[km] / 1000[s]
LuaValue.valueOf((machine.worldTime + 6000) * 60 * 60 / 1000)
}
else {
val table = args.checktable(1)