How to create a custom chest?
I am writing an extension for the oil mod that adds a mesecon power generator. It should look like a 1x1 chest you can put the fuel in. This is what the code looks like:
If you want to see the whole code, just paste the thing above below the oil mod code
For some reason, i always get this error:
Any idea why? Any suggestions on how to fix the bug? Morechests mod works fine and I can't really see a big difference from my mod to the morechests thing...
Please help!
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
minetest.register_node("oil:generator", {
tile_images = {"default_lava.png"},
paramtype = "facedir_simple",
metadata_name = "generic",
material = minetest.digprop_stonelike(3.0),
})
minetest.register_on_placenode(function(pos, newnode, placer)
if newnode.name == "oil:generator" then
local meta = minetest.env:get_meta(pos)
meta:inventory_set_list("0", {""}) -- THIS LINE SEEMS TO CAUSE THE ERROR
meta:set_inventory_draw_spec(
"invsize[8,9;]list[current_name;0;4,4;1,1;]"
.."list[current_player;main;0,5;8,4;]"
)
end
end)
If you want to see the whole code, just paste the thing above below the oil mod code
For some reason, i always get this error:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
- Code: Select all
20:18:28: ERROR[ServerThread]: ERROR: An unhandled exception occurred: LuaError: error: /home/florian/.minetest/usermods/oil/init.lua:536: attempt to call method 'inventory_set_list' (a nil value)
Any idea why? Any suggestions on how to fix the bug? Morechests mod works fine and I can't really see a big difference from my mod to the morechests thing...
Please help!