mirror of
https://github.com/kepler155c/opus
synced 2026-04-29 10:01:27 +00:00
build using command computer
This commit is contained in:
@@ -769,14 +769,14 @@ function blockTypeDB:seedDB()
|
||||
{ '+12', nil, nil },
|
||||
})
|
||||
blockTypeDB:addTemp('door', {
|
||||
{ 0, nil, 0, 'east-door' },
|
||||
{ 1, nil, 0, 'south-door' },
|
||||
{ 2, nil, 0, 'west-door' },
|
||||
{ 3, nil, 0, 'north-door' },
|
||||
{ 4, nil, 0, 'east-door' },
|
||||
{ 5, nil, 0, 'south-door' },
|
||||
{ 6, nil, 0, 'west-door' },
|
||||
{ 7, nil, 0, 'north-door' },
|
||||
{ 0, nil, 0, 'east-door', { door = true } },
|
||||
{ 1, nil, 0, 'south-door', { door = true } },
|
||||
{ 2, nil, 0, 'west-door', { door = true } },
|
||||
{ 3, nil, 0, 'north-door', { door = true } },
|
||||
{ 4, nil, 0, 'east-door', { door = true } },
|
||||
{ 5, nil, 0, 'south-door', { door = true } },
|
||||
{ 6, nil, 0, 'west-door', { door = true } },
|
||||
{ 7, nil, 0, 'north-door', { door = true } },
|
||||
{ 8,'minecraft:air', 0 },
|
||||
{ 9,'minecraft:air', 0 },
|
||||
{ 10,'minecraft:air', 0 },
|
||||
@@ -823,7 +823,13 @@ function Blocks:getRealBlock(id, dmg)
|
||||
|
||||
local p = placementDB:get({id, dmg})
|
||||
if p then
|
||||
return { id = p.sid, dmg = p.sdmg, direction = p.direction, extra = p.extra }
|
||||
return {
|
||||
id = p.sid,
|
||||
dmg = p.sdmg,
|
||||
direction = p.direction,
|
||||
extra = p.extra,
|
||||
odmg = dmg
|
||||
}
|
||||
end
|
||||
|
||||
local b = blockDB:get({id, dmg})
|
||||
|
||||
@@ -24,6 +24,9 @@ function ChestProvider:init(args)
|
||||
Util.merge(self, args)
|
||||
|
||||
local chest = Peripheral.getBySide(self.wrapSide)
|
||||
if not chest then
|
||||
chest = Peripheral.getByMethod('list')
|
||||
end
|
||||
if chest then
|
||||
Util.merge(self, chest)
|
||||
end
|
||||
|
||||
@@ -189,6 +189,11 @@ local function processRoutines(...)
|
||||
end
|
||||
end
|
||||
|
||||
function Event.processEvent(e)
|
||||
processHandlers(e[1])
|
||||
processRoutines(table.unpack(e))
|
||||
end
|
||||
|
||||
function Event.pullEvent(eventType)
|
||||
|
||||
while true do
|
||||
|
||||
@@ -5,27 +5,29 @@ local netfs = { }
|
||||
|
||||
local function remoteCommand(node, msg)
|
||||
|
||||
if not node.socket then
|
||||
node.socket = Socket.connect(node.id, 139)
|
||||
end
|
||||
for i = 1, 2 do
|
||||
if not node.socket then
|
||||
node.socket = Socket.connect(node.id, 139)
|
||||
end
|
||||
|
||||
if not node.socket then
|
||||
error('netfs: Unable to establish connection to ' .. node.id)
|
||||
fs.unmount(node.mountPoint)
|
||||
return
|
||||
end
|
||||
if not node.socket then
|
||||
error('netfs: Unable to establish connection to ' .. node.id)
|
||||
fs.unmount(node.mountPoint)
|
||||
return
|
||||
end
|
||||
|
||||
local ret
|
||||
synchronized(node.socket, function()
|
||||
node.socket:write(msg)
|
||||
ret = node.socket:read(2)
|
||||
end)
|
||||
local ret
|
||||
synchronized(node.socket, function()
|
||||
node.socket:write(msg)
|
||||
ret = node.socket:read(1)
|
||||
end)
|
||||
|
||||
if ret then
|
||||
return ret.response
|
||||
if ret then
|
||||
return ret.response
|
||||
end
|
||||
node.socket:close()
|
||||
node.socket = nil
|
||||
end
|
||||
node.socket:close()
|
||||
node.socket = nil
|
||||
error('netfs: Connection failed', 2)
|
||||
end
|
||||
|
||||
|
||||
@@ -151,9 +151,9 @@ end
|
||||
function Schematic:copyBlocks(iblocks, oblocks, throttle)
|
||||
for k,b in ipairs(iblocks) do
|
||||
oblocks[k] = Util.shallowCopy(b)
|
||||
if (k % 1000) == 0 then
|
||||
--if (k % 1000) == 0 then
|
||||
throttle()
|
||||
end
|
||||
--end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -359,7 +359,7 @@ function Schematic:assignDamages(spinner)
|
||||
end
|
||||
end
|
||||
|
||||
function Schematic:findIndexAt(x, z, y)
|
||||
function Schematic:findIndexAt(x, z, y, allBlocks)
|
||||
if y < 0 then
|
||||
return
|
||||
end
|
||||
@@ -369,8 +369,8 @@ function Schematic:findIndexAt(x, z, y)
|
||||
for i = ri.s, ri.e do
|
||||
local b = self.blocks[i]
|
||||
if b.x == x and b.z == z and b.y == y then
|
||||
if b.id == 'minecraft:air' then
|
||||
-- this will definitely screw up placement order if a substition is made with air after starting
|
||||
if b.id == 'minecraft:air' and not allBlocks then
|
||||
-- this will possibly screw up placement order if a substition is made with air after starting
|
||||
-- as blocks will be placed differently and could have a different heading
|
||||
break
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ function Terminal.scrollable(ct, size)
|
||||
|
||||
local function drawScrollbar(oldPos, newPos)
|
||||
local x, y = oldWin.getCursorPos()
|
||||
|
||||
|
||||
local pos = math.floor(oldPos / size * (h - 1))
|
||||
oldWin.setCursorPos(w, oldPos + pos + 1)
|
||||
oldWin.write(' ')
|
||||
@@ -18,7 +18,7 @@ function Terminal.scrollable(ct, size)
|
||||
pos = math.floor(newPos / size * (h - 1))
|
||||
oldWin.setCursorPos(w, newPos + pos + 1)
|
||||
oldWin.write('#')
|
||||
|
||||
|
||||
oldWin.setCursorPos(x, y)
|
||||
end
|
||||
|
||||
@@ -44,7 +44,8 @@ function Terminal.scrollable(ct, size)
|
||||
if p ~= scrollPos then
|
||||
drawScrollbar(scrollPos, p)
|
||||
scrollPos = p
|
||||
win.reposition(1, -scrollPos + 1)
|
||||
--local w, h = win.getSize()
|
||||
win.reposition(1, -scrollPos + 1, w, h + size)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -168,10 +168,10 @@ function Util.findAll(t, name, value)
|
||||
end
|
||||
|
||||
function Util.shallowCopy(t)
|
||||
local t2 = {}
|
||||
local t2 = { }
|
||||
for k,v in pairs(t) do
|
||||
t2[k] = v
|
||||
end
|
||||
t2[k] = v
|
||||
end
|
||||
return t2
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user