fix ic2-classic mod incompatibility

additionally:
remove dead code in openos transforms
safe guard openos boot from slow server tick

closes #2487
This commit is contained in:
payonel 2017-10-30 23:14:54 -07:00
parent c930ec329e
commit 07791b9851
6 changed files with 20 additions and 18 deletions

View File

@ -42,6 +42,8 @@ if gpu and screen then
gpu.fill(1, 1, w, h, " ") gpu.fill(1, 1, w, h, " ")
end end
local y = 1 local y = 1
local uptime = computer.uptime
local last_sleep = uptime()
local function status(msg) local function status(msg)
if gpu and screen then if gpu and screen then
gpu.set(1, y, msg) gpu.set(1, y, msg)
@ -52,6 +54,10 @@ local function status(msg)
y = y + 1 y = y + 1
end end
end end
if uptime() - last_sleep > 1 then
computer.pullSignal(0)
last_sleep = uptime()
end
end end
status("Booting " .. _OSVERSION .. "...") status("Booting " .. _OSVERSION .. "...")

View File

@ -356,7 +356,7 @@ function sh.internal.hasValidPiping(words, pipes)
return true return true
end end
local semi_split = tx.find(text.syntax, {";"}) -- symbols before ; are redirects and follow slightly different rules, see buildCommandRedirects local semi_split = tx.first(text.syntax, {{";"}}) -- symbols before ; are redirects and follow slightly different rules, see buildCommandRedirects
pipes = pipes or tx.sub(text.syntax, semi_split + 1) pipes = pipes or tx.sub(text.syntax, semi_split + 1)
local state = "" -- cannot start on a pipe local state = "" -- cannot start on a pipe

View File

@ -15,19 +15,6 @@ function lib.sub(tbl,f,l)
return r return r
end end
-- if value was made by lib.sub then find can find from whence
function lib.find(tbl, sub, first, last)
checkArg(1, tbl, 'table')
checkArg(2, sub, 'table')
local sub_len = #sub
return lib.first(tbl, function(element, index, projected_table)
for n=0,sub_len-1 do
if projected_table[n + index] ~= sub[n + 1] then return nil end
end
return 1, sub_len
end, first, last)
end
-- Returns a list of subsets of tbl where partitioner acts as a delimiter. -- Returns a list of subsets of tbl where partitioner acts as a delimiter.
function lib.partition(tbl,partitioner,dropEnds,f,l) function lib.partition(tbl,partitioner,dropEnds,f,l)
checkArg(1,tbl,'table') checkArg(1,tbl,'table')

View File

@ -11,8 +11,12 @@ end
function lib.internal.table_view(tbl,f,l) function lib.internal.table_view(tbl,f,l)
return setmetatable({}, return setmetatable({},
{ {
__index=function(b,k)return(type(k)~='number'or(k>=f and k<=l))and tbl[k]or nil end, __index = function(_, key)
__len=function(b)return#tbl end, return (type(key) ~= 'number' or (key >= f and key <= l)) and tbl[key] or nil
end,
__len = function(_)
return l
end,
}) })
end end
local adjust=lib.internal.range_adjust local adjust=lib.internal.range_adjust

View File

@ -199,6 +199,7 @@ object Mods {
final val GregTech = "gregtech" final val GregTech = "gregtech"
final val IndustrialCraft2 = "IC2" final val IndustrialCraft2 = "IC2"
final val IndustrialCraft2Classic = "IC2-Classic" final val IndustrialCraft2Classic = "IC2-Classic"
final val IndustrialCraft2Spmod = "IC2-Classic-Spmod"
final val IngameWiki = "IGWMod" final val IngameWiki = "IGWMod"
final val Mekanism = "Mekanism" final val Mekanism = "Mekanism"
final val MekanismGas = "MekanismAPI|gas" final val MekanismGas = "MekanismAPI|gas"

View File

@ -1,5 +1,6 @@
package li.cil.oc.integration.ic2 package li.cil.oc.integration.ic2
import cpw.mods.fml.common.Loader
import li.cil.oc.api import li.cil.oc.api
import li.cil.oc.api.Driver import li.cil.oc.api.Driver
import li.cil.oc.integration.ModProxy import li.cil.oc.integration.ModProxy
@ -20,14 +21,17 @@ object ModIndustrialCraft2 extends ModProxy {
MinecraftForge.EVENT_BUS.register(EventHandlerIndustrialCraft2) MinecraftForge.EVENT_BUS.register(EventHandlerIndustrialCraft2)
if (!Loader.isModLoaded(Mods.IDs.IndustrialCraft2Spmod)) {
Driver.add(new DriverReactorRedstonePort)
Driver.add(new DriverMassFab)
}
Driver.add(new DriverEnergyConductor) Driver.add(new DriverEnergyConductor)
Driver.add(new DriverEnergySink) Driver.add(new DriverEnergySink)
Driver.add(new DriverEnergySource) Driver.add(new DriverEnergySource)
Driver.add(new DriverEnergyStorage) Driver.add(new DriverEnergyStorage)
Driver.add(new DriverMassFab)
Driver.add(new DriverReactor) Driver.add(new DriverReactor)
Driver.add(new DriverReactorChamber) Driver.add(new DriverReactorChamber)
Driver.add(new DriverReactorRedstonePort)
Driver.add(new ConverterElectricItem) Driver.add(new ConverterElectricItem)
} }