This commit is contained in:
parent
84ddbef3b0
commit
ca91f95ad8
17
elevator.lua
17
elevator.lua
@ -135,10 +135,9 @@ minetest.register_node("travelnet:elevator", {
|
||||
-- "field[0.3,7.6;6,0.7;owner_name;(optional) owned by:;]"..
|
||||
"button_exit[6.3,6.2;1.7,0.7;station_set;"..S("Store").."]" );
|
||||
|
||||
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
||||
minetest.add_node(p, {name="travelnet:elevator_top", paramtype2="facedir", param2=p2})
|
||||
travelnet.show_nearest_elevator( pos, placer:get_player_name(), p2 );
|
||||
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
|
||||
travelnet.show_nearest_elevator( pos, placer:get_player_name(), minetest.dir_to_facedir(placer:get_look_dir()));
|
||||
end,
|
||||
|
||||
on_receive_fields = travelnet.on_receive_fields,
|
||||
@ -163,8 +162,8 @@ minetest.register_node("travelnet:elevator", {
|
||||
local pos = pointed_thing.above;
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z});
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
-- leftover elevator_top nodes can be removed by placing a new elevator underneath
|
||||
if not def or not def.buildable_to then
|
||||
-- leftover top nodes can be removed by placing a new elevator underneath
|
||||
if (not def or not def.buildable_to) and node.name ~= "travelnet:hidden_top" then
|
||||
minetest.chat_send_player(
|
||||
placer:get_player_name(),
|
||||
S('Not enough vertical space to place the travelnet box!')
|
||||
@ -175,12 +174,12 @@ minetest.register_node("travelnet:elevator", {
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.remove_node(p)
|
||||
pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
})
|
||||
|
||||
minetest.register_alias("travelnet:elevator_top", "air")
|
||||
minetest.register_alias("travelnet:hidden_top", "air")
|
||||
|
||||
--if( minetest.get_modpath("technic") ~= nil ) then
|
||||
-- minetest.register_craft({
|
||||
|
35
init.lua
35
init.lua
@ -865,11 +865,15 @@ travelnet.on_receive_fields = function(pos, formname, fields, player)
|
||||
local player_model_vec = vector.new(0, player_model_bottom, 0);
|
||||
local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos;
|
||||
|
||||
-- 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
|
||||
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
local top_node = minetest.get_node(top_pos)
|
||||
if top_node.name ~= "travelnet:hidden_top" then
|
||||
local def = minetest.registered_nodes[top_node.name]
|
||||
if def and def.buildable_to then
|
||||
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
|
||||
end
|
||||
end
|
||||
|
||||
player:move_to( vector.add(target_pos, player_model_vec), false);
|
||||
|
||||
if( travelnet.enable_travelnet_effect ) then
|
||||
@ -1031,8 +1035,25 @@ travelnet.can_dig_old = function( pos, player, description )
|
||||
return true;
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- invisible node to place inside top of travelnet box and elevator
|
||||
minetest.register_node("travelnet:hidden_top", {
|
||||
drawtype = "nodebox",
|
||||
paramtype = "light",
|
||||
sunlight_propagates = true,
|
||||
pointable = false,
|
||||
diggable = false,
|
||||
drop = "",
|
||||
groups = {not_in_creative_inventory = 1},
|
||||
tiles = {"travelnet_blank.png"},
|
||||
node_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, 0.45,-0.5,0.5, 0.5, 0.5},
|
||||
},
|
||||
collision_box = {
|
||||
type = "fixed",
|
||||
fixed = { -0.5, 0.45,-0.5,0.5, 0.5, 0.5},
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
if( travelnet.travelnet_effect_enabled ) then
|
||||
|
BIN
textures/travelnet_blank.png
Normal file
BIN
textures/travelnet_blank.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 95 B |
@ -49,9 +49,12 @@ minetest.register_node("travelnet:travelnet", {
|
||||
light_source = 10,
|
||||
|
||||
after_place_node = function(pos, placer, itemstack)
|
||||
local meta = minetest.get_meta(pos);
|
||||
travelnet.reset_formspec( meta );
|
||||
meta:set_string("owner", placer:get_player_name() );
|
||||
local meta = minetest.get_meta(pos);
|
||||
travelnet.reset_formspec( meta );
|
||||
meta:set_string("owner", placer:get_player_name() );
|
||||
|
||||
local top_pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.set_node(top_pos, {name="travelnet:hidden_top"})
|
||||
end,
|
||||
|
||||
on_receive_fields = travelnet.on_receive_fields,
|
||||
@ -77,7 +80,8 @@ minetest.register_node("travelnet:travelnet", {
|
||||
local pos = pointed_thing.above;
|
||||
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
local def = minetest.registered_nodes[node.name]
|
||||
if not def or not def.buildable_to then
|
||||
-- leftover top nodes can be removed by placing a new travelnet underneath
|
||||
if (not def or not def.buildable_to) and node.name ~= "travelnet:hidden_top" then
|
||||
|
||||
minetest.chat_send_player(
|
||||
placer:get_player_name(),
|
||||
@ -88,6 +92,10 @@ minetest.register_node("travelnet:travelnet", {
|
||||
return minetest.item_place(itemstack, placer, pointed_thing);
|
||||
end,
|
||||
|
||||
on_destruct = function(pos)
|
||||
pos = {x=pos.x, y=pos.y+1, z=pos.z}
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
})
|
||||
|
||||
--[
|
||||
|
Loading…
x
Reference in New Issue
Block a user