From b50b700e615a7b78037db81bd53d36d4829c1bd3 Mon Sep 17 00:00:00 2001
From: TenPlus1 <kinsellaja@yahoo.com>
Date: Mon, 3 Oct 2016 10:42:37 +0100
Subject: [PATCH] Added pad facing direction after use

---
 README.md         |   1 +
 init.lua          |  38 +++++++++++++++++++++++++++++---------
 textures/padd.png | Bin 225 -> 201 bytes
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/README.md b/README.md
index 5d8d0df..dc253c1 100644
--- a/README.md
+++ b/README.md
@@ -7,6 +7,7 @@ https://forum.minetest.net/viewtopic.php?f=9&t=9234
 
 Change log:
 
+- 0.8 - Teleport pads now have arrows showing direction player will face after use
 - 0.7 - Can now enter descriptions for teleport pads e.g. (0,12,0,Home)
 - 0.6 - Tweaked and tidied code, added map_generation_limit's
 - 0.5 - Added throwable potions
diff --git a/init.lua b/init.lua
index c164394..2165602 100755
--- a/init.lua
+++ b/init.lua
@@ -1,5 +1,5 @@
 
---= Teleport Potion mod 0.7 by TenPlus1
+--= Teleport Potion mod 0.8 by TenPlus1
 
 -- Create teleport potion or pad, place then right-click to enter coords
 -- and step onto pad or walk into the blue portal light, portal closes after
@@ -206,10 +206,10 @@ minetest.register_craft({
 
 -- teleport pad
 minetest.register_node("teleport_potion:pad", {
-	tiles = {"padd.png"},
-	drawtype = 'nodebox',
+	tiles = {"padd.png", "padd.png^[transformFY"},
+	drawtype = "nodebox",
 	paramtype = "light",
-	paramtype2 = "wallmounted",
+	paramtype2 = "facedir",
 	legacy_wallmounted = true,
 	walkable = true,
 	sunlight_propagates = true,
@@ -219,12 +219,13 @@ minetest.register_node("teleport_potion:pad", {
 	light_source = 5,
 	groups = {snappy = 3},
 	node_box = {
-		type = "wallmounted",
-		wall_top    = {-0.5, 0.4375, -0.5, 0.5, 0.5, 0.5},
-		wall_bottom = {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
-		wall_side   = {-0.5, -0.5, -0.5, -0.4375, 0.5, 0.5},
+		type = "fixed",
+		fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
+	},
+	selection_box = {
+		type = "fixed",
+		fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5}
 	},
-	selection_box = {type = "wallmounted"},
 
 	on_construct = function(pos)
 
@@ -343,6 +344,25 @@ minetest.register_abm({
 					gain = 1.0,
 					max_hear_distance = 5
 				})
+
+				-- rotate player to look in pad placement direction
+				if objs[n]:is_player() then
+
+					local rot = node.param2
+					local yaw = 0
+
+					if rot == 0 or rot == 20 then
+						yaw = 0 -- north
+					elseif rot == 2 or rot == 22 then
+						yaw = 3.14 -- south
+					elseif rot == 1 or rot == 23 then
+						yaw = 4.71 -- west
+					elseif rot == 3 or rot == 21 then
+						yaw = 1.57 -- east
+					end
+
+					objs[n]:set_look_yaw(yaw)
+				end
 			end
 		end
 	end
diff --git a/textures/padd.png b/textures/padd.png
index cee7c3499bbb95d7555cb4fed13997b4f041d874..0f7c9378bdbe2e2f849d822e38c08dcb8b14a001 100644
GIT binary patch
delta 165
zcmV;W09yay0m%W77!d>m0002(-QrRJ000<JOjJdYEEs<)-x%-!003-BL_t&t*Imxb
z4S*mJ1ke#F0AmA4Xn;iS#7_knY(QfLy6ro7bWShXFPvW*vrG;aa08%-jv-Q0VKh=-
zM9x5rm&lVfR21egQ0pJ~N}ENBY?kbi^e%GO@ivw-bD>2)&f&X-E?B}*;2SSMOd5HZ
T=@Qxi000R9NkvXXu0mjf+UGt@

delta 209
zcmX@f_>ggeL_G&H0|SGGE`KnPk`C|*alPUfaQeahMccQ{+_huf@uRygoCk7my?XWd
z<HzNE-*kb>I7@>3f*JlpfjQIcD?q^<PZ!4!iOa41jzUKbIGk29efy`bx9sHq)0;Z?
zNGivKx*F-&n}wg1nfFLm%%j2K8Iz3vO4k_|yc8DhTRZI}L%~m1o<$3)SI<m5pfB)W
zbYqfTsC>gL?ZUEiHyP%vUTS`$)9z+{Y>!an?mI7czP5MtXR%hf7To}}n8DN4&t;uc
GLK6T?SYBlS

-- 
GitLab