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 = {}
|
local tRes = {}
|
||||||
for idx,pos in ipairs(lPos) do
|
for idx,pos in ipairs(lPos) do
|
||||||
local pos1, pos2 = calc_area(pos)
|
local pos1, pos2 = calc_area(pos)
|
||||||
local ypos = 0.2 + idx * 0.4
|
|
||||||
tRes[#tRes+1] = idx
|
tRes[#tRes+1] = idx
|
||||||
tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1))
|
tRes[#tRes+1] = minetest.formspec_escape(P2S(pos1))
|
||||||
tRes[#tRes+1] = "to"
|
tRes[#tRes+1] = "to"
|
||||||
|
@ -129,4 +129,3 @@ techage.register_node({"protector:chest"}, {
|
|||||||
return techage.put_items(inv, "main", stack)
|
return techage.put_items(inv, "main", stack)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -89,4 +89,3 @@ techage.manual_DE.aPlanTable = {
|
|||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ techage.shared_tank = {}
|
|||||||
local liquid = networks.liquid
|
local liquid = networks.liquid
|
||||||
local hyperloop = techage.hyperloop
|
local hyperloop = techage.hyperloop
|
||||||
local remote_pos = techage.hyperloop.remote_pos
|
local remote_pos = techage.hyperloop.remote_pos
|
||||||
|
local is_paired = techage.hyperloop.is_paired
|
||||||
local menu = techage.menu
|
local menu = techage.menu
|
||||||
|
|
||||||
local function formspec(pos)
|
local function formspec(pos)
|
||||||
@ -36,7 +37,7 @@ local function formspec(pos)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function techage.shared_tank.node_timer(pos)
|
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))
|
M(pos):set_string("formspec", formspec(pos))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -60,26 +61,47 @@ function techage.shared_tank.can_dig(pos, player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function techage.shared_tank.peek_liquid(pos, indir)
|
function techage.shared_tank.peek_liquid(pos, indir)
|
||||||
pos = remote_pos(pos)
|
if is_paired(pos) then
|
||||||
local nvm = techage.get_nvm(pos)
|
pos = remote_pos(pos)
|
||||||
return liquid.srv_peek(nvm)
|
local nvm = techage.get_nvm(pos)
|
||||||
|
return liquid.srv_peek(nvm)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.shared_tank.take_liquid(pos, indir, name, amount)
|
function techage.shared_tank.take_liquid(pos, indir, name, amount)
|
||||||
pos = remote_pos(pos)
|
if is_paired(pos) then
|
||||||
local nvm = techage.get_nvm(pos)
|
pos = remote_pos(pos)
|
||||||
amount, name = liquid.srv_take(nvm, name, amount)
|
local nvm = techage.get_nvm(pos)
|
||||||
if techage.is_activeformspec(pos) then
|
amount, name = liquid.srv_take(nvm, name, amount)
|
||||||
M(pos):set_string("formspec", formspec(pos))
|
if techage.is_activeformspec(pos) then
|
||||||
|
M(pos):set_string("formspec", formspec(pos))
|
||||||
|
end
|
||||||
|
return amount, name
|
||||||
end
|
end
|
||||||
return amount, name
|
return 0, name
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
||||||
pos = remote_pos(pos)
|
if is_paired(pos) then
|
||||||
-- check if it is not powder
|
pos = remote_pos(pos)
|
||||||
local ndef = minetest.registered_craftitems[name] or {}
|
-- check if it is not powder
|
||||||
if not ndef.groups or ndef.groups.powder ~= 1 then
|
local ndef = minetest.registered_craftitems[name] or {}
|
||||||
|
if not ndef.groups or ndef.groups.powder ~= 1 then
|
||||||
|
local nvm = techage.get_nvm(pos)
|
||||||
|
local ndef = NDEF(pos)
|
||||||
|
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
||||||
|
if techage.is_activeformspec(pos) then
|
||||||
|
M(pos):set_string("formspec", formspec(pos))
|
||||||
|
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 nvm = techage.get_nvm(pos)
|
||||||
local ndef = NDEF(pos)
|
local ndef = NDEF(pos)
|
||||||
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
||||||
@ -91,15 +113,4 @@ function techage.shared_tank.put_liquid(pos, indir, name, amount)
|
|||||||
return amount
|
return amount
|
||||||
end
|
end
|
||||||
|
|
||||||
function techage.shared_tank.untake_liquid(pos, indir, name, amount)
|
|
||||||
pos = remote_pos(pos)
|
|
||||||
local nvm = techage.get_nvm(pos)
|
|
||||||
local ndef = NDEF(pos)
|
|
||||||
local leftover = liquid.srv_put(nvm, name, amount, ndef.liquid.capa)
|
|
||||||
if techage.is_activeformspec(pos) then
|
|
||||||
M(pos):set_string("formspec", formspec(pos))
|
|
||||||
end
|
|
||||||
return leftover
|
|
||||||
end
|
|
||||||
|
|
||||||
techage.shared_tank.formspec = formspec
|
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
|
tbl.aPlanTable[#tbl.aPlanTable + 1] = item
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -128,4 +128,3 @@ minetest.register_craft({
|
|||||||
{"", "techage:ta4_wlanchip", ""},
|
{"", "techage:ta4_wlanchip", ""},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -22,11 +22,10 @@ end
|
|||||||
|
|
||||||
-- generate the choice dependent part of the form
|
-- generate the choice dependent part of the form
|
||||||
local function add_controls_to_table(tbl, kvDefinition, kvSelect)
|
local function add_controls_to_table(tbl, kvDefinition, kvSelect)
|
||||||
local val = ""
|
|
||||||
local offs = 1.4
|
local offs = 1.4
|
||||||
if kvDefinition[kvSelect.choice] then
|
if kvDefinition[kvSelect.choice] then
|
||||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||||
for idx,elem in ipairs(lControls) do
|
for _,elem in ipairs(lControls) do
|
||||||
if elem.type == "label" then
|
if elem.type == "label" then
|
||||||
tbl[#tbl+1] = "label[0,"..offs..";Description:\n"..elem.label.."]"
|
tbl[#tbl+1] = "label[0,"..offs..";Description:\n"..elem.label.."]"
|
||||||
offs = offs + 0.4
|
offs = offs + 0.4
|
||||||
@ -36,12 +35,12 @@ local function add_controls_to_table(tbl, kvDefinition, kvSelect)
|
|||||||
end
|
end
|
||||||
if elem.type == "numbers" or elem.type == "number" or elem.type == "digits" or elem.type == "letters"
|
if elem.type == "numbers" or elem.type == "number" or elem.type == "digits" or elem.type == "letters"
|
||||||
or elem.type == "ascii" then
|
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.."]"
|
tbl[#tbl+1] = "field[0.3,"..(offs+0.2)..";8,1;"..elem.name..";;"..val.."]"
|
||||||
offs = offs + 0.9
|
offs = offs + 0.9
|
||||||
elseif elem.type == "textlist" then
|
elseif elem.type == "textlist" then
|
||||||
local l = elem.choices:split(",")
|
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.."]"
|
tbl[#tbl+1] = "dropdown[0.0,"..(offs)..";8.5,1.4;"..elem.name..";"..elem.choices..";"..val.."]"
|
||||||
offs = offs + 0.9
|
offs = offs + 0.9
|
||||||
end
|
end
|
||||||
@ -52,7 +51,7 @@ end
|
|||||||
|
|
||||||
local function default_data(kvDefinition, kvSelect)
|
local function default_data(kvDefinition, kvSelect)
|
||||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
local lControls = kvDefinition[kvSelect.choice].formspec
|
||||||
for idx,elem in ipairs(lControls) do
|
for _,elem in ipairs(lControls) do
|
||||||
kvSelect[elem.name] = elem.default
|
kvSelect[elem.name] = elem.default
|
||||||
end
|
end
|
||||||
kvSelect.button = kvDefinition[kvSelect.choice].button(kvSelect)
|
kvSelect.button = kvDefinition[kvSelect.choice].button(kvSelect)
|
||||||
@ -66,7 +65,7 @@ end
|
|||||||
local function field_to_kvSelect(kvDefinition, kvSelect, fields)
|
local function field_to_kvSelect(kvDefinition, kvSelect, fields)
|
||||||
local error = false
|
local error = false
|
||||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
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 elem.type == "numbers" then
|
||||||
if fields[elem.name] then
|
if fields[elem.name] then
|
||||||
if fields[elem.name]:find("^[%d ]+$") then
|
if fields[elem.name]:find("^[%d ]+$") then
|
||||||
@ -131,7 +130,7 @@ end
|
|||||||
function techage.submenu_verify(owner, kvDefinition, kvSelect)
|
function techage.submenu_verify(owner, kvDefinition, kvSelect)
|
||||||
local error = false
|
local error = false
|
||||||
local lControls = kvDefinition[kvSelect.choice].formspec
|
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 elem.type == "numbers" then
|
||||||
if not kvSelect[elem.name]:find("^[%d ]+$") then
|
if not kvSelect[elem.name]:find("^[%d ]+$") then
|
||||||
error = true
|
error = true
|
||||||
|
@ -246,4 +246,3 @@ function techage.stop_burner(pos)
|
|||||||
minetest.sound_stop(handle)
|
minetest.sound_stop(handle)
|
||||||
meta:set_int("burn_time", 0)
|
meta:set_int("burn_time", 0)
|
||||||
end
|
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="techage:aluminum", output="techage:aluminum_powder"})
|
||||||
techage.add_grinder_recipe({input="default:silver_sandstone", output="techage:silver_sandstone_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
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -250,4 +250,3 @@ techage.register_node({"techage:ta3_logic"}, {
|
|||||||
|
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -323,4 +323,3 @@ techage.lua_ctlr.register_action("server_write", {
|
|||||||
" return value: true if successful or false\n"..
|
" return value: true if successful or false\n"..
|
||||||
' example: res = $server_write("123", "state", state)'
|
' example: res = $server_write("123", "state", state)'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
2
mod.conf
2
mod.conf
@ -1,4 +1,4 @@
|
|||||||
name = techage
|
name = techage
|
||||||
depends = default,doors,flowers,tubelib2,networks,basic_materials,bucket,stairs,screwdriver,minecart,lcdlib,safer_lua
|
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!
|
description = Techage, go through 5 tech ages in search of wealth and power!
|
||||||
|
@ -187,4 +187,3 @@ minetest.register_craft({
|
|||||||
},})
|
},})
|
||||||
|
|
||||||
techage.TA4_Cable = Cable
|
techage.TA4_Cable = Cable
|
||||||
|
|
||||||
|
@ -170,4 +170,3 @@ minetest.register_lbm({
|
|||||||
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
minetest.get_node_timer(pos):start(CYCLE_TIME)
|
||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -236,4 +236,3 @@ minetest.register_craft({
|
|||||||
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user