networks, liquids, reactor, barrels, tanks, and pumps introduced
@ -61,6 +61,7 @@ Node mem data:
|
||||
local S = function(pos) if pos then return minetest.pos_to_string(pos) end end
|
||||
local P = minetest.string_to_pos
|
||||
local M = minetest.get_meta
|
||||
local N = techage.get_node_lvm
|
||||
|
||||
--
|
||||
-- TechAge machine states
|
||||
@ -82,6 +83,10 @@ techage.StatesImg = {
|
||||
"techage_inv_button_off.png",
|
||||
}
|
||||
|
||||
local function error(pos, msg)
|
||||
minetest.log("error", "[TA states] "..msg.." at "..S(pos).." "..N(pos).name)
|
||||
end
|
||||
|
||||
-- Return state button image for the node inventory
|
||||
function techage.state_button(state)
|
||||
if state and state < 7 and state > 0 then
|
||||
@ -197,6 +202,8 @@ local function start_timer_delayed(pos, cycle_time)
|
||||
t:stop()
|
||||
if cycle_time > 0.9 then
|
||||
minetest.after(0.1, t.start, t, cycle_time)
|
||||
else
|
||||
error(pos, "invalid cycle_time")
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -16,6 +16,7 @@ local M = minetest.get_meta
|
||||
local N = function(pos) return minetest.get_node(pos).name end
|
||||
local LQD = function(pos) return (minetest.registered_nodes[techage.get_node_lvm(pos).name] or {}).liquid end
|
||||
local Pipe = techage.LiquidPipe
|
||||
local S = techage.S
|
||||
|
||||
local net_def = techage.networks.net_def
|
||||
local networks = techage.networks
|
||||
@ -74,6 +75,8 @@ end
|
||||
|
||||
|
||||
local function get_network_table(pos, outdir, ntype)
|
||||
-- jump to the next node because pumps have to network
|
||||
-- interfaces and therefore can't have a netID
|
||||
local pos2 = Pipe:get_connected_node_pos(pos, outdir)
|
||||
local mem = tubelib2.get_mem(pos2)
|
||||
if not mem.pipe or not mem.pipe.netID then
|
||||
@ -115,7 +118,7 @@ function techage.liquid.put(pos, outdir, name, amount)
|
||||
-- wrong items?
|
||||
local peek = liquid.peek(item.pos, item.indir)
|
||||
if peek and peek ~= name then return amount end
|
||||
techage.mark_position("singleplayer", item.pos, "put", "", 1) ------------------- debug
|
||||
--techage.mark_position("singleplayer", item.pos, "put", "", 1) ------------------- debug
|
||||
amount = liquid.put(item.pos, item.indir, name, amount)
|
||||
if amount == 0 then break end
|
||||
end
|
||||
@ -131,7 +134,7 @@ function techage.liquid.take(pos, outdir, name, amount)
|
||||
for _,item in ipairs(get_network_table(pos, outdir, "tank")) do
|
||||
local liquid = LQD(item.pos)
|
||||
if liquid and liquid.take then
|
||||
techage.mark_position("singleplayer", item.pos, "take", "", 1) ------------------- debug
|
||||
--techage.mark_position("singleplayer", item.pos, "take", "", 1) ------------------- debug
|
||||
local val, name = liquid.take(item.pos, item.indir, name, amount - taken)
|
||||
if val and name then
|
||||
taken = taken + val
|
||||
@ -226,8 +229,21 @@ function techage.liquid.update_network(pos, outdir)
|
||||
delete_netID(pos, outdir)
|
||||
end
|
||||
|
||||
minetest.register_craftitem("techage:water", {
|
||||
description = S("Water"),
|
||||
inventory_image = "techage_water_inv.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
||||
})
|
||||
|
||||
techage.register_liquid("bucket:bucket_water", "bucket:bucket_empty", 1, "default:water_source")
|
||||
techage.register_liquid("bucket:bucket_river_water", "bucket:bucket_empty", 1, "default:river_water_source")
|
||||
minetest.register_craftitem("techage:river_water", {
|
||||
description = S("Water"),
|
||||
inventory_image = "techage_water_inv.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
|
||||
})
|
||||
|
||||
techage.register_liquid("bucket:bucket_water", "bucket:bucket_empty", 1, "techage:water")
|
||||
techage.register_liquid("bucket:bucket_river_water", "bucket:bucket_empty", 1, "techage:river_water")
|
||||
techage.register_liquid("bucket:bucket_lava", "bucket:bucket_empty", 1, "default:lava_source")
|
||||
|
||||
|
@ -54,25 +54,32 @@ local function formspec_oil(x, y, mem)
|
||||
if mem.running then
|
||||
fuel_percent = ((mem.burn_cycles or 1) * 100) / (mem.burn_cycles_total or 1)
|
||||
end
|
||||
-- return "container["..x..","..y.."]"..
|
||||
-- "background[0,0;2,2.05;techage_form_grey.png]"..
|
||||
-- "image[0,0;1,1;techage_form_input_arrow.png]"..
|
||||
-- "image[1,0;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
-- fuel_percent..":default_furnace_fire_fg.png]"..
|
||||
-- techage.item_image(1, 1, itemname)..
|
||||
-- "list[context;fuel;0,1;1,1;]"..
|
||||
-- "container_end[]"
|
||||
return "container["..x..","..y.."]"..
|
||||
"background[0,0;2,2.05;techage_form_grey.png]"..
|
||||
"image[0,0;1,1;techage_form_input_arrow.png]"..
|
||||
"image[1,0;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
"background[0,0;3,1.05;techage_form_grey.png]"..
|
||||
"list[context;fuel;0,0;1,1;]"..
|
||||
techage.item_image(1, 0, itemname)..
|
||||
"image[2,0;1,1;default_furnace_fire_bg.png^[lowpart:"..
|
||||
fuel_percent..":default_furnace_fire_fg.png]"..
|
||||
techage.item_image(1, 1, itemname)..
|
||||
"list[context;fuel;0,1;1,1;]"..
|
||||
"container_end[]"
|
||||
end
|
||||
|
||||
function techage.oilburner.formspec(mem)
|
||||
local update = ((mem.countdown or 0) > 0 and mem.countdown) or S("Update")
|
||||
return "size[8,6]"..
|
||||
return "size[8,5]"..
|
||||
default.gui_bg..
|
||||
default.gui_bg_img..
|
||||
default.gui_slots..
|
||||
formspec_oil(2, 0, mem)..
|
||||
"button[5.5,0.5;2,1;update;"..update.."]"..
|
||||
"list[current_player;main;0,2.3;8,4;]"
|
||||
formspec_oil(1, 0, mem)..
|
||||
"button[5,0;2,1;update;"..update.."]"..
|
||||
"list[current_player;main;0,1.3;8,4;]"
|
||||
end
|
||||
|
||||
local function fill_container(pos, inv, mem)
|
||||
|
@ -77,13 +77,13 @@ end
|
||||
local function node_timer3(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
pumping(pos, mem, State3, CAPA)
|
||||
return true
|
||||
return State3:is_active(mem)
|
||||
end
|
||||
|
||||
local function node_timer4(pos, elapsed)
|
||||
local mem = tubelib2.get_mem(pos)
|
||||
pumping(pos, mem, State4, CAPA * 2)
|
||||
return true
|
||||
return State4:is_active(mem)
|
||||
end
|
||||
|
||||
local function on_rightclick(pos, node, clicker)
|
||||
@ -196,7 +196,7 @@ minetest.register_node("techage:t3_pump", {
|
||||
after_place_node = after_place_node3,
|
||||
on_rightclick = on_rightclick,
|
||||
tubelib2_on_update2 = tubelib2_on_update2,
|
||||
--on_timer = node_timer3,
|
||||
on_timer = node_timer3,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rotate = screwdriver.disallow,
|
||||
networks = nworks,
|
||||
@ -231,7 +231,7 @@ minetest.register_node("techage:t4_pump", {
|
||||
after_place_node = after_place_node4,
|
||||
on_rightclick = on_rightclick,
|
||||
tubelib2_on_update2 = tubelib2_on_update2,
|
||||
--on_timer = node_timer4,
|
||||
on_timer = node_timer4,
|
||||
after_dig_node = after_dig_node,
|
||||
on_rotate = screwdriver.disallow,
|
||||
networks = nworks,
|
||||
|
Before Width: | Height: | Size: 266 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 205 B After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 539 B After Width: | Height: | Size: 250 B |
Before Width: | Height: | Size: 208 B After Width: | Height: | Size: 179 B |
Before Width: | Height: | Size: 347 B After Width: | Height: | Size: 215 B |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 226 B |
Before Width: | Height: | Size: 592 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 385 B |
BIN
textures/techage_barrel_water_inv.png
Normal file
After Width: | Height: | Size: 419 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 422 B |
Before Width: | Height: | Size: 223 B After Width: | Height: | Size: 201 B |
Before Width: | Height: | Size: 185 B After Width: | Height: | Size: 175 B |
Before Width: | Height: | Size: 221 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 272 B After Width: | Height: | Size: 219 B |
Before Width: | Height: | Size: 220 B After Width: | Height: | Size: 191 B |
Before Width: | Height: | Size: 934 B After Width: | Height: | Size: 487 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 432 B |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 351 B |
Before Width: | Height: | Size: 734 B After Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 848 B After Width: | Height: | Size: 428 B |
Before Width: | Height: | Size: 742 B After Width: | Height: | Size: 392 B |
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 329 B |
BIN
textures/techage_water_inv.png
Normal file
After Width: | Height: | Size: 351 B |