check and remove blocking node in travelnet box

fixes https://github.com/pandorabox-io/pandorabox.io/issues/337
This commit is contained in:
BuckarooBanzay 2019-12-16 13:54:17 +01:00 committed by Thomas Rudin
parent 41f621a760
commit 84ddbef3b0

View File

@ -864,7 +864,13 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
local player_model_bottom = tonumber(minetest.settings:get("player_model_bottom")) or -.5;
local player_model_vec = vector.new(0, player_model_bottom, 0);
local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos;
player:move_to( target_pos, false);
-- check if the node above the box (upper half) is air
if minetest.get_node(vector.add(target_pos, {x=0, y=1, z=0})).name ~= "air" then
-- replace with air if blocked
minetest.set_node(target_pos, {name="air"})
end
player:move_to( vector.add(target_pos, player_model_vec), false);
if( travelnet.enable_travelnet_effect ) then
-- it self-destructs after 20 turns