mirror of
https://github.com/minetest-mods/hopper.git
synced 2024-12-22 05:12:29 +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
|
||||
hopper.config.eject_button_enabled = true
|
||||
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
|
||||
|
||||
-- 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")
|
||||
|
@ -75,7 +75,7 @@ minetest.register_node("hopper:chute", {
|
||||
end,
|
||||
|
||||
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)))
|
||||
|
||||
local timer = minetest.get_node_timer(pos)
|
||||
|
@ -121,17 +121,17 @@ minetest.register_node("hopper:hopper", {
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
})
|
||||
@ -214,17 +214,18 @@ minetest.register_node("hopper:hopper_side", {
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
|
||||
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)))
|
||||
end,
|
||||
})
|
||||
|
@ -141,7 +141,7 @@ minetest.register_node("hopper:sorter", {
|
||||
end,
|
||||
|
||||
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)))
|
||||
|
||||
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
|
||||
|
||||
#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.
|
||||
#When false, top hoppers and side hoppers are explicitly craftable as separate
|
||||
#items.
|
||||
# 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.
|
||||
# When false, top hoppers and side hoppers are explicitly craftable as separate
|
||||
# items.
|
||||
hopper_single_craftable_item (Single craftable item) bool true
|
||||
|
||||
#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
|
||||
#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.
|
||||
# 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
|
||||
# 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.
|
||||
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