aboutsummaryrefslogtreecommitdiff
path: root/wagons.lua
diff options
context:
space:
mode:
authororwell96 <mono96.mml@gmail.com>2016-11-24 21:52:17 +0100
committerorwell96 <mono96.mml@gmail.com>2016-11-24 21:52:51 +0100
commit6f444cd10e6d43404c1f12a8eaf092805724268b (patch)
tree6e885e80a13358080e5353a10a4f9585c80dc1a9 /wagons.lua
parent8c43f4d02693cddde0eb136ad9fe5d2f2bf210a4 (diff)
downloadadvtrains-6f444cd10e6d43404c1f12a8eaf092805724268b.tar.gz
advtrains-6f444cd10e6d43404c1f12a8eaf092805724268b.tar.bz2
advtrains-6f444cd10e6d43404c1f12a8eaf092805724268b.zip
drop player on the platform if there is one
Diffstat (limited to 'wagons.lua')
-rw-r--r--wagons.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/wagons.lua b/wagons.lua
index a5734d6..a82bde2 100644
--- a/wagons.lua
+++ b/wagons.lua
@@ -438,6 +438,16 @@ function wagon:get_off(seatno)
if clicker then
clicker:set_detach()
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
+ local objpos=advtrains.round_vector_floor_y(self.object:getpos())
+ local yaw=self.object:getyaw()
+ local isx=(yaw < math.pi/4) or (yaw > 3*math.pi/4 and yaw < 5*math.pi/4) or (yaw > 7*math.pi/4)
+ --abuse helper function
+ for _,r in ipairs({-1, 1}) do
+ local p=vector.add({x=isx and r or 0, y=0, z=not isx and r or 0}, objpos)
+ if minetest.get_item_group(minetest.get_node(p).name, "platform")>0 then
+ minetest.after(0.2, function() clicker:setpos({x=p.x, y=p.y+1, z=p.z}) end)
+ end
+ end
end
self.seatp[seatno]=nil
end