local detail_level = 20 local spherebox = {} local detail = detail_level local sehne for i = 1, detail-1 do sehne = math.sqrt (0.25 - (((i/detail)-0.5)^2)) spherebox [i] = { -sehne , (i/detail)-0.5 , -sehne , sehne , (i/detail) + (1/detail)-0.5 , sehne , } end local param_palantiri = { description = "Palantiri", drawtype = "nodebox", sunlight_propagates = true, paramtype = 'light', paramtype2 = "facedir", selection_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 } }, node_box = { type = "fixed", fixed = spherebox, }, tiles = {"default_obsidian.png"}, groups = { cracky=1,choppy=1,snappy=1,travelnet=1 } , light_source = 10, after_place_node = function(pos, placer, itemstack) local meta = minetest.get_meta (pos) meta:set_string ("infotext", "Palantiri (unconfigured)") meta:set_string ("station_name", "") meta:set_string ("station_network","") meta:set_string ("owner", placer:get_player_name()) -- request initial 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,5.4;1.7,0.7;station_dig;Remove]" .. "button_exit[6.3,6.4;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 , on_place = function (itemstack, placer, pointed_thing) local pos = pointed_thing.above local anode anode = minetest.get_node ({x=pos.x, y=pos.y+1, z=pos.z}) if anode.name ~= "air" and anode.name ~= "default:vacuum" then minetest.chat_send_player (placer:get_player_name(), 'Not enough vertical space to place the travelpad') return end anode = minetest.get_node ({x=pos.x, y=pos.y+2, z=pos.z}) if anode.name ~= "air" and anode.name ~= "default:vacuum" then minetest.chat_send_player (placer:get_player_name(), 'Not enough vertical space to place the travelpad') return end return minetest.item_place(itemstack, placer, pointed_thing) end , } minetest.register_node ("travelnet:palantiri", param_palantiri) minetest.register_craft({ output = "travelnet:palantiri" , recipe = { {'default:obsidian' , 'default:diamondblock' , 'default:obsidian' } , {'default:diamondblock' , 'default:mese' , 'default:diamondblock' } , {'default:obsidian' , 'default:diamondblock' , 'default:obsidian' } } }) local tiles_classic = { "travelnet_classic_front.png", -- backward view "travelnet_classic_back.png", -- front view "travelnet_classic_side.png", -- sides "default_steel_block.png", -- view from top "default_clay.png", -- view from bottom } local tiles_oldcoder = { "travelnet_oldcoder_front.png", -- backward view "travelnet_oldcoder_side.png", -- front view "travelnet_oldcoder_side.png", -- sides "default_steel_block.png", -- view from top "default_clay.png", -- view from bottom } local tiles_poikilos = { "travelnet_poikilos_front.png", -- backward view "travelnet_poikilos_back.png", -- front view "travelnet_poikilos_side.png", -- sides "default_steel_block.png", -- view from top "default_clay.png", -- view from bottom } local sound = minetest.setting_get ("travelnet_sound") if sound == nil then sound = "travelnet_sound_poikilos" end travelnet.sound = sound local theme = minetest.setting_get ("travelnet_theme") local tiles_travelnet = tiles_oldcoder travelnet.theme = theme if theme == "classic" then tiles_travelnet = tiles_classic end if theme == "legacy" then tiles_travelnet = tiles_classic end if theme == "oldcoder" then tiles_travelnet = tiles_oldcoder end if theme == "poikilos" then tiles_travelnet = tiles_poikilos end if theme == "tardis" then tiles_travelnet = tiles_oldcoder end if theme == "palantiri" then minetest.register_node ("travelnet:travelnet", param_palantiri) else minetest.register_node ("travelnet:travelnet", { description = "Travelnet box", drawtype = "mesh", mesh = "travelnet.obj", sunlight_propagates = true, paramtype = 'light', paramtype2 = "facedir", wield_scale = {x=0.6, y=0.6, z=0.6}, selection_box = { type = "fixed", fixed = { -0.5, -0.5, -0.5, 0.5, 1.5, 0.5 } }, collision_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}, } , } , tiles = tiles_travelnet , inventory_image = "travelnet_inv.png" , groups = { cracky=1,choppy=1,snappy=1,travelnet=1 } , light_source = 10 , after_place_node = function(pos, placer, itemstack) local meta = minetest.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 initial 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,5.4;1.7,0.7;station_dig;Remove]" .. "button_exit[6.3,6.4;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, on_place = function (itemstack, placer, pointed_thing) local pos = pointed_thing.above local anode anode = minetest.get_node ({x=pos.x, y=pos.y+1, z=pos.z}) if anode.name ~= "air" and anode.name ~= "default:vacuum" then minetest.chat_send_player (placer:get_player_name(), 'Not enough vertical space to place the travelnet') return end return minetest.item_place(itemstack, placer, pointed_thing); end , }) end -- =================================================================== minetest.register_alias ("palantiri" , "travelnet:palantiri" ) minetest.register_alias ("travelnet" , "travelnet:travelnet" )