~gpcf/misc-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Adding logging to changing the teleport pad / portion or when a player teleports to stored POS from POS of teleport pad/potion

Details
Message ID
<20211228225712.31983-1-erstazi@gmail.com>
DKIM signature
missing
Download raw message
Patch: +26 -0
---
 init.lua | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/init.lua b/init.lua
index a24e8ce..27ac710 100644
--- a/init.lua
+++ b/init.lua
@@ -236,6 +236,15 @@ minetest.register_node("teleport_potion:pad", {

			local meta = minetest.get_meta(pos)

			local old_target_coords = {
				x = meta:get_int("x"),
				y = meta:get_int("y"),
				z = meta:get_int("z")
			}

			local teleport_to_string = minetest.pos_to_string(coords)
			local teleport_from_string = minetest.pos_to_string(old_target_coords)

			meta:set_int("x", coords.x)
			meta:set_int("y", coords.y)
			meta:set_int("z", coords.z)
@@ -249,6 +258,9 @@ minetest.register_node("teleport_potion:pad", {
					.. coords.x .. "," .. coords.y .. "," .. coords.z .. ")")
			end

			-- logging the teleportation
			minetest.log("action", name .. " changed teleport pad from " .. teleport_from_string .. " to " .. teleport_to_string)

			minetest.sound_play("portal_open", {
				pos = pos,
				gain = 1.0,
@@ -288,6 +300,9 @@ minetest.register_abm({
		end

		-- get coords from pad/portal

		local original_object_pos = minetest.pos_to_string(pos)

		local meta = minetest.get_meta(pos)
		local target_coords = {
			x = meta:get_int("x"),
@@ -298,6 +313,8 @@ minetest.register_abm({
		for k, player in pairs(objs) do

			if player then
				local player_name = player:get_player_name()
				local teleport_to_string = minetest.pos_to_string(target_coords)

				-- play sound on portal end
				minetest.sound_play("portal_close", {
@@ -309,6 +326,9 @@ minetest.register_abm({
				-- move player/object
				player:setpos(target_coords)

				-- logging the teleportation
				minetest.log("action", player_name .. " teleported from " .. original_object_pos .. " to " .. teleport_to_string )

				-- paricle effects on arrival
				tp_effect(target_coords)

@@ -354,12 +374,18 @@ potion_entity.on_step = function(self, dtime)
		or vel.z == 0 then

			if self.player ~= "" then
				local player_name = self.player:get_player_name()
				local teleport_to_string = minetest.pos_to_string(self.lastpos)
				local teleport_from_string = minetest.pos_to_string(pos)

				-- round up coords to fix glitching through doors
				self.lastpos = vector.round(self.lastpos)

				self.player:setpos(self.lastpos)

				-- logging the teleportation
				minetest.log("action", player_name .. " teleported to " .. teleport_to_string .. " from " .. original_object_pos)

				minetest.sound_play("portal_close", {
					pos = self.lastpos,
					gain = 1.0,
-- 
2.17.1
Details
Message ID
<HK0PR01MB259400C077F5845F59540F5DDB449@HK0PR01MB2594.apcprd01.prod.exchangelabs.com>
In-Reply-To
<20211228225712.31983-1-erstazi@gmail.com> (view parent)
DKIM signature
missing
Download raw message
Could we take this opportunity to submit the patch upstream instead and 
update our teleport potion mod? Last I checked it was quite out of date.
Reply to thread Export thread (mbox)