1
0
mirror of https://github.com/mt-mods/pipeworks.git synced 2025-05-10 20:50:22 +02:00

log when items teleport through tubes

This commit is contained in:
flux 2023-05-16 13:22:52 -07:00
parent bd5a42356b
commit cfc722db47
No known key found for this signature in database
GPG Key ID: 9333B27816848A15

View File

@ -233,7 +233,8 @@ local function can_go(pos, node, velocity, stack)
velocity.x = 0 velocity.x = 0
velocity.y = 0 velocity.y = 0
velocity.z = 0 velocity.z = 0
local channel = minetest.get_meta(pos):get_string("channel") local src_meta = minetest.get_meta(pos)
local channel = src_meta:get_string("channel")
if channel == "" then if channel == "" then
return {} return {}
end end
@ -242,6 +243,12 @@ local function can_go(pos, node, velocity, stack)
return {} return {}
end end
local target = receivers[math.random(1, #receivers)] local target = receivers[math.random(1, #receivers)]
local src_owner = src_meta:get_string("owner")
local dst_meta = minetest.get_meta(pos)
local dst_owner = dst_meta:get_string("owner")
minetest.log("action", string.format("[pipeworks] %s teleported from %s (owner=%s) to %s (owner=%s) via %s",
stack:to_string(), minetest.pos_to_string(pos), src_owner, minetest.pos_to_string(target), dst_owner, channel
))
pos.x = target.x pos.x = target.x
pos.y = target.y pos.y = target.y
pos.z = target.z pos.z = target.z