Merge branch 'master-MC1.11' into master-MC1.12

This commit is contained in:
payonel 2018-11-16 02:53:42 -08:00
commit 66f5a040ca
6 changed files with 71 additions and 74 deletions

View File

@ -4,7 +4,7 @@ forge.version=14.23.4.2727
mod.name=OpenComputers mod.name=OpenComputers
mod.group=li.cil.oc mod.group=li.cil.oc
mod.version=1.7.2 mod.version=1.7.3
ae2.version=rv6-stable-1 ae2.version=rv6-stable-1
buildcraft.version=7.99.17 buildcraft.version=7.99.17

View File

@ -15,7 +15,7 @@ if #args == 0 then
while true do while true do
if has_prompt then if has_prompt then
while not tty.isAvailable() do while not tty.isAvailable() do
event.pull("term_available", .5) event.pull(.5, "term_available")
end end
if needs_profile then -- first time run AND interactive if needs_profile then -- first time run AND interactive
needs_profile = nil needs_profile = nil

View File

@ -1,18 +1,15 @@
do do
local loadfile = load([[return function(file) local addr, invoke = computer.getBootAddress(), component.invoke
local pc,cp = computer or package.loaded.computer, component or package.loaded.component local function loadfile(file)
local addr, invoke = pc.getBootAddress(), cp.invoke local handle = assert(invoke(addr, "open", file))
local handle, reason = invoke(addr, "open", file)
assert(handle, reason)
local buffer = "" local buffer = ""
repeat repeat
local data, reason = invoke(addr, "read", handle, math.huge) local data = invoke(addr, "read", handle, math.huge)
assert(data or not reason, reason)
buffer = buffer .. (data or "") buffer = buffer .. (data or "")
until not data until not data
invoke(addr, "close", handle) invoke(addr, "close", handle)
return load(buffer, "=" .. file, "bt", _G) return load(buffer, "=" .. file, "bt", _G)
end]], "=loadfile", "bt", _G)() end
loadfile("/lib/core/boot.lua")(loadfile) loadfile("/lib/core/boot.lua")(loadfile)
end end

View File

@ -1,7 +1,7 @@
-- called from /init.lua -- called from /init.lua
local raw_loadfile = ... local raw_loadfile = ...
_G._OSVERSION = "OpenOS 1.7.2" _G._OSVERSION = "OpenOS 1.7.3"
local component = component local component = component
local computer = computer local computer = computer
@ -73,13 +73,9 @@ end
status("Booting " .. _OSVERSION .. "...") status("Booting " .. _OSVERSION .. "...")
-- Custom low-level dofile implementation reading from our ROM. -- Custom low-level dofile implementation reading from our ROM.
local loadfile = function(file)
status("> " .. file)
return raw_loadfile(file)
end
local function dofile(file) local function dofile(file)
local program, reason = loadfile(file) status("> " .. file)
local program, reason = raw_loadfile(file)
if program then if program then
local result = table.pack(pcall(program)) local result = table.pack(pcall(program))
if result[1] then if result[1] then
@ -112,11 +108,11 @@ do
package.loaded.component = component package.loaded.component = component
package.loaded.computer = computer package.loaded.computer = computer
package.loaded.unicode = unicode package.loaded.unicode = unicode
package.loaded.buffer = assert(loadfile("/lib/buffer.lua"))() package.loaded.buffer = dofile("/lib/buffer.lua")
package.loaded.filesystem = assert(loadfile("/lib/filesystem.lua"))() package.loaded.filesystem = dofile("/lib/filesystem.lua")
-- Inject the io modules -- Inject the io modules
_G.io = assert(loadfile("/lib/io.lua"))() _G.io = dofile("/lib/io.lua")
end end
status("Initializing file system...") status("Initializing file system...")

View File

