2013-11-20 20:27:10 +01:00
|
|
|
-- This version of the travelnet box allows to move up or down only.
|
|
|
|
-- The network name is determined automaticly from the position (x/z coordinates).
|
|
|
|
-- >utor: Sokomine
|
2013-06-13 05:49:41 +02:00
|
|
|
|
|
|
|
minetest.register_node("travelnet:elevator", {
|
2013-06-21 22:01:54 +02:00
|
|
|
description = "Elevator",
|
2013-06-13 05:49:41 +02:00
|
|
|
|
|
|
|
drawtype = "nodebox",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = 'light',
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 }
|
|
|
|
},
|
|
|
|
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
|
|
|
|
{ 0.48, -0.5,-0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.5 , -0.5, 0.48, 0.48, 0.5, 0.5},
|
|
|
|
{-0.5, -0.5,-0.5 ,-0.48, 0.5, 0.5},
|
|
|
|
|
|
|
|
--groundplate to stand on
|
|
|
|
{ -0.5,-0.5,-0.5,0.5,-0.48, 0.5},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
tiles = {
|
|
|
|
|
|
|
|
"travelnet_elevator_inside_floor.png", -- view from top
|
|
|
|
"default_stone.png", -- view from bottom
|
|
|
|
"travelnet_elevator_inside_bottom.png", -- left side
|
|
|
|
"travelnet_elevator_inside_bottom.png", -- right side
|
|
|
|
"travelnet_elevator_inside_bottom.png", -- front view
|
|
|
|
"travelnet_elevator_inside_bottom.png", -- backward view
|
|
|
|
},
|
2013-06-26 23:15:57 +02:00
|
|
|
inventory_image = "travelnet_elevator_inv.png",
|
2013-06-30 01:50:55 +02:00
|
|
|
wield_image = "travelnet_elevator_wield.png",
|
2013-06-13 05:49:41 +02:00
|
|
|
|
|
|
|
groups = {cracky=1,choppy=1,snappy=1},
|
|
|
|
|
|
|
|
|
|
|
|
light_source = 10,
|
|
|
|
|
|
|
|
after_place_node = function(pos, placer, itemstack)
|
2014-11-30 18:50:48 +01:00
|
|
|
local meta = minetest.get_meta(pos);
|
2013-06-21 22:01:54 +02:00
|
|
|
meta:set_string("infotext", "Elevator (unconfigured)");
|
2013-06-13 05:49:41 +02:00
|
|
|
meta:set_string("station_name", "");
|
|
|
|
meta:set_string("station_network","");
|
|
|
|
meta:set_string("owner", placer:get_player_name() );
|
|
|
|
-- request initinal data
|
|
|
|
meta:set_string("formspec",
|
|
|
|
"size[12,10]"..
|
|
|
|
"field[0.3,5.6;6,0.7;station_name;Name of this station:;]"..
|
2013-06-20 04:59:04 +02:00
|
|
|
-- "field[0.3,6.6;6,0.7;station_network;Assign to Network:;]"..
|
|
|
|
-- "field[0.3,7.6;6,0.7;owner_name;(optional) owned by:;]"..
|
2013-06-13 05:49:41 +02:00
|
|
|
"button_exit[6.3,6.2;1.7,0.7;station_set;Store]" );
|
2013-06-21 22:01:54 +02:00
|
|
|
|
|
|
|
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
|
|
|
local p2 = minetest.dir_to_facedir(placer:get_look_dir())
|
2014-11-30 18:50:48 +01:00
|
|
|
minetest.add_node(p, {name="travelnet:elevator_top", paramtype2="facedir", param2=p2})
|
2013-06-13 05:49:41 +02:00
|
|
|
end,
|
|
|
|
|
|
|
|
on_receive_fields = travelnet.on_receive_fields,
|
|
|
|
on_punch = function(pos, node, puncher)
|
|
|
|
travelnet.update_formspec(pos, puncher:get_player_name())
|
|
|
|
end,
|
|
|
|
|
2013-06-19 22:52:32 +02:00
|
|
|
can_dig = function( pos, player )
|
|
|
|
return travelnet.can_dig( pos, player, 'elevator' )
|
|
|
|
end,
|
|
|
|
|
2013-06-13 05:49:41 +02:00
|
|
|
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
|
|
|
travelnet.remove_box( pos, oldnode, oldmetadata, digger )
|
|
|
|
end,
|
|
|
|
|
|
|
|
-- taken from VanessaEs homedecor fridge
|
|
|
|
on_place = function(itemstack, placer, pointed_thing)
|
2013-06-21 22:01:54 +02:00
|
|
|
local pos = pointed_thing.above;
|
2014-11-30 18:50:48 +01:00
|
|
|
local node = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z});
|
2013-06-21 22:01:54 +02:00
|
|
|
-- leftover elevator_top nodes can be removed by placing a new elevator underneath
|
|
|
|
if( node ~= nil and node.name ~= "air" and node.name ~= 'travelnet:elevator_top') then
|
2013-06-13 05:49:41 +02:00
|
|
|
minetest.chat_send_player( placer:get_player_name(), 'Not enough vertical space to place the travelnet box!' )
|
|
|
|
return;
|
|
|
|
end
|
|
|
|
return minetest.item_place(itemstack, placer, pointed_thing);
|
|
|
|
end,
|
|
|
|
|
|
|
|
on_destruct = function(pos)
|
|
|
|
local p = {x=pos.x, y=pos.y+1, z=pos.z}
|
2014-11-30 18:50:48 +01:00
|
|
|
minetest.remove_node(p)
|
2013-06-13 05:49:41 +02:00
|
|
|
end
|
|
|
|
})
|
|
|
|
|
|
|
|
minetest.register_node("travelnet:elevator_top", {
|
2013-06-21 22:01:54 +02:00
|
|
|
description = "Elevator Top",
|
2013-06-13 05:49:41 +02:00
|
|
|
|
|
|
|
drawtype = "nodebox",
|
|
|
|
sunlight_propagates = true,
|
|
|
|
paramtype = 'light',
|
|
|
|
paramtype2 = "facedir",
|
|
|
|
|
|
|
|
selection_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = { 0, 0, 0, 0, 0, 0 }
|
|
|
|
-- fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
|
|
|
|
},
|
|
|
|
|
|
|
|
node_box = {
|
|
|
|
type = "fixed",
|
|
|
|
fixed = {
|
|
|
|
|
|
|
|
{ 0.48, -0.5,-0.5, 0.5, 0.5, 0.5},
|
|
|
|
{-0.5 , -0.5, 0.48, 0.48, 0.5, 0.5},
|
|
|
|
{-0.5, -0.5,-0.5 ,-0.48, 0.5, 0.5},
|
|
|
|
|
|
|
|
--top ceiling
|
|
|
|
{ -0.5, 0.48,-0.5,0.5, 0.5, 0.5},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
tiles = {
|
|
|
|
|
|
|
|
"default_stone.png", -- view from top
|
|
|
|
"travelnet_elevator_inside_ceiling.png", -- view from bottom
|
|
|
|
"travelnet_elevator_inside_top_control.png", -- left side
|
|
|
|
"travelnet_elevator_inside_top.png", -- right side
|
|
|
|
"travelnet_elevator_inside_top.png", -- front view
|
|
|
|
"travelnet_elevator_inside_top.png", -- backward view
|
|
|
|
},
|
2013-06-26 23:15:57 +02:00
|
|
|
inventory_image = "travelnet_elevator_inv.png",
|
2013-06-30 01:50:55 +02:00
|
|
|
wield_image = "travelnet_elevator_wield.png",
|
2013-06-13 05:49:41 +02:00
|
|
|
|
|
|
|
light_source = 10,
|
|
|
|
|
2013-06-21 22:01:54 +02:00
|
|
|
groups = {cracky=1,choppy=1,snappy=1,not_in_creative_inventory=1},
|
2013-06-13 05:49:41 +02:00
|
|
|
})
|
|
|
|
|
2013-06-26 23:15:57 +02:00
|
|
|
--if( minetest.get_modpath("technic") ~= nil ) then
|
|
|
|
-- minetest.register_craft({
|
|
|
|
-- output = "travelnet:elevator",
|
|
|
|
-- recipe = {
|
|
|
|
-- {"default:steel_ingot", "technic:motor", "default:steel_ingot", },
|
|
|
|
-- {"default:steel_ingot", "technic:control_logic_unit", "default:steel_ingot", },
|
|
|
|
-- {"default:steel_ingot", "moreores:copper_ingot", "default:steel_ingot", }
|
|
|
|
-- }
|
|
|
|
-- })
|
|
|
|
--else
|
2013-06-13 05:49:41 +02:00
|
|
|
minetest.register_craft({
|
|
|
|
output = "travelnet:elevator",
|
2013-11-20 20:27:10 +01:00
|
|
|
recipe = travelnet.elevator_recipe,
|
2013-06-13 05:49:41 +02:00
|
|
|
})
|
2013-06-26 23:15:57 +02:00
|
|
|
--end
|
2013-06-13 05:49:41 +02:00
|
|
|
|