Fix ta5 hyperloop tank bug, EOF blank added

This commit is contained in:
Joachim Stolberg 2022-01-04 19:40:27 +01:00
parent f96abd97b7
commit f8ca493a6b
173 changed files with 199 additions and 205 deletions

View File

@ -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"

View File

@ -129,4 +129,3 @@ techage.register_node({"protector:chest"}, {
return techage.put_items(inv, "main", stack)
end,
})

View File

@ -89,4 +89,3 @@ techage.manual_DE.aPlanTable = {
"",
"",
}

View File

@ -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,26 +61,47 @@ function techage.shared_tank.can_dig(pos, player)
end
function techage.shared_tank.peek_liquid(pos, indir)
pos = remote_pos(pos)
local nvm = techage.get_nvm(pos)
return liquid.srv_peek(nvm)
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)
pos = remote_pos(pos)
local nvm = techage.get_nvm(pos)
amount, name = liquid.srv_take(nvm, name, amount)
if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(pos))
if is_paired(pos) then
pos = remote_pos(pos)
local nvm = techage.get_nvm(pos)
amount, name = liquid.srv_take(nvm, name, amount)
if techage.is_activeformspec(pos) then
M(pos):set_string("formspec", formspec(pos))
end
return amount, name
end
return amount, name
return 0, name
end
function techage.shared_tank.put_liquid(pos, indir, name, amount)
pos = remote_pos(pos)
-- check if it is not powder
local ndef = minetest.registered_craftitems[name] or {}
if not ndef.groups or ndef.groups.powder ~= 1 then
if is_paired(pos) then
pos = remote_pos(pos)
-- check if it is not powder
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 ndef = NDEF(pos)
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
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

View File

@ -142,4 +142,3 @@ minetest.register_craft({
{'', '', ''},
},
})

View File

@ -2552,4 +2552,3 @@ techage.manual_DE.aPlanTable = {
"",
"",
}

View File

@ -2545,4 +2545,3 @@ techage.manual_EN.aPlanTable = {
"",
"",
}

View File

@ -37,4 +37,3 @@ function techage.add_to_manual(language, titles, texts, items, plans)
tbl.aPlanTable[#tbl.aPlanTable + 1] = item
end
end

View File

@ -128,4 +128,3 @@ minetest.register_craft({
{"", "techage:ta4_wlanchip", ""},
},
})

View File

@ -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

View File

@ -246,4 +246,3 @@ function techage.stop_burner(pos)
minetest.sound_stop(handle)
meta:set_int("burn_time", 0)
end

View File

@ -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"})

View File

@ -408,4 +408,3 @@ techage.register_node({"techage:ta3_logic2"}, {
end
end,
})

View File

@ -250,4 +250,3 @@ techage.register_node({"techage:ta3_logic"}, {
end,
})

View File

@ -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)'
})

View File

@ -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!

View File

@ -187,4 +187,3 @@ minetest.register_craft({
},})
techage.TA4_Cable = Cable

View File

@ -170,4 +170,3 @@ minetest.register_lbm({
minetest.get_node_timer(pos):start(CYCLE_TIME)
end
})

View File

@ -236,4 +236,3 @@ minetest.register_craft({
{"default:wood", "techage:iron_ingot", "basic_materials:steel_bar"},
},
})