code freeze for adding consumer model

This commit is contained in:
Joachim Stolberg 2019-03-10 11:36:00 +01:00
parent 04bd91b6e7
commit e8c5f02c64
9 changed files with 43 additions and 31 deletions

View File

@ -23,12 +23,12 @@ techage.register_node("default:chest", {"default:chest_open"}, {
on_push_item = function(pos, in_dir, stack) on_push_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_item(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
on_unpull_item = function(pos, in_dir, stack) on_unpull_item = function(pos, in_dir, stack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_item(inv, "main", stack) return techage.put_items(inv, "main", stack)
end, end,
}) })
@ -43,14 +43,14 @@ techage.register_node("default:furnace", {"default:furnace_active"}, {
local inv = meta:get_inventory() local inv = meta:get_inventory()
minetest.get_node_timer(pos):start(1.0) minetest.get_node_timer(pos):start(1.0)
if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then
return techage.put_item(inv, "fuel", stack) return techage.put_items(inv, "fuel", stack)
else else
return techage.put_item(meta, "src", stack) return techage.put_items(meta, "src", stack)
end end
end, end,
on_unpull_item = function(pos, side, stack) on_unpull_item = function(pos, side, stack)
local meta = minetest.get_meta(pos) local meta = minetest.get_meta(pos)
local inv = meta:get_inventory() local inv = meta:get_inventory()
return techage.put_item(meta, "dst", stack) return techage.put_items(meta, "dst", stack)
end, end,
}) })

View File

