Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bone logging #3040

Merged
merged 4 commits into from
Jul 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions mods/bones/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ local bones_formspec =
local share_bones_time = tonumber(minetest.settings:get("share_bones_time")) or 1200
local share_bones_time_early = tonumber(minetest.settings:get("share_bones_time_early")) or share_bones_time / 4

minetest.register_node("bones:bones", {
local bones_def = {
description = S("Bones"),
tiles = {
"bones_top.png^[transform2",
Expand Down Expand Up @@ -130,7 +130,11 @@ minetest.register_node("bones:bones", {
end,
on_blast = function(pos)
end,
})
}

default.set_inventory_action_loggers(bones_def, "bones")

minetest.register_node("bones:bones", bones_def)

local function may_replace(pos, player)
local node_name = minetest.get_node(pos).name
Expand Down
4 changes: 2 additions & 2 deletions mods/default/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,12 @@ function default.set_inventory_action_loggers(def, name)
end
local on_put = def.on_metadata_inventory_put or nop
def.on_metadata_inventory_put = function(pos, listname, index, stack, player)
default.log_player_action(player, "moves", stack:get_name(), "to", name, "at", pos)
default.log_player_action(player, "moves", stack:get_name(), stack:get_count(), "to", name, "at", pos)
return on_put(pos, listname, index, stack, player)
end
local on_take = def.on_metadata_inventory_take or nop
def.on_metadata_inventory_take = function(pos, listname, index, stack, player)
default.log_player_action(player, "takes", stack:get_name(), "from", name, "at", pos)
default.log_player_action(player, "takes", stack:get_name(), stack:get_count(), "from", name, "at", pos)
return on_take(pos, listname, index, stack, player)
end
end
Expand Down