1 coronaserver.savedata.suspect_items = coronaserver.savedata.suspect_items or {}
2 minetest.register_lbm({
3 name = "coronaserver:chest_control",
4 nodenames = {"default:chest", "default:chest_locked", "currency:safe", "protector:chest"},
5 run_at_every_load = true,
7 local meta = minetest.get_meta(pos)
8 if not meta then return end
9 local inv = meta:get_inventory()
10 if not inv then return end
11 for _, sitem in pairs(coronaserver.savedata.suspect_items) do
12 if inv:contains_item("main", sitem) then
13 coronaserver.teamchat_message(nil, "Verdächtige Kiste bei Position " .. minetest.pos_to_string(pos))
18 minetest.register_chatcommand("add_suspect_item", {
19 description = "Mark an item as suspect",
20 param = "<itemstring>",
21 privs = {server = true},
22 func = function(name, param)
23 if not param then return false, "Invalid Usage" end
24 table.insert(coronaserver.savedata.suspect_items, param)
25 return true, param .. " added to suspect items"
28 minetest.register_chatcommand("print_suspect_items", {
29 description = "Print all items that are marked as suspect",
31 privs = {server = true},
32 func = function(name, param)
33 return true, "Suspect items: " .. table.concat(coronaserver.savedata.suspect_items, ", ")
36 minetest.register_chatcommand("remove_suspect_item", {
37 description = "Remove the suspect Mark from an item",
39 privs = {server = true},
40 func = function(name, param)
42 for i, item in pairs(coronaserver.savedata.suspect_items) do
44 table.remove(coronaserver.savedata.suspect_items, i)
50 return true, "Removed " .. tostring(f()) .. " from list"