Fix ta5 hyperloop tank bug, EOF blank added
This commit is contained in:
parent
f96abd97b7
commit
f8ca493a6b
@ -116,7 +116,6 @@ local function formspec(name)
|
||||
local tRes = {}
|
||||
for idx,pos in ipairs(lPos) do
|
||||
local pos1, pos2 = calc_area(pos)
|
||||
local ypos = 0.2 + idx * 0.4
|
||||
tRes[#tRes+1] = idx
|
||||
tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1))
|
||||
tRes[#tRes+1] = "to"
|
||||
|
@ -129,4 +129,3 @@ techage.register_node({"protector:chest"}, {
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -89,4 +89,3 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ techage.shared_tank = {}
|
||||
local liquid = networks.liquid
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
local is_paired = techage.hyperloop.is_paired
|
||||
local menu = techage.menu
|
||||
|
||||
local function formspec(pos)
|
||||
@ -36,7 +37,7 @@ local function formspec(pos)
|
||||
end
|
||||
|
||||
function techage.shared_tank.node_timer(pos)
|
||||
if techage.is_activeformspec(pos) then
|
||||
if techage.is_activeformspec(pos) and is_paired(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
return true
|
||||
end
|
||||
@ -60,12 +61,15 @@ function techage.shared_tank.can_dig(pos, player)
|
||||
end
|
||||
|
||||
function techage.shared_tank.peek_liquid(pos, indir)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_peek(nvm)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.shared_tank.take_liquid(pos, indir, name, amount)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
amount, name = liquid.srv_take(nvm, name, amount)
|
||||
@ -73,9 +77,12 @@ function techage.shared_tank.take_liquid(pos, indir, name, amount)
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
return amount, name
|
||||
end
|
||||
return 0, name
|
||||
end
|
||||
|
||||
function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
-- check if it is not powder
|
||||
local ndef = minetest.registered_craftitems[name] or {}
|
||||
@ -88,10 +95,12 @@ function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
||||
end
|
||||
return leftover
|
||||
end
|
||||
end
|
||||
return amount
|
||||
end
|
||||
|
||||
function techage.shared_tank.untake_liquid(pos, indir, name, amount)
|
||||
if is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
local ndef = NDEF(pos)
|
||||
@ -100,6 +109,8 @@ function techage.shared_tank.untake_liquid(pos, indir, name, amount)
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
return leftover
|
||||
end
|
||||
return amount
|
||||
end
|
||||
|
||||
techage.shared_tank.formspec = formspec
|
@ -142,4 +142,3 @@ minetest.register_craft({
|
||||
{'', '', ''},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -2552,4 +2552,3 @@ techage.manual_DE.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -2545,4 +2545,3 @@ techage.manual_EN.aPlanTable = {
|
||||
"",
|
||||
"",
|
||||
}
|
||||
|
||||
|
@ -37,4 +37,3 @@ function techage.add_to_manual(language, titles, texts, items, plans)
|
||||
tbl.aPlanTable[#tbl.aPlanTable + 1] = item
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -128,4 +128,3 @@ minetest.register_craft({
|
||||
{"", "techage:ta4_wlanchip", ""},
|
||||
},
|
||||
})
|
||||
|
||||
|
@ -22,11 +22,10 @@ end
|
||||
|
||||
-- generate the choice dependent part of the form
|
||||
local function add_controls_to_table(tbl, kvDefinition, kvSelect)
|
||||
local val = ""
|
||||
local offs = 1.4
|
||||
if kvDefinition[kvSelect.choice] then
|
||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||
for idx,elem in ipairs(lControls) do
|
||||
for _,elem in ipairs(lControls) do
|
||||
if elem.type == "label" then
|
||||
tbl[#tbl+1] = "label[0,"..offs..";Description:\n"..elem.label.."]"
|
||||
offs = offs + 0.4
|
||||
@ -36,12 +35,12 @@ local function add_controls_to_table(tbl, kvDefinition, kvSelect)
|
||||
end
|
||||
if elem.type == "numbers" or elem.type == "number" or elem.type == "digits" or elem.type == "letters"
|
||||
or elem.type == "ascii" then
|
||||
val = kvSelect[elem.name] or elem.default
|
||||
local val = kvSelect[elem.name] or elem.default
|
||||
tbl[#tbl+1] = "field[0.3,"..(offs+0.2)..";8,1;"..elem.name..";;"..val.."]"
|
||||
offs = offs + 0.9
|
||||
elseif elem.type == "textlist" then
|
||||
local l = elem.choices:split(",")
|
||||
val = index(l, kvSelect[elem.name]) or elem.default
|
||||
local val = index(l, kvSelect[elem.name]) or elem.default
|
||||
tbl[#tbl+1] = "dropdown[0.0,"..(offs)..";8.5,1.4;"..elem.name..";"..elem.choices..";"..val.."]"
|
||||
offs = offs + 0.9
|
||||
end
|
||||
@ -52,7 +51,7 @@ end
|
||||
|
||||
local function default_data(kvDefinition, kvSelect)
|
||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||
for idx,elem in ipairs(lControls) do
|
||||
for _,elem in ipairs(lControls) do
|
||||
kvSelect[elem.name] = elem.default
|
||||
end
|
||||
kvSelect.button = kvDefinition[kvSelect.choice].button(kvSelect)
|
||||
@ -66,7 +65,7 @@ end
|
||||
local function field_to_kvSelect(kvDefinition, kvSelect, fields)
|
||||
local error = false
|
||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||
for idx,elem in ipairs(lControls) do
|
||||
for _,elem in ipairs(lControls) do
|
||||
if elem.type == "numbers" then
|
||||
if fields[elem.name] then
|
||||
if fields[elem.name]:find("^[%d ]+$") then
|
||||
@ -131,7 +130,7 @@ end
|
||||
function techage.submenu_verify(owner, kvDefinition, kvSelect)
|
||||
local error = false
|
||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||
for idx,elem in ipairs(lControls) do
|
||||
for _,elem in ipairs(lControls) do
|
||||
if elem.type == "numbers" then
|
||||
if not kvSelect[elem.name]:find("^[%d ]+$") then
|
||||
error = true
|
||||
|
@ -246,4 +246,3 @@ function techage.stop_burner(pos)
|
||||
minetest.sound_stop(handle)
|
||||
meta:set_int("burn_time", 0)
|
||||
end
|
||||
|
||||
|
@ -63,4 +63,3 @@ techage.add_grinder_recipe({input="default:clay", output="techage:clay_powder"})
|
||||
techage.add_grinder_recipe({input="techage:aluminum", output="techage:aluminum_powder"})
|
||||
techage.add_grinder_recipe({input="default:silver_sandstone", output="techage:silver_sandstone_powder"})
|
||||
|
||||
|
||||
|
@ -408,4 +408,3 @@ techage.register_node({"techage:ta3_logic2"}, {
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -250,4 +250,3 @@ techage.register_node({"techage:ta3_logic"}, {
|
||||
|
||||
end,
|
||||
})
|
||||
|
||||
|
@ -323,4 +323,3 @@ techage.lua_ctlr.register_action("server_write", {
|
||||
" return value: true if successful or false\n"..
|
||||
' example: res = $server_write("123", "state", state)'
|
||||
})
|
||||
|
||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
||||
name = techage
|
||||
depends = default,doors,flowers,tubelib2,networks,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua
|
||||
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks,i3
|
||||
optional_depends = unified_inventory,wielded_light,unifieddyes,moreores,ethereal,mesecon,digtron,bakedclay,moreblocks,i3,creative,craftguide
|
||||
description = Techage, go through 5 tech ages in search of wealth and power!
|
||||
|
@ -187,4 +187,3 @@ minetest.register_craft({
|
||||
},})
|
||||
|
||||
techage.TA4_Cable = Cable
|
||||
|
||||
|
@ -170,4 +170,3 @@ minetest.register_lbm({
|
||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||
end
|
||||
})
|
||||
|
||||
|
@ -236,4 +236,3 @@ minetest.register_craft({
|
||||
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user