drop player on the platform if there is one
This commit is contained in:
parent
8c43f4d026
commit
6f444cd10e
BIN
advtrains.zip
BIN
advtrains.zip
Binary file not shown.
|
@ -15,7 +15,7 @@ function advtrains.register_platform(preset)
|
||||||
minetest.register_node("advtrains:platform_low_"..nodename, {
|
minetest.register_node("advtrains:platform_low_"..nodename, {
|
||||||
description = desc.." Platform (low)",
|
description = desc.." Platform (low)",
|
||||||
tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
|
tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
|
||||||
groups = {cracky = 1, not_blocking_trains = 1},
|
groups = {cracky = 1, not_blocking_trains = 1, platform=1},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
|
@ -32,7 +32,7 @@ function advtrains.register_platform(preset)
|
||||||
minetest.register_node("advtrains:platform_high_"..nodename, {
|
minetest.register_node("advtrains:platform_high_"..nodename, {
|
||||||
description = desc.." Platform (high)",
|
description = desc.." Platform (high)",
|
||||||
tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
|
tiles = {btex.."^advtrains_platform.png", btex, btex, btex, btex, btex},
|
||||||
groups = {cracky = 1, not_blocking_trains = 1},
|
groups = {cracky = 1, not_blocking_trains = 1, platform=2},
|
||||||
sounds = default.node_sound_stone_defaults(),
|
sounds = default.node_sound_stone_defaults(),
|
||||||
drawtype = "nodebox",
|
drawtype = "nodebox",
|
||||||
node_box = {
|
node_box = {
|
||||||
|
|
10
wagons.lua
10
wagons.lua
|
@ -438,6 +438,16 @@ function wagon:get_off(seatno)
|
||||||
if clicker then
|
if clicker then
|
||||||
clicker:set_detach()
|
clicker:set_detach()
|
||||||
clicker:set_eye_offset({x=0,y=0,z=0}, {x=0,y=0,z=0})
|
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
|
end
|
||||||
self.seatp[seatno]=nil
|
self.seatp[seatno]=nil
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue