diff --git a/deco_caves.lua b/deco_caves.lua index 461f14d..7ef2b03 100644 --- a/deco_caves.lua +++ b/deco_caves.lua @@ -80,7 +80,7 @@ minetest.register_node("fun_caves:glowing_fungal_stone", { }) -- Glowing fungus grows underground. -minetest.register_node("fun_caves:glowing_fungus", { +minetest.register_craftitem("fun_caves:glowing_fungus", { description = "Glowing Fungus", drawtype = "plantlike", paramtype = "light", @@ -111,7 +111,7 @@ newnode.light_source = default.LIGHT_MAX minetest.register_node("fun_caves:moon_glass", newnode) -- Moon juice is extracted from glowing fungus, to make glowing materials. -minetest.register_node("fun_caves:moon_juice", { +minetest.register_craftitem("fun_caves:moon_juice", { description = "Moon Juice", drawtype = "plantlike", paramtype = "light", diff --git a/init.lua b/init.lua index 9fee56f..ad5296a 100644 --- a/init.lua +++ b/init.lua @@ -3,10 +3,20 @@ fun_caves.version = "1.0" fun_caves.time_factor = 10 fun_caves.light_max = 8 fun_caves.path = minetest.get_modpath(minetest.get_current_modname()) +fun_caves.world = minetest.get_worldpath() fun_caves.DEBUG = false +local inp = io.open(fun_caves.world..'/fun_caves_data.txt','r') +if inp then + local d = inp:read('*a') + fun_caves.db = minetest.deserialize(d) +else + fun_caves.db = {} +end + + minetest.register_on_mapgen_init(function(mgparams) minetest.set_mapgen_params({flags="nocaves,nodungeons"}) end) diff --git a/nodes.lua b/nodes.lua index 17fbd9d..325996b 100644 --- a/nodes.lua +++ b/nodes.lua @@ -112,3 +112,91 @@ minetest.register_node("fun_caves:water_poison_flowing", newnode) -- light_source = LIGHT_MAX, -- pointable = false, --}) + +local function teleporter(user, area, power) + if not user then + return + end + + local name = user:get_player_name() + local pos = user:getpos() + + if not fun_caves.db then + fun_caves.db = {} + end + if not fun_caves.db.teleport_data then + fun_caves.db.teleport_data = {} + end + if not fun_caves.db.teleport_data[name] then + fun_caves.db.teleport_data[name] = {} + end + + local out = io.open(fun_caves.world..'/fun_caves_data.txt','w') + if not (out and name) then + return + end + + if fun_caves.db.teleport_data[name].teleported_from then + user:setpos(fun_caves.db.teleport_data[name].teleported_from) + fun_caves.db.teleport_data[name].teleported_from = nil + else + local newpos + if area == 'overworld' then + newpos = {x=math.random(12000)-6000, y=120, z=math.random(12000)-6000} + else + return + end + + user:setpos(newpos) + print('Fun Caves: '..name..' teleported to ('..pos.x..','..pos.y..','..pos.z..')') + fun_caves.db.teleport_data[name].teleported_from = pos + out:write(minetest.serialize(fun_caves.db)) + user:set_physics_override({gravity=0.1}) + + minetest.after(20, function() + user:set_physics_override({gravity=1}) + end) + end +end + +minetest.register_craftitem("fun_caves:teleporter_steel_aquamarine", { + description = "Steel and Aquamarine Teleporter", + drawtype = "plantlike", + paramtype = "light", + tiles = {"fun_caves_tesseract_steel_aqua.png"}, + inventory_image = "fun_caves_tesseract_steel_aqua.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), + on_use = function(itemstack, user, pointed_thing) + teleporter(user, 'overworld', 1) + end, +}) + +minetest.register_craftitem("fun_caves:pure_steel", { + description = "Incredibly Pure Steel", + drawtype = "plantlike", + paramtype = "light", + tiles = {"default_steel_ingot.png"}, + inventory_image = "default_steel_ingot.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_craftitem("fun_caves:perfect_aquamarine", { + description = "Perfect Aquamarine", + drawtype = "plantlike", + paramtype = "light", + tiles = {"default_diamond.png"}, + inventory_image = "default_diamond.png", + groups = {dig_immediate = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft({ + output = 'fun_caves:teleporter_steel_aquamarine', + recipe = { + {'fun_caves:pure_steel', 'default:copper_ingot', 'fun_caves:pure_steel'}, + {'fun_caves:pure_steel', 'fun_caves:perfect_aquamarine', 'fun_caves:pure_steel'}, + {'fun_caves:pure_steel', 'default:obsidianbrick', 'fun_caves:pure_steel'}, + } +}) diff --git a/textures/fun_caves_tesseract_bronze_aqua.png b/textures/fun_caves_tesseract_bronze_aqua.png new file mode 100644 index 0000000..b6e6ec4 Binary files /dev/null and b/textures/fun_caves_tesseract_bronze_aqua.png differ diff --git a/textures/fun_caves_tesseract_copper_aqua.png b/textures/fun_caves_tesseract_copper_aqua.png new file mode 100644 index 0000000..08c1477 Binary files /dev/null and b/textures/fun_caves_tesseract_copper_aqua.png differ diff --git a/textures/fun_caves_tesseract_gold_aqua.png b/textures/fun_caves_tesseract_gold_aqua.png new file mode 100644 index 0000000..47fcc7b Binary files /dev/null and b/textures/fun_caves_tesseract_gold_aqua.png differ diff --git a/textures/fun_caves_tesseract_mese_aqua.png b/textures/fun_caves_tesseract_mese_aqua.png new file mode 100644 index 0000000..4f7a123 Binary files /dev/null and b/textures/fun_caves_tesseract_mese_aqua.png differ diff --git a/textures/fun_caves_tesseract_silver_aqua.png b/textures/fun_caves_tesseract_silver_aqua.png new file mode 100644 index 0000000..7d8899a Binary files /dev/null and b/textures/fun_caves_tesseract_silver_aqua.png differ diff --git a/textures/fun_caves_tesseract_steel_aqua.png b/textures/fun_caves_tesseract_steel_aqua.png new file mode 100644 index 0000000..69fb520 Binary files /dev/null and b/textures/fun_caves_tesseract_steel_aqua.png differ diff --git a/textures/image_credits.txt b/textures/image_credits.txt index b5c5753..a060fa9 100644 --- a/textures/image_credits.txt +++ b/textures/image_credits.txt @@ -1,2 +1,3 @@ Original spider textures: AspireMint Original goblins textures and models: Francisco "FreeLikeGNU" Athens +Original tesseract: Claudio Rocchini (cc-by-sa 2.5), https://en.wikipedia.org/wiki/File:Runci_trunc_tessaract.png