mirror of
https://github.com/minetest-mods/hopper.git
synced 2024-12-22 13:22:28 +01:00
Configurable inventory log level (#17)
This aims to reduce spammed log files and corrects nonsense translations to the terminal
This commit is contained in:
parent
a05aa9a59b
commit
c691f370b4
@ -15,3 +15,5 @@ hopper.config.eject_button_enabled = minetest.settings:get_bool("hopper_eject_bu
|
|||||||
if hopper.config.eject_button_enabled == nil then
|
if hopper.config.eject_button_enabled == nil then
|
||||||
hopper.config.eject_button_enabled = true
|
hopper.config.eject_button_enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
hopper.config.inv_log_level = minetest.settings:get("hopper_inventory_log_level") or "info"
|
||||||
|
6
init.lua
6
init.lua
@ -62,4 +62,10 @@ if minetest.get_modpath("lucky_block") then
|
|||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Utility function for inventory movement logs
|
||||||
|
function hopper.log_inventory(...)
|
||||||
|
minetest.log(hopper.config.inv_log_level, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
minetest.log("action", "[hopper] Hopper mod loaded")
|
minetest.log("action", "[hopper] Hopper mod loaded")
|
||||||
|
@ -75,7 +75,7 @@ minetest.register_node("hopper:chute", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff to chute at @2",
|
hopper.log_inventory(("%s moves stuff to chute at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
@ -121,17 +121,17 @@ minetest.register_node("hopper:hopper", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
minetest.log("action", S("@1 moves stuff in hopper at @2",
|
minetest.log("action", ("%s moves stuff in hopper at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff to hopper at @2",
|
hopper.log_inventory(("%s moves stuff to hopper at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff from hopper at @2",
|
hopper.log_inventory(("%s moves stuff from hopper at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
@ -214,17 +214,18 @@ minetest.register_node("hopper:hopper_side", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
minetest.log("action", S("@1 moves stuff in hopper at @2",
|
-- Only players move items. "action" is generally okay here.
|
||||||
|
minetest.log("action", ("%s moves stuff in hopper at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff to hopper at @2",
|
hopper.log_inventory(("%s moves stuff to hopper at%s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
on_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff from hopper at @2",
|
hopper.log_inventory(("%s moves stuff from hopper at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
@ -141,7 +141,7 @@ minetest.register_node("hopper:sorter", {
|
|||||||
end,
|
end,
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
on_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
minetest.log("action", S("@1 moves stuff to sorter at @2",
|
hopper.log_inventory(("%s moves stuff to sorter at %s"):format(
|
||||||
player:get_player_name(), minetest.pos_to_string(pos)))
|
player:get_player_name(), minetest.pos_to_string(pos)))
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
|
@ -1,14 +1,17 @@
|
|||||||
#Dimensions of the textures used, in pixels.
|
# Dimensions of the textures used, in pixels.
|
||||||
hopper_texture_size (Hopper texture size) enum 16 16,32
|
hopper_texture_size (Hopper texture size) enum 16 16,32
|
||||||
|
|
||||||
#When true, the hopper mod uses a single craftable item that auto-selects
|
# When true, the hopper mod uses a single craftable item that auto-selects
|
||||||
#a top hopper or side hopper depending on the context the player places it in.
|
# a top hopper or side hopper depending on the context the player places it in.
|
||||||
#When false, top hoppers and side hoppers are explicitly craftable as separate
|
# When false, top hoppers and side hoppers are explicitly craftable as separate
|
||||||
#items.
|
# items.
|
||||||
hopper_single_craftable_item (Single craftable item) bool true
|
hopper_single_craftable_item (Single craftable item) bool true
|
||||||
|
|
||||||
#This enables a toggle button in the hopper formspecs that allows a hopper
|
# This enables a toggle button in the hopper formspecs that allows a hopper
|
||||||
#to be set to "eject" items out into the world if there's no suitable node
|
# to be set to "eject" items out into the world if there's no suitable node
|
||||||
#in their target location to receive them. By default hoppers do not eject
|
# in their target location to receive them. By default hoppers do not eject
|
||||||
#items like this, the player must set this on a per-hopper basis.
|
# items like this, the player must set this on a per-hopper basis.
|
||||||
hopper_eject_button (Eject items button) bool true
|
hopper_eject_button (Eject items button) bool true
|
||||||
|
|
||||||
|
# The Minetest log level to use for inventory take/put actions
|
||||||
|
hopper_inventory_log_level (Inventory log level) enum action none,action,info,verbose
|
||||||
|
Loading…
Reference in New Issue
Block a user