@ -1,61 +1,64 @@
local component_invoke = component.invoke local init
function boot_invoke(address, method, ...)
local result = table.pack(pcall(component_invoke, address, method, ...))
if not result[1] then
return nil, result[2]
else
return table.unpack(result, 2, result.n)
end
end
-- backwards compatibility, may remove later
local eeprom = component.list("eeprom")()
computer.getBootAddress = function()
return boot_invoke(eeprom, "getData")
end
computer.setBootAddress = function(address)
return boot_invoke(eeprom, "setData", address)
end
do do
local screen = component.list("screen")() local component_invoke = component.invoke
local gpu = component.list("gpu")() local function boot_invoke(address, method, ...)
if gpu and screen then local result = table.pack(pcall(component_invoke, address, method, ...))
boot_invoke(gpu, "bind", screen) if not result[1] then
return nil, result[2]
else
return table.unpack(result, 2, result.n)
end
end end
end
local function tryLoadFrom(address) -- backwards compatibility, may remove later
local handle, reason = boot_invoke(address, "open", "/init.lua") local eeprom = component.list("eeprom")()
if not handle then computer.getBootAddress = function()
return nil, reason return boot_invoke(eeprom, "getData")
end end
local buffer = "" computer.setBootAddress = function(address)
repeat return boot_invoke(eeprom, "setData", address)
local data, reason = boot_invoke(address, "read", handle, math.huge) end
if not data and reason then
do
local screen = component.list("screen")()
local gpu = component.list("gpu")()
if gpu and screen then
boot_invoke(gpu, "bind", screen)
end
end
local function tryLoadFrom(address)
local handle, reason = boot_invoke(address, "open", "/init.lua")
if not handle then
return nil, reason return nil, reason
end end
buffer = buffer .. (data or "") local buffer = ""
until not data repeat
boot_invoke(address, "close", handle) local data, reason = boot_invoke(address, "read", handle, math.huge)
return load(buffer, "=init") if not data and reason then
end return nil, reason
local init, reason end
if computer.getBootAddress() then buffer = buffer .. (data or "")
init, reason = tryLoadFrom(computer.getBootAddress()) until not data
end boot_invoke(address, "close", handle)
if not init then return load(buffer, "=init")
computer.setBootAddress() end
for address in component.list("filesystem") do local reason
init, reason = tryLoadFrom(address) if computer.getBootAddress() then
if init then init, reason = tryLoadFrom(computer.getBootAddress())
computer.setBootAddress(address) end
break if not init then
computer.setBootAddress()
for address in component.list("filesystem") do
init, reason = tryLoadFrom(address)
if init then
computer.setBootAddress(address)
break
end
end end
end end
if not init then
error("no bootable medium found" .. (reason and (": " .. tostring(reason)) or ""), 0)
end
computer.beep(1000, 0.2)
end end
if not init then init()
error("no bootable medium found" .. (reason and (": " .. tostring(reason)) or ""), 0)
end
computer.beep(1000, 0.2)
init()

View File

@ -34,7 +34,8 @@ object PetRenderer {
"23c7ed71-fb13-4abe-abe7-f355e1de6e62" ->(0.3, 0.3, 1.0), // LizzyTheSiren "23c7ed71-fb13-4abe-abe7-f355e1de6e62" ->(0.3, 0.3, 1.0), // LizzyTheSiren
"076541f1-f10a-46de-a127-dfab8adfbb75" ->(0.2, 1.0, 0.1), // vifino "076541f1-f10a-46de-a127-dfab8adfbb75" ->(0.2, 1.0, 0.1), // vifino
"e7e90198-0ccf-4662-a827-192ec8f4419d" ->(0.0, 0.2, 0.6), // Izaya "e7e90198-0ccf-4662-a827-192ec8f4419d" ->(0.0, 0.2, 0.6), // Izaya
"f514ee69-7bbb-4e46-9e94-d8176324cec2" ->(0.098, 0.471, 0.784) // Wobbo "f514ee69-7bbb-4e46-9e94-d8176324cec2" ->(0.098, 0.471, 0.784), // Wobbo
"f812c043-78ba-4324-82ae-e8f05c52ae6e" ->(0.1, 0.8, 0.5) // payonel
) )
private val petLocations = com.google.common.cache.CacheBuilder.newBuilder(). private val petLocations = com.google.common.cache.CacheBuilder.newBuilder().