diff --git a/config.lua b/config.lua new file mode 100644 index 0000000..6708ecb --- /dev/null +++ b/config.lua @@ -0,0 +1,65 @@ + +travelnet.MAX_STATIONS_PER_NETWORK = 24; + +-- set this to true if you want a simulated beam effect +travelnet.travelnet_effect_enabled = false; +-- set this to true if you want a sound to be played when the travelnet is used +travelnet.travelnet_sound_enabled = false; + +-- if you set this to false, travelnets cannot be created +-- (this may be useful if you want nothing but the elevators on your server) +travelnet.travelnet_enabled = true; +-- if you set travelnet.elevator_enabled to false, you will not be able to +-- craft, place or use elevators +travelnet.elevator_enabled = true; +-- if you set this to false, doors will be disabled +travelnet.doors_enabled = true; + + +-- change these if you want other receipes for travelnet or elevator +travelnet.travelnet_recipe = { + {"default:glass", "default:steel_ingot", "default:glass", }, + {"default:glass", "default:mese", "default:glass", }, + {"default:glass", "default:steel_ingot", "default:glass", } +} +travelnet.elevator_recipe = { + {"default:steel_ingot", "default:glass", "default:steel_ingot", }, + {"default:steel_ingot", "", "default:steel_ingot", }, + {"default:steel_ingot", "default:glass", "default:steel_ingot", } +} + +-- if this function returns true, the player with the name player_name is +-- allowed to add a box to the network named network_name, which is owned +-- by the player owner_name; +-- if you want to allow *everybody* to attach stations to all nets, let the +-- function always return true; +-- if the function returns false, players with the travelnet_attach priv +-- can still add stations to that network + +travelnet.allow_attach = function( player_name, owner_name, network_name ) + return false; +end + + +-- if this returns true, a player named player_name can remove a travelnet station +-- from network_name (owned by owner_name) even though he is neither the owner nor +-- has the travelnet_remove priv +travelnet.allow_dig = function( player_name, owner_name, network_name ) + return false; +end + + +-- if this function returns false, then player player_name will not be allowed to use +-- the travelnet station_name_start on networ network_name owned by owner_name to travel to +-- the station station_name_target on the same network; +-- if this function returns true, the player will be transfered to the target station; +-- you can use this code to i.e. charge the player money for the transfer or to limit +-- usage of stations to players in the same fraction on PvP servers +travelnet.allow_travel = function( player_name, owner_name, network_name, station_name_start, station_name_target ) + + --minetest.chat_send_player( player_name, "Player "..tostring( player_name ).." tries to use station "..tostring( station_name_start ).. + -- " on network "..tostring( network_name ).." owned by "..tostring( owner_name ).." in order to travel to ".. + -- tostring( station_name_target ).."."); + + return true; +end diff --git a/doors.lua b/doors.lua new file mode 100644 index 0000000..24c3c6a --- /dev/null +++ b/doors.lua @@ -0,0 +1,142 @@ +-- Doors that are especially useful for travelnet elevators but can also be used in other situations. +-- All doors (not only these here) in front of a travelnet or elevator are opened automaticly when a player arrives +-- and are closed when a player departs from the travelnet or elevator. +-- Autor: Sokomine + +minetest.register_node("travelnet:elevator_door_steel_open", { + description = "elevator door (open)", + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"default_stone.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem + node_box = { + type = "fixed", + fixed = { + {-0.90, -0.5, 0.4, -0.49, 1.5, 0.5}, + { 0.49, -0.5, 0.4, 0.9, 1.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.9, -0.5, 0.4, 0.9, 1.5, 0.5}, + }, + }, + drop = "travelnet:elevator_door_steel_closed", + on_rightclick = function(pos, node, puncher) + minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_closed", param2 = node.param2}) + end, +}) + +minetest.register_node("travelnet:elevator_door_steel_closed", { + description = "elevator door (closed)", + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"default_stone.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, -0.01, 1.5, 0.5}, + { 0.01, -0.5, 0.4, 0.5, 1.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.5, 1.5, 0.5}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_open", param2 = node.param2}) + end, +}) + + + + +minetest.register_node("travelnet:elevator_door_glass_open", { + description = "elevator door (open)", + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"travelnet_elevator_door_glass.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, + -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem + node_box = { + type = "fixed", + fixed = { + {-0.99, -0.5, 0.4, -0.49, 1.5, 0.5}, + { 0.49, -0.5, 0.4, 0.99, 1.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.9, -0.5, 0.4, 0.9, 1.5, 0.5}, + }, + }, + drop = "travelnet:elevator_door_glass_closed", + on_rightclick = function(pos, node, puncher) + minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = node.param2}) + end, +}) + +minetest.register_node("travelnet:elevator_door_glass_closed", { + description = "elevator door (closed)", + drawtype = "nodebox", + -- top, bottom, side1, side2, inner, outer + tiles = {"travelnet_elevator_door_glass.png"}, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = true, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, -0.01, 1.5, 0.5}, + { 0.01, -0.5, 0.4, 0.5, 1.5, 0.5}, + }, + }, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, 0.4, 0.5, 1.5, 0.5}, + }, + }, + on_rightclick = function(pos, node, puncher) + minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_open", param2 = node.param2}) + end, +}) + +minetest.register_craft({ + output = "travelnet:elevator_door_glass_closed", + recipe = { + {"default:glass", "", "default:glass", }, + {"default:glass", "", "default:glass", }, + {"default:glass", "", "default:glass", } + } + }) + +minetest.register_craft({ + output = "travelnet:elevator_door_steel_closed", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot", }, + {"default:steel_ingot", "", "default:steel_ingot", }, + {"default:steel_ingot", "", "default:steel_ingot", } + } + }) +-- local old_node = minetest.env:get_node( pos ); +-- minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = old_node.param2}) + + + diff --git a/elevator.lua b/elevator.lua index 8029b60..75e5458 100644 --- a/elevator.lua +++ b/elevator.lua @@ -1,3 +1,6 @@ +-- 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 minetest.register_node("travelnet:elevator", { description = "Elevator", @@ -150,149 +153,7 @@ minetest.register_node("travelnet:elevator_top", { --else minetest.register_craft({ output = "travelnet:elevator", - recipe = { - {"default:steel_ingot", "default:glass", "default:steel_ingot", }, - {"default:steel_ingot", "", "default:steel_ingot", }, - {"default:steel_ingot", "default:glass", "default:steel_ingot", } - } + recipe = travelnet.elevator_recipe, }) --end - -minetest.register_node("travelnet:elevator_door_steel_open", { - description = "elevator door (open)", - drawtype = "nodebox", - -- top, bottom, side1, side2, inner, outer - tiles = {"default_stone.png"}, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem - node_box = { - type = "fixed", - fixed = { - {-0.90, -0.5, 0.4, -0.49, 1.5, 0.5}, - { 0.49, -0.5, 0.4, 0.9, 1.5, 0.5}, - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.9, -0.5, 0.4, 0.9, 1.5, 0.5}, - }, - }, - drop = "travelnet:elevator_door_steel_closed", - on_rightclick = function(pos, node, puncher) - minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_closed", param2 = node.param2}) - end, -}) - -minetest.register_node("travelnet:elevator_door_steel_closed", { - description = "elevator door (closed)", - drawtype = "nodebox", - -- top, bottom, side1, side2, inner, outer - tiles = {"default_stone.png"}, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.4, -0.01, 1.5, 0.5}, - { 0.01, -0.5, 0.4, 0.5, 1.5, 0.5}, - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.4, 0.5, 1.5, 0.5}, - }, - }, - on_rightclick = function(pos, node, puncher) - minetest.env:add_node(pos, {name = "travelnet:elevator_door_steel_open", param2 = node.param2}) - end, -}) - - - - -minetest.register_node("travelnet:elevator_door_glass_open", { - description = "elevator door (open)", - drawtype = "nodebox", - -- top, bottom, side1, side2, inner, outer - tiles = {"travelnet_elevator_door_glass.png"}, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, - -- larger than one node but slightly smaller than a half node so that wallmounted torches pose no problem - node_box = { - type = "fixed", - fixed = { - {-0.99, -0.5, 0.4, -0.49, 1.5, 0.5}, - { 0.49, -0.5, 0.4, 0.99, 1.5, 0.5}, - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.9, -0.5, 0.4, 0.9, 1.5, 0.5}, - }, - }, - drop = "travelnet:elevator_door_glass_closed", - on_rightclick = function(pos, node, puncher) - minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = node.param2}) - end, -}) - -minetest.register_node("travelnet:elevator_door_glass_closed", { - description = "elevator door (closed)", - drawtype = "nodebox", - -- top, bottom, side1, side2, inner, outer - tiles = {"travelnet_elevator_door_glass.png"}, - paramtype = "light", - paramtype2 = "facedir", - is_ground_content = true, - groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2}, - node_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.4, -0.01, 1.5, 0.5}, - { 0.01, -0.5, 0.4, 0.5, 1.5, 0.5}, - }, - }, - selection_box = { - type = "fixed", - fixed = { - {-0.5, -0.5, 0.4, 0.5, 1.5, 0.5}, - }, - }, - on_rightclick = function(pos, node, puncher) - minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_open", param2 = node.param2}) - end, -}) - -minetest.register_craft({ - output = "travelnet:elevator_door_glass_closed", - recipe = { - {"default:glass", "", "default:glass", }, - {"default:glass", "", "default:glass", }, - {"default:glass", "", "default:glass", } - } - }) - -minetest.register_craft({ - output = "travelnet:elevator_door_steel_closed", - recipe = { - {"default:steel_ingot", "", "default:steel_ingot", }, - {"default:steel_ingot", "", "default:steel_ingot", }, - {"default:steel_ingot", "", "default:steel_ingot", } - } - }) --- local old_node = minetest.env:get_node( pos ); --- minetest.env:add_node(pos, {name = "travelnet:elevator_door_glass_closed", param2 = old_node.param2}) - - - diff --git a/init.lua b/init.lua index 66aa0ae..dec181f 100644 --- a/init.lua +++ b/init.lua @@ -17,9 +17,13 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . - Version: 2.0 (with elevators!) + Version: 2.1 (with config file) + Please configure this mod in config.lua + Changelog: + 19.11.13 - moved doors and travelnet definition into an extra file + - moved configuration to config.lua 05.08.13 - fixed possible crash when the node in front of the travelnet is unknown 26.06.13 - added inventory image for elevator (created by VanessaE) 21.06.13 - bugfix: wielding an elevator while digging a door caused the elevator_top to be placed @@ -48,7 +52,6 @@ - target list is now centered if there are less than 9 targets --]] -local MAX_STATIONS_PER_NETWORK = 24; minetest.register_privilege("travelnet_attach", { description = "allows to attach travelnet boxes to travelnets of other players", give_to_singleplayer = false}); minetest.register_privilege("travelnet_remove", { description = "allows to dig travelnet boxes which belog to nets of other players", give_to_singleplayer = false}); @@ -57,9 +60,11 @@ travelnet = {}; travelnet.targets = {}; --- set this to true if you want a simulated beam effect -travelnet_effect_enabled = false; -travelnet_sound_enabled = false; + +-- read the configuration +dofile(minetest.get_modpath("travelnet").."/config.lua"); -- the normal, default travelnet + + -- TODO: save and restore ought to be library functions and not implemented in each individual mod! -- called whenever a station is added or removed @@ -312,9 +317,10 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m minetest.chat_send_player(player_name, "There is no network named "..tostring( network_name ).." owned by "..tostring( owner_name )..". Aborting."); return; - elseif( not( minetest.check_player_privs(player_name, {travelnet_attach=true}))) then + elseif( not( minetest.check_player_privs(player_name, {travelnet_attach=true})) + and not( travelnet.allow_attach( player_name, owner_name, network_name ))) then - minetest.chat_send_player(player_name, "You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting."); + minetest.chat_send_player(player_name, "You do not have the travelnet_attach priv which is required to attach your box to the network of someone else. Aborting."); return; end @@ -341,9 +347,9 @@ travelnet.add_target = function( station_name, network_name, pos, player_name, m end -- we don't want too many stations in the same network because that would get confusing when displaying the targets - if( anz+1 > MAX_STATIONS_PER_NETWORK ) then + if( anz+1 > travelnet.MAX_STATIONS_PER_NETWORK ) then minetest.chat_send_player(player_name, "Error: Network '"..network_name.."' already contains the maximum number (=" - ..(MAX_STATIONS_PER_NETWORK)..") of allowed stations per network. Please choose a diffrent/new network name."); + ..(travelnet.MAX_STATIONS_PER_NETWORK)..") of allowed stations per network. Please choose a diffrent/new network name."); return; end @@ -484,14 +490,17 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) end + if( not( travelnet.allow_travel( name, owner_name, station_network, station_name, fields.target ))) then + return; + end minetest.chat_send_player(name, "Initiating transfer to station '"..( fields.target or "?").."'.'"); - if( travelnet_sound_enabled ) then + if( travelnet.travelnet_sound_enabled ) then minetest.sound_play("128590_7037-lq.mp3", {pos = pos, gain = 1.0, max_hear_distance = 10,}) end - if( travelnet_effect_enabled ) then + if( travelnet.travelnet_effect_enabled ) then minetest.env:add_entity( {x=pos.x,y=pos.y+0.5,z=pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns end @@ -502,10 +511,10 @@ travelnet.on_receive_fields = function(pos, formname, fields, player) local target_pos = travelnet.targets[ owner_name ][ station_network ][ fields.target ].pos; player:moveto( target_pos, false); - if( travelnet_sound_enabled ) then + if( travelnet.travelnet_sound_enabled ) then minetest.sound_play("travelnet_travel.wav", {pos = target_pos, gain = 1.0, max_hear_distance = 10,}) end - if( travelnet_effect_enabled ) then + if( travelnet.travelnet_effect_enabled ) then minetest.env:add_entity( {x=target_pos.x,y=target_pos.y+0.5,z=target_pos.z}, "travelnet:effect"); -- it self-destructs after 20 turns end @@ -589,7 +598,8 @@ travelnet.can_dig = function( pos, player, description ) local name = player:get_player_name(); -- players with that priv can dig regardless of owner - if( minetest.check_player_privs(name, {travelnet_remove=true})) then + if( minetest.check_player_privs(name, {travelnet_remove=true}) + or travelnet.allow_dig( player_name, owner_name, network_name )) then return true; end @@ -609,99 +619,10 @@ end -minetest.register_node("travelnet:travelnet", { - - description = "Travelnet box", - - 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.45, -0.5,-0.5, 0.5, 1.45, 0.5}, - {-0.5 , -0.5, 0.45, 0.45, 1.45, 0.5}, - {-0.5, -0.5,-0.5 ,-0.45, 1.45, 0.5}, - - --groundplate to stand on - { -0.5,-0.5,-0.5,0.5,-0.45, 0.5}, - --roof - { -0.5, 1.45,-0.5,0.5, 1.5, 0.5}, - - -- control panel --- { -0.2, 0.6, 0.3, 0.2, 1.1, 0.5}, - - }, - }, - - - tiles = { - - "default_clay.png", -- view from top - "default_clay.png", -- view from bottom - "travelnet_travelnet_side.png", -- left side - "travelnet_travelnet_side.png", -- right side - "travelnet_travelnet_back.png", -- front view - "travelnet_travelnet_front.png", -- backward view - }, - inventory_image = "travelnet_inv.png", - - groups = {cracky=1,choppy=1,snappy=1}, - - light_source = 10, - - after_place_node = function(pos, placer, itemstack) - local meta = minetest.env:get_meta(pos); - meta:set_string("infotext", "Travelnet-box (unconfigured)"); - 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:;]".. - "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:;]".. - "button_exit[6.3,6.2;1.7,0.7;station_set;Store]" ); - end, - - on_receive_fields = travelnet.on_receive_fields, - on_punch = function(pos, node, puncher) - travelnet.update_formspec(pos, puncher:get_player_name()) - end, - - can_dig = function( pos, player ) - return travelnet.can_dig( pos, player, 'travelnet box' ) - end, - - 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) - - local pos = pointed_thing.above; - if( minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then - - 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, - -}) -minetest.register_entity( 'travelnet:effect', { +if( travelnet.travelnet_effect_enabled ) then + minetest.register_entity( 'travelnet:effect', { hp_max = 1, physical = false, @@ -729,22 +650,20 @@ minetest.register_entity( 'travelnet:effect', { self.object:remove(); end end -}) + }) +end - -minetest.register_craft({ - output = "travelnet:travelnet", - recipe = { - {"default:glass", "default:steel_ingot", "default:glass", }, - {"default:glass", "default:mese", "default:glass", }, - {"default:glass", "default:steel_ingot", "default:glass", } - } -}) - -dofile(minetest.get_modpath("travelnet").."/elevator.lua"); +if( travelnet.travelnet_enabled ) then + dofile(minetest.get_modpath("travelnet").."/travelnet.lua"); -- the travelnet node definition +end +if( travelnet.elevator_enabled ) then + dofile(minetest.get_modpath("travelnet").."/elevator.lua"); -- allows up/down transfers only +end +if( travelnet.doors_enabled ) then + dofile(minetest.get_modpath("travelnet").."/doors.lua"); -- doors that open and close automaticly when the travelnet or elevator is used +end -- upon server start, read the savefile travelnet.restore_data(); - diff --git a/travelnet.lua b/travelnet.lua new file mode 100644 index 0000000..54c8d68 --- /dev/null +++ b/travelnet.lua @@ -0,0 +1,101 @@ +-- contains the node definition for a general travelnet that can be used by anyone +-- further travelnets can only be installed by the owner or by people with the travelnet_attach priv +-- digging of such a travelnet is limited to the owner and to people with the travelnet_remove priv (useful for admins to clean up) +-- (this can be overrided in config.lua) +-- Autor: Sokomine +minetest.register_node("travelnet:travelnet", { + + description = "Travelnet box", + + 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.45, -0.5,-0.5, 0.5, 1.45, 0.5}, + {-0.5 , -0.5, 0.45, 0.45, 1.45, 0.5}, + {-0.5, -0.5,-0.5 ,-0.45, 1.45, 0.5}, + + --groundplate to stand on + { -0.5,-0.5,-0.5,0.5,-0.45, 0.5}, + --roof + { -0.5, 1.45,-0.5,0.5, 1.5, 0.5}, + + -- control panel +-- { -0.2, 0.6, 0.3, 0.2, 1.1, 0.5}, + + }, + }, + + + tiles = { + + "default_clay.png", -- view from top + "default_clay.png", -- view from bottom + "travelnet_travelnet_side.png", -- left side + "travelnet_travelnet_side.png", -- right side + "travelnet_travelnet_back.png", -- front view + "travelnet_travelnet_front.png", -- backward view + }, + inventory_image = "travelnet_inv.png", + + groups = {cracky=1,choppy=1,snappy=1}, + + light_source = 10, + + after_place_node = function(pos, placer, itemstack) + local meta = minetest.env:get_meta(pos); + meta:set_string("infotext", "Travelnet-box (unconfigured)"); + 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:;]".. + "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:;]".. + "button_exit[6.3,6.2;1.7,0.7;station_set;Store]" ); + end, + + on_receive_fields = travelnet.on_receive_fields, + on_punch = function(pos, node, puncher) + travelnet.update_formspec(pos, puncher:get_player_name()) + end, + + can_dig = function( pos, player ) + return travelnet.can_dig( pos, player, 'travelnet box' ) + end, + + 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) + + local pos = pointed_thing.above; + if( minetest.env:get_node({x=pos.x, y=pos.y+1, z=pos.z}).name ~= "air" ) then + + 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, + +}) + +--[ +minetest.register_craft({ + output = "travelnet:travelnet", + recipe = travelnet.travelnet_recipe, +})