Add command to ta4_doser to change recipe, add pusher/hopper support for ta4_reactor inventory
This commit is contained in:
parent
2ea430d054
commit
c57724dbd0
@ -169,6 +169,14 @@ function techage.recipes.get_recipe(name)
|
||||
return NormalizedRecipes[name]
|
||||
end
|
||||
|
||||
function techage.recipes.set_recipe(pos, rtype, idx)
|
||||
local nvm = techage.get_nvm(pos)
|
||||
if not nvm.running then
|
||||
local recipes = Recipes[rtype] or {}
|
||||
idx = tonumber(idx) or 1
|
||||
nvm.recipe_idx = range(idx, 1, #recipes)
|
||||
end
|
||||
end
|
||||
|
||||
function techage.recipes.get_default_group_item_name(item_name)
|
||||
if item_name and item_name:sub(1, 6) == "group:" then
|
||||
|
@ -358,7 +358,12 @@ liquid.register_nodes({"techage:ta4_doser", "techage:ta4_doser_on"}, Pipe, "pump
|
||||
|
||||
techage.register_node({"techage:ta4_doser", "techage:ta4_doser_on"}, {
|
||||
on_recv_message = function(pos, src, topic, payload)
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
if topic == "recipe" then
|
||||
techage.recipes.set_recipe(pos, "ta4_doser", payload)
|
||||
return true
|
||||
else
|
||||
return State:on_receive_message(pos, topic, payload)
|
||||
end
|
||||
end,
|
||||
on_beduino_receive_cmnd = function(pos, src, topic, payload)
|
||||
return State:on_beduino_receive_cmnd(pos, topic, payload)
|
||||
|
@ -168,6 +168,28 @@ minetest.register_node("techage:ta4_reactor", {
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
})
|
||||
|
||||
techage.register_node({"techage:ta4_reactor"}, {
|
||||
on_inv_request = function(pos, in_dir, access_type)
|
||||
local meta = minetest.get_meta(pos)
|
||||
return meta:get_inventory(), "main"
|
||||
end,
|
||||
on_pull_item = function(pos, in_dir, num, item_name)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.get_items(pos, inv, "main", num)
|
||||
end,
|
||||
on_push_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
on_unpull_item = function(pos, in_dir, stack)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return techage.put_items(inv, "main", stack)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = 'techage:ta4_reactor',
|
||||
recipe = {
|
||||
|
@ -22,7 +22,7 @@ minetest.register_alias("techage:hopper_ta1", "minecart:hopper")
|
||||
minecart.register_inventory(
|
||||
{
|
||||
"techage:chest_ta2", "techage:chest_ta3", "techage:chest_ta4",
|
||||
"techage:meltingpot", "techage:meltingpot_active",
|
||||
"techage:meltingpot", "techage:meltingpot_active", "techage:ta4_reactor",
|
||||
},
|
||||
{
|
||||
put = {
|
||||
|
Loading…
Reference in New Issue
Block a user