ta5 hyperloop tank addded
This commit is contained in:
parent
8f037a4ec0
commit
e2834a20ff
@ -17,14 +17,10 @@ local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local TA4_INV_SIZE = 50
|
||||
local EX_POINTS = 20
|
||||
|
||||
local MP = minetest.get_modpath(minetest.get_current_modname())
|
||||
local mConf = dofile(MP.."/basis/conf_inv.lua")
|
||||
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
|
||||
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
@ -200,17 +196,6 @@ local function formspec4(pos)
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function formspec5(pos)
|
||||
return "size[10,9]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
"list[context;main;0,0;10,5;]"..
|
||||
"list[current_player;main;1,5.3;8,4;]"..
|
||||
"listring[context;main]"..
|
||||
"listring[current_player;main]"
|
||||
end
|
||||
|
||||
local function formspec4_pre(pos)
|
||||
return "size[10,9]"..
|
||||
"tabheader[0,0;tab;"..S("Inventory,Pre-Assignment,Config")..";2;;true]"..
|
||||
@ -243,10 +228,6 @@ local function ta4_allow_metadata_inventory_put(pos, listname, index, stack, pla
|
||||
return 0
|
||||
end
|
||||
|
||||
if techage.hyperloop.is_client(pos) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
@ -260,10 +241,6 @@ local function ta4_allow_metadata_inventory_take(pos, listname, index, stack, pl
|
||||
return 0
|
||||
end
|
||||
|
||||
if techage.hyperloop.is_client(pos) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if listname == "main" then
|
||||
return stack:get_count()
|
||||
else
|
||||
@ -277,10 +254,6 @@ local function ta4_allow_metadata_inventory_move(pos, from_list, from_index, to_
|
||||
return 0
|
||||
end
|
||||
|
||||
if techage.hyperloop.is_client(pos) then
|
||||
return 0
|
||||
end
|
||||
|
||||
if from_list == "main" then
|
||||
return count
|
||||
else
|
||||
@ -314,7 +287,6 @@ minetest.register_node("techage:chest_ta4", {
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
meta:set_string("formspec", formspec4(pos))
|
||||
meta:set_string("infotext", S("TA4 Protected Chest").." "..number)
|
||||
hyperloop.after_place_node(pos, placer, "chest")
|
||||
end,
|
||||
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
@ -353,22 +325,8 @@ minetest.register_node("techage:chest_ta4", {
|
||||
return techage.logic.set_numbers(pos, numbers, player_name, S("TA4 Protected Chest"))
|
||||
end,
|
||||
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
if hyperloop.is_client(pos) then
|
||||
M(pos):set_string("formspec", formspec5(pos))
|
||||
elseif hyperloop.is_server(pos) then
|
||||
M(pos):set_string("formspec", formspec5(pos))
|
||||
end
|
||||
end,
|
||||
|
||||
can_dig = can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
ta5_formspec = {menu=hyperloop.WRENCH_MENU, ex_points=EX_POINTS},
|
||||
ta_after_formspec = hyperloop.after_formspec,
|
||||
after_dig_node = after_dig_node,
|
||||
allow_metadata_inventory_put = ta4_allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_take = ta4_allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_move = ta4_allow_metadata_inventory_move,
|
||||
@ -382,12 +340,10 @@ minetest.register_node("techage:chest_ta4", {
|
||||
|
||||
techage.register_node({"techage:chest_ta4"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return meta:get_inventory(), "main"
|
||||
end,
|
||||
on_pull_item = function(pos, in_dir, num, item_name)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
@ -415,7 +371,6 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
end
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, item, idx)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
@ -432,7 +387,6 @@ techage.register_node({"techage:chest_ta4"}, {
|
||||
end
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, item)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
@ -8,7 +8,7 @@
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA5 Hyperloop Chest/Tank
|
||||
TA5 Hyperloop Chest
|
||||
|
||||
]]--
|
||||
|
||||
@ -16,7 +16,6 @@
|
||||
local S2P = minetest.string_to_pos
|
||||
local P2S = minetest.pos_to_string
|
||||
local M = minetest.get_meta
|
||||
local N = techage.get_node_lvm
|
||||
local S = techage.S
|
||||
|
||||
local TA4_INV_SIZE = 32
|
||||
@ -27,20 +26,6 @@ local remote_pos = techage.hyperloop.remote_pos
|
||||
local shared_inv = techage.shared_inv
|
||||
local menu = techage.menu
|
||||
|
||||
local function can_dig(pos, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return false
|
||||
end
|
||||
|
||||
shared_inv.before_inv_access(pos, "main")
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end
|
||||
|
||||
local function after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end
|
||||
|
||||
local function formspec(pos)
|
||||
local ndef = minetest.registered_nodes["techage:ta5_hl_chest"]
|
||||
local status = M(pos):get_string("conn_status")
|
||||
@ -118,16 +103,24 @@ minetest.register_node("techage:ta5_hl_chest", {
|
||||
if techage.get_expoints(player) >= EX_POINTS then
|
||||
if techage.menu.eval_input(pos, hyperloop.SUBMENU, fields) then
|
||||
hyperloop.after_formspec(pos, fields)
|
||||
shared_inv.on_rightclick(pos, player, "main")
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_timer = shared_inv.node_timer,
|
||||
on_rightclick = function(pos, node, clicker)
|
||||
shared_inv.on_rightclick(pos, node, clicker)
|
||||
shared_inv.on_rightclick(pos, clicker, "main")
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end,
|
||||
can_dig = can_dig,
|
||||
can_dig = function(pos, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return false
|
||||
end
|
||||
shared_inv.before_inv_access(pos, "main")
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
return inv:is_empty("main")
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
@ -155,67 +148,26 @@ techage.register_node({"techage:ta5_hl_chest"}, {
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
if inv:is_empty("main") then
|
||||
return nil
|
||||
end
|
||||
|
||||
if item_name then
|
||||
if mem.filter[item_name] or not mem.chest_configured then
|
||||
local taken = inv:remove_item("main", {name = item_name, count = num})
|
||||
if taken:get_count() > 0 then
|
||||
return taken
|
||||
end
|
||||
end
|
||||
else -- no item given
|
||||
if mem.chest_configured then
|
||||
return mConf.take_item(pos, inv, "main", num, mem.filter["unconfigured"])
|
||||
else
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end
|
||||
end
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, item, idx)
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
if techage.hyperloop.is_paired(pos) then
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end
|
||||
return false
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
return mConf.put_items(pos, inv, "main", item, stacks, idx)
|
||||
else
|
||||
return techage.put_items(inv, "main", item, idx)
|
||||
end
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, item)
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local mem = techage.get_mem(pos)
|
||||
|
||||
mem.filter = mem.filter or mConf.item_filter(pos, TA4_INV_SIZE)
|
||||
mem.chest_configured = mem.chest_configured or not inv:is_empty("conf")
|
||||
|
||||
if mem.chest_configured then
|
||||
local name = item:get_name()
|
||||
local stacks = mem.filter[name] or mem.filter["unconfigured"]
|
||||
return mConf.put_items(pos, inv, "main", item, stacks)
|
||||
else
|
||||
return techage.put_items(inv, "main", item)
|
||||
end
|
||||
end,
|
||||
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
if topic == "state" then
|
||||
pos = remote_pos(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.get_inv_state(inv, "main")
|
||||
@ -225,8 +177,9 @@ techage.register_node({"techage:ta5_hl_chest"}, {
|
||||
end,
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "techage:ta5_hl_chest",
|
||||
recipe = {"techage:chest_ta4", "techage:aichip"}
|
||||
recipe = {"techage:chest_ta4", "techage:ta5_aichip"}
|
||||
})
|
||||
|
@ -3,7 +3,7 @@
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
@ -148,7 +148,6 @@ function techage.hyperloop.is_client(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if Stations:get(nvm.rmt_pos) then
|
||||
if M(pos):get_string("status") == "client" then
|
||||
print("is_client2", true)
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
@ -30,8 +30,8 @@ local function help(x, y)
|
||||
"tooltip["..x..","..y..";0.5,0.5;"..tooltip..";#0C3D32;#FFFFFF]"
|
||||
end
|
||||
|
||||
function techage.liquid.formspec(pos, nvm)
|
||||
local title = S("Liquid Tank")
|
||||
function techage.liquid.formspec(pos, nvm, title)
|
||||
title = title or S("Liquid Tank")
|
||||
local itemname = "techage:liquid"
|
||||
if nvm.liquid and nvm.liquid.amount and nvm.liquid.amount > 0 and nvm.liquid.name then
|
||||
itemname = nvm.liquid.name.." "..nvm.liquid.amount
|
||||
@ -41,19 +41,19 @@ function techage.liquid.formspec(pos, nvm)
|
||||
local meta = M(pos)
|
||||
local public = dump((meta:get_int("public") or 0) == 1)
|
||||
local keep_assignment = dump((meta:get_int("keep_assignment") or 0) == 1)
|
||||
return "size[5,3.5]"..
|
||||
"box[0,-0.1;4.8,0.5;#c6e8ff]"..
|
||||
"label[1.5,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(4.4, -0.1)..
|
||||
techage.item_image(2, 1, itemname)..
|
||||
return "size[8,3.5]"..
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||
"label[0.2,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(7.4, -0.1)..
|
||||
techage.item_image(3.5, 1, itemname)..
|
||||
"checkbox[0.1,2.5;public;"..S("Allow public access to the tank")..";"..public.."]"..
|
||||
"checkbox[0.1,3;keep_assignment;"..S("keep assignment")..";"..keep_assignment.."]"
|
||||
else
|
||||
return "size[4,2]"..
|
||||
"box[0,-0.1;3.8,0.5;#c6e8ff]"..
|
||||
"label[1,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(3.4, -0.1)..
|
||||
techage.item_image(1.5, 1, itemname)
|
||||
return "size[8,2]"..
|
||||
"box[0,-0.1;7.8,0.5;#c6e8ff]"..
|
||||
"label[0.2,-0.1;"..minetest.colorize("#000000", title).."]"..
|
||||
help(7.4, -0.1)..
|
||||
techage.item_image(3.5, 1, itemname)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2021 Joachim Stolberg
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
@ -40,7 +40,6 @@ end
|
||||
|
||||
-- Synchronize the client inventory with the server one
|
||||
function techage.shared_inv.before_inv_access(pos, listname)
|
||||
print("before_inv_access", listname)
|
||||
if hyperloop.is_client(pos) then
|
||||
local rmt_pos = remote_pos(pos)
|
||||
copy_inventory_list(rmt_pos, pos, listname)
|
||||
@ -51,7 +50,6 @@ end
|
||||
|
||||
-- Synchronize the client inventory with the server one
|
||||
function techage.shared_inv.after_inv_access(pos, listname)
|
||||
print("after_inv_access", listname)
|
||||
if hyperloop.is_client(pos) then
|
||||
local rmt_pos = remote_pos(pos)
|
||||
copy_inventory_list(pos, rmt_pos, listname)
|
||||
@ -60,10 +58,12 @@ function techage.shared_inv.after_inv_access(pos, listname)
|
||||
return false
|
||||
end
|
||||
|
||||
function techage.shared_inv.on_rightclick(pos, node, clicker)
|
||||
function techage.shared_inv.on_rightclick(pos, clicker, listname)
|
||||
if hyperloop.is_client(pos) then
|
||||
copy_inventory_list(remote_pos(pos), pos, "main")
|
||||
local rmt_pos = remote_pos(pos)
|
||||
copy_inventory_list(rmt_pos, pos, listname)
|
||||
techage.set_activeformspec(pos, clicker)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end
|
||||
end
|
||||
|
||||
|
106
basis/shared_tank.lua
Normal file
106
basis/shared_tank.lua
Normal file
@ -0,0 +1,106 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
Library for shared inventories
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local M = minetest.get_meta
|
||||
local NDEF = function(pos) return minetest.registered_nodes[techage.get_node_lvm(pos).name] or {} end
|
||||
|
||||
techage.shared_tank = {}
|
||||
|
||||
local liquid = networks.liquid
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
local menu = techage.menu
|
||||
|
||||
local function formspec(pos)
|
||||
local ndef = NDEF(pos)
|
||||
local status = M(pos):get_string("conn_status")
|
||||
if hyperloop.is_client(pos) or hyperloop.is_server(pos) then
|
||||
local title = ndef.description .. " " .. status
|
||||
local nvm = techage.get_nvm(remote_pos(pos))
|
||||
return techage.liquid.formspec(pos, nvm, title)
|
||||
else
|
||||
return menu.generate_formspec(pos, ndef, hyperloop.SUBMENU)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.shared_tank.node_timer(pos)
|
||||
print("node_timer", minetest.pos_to_string(pos))
|
||||
if techage.is_activeformspec(pos) then
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function techage.shared_tank.on_rightclick(pos, node, clicker)
|
||||
--if hyperloop.is_client(pos) then
|
||||
techage.set_activeformspec(pos, clicker)
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
--end
|
||||
M(pos):set_string("formspec", formspec(pos))
|
||||
end
|
||||
|
||||
function techage.shared_tank.can_dig(pos, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return false
|
||||
end
|
||||
pos = remote_pos(pos)
|
||||
return techage.liquid.is_empty(pos)
|
||||
end
|
||||
|
||||
function techage.shared_tank.peek_liquid(pos, indir)
|
||||
pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
return liquid.srv_peek(nvm)
|
||||
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))
|
||||
end
|
||||
return amount, 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
|
||||
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
|
||||
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
|
@ -114,7 +114,6 @@ local function generate_formspec_substring(pos, meta, form_def, player_name)
|
||||
local choices = elem.on_dropdown(pos)
|
||||
local l = choices:split(",")
|
||||
local idx = index(l, val) or 1
|
||||
print("choices", dump(choices), idx, val)
|
||||
tbl[#tbl+1] = "dropdown[4.72," .. (offs) .. ";5.5,1.4;" .. elem.name .. ";" .. choices .. ";" .. idx .. "]"
|
||||
else
|
||||
local val = elem.default
|
||||
|
2
init.lua
2
init.lua
@ -102,6 +102,7 @@ dofile(MP.."/basis/hyperloop.lua")
|
||||
dofile(MP.."/basis/oggfiles.lua")
|
||||
dofile(MP.."/basis/submenu.lua")
|
||||
dofile(MP.."/basis/shared_inv.lua")
|
||||
dofile(MP.."/basis/shared_tank.lua")
|
||||
|
||||
-- Main doc
|
||||
dofile(MP.."/doc/manual_DE.lua")
|
||||
@ -201,6 +202,7 @@ dofile(MP.."/liquids/silo.lua")
|
||||
dofile(MP.."/liquids/pump.lua")
|
||||
dofile(MP.."/liquids/waterpump.lua")
|
||||
dofile(MP.."/liquids/waterinlet.lua")
|
||||
dofile(MP.."/liquids/ta5_tank.lua")
|
||||
|
||||
-- Coal power station
|
||||
dofile(MP.."/coal_power_station/firebox.lua")
|
||||
|
105
liquids/ta5_tank.lua
Normal file
105
liquids/ta5_tank.lua
Normal file
@ -0,0 +1,105 @@
|
||||
--[[
|
||||
|
||||
TechAge
|
||||
=======
|
||||
|
||||
Copyright (C) 2019-2022 Joachim Stolberg
|
||||
|
||||
AGPL v3
|
||||
See LICENSE.txt for more information
|
||||
|
||||
TA5 Hyperloop Tank
|
||||
|
||||
]]--
|
||||
|
||||
-- for lazy programmers
|
||||
local S2P = minetest.string_to_pos
|
||||
local P2S = minetest.pos_to_string
|
||||
local M = minetest.get_meta
|
||||
local S = techage.S
|
||||
|
||||
local Pipe = techage.LiquidPipe
|
||||
local liquid = networks.liquid
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
local shared_tank = techage.shared_tank
|
||||
local menu = techage.menu
|
||||
|
||||
local CAPACITY = 1000
|
||||
local EX_POINTS = 20
|
||||
|
||||
minetest.register_node("techage:ta5_hl_tank", {
|
||||
description = S("TA5 Hyperloop Tank"),
|
||||
tiles = {
|
||||
-- up, down, right, left, back, front
|
||||
"techage_filling_ta4.png^techage_frame_ta5_top.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_tank.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_tank.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_tank.png",
|
||||
"techage_filling_ta4.png^techage_frame_ta5.png^techage_appl_tank.png",
|
||||
},
|
||||
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = M(pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
nvm.liquid = {}
|
||||
local number = techage.add_node(pos, "techage:ta5_hl_tank")
|
||||
meta:set_string("node_number", number)
|
||||
meta:set_string("owner", placer:get_player_name())
|
||||
meta:set_string("formspec", shared_tank.formspec(pos))
|
||||
meta:set_string("infotext", S("TA5 Hyperloop Tank").." "..number)
|
||||
Pipe:after_place_node(pos)
|
||||
hyperloop.after_place_node(pos, placer, "tank")
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return
|
||||
end
|
||||
if techage.get_expoints(player) >= EX_POINTS then
|
||||
if techage.menu.eval_input(pos, hyperloop.SUBMENU, fields) then
|
||||
hyperloop.after_formspec(pos, fields)
|
||||
shared_tank.on_rightclick(pos, nil, player)
|
||||
M(pos):set_string("formspec", shared_tank.formspec(pos))
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_timer = shared_tank.node_timer,
|
||||
on_rightclick = shared_tank.on_rightclick,
|
||||
on_punch = function(pos, node, puncher)
|
||||
return techage.liquid.on_punch(remote_pos(pos), node, puncher)
|
||||
end,
|
||||
can_dig = shared_tank.can_dig,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
techage.del_mem(pos)
|
||||
end,
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
groups = {cracky=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
liquid.register_nodes({"techage:ta5_hl_tank"},
|
||||
Pipe, "tank", nil, {
|
||||
capa = CAPACITY,
|
||||
peek = shared_tank.peek_liquid,
|
||||
put = shared_tank.put_liquid,
|
||||
take = shared_tank.take_liquid,
|
||||
untake = shared_tank.untake_liquid,
|
||||
}
|
||||
)
|
||||
|
||||
techage.register_node({"techage:ta5_hl_tank"}, techage.liquid.recv_message)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "techage:ta5_hl_tank",
|
||||
recipe = {
|
||||
{"", "techage:ta5_aichip", ""},
|
||||
{"", "techage:ta5_hl_tank", ""},
|
||||
{"", "", ""},
|
||||
},
|
||||
})
|
@ -21,25 +21,19 @@ local S = techage.S
|
||||
local Pipe = techage.LiquidPipe
|
||||
local liquid = networks.liquid
|
||||
|
||||
local hyperloop = techage.hyperloop
|
||||
local remote_pos = techage.hyperloop.remote_pos
|
||||
|
||||
local CAPACITY = 1000
|
||||
local EX_POINTS = 20
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
local rmt_pos = remote_pos(pos)
|
||||
local nvm = techage.get_nvm(rmt_pos)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
techage.set_activeformspec(pos, clicker)
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(rmt_pos, nvm))
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
|
||||
minetest.get_node_timer(pos):start(2)
|
||||
end
|
||||
|
||||
local function node_timer(pos, elapsed)
|
||||
local rmt_pos = remote_pos(pos)
|
||||
if techage.is_activeformspec(pos) then
|
||||
local nvm = techage.get_nvm(rmt_pos)
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(rmt_pos, nvm))
|
||||
local nvm = techage.get_nvm(pos)
|
||||
M(pos):set_string("formspec", techage.liquid.formspec(pos, nvm))
|
||||
return true
|
||||
end
|
||||
return false
|
||||
@ -220,7 +214,6 @@ minetest.register_node("techage:ta4_tank", {
|
||||
meta:set_string("formspec", techage.liquid.formspec(pos, nvm))
|
||||
meta:set_string("infotext", S("TA4 Tank").." "..number)
|
||||
Pipe:after_place_node(pos)
|
||||
hyperloop.after_place_node(pos, placer, "tank")
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
@ -234,17 +227,12 @@ minetest.register_node("techage:ta4_tank", {
|
||||
end
|
||||
end,
|
||||
on_timer = node_timer,
|
||||
on_punch = function(pos, node, puncher)
|
||||
return techage.liquid.on_punch(remote_pos(pos), node, puncher)
|
||||
end,
|
||||
on_punch = techage.liquid.on_punch,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
Pipe:after_dig_node(pos)
|
||||
hyperloop.after_dig_node(pos, oldnode, oldmetadata, digger)
|
||||
techage.remove_node(pos, oldnode, oldmetadata)
|
||||
end,
|
||||
on_rightclick = on_rightclick,
|
||||
ta5_formspec = {menu=hyperloop.WRENCH_MENU, ex_points=EX_POINTS},
|
||||
ta_after_formspec = hyperloop.after_formspec,
|
||||
can_dig = can_dig,
|
||||
paramtype2 = "facedir",
|
||||
on_rotate = screwdriver.disallow,
|
||||
@ -256,18 +244,10 @@ minetest.register_node("techage:ta4_tank", {
|
||||
liquid.register_nodes({"techage:ta4_tank"},
|
||||
Pipe, "tank", nil, {
|
||||
capa = CAPACITY * 2,
|
||||
peek = function(pos, indir)
|
||||
return peek_liquid(remote_pos(pos), indir)
|
||||
end,
|
||||
put = function(pos, indir, name, amount)
|
||||
return put_liquid(remote_pos(pos), indir, name, amount)
|
||||
end,
|
||||
take = function(pos, indir, name, amount)
|
||||
return take_liquid(remote_pos(pos), indir, name, amount)
|
||||
end,
|
||||
untake = function(pos, indir, name, amount)
|
||||
return untake_liquid(remote_pos(pos), indir, name, amount)
|
||||
end,
|
||||
peek = peek_liquid,
|
||||
put = put_liquid,
|
||||
take = take_liquid,
|
||||
untake = untake_liquid,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -30,27 +30,27 @@ Die Nutzung des TA5 Flug Controllers benötigt 40 Erfahrungspunkte.
|
||||
|
||||
[ta5_flycontroller|image]
|
||||
|
||||
### TA5 Hyperloop Transport Kiste
|
||||
### TA5 Hyperloop Kiste / TA5 Hyperloop Chest
|
||||
|
||||
Die TA5 Hyperloop Transport Kiste erlaubt den Transport von Gegenständen über ein Hyperloop Netzwerk.
|
||||
Die TA5 Hyperloop Kiste erlaubt den Transport von Gegenständen über ein Hyperloop Netzwerk.
|
||||
|
||||
Eine normale TA4 Kiste muss man dazu auf eine Hyperloop Junction stellen. Die Kiste bekommt damit ein zusätzliches Schraubenschlüssel-Menü mit dem man das Pairing von zwei Kisten durchführen kann. Dinge, die in der Kiste sind, werden zur Gegenstelle teleportiert. Die Kiste kann auch mit einem Schieber gefüllt/geleert werden.
|
||||
Die TA5 Hyperloop Kiste muss man dazu auf eine Hyperloop Junction stellen. Die Kiste besitzt ein spezielles Menü, mit dem man das Pairing von zwei Kisten durchführen kann. Dinge, die in der Kiste sind, werden zur Gegenstelle teleportiert. Die Kiste kann auch mit einem Schieber gefüllt/geleert werden.
|
||||
|
||||
Für das Pairing musst du zuerst auf der einen Seite einen Namen für die Kiste eingeben, dann kannst du bei der anderen Kiste diesen Namen auswählen und so die beiden Blöcke verbinden.
|
||||
|
||||
Die Nutzung der TA5 Hyperloop Transport Kiste benötigt 20 Erfahrungspunkte.
|
||||
Die Nutzung der TA5 Hyperloop Kiste benötigt 20 Erfahrungspunkte.
|
||||
|
||||
[ta4_chest|image]
|
||||
|
||||
### TA5 Hyperloop Transport Tank
|
||||
### TA5 Hyperloop Tank / TA5 Hyperloop Tank
|
||||
|
||||
Der TA5 Hyperloop Transport Tank erlaubt den Transport von Flüssigkeiten über ein Hyperloop Netzwerk.
|
||||
Der TA5 Hyperloop Tank erlaubt den Transport von Flüssigkeiten über ein Hyperloop Netzwerk.
|
||||
|
||||
Ein TA4 Tank muss man dazu auf eine Hyperloop Junction stellen. Der Tank bekommt damit ein zusätzliches Schraubenschlüssel-Menü mit dem man das Pairing von zwei Tanks durchführen kann. Flüssigkeiten, die in dem Tank sind, werden zur Gegenstelle teleportiert. Der Tank kann auch mit einer Pumpe gefüllt/geleert werden.
|
||||
Den TA5 Hyperloop Tank muss man dazu auf eine Hyperloop Junction stellen. Der Tank besitzt ein spezielles Menü, mit dem man das Pairing von zwei Tanks durchführen kann. Flüssigkeiten, die in dem Tank sind, werden zur Gegenstelle teleportiert. Der Tank kann auch mit einer Pumpe gefüllt/geleert werden.
|
||||
|
||||
Für das Pairing musst du zuerst auf der einen Seite einen Namen für den Tank eingeben, dann kannst du bei dem anderen Tank diesen Namen auswählen und so die beiden Blöcke verbinden.
|
||||
|
||||
Die Nutzung des TA5 Hyperloop Transport Tanks benötigt 20 Erfahrungspunkte.
|
||||
Die Nutzung des TA5 Hyperloop Tanks benötigt 20 Erfahrungspunkte.
|
||||
|
||||
[ta4_tank|image]
|
||||
|
||||
|
@ -30,27 +30,27 @@ The use of the TA5 Flight Controller requires 40 experience points.
|
||||
|
||||
[ta5_flycontroller|image]
|
||||
|
||||
### TA5 Hyperloop Transport Chest
|
||||
### TA5 Hyperloop Chest
|
||||
|
||||
The TA5 Hyperloop Transport Chest allows objects to be transported over a Hyperloop network.
|
||||
The TA5 Hyperloop Chest allows objects to be transported over a Hyperloop network.
|
||||
|
||||
A normal TA4 chest has to be placed on a Hyperloop Junction. The chest has an additional wrench menu with which you can pair two chests. Things that are in the chest are teleported to the remote station. The box can also be filled/emptied with a pusher.
|
||||
The TA5 Hyperloop Chest has to be placed on a Hyperloop Junction. The chest has a special menu, with which you can pair two chests. Things that are in the chest are teleported to the remote station. The chest can also be filled/emptied with a pusher.
|
||||
|
||||
For pairing you first have to enter a name for the chest on one side, then you can select this name for the other chest and thus connect the two blocks.
|
||||
|
||||
The use of the TA5 Hyperloop Transport Chest requires 20 experience points.
|
||||
The use of the TA5 Hyperloop Chest requires 20 experience points.
|
||||
|
||||
[ta4_chest|image]
|
||||
|
||||
### TA5 Hyperloop Transport Tank
|
||||
### TA5 Hyperloop Tank
|
||||
|
||||
The TA5 Hyperloop Transport Tank allows liquids to be transported over a Hyperloop network.
|
||||
The TA5 Hyperloop Tank allows liquids to be transported over a Hyperloop network.
|
||||
|
||||
A TA4 Tank has to be placed on a Hyperloop Junction. This gives the tank an additional wrench menu that can be used to pair two tanks. Liquids in the tank will be teleported to the remote station. The tank can also be filled/emptied with a pump.
|
||||
The TA5 Hyperloop Tank has to be placed on a Hyperloop Junction.The tank has a special menu, with which you can pair two tanks. Liquids in the tank will be teleported to the remote station. The tank can also be filled/emptied with a pump.
|
||||
|
||||
For pairing you first have to enter a name for the tank on one side, then you can select this name for the other tank and thus connect the two blocks.
|
||||
|
||||
The use of the TA5 Hyperloop Transport Tank requires 20 experience points.
|
||||
The use of the TA5 Hyperloop Tank requires 20 experience points.
|
||||
|
||||
[ta4_tank|image]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user