diff --git a/changelog.md b/changelog.md index 517ab0846..513a1a570 100644 --- a/changelog.md +++ b/changelog.md @@ -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 diff --git a/dependencies.gradle b/dependencies.gradle index ef0c109d3..936ce7858 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -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") } diff --git a/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua b/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua index f8ecf4762..13e080e15 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/bin/flash.lua @@ -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 \ No newline at end of file diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua index 736fe1129..34c966cf7 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua @@ -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 diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua index 1ad8b4698..7c7ab7eab 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/event.lua @@ -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)) diff --git a/src/main/scala/li/cil/oc/client/gui/Rack.scala b/src/main/scala/li/cil/oc/client/gui/Rack.scala index ea60d4114..878010623 100644 --- a/src/main/scala/li/cil/oc/client/gui/Rack.scala +++ b/src/main/scala/li/cil/oc/client/gui/Rack.scala @@ -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.WEST => Localization.Rack.Left + case ForgeDirection.EAST => Localization.Rack.Right case ForgeDirection.NORTH => Localization.Rack.Back case _ => Localization.Rack.None } diff --git a/src/main/scala/li/cil/oc/server/component/EEPROM.scala b/src/main/scala/li/cil/oc/server/component/EEPROM.scala index cc907aff6..59143cb21 100644 --- a/src/main/scala/li/cil/oc/server/component/EEPROM.scala +++ b/src/main/scala/li/cil/oc/server/component/EEPROM.scala @@ -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) } diff --git a/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala b/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala index 56773404f..9d539f356 100644 --- a/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala +++ b/src/main/scala/li/cil/oc/server/machine/luac/OSAPI.scala @@ -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) = { diff --git a/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala b/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala index 06e721194..41b3e0e39 100644 --- a/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala +++ b/src/main/scala/li/cil/oc/server/machine/luaj/OSAPI.scala @@ -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)