Allow only meshnode glue in controller inventory

If a meshnode controller was trying to make sense of metadata from an
item other than meshnode glue, the server would crash. To prevent this,
only meshnode glue is allowed to be in a meshnode controller inventory.
This commit is contained in:
Nils Dagsson Moskopp 2021-08-26 01:32:51 +02:00
parent ab6d4df25f
commit 3dcfa8b324
Signed by: erlehmann
GPG Key ID: A3BC671C35191080
1 changed files with 3 additions and 0 deletions

View File

@ -356,6 +356,9 @@ minetest.register_node("meshnode:controller", {
show_meshnode_formspec(pos, clicker)
end,
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
if stack:get_name() ~= "meshnode:glue" then
return 0
end
local meta = stack:get_metadata()
if meta then
if vector.equals(minetest.string_to_pos(meta), pos) then