2018-03-10 22:14:57 +01:00
|
|
|
--[[
|
|
|
|
|
|
|
|
Tubelib Addons 1
|
|
|
|
================
|
|
|
|
|
2020-11-20 14:45:28 +01:00
|
|
|
Copyright (C) 2017-2020 Joachim Stolberg
|
2018-03-10 22:14:57 +01:00
|
|
|
|
2020-11-20 14:45:28 +01:00
|
|
|
AGPL v3
|
2018-03-10 22:14:57 +01:00
|
|
|
See LICENSE.txt for more information
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-03-10 22:14:57 +01:00
|
|
|
fermenter.lua
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2019-01-28 21:51:38 +01:00
|
|
|
The Fermenter converts 3 leave items of any kind into one Bio Gas item,
|
2018-03-10 22:14:57 +01:00
|
|
|
needed by the Reformer to produce Bio Fuel.
|
|
|
|
|
|
|
|
]]--
|
|
|
|
|
2020-11-03 20:19:38 +01:00
|
|
|
-- Load support for I18n
|
|
|
|
local S = tubelib_addons1.S
|
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
-- for lazy programmers
|
|
|
|
local P = minetest.string_to_pos
|
|
|
|
local M = minetest.get_meta
|
|
|
|
|
|
|
|
local STANDBY_TICKS = 4
|
|
|
|
local COUNTDOWN_TICKS = 4
|
|
|
|
local CYCLE_TIME = 2
|
2019-01-28 21:51:38 +01:00
|
|
|
local NUM_LEAVES = 3 -- to produce on bio gas
|
2018-12-25 22:06:05 +01:00
|
|
|
|
2019-01-05 18:04:56 +01:00
|
|
|
local function formspec(self, pos, meta)
|
2018-03-10 22:14:57 +01:00
|
|
|
return "size[8,8]"..
|
|
|
|
default.gui_bg..
|
|
|
|
default.gui_bg_img..
|
|
|
|
default.gui_slots..
|
|
|
|
"list[context;src;0,0;3,3;]"..
|
|
|
|
"item_image[0,0;1,1;default:leaves]"..
|
|
|
|
"image[3.5,1;1,1;tubelib_gui_arrow.png]"..
|
2019-01-05 18:04:56 +01:00
|
|
|
"image_button[3.5,3;1,1;".. self:get_state_button_image(meta) ..";state_button;]"..
|
2018-03-10 22:14:57 +01:00
|
|
|
"list[context;dst;5,0;3,3;]"..
|
|
|
|
"item_image[5,0;1,1;tubelib_addons1:biogas]"..
|
|
|
|
"list[current_player;main;0,4.3;8,4;]"..
|
|
|
|
"listring[context;dst]"..
|
|
|
|
"listring[current_player;main]"..
|
|
|
|
"listring[context;src]"..
|
|
|
|
"listring[current_player;main]"
|
|
|
|
end
|
|
|
|
|
2019-01-05 18:04:56 +01:00
|
|
|
local State = tubelib.NodeStates:new({
|
|
|
|
node_name_passive = "tubelib_addons1:fermenter",
|
|
|
|
node_name_defect = "tubelib_addons1:fermenter_defect",
|
2020-11-03 20:19:38 +01:00
|
|
|
infotext_name = S("Tubelib Fermenter"),
|
2019-01-05 18:04:56 +01:00
|
|
|
cycle_time = CYCLE_TIME,
|
|
|
|
standby_ticks = STANDBY_TICKS,
|
|
|
|
has_item_meter = true,
|
|
|
|
aging_factor = 10,
|
|
|
|
formspec_func = formspec,
|
|
|
|
})
|
2018-12-25 22:06:05 +01:00
|
|
|
|
2018-03-24 19:03:21 +01:00
|
|
|
local function is_leaves(name)
|
2019-03-02 10:15:57 +01:00
|
|
|
return (tubelib_addons1.FarmingNodes[name] ~= nil and
|
|
|
|
tubelib_addons1.FarmingNodes[name].leaves == true) or
|
|
|
|
minetest.get_item_group(name, "leaves") > 0
|
2018-03-24 19:03:21 +01:00
|
|
|
end
|
|
|
|
|
2018-03-10 22:14:57 +01:00
|
|
|
local function allow_metadata_inventory_put(pos, listname, index, stack, player)
|
|
|
|
if minetest.is_protected(pos, player:get_player_name()) then
|
|
|
|
return 0
|
|
|
|
end
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-03-10 22:14:57 +01:00
|
|
|
local inv = meta:get_inventory()
|
2018-03-24 19:03:21 +01:00
|
|
|
if listname == "src" and is_leaves(stack:get_name()) then
|
2018-12-27 22:37:13 +01:00
|
|
|
if State:get_state(meta) == tubelib.STANDBY then
|
|
|
|
State:start(pos, meta)
|
2018-12-25 22:06:05 +01:00
|
|
|
end
|
2018-03-10 22:14:57 +01:00
|
|
|
return stack:get_count()
|
|
|
|
elseif listname == "dst" then
|
|
|
|
return stack:get_count()
|
|
|
|
end
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
|
|
|
|
local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player)
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-03-10 22:14:57 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
local stack = inv:get_stack(from_list, from_index)
|
|
|
|
return allow_metadata_inventory_put(pos, to_list, to_index, stack, player)
|
|
|
|
end
|
|
|
|
|
|
|
|
local function allow_metadata_inventory_take(pos, listname, index, stack, player)
|
|
|
|
if minetest.is_protected(pos, player:get_player_name()) then
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
return stack:get_count()
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
local function place_top(pos, facedir, placer)
|
|
|
|
if minetest.is_protected(pos, placer:get_player_name()) then
|
|
|
|
return false
|
|
|
|
end
|
|
|
|
local node = minetest.get_node(pos)
|
2019-09-08 03:54:09 +02:00
|
|
|
local def = minetest.registered_nodes[node.name]
|
|
|
|
if not def or not def.buildable_to then
|
2018-03-10 22:14:57 +01:00
|
|
|
return false
|
|
|
|
end
|
|
|
|
minetest.add_node(pos, {name="tubelib_addons1:fermenter_top", param2=facedir})
|
|
|
|
return true
|
|
|
|
end
|
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
local function convert_leaves_to_biogas(pos, meta)
|
2018-03-10 22:14:57 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
local biogas = ItemStack("tubelib_addons1:biogas")
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
-- Not enough output space?
|
|
|
|
if not inv:room_for_item("dst", biogas) then
|
|
|
|
State:blocked(pos, meta)
|
|
|
|
return
|
|
|
|
end
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2019-01-28 21:51:38 +01:00
|
|
|
-- take NUM_LEAVES items
|
2018-12-25 22:06:05 +01:00
|
|
|
local items = {}
|
2019-01-28 21:51:38 +01:00
|
|
|
for i = 1, NUM_LEAVES do
|
2018-12-25 22:06:05 +01:00
|
|
|
items[i] = tubelib.get_num_items(meta, "src", 1)
|
|
|
|
if items[i] then -- input available?
|
|
|
|
if not is_leaves(items[i]:get_name()) then
|
2019-02-07 12:56:23 +01:00
|
|
|
for j = 1, #items do
|
|
|
|
inv:add_item("src", items[j])
|
|
|
|
end
|
2018-12-25 22:06:05 +01:00
|
|
|
State:fault(pos, meta)
|
|
|
|
return
|
2018-11-29 11:53:51 +01:00
|
|
|
end
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
end
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
-- put result into dst inventory
|
2019-01-28 21:51:38 +01:00
|
|
|
if #items == NUM_LEAVES then
|
2018-12-25 22:06:05 +01:00
|
|
|
inv:add_item("dst", biogas)
|
|
|
|
State:keep_running(pos, meta, COUNTDOWN_TICKS)
|
|
|
|
return
|
|
|
|
end
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
-- put leaves back to src inventory
|
|
|
|
for i = 1, #items do
|
|
|
|
inv:add_item("src", items[i])
|
|
|
|
end
|
|
|
|
State:idle(pos, meta)
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
local function keep_running(pos, elapsed)
|
2019-04-23 21:46:08 +02:00
|
|
|
if tubelib.data_not_corrupted(pos) then
|
|
|
|
local meta = M(pos)
|
|
|
|
convert_leaves_to_biogas(pos, meta)
|
|
|
|
return State:is_active(meta)
|
|
|
|
end
|
|
|
|
return false
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
local function on_receive_fields(pos, formname, fields, player)
|
|
|
|
if minetest.is_protected(pos, player:get_player_name()) then
|
|
|
|
return
|
|
|
|
end
|
2018-12-25 22:06:05 +01:00
|
|
|
State:state_button_event(pos, fields)
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
minetest.register_node("tubelib_addons1:fermenter", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Tubelib Fermenter"),
|
2018-03-10 22:14:57 +01:00
|
|
|
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
'tubelib_front.png',
|
|
|
|
'tubelib_front.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png',
|
|
|
|
},
|
|
|
|
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -8/16, -8/16, -8/16, 8/16, 24/16, 8/16 },
|
|
|
|
},
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-03-10 22:14:57 +01:00
|
|
|
on_construct = function(pos)
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-03-10 22:14:57 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
inv:set_size('src', 9)
|
|
|
|
inv:set_size('dst', 9)
|
|
|
|
end,
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-03-10 22:14:57 +01:00
|
|
|
after_place_node = function(pos, placer)
|
|
|
|
local facedir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
2019-09-08 03:54:09 +02:00
|
|
|
if place_top({x=pos.x, y=pos.y+1, z=pos.z}, facedir, placer) then
|
|
|
|
local number = tubelib.add_node(pos, "tubelib_addons1:fermenter")
|
|
|
|
State:node_init(pos, number)
|
|
|
|
else
|
2018-03-10 22:14:57 +01:00
|
|
|
minetest.remove_node(pos)
|
2020-11-03 20:19:38 +01:00
|
|
|
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
|
2019-09-08 03:54:09 +02:00
|
|
|
return true
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2019-01-06 15:03:22 +01:00
|
|
|
-- the fermenter needs 'on_dig' to be able to remove the upper node
|
2020-08-22 19:38:34 +02:00
|
|
|
on_dig = function(pos, node, player)
|
2020-08-22 20:06:58 +02:00
|
|
|
local pos_above = vector.add(pos, vector.new(0, 1, 0))
|
|
|
|
local player_name = player:get_player_name()
|
|
|
|
|
|
|
|
if minetest.is_protected(pos, player_name) or minetest.is_protected(pos_above, player_name) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-03-10 22:14:57 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
if inv:is_empty("dst") and inv:is_empty("src") then
|
2020-08-22 19:38:34 +02:00
|
|
|
State:on_dig_node(pos, node, player)
|
|
|
|
tubelib.remove_node(pos)
|
2020-08-22 20:06:58 +02:00
|
|
|
minetest.remove_node(pos_above)
|
2018-03-10 22:14:57 +01:00
|
|
|
end
|
|
|
|
end,
|
2019-01-06 15:03:22 +01:00
|
|
|
|
2018-03-31 17:09:16 +02:00
|
|
|
on_rotate = screwdriver.disallow,
|
2018-03-10 22:14:57 +01:00
|
|
|
on_timer = keep_running,
|
|
|
|
on_receive_fields = on_receive_fields,
|
|
|
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
|
|
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
|
|
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
|
|
|
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {choppy=2, cracky=2, crumbly=2},
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
|
|
|
})
|
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
minetest.register_node("tubelib_addons1:fermenter_defect", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Tubelib Fermenter defect"),
|
2018-12-25 22:06:05 +01:00
|
|
|
inventory_image = "tubelib_addons1_fermenter_inventory.png",
|
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
'tubelib_front.png',
|
|
|
|
'tubelib_front.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png^tubelib_defect.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png^tubelib_defect.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png^tubelib_defect.png',
|
|
|
|
'tubelib_addons1_fermenter_bottom.png^tubelib_defect.png',
|
|
|
|
},
|
|
|
|
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -8/16, -8/16, -8/16, 8/16, 24/16, 8/16 },
|
|
|
|
},
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
on_construct = function(pos)
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-12-25 22:06:05 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
inv:set_size('src', 9)
|
|
|
|
inv:set_size('dst', 9)
|
|
|
|
end,
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
after_place_node = function(pos, placer)
|
|
|
|
local facedir = minetest.dir_to_facedir(placer:get_look_dir(), false)
|
2019-09-08 03:54:09 +02:00
|
|
|
if place_top({x=pos.x, y=pos.y+1, z=pos.z}, facedir, placer) then
|
|
|
|
local number = tubelib.add_node(pos, "tubelib_addons1:fermenter")
|
|
|
|
State:node_init(pos, number)
|
|
|
|
State:defect(pos, M(pos))
|
|
|
|
else
|
2018-12-25 22:06:05 +01:00
|
|
|
minetest.remove_node(pos)
|
2020-11-03 20:19:38 +01:00
|
|
|
minetest.chat_send_player(placer:get_player_name(), S("Fermenter will not fit there"))
|
2019-09-08 03:54:09 +02:00
|
|
|
return true
|
2018-12-25 22:06:05 +01:00
|
|
|
end
|
|
|
|
end,
|
|
|
|
|
2019-01-06 15:03:22 +01:00
|
|
|
-- the fermenter needs 'on_dig' to be able to remove the upper node
|
2018-12-25 22:06:05 +01:00
|
|
|
on_dig = function(pos, node, puncher, pointed_thing)
|
2020-08-22 20:06:58 +02:00
|
|
|
local pos_above = vector.add(pos, vector.new(0, 1, 0))
|
|
|
|
local puncher_name = puncher:get_player_name()
|
|
|
|
|
|
|
|
if minetest.is_protected(pos, puncher_name) or minetest.is_protected(pos_above, puncher_name) then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
2018-12-27 22:37:13 +01:00
|
|
|
local meta = M(pos)
|
2018-12-25 22:06:05 +01:00
|
|
|
local inv = meta:get_inventory()
|
|
|
|
if inv:is_empty("dst") and inv:is_empty("src") then
|
|
|
|
minetest.node_dig(pos, node, puncher, pointed_thing)
|
2020-08-22 20:06:58 +02:00
|
|
|
minetest.remove_node(pos_above)
|
2018-12-25 22:06:05 +01:00
|
|
|
end
|
|
|
|
end,
|
2019-01-06 15:03:22 +01:00
|
|
|
|
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
|
|
tubelib.remove_node(pos)
|
|
|
|
end,
|
2019-09-08 03:54:09 +02:00
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
on_rotate = screwdriver.disallow,
|
|
|
|
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
|
|
|
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
|
|
|
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
|
|
|
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {choppy=2, cracky=2, crumbly=2, not_in_creative_inventory=1},
|
|
|
|
is_ground_content = false,
|
|
|
|
sounds = default.node_sound_metal_defaults(),
|
|
|
|
})
|
2018-03-10 22:14:57 +01:00
|
|
|
|
|
|
|
minetest.register_node("tubelib_addons1:fermenter_top", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Tubelib Fermenter Top"),
|
2018-03-10 22:14:57 +01:00
|
|
|
tiles = {
|
|
|
|
-- up, down, right, left, back, front
|
|
|
|
'tubelib_front.png',
|
|
|
|
"tubelib_front.png",
|
|
|
|
'tubelib_addons1_fermenter_top.png',
|
|
|
|
'tubelib_addons1_fermenter_top.png',
|
|
|
|
'tubelib_addons1_fermenter_top.png',
|
|
|
|
'tubelib_addons1_fermenter_top.png',
|
|
|
|
},
|
|
|
|
|
|
|
|
paramtype = "light",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
groups = {crumbly=0, not_in_creative_inventory=1},
|
|
|
|
is_ground_content = false,
|
2018-06-30 09:35:07 +02:00
|
|
|
pointable = false,
|
2018-03-10 22:14:57 +01:00
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_craftitem("tubelib_addons1:biogas", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Bio Gas"),
|
2018-03-10 22:14:57 +01:00
|
|
|
inventory_image = "tubelib_addons1_biogas.png",
|
|
|
|
})
|
|
|
|
|
2018-08-16 17:11:56 +02:00
|
|
|
if minetest.global_exists("unified_inventory") then
|
|
|
|
unified_inventory.register_craft_type("fermenting", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Fermenter"),
|
2018-08-16 17:11:56 +02:00
|
|
|
icon = "tubelib_addons1_fermenter_inventory.png",
|
|
|
|
width = 2,
|
|
|
|
height = 2,
|
|
|
|
})
|
|
|
|
unified_inventory.register_craft_type("reforming", {
|
2020-11-03 20:19:38 +01:00
|
|
|
description = S("Reformer"),
|
2018-08-16 17:11:56 +02:00
|
|
|
icon = "tubelib_addons1_reformer_inventory.png",
|
|
|
|
width = 2,
|
|
|
|
height = 2,
|
|
|
|
})
|
|
|
|
unified_inventory.register_craft({
|
2019-09-08 03:54:09 +02:00
|
|
|
items = {"group:leaves", "group:leaves"},
|
|
|
|
output = "tubelib_addons1:biogas",
|
2018-08-16 17:11:56 +02:00
|
|
|
type = "fermenting"
|
|
|
|
})
|
|
|
|
unified_inventory.register_craft({
|
2019-09-08 03:54:09 +02:00
|
|
|
items = {"tubelib_addons1:biogas", "tubelib_addons1:biogas",
|
|
|
|
"tubelib_addons1:biogas", "tubelib_addons1:biogas"},
|
|
|
|
output = "tubelib_addons1:biofuel",
|
2018-08-16 17:11:56 +02:00
|
|
|
type = "reforming"
|
|
|
|
})
|
|
|
|
end
|
2018-03-10 22:14:57 +01:00
|
|
|
|
|
|
|
minetest.register_craft({
|
|
|
|
output = "tubelib_addons1:fermenter",
|
|
|
|
recipe = {
|
2018-12-27 22:37:13 +01:00
|
|
|
{"default:steel_ingot", "default:dirt", "default:steel_ingot"},
|
2018-12-31 14:59:02 +01:00
|
|
|
{"tubelib:tubeS", "default:mese_crystal", "tubelib:tubeS"},
|
2018-12-27 22:37:13 +01:00
|
|
|
{"default:steel_ingot", "group:wood", "default:steel_ingot"},
|
2018-03-10 22:14:57 +01:00
|
|
|
},
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2018-12-25 22:06:05 +01:00
|
|
|
tubelib.register_node("tubelib_addons1:fermenter", {"tubelib_addons1:fermenter_defect"}, {
|
2018-03-10 22:14:57 +01:00
|
|
|
on_pull_item = function(pos, side)
|
2018-12-25 22:06:05 +01:00
|
|
|
return tubelib.get_item(M(pos), "dst")
|
2018-03-10 22:14:57 +01:00
|
|
|
end,
|
|
|
|
on_push_item = function(pos, side, item)
|
2018-12-25 22:06:05 +01:00
|
|
|
return tubelib.put_item(M(pos), "src", item)
|
2018-03-10 22:14:57 +01:00
|
|
|
end,
|
|
|
|
on_unpull_item = function(pos, side, item)
|
2018-12-25 22:06:05 +01:00
|
|
|
return tubelib.put_item(M(pos), "dst", item)
|
2018-03-10 22:14:57 +01:00
|
|
|
end,
|
|
|
|
on_recv_message = function(pos, topic, payload)
|
2018-12-25 22:06:05 +01:00
|
|
|
local resp = State:on_receive_message(pos, topic, payload)
|
|
|
|
if resp then
|
|
|
|
return resp
|
2018-03-10 22:14:57 +01:00
|
|
|
else
|
|
|
|
return "unsupported"
|
|
|
|
end
|
|
|
|
end,
|
2018-12-22 16:58:11 +01:00
|
|
|
on_node_load = function(pos)
|
2018-12-25 22:06:05 +01:00
|
|
|
State:on_node_load(pos)
|
|
|
|
end,
|
|
|
|
on_node_repair = function(pos)
|
|
|
|
return State:on_node_repair(pos)
|
2018-12-22 16:58:11 +01:00
|
|
|
end,
|
2019-09-08 03:54:09 +02:00
|
|
|
})
|