@ -29,7 +29,6 @@ local M = minetest.get_meta
-- Techage Related Data -- Techage Related Data
local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end local TRD = function(pos) return (minetest.registered_nodes[minetest.get_node(pos).name] or {}).techage end
local TRDN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end local TRDN = function(node) return (minetest.registered_nodes[node.name] or {}).techage end
-- Load support for intllib. -- Load support for intllib.
local MP = minetest.get_modpath("tubelib2") local MP = minetest.get_modpath("tubelib2")
local I,_ = dofile(MP.."/intllib.lua") local I,_ = dofile(MP.."/intllib.lua")
@ -41,7 +40,7 @@ local CYCLE_TIME = 2
local function pushing(pos, trd, meta, mem) local function pushing(pos, trd, meta, mem)
local pull_dir = meta:get_int("pull_dir") local pull_dir = meta:get_int("pull_dir")
local push_dir = meta:get_int("push_dir") local push_dir = meta:get_int("push_dir")
local items = techage.pull_items(pos, pull_dir, TRD(pos).num_items) local items = techage.pull_items(pos, pull_dir, trd.num_items)
if items ~= nil then if items ~= nil then
if techage.push_items(pos, push_dir, items) == false then if techage.push_items(pos, push_dir, items) == false then
-- place item back -- place item back
@ -98,8 +97,8 @@ local function register_pusher(stage, num_items)
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png", "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png", "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png", "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
"techage_pusher.png^[transformR180]^techage_frame_ta"..stage..".png", "techage_appl_pusher.png^[transformR180]^techage_frame_ta"..stage..".png",
"techage_pusher.png^techage_frame_ta"..stage..".png", "techage_appl_pusher.png^techage_frame_ta"..stage..".png",
}, },
techage = { techage = {
@ -141,7 +140,7 @@ local function register_pusher(stage, num_items)
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png", "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png",
"techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png", "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png",
{ {
image = "techage_pusher14.png^[transformR180]^techage_frame14_ta"..stage..".png", image = "techage_appl_pusher14.png^[transformR180]^techage_frame14_ta"..stage..".png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
@ -151,7 +150,7 @@ local function register_pusher(stage, num_items)
}, },
}, },
{ {
image = "techage_pusher14.png^techage_frame14_ta"..stage..".png", image = "techage_appl_pusher14.png^techage_frame14_ta"..stage..".png",
backface_culling = false, backface_culling = false,
animation = { animation = {
type = "vertical_frames", type = "vertical_frames",
@ -184,12 +183,12 @@ local function register_pusher(stage, num_items)
description = "TA"..stage.." Pusher", description = "TA"..stage.." Pusher",
tiles = { tiles = {
-- up, down, right, left, back, front -- up, down, right, left, back, front
'tubelib_pusher1.png', "techage_filling_ta"..stage..".png^techage_frame_ta"..stage.."_top.png^techage_appl_arrow.png",
'tubelib_pusher1.png', "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png",
'tubelib_outp.png^tubelib_defect.png', "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_outp.png^tubelib_defect.png",
'tubelib_inp.png^tubelib_defect.png', "techage_filling_ta"..stage..".png^techage_frame_ta"..stage..".png^techage_appl_inp.png^tubelib_defect.png",
"tubelib_pusher1.png^[transformR180]^tubelib_defect.png", "techage_appl_pusher.png^[transformR180]^techage_frame_ta"..stage..".png^tubelib_defect.png",
"tubelib_pusher1.png^tubelib_defect.png", "techage_appl_pusher.png^techage_frame_ta"..stage..".png^tubelib_defect.png",
}, },
techage = { techage = {
@ -218,21 +217,14 @@ local function register_pusher(stage, num_items)
sounds = default.node_sound_wood_defaults(), sounds = default.node_sound_wood_defaults(),
}) })
minetest.register_craft({
output = "tubelib:pusher 2",
recipe = {
{"group:wood", "wool:dark_green", "group:wood"},
{"tubelib:tubeS", "default:mese_crystal", "tubelib:tubeS"},
{"group:wood", "wool:dark_green", "group:wood"},
},
})
if stage == 2 then if stage == 2 then
techage.register_node("techage:ta"..stage.."_pusher", techage.register_node("techage:ta"..stage.."_pusher",
{"techage:ta"..stage.."_pusher_active", "techage:ta"..stage.."_pusher_defect"}, { {"techage:ta"..stage.."_pusher_active", "techage:ta"..stage.."_pusher_defect"}, {
is_pusher = true, -- is a pulling/pushing node is_pusher = true, -- is a pulling/pushing node
on_recv_message = function(pos, topic, payload)
return "unsupported"
end,
on_node_load = function(pos) on_node_load = function(pos)
TRD(pos).State:on_node_load(pos) TRD(pos).State:on_node_load(pos)
end, end,
@ -267,3 +259,11 @@ register_pusher(2, 2)
register_pusher(3, 6) register_pusher(3, 6)
register_pusher(4, 18) register_pusher(4, 18)
minetest.register_craft({
output = "techage:ta2_pusher 2",
recipe = {
{"group:wood", "wool:dark_green", "group:wood"},
{"tubelib:tubeS", "default:mese_crystal", "tubelib:tubeS"},
{"group:wood", "wool:dark_green", "group:wood"},
},
})

View File

@ -127,6 +127,10 @@ end
techage.side_to_outdir = side_to_dir techage.side_to_outdir = side_to_dir
function techage.side_to_indir(side, param2)
return tubelib2.Turn180Deg[side_to_dir(side, param2)]
end
local function get_dest_node(pos, out_dir) local function get_dest_node(pos, out_dir)
local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir) local spos, in_dir = Tube:get_connected_node_pos(pos, out_dir)
local _,node = Tube:get_node(spos) local _,node = Tube:get_node(spos)
@ -372,7 +376,7 @@ end
-- Put the given stack into the given ItemList. -- Put the given stack into the given ItemList.
-- Function returns false if ItemList is full. -- Function returns false if ItemList is full.
function techage.put_item(inv, listname, stack) function techage.put_items(inv, listname, stack)
if inv:room_for_item(listname, stack) then if inv:room_for_item(listname, stack) then
inv:add_item(listname, stack) inv:add_item(listname, stack)
return true return true

View File

@ -211,9 +211,10 @@ function NodeStates:start(pos, mem, called_from_on_timer)
if self.formspec_func then if self.formspec_func then
M(pos):set_string("formspec", self.formspec_func(self, pos, mem)) M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
end end
if not minetest.get_node_timer(pos):is_started() then if minetest.get_node_timer(pos):is_started() then
minetest.get_node_timer(pos):start(self.cycle_time) minetest.get_node_timer(pos):stop()
end end
minetest.get_node_timer(pos):start(self.cycle_time)
return true return true
end end
return false return false
@ -234,6 +235,9 @@ function NodeStates:standby(pos, mem)
if self.formspec_func then if self.formspec_func then
M(pos):set_string("formspec", self.formspec_func(self, pos, mem)) M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
end end
if minetest.get_node_timer(pos):is_started() then
minetest.get_node_timer(pos):stop()
end
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks) minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
return true return true
end end
@ -256,6 +260,9 @@ function NodeStates:blocked(pos, mem)
if self.formspec_func then if self.formspec_func then
M(pos):set_string("formspec", self.formspec_func(self, pos, mem)) M(pos):set_string("formspec", self.formspec_func(self, pos, mem))
end end
if minetest.get_node_timer(pos):is_started() then
minetest.get_node_timer(pos):stop()
end
minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks) minetest.get_node_timer(pos):start(self.cycle_time * self.standby_ticks)
return true return true
end end

View File

@ -37,6 +37,7 @@ dofile(MP.."/electric/consumer.lua")
dofile(MP.."/basic_machines/pusher.lua") dofile(MP.."/basic_machines/pusher.lua")
dofile(MP.."/basic_machines/legacy_nodes.lua") dofile(MP.."/basic_machines/legacy_nodes.lua")
dofile(MP.."/basic_machines/grinder.lua")
--dofile(MP.."/fermenter/biogas_pipe.lua") --dofile(MP.."/fermenter/biogas_pipe.lua")

View File

@ -5,7 +5,7 @@ print ">>> Convert"
for filename in os.listdir("./"): for filename in os.listdir("./"):
if fnmatch.fnmatch(filename, "*.png"): if fnmatch.fnmatch(filename, "*.png"):
print(filename) print(filename)
os.system("pngquant --skip-if-larger --quality=8-16 --output ./%s.new ./%s" % (filename, filename)) os.system("pngquant --skip-if-larger --quality=8-32 --output ./%s.new ./%s" % (filename, filename))
print "\n>>> Copy" print "\n>>> Copy"
for filename in os.listdir("./"): for filename in os.listdir("./"):

Binary file not shown.

Before

Width:  |  Height:  |  Size: 478 B

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 613 B

After

Width:  |  Height:  |  Size: 677 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB