commit 6a28b6e065a051d5a3b6f6ad805bf1072d5db1ad Author: Der1248 Date: Sat Nov 3 12:03:34 2018 +0100 Castrum 1.3.0 upload diff --git a/README.txt b/README.txt new file mode 100644 index 0000000..1132309 --- /dev/null +++ b/README.txt @@ -0,0 +1,19 @@ +A subgame by 1248 + +Thanks to: +/ + +Info: +Castrum is my new game for Minetest. +You are on a floor plan of a castle. +Hit a diamond block to build and upgrade a building. +Go first to the quarry in the east. +Collect resources and rebuild the old castle + +License: +See README.txt in each mod for more information +Every code written by me is LGPLv2.1 and CC-BY-SA + +notes: +wood door in doors mod changed +chest in default mod changed \ No newline at end of file diff --git a/game.conf b/game.conf new file mode 100644 index 0000000..e84e8dd --- /dev/null +++ b/game.conf @@ -0,0 +1 @@ +name = Castrum diff --git a/menu/Thumbs.db b/menu/Thumbs.db new file mode 100644 index 0000000..3ffa3e5 Binary files /dev/null and b/menu/Thumbs.db differ diff --git a/menu/header.png b/menu/header.png new file mode 100644 index 0000000..b53096d Binary files /dev/null and b/menu/header.png differ diff --git a/menu/icon.png b/menu/icon.png new file mode 100644 index 0000000..dceb829 Binary files /dev/null and b/menu/icon.png differ diff --git a/mods/beds/README.txt b/mods/beds/README.txt new file mode 100644 index 0000000..cda6ebd --- /dev/null +++ b/mods/beds/README.txt @@ -0,0 +1,26 @@ +Minetest Game mod: beds +======================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by BlockMen (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0) + +This mod adds a bed to Minetest which allows to skip the night. +To sleep, rightclick the bed. If playing in singleplayer mode the night gets skipped +immediately. If playing multiplayer you get shown how many other players are in bed too, +if all players are sleeping the night gets skipped. The night skip can be forced if more +than 50% of the players are lying in bed and use this option. + +Another feature is a controlled respawning. If you have slept in bed (not just lying in +it) your respawn point is set to the beds location and you will respawn there after +death. +You can disable the respawn at beds by setting "enable_bed_respawn = false" in +minetest.conf. +You can disable the night skip feature by setting "enable_bed_night_skip = false" in +minetest.conf or by using the /set command in-game. diff --git a/mods/beds/api.lua b/mods/beds/api.lua new file mode 100644 index 0000000..97dde43 --- /dev/null +++ b/mods/beds/api.lua @@ -0,0 +1,167 @@ + +local reverse = true + +local function destruct_bed(pos, n) + local node = minetest.get_node(pos) + local other + + if n == 2 then + local dir = minetest.facedir_to_dir(node.param2) + other = vector.subtract(pos, dir) + elseif n == 1 then + local dir = minetest.facedir_to_dir(node.param2) + other = vector.add(pos, dir) + end + + if reverse then + reverse = not reverse + minetest.remove_node(other) + minetest.check_for_falling(other) + else + reverse = not reverse + end +end + +function beds.register_bed(name, def) + minetest.register_node(name .. "_bottom", { + description = def.description, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + drawtype = "nodebox", + tiles = def.tiles.bottom, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + stack_max = 1, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 1}, + sounds = def.sounds or default.node_sound_wood_defaults(), + node_box = { + type = "fixed", + fixed = def.nodebox.bottom, + }, + selection_box = { + type = "fixed", + fixed = def.selectionbox, + }, + + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + local pos + if minetest.registered_items[minetest.get_node(under).name].buildable_to then + pos = under + else + pos = pointed_thing.above + end + + if minetest.is_protected(pos, placer:get_player_name()) and + not minetest.check_player_privs(placer, "protection_bypass") then + minetest.record_protection_violation(pos, placer:get_player_name()) + return itemstack + end + + local node_def = minetest.registered_nodes[minetest.get_node(pos).name] + if not node_def or not node_def.buildable_to then + return itemstack + end + + local dir = minetest.dir_to_facedir(placer:get_look_dir()) + local botpos = vector.add(pos, minetest.facedir_to_dir(dir)) + + if minetest.is_protected(botpos, placer:get_player_name()) and + not minetest.check_player_privs(placer, "protection_bypass") then + minetest.record_protection_violation(botpos, placer:get_player_name()) + return itemstack + end + + local botdef = minetest.registered_nodes[minetest.get_node(botpos).name] + if not botdef or not botdef.buildable_to then + return itemstack + end + + minetest.set_node(pos, {name = name .. "_bottom", param2 = dir}) + minetest.set_node(botpos, {name = name .. "_top", param2 = dir}) + + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then + itemstack:take_item() + end + return itemstack + end, + + on_destruct = function(pos) + destruct_bed(pos, 1) + end, + + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + beds.on_rightclick(pos, clicker) + return itemstack + end, + + on_rotate = function(pos, node, user, mode, new_param2) + local dir = minetest.facedir_to_dir(node.param2) + local p = vector.add(pos, dir) + local node2 = minetest.get_node_or_nil(p) + if not node2 or not minetest.get_item_group(node2.name, "bed") == 2 or + not node.param2 == node2.param2 then + return false + end + if minetest.is_protected(p, user:get_player_name()) then + minetest.record_protection_violation(p, user:get_player_name()) + return false + end + if mode ~= screwdriver.ROTATE_FACE then + return false + end + local newp = vector.add(pos, minetest.facedir_to_dir(new_param2)) + local node3 = minetest.get_node_or_nil(newp) + local node_def = node3 and minetest.registered_nodes[node3.name] + if not node_def or not node_def.buildable_to then + return false + end + if minetest.is_protected(newp, user:get_player_name()) then + minetest.record_protection_violation(newp, user:get_player_name()) + return false + end + node.param2 = new_param2 + -- do not remove_node here - it will trigger destroy_bed() + minetest.set_node(p, {name = "air"}) + minetest.set_node(pos, node) + minetest.set_node(newp, {name = name .. "_top", param2 = new_param2}) + return true + end, + }) + + minetest.register_node(name .. "_top", { + drawtype = "nodebox", + tiles = def.tiles.top, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + pointable = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 3, bed = 2}, + sounds = def.sounds or default.node_sound_wood_defaults(), + drop = name .. "_bottom", + node_box = { + type = "fixed", + fixed = def.nodebox.top, + }, + on_destruct = function(pos) + destruct_bed(pos, 2) + end, + }) + + minetest.register_alias(name, name .. "_bottom") + + minetest.register_craft({ + output = name, + recipe = def.recipe + }) +end diff --git a/mods/beds/beds.lua b/mods/beds/beds.lua new file mode 100644 index 0000000..bb2fd5d --- /dev/null +++ b/mods/beds/beds.lua @@ -0,0 +1,104 @@ +-- Fancy shaped bed + +beds.register_bed("beds:fancy_bed", { + description = "Fancy Bed", + inventory_image = "beds_bed_fancy.png", + wield_image = "beds_bed_fancy.png", + tiles = { + bottom = { + "beds_bed_top1.png", + "default_wood.png", + "beds_bed_side1.png", + "beds_bed_side1.png^[transformFX", + "default_wood.png", + "beds_bed_foot.png", + }, + top = { + "beds_bed_top2.png", + "default_wood.png", + "beds_bed_side2.png", + "beds_bed_side2.png^[transformFX", + "beds_bed_head.png", + "default_wood.png", + } + }, + nodebox = { + bottom = { + {-0.5, -0.5, -0.5, -0.375, -0.065, -0.4375}, + {0.375, -0.5, -0.5, 0.5, -0.065, -0.4375}, + {-0.5, -0.375, -0.5, 0.5, -0.125, -0.4375}, + {-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5}, + {0.4375, -0.375, -0.5, 0.5, -0.125, 0.5}, + {-0.4375, -0.3125, -0.4375, 0.4375, -0.0625, 0.5}, + }, + top = { + {-0.5, -0.5, 0.4375, -0.375, 0.1875, 0.5}, + {0.375, -0.5, 0.4375, 0.5, 0.1875, 0.5}, + {-0.5, 0, 0.4375, 0.5, 0.125, 0.5}, + {-0.5, -0.375, 0.4375, 0.5, -0.125, 0.5}, + {-0.5, -0.375, -0.5, -0.4375, -0.125, 0.5}, + {0.4375, -0.375, -0.5, 0.5, -0.125, 0.5}, + {-0.4375, -0.3125, -0.5, 0.4375, -0.0625, 0.4375}, + } + }, + selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5}, + recipe = { + {"", "", "group:stick"}, + {"wool:red", "wool:red", "wool:white"}, + {"group:wood", "group:wood", "group:wood"}, + }, +}) + +-- Simple shaped bed + +beds.register_bed("beds:bed", { + description = "Simple Bed", + inventory_image = "beds_bed.png", + wield_image = "beds_bed.png", + tiles = { + bottom = { + "beds_bed_top_bottom.png^[transformR90", + "default_wood.png", + "beds_bed_side_bottom_r.png", + "beds_bed_side_bottom_r.png^[transformfx", + "beds_transparent.png", + "beds_bed_side_bottom.png" + }, + top = { + "beds_bed_top_top.png^[transformR90", + "default_wood.png", + "beds_bed_side_top_r.png", + "beds_bed_side_top_r.png^[transformfx", + "beds_bed_side_top.png", + "beds_transparent.png", + } + }, + nodebox = { + bottom = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5}, + top = {-0.5, -0.5, -0.5, 0.5, 0.06, 0.5}, + }, + selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.06, 1.5}, + recipe = { + {"wool:red", "wool:red", "wool:white"}, + {"group:wood", "group:wood", "group:wood"} + }, +}) + +-- Aliases for PilzAdam's beds mod + +minetest.register_alias("beds:bed_bottom_red", "beds:bed_bottom") +minetest.register_alias("beds:bed_top_red", "beds:bed_top") + +-- Fuel + +minetest.register_craft({ + type = "fuel", + recipe = "beds:fancy_bed_bottom", + burntime = 13, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "beds:bed_bottom", + burntime = 12, +}) diff --git a/mods/beds/depends.txt b/mods/beds/depends.txt new file mode 100644 index 0000000..470ec30 --- /dev/null +++ b/mods/beds/depends.txt @@ -0,0 +1,2 @@ +default +wool diff --git a/mods/beds/functions.lua b/mods/beds/functions.lua new file mode 100644 index 0000000..78df9a1 --- /dev/null +++ b/mods/beds/functions.lua @@ -0,0 +1,220 @@ +local pi = math.pi +local player_in_bed = 0 +local is_sp = minetest.is_singleplayer() +local enable_respawn = minetest.settings:get_bool("enable_bed_respawn") +if enable_respawn == nil then + enable_respawn = true +end + +-- Helper functions + +local function get_look_yaw(pos) + local n = minetest.get_node(pos) + if n.param2 == 1 then + return pi / 2, n.param2 + elseif n.param2 == 3 then + return -pi / 2, n.param2 + elseif n.param2 == 0 then + return pi, n.param2 + else + return 0, n.param2 + end +end + +local function is_night_skip_enabled() + local enable_night_skip = minetest.settings:get_bool("enable_bed_night_skip") + if enable_night_skip == nil then + enable_night_skip = true + end + return enable_night_skip +end + +local function check_in_beds(players) + local in_bed = beds.player + if not players then + players = minetest.get_connected_players() + end + + for n, player in ipairs(players) do + local name = player:get_player_name() + if not in_bed[name] then + return false + end + end + + return #players > 0 +end + +local function lay_down(player, pos, bed_pos, state, skip) + local name = player:get_player_name() + local hud_flags = player:hud_get_flags() + + if not player or not name then + return + end + + -- stand up + if state ~= nil and not state then + local p = beds.pos[name] or nil + if beds.player[name] ~= nil then + beds.player[name] = nil + player_in_bed = player_in_bed - 1 + end + -- skip here to prevent sending player specific changes (used for leaving players) + if skip then + return + end + if p then + player:setpos(p) + end + + -- physics, eye_offset, etc + player:set_eye_offset({x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}) + player:set_look_horizontal(math.random(1, 180) / 100) + default.player_attached[name] = false + player:set_physics_override(1, 1, 1) + hud_flags.wielditem = true + default.player_set_animation(player, "stand" , 30) + + -- lay down + else + beds.player[name] = 1 + beds.pos[name] = pos + player_in_bed = player_in_bed + 1 + + -- physics, eye_offset, etc + player:set_eye_offset({x = 0, y = -13, z = 0}, {x = 0, y = 0, z = 0}) + local yaw, param2 = get_look_yaw(bed_pos) + player:set_look_horizontal(yaw) + local dir = minetest.facedir_to_dir(param2) + local p = {x = bed_pos.x + dir.x / 2, y = bed_pos.y, z = bed_pos.z + dir.z / 2} + player:set_physics_override(0, 0, 0) + player:setpos(p) + default.player_attached[name] = true + hud_flags.wielditem = false + default.player_set_animation(player, "lay" , 0) + end + + player:hud_set_flags(hud_flags) +end + +local function update_formspecs(finished) + local ges = #minetest.get_connected_players() + local form_n + local is_majority = (ges / 2) < player_in_bed + + if finished then + form_n = beds.formspec .. "label[2.7,11; Good morning.]" + else + form_n = beds.formspec .. "label[2.2,11;" .. tostring(player_in_bed) .. + " of " .. tostring(ges) .. " players are in bed]" + if is_majority and is_night_skip_enabled() then + form_n = form_n .. "button_exit[2,8;4,0.75;force;Force night skip]" + end + end + + for name,_ in pairs(beds.player) do + minetest.show_formspec(name, "beds_form", form_n) + end +end + + +-- Public functions + +function beds.kick_players() + for name, _ in pairs(beds.player) do + local player = minetest.get_player_by_name(name) + lay_down(player, nil, nil, false) + end +end + +function beds.skip_night() + minetest.set_timeofday(0.23) +end + +function beds.on_rightclick(pos, player) + local name = player:get_player_name() + local ppos = player:getpos() + local tod = minetest.get_timeofday() + + if tod > 0.2 and tod < 0.805 then + if beds.player[name] then + lay_down(player, nil, nil, false) + end + minetest.chat_send_player(name, "You can only sleep at night.") + return + end + + -- move to bed + if not beds.player[name] then + lay_down(player, ppos, pos) + beds.set_spawns() -- save respawn positions when entering bed + else + lay_down(player, nil, nil, false) + end + + if not is_sp then + update_formspecs(false) + end + + -- skip the night and let all players stand up + if check_in_beds() then + minetest.after(2, function() + if not is_sp then + update_formspecs(is_night_skip_enabled()) + end + if is_night_skip_enabled() then + beds.skip_night() + beds.kick_players() + end + end) + end +end + + +-- Callbacks +-- Only register respawn callback if respawn enabled +if enable_respawn then + -- respawn player at bed if enabled and valid position is found + minetest.register_on_respawnplayer(function(player) + local name = player:get_player_name() + local pos = beds.spawn[name] + if pos then + player:setpos(pos) + return true + end + end) +end + +minetest.register_on_leaveplayer(function(player) + local name = player:get_player_name() + lay_down(player, nil, nil, false, true) + beds.player[name] = nil + if check_in_beds() then + minetest.after(2, function() + update_formspecs(is_night_skip_enabled()) + if is_night_skip_enabled() then + beds.skip_night() + beds.kick_players() + end + end) + end +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "beds_form" then + return + end + if fields.quit or fields.leave then + lay_down(player, nil, nil, false) + update_formspecs(false) + end + + if fields.force then + update_formspecs(is_night_skip_enabled()) + if is_night_skip_enabled() then + beds.skip_night() + beds.kick_players() + end + end +end) diff --git a/mods/beds/init.lua b/mods/beds/init.lua new file mode 100644 index 0000000..8b25890 --- /dev/null +++ b/mods/beds/init.lua @@ -0,0 +1,17 @@ +beds = {} +beds.player = {} +beds.pos = {} +beds.spawn = {} + +beds.formspec = "size[8,15;true]" .. + "bgcolor[#080808BB; true]" .. + "button_exit[2,12;4,0.75;leave;Leave Bed]" + +local modpath = minetest.get_modpath("beds") + +-- Load files + +dofile(modpath .. "/functions.lua") +dofile(modpath .. "/api.lua") +dofile(modpath .. "/beds.lua") +dofile(modpath .. "/spawns.lua") diff --git a/mods/beds/license.txt b/mods/beds/license.txt new file mode 100644 index 0000000..0494b36 --- /dev/null +++ b/mods/beds/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 BlockMen + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/beds/spawns.lua b/mods/beds/spawns.lua new file mode 100644 index 0000000..6b1f404 --- /dev/null +++ b/mods/beds/spawns.lua @@ -0,0 +1,63 @@ +local world_path = minetest.get_worldpath() +local org_file = world_path .. "/beds_spawns" +local file = world_path .. "/beds_spawns" +local bkwd = false + +-- check for PA's beds mod spawns +local cf = io.open(world_path .. "/beds_player_spawns", "r") +if cf ~= nil then + io.close(cf) + file = world_path .. "/beds_player_spawns" + bkwd = true +end + +function beds.read_spawns() + local spawns = beds.spawn + local input = io.open(file, "r") + if input and not bkwd then + repeat + local x = input:read("*n") + if x == nil then + break + end + local y = input:read("*n") + local z = input:read("*n") + local name = input:read("*l") + spawns[name:sub(2)] = {x = x, y = y, z = z} + until input:read(0) == nil + io.close(input) + elseif input and bkwd then + beds.spawn = minetest.deserialize(input:read("*all")) + input:close() + beds.save_spawns() + os.rename(file, file .. ".backup") + file = org_file + end +end + +beds.read_spawns() + +function beds.save_spawns() + if not beds.spawn then + return + end + local data = {} + local output = io.open(org_file, "w") + for k, v in pairs(beds.spawn) do + table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, k)) + end + output:write(table.concat(data)) + io.close(output) +end + +function beds.set_spawns() + for name,_ in pairs(beds.player) do + local player = minetest.get_player_by_name(name) + local p = player:getpos() + -- but don't change spawn location if borrowing a bed + if not minetest.is_protected(p, name) then + beds.spawn[name] = p + end + end + beds.save_spawns() +end diff --git a/mods/beds/textures/beds_bed.png b/mods/beds/textures/beds_bed.png new file mode 100644 index 0000000..5c0054c Binary files /dev/null and b/mods/beds/textures/beds_bed.png differ diff --git a/mods/beds/textures/beds_bed_fancy.png b/mods/beds/textures/beds_bed_fancy.png new file mode 100644 index 0000000..4f9e8a7 Binary files /dev/null and b/mods/beds/textures/beds_bed_fancy.png differ diff --git a/mods/beds/textures/beds_bed_foot.png b/mods/beds/textures/beds_bed_foot.png new file mode 100644 index 0000000..74d84c8 Binary files /dev/null and b/mods/beds/textures/beds_bed_foot.png differ diff --git a/mods/beds/textures/beds_bed_head.png b/mods/beds/textures/beds_bed_head.png new file mode 100644 index 0000000..763f5e1 Binary files /dev/null and b/mods/beds/textures/beds_bed_head.png differ diff --git a/mods/beds/textures/beds_bed_side1.png b/mods/beds/textures/beds_bed_side1.png new file mode 100644 index 0000000..1ed8158 Binary files /dev/null and b/mods/beds/textures/beds_bed_side1.png differ diff --git a/mods/beds/textures/beds_bed_side2.png b/mods/beds/textures/beds_bed_side2.png new file mode 100644 index 0000000..9d1384d Binary files /dev/null and b/mods/beds/textures/beds_bed_side2.png differ diff --git a/mods/beds/textures/beds_bed_side_bottom.png b/mods/beds/textures/beds_bed_side_bottom.png new file mode 100644 index 0000000..99ff309 Binary files /dev/null and b/mods/beds/textures/beds_bed_side_bottom.png differ diff --git a/mods/beds/textures/beds_bed_side_bottom_r.png b/mods/beds/textures/beds_bed_side_bottom_r.png new file mode 100644 index 0000000..6f870e8 Binary files /dev/null and b/mods/beds/textures/beds_bed_side_bottom_r.png differ diff --git a/mods/beds/textures/beds_bed_side_top.png b/mods/beds/textures/beds_bed_side_top.png new file mode 100644 index 0000000..b2807c5 Binary files /dev/null and b/mods/beds/textures/beds_bed_side_top.png differ diff --git a/mods/beds/textures/beds_bed_side_top_r.png b/mods/beds/textures/beds_bed_side_top_r.png new file mode 100644 index 0000000..429ad7d Binary files /dev/null and b/mods/beds/textures/beds_bed_side_top_r.png differ diff --git a/mods/beds/textures/beds_bed_top1.png b/mods/beds/textures/beds_bed_top1.png new file mode 100644 index 0000000..b6fcc2c Binary files /dev/null and b/mods/beds/textures/beds_bed_top1.png differ diff --git a/mods/beds/textures/beds_bed_top2.png b/mods/beds/textures/beds_bed_top2.png new file mode 100644 index 0000000..2fe5bf2 Binary files /dev/null and b/mods/beds/textures/beds_bed_top2.png differ diff --git a/mods/beds/textures/beds_bed_top_bottom.png b/mods/beds/textures/beds_bed_top_bottom.png new file mode 100644 index 0000000..9b78be6 Binary files /dev/null and b/mods/beds/textures/beds_bed_top_bottom.png differ diff --git a/mods/beds/textures/beds_bed_top_top.png b/mods/beds/textures/beds_bed_top_top.png new file mode 100644 index 0000000..e877c80 Binary files /dev/null and b/mods/beds/textures/beds_bed_top_top.png differ diff --git a/mods/beds/textures/beds_transparent.png b/mods/beds/textures/beds_transparent.png new file mode 100644 index 0000000..2dc0e3d Binary files /dev/null and b/mods/beds/textures/beds_transparent.png differ diff --git a/mods/boats/README.txt b/mods/boats/README.txt new file mode 100644 index 0000000..59631d9 --- /dev/null +++ b/mods/boats/README.txt @@ -0,0 +1,15 @@ +Minetest Game mod: boats +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures and model) +------------------------------------- +Textures: Zeg9 (CC BY-SA 3.0) +Model: thetoon and Zeg9 (CC BY-SA 3.0), + modified by PavelS(SokolovPavel) (CC BY-SA 3.0), + modified by sofar (CC BY-SA 3.0) diff --git a/mods/boats/depends.txt b/mods/boats/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/boats/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/boats/init.lua b/mods/boats/init.lua new file mode 100644 index 0000000..4d8f467 --- /dev/null +++ b/mods/boats/init.lua @@ -0,0 +1,271 @@ +-- +-- Helper functions +-- + +local function is_water(pos) + local nn = minetest.get_node(pos).name + return minetest.get_item_group(nn, "water") ~= 0 +end + + +local function get_sign(i) + if i == 0 then + return 0 + else + return i / math.abs(i) + end +end + + +local function get_velocity(v, yaw, y) + local x = -math.sin(yaw) * v + local z = math.cos(yaw) * v + return {x = x, y = y, z = z} +end + + +local function get_v(v) + return math.sqrt(v.x ^ 2 + v.z ^ 2) +end + +-- +-- Boat entity +-- + +local boat = { + physical = true, + -- Warning: Do not change the position of the collisionbox top surface, + -- lowering it causes the boat to fall through the world if underwater + collisionbox = {-0.5, -0.35, -0.5, 0.5, 0.3, 0.5}, + visual = "mesh", + mesh = "boats_boat.obj", + textures = {"default_wood.png"}, + + driver = nil, + v = 0, + last_v = 0, + removed = false +} + + +function boat.on_rightclick(self, clicker) + if not clicker or not clicker:is_player() then + return + end + local name = clicker:get_player_name() + if self.driver and clicker == self.driver then + self.driver = nil + clicker:set_detach() + default.player_attached[name] = false + default.player_set_animation(clicker, "stand" , 30) + local pos = clicker:getpos() + pos = {x = pos.x, y = pos.y + 0.2, z = pos.z} + minetest.after(0.1, function() + clicker:setpos(pos) + end) + elseif not self.driver then + local attach = clicker:get_attach() + if attach and attach:get_luaentity() then + local luaentity = attach:get_luaentity() + if luaentity.driver then + luaentity.driver = nil + end + clicker:set_detach() + end + self.driver = clicker + clicker:set_attach(self.object, "", + {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) + default.player_attached[name] = true + minetest.after(0.2, function() + default.player_set_animation(clicker, "sit" , 30) + end) + clicker:set_look_horizontal(self.object:getyaw()) + end +end + + +function boat.on_activate(self, staticdata, dtime_s) + self.object:set_armor_groups({immortal = 1}) + if staticdata then + self.v = tonumber(staticdata) + end + self.last_v = self.v +end + + +function boat.get_staticdata(self) + return tostring(self.v) +end + + +function boat.on_punch(self, puncher) + if not puncher or not puncher:is_player() or self.removed then + return + end + if self.driver and puncher == self.driver then + self.driver = nil + puncher:set_detach() + default.player_attached[puncher:get_player_name()] = false + end + if not self.driver then + self.removed = true + local inv = puncher:get_inventory() + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(puncher:get_player_name())) + or not inv:contains_item("main", "boats:boat") then + local leftover = inv:add_item("main", "boats:boat") + -- if no room in inventory add a replacement boat to the world + if not leftover:is_empty() then + minetest.add_item(self.object:getpos(), leftover) + end + end + -- delay remove to ensure player is detached + minetest.after(0.1, function() + self.object:remove() + end) + end +end + + +function boat.on_step(self, dtime) + self.v = get_v(self.object:getvelocity()) * get_sign(self.v) + if self.driver then + local ctrl = self.driver:get_player_control() + local yaw = self.object:getyaw() + if ctrl.up then + self.v = self.v + 0.1 + elseif ctrl.down then + self.v = self.v - 0.1 + end + if ctrl.left then + if self.v < 0 then + self.object:setyaw(yaw - (1 + dtime) * 0.03) + else + self.object:setyaw(yaw + (1 + dtime) * 0.03) + end + elseif ctrl.right then + if self.v < 0 then + self.object:setyaw(yaw + (1 + dtime) * 0.03) + else + self.object:setyaw(yaw - (1 + dtime) * 0.03) + end + end + end + local velo = self.object:getvelocity() + if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then + self.object:setpos(self.object:getpos()) + return + end + local s = get_sign(self.v) + self.v = self.v - 0.02 * s + if s ~= get_sign(self.v) then + self.object:setvelocity({x = 0, y = 0, z = 0}) + self.v = 0 + return + end + if math.abs(self.v) > 5 then + self.v = 5 * get_sign(self.v) + end + + local p = self.object:getpos() + p.y = p.y - 0.5 + local new_velo + local new_acce = {x = 0, y = 0, z = 0} + if not is_water(p) then + local nodedef = minetest.registered_nodes[minetest.get_node(p).name] + if (not nodedef) or nodedef.walkable then + self.v = 0 + new_acce = {x = 0, y = 1, z = 0} + else + new_acce = {x = 0, y = -9.8, z = 0} + end + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + else + p.y = p.y + 1 + if is_water(p) then + local y = self.object:getvelocity().y + if y >= 5 then + y = 5 + elseif y < 0 then + new_acce = {x = 0, y = 20, z = 0} + else + new_acce = {x = 0, y = 5, z = 0} + end + new_velo = get_velocity(self.v, self.object:getyaw(), y) + self.object:setpos(self.object:getpos()) + else + new_acce = {x = 0, y = 0, z = 0} + if math.abs(self.object:getvelocity().y) < 1 then + local pos = self.object:getpos() + pos.y = math.floor(pos.y) + 0.5 + self.object:setpos(pos) + new_velo = get_velocity(self.v, self.object:getyaw(), 0) + else + new_velo = get_velocity(self.v, self.object:getyaw(), + self.object:getvelocity().y) + self.object:setpos(self.object:getpos()) + end + end + end + self.object:setvelocity(new_velo) + self.object:setacceleration(new_acce) +end + + +minetest.register_entity("boats:boat", boat) + + +minetest.register_craftitem("boats:boat", { + description = "Boat", + inventory_image = "boats_inventory.png", + wield_image = "boats_wield.png", + wield_scale = {x = 2, y = 2, z = 1}, + liquids_pointable = true, + groups = {flammable = 2}, + + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + if pointed_thing.type ~= "node" then + return itemstack + end + if not is_water(pointed_thing.under) then + return itemstack + end + pointed_thing.under.y = pointed_thing.under.y + 0.5 + boat = minetest.add_entity(pointed_thing.under, "boats:boat") + if boat then + boat:setyaw(placer:get_look_horizontal()) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then + itemstack:take_item() + end + end + return itemstack + end, +}) + + +minetest.register_craft({ + output = "boats:boat", + recipe = { + {"", "", "" }, + {"group:wood", "", "group:wood"}, + {"group:wood", "group:wood", "group:wood"}, + }, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "boats:boat", + burntime = 20, +}) diff --git a/mods/boats/license.txt b/mods/boats/license.txt new file mode 100644 index 0000000..d4afe75 --- /dev/null +++ b/mods/boats/license.txt @@ -0,0 +1,63 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures and model) +-------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Zeg9 +Copyright (C) 2012-2016 thetoon +Copyright (C) 2012-2016 PavelS(SokolovPavel) +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/boats/models/boats_boat.obj b/mods/boats/models/boats_boat.obj new file mode 100644 index 0000000..0f21e47 --- /dev/null +++ b/mods/boats/models/boats_boat.obj @@ -0,0 +1,358 @@ +# Blender v2.76 (sub 11) OBJ File: 'boat.blend' +# www.blender.org +mtllib boat.mtl +o boats_boat +v -6.786140 -3.033999 -9.415440 +v -6.786140 -1.967150 -9.415440 +v -6.786140 -1.967150 8.793510 +v -6.786140 -3.033999 8.793510 +v 5.732520 -1.967150 -9.415440 +v 5.732520 -3.033999 -9.415440 +v 5.732520 -3.033999 8.793510 +v 5.732520 -1.967150 8.793510 +v -2.233900 -3.033999 -9.415440 +v -2.233900 -1.967150 -9.415440 +v -2.233900 -1.967150 8.793510 +v -2.233900 -3.033999 8.793510 +v 2.318340 -3.033999 -9.415440 +v 2.318340 -1.967150 -9.415440 +v 2.318340 -1.967150 8.793510 +v 2.318340 -3.033999 8.793510 +v -3.371960 -3.033999 8.793510 +v -3.371960 -1.967150 8.793510 +v -3.371960 -1.967150 -9.415440 +v -3.371960 -3.033999 -9.415440 +v 2.318340 0.276645 8.793510 +v 1.180280 -1.967150 8.793510 +v 5.732520 0.276645 8.793510 +v 5.732520 1.039180 8.793510 +v 6.870580 0.276645 8.793510 +v 6.870580 -1.967150 8.793510 +v 2.318340 1.039180 8.793510 +v 1.180280 0.276645 8.793510 +v 1.180280 1.039180 8.793510 +v 1.180280 -3.033999 8.793510 +v -2.233900 0.276645 8.793510 +v -3.371960 0.276645 8.793510 +v -2.233900 1.039180 8.793510 +v -3.371960 1.039180 8.793510 +v -6.786140 0.276645 8.793510 +v -7.786200 0.276645 8.793510 +v -7.786200 -1.967150 8.793510 +v -6.786140 1.039180 8.793510 +v 1.180280 -1.967150 -9.415440 +v 1.180280 -3.033999 -9.415440 +v 2.318340 0.276645 -9.415440 +v 1.180280 0.276645 -9.415440 +v 2.318340 1.039180 -9.415440 +v 5.732520 0.276645 -9.415440 +v 6.870580 -1.967150 -9.415440 +v 5.732520 1.039180 -9.415440 +v 6.870580 0.276645 -9.415440 +v 0.042220 1.039180 -9.415440 +v 1.180280 1.039180 -9.415440 +v 0.042220 -1.967150 -9.415440 +v -1.095840 -1.967150 -9.415440 +v -2.233900 0.276645 -9.415440 +v -3.371960 0.276645 -9.415440 +v -2.233900 1.039180 -9.415440 +v -1.095840 1.039180 -9.415440 +v -3.371960 1.039180 -9.415440 +v -6.786140 0.276645 -9.415440 +v -6.786140 1.039180 -9.415440 +v -7.786200 -1.967150 -9.415440 +v -7.786200 0.276645 -9.415440 +v -1.095840 0.156645 -12.044100 +v -1.095840 -4.601110 -9.415440 +v -1.095840 1.039181 -10.802900 +v -1.095840 2.868579 -10.802900 +v -1.095840 2.868580 -7.883420 +v -1.095840 3.746069 -12.034100 +v -1.095840 3.746070 -7.883420 +v -1.095840 0.156645 -14.294900 +v -1.095840 -4.601110 -14.284900 +v 0.042220 -4.601110 -14.284900 +v 0.042220 -4.601110 -9.415440 +v 0.042220 1.039181 -10.802900 +v 0.042220 0.156645 -12.044100 +v 0.042220 2.868579 -10.802900 +v 0.042220 0.156645 -14.294900 +v 0.042220 3.746069 -12.034100 +v 0.042220 3.746070 -7.883420 +v 0.042220 2.868580 -7.883420 +v -1.096322 -3.033999 -9.415440 +v 0.044046 -3.035397 -9.415440 +vt 1.000000 0.187500 +vt -1.000000 0.312500 +vt 1.000000 0.312500 +vt 0.687500 1.000000 +vt 0.500000 0.875000 +vt 0.500000 0.625000 +vt -1.000000 0.062500 +vt 1.000000 0.062500 +vt 1.000000 -0.000000 +vt -1.000000 0.125000 +vt 1.000000 0.125000 +vt 0.437500 0.125000 +vt 0.312500 0.500000 +vt 0.312500 0.125000 +vt 1.000000 0.625000 +vt -1.000000 0.500000 +vt 1.000000 0.500000 +vt 0.187500 0.687500 +vt -0.187500 0.687500 +vt -0.187500 0.312500 +vt 1.000000 0.812500 +vt -1.000000 0.937500 +vt -1.000000 0.812500 +vt 0.812500 0.687500 +vt 1.187500 0.687500 +vt 0.812500 0.312500 +vt 1.000000 0.562500 +vt 0.312500 0.437500 +vt 1.000000 0.437500 +vt 1.000000 0.750000 +vt -1.000000 0.875000 +vt -1.000000 0.750000 +vt -1.000000 1.000000 +vt 1.000000 1.000000 +vt 0.437500 0.625000 +vt 0.562500 0.437500 +vt 0.562500 0.625000 +vt -1.000000 0.437500 +vt -1.000000 0.000000 +vt 0.500000 0.062500 +vt 0.375000 0.750000 +vt 0.500000 0.750000 +vt -1.000000 0.250000 +vt -1.000000 0.687500 +vt 1.000000 0.687500 +vt 0.625000 0.375000 +vt 1.000000 0.375000 +vt 1.000000 0.250000 +vt 1.000000 0.937500 +vt 0.437500 0.812500 +vt 0.312500 0.312500 +vt 0.312500 0.812500 +vt 0.437500 0.312500 +vt 0.437500 0.437500 +vt 0.687500 0.812500 +vt 0.000000 0.687500 +vt 0.000000 0.812500 +vt -1.000000 0.562500 +vt 0.875000 0.812500 +vt 0.875000 0.687500 +vt 0.250000 0.312500 +vt 0.562500 0.187500 +vt 0.250000 0.187500 +vt -1.000000 0.187500 +vt 0.312500 0.625000 +vt 0.312500 0.187500 +vt 0.312500 -0.187500 +vt 1.000000 -0.187500 +vt 0.687500 0.500000 +vt -0.000000 1.000000 +vt 0.000000 0.875000 +vt 0.437500 0.500000 +vt -1.000000 0.625000 +vt 0.812500 0.187500 +vt 1.187500 0.187500 +vt 1.187500 0.312500 +vt 1.312500 0.312500 +vt 1.312500 0.687500 +vt 0.687500 0.187500 +vt 0.687500 0.312500 +vt 1.187500 0.812500 +vt 0.812500 0.812500 +vt 0.187500 0.312500 +vt 0.312500 0.687500 +vt 0.687500 0.687500 +vt -0.187500 0.187500 +vt 0.187500 0.187500 +vt -0.312500 0.687500 +vt -0.312500 0.312500 +vt 0.187500 0.812500 +vt -0.187500 0.812500 +vt 0.437500 0.687500 +vt 0.437500 0.187500 +vt 0.562500 0.812500 +vt 0.562500 0.687500 +vt 0.312500 0.562500 +vt 1.000000 0.875000 +vt 0.375000 0.062500 +vt -1.000000 0.375000 +vt 0.625000 0.500000 +vt 0.875000 0.562500 +vt 0.937500 0.812500 +vt 0.937500 0.687500 +vt 0.875000 0.937500 +vt 0.562500 0.312500 +vn -1.000000 0.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 -0.002100 -1.000000 +vn 0.001200 -1.000000 0.000000 +vn 0.000000 0.002800 -1.000000 +vn -0.001200 -1.000000 0.000200 +g boats_boat_boats_boat_None +usemtl None +s off +f 41/1/1 27/2/1 43/3/1 +f 76/4/2 74/5/2 72/6/2 +f 8/7/2 6/1/2 5/8/2 +f 15/9/1 13/10/1 16/11/1 +f 51/12/3 71/13/3 50/14/3 +f 56/15/2 32/16/2 53/17/2 +f 15/18/3 8/19/3 23/20/3 +f 22/21/2 40/22/2 39/23/2 +f 19/24/4 2/25/4 53/26/4 +f 70/27/5 62/28/5 69/29/5 +f 11/30/5 19/31/5 10/32/5 +f 4/15/5 20/33/5 17/34/5 +f 72/35/3 64/36/3 63/37/3 +f 13/8/5 7/38/5 16/7/5 +f 23/39/6 47/11/6 44/9/6 +f 68/40/7 70/41/7 69/42/7 +f 80/43/8 40/10/8 30/11/8 +f 3/15/1 1/32/1 4/30/1 +f 20/44/2 18/27/2 17/45/2 +f 74/17/5 65/46/5 64/47/5 +f 31/43/1 54/47/1 52/48/1 +f 22/47/5 14/43/5 15/48/5 +f 46/1/2 23/7/2 44/8/2 +f 57/21/1 38/22/1 58/49/1 +f 61/50/9 76/51/9 73/52/9 +f 37/45/5 2/23/5 3/21/5 +f 78/28/3 67/53/3 65/54/3 +f 64/5/1 66/4/1 63/6/1 +f 76/55/6 67/56/6 77/57/6 +f 47/17/2 26/10/2 45/11/2 +f 5/16/5 26/47/5 8/17/5 +f 33/58/6 48/59/6 55/60/6 +f 29/38/2 42/3/2 49/29/2 +f 32/44/6 52/21/6 53/45/6 +f 58/15/6 34/33/6 56/34/6 +f 27/7/6 46/29/6 43/8/6 +f 73/61/6 68/62/6 61/63/6 +f 21/58/6 42/29/6 28/38/6 +f 11/29/1 9/58/1 12/27/1 +f 59/45/1 36/2/1 60/3/1 +f 60/9/6 35/10/6 57/11/6 +f 41/1/1 21/64/1 27/2/1 +f 72/6/2 48/65/2 50/66/2 +f 50/66/2 71/67/2 70/68/2 +f 70/68/2 75/17/2 73/69/2 +f 76/4/2 77/70/2 74/5/2 +f 77/70/2 78/71/2 74/5/2 +f 50/66/2 70/68/2 73/69/2 +f 73/69/2 76/4/2 72/6/2 +f 72/6/2 50/66/2 73/69/2 +f 8/7/2 7/64/2 6/1/2 +f 15/9/1 14/39/1 13/10/1 +f 51/12/3 62/72/3 71/13/3 +f 56/15/2 34/73/2 32/16/2 +f 32/26/3 34/74/3 38/75/3 +f 35/76/3 36/77/3 37/78/3 +f 32/26/3 38/75/3 35/76/3 +f 29/66/3 33/79/3 31/80/3 +f 32/26/3 35/76/3 3/25/3 +f 28/51/3 29/66/3 31/80/3 +f 31/80/3 32/26/3 18/24/3 +f 3/25/3 4/81/3 17/82/3 +f 35/76/3 37/78/3 3/25/3 +f 21/83/3 28/51/3 22/84/3 +f 3/25/3 17/82/3 18/24/3 +f 11/85/3 12/55/3 30/52/3 +f 32/26/3 3/25/3 18/24/3 +f 11/85/3 30/52/3 22/84/3 +f 31/80/3 18/24/3 11/85/3 +f 24/86/3 27/87/3 21/83/3 +f 28/51/3 31/80/3 11/85/3 +f 11/85/3 22/84/3 28/51/3 +f 24/86/3 21/83/3 23/20/3 +f 26/88/3 25/89/3 23/20/3 +f 23/20/3 21/83/3 15/18/3 +f 15/18/3 16/90/3 7/91/3 +f 21/83/3 22/84/3 15/18/3 +f 8/19/3 26/88/3 23/20/3 +f 15/18/3 7/91/3 8/19/3 +f 22/21/2 30/49/2 40/22/2 +f 47/89/4 45/88/4 5/19/4 +f 5/19/4 6/91/4 13/90/4 +f 5/19/4 13/90/4 14/18/4 +f 44/20/4 47/89/4 5/19/4 +f 43/87/4 46/86/4 44/20/4 +f 41/83/4 43/87/4 44/20/4 +f 44/20/4 5/19/4 14/18/4 +f 39/84/4 40/52/4 80/50/4 +f 44/20/4 14/18/4 41/83/4 +f 42/51/4 41/83/4 39/84/4 +f 39/84/4 80/50/4 50/92/4 +f 41/83/4 14/18/4 39/84/4 +f 48/93/4 49/66/4 42/51/4 +f 50/92/4 48/93/4 42/51/4 +f 80/50/4 79/94/4 50/92/4 +f 50/92/4 42/51/4 39/84/4 +f 54/79/4 55/62/4 52/80/4 +f 50/92/4 79/94/4 51/95/4 +f 52/80/4 55/62/4 51/95/4 +f 51/95/4 79/94/4 10/85/4 +f 79/94/4 9/55/4 10/85/4 +f 53/26/4 52/80/4 10/85/4 +f 58/75/4 56/74/4 53/26/4 +f 59/78/4 60/77/4 57/76/4 +f 57/76/4 58/75/4 53/26/4 +f 52/80/4 51/95/4 10/85/4 +f 19/24/4 20/82/4 1/81/4 +f 53/26/4 10/85/4 19/24/4 +f 59/78/4 57/76/4 2/25/4 +f 19/24/4 1/81/4 2/25/4 +f 2/25/4 57/76/4 53/26/4 +f 70/27/5 71/96/5 62/28/5 +f 11/30/5 18/97/5 19/31/5 +f 4/15/5 1/73/5 20/33/5 +f 72/35/3 74/54/3 64/36/3 +f 13/8/5 6/29/5 7/38/5 +f 23/39/6 25/10/6 47/11/6 +f 68/40/7 75/98/7 70/41/7 +f 30/11/5 12/17/5 79/99/5 +f 79/99/10 80/43/10 30/11/10 +f 12/17/5 9/16/5 79/99/5 +f 3/15/1 2/73/1 1/32/1 +f 20/44/2 19/58/2 18/27/2 +f 74/17/5 78/100/5 65/46/5 +f 31/43/1 33/99/1 54/47/1 +f 22/47/5 39/99/5 14/43/5 +f 46/1/2 24/64/2 23/7/2 +f 57/21/1 35/23/1 38/22/1 +f 61/50/9 66/53/9 76/51/9 +f 37/45/5 59/44/5 2/23/5 +f 78/28/3 77/51/3 67/53/3 +f 62/67/1 51/66/1 69/68/1 +f 51/66/1 55/65/1 63/6/1 +f 68/17/1 69/68/1 61/69/1 +f 61/69/1 69/68/1 51/66/1 +f 61/69/1 51/66/1 63/6/1 +f 65/71/1 67/70/1 64/5/1 +f 61/69/1 63/6/1 66/4/1 +f 64/5/1 67/70/1 66/4/1 +f 76/55/6 66/85/6 67/56/6 +f 47/17/2 25/16/2 26/10/2 +f 5/16/5 45/99/5 26/47/5 +f 55/60/6 54/101/6 33/58/6 +f 33/58/6 29/22/6 48/59/6 +f 48/59/6 72/102/6 63/103/6 +f 29/22/6 49/104/6 48/59/6 +f 48/59/6 63/103/6 55/60/6 +f 29/38/2 28/2/2 42/3/2 +f 32/44/6 31/23/6 52/21/6 +f 58/15/6 38/73/6 34/33/6 +f 27/7/6 24/38/6 46/29/6 +f 73/61/6 75/105/6 68/62/6 +f 21/58/6 41/27/6 42/29/6 +f 11/29/1 10/38/1 9/58/1 +f 59/45/1 37/44/1 36/2/1 +f 60/9/6 36/39/6 35/10/6 diff --git a/mods/boats/textures/boats_inventory.png b/mods/boats/textures/boats_inventory.png new file mode 100644 index 0000000..f9d082e Binary files /dev/null and b/mods/boats/textures/boats_inventory.png differ diff --git a/mods/boats/textures/boats_wield.png b/mods/boats/textures/boats_wield.png new file mode 100644 index 0000000..f998b5b Binary files /dev/null and b/mods/boats/textures/boats_wield.png differ diff --git a/mods/bones/README.txt b/mods/bones/README.txt new file mode 100644 index 0000000..91bcd10 --- /dev/null +++ b/mods/bones/README.txt @@ -0,0 +1,12 @@ +Minetest Game mod: bones +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +All textures: paramat (CC BY-SA 3.0) diff --git a/mods/bones/depends.txt b/mods/bones/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/bones/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/bones/init.lua b/mods/bones/init.lua new file mode 100644 index 0000000..9583bc2 --- /dev/null +++ b/mods/bones/init.lua @@ -0,0 +1,249 @@ +-- Minetest 0.4 mod: bones +-- See README.txt for licensing and other information. + +local function is_owner(pos, name) + local owner = minetest.get_meta(pos):get_string("owner") + if owner == "" or owner == name or minetest.check_player_privs(name, "protection_bypass") then + return true + end + return false +end + +local bones_formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[current_name;main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[current_name;main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + +local share_bones_time = tonumber(minetest.settings:get("share_bones_time")) or 1200 +local share_bones_time_early = tonumber(minetest.settings:get("share_bones_time_early")) or share_bones_time / 4 + +minetest.register_node("bones:bones", { + description = "Bones", + tiles = { + "bones_top.png^[transform2", + "bones_bottom.png", + "bones_side.png", + "bones_side.png", + "bones_rear.png", + "bones_front.png" + }, + paramtype2 = "facedir", + groups = {dig_immediate = 2}, + sounds = default.node_sound_gravel_defaults(), + + can_dig = function(pos, player) + local inv = minetest.get_meta(pos):get_inventory() + local name = "" + if player then + name = player:get_player_name() + end + return is_owner(pos, name) and inv:is_empty("main") + end, + + allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + if is_owner(pos, player:get_player_name()) then + return count + end + return 0 + end, + + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + return 0 + end, + + allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if is_owner(pos, player:get_player_name()) then + return stack:get_count() + end + return 0 + end, + + on_metadata_inventory_take = function(pos, listname, index, stack, player) + local meta = minetest.get_meta(pos) + if meta:get_inventory():is_empty("main") then + minetest.remove_node(pos) + end + end, + + on_punch = function(pos, node, player) + if not is_owner(pos, player:get_player_name()) then + return + end + + if minetest.get_meta(pos):get_string("infotext") == "" then + return + end + + local inv = minetest.get_meta(pos):get_inventory() + local player_inv = player:get_inventory() + local has_space = true + + for i = 1, inv:get_size("main") do + local stk = inv:get_stack("main", i) + if player_inv:room_for_item("main", stk) then + inv:set_stack("main", i, nil) + player_inv:add_item("main", stk) + else + has_space = false + break + end + end + + -- remove bones if player emptied them + if has_space then + if player_inv:room_for_item("main", {name = "bones:bones"}) then + player_inv:add_item("main", {name = "bones:bones"}) + else + minetest.add_item(pos,"bones:bones") + end + minetest.remove_node(pos) + end + end, + + on_timer = function(pos, elapsed) + local meta = minetest.get_meta(pos) + local time = meta:get_int("time") + elapsed + if time >= share_bones_time then + meta:set_string("infotext", meta:get_string("owner") .. "'s old bones") + meta:set_string("owner", "") + else + meta:set_int("time", time) + return true + end + end, + on_blast = function(pos) + end, +}) + +local function may_replace(pos, player) + local node_name = minetest.get_node(pos).name + local node_definition = minetest.registered_nodes[node_name] + + -- if the node is unknown, we return false + if not node_definition then + return false + end + + -- allow replacing air and liquids + if node_name == "air" or node_definition.liquidtype ~= "none" then + return true + end + + -- don't replace filled chests and other nodes that don't allow it + local can_dig_func = node_definition.can_dig + if can_dig_func and not can_dig_func(pos, player) then + return false + end + + -- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones? + -- flowers being squished by bones are more realistical than a squished stone, too + -- exception are of course any protected buildable_to + return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name()) +end + +local drop = function(pos, itemstack) + local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count())) + if obj then + obj:setvelocity({ + x = math.random(-10, 10) / 9, + y = 5, + z = math.random(-10, 10) / 9, + }) + end +end + +minetest.register_on_dieplayer(function(player) + + local bones_mode = minetest.settings:get("bones_mode") or "bones" + if bones_mode ~= "bones" and bones_mode ~= "drop" and bones_mode ~= "keep" then + bones_mode = "bones" + end + + -- return if keep inventory set or in creative mode + if bones_mode == "keep" or (creative and creative.is_enabled_for + and creative.is_enabled_for(player:get_player_name())) then + return + end + + local player_inv = player:get_inventory() + if player_inv:is_empty("main") and + player_inv:is_empty("craft") then + return + end + + local pos = vector.round(player:getpos()) + local player_name = player:get_player_name() + + -- check if it's possible to place bones, if not find space near player + if bones_mode == "bones" and not may_replace(pos, player) then + local air = minetest.find_node_near(pos, 1, {"air"}) + if air and not minetest.is_protected(air, player_name) then + pos = air + else + bones_mode = "drop" + end + end + + if bones_mode == "drop" then + + -- drop inventory items + for i = 1, player_inv:get_size("main") do + drop(pos, player_inv:get_stack("main", i)) + end + player_inv:set_list("main", {}) + + -- drop crafting grid items + for i = 1, player_inv:get_size("craft") do + drop(pos, player_inv:get_stack("craft", i)) + end + player_inv:set_list("craft", {}) + + drop(pos, ItemStack("bones:bones")) + return + end + + local param2 = minetest.dir_to_facedir(player:get_look_dir()) + minetest.set_node(pos, {name = "bones:bones", param2 = param2}) + + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size("main", 8 * 4) + inv:set_list("main", player_inv:get_list("main")) + + for i = 1, player_inv:get_size("craft") do + local stack = player_inv:get_stack("craft", i) + if inv:room_for_item("main", stack) then + inv:add_item("main", stack) + else + --drop if no space left + drop(pos, stack) + end + end + + player_inv:set_list("main", {}) + player_inv:set_list("craft", {}) + + meta:set_string("formspec", bones_formspec) + meta:set_string("owner", player_name) + + if share_bones_time ~= 0 then + meta:set_string("infotext", player_name .. "'s fresh bones") + + if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then + meta:set_int("time", 0) + else + meta:set_int("time", (share_bones_time - share_bones_time_early)) + end + + minetest.get_node_timer(pos):start(10) + else + meta:set_string("infotext", player_name.."'s bones") + end +end) diff --git a/mods/bones/license.txt b/mods/bones/license.txt new file mode 100644 index 0000000..fe52584 --- /dev/null +++ b/mods/bones/license.txt @@ -0,0 +1,58 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + diff --git a/mods/bones/textures/bones_bottom.png b/mods/bones/textures/bones_bottom.png new file mode 100644 index 0000000..859c6bb Binary files /dev/null and b/mods/bones/textures/bones_bottom.png differ diff --git a/mods/bones/textures/bones_front.png b/mods/bones/textures/bones_front.png new file mode 100644 index 0000000..1e52437 Binary files /dev/null and b/mods/bones/textures/bones_front.png differ diff --git a/mods/bones/textures/bones_rear.png b/mods/bones/textures/bones_rear.png new file mode 100644 index 0000000..4cfe236 Binary files /dev/null and b/mods/bones/textures/bones_rear.png differ diff --git a/mods/bones/textures/bones_side.png b/mods/bones/textures/bones_side.png new file mode 100644 index 0000000..a07595f Binary files /dev/null and b/mods/bones/textures/bones_side.png differ diff --git a/mods/bones/textures/bones_top.png b/mods/bones/textures/bones_top.png new file mode 100644 index 0000000..198a8a2 Binary files /dev/null and b/mods/bones/textures/bones_top.png differ diff --git a/mods/bucket/README.txt b/mods/bucket/README.txt new file mode 100644 index 0000000..45e0ec5 --- /dev/null +++ b/mods/bucket/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: bucket +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Kahrl (LGPL 2.1) +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures) +--------------------------- +ElementW (CC BY-SA 3.0) diff --git a/mods/bucket/depends.txt b/mods/bucket/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/bucket/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/bucket/init.lua b/mods/bucket/init.lua new file mode 100644 index 0000000..5076dec --- /dev/null +++ b/mods/bucket/init.lua @@ -0,0 +1,215 @@ +-- Minetest 0.4 mod: bucket +-- See README.txt for licensing and other information. + +minetest.register_alias("bucket", "bucket:bucket_empty") +minetest.register_alias("bucket_water", "bucket:bucket_water") +minetest.register_alias("bucket_lava", "bucket:bucket_lava") + +minetest.register_craft({ + output = 'bucket:bucket_empty 1', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'', 'default:steel_ingot', ''}, + } +}) + +bucket = {} +bucket.liquids = {} + +local function check_protection(pos, name, text) + if minetest.is_protected(pos, name) then + minetest.log("action", (name ~= "" and name or "A mod") + .. " tried to " .. text + .. " at protected position " + .. minetest.pos_to_string(pos) + .. " with a bucket") + minetest.record_protection_violation(pos, name) + return true + end + return false +end + +-- Register a new liquid +-- source = name of the source node +-- flowing = name of the flowing node +-- itemname = name of the new bucket item (or nil if liquid is not takeable) +-- inventory_image = texture of the new bucket item (ignored if itemname == nil) +-- name = text description of the bucket item +-- groups = (optional) groups of the bucket item, for example {water_bucket = 1} +-- force_renew = (optional) bool. Force the liquid source to renew if it has a +-- source neighbour, even if defined as 'liquid_renewable = false'. +-- Needed to avoid creating holes in sloping rivers. +-- This function can be called from any mod (that depends on bucket). +function bucket.register_liquid(source, flowing, itemname, inventory_image, name, + groups, force_renew) + bucket.liquids[source] = { + source = source, + flowing = flowing, + itemname = itemname, + force_renew = force_renew, + } + bucket.liquids[flowing] = bucket.liquids[source] + + if itemname ~= nil then + minetest.register_craftitem(itemname, { + description = name, + inventory_image = inventory_image, + stack_max = 1, + liquids_pointable = true, + groups = groups, + + on_place = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + + local node = minetest.get_node_or_nil(pointed_thing.under) + local ndef = node and minetest.registered_nodes[node.name] + + -- Call on_rightclick if the pointed node defines it + if ndef and ndef.on_rightclick and + user and not user:get_player_control().sneak then + return ndef.on_rightclick( + pointed_thing.under, + node, user, + itemstack) + end + + local lpos + + -- Check if pointing to a buildable node + if ndef and ndef.buildable_to then + -- buildable; replace the node + lpos = pointed_thing.under + else + -- not buildable to; place the liquid above + -- check if the node above can be replaced + + lpos = pointed_thing.above + node = minetest.get_node_or_nil(lpos) + local above_ndef = node and minetest.registered_nodes[node.name] + + if not above_ndef or not above_ndef.buildable_to then + -- do not remove the bucket with the liquid + return itemstack + end + end + + if check_protection(lpos, user + and user:get_player_name() + or "", "place "..source) then + return + end + + minetest.set_node(lpos, {name = source}) + return ItemStack("bucket:bucket_empty") + end + }) + end +end + +minetest.register_craftitem("bucket:bucket_empty", { + description = "Empty Bucket", + inventory_image = "bucket.png", + stack_max = 99, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type == "object" then + pointed_thing.ref:punch(user, 1.0, { full_punch_interval=1.0 }, nil) + return user:get_wielded_item() + elseif pointed_thing.type ~= "node" then + -- do nothing if it's neither object nor node + return + end + -- Check if pointing to a liquid source + local node = minetest.get_node(pointed_thing.under) + local liquiddef = bucket.liquids[node.name] + local item_count = user:get_wielded_item():get_count() + + if liquiddef ~= nil + and liquiddef.itemname ~= nil + and node.name == liquiddef.source then + if check_protection(pointed_thing.under, + user:get_player_name(), + "take ".. node.name) then + return + end + + -- default set to return filled bucket + local giving_back = liquiddef.itemname + + -- check if holding more than 1 empty bucket + if item_count > 1 then + + -- if space in inventory add filled bucked, otherwise drop as item + local inv = user:get_inventory() + if inv:room_for_item("main", {name=liquiddef.itemname}) then + inv:add_item("main", liquiddef.itemname) + else + local pos = user:getpos() + pos.y = math.floor(pos.y + 0.5) + minetest.add_item(pos, liquiddef.itemname) + end + + -- set to return empty buckets minus 1 + giving_back = "bucket:bucket_empty "..tostring(item_count-1) + + end + + -- force_renew requires a source neighbour + local source_neighbor = false + if liquiddef.force_renew then + source_neighbor = + minetest.find_node_near(pointed_thing.under, 1, liquiddef.source) + end + if not (source_neighbor and liquiddef.force_renew) then + minetest.add_node(pointed_thing.under, {name = "air"}) + end + + return ItemStack(giving_back) + else + -- non-liquid nodes will have their on_punch triggered + local node_def = minetest.registered_nodes[node.name] + if node_def then + node_def.on_punch(pointed_thing.under, node, user, pointed_thing) + end + return user:get_wielded_item() + end + end, +}) + +bucket.register_liquid( + "default:water_source", + "default:water_flowing", + "bucket:bucket_water", + "bucket_water.png", + "Water Bucket", + {water_bucket = 1} +) + +bucket.register_liquid( + "default:river_water_source", + "default:river_water_flowing", + "bucket:bucket_river_water", + "bucket_river_water.png", + "River Water Bucket", + {water_bucket = 1}, + true +) + +bucket.register_liquid( + "default:lava_source", + "default:lava_flowing", + "bucket:bucket_lava", + "bucket_lava.png", + "Lava Bucket" +) + +minetest.register_craft({ + type = "fuel", + recipe = "bucket:bucket_lava", + burntime = 60, + replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}}, +}) + diff --git a/mods/bucket/license.txt b/mods/bucket/license.txt new file mode 100644 index 0000000..a5156ae --- /dev/null +++ b/mods/bucket/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2015-2016 ElementW + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/bucket/textures/bucket.png b/mods/bucket/textures/bucket.png new file mode 100644 index 0000000..17b0c49 Binary files /dev/null and b/mods/bucket/textures/bucket.png differ diff --git a/mods/bucket/textures/bucket_lava.png b/mods/bucket/textures/bucket_lava.png new file mode 100644 index 0000000..ac6108d Binary files /dev/null and b/mods/bucket/textures/bucket_lava.png differ diff --git a/mods/bucket/textures/bucket_river_water.png b/mods/bucket/textures/bucket_river_water.png new file mode 100644 index 0000000..d4648bb Binary files /dev/null and b/mods/bucket/textures/bucket_river_water.png differ diff --git a/mods/bucket/textures/bucket_water.png b/mods/bucket/textures/bucket_water.png new file mode 100644 index 0000000..5af836b Binary files /dev/null and b/mods/bucket/textures/bucket_water.png differ diff --git a/mods/carts/README.txt b/mods/carts/README.txt new file mode 100644 index 0000000..31ce644 --- /dev/null +++ b/mods/carts/README.txt @@ -0,0 +1,22 @@ +Carts (formerly boost_cart) +========================== + +Carts, based almost entirely on the mod boost_cart [1], which +itself is based on (and fully compatible with) the carts mod [2]. + +The model was originally designed by stujones11 [3] (CC-0). + +Cart textures are based on original work from PixelBOX (WTFPL). + + +[1] https://github.com/SmallJoker/boost_cart/ +[2] https://github.com/PilzAdam/carts/ +[3] https://github.com/stujones11/railcart/ + + +Features +---------- +- A fast cart for your railway or roller coaster (up to 7 m/s!) +- Boost and brake rails +- Rail junction switching with the 'right-left' walking keys +- Handbrake with the 'back' key diff --git a/mods/carts/cart_entity.lua b/mods/carts/cart_entity.lua new file mode 100644 index 0000000..a19da64 --- /dev/null +++ b/mods/carts/cart_entity.lua @@ -0,0 +1,403 @@ +local cart_entity = { + physical = false, -- otherwise going uphill breaks + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + visual = "mesh", + mesh = "carts_cart.b3d", + visual_size = {x=1, y=1}, + textures = {"carts_cart.png"}, + + driver = nil, + punched = false, -- used to re-send velocity and position + velocity = {x=0, y=0, z=0}, -- only used on punch + old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch + old_pos = nil, + old_switch = 0, + railtype = nil, + attached_items = {} +} + +function cart_entity:on_rightclick(clicker) + if not clicker or not clicker:is_player() then + return + end + local player_name = clicker:get_player_name() + if self.driver and player_name == self.driver then + self.driver = nil + carts:manage_attachment(clicker, nil) + elseif not self.driver then + self.driver = player_name + carts:manage_attachment(clicker, self.object) + end +end + +function cart_entity:on_activate(staticdata, dtime_s) + self.object:set_armor_groups({immortal=1}) + if string.sub(staticdata, 1, string.len("return")) ~= "return" then + return + end + local data = minetest.deserialize(staticdata) + if not data or type(data) ~= "table" then + return + end + self.railtype = data.railtype + if data.old_dir then + self.old_dir = data.old_dir + end + if data.old_vel then + self.old_vel = data.old_vel + end +end + +function cart_entity:get_staticdata() + return minetest.serialize({ + railtype = self.railtype, + old_dir = self.old_dir, + old_vel = self.old_vel + }) +end + +function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction) + local pos = self.object:getpos() + if not self.railtype then + local node = minetest.get_node(pos).name + self.railtype = minetest.get_item_group(node, "connect_to_raillike") + end + -- Punched by non-player + if not puncher or not puncher:is_player() then + local cart_dir = carts:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype) + if vector.equals(cart_dir, {x=0, y=0, z=0}) then + return + end + self.velocity = vector.multiply(cart_dir, 2) + self.punched = true + return + end + -- Player digs cart by sneak-punch + if puncher:get_player_control().sneak then + if self.sound_handle then + minetest.sound_stop(self.sound_handle) + end + -- Detach driver and items + if self.driver then + if self.old_pos then + self.object:setpos(self.old_pos) + end + local player = minetest.get_player_by_name(self.driver) + carts:manage_attachment(player, nil) + end + for _,obj_ in ipairs(self.attached_items) do + if obj_ then + obj_:set_detach() + end + end + -- Pick up cart + local inv = puncher:get_inventory() + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(puncher:get_player_name())) + or not inv:contains_item("main", "carts:cart") then + local leftover = inv:add_item("main", "carts:cart") + -- If no room in inventory add a replacement cart to the world + if not leftover:is_empty() then + minetest.add_item(self.object:getpos(), leftover) + end + end + self.object:remove() + return + end + -- Player punches cart to alter velocity + local vel = self.object:getvelocity() + if puncher:get_player_name() == self.driver then + if math.abs(vel.x + vel.z) > carts.punch_speed_max then + return + end + end + + local punch_dir = carts:velocity_to_dir(puncher:get_look_dir()) + punch_dir.y = 0 + local cart_dir = carts:get_rail_direction(pos, punch_dir, nil, nil, self.railtype) + if vector.equals(cart_dir, {x=0, y=0, z=0}) then + return + end + + local punch_interval = 1 + if tool_capabilities and tool_capabilities.full_punch_interval then + punch_interval = tool_capabilities.full_punch_interval + end + time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval) + local f = 2 * (time_from_last_punch / punch_interval) + + self.velocity = vector.multiply(cart_dir, f) + self.old_dir = cart_dir + self.punched = true +end + +local function rail_on_step_event(handler, obj, dtime) + if handler then + handler(obj, dtime) + end +end + +-- sound refresh interval = 1.0sec +local function rail_sound(self, dtime) + if not self.sound_ttl then + self.sound_ttl = 1.0 + return + elseif self.sound_ttl > 0 then + self.sound_ttl = self.sound_ttl - dtime + return + end + self.sound_ttl = 1.0 + if self.sound_handle then + local handle = self.sound_handle + self.sound_handle = nil + minetest.after(0.2, minetest.sound_stop, handle) + end + local vel = self.object:getvelocity() + local speed = vector.length(vel) + if speed > 0 then + self.sound_handle = minetest.sound_play( + "carts_cart_moving", { + object = self.object, + gain = (speed / carts.speed_max) / 2, + loop = true, + }) + end +end + +local function get_railparams(pos) + local node = minetest.get_node(pos) + return carts.railparams[node.name] or {} +end + +local function rail_on_step(self, dtime) + local vel = self.object:getvelocity() + if self.punched then + vel = vector.add(vel, self.velocity) + self.object:setvelocity(vel) + self.old_dir.y = 0 + elseif vector.equals(vel, {x=0, y=0, z=0}) then + return + end + + local pos = self.object:getpos() + local update = {} + + -- stop cart if velocity vector flips + if self.old_vel and self.old_vel.y == 0 and + (self.old_vel.x * vel.x < 0 or self.old_vel.z * vel.z < 0) then + self.old_vel = {x = 0, y = 0, z = 0} + self.old_pos = pos + self.object:setvelocity(vector.new()) + self.object:setacceleration(vector.new()) + rail_on_step_event(get_railparams(pos).on_step, self, dtime) + return + end + self.old_vel = vector.new(vel) + + if self.old_pos and not self.punched then + local flo_pos = vector.round(pos) + local flo_old = vector.round(self.old_pos) + if vector.equals(flo_pos, flo_old) then + -- Do not check one node multiple times + return + end + end + + local ctrl, player + + -- Get player controls + if self.driver then + player = minetest.get_player_by_name(self.driver) + if player then + ctrl = player:get_player_control() + end + end + + if self.old_pos then + -- Detection for "skipping" nodes + local found_path = carts:pathfinder( + pos, self.old_pos, self.old_dir, ctrl, self.old_switch, self.railtype + ) + + if not found_path then + -- No rail found: reset back to the expected position + pos = vector.new(self.old_pos) + update.pos = true + end + end + + local cart_dir = carts:velocity_to_dir(vel) + local railparams + + -- dir: New moving direction of the cart + -- switch_keys: Currently pressed L/R key, used to ignore the key on the next rail node + local dir, switch_keys = carts:get_rail_direction( + pos, cart_dir, ctrl, self.old_switch, self.railtype + ) + + local new_acc = {x=0, y=0, z=0} + if vector.equals(dir, {x=0, y=0, z=0}) then + vel = {x = 0, y = 0, z = 0} + pos = vector.round(pos) + update.pos = true + update.vel = true + else + -- Direction change detected + if not vector.equals(dir, self.old_dir) then + vel = vector.multiply(dir, math.abs(vel.x + vel.z)) + update.vel = true + if dir.y ~= self.old_dir.y then + pos = vector.round(pos) + update.pos = true + end + end + -- Center on the rail + if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then + pos.x = math.floor(pos.x + 0.5) + update.pos = true + end + if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then + pos.z = math.floor(pos.z + 0.5) + update.pos = true + end + + -- Slow down or speed up.. + local acc = dir.y * -4.0 + + -- Get rail for corrected position + railparams = get_railparams(pos) + + -- no need to check for railparams == nil since we always make it exist. + local speed_mod = railparams.acceleration + if speed_mod and speed_mod ~= 0 then + -- Try to make it similar to the original carts mod + acc = acc + speed_mod + else + -- Handbrake or coast + if ctrl and ctrl.down then + acc = acc - 3 + else + acc = acc - 0.4 + end + end + + new_acc = vector.multiply(dir, acc) + end + + -- Limits + local max_vel = carts.speed_max + for _, v in pairs({"x","y","z"}) do + if math.abs(vel[v]) > max_vel then + vel[v] = carts:get_sign(vel[v]) * max_vel + new_acc[v] = 0 + update.vel = true + end + end + + self.object:setacceleration(new_acc) + self.old_pos = vector.new(pos) + if not vector.equals(dir, {x=0, y=0, z=0}) then + self.old_dir = vector.new(dir) + end + self.old_switch = switch_keys + + if self.punched then + -- Collect dropped items + for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do + if not obj_:is_player() and + obj_:get_luaentity() and + not obj_:get_luaentity().physical_state and + obj_:get_luaentity().name == "__builtin:item" then + + obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0}) + self.attached_items[#self.attached_items + 1] = obj_ + end + end + self.punched = false + update.vel = true + end + + railparams = railparams or get_railparams(pos) + + if not (update.vel or update.pos) then + rail_on_step_event(railparams.on_step, self, dtime) + return + end + + local yaw = 0 + if self.old_dir.x < 0 then + yaw = 0.5 + elseif self.old_dir.x > 0 then + yaw = 1.5 + elseif self.old_dir.z < 0 then + yaw = 1 + end + self.object:setyaw(yaw * math.pi) + + local anim = {x=0, y=0} + if dir.y == -1 then + anim = {x=1, y=1} + elseif dir.y == 1 then + anim = {x=2, y=2} + end + self.object:set_animation(anim, 1, 0) + + self.object:setvelocity(vel) + if update.pos then + self.object:setpos(pos) + end + + -- call event handler + rail_on_step_event(railparams.on_step, self, dtime) +end + +function cart_entity:on_step(dtime) + rail_on_step(self, dtime) + rail_sound(self, dtime) +end + +minetest.register_entity("carts:cart", cart_entity) + +minetest.register_craftitem("carts:cart", { + description = "Cart (Sneak+Click to pick up)", + inventory_image = minetest.inventorycube("carts_cart_top.png", "carts_cart_side.png", "carts_cart_side.png"), + wield_image = "carts_cart_side.png", + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + if not pointed_thing.type == "node" then + return + end + if carts:is_rail(pointed_thing.under) then + minetest.add_entity(pointed_thing.under, "carts:cart") + elseif carts:is_rail(pointed_thing.above) then + minetest.add_entity(pointed_thing.above, "carts:cart") + else + return + end + + minetest.sound_play({name = "default_place_node_metal", gain = 0.5}, + {pos = pointed_thing.above}) + + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then + itemstack:take_item() + end + return itemstack + end, +}) + +minetest.register_craft({ + output = "carts:cart", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + }, +}) diff --git a/mods/carts/depends.txt b/mods/carts/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/carts/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/carts/functions.lua b/mods/carts/functions.lua new file mode 100644 index 0000000..a471719 --- /dev/null +++ b/mods/carts/functions.lua @@ -0,0 +1,221 @@ +function carts:get_sign(z) + if z == 0 then + return 0 + else + return z / math.abs(z) + end +end + +function carts:manage_attachment(player, obj) + if not player then + return + end + local status = obj ~= nil + local player_name = player:get_player_name() + if default.player_attached[player_name] == status then + return + end + default.player_attached[player_name] = status + + if status then + player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0}) + player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0}) + else + player:set_detach() + player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0}) + end +end + +function carts:velocity_to_dir(v) + if math.abs(v.x) > math.abs(v.z) then + return {x=carts:get_sign(v.x), y=carts:get_sign(v.y), z=0} + else + return {x=0, y=carts:get_sign(v.y), z=carts:get_sign(v.z)} + end +end + +function carts:is_rail(pos, railtype) + local node = minetest.get_node(pos).name + if node == "ignore" then + local vm = minetest.get_voxel_manip() + local emin, emax = vm:read_from_map(pos, pos) + local area = VoxelArea:new{ + MinEdge = emin, + MaxEdge = emax, + } + local data = vm:get_data() + local vi = area:indexp(pos) + node = minetest.get_name_from_content_id(data[vi]) + end + if minetest.get_item_group(node, "rail") == 0 then + return false + end + if not railtype then + return true + end + return minetest.get_item_group(node, "connect_to_raillike") == railtype +end + +function carts:check_front_up_down(pos, dir_, check_up, railtype) + local dir = vector.new(dir_) + local cur + + -- Front + dir.y = 0 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + -- Up + if check_up then + dir.y = 1 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + end + -- Down + dir.y = -1 + cur = vector.add(pos, dir) + if carts:is_rail(cur, railtype) then + return dir + end + return nil +end + +function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype) + local pos = vector.round(pos_) + local cur + local left_check, right_check = true, true + + -- Check left and right + local left = {x=0, y=0, z=0} + local right = {x=0, y=0, z=0} + if dir.z ~= 0 and dir.x == 0 then + left.x = -dir.z + right.x = dir.z + elseif dir.x ~= 0 and dir.z == 0 then + left.z = dir.x + right.z = -dir.x + end + + if ctrl then + if old_switch == 1 then + left_check = false + elseif old_switch == 2 then + right_check = false + end + if ctrl.left and left_check then + cur = carts:check_front_up_down(pos, left, false, railtype) + if cur then + return cur, 1 + end + left_check = false + end + if ctrl.right and right_check then + cur = carts:check_front_up_down(pos, right, false, railtype) + if cur then + return cur, 2 + end + right_check = true + end + end + + -- Normal + cur = carts:check_front_up_down(pos, dir, true, railtype) + if cur then + return cur + end + + -- Left, if not already checked + if left_check then + cur = carts:check_front_up_down(pos, left, false, railtype) + if cur then + return cur + end + end + + -- Right, if not already checked + if right_check then + cur = carts:check_front_up_down(pos, right, false, railtype) + if cur then + return cur + end + end + + -- Backwards + if not old_switch then + cur = carts:check_front_up_down(pos, { + x = -dir.x, + y = dir.y, + z = -dir.z + }, true, railtype) + if cur then + return cur + end + end + + return {x=0, y=0, z=0} +end + +function carts:pathfinder(pos_, old_pos, old_dir, ctrl, pf_switch, railtype) + local pos = vector.round(pos_) + local pf_pos = vector.round(old_pos) + local pf_dir = vector.new(old_dir) + + for i = 1, 3 do + if vector.equals(pf_pos, pos) then + -- Success! Cart moved on correctly + return true + end + + pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype) + if vector.equals(pf_dir, {x=0, y=0, z=0}) then + -- No way forwards + return false + end + + pf_pos = vector.add(pf_pos, pf_dir) + end + -- Cart not found + return false +end + +function carts:register_rail(name, def_overwrite, railparams) + local def = { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + sounds = default.node_sound_metal_defaults() + } + for k, v in pairs(def_overwrite) do + def[k] = v + end + if not def.inventory_image then + def.wield_image = def.tiles[1] + def.inventory_image = def.tiles[1] + end + + if railparams then + carts.railparams[name] = table.copy(railparams) + end + + minetest.register_node(name, def) +end + +function carts:get_rail_groups(additional_groups) + -- Get the default rail groups and add more when a table is given + local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1} + if type(additional_groups) == "table" then + for k, v in pairs(additional_groups) do + groups[k] = v + end + end + return groups +end diff --git a/mods/carts/init.lua b/mods/carts/init.lua new file mode 100644 index 0000000..53b33cc --- /dev/null +++ b/mods/carts/init.lua @@ -0,0 +1,20 @@ + +carts = {} +carts.modpath = minetest.get_modpath("carts") +carts.railparams = {} + +-- Maximal speed of the cart in m/s (min = -1) +carts.speed_max = 7 +-- Set to -1 to disable punching the cart from inside (min = -1) +carts.punch_speed_max = 5 + + +dofile(carts.modpath.."/functions.lua") +dofile(carts.modpath.."/rails.lua") + +-- Support for non-default games +if not default.player_attached then + default.player_attached = {} +end + +dofile(carts.modpath.."/cart_entity.lua") diff --git a/mods/carts/license.txt b/mods/carts/license.txt new file mode 100644 index 0000000..6c5beb4 --- /dev/null +++ b/mods/carts/license.txt @@ -0,0 +1,54 @@ + +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 SmallJoker +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media +----------------- + +CC-0, see: https://creativecommons.org/share-your-work/public-domain/cc0/, except +if other license is mentioned. + + +Authors +--------- +Originally from PixelBOX (Gambit): + carts_cart_side.png + carts_cart_top.png + carts_cart_front.png* + carts_cart.png* + +sofar + stujones11: + carts_cart.b3d and carts_cart.blend + +hexafraction, modified by sofar + carts_rail_*.png + +http://www.freesound.org/people/YleArkisto/sounds/253159/ - YleArkisto - CC-BY-3.0 + carts_cart_moving.*.ogg diff --git a/mods/carts/models/carts_cart.b3d b/mods/carts/models/carts_cart.b3d new file mode 100644 index 0000000..4e7eba3 Binary files /dev/null and b/mods/carts/models/carts_cart.b3d differ diff --git a/mods/carts/models/carts_cart.blend b/mods/carts/models/carts_cart.blend new file mode 100644 index 0000000..7d2515e Binary files /dev/null and b/mods/carts/models/carts_cart.blend differ diff --git a/mods/carts/rails.lua b/mods/carts/rails.lua new file mode 100644 index 0000000..066779d --- /dev/null +++ b/mods/carts/rails.lua @@ -0,0 +1,59 @@ +carts:register_rail("carts:rail", { + description = "Rail", + tiles = { + "carts_rail_straight.png", "carts_rail_curved.png", + "carts_rail_t_junction.png", "carts_rail_crossing.png" + }, + inventory_image = "carts_rail_straight.png", + wield_image = "carts_rail_straight.png", + groups = carts:get_rail_groups(), +}, {}) + +minetest.register_craft({ + output = "carts:rail 18", + recipe = { + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + } +}) + +minetest.register_alias("default:rail", "carts:rail") + + +carts:register_rail("carts:powerrail", { + description = "Powered rail", + tiles = { + "carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png", + "carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png" + }, + groups = carts:get_rail_groups(), +}, {acceleration = 5}) + +minetest.register_craft({ + output = "carts:powerrail 18", + recipe = { + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + {"default:steel_ingot", "default:mese_crystal", "default:steel_ingot"}, + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + } +}) + + +carts:register_rail("carts:brakerail", { + description = "Brake rail", + tiles = { + "carts_rail_straight_brk.png", "carts_rail_curved_brk.png", + "carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png" + }, + groups = carts:get_rail_groups(), +}, {acceleration = -3}) + +minetest.register_craft({ + output = "carts:brakerail 18", + recipe = { + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + {"default:steel_ingot", "default:coal_lump", "default:steel_ingot"}, + {"default:steel_ingot", "group:wood", "default:steel_ingot"}, + } +}) diff --git a/mods/carts/sounds/carts_cart_moving.1.ogg b/mods/carts/sounds/carts_cart_moving.1.ogg new file mode 100644 index 0000000..869e765 Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.1.ogg differ diff --git a/mods/carts/sounds/carts_cart_moving.2.ogg b/mods/carts/sounds/carts_cart_moving.2.ogg new file mode 100644 index 0000000..b4cc508 Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.2.ogg differ diff --git a/mods/carts/sounds/carts_cart_moving.3.ogg b/mods/carts/sounds/carts_cart_moving.3.ogg new file mode 100644 index 0000000..e19a782 Binary files /dev/null and b/mods/carts/sounds/carts_cart_moving.3.ogg differ diff --git a/mods/carts/textures/carts_cart.png b/mods/carts/textures/carts_cart.png new file mode 100644 index 0000000..965347c Binary files /dev/null and b/mods/carts/textures/carts_cart.png differ diff --git a/mods/carts/textures/carts_cart_front.png b/mods/carts/textures/carts_cart_front.png new file mode 100644 index 0000000..38955b2 Binary files /dev/null and b/mods/carts/textures/carts_cart_front.png differ diff --git a/mods/carts/textures/carts_cart_side.png b/mods/carts/textures/carts_cart_side.png new file mode 100644 index 0000000..f53808c Binary files /dev/null and b/mods/carts/textures/carts_cart_side.png differ diff --git a/mods/carts/textures/carts_cart_top.png b/mods/carts/textures/carts_cart_top.png new file mode 100644 index 0000000..d9a31a9 Binary files /dev/null and b/mods/carts/textures/carts_cart_top.png differ diff --git a/mods/carts/textures/carts_rail_crossing.png b/mods/carts/textures/carts_rail_crossing.png new file mode 100644 index 0000000..e10f3b1 Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing.png differ diff --git a/mods/carts/textures/carts_rail_crossing_brk.png b/mods/carts/textures/carts_rail_crossing_brk.png new file mode 100644 index 0000000..0bf455e Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing_brk.png differ diff --git a/mods/carts/textures/carts_rail_crossing_pwr.png b/mods/carts/textures/carts_rail_crossing_pwr.png new file mode 100644 index 0000000..d763d50 Binary files /dev/null and b/mods/carts/textures/carts_rail_crossing_pwr.png differ diff --git a/mods/carts/textures/carts_rail_curved.png b/mods/carts/textures/carts_rail_curved.png new file mode 100644 index 0000000..b320f0d Binary files /dev/null and b/mods/carts/textures/carts_rail_curved.png differ diff --git a/mods/carts/textures/carts_rail_curved_brk.png b/mods/carts/textures/carts_rail_curved_brk.png new file mode 100644 index 0000000..ca40723 Binary files /dev/null and b/mods/carts/textures/carts_rail_curved_brk.png differ diff --git a/mods/carts/textures/carts_rail_curved_pwr.png b/mods/carts/textures/carts_rail_curved_pwr.png new file mode 100644 index 0000000..781bbd0 Binary files /dev/null and b/mods/carts/textures/carts_rail_curved_pwr.png differ diff --git a/mods/carts/textures/carts_rail_straight.png b/mods/carts/textures/carts_rail_straight.png new file mode 100644 index 0000000..30dcafe Binary files /dev/null and b/mods/carts/textures/carts_rail_straight.png differ diff --git a/mods/carts/textures/carts_rail_straight_brk.png b/mods/carts/textures/carts_rail_straight_brk.png new file mode 100644 index 0000000..0c69052 Binary files /dev/null and b/mods/carts/textures/carts_rail_straight_brk.png differ diff --git a/mods/carts/textures/carts_rail_straight_pwr.png b/mods/carts/textures/carts_rail_straight_pwr.png new file mode 100644 index 0000000..e067ff1 Binary files /dev/null and b/mods/carts/textures/carts_rail_straight_pwr.png differ diff --git a/mods/carts/textures/carts_rail_t_junction.png b/mods/carts/textures/carts_rail_t_junction.png new file mode 100644 index 0000000..8b1b946 Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction.png differ diff --git a/mods/carts/textures/carts_rail_t_junction_brk.png b/mods/carts/textures/carts_rail_t_junction_brk.png new file mode 100644 index 0000000..6b4f6fa Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction_brk.png differ diff --git a/mods/carts/textures/carts_rail_t_junction_pwr.png b/mods/carts/textures/carts_rail_t_junction_pwr.png new file mode 100644 index 0000000..dd0eede Binary files /dev/null and b/mods/carts/textures/carts_rail_t_junction_pwr.png differ diff --git a/mods/castrum/Chapter1.lua b/mods/castrum/Chapter1.lua new file mode 100644 index 0000000..402a3cd --- /dev/null +++ b/mods/castrum/Chapter1.lua @@ -0,0 +1,171 @@ +local list = { + {1, {x=-173, y=9, z=-70},{x=-172, y=9, z=-70},1}, + {2, {x=-173, y=9, z=-62},{x=-172, y=9, z=-62},1}, + {3, {x=-171, y=9, z=-69},{x=-170, y=9, z=-69},1}, + {4, {x=-171, y=9, z=-63},{x=-170, y=9, z=-63},1}, + {5, {x=-170, y=9, z=-67},{x=-169, y=9, z=-67},1}, + {6, {x=-170, y=9, z=-65},{x=-169, y=9, z=-65},1}, + {7, {x=-172, y=9, z=-70},{x=-171, y=9, z=-70},1}, + {8, {x=-172, y=9, z=-62},{x=-171, y=9, z=-62},1}, + {9, {x=-170, y=9, z=-69},{x=-169, y=9, z=-69},1}, + {10, {x=-170, y=9, z=-63},{x=-169, y=9, z=-63},1}, + {11, {x=-169, y=9, z=-67},{x=-168, y=9, z=-67},1}, + {12, {x=-169, y=9, z=-65},{x=-168, y=9, z=-65},1}, + {13, {x=-171, y=9, z=-70},{x=-170, y=9, z=-70},1}, + {14, {x=-171, y=9, z=-62},{x=-170, y=9, z=-62},1}, + {15, {x=-169, y=9, z=-69},{x=-168, y=9, z=-69},1}, + {16, {x=-169, y=9, z=-63},{x=-168, y=9, z=-63},1}, + {17, {x=-168, y=9, z=-67},{x=-167, y=9, z=-67},1}, + {18, {x=-168, y=9, z=-65},{x=-167, y=9, z=-65},1}, + {19, {x=-170, y=9, z=-70},{x=-169, y=9, z=-70},1}, + {20, {x=-170, y=9, z=-62},{x=-169, y=9, z=-62},1}, + {21, {x=-168, y=9, z=-69},{x=-167, y=9, z=-69},1}, + {22, {x=-168, y=9, z=-63},{x=-167, y=9, z=-63},1}, + {23, {x=-167, y=9, z=-67},{x=-166, y=9, z=-67},1}, + {24, {x=-167, y=9, z=-65},{x=-166, y=9, z=-65},1}, + {25, {x=-169, y=9, z=-70},{x=-168, y=9, z=-70},1}, + {26, {x=-169, y=9, z=-62},{x=-168, y=9, z=-62},1}, + {27, {x=-167, y=9, z=-69},{x=-166, y=9, z=-69},1}, + {28, {x=-167, y=9, z=-63},{x=-166, y=9, z=-63},1}, + {29, {x=-166, y=9, z=-67},{x=-165, y=9, z=-67},1}, + {30, {x=-166, y=9, z=-65},{x=-165, y=9, z=-65},1}, + {31, {x=-168, y=9, z=-70},{x=-167, y=9, z=-71},1}, + {32, {x=-168, y=9, z=-62},{x=-167, y=9, z=-61},1}, + {33, {x=-165, y=9, z=-67},{x=-164, y=9, z=-67},1}, + {34, {x=-165, y=9, z=-65},{x=-164, y=9, z=-65},1}, + {35, {x=-166, y=9, z=-69},{x=-165, y=9, z=-69},1}, + {36, {x=-166, y=9, z=-63},{x=-165, y=9, z=-63},1}, + {37, {x=-167, y=9, z=-71},{x=-166, y=9, z=-71},1}, + {38, {x=-167, y=9, z=-61},{x=-166, y=9, z=-61},1}, + {39, {x=-166, y=9, z=-71},{x=-165, y=9, z=-72},1}, + {40, {x=-166, y=9, z=-61},{x=-165, y=9, z=-60},1}, + {41, {x=-165, y=9, z=-69},{x=-164, y=9, z=-70},1}, + {42, {x=-165, y=9, z=-63},{x=-164, y=9, z=-62},1}, + {43, {x=-164, y=9, z=-67},{x=-163, y=9, z=-68},1}, + {44, {x=-164, y=9, z=-65},{x=-163, y=9, z=-64},1}, + {45, {x=-165, y=9, z=-72},{x=-164, y=9, z=-72},1}, + {46, {x=-165, y=9, z=-60},{x=-164, y=9, z=-60},1}, + {47, {x=-164, y=9, z=-70},{x=-163, y=9, z=-70},1}, + {48, {x=-164, y=9, z=-62},{x=-163, y=9, z=-62},1}, + {49, {x=-163, y=9, z=-68},{x=-162, y=9, z=-67},1}, + {50, {x=-163, y=9, z=-64},{x=-162, y=9, z=-65},1}, + {51, {x=-164, y=9, z=-72},{x=-163, y=9, z=-73},1}, + {52, {x=-164, y=9, z=-60},{x=-163, y=9, z=-59},1}, + {53, {x=-163, y=9, z=-70},{x=-162, y=9, z=-71},1}, + {54, {x=-163, y=9, z=-62},{x=-162, y=9, z=-61},1}, + {55, {x=-162, y=9, z=-67},{x=-161, y=9, z=-68},1}, + {56, {x=-162, y=9, z=-65},{x=-161, y=9, z=-64},1}, + {57, {x=-163, y=9, z=-73},{x=-162, y=9, z=-73},1}, + {58, {x=-163, y=9, z=-59},{x=-162, y=9, z=-59},1}, + {59, {x=-162, y=9, z=-71},{x=-161, y=9, z=-71},1}, + {60, {x=-162, y=9, z=-61},{x=-161, y=9, z=-61},1}, + {61, {x=-161, y=9, z=-68},{x=-160, y=9, z=-67},1}, + {62, {x=-161, y=9, z=-64},{x=-160, y=9, z=-65},1}, + {63, {x=-162, y=9, z=-73},{x=-161, y=9, z=-74},1}, + {64, {x=-162, y=9, z=-59},{x=-161, y=9, z=-58},1}, + {65, {x=-161, y=9, z=-71},{x=-160, y=9, z=-71},1}, + {66, {x=-161, y=9, z=-61},{x=-160, y=9, z=-61},1}, + {67, {x=-160, y=9, z=-67},{x=-159, y=9, z=-68},1}, + {68, {x=-160, y=9, z=-65},{x=-159, y=9, z=-64},1}, + {69, {x=-161, y=9, z=-74},{x=-160, y=9, z=-74},1}, + {70, {x=-161, y=9, z=-58},{x=-160, y=9, z=-58},1}, + {71, {x=-160, y=9, z=-74},{x=-159, y=9, z=-74},1}, + {72, {x=-160, y=9, z=-58},{x=-159, y=9, z=-58},1}, + {73, {x=-160, y=9, z=-71},{x=-159, y=9, z=-71},1}, + {74, {x=-160, y=9, z=-61},{x=-159, y=9, z=-61},1}, + {75, {x=-159, y=9, z=-68},{x=-158, y=9, z=-67},1}, + {76, {x=-159, y=9, z=-64},{x=-158, y=9, z=-65},1}, + {77, {x=-159, y=9, z=-74},{x=-158, y=9, z=-74},1}, + {78, {x=-159, y=9, z=-58},{x=-158, y=9, z=-58},1}, + {79, {x=-159, y=9, z=-71},{x=-158, y=9, z=-71},1}, + {80, {x=-159, y=9, z=-61},{x=-158, y=9, z=-61},1}, + {81, {x=-158, y=9, z=-67},{x=-157, y=9, z=-68},1}, + {82, {x=-158, y=9, z=-65},{x=-157, y=9, z=-64},1}, + {83, {x=-158, y=9, z=-74},{x=-157, y=9, z=-74},1}, + {84, {x=-158, y=9, z=-58},{x=-157, y=9, z=-58},1}, + {85, {x=-157, y=9, z=-74},{x=-156, y=9, z=-74},1}, + {86, {x=-157, y=9, z=-58},{x=-156, y=9, z=-58},1}, + {87, {x=-158, y=9, z=-71},{x=-157, y=9, z=-71},1}, + {88, {x=-158, y=9, z=-61},{x=-157, y=9, z=-61},1}, + {89, {x=-157, y=9, z=-68},{x=-156, y=9, z=-67},1}, + {90, {x=-157, y=9, z=-64},{x=-156, y=9, z=-65},1}, + {91, {x=-156, y=9, z=-74},{x=-155, y=9, z=-74},1}, + {92, {x=-156, y=9, z=-58},{x=-155, y=9, z=-58},1}, + {93, {x=-157, y=9, z=-71},{x=-156, y=9, z=-71},1}, + {94, {x=-157, y=9, z=-61},{x=-156, y=9, z=-61},1}, + {95, {x=-155, y=9, z=-74},{x=-154, y=9, z=-74},1}, + {96, {x=-155, y=9, z=-58},{x=-154, y=9, z=-58},1}, + {97, {x=-156, y=9, z=-71},{x=-155, y=9, z=-71},1}, + {98, {x=-156, y=9, z=-61},{x=-155, y=9, z=-61},1}, + {99, {x=-156, y=9, z=-67},{x=-155, y=9, z=-68},1}, + {100, {x=-156, y=9, z=-65},{x=-155, y=9, z=-64},1}, + {101, {x=-154, y=9, z=-74},{x=-153, y=9, z=-74},1}, + {102, {x=-154, y=9, z=-58},{x=-153, y=9, z=-58},1}, + {103, {x=-155, y=9, z=-71},{x=-154, y=9, z=-71},1}, + {104, {x=-155, y=9, z=-61},{x=-154, y=9, z=-61},1}, + {105, {x=-155, y=9, z=-68},{x=-154, y=9, z=-67},1}, + {106, {x=-155, y=9, z=-64},{x=-154, y=9, z=-65},1}, + {107, {x=-153, y=9, z=-74},{x=-152, y=9, z=-74},1}, + {108, {x=-153, y=9, z=-58},{x=-152, y=9, z=-58},1}, + {109, {x=-154, y=9, z=-71},{x=-153, y=9, z=-71},1}, + {110, {x=-154, y=9, z=-61},{x=-153, y=9, z=-61},1}, + {111, {x=-152, y=9, z=-74},{x=-151, y=9, z=-74},1}, + {112, {x=-152, y=9, z=-58},{x=-151, y=9, z=-58},1}, + {113, {x=-153, y=9, z=-71},{x=-152, y=9, z=-71},1}, + {114, {x=-153, y=9, z=-61},{x=-152, y=9, z=-61},1}, + {115, {x=-154, y=9, z=-67},{x=-153, y=9, z=-68},1}, + {116, {x=-154, y=9, z=-65},{x=-153, y=9, z=-64},1}, + {117, {x=-151, y=9, z=-74},{x=-150, y=9, z=-73},1}, + {118, {x=-151, y=9, z=-58},{x=-150, y=9, z=-59},1}, + {119, {x=-152, y=9, z=-71},{x=-151, y=9, z=-70},1}, + {120, {x=-152, y=9, z=-61},{x=-151, y=9, z=-62},1}, + {121, {x=-153, y=9, z=-68},{x=-152, y=9, z=-67},1}, + {122, {x=-153, y=9, z=-64},{x=-152, y=9, z=-65},1}, + {123, {x=-150, y=9, z=-73},{x=-149, y=9, z=-73},1}, + {124, {x=-150, y=9, z=-59},{x=-149, y=9, z=-59},1}, + {125, {x=-151, y=9, z=-70},{x=-150, y=9, z=-69},1}, + {126, {x=-151, y=9, z=-62},{x=-150, y=9, z=-63},1}, + {127, {x=-152, y=9, z=-67},{x=-151, y=9, z=-67},1}, + {128, {x=-152, y=9, z=-65},{x=-151, y=9, z=-65},1}, + {129, {x=-149, y=9, z=-73},{x=-148, y=9, z=-72},1}, + {130, {x=-149, y=9, z=-59},{x=-148, y=9, z=-60},1}, + {131, {x=-150, y=9, z=-69},{x=-149, y=9, z=-69},1}, + {132, {x=-150, y=9, z=-63},{x=-149, y=9, z=-63},1}, + {133, {x=-151, y=9, z=-67},{x=-150, y=9, z=-67},1}, + {134, {x=-151, y=9, z=-65},{x=-150, y=9, z=-65},1}, + {135, {x=-148, y=9, z=-72},{x=-147, y=9, z=-71},1}, + {136, {x=-148, y=9, z=-60},{x=-147, y=9, z=-61},1}, + {137, {x=-149, y=9, z=-69},{x=-148, y=9, z=-69},1}, + {138, {x=-149, y=9, z=-63},{x=-148, y=9, z=-63},1}, + {139, {x=-150, y=9, z=-67},{x=-149, y=9, z=-67},1}, + {140, {x=-150, y=9, z=-65},{x=-149, y=9, z=-65},1}, + {141, {x=-147, y=9, z=-71},{x=-146, y=9, z=-70},1}, + {142, {x=-147, y=9, z=-61},{x=-146, y=9, z=-62},1}, + {143, {x=-148, y=9, z=-69},{x=-147, y=9, z=-69},1}, + {144, {x=-148, y=9, z=-63},{x=-147, y=9, z=-63},1}, + {145, {x=-149, y=9, z=-67},{x=-148, y=9, z=-67},1}, + {146, {x=-149, y=9, z=-65},{x=-148, y=9, z=-65},1}, + {147, {x=-146, y=9, z=-70},{x=-145, y=9, z=-69},1}, + {148, {x=-146, y=9, z=-62},{x=-145, y=9, z=-63},1}, + {149, {x=-147, y=9, z=-69},{x=-146, y=9, z=-68},1}, + {150, {x=-147, y=9, z=-63},{x=-146, y=9, z=-64},1}, + {151, {x=-148, y=9, z=-67},{x=-147, y=9, z=-67},1}, + {152, {x=-148, y=9, z=-65},{x=-147, y=9, z=-65},1}, + {153, {x=-145, y=9, z=-69},{x=-144, y=9, z=-69},1}, + {154, {x=-145, y=9, z=-63},{x=-144, y=9, z=-63},1}, + {155, {x=-146, y=9, z=-68},{x=-145, y=9, z=-68},1}, + {156, {x=-146, y=9, z=-64},{x=-145, y=9, z=-64},1}, + {157, {x=-147, y=9, z=-67},{x=-146, y=9, z=-67},1}, + {158, {x=-147, y=9, z=-65},{x=-146, y=9, z=-65},1}, + {159, {x=-146, y=9, z=-67},{x=-145, y=9, z=-67},1}, + {160, {x=-146, y=9, z=-65},{x=-145, y=9, z=-65},1}, + {161, {x=-145, y=9, z=-68},{x=-144, y=9, z=-67},1}, + {162, {x=-145, y=9, z=-64},{x=-144, y=9, z=-65},1}, + {163, {x=-144, y=9, z=-69},{x=-144, y=9, z=-68},1}, + {164, {x=-144, y=9, z=-63},{x=-144, y=9, z=-64},1}, + {165, {x=-144, y=9, z=-68},{x=-144, y=9, z=-67},1}, + {166, {x=-144, y=9, z=-64},{x=-144, y=9, z=-65},1}, +} +function Chapter1() + return list +end \ No newline at end of file diff --git a/mods/castrum/Chapter2.lua b/mods/castrum/Chapter2.lua new file mode 100644 index 0000000..5cab673 --- /dev/null +++ b/mods/castrum/Chapter2.lua @@ -0,0 +1,304 @@ +local list = { + {1, {x=-173, y=9, z=-70},{x=-172, y=9, z=-70},1}, + {2, {x=-173, y=9, z=-62},{x=-172, y=9, z=-62},1}, + {3, {x=-171, y=9, z=-69},{x=-170, y=9, z=-69},1}, + {4, {x=-171, y=9, z=-63},{x=-170, y=9, z=-63},1}, + {5, {x=-170, y=9, z=-67},{x=-169, y=9, z=-67},1}, + {6, {x=-170, y=9, z=-65},{x=-169, y=9, z=-65},1}, + {7, {x=-172, y=9, z=-70},{x=-171, y=9, z=-71},1}, + {8, {x=-172, y=9, z=-62},{x=-171, y=9, z=-61},1}, + {9, {x=-171, y=9, z=-71},{x=-170, y=9, z=-71},1}, + {10, {x=-171, y=9, z=-61},{x=-170, y=9, z=-61},1}, + {11, {x=-170, y=9, z=-70},{x=-169, y=9, z=-70},1}, + {12, {x=-170, y=9, z=-62},{x=-169, y=9, z=-62},1}, + {13, {x=-170, y=9, z=-69},{x=-169, y=9, z=-69},1}, + {14, {x=-170, y=9, z=-63},{x=-169, y=9, z=-63},1}, + {15, {x=-169, y=9, z=-68},{x=-168, y=9, z=-68},1}, + {16, {x=-169, y=9, z=-64},{x=-168, y=9, z=-64},1}, + {17, {x=-169, y=9, z=-67},{x=-168, y=9, z=-67},1}, + {18, {x=-169, y=9, z=-65},{x=-168, y=9, z=-65},1}, + {19, {x=-168, y=9, z=-66},{x=-167, y=9, z=-66},1}, + {20, {x=-170, y=9, z=-71},{x=-169, y=9, z=-71},1}, + {21, {x=-170, y=9, z=-61},{x=-169, y=9, z=-61},1}, + {22, {x=-169, y=9, z=-70},{x=-168, y=9, z=-70},1}, + {23, {x=-169, y=9, z=-62},{x=-168, y=9, z=-62},1}, + {24, {x=-169, y=9, z=-69},{x=-168, y=9, z=-69},1}, + {25, {x=-169, y=9, z=-63},{x=-168, y=9, z=-63},1}, + {26, {x=-168, y=9, z=-68},{x=-167, y=9, z=-68},1}, + {27, {x=-168, y=9, z=-64},{x=-167, y=9, z=-64},1}, + {28, {x=-168, y=9, z=-67},{x=-167, y=9, z=-67},1}, + {29, {x=-168, y=9, z=-65},{x=-167, y=9, z=-65},1}, + {30, {x=-167, y=9, z=-66},{x=-166, y=9, z=-66},1}, + {31, {x=-169, y=9, z=-71},{x=-168, y=9, z=-71},1}, + {32, {x=-169, y=9, z=-61},{x=-168, y=9, z=-61},1}, + {33, {x=-168, y=9, z=-70},{x=-167, y=9, z=-70},1}, + {34, {x=-168, y=9, z=-62},{x=-167, y=9, z=-62},1}, + {35, {x=-168, y=9, z=-69},{x=-167, y=9, z=-69},1}, + {36, {x=-168, y=9, z=-63},{x=-167, y=9, z=-63},1}, + {37, {x=-167, y=9, z=-68},{x=-166, y=9, z=-68},1}, + {38, {x=-167, y=9, z=-64},{x=-166, y=9, z=-64},1}, + {39, {x=-167, y=9, z=-67},{x=-166, y=9, z=-67},1}, + {40, {x=-167, y=9, z=-65},{x=-166, y=9, z=-65},1}, + {41, {x=-166, y=9, z=-66},{x=-165, y=9, z=-66},1}, + {42, {x=-168, y=9, z=-71},{x=-167, y=9, z=-72},1}, + {43, {x=-168, y=9, z=-61},{x=-167, y=9, z=-60},1}, + {44, {x=-167, y=9, z=-70},{x=-166, y=9, z=-70},1}, + {45, {x=-167, y=9, z=-62},{x=-166, y=9, z=-62},1}, + {46, {x=-167, y=9, z=-69},{x=-166, y=9, z=-69},1}, + {47, {x=-167, y=9, z=-63},{x=-166, y=9, z=-63},1}, + {48, {x=-166, y=9, z=-68},{x=-165, y=9, z=-68},1}, + {49, {x=-166, y=9, z=-64},{x=-165, y=9, z=-64},1}, + {50, {x=-166, y=9, z=-67},{x=-165, y=9, z=-67},1}, + {51, {x=-166, y=9, z=-65},{x=-165, y=9, z=-65},1}, + {52, {x=-165, y=9, z=-66},{x=-164, y=9, z=-66},1}, + {53, {x=-167, y=9, z=-72},{x=-166, y=9, z=-73},1}, + {54, {x=-167, y=9, z=-60},{x=-166, y=9, z=-59},1}, + {55, {x=-166, y=9, z=-70},{x=-165, y=9, z=-71},1}, + {56, {x=-166, y=9, z=-62},{x=-165, y=9, z=-61},1}, + {57, {x=-166, y=9, z=-69},{x=-165, y=9, z=-69},1}, + {58, {x=-166, y=9, z=-63},{x=-165, y=9, z=-63},1}, + {59, {x=-165, y=9, z=-68},{x=-164, y=9, z=-68},1}, + {60, {x=-165, y=9, z=-64},{x=-164, y=9, z=-64},1}, + {61, {x=-165, y=9, z=-67},{x=-164, y=9, z=-67},1}, + {62, {x=-165, y=9, z=-65},{x=-164, y=9, z=-65},1}, + {63, {x=-164, y=9, z=-66},{x=-163, y=9, z=-66},1}, + {64, {x=-166, y=9, z=-73},{x=-165, y=9, z=-73},1}, + {65, {x=-166, y=9, z=-59},{x=-165, y=9, z=-59},1}, + {66, {x=-165, y=9, z=-71},{x=-164, y=9, z=-71},1}, + {67, {x=-165, y=9, z=-61},{x=-164, y=9, z=-61},1}, + {68, {x=-165, y=9, z=-69},{x=-164, y=9, z=-69},1}, + {69, {x=-165, y=9, z=-63},{x=-164, y=9, z=-63},1}, + {70, {x=-164, y=9, z=-68},{x=-163, y=9, z=-68},1}, + {71, {x=-164, y=9, z=-64},{x=-163, y=9, z=-64},1}, + {72, {x=-164, y=9, z=-67},{x=-163, y=9, z=-67},1}, + {73, {x=-164, y=9, z=-65},{x=-163, y=9, z=-65},1}, + {74, {x=-163, y=9, z=-66},{x=-162, y=9, z=-66},1}, + {75, {x=-165, y=9, z=-73},{x=-164, y=9, z=-74},1}, + {76, {x=-165, y=9, z=-59},{x=-164, y=9, z=-58},1}, + {77, {x=-164, y=9, z=-71},{x=-163, y=9, z=-72},1}, + {78, {x=-164, y=9, z=-61},{x=-163, y=9, z=-60},1}, + {79, {x=-164, y=9, z=-69},{x=-163, y=9, z=-69},1}, + {80, {x=-164, y=9, z=-63},{x=-163, y=9, z=-63},1}, + {81, {x=-163, y=9, z=-68},{x=-162, y=9, z=-68},1}, + {82, {x=-163, y=9, z=-64},{x=-162, y=9, z=-64},1}, + {83, {x=-163, y=9, z=-67},{x=-162, y=9, z=-67},1}, + {84, {x=-163, y=9, z=-65},{x=-162, y=9, z=-65},1}, + {85, {x=-162, y=9, z=-66},{x=-161, y=9, z=-66},1}, + {86, {x=-164, y=9, z=-74},{x=-163, y=9, z=-74},1}, + {87, {x=-164, y=9, z=-58},{x=-163, y=9, z=-58},1}, + {88, {x=-163, y=9, z=-72},{x=-162, y=9, z=-72},1}, + {89, {x=-163, y=9, z=-60},{x=-162, y=9, z=-60},1}, + {90, {x=-163, y=9, z=-69},{x=-162, y=9, z=-70},1}, + {91, {x=-163, y=9, z=-63},{x=-162, y=9, z=-62},1}, + {92, {x=-162, y=9, z=-68},{x=-161, y=9, z=-68},1}, + {93, {x=-162, y=9, z=-64},{x=-161, y=9, z=-64},1}, + {94, {x=-162, y=9, z=-67},{x=-161, y=9, z=-67},1}, + {95, {x=-162, y=9, z=-65},{x=-161, y=9, z=-65},1}, + {96, {x=-161, y=9, z=-66},{x=-160, y=9, z=-66},1}, + {97, {x=-163, y=9, z=-74},{x=-162, y=9, z=-75},1}, + {98, {x=-163, y=9, z=-58},{x=-162, y=9, z=-57},1}, + {99, {x=-162, y=9, z=-72},{x=-161, y=9, z=-73},1}, + {100, {x=-162, y=9, z=-60},{x=-161, y=9, z=-59},1}, + {101, {x=-162, y=9, z=-70},{x=-161, y=9, z=-70},1}, + {102, {x=-162, y=9, z=-62},{x=-161, y=9, z=-62},1}, + {103, {x=-161, y=9, z=-68},{x=-160, y=9, z=-68},1}, + {104, {x=-161, y=9, z=-64},{x=-160, y=9, z=-64},1}, + {105, {x=-161, y=9, z=-67},{x=-160, y=9, z=-67},1}, + {106, {x=-161, y=9, z=-65},{x=-160, y=9, z=-65},1}, + {107, {x=-160, y=9, z=-66},{x=-159, y=9, z=-66},1}, + {108, {x=-162, y=9, z=-75},{x=-161, y=9, z=-75},1}, + {109, {x=-162, y=9, z=-57},{x=-161, y=9, z=-57},1}, + {110, {x=-161, y=9, z=-73},{x=-160, y=9, z=-73},1}, + {111, {x=-161, y=9, z=-59},{x=-160, y=9, z=-59},1}, + {112, {x=-161, y=9, z=-70},{x=-160, y=9, z=-71},1}, + {113, {x=-161, y=9, z=-62},{x=-160, y=9, z=-61},1}, + {114, {x=-160, y=9, z=-68},{x=-159, y=9, z=-69},1}, + {115, {x=-160, y=9, z=-64},{x=-159, y=9, z=-63},1}, + {116, {x=-160, y=9, z=-67},{x=-159, y=9, z=-67},1}, + {117, {x=-160, y=9, z=-65},{x=-159, y=9, z=-65},1}, + {118, {x=-159, y=9, z=-66},{x=-158, y=9, z=-66},1}, + {119, {x=-161, y=9, z=-75},{x=-160, y=9, z=-76},1}, + {120, {x=-161, y=9, z=-57},{x=-160, y=9, z=-56},1}, + {121, {x=-160, y=9, z=-73},{x=-159, y=9, z=-74},1}, + {122, {x=-160, y=9, z=-59},{x=-159, y=9, z=-58},1}, + {123, {x=-160, y=9, z=-71},{x=-159, y=9, z=-71},1}, + {124, {x=-160, y=9, z=-61},{x=-159, y=9, z=-61},1}, + {125, {x=-159, y=9, z=-69},{x=-158, y=9, z=-69},1}, + {126, {x=-159, y=9, z=-63},{x=-158, y=9, z=-63},1}, + {127, {x=-159, y=9, z=-67},{x=-158, y=9, z=-67},1}, + {128, {x=-159, y=9, z=-65},{x=-158, y=9, z=-65},1}, + {129, {x=-160, y=9, z=-76},{x=-159, y=9, z=-76},1}, + {130, {x=-160, y=9, z=-56},{x=-159, y=9, z=-56},1}, + {131, {x=-159, y=9, z=-74},{x=-158, y=9, z=-74},1}, + {132, {x=-159, y=9, z=-58},{x=-158, y=9, z=-58},1}, + {133, {x=-159, y=9, z=-71},{x=-158, y=9, z=-71},1}, + {134, {x=-159, y=9, z=-61},{x=-158, y=9, z=-61},1}, + {135, {x=-159, y=9, z=-76},{x=-158, y=9, z=-76},1}, + {136, {x=-159, y=9, z=-56},{x=-158, y=9, z=-56},1}, + {137, {x=-158, y=9, z=-76},{x=-157, y=9, z=-75},1}, + {138, {x=-158, y=9, z=-56},{x=-157, y=9, z=-57},1}, + {139, {x=-157, y=9, z=-75},{x=-156, y=9, z=-75},1}, + {140, {x=-157, y=9, z=-57},{x=-156, y=9, z=-57},1}, + {141, {x=-158, y=9, z=-74},{x=-157, y=9, z=-73},1}, + {142, {x=-158, y=9, z=-58},{x=-157, y=9, z=-59},1}, + {143, {x=-158, y=9, z=-71},{x=-157, y=9, z=-71},1}, + {144, {x=-158, y=9, z=-61},{x=-157, y=9, z=-61},1}, + {145, {x=-156, y=9, z=-75},{x=-155, y=9, z=-75},1}, + {146, {x=-156, y=9, z=-57},{x=-155, y=9, z=-57},1}, + {147, {x=-157, y=9, z=-73},{x=-156, y=9, z=-73},1}, + {148, {x=-157, y=9, z=-59},{x=-156, y=9, z=-59},1}, + {149, {x=-157, y=9, z=-71},{x=-156, y=9, z=-70},1}, + {150, {x=-157, y=9, z=-61},{x=-156, y=9, z=-62},1}, + {151, {x=-158, y=9, z=-69},{x=-157, y=9, z=-69},1}, + {152, {x=-158, y=9, z=-63},{x=-157, y=9, z=-63},1}, + {153, {x=-158, y=9, z=-67},{x=-157, y=9, z=-67},1}, + {154, {x=-158, y=9, z=-65},{x=-157, y=9, z=-65},1}, + {155, {x=-155, y=9, z=-75},{x=-154, y=9, z=-74},1}, + {156, {x=-155, y=9, z=-57},{x=-154, y=9, z=-58},1}, + {157, {x=-156, y=9, z=-73},{x=-155, y=9, z=-72},1}, + {158, {x=-156, y=9, z=-59},{x=-155, y=9, z=-60},1}, + {159, {x=-156, y=9, z=-70},{x=-155, y=9, z=-70},1}, + {160, {x=-156, y=9, z=-62},{x=-155, y=9, z=-62},1}, + {161, {x=-157, y=9, z=-69},{x=-156, y=9, z=-68},1}, + {162, {x=-157, y=9, z=-63},{x=-156, y=9, z=-64},1}, + {163, {x=-157, y=9, z=-67},{x=-156, y=9, z=-67},1}, + {164, {x=-157, y=9, z=-65},{x=-156, y=9, z=-65},1}, + {165, {x=-158, y=9, z=-66},{x=-157, y=9, z=-66},1}, + {166, {x=-154, y=9, z=-74},{x=-153, y=9, z=-74},1}, + {167, {x=-154, y=9, z=-58},{x=-153, y=9, z=-58},1}, + {168, {x=-155, y=9, z=-72},{x=-154, y=9, z=-72},1}, + {169, {x=-155, y=9, z=-60},{x=-154, y=9, z=-60},1}, + {170, {x=-155, y=9, z=-70},{x=-154, y=9, z=-70},1}, + {171, {x=-155, y=9, z=-62},{x=-154, y=9, z=-62},1}, + {172, {x=-156, y=9, z=-68},{x=-155, y=9, z=-68},1}, + {173, {x=-156, y=9, z=-64},{x=-155, y=9, z=-64},1}, + {174, {x=-156, y=9, z=-67},{x=-155, y=9, z=-67},1}, + {175, {x=-156, y=9, z=-65},{x=-155, y=9, z=-65},1}, + {176, {x=-157, y=9, z=-66},{x=-156, y=9, z=-66},1}, + {177, {x=-153, y=9, z=-74},{x=-152, y=9, z=-74},1}, + {178, {x=-153, y=9, z=-58},{x=-152, y=9, z=-58},1}, + {179, {x=-154, y=9, z=-72},{x=-153, y=9, z=-72},1}, + {180, {x=-154, y=9, z=-60},{x=-153, y=9, z=-60},1}, + {181, {x=-154, y=9, z=-70},{x=-153, y=9, z=-69},1}, + {182, {x=-154, y=9, z=-62},{x=-153, y=9, z=-63},1}, + {183, {x=-155, y=9, z=-68},{x=-154, y=9, z=-68},1}, + {184, {x=-155, y=9, z=-64},{x=-154, y=9, z=-64},1}, + {185, {x=-155, y=9, z=-67},{x=-154, y=9, z=-67},1}, + {186, {x=-155, y=9, z=-65},{x=-154, y=9, z=-65},1}, + {187, {x=-156, y=9, z=-66},{x=-155, y=9, z=-66},1}, + {188, {x=-152, y=9, z=-74},{x=-151, y=9, z=-73},1}, + {189, {x=-152, y=9, z=-58},{x=-151, y=9, z=-59},1}, + {190, {x=-153, y=9, z=-72},{x=-152, y=9, z=-71},1}, + {191, {x=-153, y=9, z=-60},{x=-152, y=9, z=-61},1}, + {192, {x=-153, y=9, z=-69},{x=-152, y=9, z=-69},1}, + {193, {x=-153, y=9, z=-63},{x=-152, y=9, z=-63},1}, + {194, {x=-154, y=9, z=-68},{x=-153, y=9, z=-68},1}, + {195, {x=-154, y=9, z=-64},{x=-153, y=9, z=-64},1}, + {196, {x=-154, y=9, z=-67},{x=-153, y=9, z=-67},1}, + {197, {x=-154, y=9, z=-65},{x=-153, y=9, z=-65},1}, + {198, {x=-155, y=9, z=-66},{x=-154, y=9, z=-66},1}, + {199, {x=-151, y=9, z=-73},{x=-150, y=9, z=-73},1}, + {200, {x=-151, y=9, z=-59},{x=-150, y=9, z=-59},1}, + {201, {x=-152, y=9, z=-71},{x=-151, y=9, z=-71},1}, + {202, {x=-152, y=9, z=-61},{x=-151, y=9, z=-61},1}, + {203, {x=-152, y=9, z=-69},{x=-151, y=9, z=-69},1}, + {204, {x=-152, y=9, z=-63},{x=-151, y=9, z=-63},1}, + {205, {x=-153, y=9, z=-68},{x=-152, y=9, z=-68},1}, + {206, {x=-153, y=9, z=-64},{x=-152, y=9, z=-64},1}, + {207, {x=-153, y=9, z=-67},{x=-152, y=9, z=-67},1}, + {208, {x=-153, y=9, z=-65},{x=-152, y=9, z=-65},1}, + {209, {x=-154, y=9, z=-66},{x=-153, y=9, z=-66},1}, + {210, {x=-150, y=9, z=-73},{x=-149, y=9, z=-73},1}, + {211, {x=-150, y=9, z=-59},{x=-149, y=9, z=-59},1}, + {212, {x=-151, y=9, z=-71},{x=-150, y=9, z=-71},1}, + {213, {x=-151, y=9, z=-61},{x=-150, y=9, z=-61},1}, + {214, {x=-151, y=9, z=-69},{x=-150, y=9, z=-69},1}, + {215, {x=-151, y=9, z=-63},{x=-150, y=9, z=-63},1}, + {216, {x=-152, y=9, z=-68},{x=-151, y=9, z=-68},1}, + {217, {x=-152, y=9, z=-64},{x=-151, y=9, z=-64},1}, + {218, {x=-152, y=9, z=-67},{x=-151, y=9, z=-67},1}, + {219, {x=-152, y=9, z=-65},{x=-151, y=9, z=-65},1}, + {220, {x=-153, y=9, z=-66},{x=-152, y=9, z=-66},1}, + {221, {x=-149, y=9, z=-73},{x=-148, y=9, z=-72},1}, + {222, {x=-149, y=9, z=-59},{x=-148, y=9, z=-60},1}, + {223, {x=-150, y=9, z=-71},{x=-149, y=9, z=-70},1}, + {224, {x=-150, y=9, z=-61},{x=-149, y=9, z=-62},1}, + {225, {x=-150, y=9, z=-69},{x=-149, y=9, z=-69},1}, + {226, {x=-150, y=9, z=-63},{x=-149, y=9, z=-63},1}, + {227, {x=-151, y=9, z=-68},{x=-150, y=9, z=-68},1}, + {228, {x=-151, y=9, z=-64},{x=-150, y=9, z=-64},1}, + {229, {x=-151, y=9, z=-67},{x=-150, y=9, z=-67},1}, + {230, {x=-151, y=9, z=-65},{x=-150, y=9, z=-65},1}, + {231, {x=-152, y=9, z=-66},{x=-151, y=9, z=-66},1}, + {232, {x=-148, y=9, z=-72},{x=-147, y=9, z=-72},1}, + {233, {x=-148, y=9, z=-60},{x=-147, y=9, z=-60},1}, + {234, {x=-149, y=9, z=-70},{x=-148, y=9, z=-70},1}, + {235, {x=-149, y=9, z=-62},{x=-148, y=9, z=-62},1}, + {236, {x=-149, y=9, z=-69},{x=-148, y=9, z=-69},1}, + {237, {x=-149, y=9, z=-63},{x=-148, y=9, z=-63},1}, + {238, {x=-150, y=9, z=-68},{x=-149, y=9, z=-68},1}, + {239, {x=-150, y=9, z=-64},{x=-149, y=9, z=-64},1}, + {240, {x=-150, y=9, z=-67},{x=-149, y=9, z=-67},1}, + {241, {x=-150, y=9, z=-65},{x=-149, y=9, z=-65},1}, + {242, {x=-151, y=9, z=-66},{x=-150, y=9, z=-66},1}, + {243, {x=-147, y=9, z=-72},{x=-146, y=9, z=-72},1}, + {244, {x=-147, y=9, z=-60},{x=-146, y=9, z=-60},1}, + {245, {x=-148, y=9, z=-70},{x=-147, y=9, z=-70},1}, + {246, {x=-148, y=9, z=-62},{x=-147, y=9, z=-62},1}, + {247, {x=-148, y=9, z=-69},{x=-147, y=9, z=-69},1}, + {248, {x=-148, y=9, z=-63},{x=-147, y=9, z=-63},1}, + {249, {x=-149, y=9, z=-68},{x=-148, y=9, z=-68},1}, + {250, {x=-149, y=9, z=-64},{x=-148, y=9, z=-64},1}, + {251, {x=-149, y=9, z=-67},{x=-148, y=9, z=-67},1}, + {252, {x=-149, y=9, z=-65},{x=-148, y=9, z=-65},1}, + {253, {x=-150, y=9, z=-66},{x=-149, y=9, z=-66},1}, + {254, {x=-146, y=9, z=-72},{x=-145, y=9, z=-71},1}, + {255, {x=-146, y=9, z=-60},{x=-145, y=9, z=-61},1}, + {256, {x=-147, y=9, z=-70},{x=-146, y=9, z=-70},1}, + {257, {x=-147, y=9, z=-62},{x=-146, y=9, z=-62},1}, + {258, {x=-145, y=9, z=-71},{x=-144, y=9, z=-71},1}, + {259, {x=-145, y=9, z=-61},{x=-144, y=9, z=-61},1}, + {260, {x=-146, y=9, z=-70},{x=-145, y=9, z=-70},1}, + {261, {x=-146, y=9, z=-62},{x=-145, y=9, z=-62},1}, + {262, {x=-147, y=9, z=-69},{x=-146, y=9, z=-69},1}, + {263, {x=-147, y=9, z=-63},{x=-146, y=9, z=-63},1}, + {264, {x=-148, y=9, z=-68},{x=-147, y=9, z=-68},1}, + {265, {x=-148, y=9, z=-64},{x=-147, y=9, z=-64},1}, + {266, {x=-144, y=9, z=-71},{x=-144, y=9, z=-70},1}, + {267, {x=-144, y=9, z=-61},{x=-144, y=9, z=-62},1}, + {268, {x=-145, y=9, z=-70},{x=-145, y=9, z=-69},1}, + {269, {x=-145, y=9, z=-62},{x=-145, y=9, z=-63},1}, + {270, {x=-147, y=9, z=-68},{x=-146, y=9, z=-68},1}, + {271, {x=-147, y=9, z=-64},{x=-146, y=9, z=-64},1}, + {272, {x=-148, y=9, z=-67},{x=-147, y=9, z=-67},1}, + {273, {x=-148, y=9, z=-65},{x=-147, y=9, z=-65},1}, + {274, {x=-149, y=9, z=-66},{x=-148, y=9, z=-66},1}, + {275, {x=-147, y=9, z=-67},{x=-146, y=9, z=-67},1}, + {276, {x=-147, y=9, z=-65},{x=-146, y=9, z=-65},1}, + {277, {x=-148, y=9, z=-66},{x=-147, y=9, z=-66},1}, + {278, {x=-146, y=9, z=-69},{x=-145, y=9, z=-68},1}, + {279, {x=-146, y=9, z=-63},{x=-145, y=9, z=-64},1}, + {280, {x=-144, y=9, z=-70},{x=-144, y=9, z=-69},1}, + {281, {x=-144, y=9, z=-62},{x=-144, y=9, z=-63},1}, + {282, {x=-145, y=9, z=-68},{x=-144, y=9, z=-67},1}, + {283, {x=-145, y=9, z=-64},{x=-144, y=9, z=-65},1}, + {284, {x=-147, y=9, z=-66},{x=-146, y=9, z=-66},1}, + {285, {x=-146, y=9, z=-67},{x=-145, y=9, z=-67},1}, + {286, {x=-146, y=9, z=-65},{x=-145, y=9, z=-65},1}, + {287, {x=-146, y=9, z=-66},{x=-145, y=9, z=-66},1}, + {288, {x=-146, y=9, z=-68},{x=-146, y=9, z=-67},1}, + {289, {x=-146, y=9, z=-64},{x=-146, y=9, z=-65},1}, + {290, {x=-145, y=9, z=-69},{x=-145, y=9, z=-68},1}, + {291, {x=-145, y=9, z=-63},{x=-145, y=9, z=-64},1}, + {292, {x=-144, y=9, z=-69},{x=-144, y=9, z=-68},1}, + {293, {x=-144, y=9, z=-63},{x=-144, y=9, z=-64},1}, + {294, {x=-146, y=9, z=-67},{x=-145, y=9, z=-67},1}, + {295, {x=-146, y=9, z=-65},{x=-145, y=9, z=-65},1}, + {296, {x=-145, y=9, z=-68},{x=-145, y=9, z=-67},1}, + {297, {x=-145, y=9, z=-64},{x=-145, y=9, z=-65},1}, + {298, {x=-144, y=9, z=-68},{x=-144, y=9, z=-67},1}, + {299, {x=-144, y=9, z=-64},{x=-144, y=9, z=-65},1}, +} +function Chapter2() + return list +end \ No newline at end of file diff --git a/mods/castrum/fight.lua b/mods/castrum/fight.lua new file mode 100644 index 0000000..2167bc7 --- /dev/null +++ b/mods/castrum/fight.lua @@ -0,0 +1,361 @@ +function nextrange(x, max) + x = x + 1 + if x > max then + x = 0 + end + return x +end +function screwdriver_handler(user, pointed_thing, mode) + if pointed_thing.type ~= "node" then + return + end + local pos = pointed_thing.under + local keys = user:get_player_control() + local player_name = user:get_player_name() + + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return + end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + if not ndef or not ndef.paramtype2 == "facedir" or + (ndef.drawtype == "nodebox" and + not ndef.node_box.type == "fixed") or + node.param2 == nil then + return + end + local n = node.param2 + local axisdir = math.floor(n / 4) + local rotation = n - axisdir * 4 + if mode == 1 then + n = axisdir * 4 + nextrange(rotation, 3) + elseif mode == 3 then + n = nextrange(axisdir, 5) * 4 + end + + node.param2 = n + minetest.swap_node(pos, node) +end +function turn(player,pos,num) + for i=1,num do + screwdriver_handler(player, {type="node", under=pos, above=pos}, 1) + end +end + +minetest.register_on_punchnode(function(pos, node, puncher, pointed_thing) + if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "castrum:fight2" then + local dig = false + local dignum = 0 + if node.name == "castrum:knight_dark" then + dig = true + elseif node.name == "castrum:knight_lv1_dark" then + local fightnode = puncher:get_attribute("fightnode") + if fightnode == "1" then + dignum = math.random(2) + else + dignum = 1 + end + end + if dignum == 1 then + dig = true + end + if dig == true then + minetest.set_node(pos, {name="air"}) + minetest.set_node({x=pos.x, y=pos.y-1, z=pos.z}, {name="castrum:fight1"}) + end + local fightpos = puncher:get_attribute("fightpos") + local fightnode = puncher:get_attribute("fightnode") + if fightnode == "1" then + minetest.set_node(minetest.string_to_pos(fightpos), {name="castrum:knight_lv1"}) + screwdriver_handler(puncher, {type="node", under=minetest.string_to_pos(fightpos), above=minetest.string_to_pos(fightpos)}, 1) + end + for j=144,174 do + for i=51,81 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + end + fight_step2(puncher) + local inv = puncher:get_inventory() + inv:remove_item("main", "castrum:knight_lv1") + puncher:set_attribute("fightdig", "false") + end +end) + +function get_fight(level,player) + for j=144,174 do + for i=51,81 do + minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"}) + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + end + for i=67,76 do + minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=56,65 do + minetest.set_node({x=-144, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=57,75 do + minetest.set_node({x=-145, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=58,74 do + minetest.set_node({x=-146, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=59,73 do + minetest.set_node({x=-147, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=61,71 do + minetest.set_node({x=-148, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=63,69 do + minetest.set_node({x=-149, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + for i=65,67 do + minetest.set_node({x=-150, y=8, z=i*(-1)}, {name="castrum:fight1"}) + end + minetest.set_node({x=-144, y=9, z=-66}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-174, y=9, z=-66}, {name="castrum:knight_dark"}) + player:setpos({x=-135, y=8.5, z=-66}) + screwdriver_handler(player, {type="node", under={x=-144, y=9, z=-66}, above={x=-144, y=9, z=-66}}, 1) + screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1) + screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1) + screwdriver_handler(player, {type="node", under={x=-174, y=9, z=-66}, above={x=-174, y=9, z=-66}}, 1) + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight_1 = file:read("*l") + file:close() + local inv = player:get_inventory() + if tonumber(knight_1) > 0 then + inv:add_item("main","castrum:knight_lv1 "..knight_1) + end + player:set_attribute("fight", "false") + set_fight(player,level) +end +function set_fight(player,level) + if level == 1 then + minetest.set_node({x=-173, y=9, z=-65}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-65},3) + minetest.set_node({x=-173, y=9, z=-67}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-67},3) + minetest.set_node({x=-173, y=9, z=-62}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-62},3) + minetest.set_node({x=-173, y=9, z=-70}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-70},3) + minetest.set_node({x=-171, y=9, z=-69}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-171, y=9, z=-69},3) + minetest.set_node({x=-171, y=9, z=-63}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-171, y=9, z=-63},3) + minetest.set_node({x=-170, y=9, z=-65}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-65},3) + minetest.set_node({x=-170, y=9, z=-67}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-67},3) + elseif level == 2 then + minetest.set_node({x=-173, y=9, z=-65}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-65},3) + minetest.set_node({x=-173, y=9, z=-67}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-67},3) + minetest.set_node({x=-173, y=9, z=-62}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-62},3) + minetest.set_node({x=-173, y=9, z=-70}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-173, y=9, z=-70},3) + minetest.set_node({x=-171, y=9, z=-69}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-171, y=9, z=-69},3) + minetest.set_node({x=-171, y=9, z=-63}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-171, y=9, z=-63},3) + minetest.set_node({x=-170, y=9, z=-65}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-65},3) + minetest.set_node({x=-170, y=9, z=-67}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-67},3) + minetest.set_node({x=-170, y=9, z=-70}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-70},3) + minetest.set_node({x=-169, y=9, z=-68}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-169, y=9, z=-68},3) + minetest.set_node({x=-168, y=9, z=-66}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-168, y=9, z=-66},3) + minetest.set_node({x=-170, y=9, z=-62}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-170, y=9, z=-62},3) + minetest.set_node({x=-169, y=9, z=-64}, {name="castrum:knight_lv1_dark"}) + turn(player,{x=-169, y=9, z=-64},3) + end + player:set_attribute("fightlv", ""..level) +end +function fight_step1(player) + local fight = player:get_attribute("fight") + if fight == "false" then + local start = false + for j=144,174 do + for i=51,81 do + if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" then + start = true + end + end + end + if start == false then + minetest.chat_send_player(player:get_player_name(), "you have to place a knight") + else + player:set_attribute("fight", "true") + player:set_attribute("fightmove", "1") + player:set_attribute("fightkill", "0") + local inv = player:get_inventory() + inv:remove_item("main", "castrum:knight_lv1 80") + for j=144,174 do + for i=51,81 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + end + end + end +end + +function fight_step2(player) + local move = tonumber(player:get_attribute("fightmove")) + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + local list = {} + if tonumber(chapter) == 1 then + list = Chapter1() + elseif tonumber(chapter) == 2 then + list = Chapter2() + end + local move2 = move + local d = 0 + local dd = 0 + local dignum = 0 + for j=144,174 do + for i=51,81 do + dignum = math.random(2) + if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" and dignum == 1 then + if minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1" then + minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)-1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)-1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)-1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1), y=9, z=i*(-1)-1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)+1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1)+1, y=9, z=i*(-1)+1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1)-1, y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1)-1, y=9, z=i*(-1)+1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + if (minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:knight_lv1" or minetest.get_node({x=j*(-1), y=9, z=i*(-1)+1}).name == "castrum:castrum_knight1") and dd == 0 then + minetest.set_node({x=j*(-1), y=9, z=i*(-1)+1}, {name="air"}) + player:set_attribute("fightkill", ""..(player:get_attribute("fightkill")+1)) + dd = 1 + end + + end + end + end + while d == 0 and move2 < 167 and dd == 0 and tonumber(chapter) == 1 do + if minetest.get_node(list[move2][2]).name == "castrum:knight_lv1_dark" then + minetest.set_node(list[move2][2], {name="air"}) + minetest.set_node(list[move2][3], {name="castrum:knight_lv1_dark"}) + player:set_attribute("fightmove", ""..(move2+1)) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + d = 1 + else + move2 = move2+1 + end + end + while d == 0 and move2 < 300 and dd == 0 and tonumber(chapter) == 2 do + if minetest.get_node(list[move2][2]).name == "castrum:knight_lv1_dark" then + minetest.set_node(list[move2][2], {name="air"}) + minetest.set_node(list[move2][3], {name="castrum:knight_lv1_dark"}) + player:set_attribute("fightmove", ""..(move2+1)) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + screwdriver_handler(player, {type="node", under=list[move2][3], above=list[move2][3]}, 1) + d = 1 + else + move2 = move2+1 + end + end + local kg = 0 + local ky = 0 + local tg = 0 + local ty = 0 + for j=144,174 do + for i=51,81 do + if minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1_dark" then + tg = 1 + elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_lv1" then + ty = 1 + elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:castrum_knight1" then + ky = 1 + elseif minetest.get_node({x=j*(-1), y=9, z=i*(-1)}).name == "castrum:knight_dark" then + kg = 1 + end + end + end + if tg == 0 then + minetest.chat_send_player(player:get_player_name(), "you win") + player:setpos({x=-74, y=8.5, z=-77}) + local inv = player:get_inventory() + inv:remove_item("main", "castrum:knight_lv1 80") + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "w") + file:write((tonumber(chapter)+1)) + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight_1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w") + file:write((tonumber(knight_1)-player:get_attribute("fightkill"))) + file:close() + Update_knight(player) + elseif ky == 0 or ty == 0 then + minetest.chat_send_player(player:get_player_name(), "you lose") + player:setpos({x=-74, y=8.5, z=-77}) + local inv = player:get_inventory() + inv:remove_item("main", "castrum:knight_lv1 80") + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight_1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w") + file:write((tonumber(knight_1)-player:get_attribute("fightkill"))) + file:close() + Update_knight(player) + end +end +minetest.register_node("castrum:start_fight",{ + tiles = {"castrum_bridge_status.png"}, + description = "Start fight", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + fight_step1(player) + + end, +}) \ No newline at end of file diff --git a/mods/castrum/init.lua b/mods/castrum/init.lua new file mode 100644 index 0000000..bac4d2d --- /dev/null +++ b/mods/castrum/init.lua @@ -0,0 +1,8950 @@ +minetest.register_on_joinplayer(function(player) + local name = player:get_player_name() + player:hud_add({ + hud_elem_type = "text", + position = {x=0, y=0.85}, + offset = {x=0, y=10}, + alignment = {x=1, y=0}, + number = 0xFFFFFF , + text = "For Minetest : 0.4.16", + }) + player:hud_add({ + hud_elem_type = "text", + position = {x=0, y=0.85}, + offset = {x=0, y=30}, + alignment = {x=1, y=0}, + number = 0xFFFFFF , + text = "Game Version : 1.3.0", + }) + player:hud_add({ + hud_elem_type = "text", + position = {x=0, y=0.85}, + offset = {x=0, y=50}, + alignment = {x=1, y=0}, + number = 0xFFFFFF , + text = "Map Version : 4", + }) +end) +function file_check(file_name) + local file_found=io.open(file_name, "r") + if file_found==nil then + file_found=false + else + file_found=true + end + return file_found +end +minetest.register_on_joinplayer(function(player) + if file_check(minetest.get_worldpath().."/SAVE/Lake.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Barracks.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Battleground.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Chapter.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "w") + file:write("1") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Camp1.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Knight_1.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Island_Fountain.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Island_Walle.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Island_Walln.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Island_Walls.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Island_Wallw.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "w") + file:write("0") + file:close() + end + if file_check(minetest.get_worldpath().."/SAVE/Sandmine.txt") == true then + else + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "w") + file:write("0") + file:close() + end +end) +dofile(minetest.get_modpath("castrum").."/Chapter1.lua") +dofile(minetest.get_modpath("castrum").."/Chapter2.lua") +dofile(minetest.get_modpath("castrum").."/fight.lua") +dofile(minetest.get_modpath("castrum").."/update.lua") +local timer = 0 +local timer2 = 0 +local timer3 = 0 +local timer4 = 0 +local timer5 = 0 +local timer6 = 0 +local tree2 = 0 +local quarry2 = 0 +local mine2 = 0 +local sandmine2 = 0 +local last = {x=0,y=0,z=0} +minetest.register_globalstep(function(dtime) + timer = timer + dtime; + timer2 = timer2 + dtime; + timer3 = timer3 + dtime; + timer4 = timer4 + dtime; + timer5 = timer5 + dtime; + timer6 = timer6 + dtime; + local players = minetest.get_connected_players() + for _,player in ipairs(players) do + local pos = player:getpos() + if pos.x < -9.5 and pos.x > -15.5 and pos.z > -62.5 and pos.z < -54 then + last = pos + elseif pos.x < -10.5 and pos.x > -14.5 and pos.z > -63.5 and pos.z < -62.5 then + last = pos + elseif pos.x < -11.5 and pos.x > -13.5 and pos.z > -64.5 and pos.z < -63.5 then + last = pos + elseif pos.x < 132.5 and pos.x > 127.5 and pos.z > 39.5 and pos.z < 48.5 then + last = pos + elseif pos.x < 131.5 and pos.x > 128.5 and pos.z > 48.5 and pos.z < 49.5 then + last = pos + elseif pos.x < 130.5 and pos.x > 129.5 and pos.z > 49.5 and pos.z < 50.5 then + last = pos + elseif pos.y < 8 then + player:setpos(last) + elseif minetest.get_node({x=pos.x, y=(pos.y-0.5),z=pos.z}).name ~= "air" then + last = pos + end + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "r") + local ship1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "r") + local quarry = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "r") + local tree = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "r") + local mine = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "r") + local lake = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "r") + local sandmine = file:read("*l") + file:close() + local quarrytime = 0 + local quarrynum = 1 + if tonumber(quarry) == 0 then + quarrytime = 5 + quarrynum = 1 + elseif tonumber(quarry) == 1 then + quarrytime = 3.5 + quarrynum = 1 + elseif tonumber(quarry) == 2 then + quarrytime = 2.5 + quarrynum = 2 + end + local treetime = 0 + local treenum = 1 + if tonumber(tree) == 1 then + treetime = 8 + treenum = 1 + elseif tonumber(tree) == 2 then + treetime = 6 + treenum = 1 + elseif tonumber(tree) == 3 then + treetime = 4 + treenum = 2 + end + local minetime = 0 + local minenum = 1 + if tonumber(mine) == 1 then + minetime = 15 + minenum = 1 + elseif tonumber(mine) == 2 then + minetime = 11.5 + minenum = 1 + elseif tonumber(mine) == 3 then + minetime = 9 + minenum = 2 + end + local laketime = 0 + if tonumber(lake) == 1 then + laketime = 12 + elseif tonumber(lake) == 2 then + laketime = 9 + elseif tonumber(lake) == 3 then + laketime = 6.5 + end + local sandminetime = 0 + local sandminenum = 1 + if tonumber(sandmine) == 0 then + sandminetime = 5 + sandminenum = 1 + elseif tonumber(sandmine) == 1 then + sandminetime = 3.5 + sandminenum = 1 + elseif tonumber(quarry) == 2 then + sandminetime = 2.5 + sandminenum = 2 + end + if timer >= quarrytime then + if tonumber(quarry) > -1 then + local inv = minetest.get_inventory({type="node", pos={x=-20, y=9, z=-2}}) + if inv then + quarry2 = quarry2+1 + if quarry2 == 2 then + quarry2 = 0 + end + inv:add_item("main", "default:cobble ") + if quarrynum > 1 and quarry2 == 1 then + inv:add_item("main", "default:desert_cobble") + end + end + end + timer = 0 + end + if timer2 >= treetime then + if tonumber(tree) > 0 then + local inv = minetest.get_inventory({type="node", pos={x=-20, y=9, z=11}}) + if inv then + tree2 = tree2+1 + if tree2 == 2 then + tree2 = 0 + end + inv:add_item("main", "default:wood") + if treenum > 1 and tree2 == 1 then + inv:add_item("main", "default:junglewood") + end + end + end + timer2 = 0 + end + if timer4 >= minetime then + if tonumber(mine) > 0 then + local inv = minetest.get_inventory({type="node", pos={x=-20, y=9, z=-15}}) + if inv then + mine2 = mine2+1 + if mine2 == 2 then + mine2 = 0 + end + inv:add_item("main", "default:coal_lump") + if minenum > 1 and mine2 == 1 then + inv:add_item("main", "default:iron_lump") + end + end + end + timer4 = 0 + end + if timer5 >= laketime then + if tonumber(lake) > 0 then + local inv = minetest.get_inventory({type="node", pos={x=-34, y=9, z=-58}}) + if inv then + inv:add_item("main", "castrum:bucket_water") + end + end + timer5 = 0 + end + if timer6 >= sandminetime then + if tonumber(sandmine) > -1 and tonumber(ship1) > 4 then + local inv = minetest.get_inventory({type="node", pos={x=132, y=9, z=15}}) + if inv then + sandmine2 = sandmine2+1 + if sandmine2 == 2 then + sandmine2 = 0 + end + inv:add_item("main", "default:sand") + if sandminenum > 1 and sandmine2 == 1 then + inv:add_item("main", "default:desert_sand") + end + end + end + timer6 = 0 + end + end +end) +minetest.register_on_joinplayer(function(player) + if player:get_player_name() == "singleplayer" then + else + minetest.kick_player(player:get_player_name(), "you can play castrum only as 'singleplayer'") + end + for i=0,90 do + for j=9,30 do + minetest.set_node({x=-134, y=j, z=i*(-1)}, {name="default:stone"}) + end + end + for i=0,96 do + for j=9,30 do + minetest.set_node({x=-134, y=j, z=i}, {name="default:stone"}) + end + end +end) +local new = {} +new.get_formspec = function(player, pos) + if player == nil then + return + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Welcome to minetest castrum.]" + .."label[0,0.3;You are on a floor plan of a castle.]" + .."label[0,0.6;Hit a diamond block to build and upgrade a building.]" + .."label[0,0.9;Go first to the quarry in the east.]" + .."label[0,1.2;Collect resources and rebuild the old castle]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +minetest.register_on_newplayer(function(player) + player:setpos({x=-40, y=8.5, z=3.0}) + minetest.show_formspec(player:get_player_name(), "new" , new.get_formspec(player)) + local privs = minetest.get_player_privs(player:get_player_name()) + privs["fast"] = true + minetest.set_player_privs(player:get_player_name(), privs) +end) +minetest.register_on_dignode(function(pos, node, digger) + local fightdig = digger:get_attribute("fightdig") + local fight = digger:get_attribute("fight") + if node.name == "castrum:knight_lv1" and fightdig ~= "true" and fight == "true" then + local inv = digger:get_inventory() + inv:add_item("main", ""..node.name) + digger:set_attribute("fightpos", minetest.pos_to_string(pos)) + if minetest.get_node({x=pos.x-1, y=9, z=pos.z}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x-1, y=9, z=pos.z}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x-1, y=9, z=pos.z}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x-1, y=8, z=pos.z}).name ~= "default:gravel" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x-1, y=9, z=pos.z-1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x-1, y=9, z=pos.z-1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z-1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x-1, y=9, z=pos.z-1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x-1, y=8, z=pos.z-1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z-1}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x-1, y=9, z=pos.z+1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x-1, y=9, z=pos.z+1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z+1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x-1, y=9, z=pos.z+1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x-1, y=8, z=pos.z+1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x-1, y=8, z=pos.z+1}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x, y=9, z=pos.z}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x, y=9, z=pos.z}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x, y=8, z=pos.z}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x, y=9, z=pos.z}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x, y=8, z=pos.z}).name ~= "default:gravel" then + minetest.set_node({x=pos.x, y=8, z=pos.z}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x, y=9, z=pos.z-1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x, y=9, z=pos.z-1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x, y=8, z=pos.z-1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x, y=9, z=pos.z-1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x, y=8, z=pos.z-1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x, y=8, z=pos.z-1}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x, y=9, z=pos.z+1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x, y=9, z=pos.z+1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x, y=8, z=pos.z+1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x, y=9, z=pos.z+1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x, y=8, z=pos.z+1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x, y=8, z=pos.z+1}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x+1, y=9, z=pos.z}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x+1, y=9, z=pos.z}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x+1, y=9, z=pos.z}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x+1, y=8, z=pos.z}).name ~= "default:gravel" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x+1, y=9, z=pos.z-1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x+1, y=9, z=pos.z-1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z-1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x+1, y=9, z=pos.z-1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x+1, y=8, z=pos.z-1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z-1}, {name="castrum:fight1"}) + end + if minetest.get_node({x=pos.x+1, y=9, z=pos.z+1}).name == "castrum:knight_lv1_dark" or minetest.get_node({x=pos.x+1, y=9, z=pos.z+1}).name == "castrum:knight_dark" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z+1}, {name="castrum:fight2"}) + elseif minetest.get_node({x=pos.x+1, y=9, z=pos.z+1}).name ~= "castrum:knight_lv1" and minetest.get_node({x=pos.x+1, y=8, z=pos.z+1}).name ~= "default:gravel" then + minetest.set_node({x=pos.x+1, y=8, z=pos.z+1}, {name="castrum:fight1"}) + end + if node.name == "castrum:knight_lv1" then + digger:set_attribute("fightnode", "1") + end + digger:set_attribute("fightdig", "true") + else + minetest.set_node(pos, {name=node.name}) + if node.name == "castrum:knight_lv1" then + screwdriver_handler(digger, {type="node", under=pos, above=pos}, 1) + end + end +end) + +function minetest.handle_node_drops(pos, drops, digger) +end +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack, pointed_thing) + if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name == "castrum:fight1" and newnode.name == "castrum:knight_lv1" then + minetest.set_node(pos, {name="castrum:knight_lv1"}) + screwdriver_handler(placer, {type="node", under=pos, above=pos}, 1) + local inv = placer:get_inventory() + inv:remove_item("main", "castrum:knight_lv1") + local fight = placer:get_attribute("fight") + placer:set_attribute("fightdig", "false") + if fight == "true" then + for j=144,174 do + for i=51,81 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + end + fight_step2(placer) + end + else + minetest.set_node(pos, {name=oldnode.name}) + return itemstack + end +end) +function Home1(v,player) + if v+0 == 1 then + for i=26,32 do + for j=20,25 do + minetest.set_node({x=i*(-1), y=9, z=j*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-29, y=9, z=-19}, {name="stairs:stair_cobble"}) + screwdriver_handler(player, {type="node", under={x=-29, y=9, z=-19}, above={x=-29, y=9, z=-19}}, 1) + screwdriver_handler(player, {type="node", under={x=-29, y=9, z=-19}, above={x=-29, y=9, z=-19}}, 1) + elseif v+0 == 2 then + for j=20,25 do + minetest.set_node({x=-26, y=10, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-32, y=10, z=j*(-1)}, {name="default:wood"}) + end + for i=26,32 do + minetest.set_node({x=i*(-1), y=10, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=10, z=-20}, {name="default:wood"}) + end + minetest.set_node({x=-29, y=10, z=-20}, {name="air"}) + elseif v+0 == 3 then + for j=20,25 do + minetest.set_node({x=-26, y=11, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-32, y=11, z=j*(-1)}, {name="default:wood"}) + end + for i=26,32 do + minetest.set_node({x=i*(-1), y=11, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=11, z=-20}, {name="default:wood"}) + end + minetest.set_node({x=-29, y=11, z=-20}, {name="air"}) + minetest.set_node({x=-29, y=10, z=-20}, {name="doors:door_wood_a"}) + screwdriver_handler(player, {type="node", under={x=-29, y=10, z=-20}, above={x=-29, y=10, z=-20}}, 1) + screwdriver_handler(player, {type="node", under={x=-29, y=10, z=-20}, above={x=-29, y=10, z=-20}}, 1) + elseif v+0 == 4 then + for j=20,25 do + minetest.set_node({x=-26, y=12, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-32, y=12, z=j*(-1)}, {name="default:wood"}) + end + for i=26,32 do + minetest.set_node({x=i*(-1), y=12, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=12, z=-20}, {name="default:wood"}) + end + elseif v+0 == 5 then + for j=21,24 do + minetest.set_node({x=-27, y=13, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-31, y=13, z=j*(-1)}, {name="default:wood"}) + end + for i=27,31 do + minetest.set_node({x=i*(-1), y=13, z=-24}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=13, z=-21}, {name="default:wood"}) + end + elseif v+0 == 6 then + for j=22,23 do + minetest.set_node({x=-28, y=14, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-30, y=14, z=j*(-1)}, {name="default:wood"}) + end + for i=28,30 do + minetest.set_node({x=i*(-1), y=14, z=-23}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=14, z=-22}, {name="default:wood"}) + end + minetest.set_node({x=-26, y=9, z=-19}, {name="castrum:character1"}) + screwdriver_handler(player, {type="node", under={x=-26, y=9, z=-19}, above={x=-26, y=9, z=-19}}, 1) + screwdriver_handler(player, {type="node", under={x=-26, y=9, z=-19}, above={x=-26, y=9, z=-19}}, 1) + elseif v+0 == 7 then + for i=26,32 do + for j=19,25 do + for k=9,14 do + if minetest.get_node({x=i*(-1), y=k, z=j*(-1)}).name == "default:wood" then + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:junglewood"}) + end + end + end + end + elseif v+0 == 0 then + for i=26,32 do + for j=19,25 do + for k=9,14 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + end + end + end +end +function Home2(v,player) + if v+0 == 1 then + for i=48,54 do + for j=20,25 do + minetest.set_node({x=i*(-1), y=9, z=j*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-51, y=9, z=-19}, {name="stairs:stair_cobble"}) + screwdriver_handler(player, {type="node", under={x=-51, y=9, z=-19}, above={x=-51, y=9, z=-19}}, 1) + screwdriver_handler(player, {type="node", under={x=-51, y=9, z=-19}, above={x=-51, y=9, z=-19}}, 1) + elseif v+0 == 2 then + for j=20,25 do + minetest.set_node({x=-48, y=10, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-54, y=10, z=j*(-1)}, {name="default:wood"}) + end + for i=48,54 do + minetest.set_node({x=i*(-1), y=10, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=10, z=-20}, {name="default:wood"}) + end + minetest.set_node({x=-51, y=10, z=-20}, {name="air"}) + elseif v+0 == 3 then + for j=20,25 do + minetest.set_node({x=-48, y=11, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-54, y=11, z=j*(-1)}, {name="default:wood"}) + end + for i=48,54 do + minetest.set_node({x=i*(-1), y=11, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=11, z=-20}, {name="default:wood"}) + end + minetest.set_node({x=-51, y=11, z=-20}, {name="air"}) + minetest.set_node({x=-51, y=10, z=-20}, {name="doors:door_wood_a"}) + screwdriver_handler(player, {type="node", under={x=-51, y=10, z=-20}, above={x=-51, y=10, z=-20}}, 1) + screwdriver_handler(player, {type="node", under={x=-51, y=10, z=-20}, above={x=-51, y=10, z=-20}}, 1) + elseif v+0 == 4 then + for j=20,25 do + minetest.set_node({x=-48, y=12, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-54, y=12, z=j*(-1)}, {name="default:wood"}) + end + for i=48,54 do + minetest.set_node({x=i*(-1), y=12, z=-25}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=12, z=-20}, {name="default:wood"}) + end + elseif v+0 == 5 then + for j=21,24 do + minetest.set_node({x=-49, y=13, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-53, y=13, z=j*(-1)}, {name="default:wood"}) + end + for i=49,53 do + minetest.set_node({x=i*(-1), y=13, z=-24}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=13, z=-21}, {name="default:wood"}) + end + elseif v+0 == 6 then + for j=22,23 do + minetest.set_node({x=-50, y=14, z=j*(-1)}, {name="default:wood"}) + minetest.set_node({x=-52, y=14, z=j*(-1)}, {name="default:wood"}) + end + for i=50,52 do + minetest.set_node({x=i*(-1), y=14, z=-23}, {name="default:wood"}) + minetest.set_node({x=i*(-1), y=14, z=-22}, {name="default:wood"}) + end + minetest.set_node({x=-54, y=9, z=-19}, {name="castrum:character1"}) + screwdriver_handler(player, {type="node", under={x=-54, y=9, z=-19}, above={x=-54, y=9, z=-19}}, 1) + screwdriver_handler(player, {type="node", under={x=-54, y=9, z=-19}, above={x=-54, y=9, z=-19}}, 1) + elseif v+0 == 0 then + for i=48,54 do + for j=19,25 do + for k=9,14 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + end + end + end +end +function Bridge(v,player) + if v+0 == 1 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-32}, {name="default:wood"}) + end + elseif v+0 == 2 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-33}, {name="default:wood"}) + end + elseif v+0 == 3 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-34}, {name="default:wood"}) + end + elseif v+0 == 4 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-35}, {name="default:wood"}) + end + elseif v+0 == 5 then + for i=36,39 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:wood"}) + end + for i=41,44 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:wood"}) + end + elseif v+0 == 6 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-37}, {name="default:wood"}) + end + elseif v+0 == 7 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-38}, {name="default:wood"}) + end + elseif v+0 == 8 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-39}, {name="default:wood"}) + end + elseif v+0 == 9 then + for i=36,44 do + minetest.set_node({x=i*(-1), y=8, z=-40}, {name="default:wood"}) + end + elseif v+0 == 10 then + for i=36,44 do + for j=32,35 do + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:junglewood"}) + end + end + for i=36,44 do + for j=37,40 do + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:junglewood"}) + end + end + for i=36,39 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:junglewood"}) + end + for i=41,44 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:junglewood"}) + end + elseif v+0 == 0 then + for i=36,44 do + for j=32,35 do + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:dirt_with_grass"}) + end + end + for i=36,44 do + for j=37,40 do + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:dirt_with_grass"}) + end + end + for i=36,39 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:dirt_with_grass"}) + end + for i=41,44 do + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="default:dirt_with_grass"}) + end + end +end +function Bridge2(v,player) + if v+0 == 10 then + for j=36,44 do + for k=8,16 do + minetest.set_node({x=j*(-1), y=k, z=-32}, {name="default:junglewood"}) + end + end + minetest.set_node({x=-40, y=12, z=-32}, {name="castrum:bridge2"}) + elseif v+0 == 0 then + for i=36,44 do + for k=8,16 do + minetest.set_node({x=i*(-1), y=k, z=-32}, {name="air"}) + end + end + for i=36,44 do + for j=32,40 do + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:dirt_with_grass"}) + end + end + minetest.set_node({x=-40, y=8, z=-36}, {name="castrum:bridge"}) + end +end +function Moat_south(v,player) + if v+0 == 1 then + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=-36}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=-36}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=-36}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=-36}, {name="air"}) + end + elseif v+0 == 2 then + for j=35,37 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j*(-1)}, {name="air"}) + end + end + for i=0,83 do + if minetest.get_node({x=i*(-1), y=7, z=-36}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=7, z=-36}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=7, z=-36}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=-36}, {name="air"}) + end + elseif v+0 == 3 then + for j=34,38 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j*(-1)}, {name="air"}) + end + end + for j=35,37 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=7, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j*(-1)}, {name="air"}) + end + end + for i=0,83 do + if minetest.get_node({x=i*(-1), y=6, z=-36}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=6, z=-36}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=6, z=-36}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=-36}, {name="air"}) + end + elseif v+0 == 4 then + for j=33,39 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j*(-1)}, {name="air"}) + end + end + for j=34,38 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=7, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j*(-1)}, {name="air"}) + end + end + for j=35,37 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=6, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j*(-1)}, {name="air"}) + end + end + for i=0,83 do + if minetest.get_node({x=i*(-1), y=5, z=-36}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=5, z=-36}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=5, z=-36}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=-36}, {name="air"}) + end + elseif v+0 == 5 then + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j*(-1)}, {name="air"}) + end + end + for j=33,39 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=7, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j*(-1)}, {name="air"}) + end + end + for j=34,38 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=6, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j*(-1)}, {name="air"}) + end + end + for j=35,37 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=5, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j*(-1)}, {name="air"}) + end + end + for i=0,83 do + if minetest.get_node({x=i*(-1), y=4, z=-36}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=4, z=-36}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=4, z=-36}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=-36}, {name="air"}) + end + elseif v+0 == 6 then + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=7, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=7, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j*(-1)}, {name="air"}) + end + end + for j=33,39 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=6, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j*(-1)}, {name="air"}) + end + end + for j=34,38 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=5, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j*(-1)}, {name="air"}) + end + end + for j=35,37 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=4, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j*(-1)}, {name="air"}) + end + end + elseif v+0 == 7 then + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=6, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=6, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j*(-1)}, {name="air"}) + end + end + for j=33,39 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=5, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j*(-1)}, {name="air"}) + end + end + for j=34,38 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=4, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j*(-1)}, {name="air"}) + end + end + elseif v+0 == 8 then + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=5, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=5, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j*(-1)}, {name="air"}) + end + end + for j=33,39 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=4, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j*(-1)}, {name="air"}) + end + end + elseif v+0 == 9 then + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=4, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=4, z=j*(-1)}, {name="air"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j*(-1)}, {name="air"}) + end + end + elseif v+0 == 10 then + for j=32,40 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j*(-1)}, {name="castrum:water"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j*(-1)}, {name="castrum:water"}) + end + end + elseif v+0 == 0 then + for j=32,40 do + for k=4,7 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:stone"}) + end + for i=1,3 do + minetest.set_node({x=i, y=k, z=j*(-1)}, {name="default:stone"}) + end + end + end + for j=32,40 do + for i=0,83 do + if minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "default:wood" and minetest.get_node({x=i*(-1), y=8, z=j*(-1)}).name ~= "castrum:bridge" then + minetest.set_node({x=i*(-1), y=8, z=j*(-1)}, {name="default:dirt_with_grass"}) + end + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j*(-1)}, {name="default:dirt_with_grass"}) + end + end + end +end +function Moat_east(v,player) + if v+0 == 1 then + for i=0,31 do + minetest.set_node({x=-1, y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-1, y=8, z=i}, {name="air"}) + end + elseif v+0 == 2 then + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-1, y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-1, y=7, z=i}, {name="air"}) + end + elseif v+0 == 3 then + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=1, y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=1, y=8, z=i}, {name="air"}) + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-1, y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-1, y=6, z=i}, {name="air"}) + end + elseif v+0 == 4 then + for j=0,4 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j, y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=8, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=1, y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=1, y=7, z=i}, {name="air"}) + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-1, y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-1, y=5, z=i}, {name="air"}) + end + elseif v+0 == 5 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=8, z=i}, {name="air"}) + end + end + for j=0,4 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j, y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=7, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=1, y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=1, y=6, z=i}, {name="air"}) + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-1, y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-1, y=4, z=i}, {name="air"}) + end + elseif v+0 == 6 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=7, z=i}, {name="air"}) + end + end + for j=0,4 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j, y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=6, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=1, y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=1, y=5, z=i}, {name="air"}) + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 7 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=6, z=i}, {name="air"}) + end + end + for j=0,4 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j, y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=5, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=1, y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=1, y=4, z=i}, {name="air"}) + end + elseif v+0 == 8 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=5, z=i}, {name="air"}) + end + end + for j=0,4 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + for j=0,2 do + for i=0,31 do + minetest.set_node({x=j, y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 9 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j, y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 10 then + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="castrum:water"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="castrum:water"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=4, z=i*(-1)}, {name="castrum:water"}) + end + for i=0,37 do + minetest.set_node({x=j, y=4, z=i}, {name="castrum:water"}) + end + end + elseif v+0 == 0 then + for k=4,7 do + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:stone"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="default:stone"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=k, z=i*(-1)}, {name="default:stone"}) + end + for i=0,37 do + minetest.set_node({x=j, y=k, z=i}, {name="default:stone"}) + end + end + end + for j=0,5 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="default:dirt_with_grass"}) + end + end + for j=0,3 do + for i=0,31 do + minetest.set_node({x=j, y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + for i=0,37 do + minetest.set_node({x=j, y=8, z=i}, {name="default:dirt_with_grass"}) + end + end + end +end +function Moat_north(v,player) + if v+0 == 1 then + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=42}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=42}, {name="air"}) + end + elseif v+0 == 2 then + for j=41,43 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j}, {name="air"}) + end + end + for i=0,83 do + minetest.set_node({x=i*(-1), y=7, z=42}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=42}, {name="air"}) + end + elseif v+0 == 3 then + for j=40,44 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j}, {name="air"}) + end + end + for j=41,43 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=7, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j}, {name="air"}) + end + end + for i=0,83 do + minetest.set_node({x=i*(-1), y=6, z=42}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=42}, {name="air"}) + end + elseif v+0 == 4 then + for j=39,45 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j}, {name="air"}) + end + end + for j=40,44 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=7, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j}, {name="air"}) + end + end + for j=41,43 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=6, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j}, {name="air"}) + end + end + for i=0,83 do + minetest.set_node({x=i*(-1), y=5, z=42}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=42}, {name="air"}) + end + elseif v+0 == 5 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j}, {name="air"}) + end + end + for j=39,45 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=7, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j}, {name="air"}) + end + end + for j=40,44 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=6, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j}, {name="air"}) + end + end + for j=41,43 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=5, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j}, {name="air"}) + end + end + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=42}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=42}, {name="air"}) + end + elseif v+0 == 6 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=7, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=7, z=j}, {name="air"}) + end + end + for j=39,45 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=6, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j}, {name="air"}) + end + end + for j=40,44 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=5, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j}, {name="air"}) + end + end + for j=41,43 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j}, {name="air"}) + end + end + elseif v+0 == 7 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=6, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=6, z=j}, {name="air"}) + end + end + for j=39,45 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=5, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j}, {name="air"}) + end + end + for j=40,44 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j}, {name="air"}) + end + end + elseif v+0 == 8 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=5, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=5, z=j}, {name="air"}) + end + end + for j=39,45 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j}, {name="air"}) + end + end + elseif v+0 == 9 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j}, {name="air"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j}, {name="air"}) + end + end + elseif v+0 == 10 then + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=4, z=j}, {name="castrum:water"}) + end + for i=1,3 do + minetest.set_node({x=i, y=4, z=j}, {name="castrum:water"}) + end + end + elseif v+0 == 0 then + for j=38,46 do + for k=4,7 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=k, z=j}, {name="default:stone"}) + end + for i=1,3 do + minetest.set_node({x=i, y=k, z=j}, {name="default:stone"}) + end + end + end + for j=38,46 do + for i=0,83 do + minetest.set_node({x=i*(-1), y=8, z=j}, {name="default:dirt_with_grass"}) + end + for i=1,3 do + minetest.set_node({x=i, y=8, z=j}, {name="default:dirt_with_grass"}) + end + end + end +end +function Wall_south(v,player) + if v+0 == 1 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=9, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=9, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 2 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=10, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=10, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 3 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=11, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=11, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 4 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=12, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=12, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=13, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=13, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 6 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=14, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=14, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 7 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=15, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=15, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 8 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=16, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=16, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 9 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=17, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=17, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-36, y=17, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-44, y=17, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 10 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=18, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=18, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-36, y=18, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-44, y=18, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-37, y=18, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-43, y=18, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 11 then + for i=14,35 do + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:cobble"}) + end + for i=45,66 do + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:cobble"}) + end + for i=29,31 do + minetest.set_node({x=-35, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-45, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-36, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-44, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-37, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-43, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-38, y=19, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-42, y=19, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 12 then + for i=14,66 do + for j=28,31 do + minetest.set_node({x=i*(-1), y=20, z=j*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 13 then + for i=14,66 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=-31}, {name="default:cobble"}) + end + end + elseif v+0 == 14 then + minetest.set_node({x=-36, y=9, z=-30}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-44, y=9, z=-30}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-64, y=21, z=-30}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-60, y=21, z=-30}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-56, y=21, z=-30}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-24, y=21, z=-30}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-20, y=21, z=-30}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-16, y=21, z=-30}, {name="castrum:castrum_knight2"}) + elseif v+0 == 15 then + for i=45,66 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:stone_block"}) + end + end + for i=14,35 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:stone_block"}) + + end + end + for i=45,66 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:stone_block"}) + end + end + for i=14,35 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:stone_block"}) + end + end + for i=45,66 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:stone_block"}) + end + end + for i=14,35 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:stone_block"}) + end + end + minetest.set_node({x=-42, y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=-43, y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=-44, y=18, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=-38, y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=-37, y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=-36, y=18, z=-31}, {name="default:stone_block"}) + for k=9,20 do + if k%2 == 1 then + minetest.set_node({x=-45, y=k, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=k, z=-29}, {name="default:stone_block"}) + end + end + minetest.set_node({x=-35, y=10, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=14, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=18, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=10, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=14, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=18, z=-30}, {name="default:stone_block"}) + minetest.set_node({x=-37, y=19, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-43, y=19, z=-29}, {name="default:stone_block"}) + elseif v+0 == 16 then + for i=14,66 do + for j=28,31 do + for k=9,21 do + if minetest.get_node({x=i*(-1), y=k, z=j*(-1)}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for i=14,66 do + for j=28,31 do + for k=9,21 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + end + end + end +end +function Fountain(v,player) + if v+0 == 1 then + for i=39,41 do + for j=0,8 do + minetest.set_node({x=i*(-1), y=9, z=j}, {name="castrum:cobble"}) + end + for j=1,2 do + minetest.set_node({x=i*(-1), y=9, z=j*(-1)}, {name="castrum:cobble"}) + end + end + for i=35,45 do + for j=2,4 do + minetest.set_node({x=i*(-1), y=9, z=j}, {name="castrum:cobble"}) + end + end + elseif v+0 == 2 then + for j=0,7 do + minetest.set_node({x=38*(-1), y=9, z=j}, {name="castrum:cobble"}) + minetest.set_node({x=42*(-1), y=9, z=j}, {name="castrum:cobble"}) + minetest.set_node({x=37*(-1), y=9, z=j}, {name="castrum:cobble"}) + minetest.set_node({x=43*(-1), y=9, z=j}, {name="castrum:cobble"}) + end + for j=0,6 do + minetest.set_node({x=36*(-1), y=9, z=j}, {name="castrum:cobble"}) + minetest.set_node({x=44*(-1), y=9, z=j}, {name="castrum:cobble"}) + end + minetest.set_node({x=38*(-1), y=9, z=1*(-1)}, {name="castrum:cobble"}) + minetest.set_node({x=42*(-1), y=9, z=1*(-1)}, {name="castrum:cobble"}) + minetest.set_node({x=37*(-1), y=9, z=1*(-1)}, {name="castrum:cobble"}) + minetest.set_node({x=43*(-1), y=9, z=1*(-1)}, {name="castrum:cobble"}) + elseif v+0 == 3 then + minetest.set_node({x=-41, y=10, z=-2}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=10, z=-2}, {name="castrum:cobble"}) + minetest.set_node({x=-39, y=10, z=-2}, {name="castrum:cobble"}) + minetest.set_node({x=-38, y=10, z=-1}, {name="castrum:cobble"}) + minetest.set_node({x=-37, y=10, z=-1}, {name="castrum:cobble"}) + minetest.set_node({x=-42, y=10, z=-1}, {name="castrum:cobble"}) + minetest.set_node({x=-43, y=10, z=-1}, {name="castrum:cobble"}) + minetest.set_node({x=-44, y=10, z=0}, {name="castrum:cobble"}) + minetest.set_node({x=-44, y=10, z=1}, {name="castrum:cobble"}) + minetest.set_node({x=-36, y=10, z=0}, {name="castrum:cobble"}) + minetest.set_node({x=-36, y=10, z=1}, {name="castrum:cobble"}) + minetest.set_node({x=-35, y=10, z=2}, {name="castrum:cobble"}) + minetest.set_node({x=-35, y=10, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-35, y=10, z=4}, {name="castrum:cobble"}) + minetest.set_node({x=-45, y=10, z=2}, {name="castrum:cobble"}) + minetest.set_node({x=-45, y=10, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-45, y=10, z=4}, {name="castrum:cobble"}) + minetest.set_node({x=-36, y=10, z=5}, {name="castrum:cobble"}) + minetest.set_node({x=-36, y=10, z=6}, {name="castrum:cobble"}) + minetest.set_node({x=-44, y=10, z=5}, {name="castrum:cobble"}) + minetest.set_node({x=-44, y=10, z=6}, {name="castrum:cobble"}) + minetest.set_node({x=-38, y=10, z=7}, {name="castrum:cobble"}) + minetest.set_node({x=-37, y=10, z=7}, {name="castrum:cobble"}) + minetest.set_node({x=-42, y=10, z=7}, {name="castrum:cobble"}) + minetest.set_node({x=-43, y=10, z=7}, {name="castrum:cobble"}) + minetest.set_node({x=-41, y=10, z=8}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=10, z=8}, {name="castrum:cobble"}) + minetest.set_node({x=-39, y=10, z=8}, {name="castrum:cobble"}) + elseif v+0 == 4 then + minetest.set_node({x=-40, y=10, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=11, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=12, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=13, z=3}, {name="castrum:cobble"}) + minetest.set_node({x=-40, y=14, z=3}, {name="default:water_source"}) + minetest.set_node({x=-40, y=13, z=4}, {name="default:water_source"}) + minetest.set_node({x=-40, y=13, z=2}, {name="default:water_source"}) + minetest.set_node({x=-41, y=13, z=3}, {name="default:water_source"}) + minetest.set_node({x=-39, y=13, z=3}, {name="default:water_source"}) + elseif v+0 == 5 then + minetest.set_node({x=-41, y=9, z=-2}, {name="default:stone_block"}) + minetest.set_node({x=-40, y=10, z=-2}, {name="default:stone_block"}) + minetest.set_node({x=-39, y=9, z=-2}, {name="default:stone_block"}) + minetest.set_node({x=-38, y=10, z=-1}, {name="default:stone_block"}) + minetest.set_node({x=-37, y=9, z=-1}, {name="default:stone_block"}) + minetest.set_node({x=-36, y=10, z=0}, {name="default:stone_block"}) + minetest.set_node({x=-36, y=9, z=1}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=10, z=2}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=9, z=3}, {name="default:stone_block"}) + minetest.set_node({x=-35, y=10, z=4}, {name="default:stone_block"}) + minetest.set_node({x=-36, y=9, z=5}, {name="default:stone_block"}) + minetest.set_node({x=-36, y=10, z=6}, {name="default:stone_block"}) + minetest.set_node({x=-37, y=9, z=7}, {name="default:stone_block"}) + minetest.set_node({x=-38, y=10, z=7}, {name="default:stone_block"}) + minetest.set_node({x=-39, y=9, z=8}, {name="default:stone_block"}) + minetest.set_node({x=-40, y=10, z=8}, {name="default:stone_block"}) + minetest.set_node({x=-41, y=9, z=8}, {name="default:stone_block"}) + minetest.set_node({x=-42, y=10, z=7}, {name="default:stone_block"}) + minetest.set_node({x=-43, y=9, z=7}, {name="default:stone_block"}) + minetest.set_node({x=-44, y=10, z=6}, {name="default:stone_block"}) + minetest.set_node({x=-44, y=9, z=5}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=10, z=4}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=9, z=3}, {name="default:stone_block"}) + minetest.set_node({x=-45, y=10, z=2}, {name="default:stone_block"}) + minetest.set_node({x=-44, y=9, z=1}, {name="default:stone_block"}) + minetest.set_node({x=-44, y=10, z=0}, {name="default:stone_block"}) + minetest.set_node({x=-43, y=9, z=-1}, {name="default:stone_block"}) + minetest.set_node({x=-42, y=10, z=-1}, {name="default:stone_block"}) + elseif v+0 == 6 then + for k=9,14 do + for i=35,45 do + for j=0,2 do + if minetest.get_node({x=i*(-1), y=k, z=j*(-1)}).name == "castrum:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:stone_block"}) + end + end + for j=0,8 do + if minetest.get_node({x=i*(-1), y=k, z=j}).name == "castrum:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for k=9,14 do + for i=35,45 do + for j=0,2 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + for j=0,8 do + minetest.set_node({x=i*(-1), y=k, z=j}, {name="air"}) + end + end + end + end +end +function Tower1(v,player) + if v+0 == 1 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=9, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=9, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=9, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=9, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=9, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=9, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=9, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=9, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=9, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=9, z=-24}, {name="default:cobble"}) + elseif v+0 == 2 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=10, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=10, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=10, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=10, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=10, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=10, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=10, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=10, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=10, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=10, z=-24}, {name="default:cobble"}) + elseif v+0 == 3 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=11, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=11, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=11, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=11, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=11, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=11, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=11, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=11, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=11, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=11, z=-24}, {name="default:cobble"}) + elseif v+0 == 4 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=12, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=12, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=12, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=12, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=12, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=12, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=12, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=12, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=12, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=12, z=-24}, {name="default:cobble"}) + elseif v+0 == 5 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=13, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=13, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=13, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=13, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=13, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=13, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=13, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=13, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=13, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=13, z=-24}, {name="default:cobble"}) + elseif v+0 == 6 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=14, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=14, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=14, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=14, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=14, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=14, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=14, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=14, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=14, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=14, z=-24}, {name="default:cobble"}) + elseif v+0 == 7 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=15, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=15, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=15, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=15, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=15, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=15, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=15, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=15, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=15, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=15, z=-24}, {name="default:cobble"}) + elseif v+0 == 8 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=16, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=16, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=16, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=16, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=16, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=16, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=16, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=16, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=16, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=16, z=-24}, {name="default:cobble"}) + elseif v+0 == 9 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=17, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=17, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=17, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=17, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=17, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=17, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=17, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=17, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=17, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=17, z=-24}, {name="default:cobble"}) + elseif v+0 == 10 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=18, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=18, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=18, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=18, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=18, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=18, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=18, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=18, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=18, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=18, z=-24}, {name="default:cobble"}) + elseif v+0 == 11 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-6, y=19, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-13, y=19, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-13, y=19, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-12, y=19, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-12, y=19, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=19, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=19, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-9, y=19, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-8, y=19, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-7, y=19, z=-24}, {name="default:cobble"}) + elseif v+0 == 12 then + for j=6,13 do + for i=24,31 do + minetest.set_node({x=j*(-1), y=20, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-13, y=20, z=-24}, {name="air"}) + minetest.set_node({x=-13, y=20, z=-25}, {name="air"}) + minetest.set_node({x=-13, y=20, z=-26}, {name="air"}) + minetest.set_node({x=-12, y=20, z=-24}, {name="air"}) + minetest.set_node({x=-12, y=20, z=-25}, {name="air"}) + minetest.set_node({x=-11, y=20, z=-24}, {name="air"}) + elseif v+0 == 13 then + for i=6,13 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=-31}, {name="default:cobble"}) + end + end + for i=24,31 do + if i%2 == 1 then + minetest.set_node({x=-6, y=21, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-12, y=21, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=21, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=21, z=-25}, {name="default:cobble"}) + elseif v+0 == 14 then + minetest.set_node({x=-12, y=22, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=22, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=22, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-6, y=22, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-12, y=22, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-6, y=22, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-12, y=23, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-11, y=23, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-10, y=23, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-12, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-11, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-7, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=-26}, {name="default:cobble"}) + elseif v+0 == 15 then + minetest.set_node({x=-11, y=24, z=-26}, {name="default:cobble"}) + for i=27,31 do + minetest.set_node({x=-12, y=24, z=i*(-1)}, {name="default:cobble"}) + end + for i=25,31 do + minetest.set_node({x=-6, y=24, z=i*(-1)}, {name="default:cobble"}) + end + for i=6,12 do + minetest.set_node({x=i*(-1), y=24, z=-31}, {name="default:cobble"}) + end + for i=6,10 do + minetest.set_node({x=i*(-1), y=24, z=-25}, {name="default:cobble"}) + end + elseif v+0 == 16 then + for i=27,30 do + minetest.set_node({x=-11, y=25, z=i*(-1)}, {name="default:cobble"}) + end + for i=26,30 do + minetest.set_node({x=-7, y=25, z=i*(-1)}, {name="default:cobble"}) + end + for i=7,11 do + minetest.set_node({x=i*(-1), y=25, z=-30}, {name="default:cobble"}) + end + for i=7,10 do + minetest.set_node({x=i*(-1), y=25, z=-26}, {name="default:cobble"}) + end + elseif v+0 == 17 then + for i=27,29 do + minetest.set_node({x=-10, y=26, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-8, y=26, z=i*(-1)}, {name="default:cobble"}) + end + for i=8,10 do + minetest.set_node({x=i*(-1), y=26, z=-29}, {name="default:cobble"}) + minetest.set_node({x=i*(-1), y=26, z=-27}, {name="default:cobble"}) + end + minetest.set_node({x=-9, y=27, z=-28}, {name="default:cobble"}) + elseif v+0 == 18 then + minetest.set_node({x=-9, y=21, z=-30}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-7, y=21, z=-28}, {name="castrum:castrum_knight1"}) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-28}, above={x=-7, y=21, z=-28}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-28}, above={x=-7, y=21, z=-28}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-28}, above={x=-7, y=21, z=-28}}, 1) + elseif v+0 == 19 then + for i=6,13 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:stone_block"}) + end + end + for i=6,13 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:stone_block"}) + end + end + for i=6,13 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%4 == 3 then + minetest.set_node({x=-6, y=20, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=16, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=12, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%2 == 0 then + minetest.set_node({x=-6, y=19, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=17, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=15, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=13, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=11, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=9, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%4 == 1 then + minetest.set_node({x=-6, y=18, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=14, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=10, z=i*(-1)}, {name="default:stone_block"}) + end + end + for k=9,20 do + if k%2 == 1 then + minetest.set_node({x=-7, y=k, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-9, y=k, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-11, y=k, z=-26}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=k, z=-28}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=k, z=-30}, {name="default:stone_block"}) + end + end + minetest.set_node({x=-8, y=10, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-8, y=14, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-8, y=18, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-10, y=12, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-10, y=16, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=10, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=14, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=18, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=12, z=-27}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=16, z=-27}, {name="default:stone_block"}) + elseif v+0 == 20 then + for j=6,13 do + for i=24,31 do + for k=9,27 do + if minetest.get_node({x=j*(-1), y=k, z=i*(-1)}).name == "default:cobble" then + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for j=6,13 do + for i=24,31 do + for k=9,27 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + end +end +function Tower2(v,player) + if v+0 == 1 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=9, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=9, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=9, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=9, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=9, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=9, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=9, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=9, z=-30}, {name="default:cobble"}) + elseif v+0 == 2 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=10, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=10, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=10, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=10, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=10, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=10, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=10, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=10, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=-30}, {name="default:cobble"}) + elseif v+0 == 3 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=11, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=11, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=11, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=11, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=11, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=11, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=11, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=11, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=11, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=11, z=-30}, {name="default:cobble"}) + elseif v+0 == 4 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=12, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=12, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=12, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=12, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=12, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=12, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=12, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=12, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=12, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=12, z=-30}, {name="default:cobble"}) + elseif v+0 == 5 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=13, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=13, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=13, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=13, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=13, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=13, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=13, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=13, z=-30}, {name="default:cobble"}) + elseif v+0 == 6 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=14, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=14, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=14, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=14, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=14, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=14, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=14, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=14, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=14, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=14, z=-30}, {name="default:cobble"}) + elseif v+0 == 7 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=15, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=15, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=15, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=15, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=15, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=15, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=15, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=15, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=15, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=15, z=-30}, {name="default:cobble"}) + elseif v+0 == 8 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=16, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=16, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=16, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=16, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=16, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=16, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=16, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=16, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=16, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=16, z=-30}, {name="default:cobble"}) + elseif v+0 == 9 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=17, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=17, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=17, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=17, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=17, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=17, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=17, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=17, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=17, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=17, z=-30}, {name="default:cobble"}) + elseif v+0 == 10 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=18, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=18, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=18, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=18, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=18, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=18, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=18, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=18, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=18, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=18, z=-30}, {name="default:cobble"}) + elseif v+0 == 11 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:cobble"}) + end + for i=24,31 do + minetest.set_node({x=-74, y=19, z=i*(-1)}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=19, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-72, y=19, z=-24}, {name="default:cobble"}) + minetest.set_node({x=-71, y=19, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-70, y=19, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=19, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-68, y=19, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-68, y=19, z=-28}, {name="default:cobble"}) + minetest.set_node({x=-67, y=19, z=-29}, {name="default:cobble"}) + minetest.set_node({x=-67, y=19, z=-30}, {name="default:cobble"}) + elseif v+0 == 12 then + for j=67,74 do + for i=24,31 do + minetest.set_node({x=j*(-1), y=20, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-67, y=20, z=-24}, {name="air"}) + minetest.set_node({x=-67, y=20, z=-25}, {name="air"}) + minetest.set_node({x=-67, y=20, z=-26}, {name="air"}) + minetest.set_node({x=-68, y=20, z=-24}, {name="air"}) + minetest.set_node({x=-68, y=20, z=-25}, {name="air"}) + minetest.set_node({x=-69, y=20, z=-24}, {name="air"}) + elseif v+0 == 13 then + for i=67,74 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=-31}, {name="default:cobble"}) + end + end + for i=24,31 do + if i%2 == 1 then + minetest.set_node({x=-74, y=21, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-68, y=21, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-69, y=21, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-70, y=21, z=-25}, {name="default:cobble"}) + elseif v+0 == 14 then + minetest.set_node({x=-68, y=22, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-69, y=22, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-70, y=22, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-74, y=22, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-68, y=22, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-74, y=22, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-68, y=23, z=-27}, {name="default:cobble"}) + minetest.set_node({x=-69, y=23, z=-26}, {name="default:cobble"}) + minetest.set_node({x=-70, y=23, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-68, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=-25}, {name="default:cobble"}) + minetest.set_node({x=-69, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-73, y=23, z=-31}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=-30}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=-26}, {name="default:cobble"}) + elseif v+0 == 15 then + minetest.set_node({x=-69, y=24, z=-26}, {name="default:cobble"}) + for i=27,31 do + minetest.set_node({x=-68, y=24, z=i*(-1)}, {name="default:cobble"}) + end + for i=25,31 do + minetest.set_node({x=-74, y=24, z=i*(-1)}, {name="default:cobble"}) + end + for i=68,74 do + minetest.set_node({x=i*(-1), y=24, z=-31}, {name="default:cobble"}) + end + for i=70,74 do + minetest.set_node({x=i*(-1), y=24, z=-25}, {name="default:cobble"}) + end + elseif v+0 == 16 then + for i=27,30 do + minetest.set_node({x=-69, y=25, z=i*(-1)}, {name="default:cobble"}) + end + for i=26,30 do + minetest.set_node({x=-73, y=25, z=i*(-1)}, {name="default:cobble"}) + end + for i=69,73 do + minetest.set_node({x=i*(-1), y=25, z=-30}, {name="default:cobble"}) + end + for i=70,73 do + minetest.set_node({x=i*(-1), y=25, z=-26}, {name="default:cobble"}) + end + elseif v+0 == 17 then + for i=27,29 do + minetest.set_node({x=-72, y=26, z=i*(-1)}, {name="default:cobble"}) + minetest.set_node({x=-70, y=26, z=i*(-1)}, {name="default:cobble"}) + end + for i=70,72 do + minetest.set_node({x=i*(-1), y=26, z=-29}, {name="default:cobble"}) + minetest.set_node({x=i*(-1), y=26, z=-27}, {name="default:cobble"}) + end + minetest.set_node({x=-71, y=27, z=-28}, {name="default:cobble"}) + elseif v+0 == 18 then + minetest.set_node({x=-71, y=21, z=-30}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-73, y=21, z=-28}, {name="castrum:castrum_knight1"}) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=-28}, above={x=-73, y=21, z=-28}}, 1) + elseif v+0 == 19 then + for i=67,74 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=-31}, {name="default:stone_block"}) + end + end + for i=67,74 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=-31}, {name="default:stone_block"}) + end + end + for i=67,74 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=-31}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=-31}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%4 == 3 then + minetest.set_node({x=-74, y=20, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=16, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=12, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%2 == 0 then + minetest.set_node({x=-74, y=19, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=17, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=15, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=13, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=11, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=24,31 do + if i%4 == 1 then + minetest.set_node({x=-74, y=18, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=14, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=10, z=i*(-1)}, {name="default:stone_block"}) + end + end + for k=9,20 do + if k%2 == 1 then + minetest.set_node({x=-73, y=k, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-71, y=k, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-69, y=k, z=-26}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=k, z=-28}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=k, z=-30}, {name="default:stone_block"}) + end + end + + minetest.set_node({x=-72, y=10, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=14, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=18, z=-24}, {name="default:stone_block"}) + minetest.set_node({x=-70, y=12, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-70, y=16, z=-25}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=10, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=14, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=18, z=-29}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=12, z=-27}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=16, z=-27}, {name="default:stone_block"}) + elseif v+0 == 20 then + for j=67,74 do + for i=24,31 do + for k=9,27 do + if minetest.get_node({x=j*(-1), y=k, z=i*(-1)}).name == "default:cobble" then + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for j=67,74 do + for i=24,31 do + for k=9,27 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + end +end +function Tower3(v,player) + if v+0 == 1 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=9, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=9, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=9, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=9, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=9, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=9, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=9, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=9, z=36}, {name="default:cobble"}) + elseif v+0 == 2 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=10, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=10, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=10, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=10, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=10, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=10, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=10, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=10, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=36}, {name="default:cobble"}) + elseif v+0 == 3 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=11, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=11, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=11, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=11, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=11, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=11, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=11, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=11, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=11, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=11, z=36}, {name="default:cobble"}) + elseif v+0 == 4 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=12, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=12, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=12, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=12, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=12, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=12, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=12, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=12, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=12, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=12, z=36}, {name="default:cobble"}) + elseif v+0 == 5 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=13, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=13, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=13, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=13, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=13, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=13, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=13, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=13, z=36}, {name="default:cobble"}) + elseif v+0 == 6 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=14, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=14, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=14, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=14, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=14, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=14, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=14, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=14, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=14, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=14, z=36}, {name="default:cobble"}) + elseif v+0 == 7 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=15, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=15, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=15, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=15, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=15, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=15, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=15, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=15, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=15, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=15, z=36}, {name="default:cobble"}) + elseif v+0 == 8 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=16, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=16, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=16, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=16, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=16, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=16, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=16, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=16, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=16, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=16, z=36}, {name="default:cobble"}) + elseif v+0 == 9 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=17, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=17, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=17, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=17, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=17, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=17, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=17, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=17, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=17, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=17, z=36}, {name="default:cobble"}) + elseif v+0 == 10 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=18, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=18, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=18, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=18, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=18, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=18, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=18, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=18, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=18, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=18, z=36}, {name="default:cobble"}) + elseif v+0 == 11 then + for i=67,74 do + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-74, y=19, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-73, y=19, z=30}, {name="default:cobble"}) + minetest.set_node({x=-72, y=19, z=30}, {name="default:cobble"}) + minetest.set_node({x=-71, y=19, z=31}, {name="default:cobble"}) + minetest.set_node({x=-70, y=19, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=19, z=32}, {name="default:cobble"}) + minetest.set_node({x=-68, y=19, z=33}, {name="default:cobble"}) + minetest.set_node({x=-68, y=19, z=34}, {name="default:cobble"}) + minetest.set_node({x=-67, y=19, z=35}, {name="default:cobble"}) + minetest.set_node({x=-67, y=19, z=36}, {name="default:cobble"}) + elseif v+0 == 12 then + for j=67,74 do + for i=30,37 do + minetest.set_node({x=j*(-1), y=20, z=i}, {name="default:cobble"}) + end + end + minetest.set_node({x=-67, y=20, z=30}, {name="air"}) + minetest.set_node({x=-67, y=20, z=31}, {name="air"}) + minetest.set_node({x=-67, y=20, z=32}, {name="air"}) + minetest.set_node({x=-68, y=20, z=30}, {name="air"}) + minetest.set_node({x=-68, y=20, z=31}, {name="air"}) + minetest.set_node({x=-69, y=20, z=30}, {name="air"}) + elseif v+0 == 13 then + for i=67,74 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=37}, {name="default:cobble"}) + end + end + for i=30,37 do + if i%2 == 1 then + minetest.set_node({x=-74, y=21, z=i}, {name="default:cobble"}) + end + end + minetest.set_node({x=-68, y=21, z=33}, {name="default:cobble"}) + minetest.set_node({x=-69, y=21, z=32}, {name="default:cobble"}) + minetest.set_node({x=-70, y=21, z=31}, {name="default:cobble"}) + elseif v+0 == 14 then + minetest.set_node({x=-68, y=22, z=33}, {name="default:cobble"}) + minetest.set_node({x=-69, y=22, z=32}, {name="default:cobble"}) + minetest.set_node({x=-70, y=22, z=31}, {name="default:cobble"}) + minetest.set_node({x=-74, y=22, z=37}, {name="default:cobble"}) + minetest.set_node({x=-68, y=22, z=37}, {name="default:cobble"}) + minetest.set_node({x=-74, y=22, z=31}, {name="default:cobble"}) + minetest.set_node({x=-68, y=23, z=33}, {name="default:cobble"}) + minetest.set_node({x=-69, y=23, z=32}, {name="default:cobble"}) + minetest.set_node({x=-70, y=23, z=31}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-68, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=31}, {name="default:cobble"}) + minetest.set_node({x=-69, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-73, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=36}, {name="default:cobble"}) + minetest.set_node({x=-74, y=23, z=32}, {name="default:cobble"}) + elseif v+0 == 15 then + minetest.set_node({x=-69, y=24, z=32}, {name="default:cobble"}) + for i=33,37 do + minetest.set_node({x=-68, y=24, z=i}, {name="default:cobble"}) + end + for i=31,37 do + minetest.set_node({x=-74, y=24, z=i}, {name="default:cobble"}) + end + for i=68,74 do + minetest.set_node({x=i*(-1), y=24, z=37}, {name="default:cobble"}) + end + for i=70,74 do + minetest.set_node({x=i*(-1), y=24, z=31}, {name="default:cobble"}) + end + elseif v+0 == 16 then + for i=33,36 do + minetest.set_node({x=-69, y=25, z=i}, {name="default:cobble"}) + end + for i=32,36 do + minetest.set_node({x=-73, y=25, z=i}, {name="default:cobble"}) + end + for i=69,73 do + minetest.set_node({x=i*(-1), y=25, z=36}, {name="default:cobble"}) + end + for i=70,73 do + minetest.set_node({x=i*(-1), y=25, z=32}, {name="default:cobble"}) + end + elseif v+0 == 17 then + for i=33,35 do + minetest.set_node({x=-72, y=26, z=i}, {name="default:cobble"}) + minetest.set_node({x=-70, y=26, z=i}, {name="default:cobble"}) + end + for i=70,72 do + minetest.set_node({x=i*(-1), y=26, z=35}, {name="default:cobble"}) + minetest.set_node({x=i*(-1), y=26, z=33}, {name="default:cobble"}) + end + minetest.set_node({x=-71, y=27, z=34}, {name="default:cobble"}) + elseif v+0 == 18 then + minetest.set_node({x=-73, y=21, z=34}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-71, y=21, z=36}, {name="castrum:castrum_knight1"}) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=34}, above={x=-73, y=21, z=34}}, 1) + screwdriver_handler(player, {type="node", under={x=-71, y=21, z=36}, above={x=-71, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-71, y=21, z=36}, above={x=-71, y=21, z=36}}, 1) + elseif v+0 == 19 then + for i=30,37 do + if i%4 == 1 then + minetest.set_node({x=-74, y=20, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=16, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=12, z=i}, {name="default:stone_block"}) + end + end + for i=30,37 do + if i%2 == 0 then + minetest.set_node({x=-74, y=19, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=17, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=15, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=13, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=11, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=i}, {name="default:stone_block"}) + end + end + for i=30,37 do + if i%4 == 3 then + minetest.set_node({x=-74, y=18, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=14, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=10, z=i}, {name="default:stone_block"}) + end + end + for i=67,74 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:stone_block"}) + end + end + for i=67,74 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:stone_block"}) + end + end + for i=67,74 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:stone_block"}) + end + end + for k=9,20 do + if k%2 == 1 then + minetest.set_node({x=-73, y=k, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-71, y=k, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-69, y=k, z=32}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=k, z=34}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=k, z=36}, {name="default:stone_block"}) + end + end + minetest.set_node({x=-72, y=10, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=14, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=18, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-70, y=12, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-70, y=16, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=10, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=14, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-67, y=18, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=12, z=33}, {name="default:stone_block"}) + minetest.set_node({x=-68, y=16, z=33}, {name="default:stone_block"}) + elseif v+0 == 20 then + for j=67,74 do + for i=30,37 do + for k=9,27 do + if minetest.get_node({x=j*(-1), y=k, z=i}).name == "default:cobble" then + minetest.set_node({x=j*(-1), y=k, z=i}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for j=67,74 do + for i=30,37 do + for k=9,27 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + end +end +function Tower4(v,player) + if v+0 == 1 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=9, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=9, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=9, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=9, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=9, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=9, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=9, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=9, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=9, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=9, z=36}, {name="default:cobble"}) + elseif v+0 == 2 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=10, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=10, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=10, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=10, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=10, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=10, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=10, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=10, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=10, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=10, z=36}, {name="default:cobble"}) + elseif v+0 == 3 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=11, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=11, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=11, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=11, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=11, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=11, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=11, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=11, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=11, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=11, z=36}, {name="default:cobble"}) + elseif v+0 == 4 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=12, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=12, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=12, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=12, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=12, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=12, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=12, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=12, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=12, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=12, z=36}, {name="default:cobble"}) + elseif v+0 == 5 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=13, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=13, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=13, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=13, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=13, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=13, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=13, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=13, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=13, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=13, z=36}, {name="default:cobble"}) + elseif v+0 == 6 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=14, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=14, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=14, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=14, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=14, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=14, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=14, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=14, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=14, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=14, z=36}, {name="default:cobble"}) + elseif v+0 == 7 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=15, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=15, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=15, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=15, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=15, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=15, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=15, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=15, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=15, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=15, z=36}, {name="default:cobble"}) + elseif v+0 == 8 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=16, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=16, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=16, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=16, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=16, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=16, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=16, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=16, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=16, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=16, z=36}, {name="default:cobble"}) + elseif v+0 == 9 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=17, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=17, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=17, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=17, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=17, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=17, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=17, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=17, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=17, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=17, z=36}, {name="default:cobble"}) + elseif v+0 == 10 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=18, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=18, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=18, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=18, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=18, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=18, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=18, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=18, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=18, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=18, z=36}, {name="default:cobble"}) + elseif v+0 == 11 then + for i=6,13 do + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:cobble"}) + end + for i=30,37 do + minetest.set_node({x=-6, y=19, z=i}, {name="default:cobble"}) + end + minetest.set_node({x=-7, y=19, z=30}, {name="default:cobble"}) + minetest.set_node({x=-8, y=19, z=30}, {name="default:cobble"}) + minetest.set_node({x=-9, y=19, z=31}, {name="default:cobble"}) + minetest.set_node({x=-10, y=19, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=19, z=32}, {name="default:cobble"}) + minetest.set_node({x=-12, y=19, z=33}, {name="default:cobble"}) + minetest.set_node({x=-12, y=19, z=34}, {name="default:cobble"}) + minetest.set_node({x=-13, y=19, z=35}, {name="default:cobble"}) + minetest.set_node({x=-13, y=19, z=36}, {name="default:cobble"}) + elseif v+0 == 12 then + for j=6,13 do + for i=30,37 do + minetest.set_node({x=j*(-1), y=20, z=i}, {name="default:cobble"}) + end + end + minetest.set_node({x=-13, y=20, z=30}, {name="air"}) + minetest.set_node({x=-13, y=20, z=31}, {name="air"}) + minetest.set_node({x=-13, y=20, z=32}, {name="air"}) + minetest.set_node({x=-12, y=20, z=30}, {name="air"}) + minetest.set_node({x=-12, y=20, z=31}, {name="air"}) + minetest.set_node({x=-11, y=20, z=30}, {name="air"}) + elseif v+0 == 13 then + for i=6,13 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=37}, {name="default:cobble"}) + end + end + for i=30,37 do + if i%2 == 1 then + minetest.set_node({x=-6, y=21, z=i}, {name="default:cobble"}) + end + end + minetest.set_node({x=-12, y=21, z=33}, {name="default:cobble"}) + minetest.set_node({x=-11, y=21, z=32}, {name="default:cobble"}) + minetest.set_node({x=-10, y=21, z=31}, {name="default:cobble"}) + elseif v+0 == 14 then + minetest.set_node({x=-12, y=22, z=33}, {name="default:cobble"}) + minetest.set_node({x=-11, y=22, z=32}, {name="default:cobble"}) + minetest.set_node({x=-10, y=22, z=31}, {name="default:cobble"}) + minetest.set_node({x=-6, y=22, z=37}, {name="default:cobble"}) + minetest.set_node({x=-12, y=22, z=37}, {name="default:cobble"}) + minetest.set_node({x=-6, y=22, z=31}, {name="default:cobble"}) + minetest.set_node({x=-12, y=23, z=33}, {name="default:cobble"}) + minetest.set_node({x=-11, y=23, z=32}, {name="default:cobble"}) + minetest.set_node({x=-10, y=23, z=31}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-12, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=31}, {name="default:cobble"}) + minetest.set_node({x=-11, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-7, y=23, z=37}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=36}, {name="default:cobble"}) + minetest.set_node({x=-6, y=23, z=32}, {name="default:cobble"}) + elseif v+0 == 15 then + minetest.set_node({x=-11, y=24, z=32}, {name="default:cobble"}) + for i=33,37 do + minetest.set_node({x=-12, y=24, z=i}, {name="default:cobble"}) + end + for i=31,37 do + minetest.set_node({x=-6, y=24, z=i}, {name="default:cobble"}) + end + for i=6,12 do + minetest.set_node({x=i*(-1), y=24, z=37}, {name="default:cobble"}) + end + for i=6,10 do + minetest.set_node({x=i*(-1), y=24, z=31}, {name="default:cobble"}) + end + elseif v+0 == 16 then + for i=33,36 do + minetest.set_node({x=-11, y=25, z=i}, {name="default:cobble"}) + end + for i=32,36 do + minetest.set_node({x=-7, y=25, z=i}, {name="default:cobble"}) + end + for i=7,11 do + minetest.set_node({x=i*(-1), y=25, z=36}, {name="default:cobble"}) + end + for i=7,10 do + minetest.set_node({x=i*(-1), y=25, z=32}, {name="default:cobble"}) + end + elseif v+0 == 17 then + for i=33,35 do + minetest.set_node({x=-8, y=26, z=i}, {name="default:cobble"}) + minetest.set_node({x=-10, y=26, z=i}, {name="default:cobble"}) + end + for i=8,10 do + minetest.set_node({x=i*(-1), y=26, z=35}, {name="default:cobble"}) + minetest.set_node({x=i*(-1), y=26, z=33}, {name="default:cobble"}) + end + minetest.set_node({x=-9, y=27, z=34}, {name="default:cobble"}) + elseif v+0 == 18 then + minetest.set_node({x=-7, y=21, z=34}, {name="castrum:castrum_knight1"}) + minetest.set_node({x=-9, y=21, z=36}, {name="castrum:castrum_knight1"}) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=34}, above={x=-7, y=21, z=34}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=34}, above={x=-7, y=21, z=34}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=34}, above={x=-7, y=21, z=34}}, 1) + screwdriver_handler(player, {type="node", under={x=-9, y=21, z=36}, above={x=-9, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-9, y=21, z=36}, above={x=-9, y=21, z=36}}, 1) + elseif v+0 == 19 then + for i=30,37 do + if i%4 == 1 then + minetest.set_node({x=-6, y=20, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=16, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=12, z=i}, {name="default:stone_block"}) + end + end + for i=30,37 do + if i%2 == 0 then + minetest.set_node({x=-6, y=19, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=17, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=15, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=13, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=11, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=9, z=i}, {name="default:stone_block"}) + end + end + for i=30,37 do + if i%4 == 3 then + minetest.set_node({x=-6, y=18, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=14, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=10, z=i}, {name="default:stone_block"}) + end + end + for i=6,13 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:stone_block"}) + end + end + for i=6,13 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:stone_block"}) + end + end + for i=6,13 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:stone_block"}) + end + end + + for k=9,20 do + if k%2 == 1 then + minetest.set_node({x=-7, y=k, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-9, y=k, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-11, y=k, z=32}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=k, z=34}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=k, z=36}, {name="default:stone_block"}) + end + end + minetest.set_node({x=-8, y=10, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-8, y=14, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-8, y=18, z=30}, {name="default:stone_block"}) + minetest.set_node({x=-10, y=12, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-10, y=16, z=31}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=10, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=14, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-13, y=18, z=35}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=12, z=33}, {name="default:stone_block"}) + minetest.set_node({x=-12, y=16, z=33}, {name="default:stone_block"}) + elseif v+0 == 20 then + for j=6,13 do + for i=30,37 do + for k=9,27 do + if minetest.get_node({x=j*(-1), y=k, z=i}).name == "default:cobble" then + minetest.set_node({x=j*(-1), y=k, z=i}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for j=6,13 do + for i=30,37 do + for k=9,27 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + end +end +function Wall_east(v,player) + if v+0 == 1 then + for i=0,29 do + minetest.set_node({x=-6, y=9, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=9, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 2 then + for i=0,29 do + minetest.set_node({x=-6, y=10, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=10, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 3 then + for i=0,29 do + minetest.set_node({x=-6, y=11, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=11, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 4 then + for i=0,29 do + minetest.set_node({x=-6, y=12, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=12, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for i=0,29 do + minetest.set_node({x=-6, y=13, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=13, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 6 then + for i=0,29 do + minetest.set_node({x=-6, y=14, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=14, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 7 then + for i=0,29 do + minetest.set_node({x=-6, y=15, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=15, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 8 then + for i=0,29 do + minetest.set_node({x=-6, y=16, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=16, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 9 then + for i=0,29 do + minetest.set_node({x=-6, y=17, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=17, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 10 then + for i=0,29 do + minetest.set_node({x=-6, y=18, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=18, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 11 then + for i=0,29 do + minetest.set_node({x=-6, y=19, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-6, y=19, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 12 then + for j=6,9 do + for i=0,29 do + minetest.set_node({x=j*(-1), y=20, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=j*(-1), y=20, z=i*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 13 then + for i=0,29 do + if i%2 == 1 then + minetest.set_node({x=-6, y=21, z=i}, {name="default:cobble"}) + end + end + for i=0,23 do + if i%2 == 1 then + minetest.set_node({x=-6, y=21, z=i*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 14 then + minetest.set_node({x=-7, y=21, z=-21}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-7, y=21, z=-17}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-7, y=21, z=-13}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-7, y=21, z=19}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-7, y=21, z=23}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-7, y=21, z=27}, {name="castrum:castrum_knight2"}) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-21}, above={x=-7, y=21, z=-21}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-17}, above={x=-7, y=21, z=-17}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-13}, above={x=-7, y=21, z=-13}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=19}, above={x=-7, y=21, z=19}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=23}, above={x=-7, y=21, z=23}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=27}, above={x=-7, y=21, z=27}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-21}, above={x=-7, y=21, z=-21}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-17}, above={x=-7, y=21, z=-17}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-13}, above={x=-7, y=21, z=-13}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=19}, above={x=-7, y=21, z=19}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=23}, above={x=-7, y=21, z=23}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=27}, above={x=-7, y=21, z=27}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-21}, above={x=-7, y=21, z=-21}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-17}, above={x=-7, y=21, z=-17}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=-13}, above={x=-7, y=21, z=-13}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=19}, above={x=-7, y=21, z=19}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=23}, above={x=-7, y=21, z=23}}, 1) + screwdriver_handler(player, {type="node", under={x=-7, y=21, z=27}, above={x=-7, y=21, z=27}}, 1) + elseif v+0 == 15 then + for i=0,29 do + if i%4 == 1 then + minetest.set_node({x=-6, y=20, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=16, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=12, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%4 == 3 then + minetest.set_node({x=-6, y=20, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=16, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=12, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=0,29 do + if i%2 == 0 then + minetest.set_node({x=-6, y=19, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=17, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=15, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=13, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=11, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=9, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%2 == 0 then + minetest.set_node({x=-6, y=19, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=17, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=15, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=13, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=11, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=9, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=0,29 do + if i%4 == 3 then + minetest.set_node({x=-6, y=18, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=14, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=10, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%4 == 1 then + minetest.set_node({x=-6, y=18, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=14, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-6, y=10, z=i*(-1)}, {name="default:stone_block"}) + end + end + elseif v+0 == 16 then + for i=6,9 do + for k=9,21 do + for j=0,29 do + if minetest.get_node({x=i*(-1), y=k, z=j}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j}, {name="default:stone_block"}) + end + end + for j=0,23 do + if minetest.get_node({x=i*(-1), y=k, z=j*(-1)}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for i=6,9 do + for k=9,21 do + for j=0,29 do + minetest.set_node({x=i*(-1), y=k, z=j}, {name="air"}) + end + for j=0,23 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + end + end + end +end +function Wall_west(v,player) + if v+0 == 1 then + for i=0,29 do + minetest.set_node({x=-74, y=9, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=9, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 2 then + for i=0,29 do + minetest.set_node({x=-74, y=10, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=10, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 3 then + for i=0,29 do + minetest.set_node({x=-74, y=11, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=11, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 4 then + for i=0,29 do + minetest.set_node({x=-74, y=12, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=12, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for i=0,29 do + minetest.set_node({x=-74, y=13, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=13, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 6 then + for i=0,29 do + minetest.set_node({x=-74, y=14, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=14, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 7 then + for i=0,29 do + minetest.set_node({x=-74, y=15, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=15, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 8 then + for i=0,29 do + minetest.set_node({x=-74, y=16, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=16, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 9 then + for i=0,29 do + minetest.set_node({x=-74, y=17, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=17, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 10 then + for i=0,29 do + minetest.set_node({x=-74, y=18, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=18, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 11 then + for i=0,29 do + minetest.set_node({x=-74, y=19, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=-74, y=19, z=i*(-1)}, {name="default:cobble"}) + end + elseif v+0 == 12 then + for j=71,74 do + for i=0,29 do + minetest.set_node({x=j*(-1), y=20, z=i}, {name="default:cobble"}) + end + for i=0,23 do + minetest.set_node({x=j*(-1), y=20, z=i*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 13 then + for i=0,29 do + if i%2 == 1 then + minetest.set_node({x=-74, y=21, z=i}, {name="default:cobble"}) + end + end + for i=0,23 do + if i%2 == 1 then + minetest.set_node({x=-74, y=21, z=i*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 14 then + minetest.set_node({x=-73, y=21, z=-21}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-73, y=21, z=-17}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-73, y=21, z=-13}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-73, y=21, z=19}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-73, y=21, z=23}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-73, y=21, z=27}, {name="castrum:castrum_knight2"}) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=-21}, above={x=-73, y=21, z=-21}}, 1) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=-17}, above={x=-73, y=21, z=-17}}, 1) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=-13}, above={x=-73, y=21, z=-13}}, 1) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=19}, above={x=-73, y=21, z=19}}, 1) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=23}, above={x=-73, y=21, z=23}}, 1) + screwdriver_handler(player, {type="node", under={x=-73, y=21, z=27}, above={x=-73, y=21, z=27}}, 1) + elseif v+0 == 15 then + for i=0,29 do + if i%4 == 1 then + minetest.set_node({x=-74, y=20, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=16, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=12, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%4 == 3 then + minetest.set_node({x=-74, y=20, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=16, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=12, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=0,29 do + if i%2 == 0 then + minetest.set_node({x=-74, y=19, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=17, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=15, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=13, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=11, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%2 == 0 then + minetest.set_node({x=-74, y=19, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=17, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=15, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=13, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=11, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=i*(-1)}, {name="default:stone_block"}) + end + end + for i=0,29 do + if i%4 == 3 then + minetest.set_node({x=-74, y=18, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=14, z=i}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=10, z=i}, {name="default:stone_block"}) + end + end + for i=0,23 do + if i%4 == 1 then + minetest.set_node({x=-74, y=18, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=14, z=i*(-1)}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=10, z=i*(-1)}, {name="default:stone_block"}) + end + end + elseif v+0 == 16 then + for i=71,74 do + for k=9,21 do + for j=0,29 do + if minetest.get_node({x=i*(-1), y=k, z=j}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j}, {name="default:stone_block"}) + end + end + for j=0,23 do + if minetest.get_node({x=i*(-1), y=k, z=j*(-1)}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for i=71,74 do + for k=9,21 do + for j=0,29 do + minetest.set_node({x=i*(-1), y=k, z=j}, {name="air"}) + end + for j=0,23 do + minetest.set_node({x=i*(-1), y=k, z=j*(-1)}, {name="air"}) + end + end + end + + end +end +function Wall_north(v,player) + if v+0 == 1 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:cobble"}) + end + elseif v+0 == 2 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:cobble"}) + end + elseif v+0 == 3 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:cobble"}) + end + elseif v+0 == 4 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:cobble"}) + end + elseif v+0 == 6 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:cobble"}) + end + elseif v+0 == 7 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:cobble"}) + end + elseif v+0 == 8 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:cobble"}) + end + elseif v+0 == 9 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:cobble"}) + end + elseif v+0 == 10 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:cobble"}) + end + elseif v+0 == 11 then + for i=14,66 do + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:cobble"}) + end + elseif v+0 == 12 then + for i=14,66 do + for j=34,37 do + minetest.set_node({x=i*(-1), y=20, z=j}, {name="default:cobble"}) + end + end + elseif v+0 == 13 then + for i=14,66 do + if i%2 == 0 then + minetest.set_node({x=i*(-1), y=21, z=37}, {name="default:cobble"}) + end + end + elseif v+0 == 14 then + minetest.set_node({x=-64, y=21, z=36}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-60, y=21, z=36}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-56, y=21, z=36}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-24, y=21, z=36}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-20, y=21, z=36}, {name="castrum:castrum_knight2"}) + minetest.set_node({x=-16, y=21, z=36}, {name="castrum:castrum_knight2"}) + screwdriver_handler(player, {type="node", under={x=-64, y=21, z=36}, above={x=-64, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-60, y=21, z=36}, above={x=-60, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-56, y=21, z=36}, above={x=-56, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-24, y=21, z=36}, above={x=-24, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-20, y=21, z=36}, above={x=-20, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-16, y=21, z=36}, above={x=-16, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-64, y=21, z=36}, above={x=-64, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-60, y=21, z=36}, above={x=-60, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-56, y=21, z=36}, above={x=-56, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-24, y=21, z=36}, above={x=-24, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-20, y=21, z=36}, above={x=-20, y=21, z=36}}, 1) + screwdriver_handler(player, {type="node", under={x=-16, y=21, z=36}, above={x=-16, y=21, z=36}}, 1) + elseif v+0 == 15 then + for i=14,66 do + if i%4 == 2 then + minetest.set_node({x=i*(-1), y=20, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=16, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=12, z=37}, {name="default:stone_block"}) + end + end + for i=14,66 do + if i%2 == 1 then + minetest.set_node({x=i*(-1), y=19, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=17, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=15, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=13, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=11, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=9, z=37}, {name="default:stone_block"}) + end + end + for i=14,66 do + if i%4 == 0 then + minetest.set_node({x=i*(-1), y=18, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=14, z=37}, {name="default:stone_block"}) + minetest.set_node({x=i*(-1), y=10, z=37}, {name="default:stone_block"}) + end + end + elseif v+0 == 16 then + for i=14,66 do + for j=34,37 do + for k=9,21 do + if minetest.get_node({x=i*(-1), y=k, z=j}).name == "default:cobble" then + minetest.set_node({x=i*(-1), y=k, z=j}, {name="default:stone_block"}) + end + end + end + end + elseif v+0 == 0 then + for i=14,66 do + for j=34,37 do + for k=9,21 do + minetest.set_node({x=i*(-1), y=k, z=j}, {name="air"}) + end + end + end + end +end +function Moat_west(v,player) + if v+0 == 1 then + for i=0,31 do + minetest.set_node({x=-79, y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-79, y=8, z=i}, {name="air"}) + end + elseif v+0 == 2 then + for j=78,80 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-79, y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-79, y=7, z=i}, {name="air"}) + end + elseif v+0 == 3 then + for j=77,81 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for j=78,80 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-79, y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-79, y=6, z=i}, {name="air"}) + end + elseif v+0 == 4 then + for j=76,82 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for j=77,81 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for j=78,80 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-79, y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-79, y=5, z=i}, {name="air"}) + end + elseif v+0 == 5 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="air"}) + end + end + for j=76,82 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for j=77,81 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for j=78,80 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for i=0,31 do + minetest.set_node({x=-79, y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=-79, y=4, z=i}, {name="air"}) + end + elseif v+0 == 6 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=7, z=i}, {name="air"}) + end + end + for j=76,82 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for j=77,81 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for j=78,80 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 7 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=6, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=6, z=i}, {name="air"}) + end + end + for j=76,82 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for j=77,81 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 8 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=5, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=5, z=i}, {name="air"}) + end + end + for j=76,82 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 9 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="air"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="air"}) + end + end + elseif v+0 == 10 then + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=4, z=i*(-1)}, {name="castrum:water"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=4, z=i}, {name="castrum:water"}) + end + end + elseif v+0 == 0 then + for k=4,7 do + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:stone"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="default:stone"}) + end + end + + end + for j=75,83 do + for i=0,31 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + for i=0,37 do + minetest.set_node({x=j*(-1), y=8, z=i}, {name="default:dirt_with_grass"}) + end + end + end +end +function Smithy(v,player) + if v+0 == 1 then + for j=62,69 do + for i=6,14 do + minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-61, y=9, z=-8}, {name="stairs:stair_cobble"}) + minetest.set_node({x=-61, y=9, z=-9}, {name="stairs:stair_cobble"}) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-8}, above={x=-61, y=9, z=-8}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-8}, above={x=-61, y=9, z=-8}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-8}, above={x=-61, y=9, z=-8}}, 1) + + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-9}, above={x=-61, y=9, z=-9}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-9}, above={x=-61, y=9, z=-9}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=-9}, above={x=-61, y=9, z=-9}}, 1) + elseif v+0 == 2 then + for j=62,69 do + minetest.set_node({x=j*(-1), y=10, z=-11}, {name="default:cobble"}) + minetest.set_node({x=j*(-1), y=10, z=-6}, {name="default:cobble"}) + end + for i=6,14 do + minetest.set_node({x=-69, y=10, z=i*(-1)}, {name="default:cobble"}) + end + for j=64,69 do + minetest.set_node({x=j*(-1), y=10, z=-14}, {name="default:cobble"}) + end + minetest.set_node({x=-62, y=10, z=-10}, {name="default:cobble"}) + minetest.set_node({x=-62, y=10, z=-7}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=-13}, {name="default:cobble"}) + minetest.set_node({x=-67, y=10, z=-12}, {name="default:cobble"}) + elseif v+0 == 3 then + for j=62,69 do + minetest.set_node({x=j*(-1), y=11, z=-11}, {name="default:cobble"}) + minetest.set_node({x=j*(-1), y=11, z=-6}, {name="default:cobble"}) + end + for i=6,14 do + minetest.set_node({x=-69, y=11, z=i*(-1)}, {name="default:cobble"}) + end + for j=65,69 do + minetest.set_node({x=j*(-1), y=11, z=-14}, {name="default:cobble"}) + end + minetest.set_node({x=-62, y=11, z=-10}, {name="default:cobble"}) + minetest.set_node({x=-62, y=11, z=-7}, {name="default:cobble"}) + minetest.set_node({x=-62, y=10, z=-9}, {name="doors:door_wood_a"}) + minetest.set_node({x=-62, y=10, z=-8}, {name="doors:door_wood_b"}) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-9}, above={x=-62, y=10, z=-9}}, 1) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-9}, above={x=-62, y=10, z=-9}}, 1) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-9}, above={x=-62, y=10, z=-9}}, 1) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-8}, above={x=-62, y=10, z=-8}}, 1) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-8}, above={x=-62, y=10, z=-8}}, 1) + screwdriver_handler(player, {type="node", under={x=-62, y=10, z=-8}, above={x=-62, y=10, z=-8}}, 1) + elseif v+0 == 4 then + for j=62,69 do + minetest.set_node({x=j*(-1), y=12, z=-11}, {name="default:cobble"}) + minetest.set_node({x=j*(-1), y=12, z=-6}, {name="default:cobble"}) + end + for i=6,14 do + minetest.set_node({x=-69, y=12, z=i*(-1)}, {name="default:cobble"}) + end + for i=6,11 do + minetest.set_node({x=-62, y=12, z=i*(-1)}, {name="default:cobble"}) + end + for j=66,69 do + minetest.set_node({x=j*(-1), y=12, z=-14}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for j=63,68 do + minetest.set_node({x=j*(-1), y=13, z=-10}, {name="default:cobble"}) + minetest.set_node({x=j*(-1), y=13, z=-7}, {name="default:cobble"}) + end + minetest.set_node({x=-63, y=13, z=-9}, {name="default:cobble"}) + minetest.set_node({x=-63, y=13, z=-8}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=-9}, {name="default:cobble"}) + minetest.set_node({x=-68, y=13, z=-8}, {name="default:cobble"}) + elseif v+0 == 6 then + for j=64,67 do + minetest.set_node({x=j*(-1), y=14, z=-9}, {name="default:cobble"}) + minetest.set_node({x=j*(-1), y=14, z=-8}, {name="default:cobble"}) + end + minetest.set_node({x=-68, y=10, z=-13}, {name="default:lava_source"}) + minetest.set_node({x=-68, y=10, z=-12}, {name="default:lava_source"}) + elseif v+0 == 0 then + for j=61,69 do + for i=6,14 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + end +end +function Stable(v,player) + if v+0 == 1 then + for j=66,69 do + minetest.set_node({x=j*(-1), y=9, z=-1}, {name="default:wood"}) + minetest.set_node({x=j*(-1), y=9, z=7}, {name="default:wood"}) + end + for i=0,6 do + minetest.set_node({x=-69, y=9, z=i}, {name="default:wood"}) + end + elseif v+0 == 2 then + for j=66,69 do + minetest.set_node({x=j*(-1), y=10, z=-1}, {name="default:wood"}) + minetest.set_node({x=j*(-1), y=10, z=7}, {name="default:wood"}) + end + for i=0,6 do + minetest.set_node({x=-69, y=10, z=i}, {name="default:wood"}) + end + elseif v+0 == 3 then + for j=66,69 do + minetest.set_node({x=j*(-1), y=11, z=-1}, {name="default:wood"}) + minetest.set_node({x=j*(-1), y=11, z=7}, {name="default:wood"}) + end + for i=0,6 do + minetest.set_node({x=-69, y=11, z=i}, {name="default:wood"}) + end + elseif v+0 == 4 then + for j=66,68 do + minetest.set_node({x=j*(-1), y=12, z=0}, {name="default:wood"}) + minetest.set_node({x=j*(-1), y=12, z=6}, {name="default:wood"}) + end + for i=1,5 do + minetest.set_node({x=-68, y=12, z=i}, {name="default:wood"}) + end + elseif v+0 == 5 then + for i=1,5 do + minetest.set_node({x=-67, y=13, z=i}, {name="default:wood"}) + minetest.set_node({x=-66, y=13, z=i}, {name="default:wood"}) + end + elseif v+0 == 6 then + for j=61,65 do + minetest.set_node({x=j*(-1), y=9, z=-1}, {name="default:fence_wood"}) + minetest.set_node({x=j*(-1), y=9, z=7}, {name="default:fence_wood"}) + end + for i=0,6 do + minetest.set_node({x=-61, y=9, z=i}, {name="default:fence_wood"}) + end + minetest.set_node({x=-61, y=9, z=3}, {name="doors:gate_wood_closed"}) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=3}, above={x=-61, y=9, z=3}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=3}, above={x=-61, y=9, z=3}}, 1) + screwdriver_handler(player, {type="node", under={x=-61, y=9, z=3}, above={x=-61, y=9, z=3}}, 1) + elseif v+0 == 7 then + minetest.set_node({x=-67, y=9, z=0}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=1}, {name="default:cobble"}) + minetest.set_node({x=-68, y=9, z=0}, {name="default:river_water_source"}) + minetest.set_node({x=-68, y=9, z=6}, {name="farming:straw"}) + minetest.set_node({x=-68, y=10, z=6}, {name="farming:straw"}) + minetest.set_node({x=-67, y=9, z=6}, {name="farming:straw"}) + minetest.set_node({x=-68, y=9, z=5}, {name="farming:straw"}) + elseif v+0 == 0 then + for j=61,69 do + for i=0,7 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + for j=61,69 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=-1}, {name="air"}) + end + end + end +end +function Mine(v,player) + if v+0 == 1 then + minetest.set_node({x=-16, y=9, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=9, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=9, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-11, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-14}, {name="default:stone_with_coal"}) + minetest.set_node({x=-20, y=9, z=-15}, {name="default:chest"}) + screwdriver_handler(player, {type="node", under={x=-20, y=9, z=-15}, above={x=-20, y=9, z=-15}}, 1) + elseif v+0 == 2 then + minetest.set_node({x=-17, y=9, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-16, y=9, z=-6}, {name="default:stone_with_coal"}) + minetest.set_node({x=-15, y=9, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-16, y=9, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-16, y=10, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-19, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=9, z=-9}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=9, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=10, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=9, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=9, z=-12}, {name="default:stone_with_coal"}) + minetest.set_node({x=-16, y=9, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=9, z=-14}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=10, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-15, y=9, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=9, z=-12}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=10, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=9, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-12, y=9, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-9}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=10, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-12, y=9, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-11, y=9, z=-9}, {name="default:stone_with_coal"}) + minetest.set_node({x=-11, y=9, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-11, y=10, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=9, z=-14}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=9, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-12, y=9, z=-14}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=10, z=-14}, {name="default:stone_with_coal"}) + elseif v+0 == 3 then + minetest.set_node({x=-16, y=11, z=-7}, {name="default:stone_with_coal"}) + minetest.set_node({x=-18, y=11, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-17, y=11, z=-13}, {name="default:stone_with_coal"}) + minetest.set_node({x=-14, y=11, z=-11}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=11, z=-8}, {name="default:stone_with_coal"}) + minetest.set_node({x=-11, y=11, z=-10}, {name="default:stone_with_coal"}) + minetest.set_node({x=-13, y=11, z=-14}, {name="default:stone_with_coal"}) + + minetest.set_node({x=-19, y=9, z=-12}, {name="default:stone_with_iron"}) + minetest.set_node({x=-18, y=9, z=-8}, {name="default:stone_with_iron"}) + minetest.set_node({x=-15, y=9, z=-9}, {name="default:stone_with_iron"}) + minetest.set_node({x=-15, y=9, z=-13}, {name="default:stone_with_iron"}) + minetest.set_node({x=-14, y=9, z=-6}, {name="default:stone_with_iron"}) + minetest.set_node({x=-12, y=9, z=-12}, {name="default:stone_with_iron"}) + minetest.set_node({x=-11, y=9, z=-7}, {name="default:stone_with_iron"}) + + + elseif v+0 == 0 then + for j=11,19 do + for i=6,14 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + minetest.set_node({x=-20, y=9, z=-15}, {name="air"}) + end +end +function Quarry(v,player) + if v+0 == 1 then + minetest.set_node({x=-17, y=9, z=6}, {name="default:stone"}) + minetest.set_node({x=-16, y=9, z=7}, {name="default:stone"}) + minetest.set_node({x=-15, y=9, z=6}, {name="default:stone"}) + minetest.set_node({x=-16, y=9, z=5}, {name="default:stone"}) + minetest.set_node({x=-16, y=10, z=6}, {name="default:stone"}) + minetest.set_node({x=-19, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-18, y=9, z=4}, {name="default:stone"}) + minetest.set_node({x=-17, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-18, y=9, z=2}, {name="default:stone"}) + minetest.set_node({x=-18, y=10, z=3}, {name="default:stone"}) + minetest.set_node({x=-18, y=9, z=0}, {name="default:stone"}) + minetest.set_node({x=-17, y=9, z=1}, {name="default:stone"}) + minetest.set_node({x=-16, y=9, z=0}, {name="default:stone"}) + minetest.set_node({x=-17, y=9, z=-1}, {name="default:stone"}) + minetest.set_node({x=-17, y=10, z=0}, {name="default:stone"}) + minetest.set_node({x=-15, y=9, z=2}, {name="default:stone"}) + minetest.set_node({x=-14, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=2}, {name="default:stone"}) + minetest.set_node({x=-14, y=9, z=1}, {name="default:stone"}) + minetest.set_node({x=-14, y=10, z=2}, {name="default:stone"}) + minetest.set_node({x=-14, y=9, z=5}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=6}, {name="default:stone"}) + minetest.set_node({x=-12, y=9, z=5}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=4}, {name="default:stone"}) + minetest.set_node({x=-13, y=10, z=5}, {name="default:stone"}) + minetest.set_node({x=-12, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-11, y=9, z=4}, {name="default:stone"}) + minetest.set_node({x=-11, y=9, z=2}, {name="default:stone"}) + minetest.set_node({x=-11, y=10, z=3}, {name="default:stone"}) + minetest.set_node({x=-14, y=9, z=-1}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=0}, {name="default:stone"}) + minetest.set_node({x=-12, y=9, z=-1}, {name="default:stone"}) + minetest.set_node({x=-13, y=10, z=-1}, {name="default:stone"}) + elseif v+0 == 2 then + minetest.set_node({x=-16, y=11, z=6}, {name="default:stone"}) + minetest.set_node({x=-18, y=11, z=3}, {name="default:stone"}) + minetest.set_node({x=-17, y=11, z=0}, {name="default:stone"}) + minetest.set_node({x=-14, y=11, z=2}, {name="default:stone"}) + minetest.set_node({x=-13, y=11, z=5}, {name="default:stone"}) + minetest.set_node({x=-11, y=11, z=3}, {name="default:stone"}) + minetest.set_node({x=-13, y=11, z=-1}, {name="default:stone"}) + minetest.set_node({x=-19, y=9, z=1}, {name="default:desert_stone"}) + minetest.set_node({x=-18, y=9, z=5}, {name="default:desert_stone"}) + minetest.set_node({x=-15, y=9, z=4}, {name="default:desert_stone"}) + minetest.set_node({x=-15, y=9, z=0}, {name="default:desert_stone"}) + minetest.set_node({x=-14, y=9, z=7}, {name="default:desert_stone"}) + minetest.set_node({x=-12, y=9, z=1}, {name="default:desert_stone"}) + minetest.set_node({x=-11, y=9, z=6}, {name="default:desert_stone"}) + elseif v+0 == 0 then + for j=11,19 do + for i=0,7 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + for j=11,19 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=-1}, {name="air"}) + end + end + minetest.set_node({x=-16, y=9, z=6}, {name="default:stone"}) + minetest.set_node({x=-18, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-17, y=9, z=0}, {name="default:stone"}) + minetest.set_node({x=-14, y=9, z=2}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=5}, {name="default:stone"}) + minetest.set_node({x=-11, y=9, z=3}, {name="default:stone"}) + minetest.set_node({x=-13, y=9, z=-1}, {name="default:stone"}) + end +end +function Tree(v,player) + if v+0 == 1 then + minetest.set_node({x=-15, y=9, z=16}, {name="default:tree"}) + minetest.set_node({x=-15, y=10, z=16}, {name="default:leaves"}) + minetest.set_node({x=-14, y=9, z=16}, {name="default:leaves"}) + minetest.set_node({x=-16, y=9, z=16}, {name="default:leaves"}) + minetest.set_node({x=-15, y=9, z=15}, {name="default:leaves"}) + minetest.set_node({x=-15, y=9, z=17}, {name="default:leaves"}) + minetest.set_node({x=-20, y=9, z=11}, {name="default:chest"}) + screwdriver_handler(player, {type="node", under={x=-20, y=9, z=11}, above={x=-20, y=9, z=11}}, 1) + elseif v+0 == 2 then + minetest.set_node({x=-15, y=10, z=16}, {name="default:tree"}) + minetest.set_node({x=-15, y=11, z=16}, {name="default:tree"}) + minetest.set_node({x=-15, y=12, z=16}, {name="default:leaves"}) + minetest.set_node({x=-14, y=11, z=16}, {name="default:leaves"}) + minetest.set_node({x=-16, y=11, z=16}, {name="default:leaves"}) + minetest.set_node({x=-15, y=11, z=17}, {name="default:leaves"}) + minetest.set_node({x=-15, y=11, z=15}, {name="default:leaves"}) + minetest.set_node({x=-14, y=11, z=15}, {name="default:leaves"}) + minetest.set_node({x=-14, y=11, z=17}, {name="default:leaves"}) + minetest.set_node({x=-16, y=11, z=15}, {name="default:leaves"}) + minetest.set_node({x=-16, y=11, z=17}, {name="default:leaves"}) + minetest.set_node({x=-14, y=9, z=16}, {name="air"}) + minetest.set_node({x=-16, y=9, z=16}, {name="air"}) + minetest.set_node({x=-15, y=9, z=15}, {name="air"}) + minetest.set_node({x=-15, y=9, z=17}, {name="air"}) + elseif v+0 == 3 then + minetest.set_node({x=-15, y=12, z=16}, {name="default:tree"}) + minetest.set_node({x=-14, y=11, z=16}, {name="air"}) + minetest.set_node({x=-16, y=11, z=16}, {name="air"}) + minetest.set_node({x=-15, y=11, z=17}, {name="air"}) + minetest.set_node({x=-15, y=11, z=15}, {name="air"}) + minetest.set_node({x=-14, y=11, z=15}, {name="air"}) + minetest.set_node({x=-14, y=11, z=17}, {name="air"}) + minetest.set_node({x=-16, y=11, z=15}, {name="air"}) + minetest.set_node({x=-16, y=11, z=17}, {name="air"}) + minetest.set_node({x=-14, y=12, z=16}, {name="default:leaves"}) + minetest.set_node({x=-16, y=12, z=16}, {name="default:leaves"}) + minetest.set_node({x=-15, y=12, z=17}, {name="default:leaves"}) + minetest.set_node({x=-15, y=12, z=15}, {name="default:leaves"}) + minetest.set_node({x=-14, y=12, z=15}, {name="default:leaves"}) + minetest.set_node({x=-14, y=12, z=17}, {name="default:leaves"}) + minetest.set_node({x=-16, y=12, z=15}, {name="default:leaves"}) + minetest.set_node({x=-16, y=12, z=17}, {name="default:leaves"}) + minetest.set_node({x=-17, y=12, z=16}, {name="default:leaves"}) + minetest.set_node({x=-13, y=12, z=16}, {name="default:leaves"}) + minetest.set_node({x=-15, y=12, z=14}, {name="default:leaves"}) + minetest.set_node({x=-15, y=12, z=18}, {name="default:leaves"}) + minetest.set_node({x=-15, y=13, z=16}, {name="default:leaves"}) + minetest.set_node({x=-14, y=13, z=16}, {name="default:leaves"}) + minetest.set_node({x=-16, y=13, z=16}, {name="default:leaves"}) + minetest.set_node({x=-15, y=13, z=17}, {name="default:leaves"}) + minetest.set_node({x=-15, y=13, z=15}, {name="default:leaves"}) + minetest.set_node({x=-12, y=9, z=19}, {name="default:jungletree"}) + minetest.set_node({x=-12, y=10, z=19}, {name="default:jungleleaves"}) + minetest.set_node({x=-11, y=9, z=19}, {name="default:jungleleaves"}) + minetest.set_node({x=-13, y=9, z=19}, {name="default:jungleleaves"}) + minetest.set_node({x=-12, y=9, z=18}, {name="default:jungleleaves"}) + minetest.set_node({x=-12, y=9, z=20}, {name="default:jungleleaves"}) + elseif v+0 == 0 then + for j=11,19 do + for i=12,20 do + for k=9,14 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + minetest.set_node({x=-20, y=9, z=11}, {name="air"}) + end +end +function Pier(v,player) + if v+0 == 1 then + for j=4,8 do + for i=52,53 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-8, y=7, z=-53}, {name="default:wood"}) + minetest.set_node({x=-8, y=6, z=-53}, {name="default:wood"}) + minetest.set_node({x=-4, y=7, z=-53}, {name="default:wood"}) + minetest.set_node({x=-4, y=6, z=-53}, {name="default:wood"}) + elseif v+0 == 2 then + for j=4,8 do + for i=54,56 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-8, y=7, z=-56}, {name="default:wood"}) + minetest.set_node({x=-8, y=6, z=-56}, {name="default:wood"}) + minetest.set_node({x=-4, y=7, z=-56}, {name="default:wood"}) + minetest.set_node({x=-4, y=6, z=-56}, {name="default:wood"}) + elseif v+0 == 3 then + for j=4,8 do + for i=57,59 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-8, y=7, z=-59}, {name="default:wood"}) + minetest.set_node({x=-8, y=6, z=-59}, {name="default:wood"}) + minetest.set_node({x=-4, y=7, z=-59}, {name="default:wood"}) + minetest.set_node({x=-4, y=6, z=-59}, {name="default:wood"}) + elseif v+0 == 4 then + for j=4,8 do + for i=60,62 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-8, y=7, z=-62}, {name="default:wood"}) + minetest.set_node({x=-8, y=6, z=-62}, {name="default:wood"}) + minetest.set_node({x=-4, y=7, z=-62}, {name="default:wood"}) + minetest.set_node({x=-4, y=6, z=-62}, {name="default:wood"}) + elseif v+0 == 5 then + for j=4,8 do + for i=63,65 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-8, y=7, z=-65}, {name="default:wood"}) + minetest.set_node({x=-8, y=6, z=-65}, {name="default:wood"}) + minetest.set_node({x=-4, y=7, z=-65}, {name="default:wood"}) + minetest.set_node({x=-4, y=6, z=-65}, {name="default:wood"}) + minetest.set_node({x=-8, y=8, z=-58}, {name="castrum:ship1"}) + minetest.set_node({x=-4, y=8, z=-58}, {name="castrum:comming_soon"}) + elseif v+0 == 6 then + for j=4,8 do + for i=52,65 do + for k=6,8 do + if minetest.get_node({x=j*(-1), y=k, z=i*(-1)}).name == "default:wood" then + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:junglewood"}) + end + end + end + end + for j=121,125 do + for i=38,51 do + for k=6,8 do + if minetest.get_node({x=j, y=k, z=i}).name == "default:wood" then + minetest.set_node({x=j, y=k, z=i}, {name="default:junglewood"}) + end + end + end + end + elseif v+0 == 0 then + for j=4,8 do + for i=52,65 do + for k=6,7 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:water_source"}) + end + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + end + for j=121,125 do + for i=38,51 do + for k=6,8 do + if minetest.get_node({x=j, y=k, z=i}).name == "default:junglewood" then + minetest.set_node({x=j, y=k, z=i}, {name="default:wood"}) + end + end + end + end + end +end +function Ship1(v,player) + if v+0 == 1 then + for j=11,15 do + for i=54,62 do + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-12, y=7, z=-63}, {name="default:wood"}) + minetest.set_node({x=-13, y=7, z=-63}, {name="default:wood"}) + minetest.set_node({x=-14, y=7, z=-63}, {name="default:wood"}) + minetest.set_node({x=-13, y=7, z=-64}, {name="default:wood"}) + elseif v+0 == 2 then + for j=10,16 do + minetest.set_node({x=j*(-1), y=8, z=-54}, {name="default:wood"}) + end + for j=11,15 do + minetest.set_node({x=j*(-1), y=9, z=-53}, {name="default:wood"}) + end + for i=55,62 do + minetest.set_node({x=-10, y=8, z=i*(-1)}, {name="default:wood"}) + minetest.set_node({x=-16, y=8, z=i*(-1)}, {name="default:wood"}) + end + minetest.set_node({x=-16, y=9, z=-54}, {name="default:wood"}) + minetest.set_node({x=-10, y=9, z=-54}, {name="default:wood"}) + minetest.set_node({x=-11, y=8, z=-63}, {name="default:wood"}) + minetest.set_node({x=-12, y=8, z=-64}, {name="default:wood"}) + minetest.set_node({x=-13, y=8, z=-65}, {name="default:wood"}) + minetest.set_node({x=-14, y=8, z=-64}, {name="default:wood"}) + minetest.set_node({x=-15, y=8, z=-63}, {name="default:wood"}) + elseif v+0 == 3 then + for i=55,62 do + minetest.set_node({x=-10, y=9, z=i*(-1)}, {name="default:fence_wood"}) + minetest.set_node({x=-16, y=9, z=i*(-1)}, {name="default:fence_wood"}) + end + for j=11,15 do + minetest.set_node({x=j*(-1), y=10, z=-53}, {name="default:fence_wood"}) + end + minetest.set_node({x=-16, y=10, z=-54}, {name="default:fence_wood"}) + minetest.set_node({x=-10, y=10, z=-54}, {name="default:fence_wood"}) + minetest.set_node({x=-11, y=9, z=-63}, {name="default:fence_wood"}) + minetest.set_node({x=-12, y=9, z=-64}, {name="default:fence_wood"}) + minetest.set_node({x=-13, y=9, z=-65}, {name="default:fence_wood"}) + minetest.set_node({x=-14, y=9, z=-64}, {name="default:fence_wood"}) + minetest.set_node({x=-15, y=9, z=-63}, {name="default:fence_wood"}) + minetest.set_node({x=-10, y=9, z=-58}, {name="air"}) + elseif v+0 == 4 then + for k=8,15 do + minetest.set_node({x=-13, y=k, z=-58}, {name="default:wood"}) + end + minetest.set_node({x=-10, y=15, z=-58}, {name="default:fence_wood"}) + minetest.set_node({x=-11, y=15, z=-58}, {name="default:fence_wood"}) + minetest.set_node({x=-12, y=15, z=-58}, {name="default:fence_wood"}) + minetest.set_node({x=-14, y=15, z=-58}, {name="default:fence_wood"}) + minetest.set_node({x=-15, y=15, z=-58}, {name="default:fence_wood"}) + minetest.set_node({x=-16, y=15, z=-58}, {name="default:fence_wood"}) + elseif v+0 == 5 then + for j=10,16 do + minetest.set_node({x=j*(-1), y=15, z=-59}, {name="wool:white"}) + minetest.set_node({x=j*(-1), y=14, z=-60}, {name="wool:white"}) + minetest.set_node({x=j*(-1), y=13, z=-60}, {name="wool:white"}) + minetest.set_node({x=j*(-1), y=12, z=-59}, {name="wool:white"}) + end + elseif v+0 == 0 then + for j=10,16 do + for i=53,65 do + for k=8,15 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + minetest.set_node({x=j*(-1), y=7, z=i*(-1)}, {name="default:water_source"}) + end + end + end +end +function Lake(v,player) + if v+0 == 1 then + minetest.set_node({x=-31, y=8, z=-55}, {name="default:water_source"}) + minetest.set_node({x=-34, y=9, z=-58}, {name="default:chest"}) + screwdriver_handler(player, {type="node", under={x=-34, y=9, z=-58}, above={x=-34, y=9, z=-58}}, 1) + elseif v+0 == 2 then + minetest.set_node({x=-30, y=8, z=-55}, {name="default:water_source"}) + minetest.set_node({x=-32, y=8, z=-55}, {name="default:water_source"}) + minetest.set_node({x=-31, y=8, z=-56}, {name="default:water_source"}) + minetest.set_node({x=-31, y=8, z=-54}, {name="default:water_source"}) + elseif v+0 == 3 then + minetest.set_node({x=-32, y=8, z=-54}, {name="default:water_source"}) + minetest.set_node({x=-33, y=8, z=-55}, {name="default:water_source"}) + minetest.set_node({x=-32, y=8, z=-56}, {name="default:water_source"}) + minetest.set_node({x=-31, y=8, z=-57}, {name="default:water_source"}) + minetest.set_node({x=-30, y=8, z=-56}, {name="default:water_source"}) + minetest.set_node({x=-29, y=8, z=-55}, {name="default:water_source"}) + minetest.set_node({x=-30, y=8, z=-54}, {name="default:water_source"}) + minetest.set_node({x=-31, y=8, z=-53}, {name="default:water_source"}) + elseif v+0 == 0 then + for j=29,33 do + for i=53,57 do + for k=8,8 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="default:dirt_with_grass"}) + end + end + end + minetest.set_node({x=-34, y=9, z=-58}, {name="air"}) + end +end +function Barracks(v,player) + if v+0 == 1 then + for j=37,43 do + for i=25,31 do + minetest.set_node({x=j*(-1), y=9, z=i}, {name="default:cobble"}) + end + end + elseif v+0 == 2 then + for i=25,30 do + minetest.set_node({x=-43, y=10, z=i}, {name="default:cobble"}) + minetest.set_node({x=-37, y=10, z=i}, {name="default:cobble"}) + end + for j=38,42 do + minetest.set_node({x=j*(-1), y=10, z=31}, {name="default:cobble"}) + end + elseif v+0 == 3 then + for i=26,30 do + minetest.set_node({x=-43, y=11, z=i}, {name="default:cobble"}) + minetest.set_node({x=-37, y=11, z=i}, {name="default:cobble"}) + end + for j=38,42 do + minetest.set_node({x=j*(-1), y=11, z=31}, {name="default:cobble"}) + end + elseif v+0 == 4 then + for i=27,30 do + minetest.set_node({x=-43, y=12, z=i}, {name="default:cobble"}) + minetest.set_node({x=-37, y=12, z=i}, {name="default:cobble"}) + end + for j=38,42 do + minetest.set_node({x=j*(-1), y=12, z=31}, {name="default:cobble"}) + end + elseif v+0 == 5 then + for j=38,42 do + for i=27,30 do + minetest.set_node({x=j*(-1), y=13, z=i}, {name="default:cobble"}) + end + end + elseif v+0 == 6 then + minetest.set_node({x=-42, y=10, z=28}, {name="castrum:knight1_sit"}) + minetest.set_node({x=-40, y=10, z=30}, {name="castrum:knight1_sit"}) + minetest.set_node({x=-38, y=10, z=28}, {name="castrum:knight1_sit"}) + minetest.set_node({x=-40, y=10, z=28}, {name="castrum:fire"}) + screwdriver_handler(player, {type="node", under={x=-38, y=10, z=28}, above={x=-38, y=10, z=28}}, 1) + screwdriver_handler(player, {type="node", under={x=-42, y=10, z=28}, above={x=-42, y=10, z=28}}, 1) + screwdriver_handler(player, {type="node", under={x=-42, y=10, z=28}, above={x=-42, y=10, z=28}}, 1) + screwdriver_handler(player, {type="node", under={x=-42, y=10, z=28}, above={x=-42, y=10, z=28}}, 1) + elseif v+0 == 0 then + for j=37,43 do + for i=25,31 do + for k=9,13 do + minetest.set_node({x=j*(-1), y=k, z=i}, {name="air"}) + end + end + end + end +end +function Camp1(v,player) + if v+0 == 1 then + minetest.set_node({x=-63, y=9, z=-57}, {name="castrum:fire"}) + elseif v+0 == 0 then + for j=59,67 do + for i=53,61 do + for k=9,9 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + end +end +function Island_Walle(v,player) + if v+0 == 1 then + for i=0,33 do + minetest.set_node({x=178, y=9, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=9, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 2 then + for i=0,33 do + minetest.set_node({x=178, y=10, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=10, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 3 then + for i=0,33 do + minetest.set_node({x=178, y=11, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=11, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 4 then + for i=0,33 do + minetest.set_node({x=178, y=12, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=12, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 5 then + for i=0,33 do + minetest.set_node({x=178, y=13, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=13, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 6 then + for i=0,33 do + minetest.set_node({x=178, y=14, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=178, y=14, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 7 then + for i=0,33 do + if i%2 == 1 then + minetest.set_node({x=178, y=15, z=i}, {name="default:sandstone"}) + end + end + for i=0,27 do + if i%2 == 1 then + minetest.set_node({x=178, y=15, z=i*(-1)}, {name="default:sandstone"}) + end + end + elseif v+0 == 0 then + for i=0,33 do + for k=9,15 do + minetest.set_node({x=178, y=k, z=i}, {name="air"}) + end + end + for i=0,27 do + for k=9,15 do + minetest.set_node({x=178, y=k, z=i*(-1)}, {name="air"}) + end + end + end +end +function Island_Wallw(v,player) + if v+0 == 1 then + for i=0,33 do + minetest.set_node({x=118, y=9, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=9, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 2 then + for i=0,33 do + minetest.set_node({x=118, y=10, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=10, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 3 then + for i=0,33 do + minetest.set_node({x=118, y=11, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=11, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 4 then + for i=0,33 do + minetest.set_node({x=118, y=12, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=12, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 5 then + for i=0,33 do + minetest.set_node({x=118, y=13, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=13, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 6 then + for i=0,33 do + minetest.set_node({x=118, y=14, z=i}, {name="default:sandstone"}) + end + for i=0,27 do + minetest.set_node({x=118, y=14, z=i*(-1)}, {name="default:sandstone"}) + end + elseif v+0 == 7 then + for i=0,33 do + if i%2 == 1 then + minetest.set_node({x=118, y=15, z=i}, {name="default:sandstone"}) + end + end + for i=0,27 do + if i%2 == 1 then + minetest.set_node({x=118, y=15, z=i*(-1)}, {name="default:sandstone"}) + end + end + elseif v+0 == 0 then + for i=0,33 do + for k=9,15 do + minetest.set_node({x=118, y=k, z=i}, {name="air"}) + end + end + for i=0,27 do + for k=9,15 do + minetest.set_node({x=118, y=k, z=i*(-1)}, {name="air"}) + end + end + end +end +function Island_Walls(v,player) + if v+0 == 1 then + for i=119,177 do + minetest.set_node({x=i, y=9, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 2 then + for i=119,177 do + minetest.set_node({x=i, y=10, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 3 then + for i=119,177 do + minetest.set_node({x=i, y=11, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 4 then + for i=119,177 do + minetest.set_node({x=i, y=12, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 5 then + for i=119,177 do + minetest.set_node({x=i, y=13, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 6 then + for i=119,177 do + minetest.set_node({x=i, y=14, z=-27}, {name="default:sandstone"}) + end + elseif v+0 == 7 then + for i=119,177 do + if i%2 == 0 then + minetest.set_node({x=i, y=15, z=-27}, {name="default:sandstone"}) + end + end + elseif v+0 == 0 then + for i=119,177 do + for k=9,15 do + minetest.set_node({x=i, y=k, z=-27}, {name="air"}) + end + end + end +end +function Island_Walln(v,player) + if v+0 == 1 then + for i=151,177 do + minetest.set_node({x=i, y=9, z=33}, {name="default:sandstone"}) + end + for i=119,145 do + minetest.set_node({x=i, y=9, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 2 then + for i=151,177 do + minetest.set_node({x=i, y=10, z=33}, {name="default:sandstone"}) + end + for i=119,145 do + minetest.set_node({x=i, y=10, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 3 then + for i=151,177 do + minetest.set_node({x=i, y=11, z=33}, {name="default:sandstone"}) + end + for i=119,145 do + minetest.set_node({x=i, y=11, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 4 then + for i=151,177 do + minetest.set_node({x=i, y=12, z=33}, {name="default:sandstone"}) + end + for i=119,145 do + minetest.set_node({x=i, y=12, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 5 then + for i=150,177 do + minetest.set_node({x=i, y=13, z=33}, {name="default:sandstone"}) + end + for i=119,146 do + minetest.set_node({x=i, y=13, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 6 then + for i=119,177 do + minetest.set_node({x=i, y=14, z=33}, {name="default:sandstone"}) + end + elseif v+0 == 7 then + for i=119,177 do + if i%2 == 0 then + minetest.set_node({x=i, y=15, z=33}, {name="default:sandstone"}) + end + end + elseif v+0 == 0 then + for i=119,177 do + for k=9,15 do + minetest.set_node({x=i, y=k, z=33}, {name="air"}) + end + end + end +end +function Island_Fountain(v,player) + if v+0 == 1 then + for i=147,149 do + for j=0,6 do + minetest.set_node({x=i, y=9, z=j}, {name="default:sandstone"}) + end + end + for i=145,151 do + for j=2,4 do + minetest.set_node({x=i, y=9, z=j}, {name="default:sandstone"}) + end + end + elseif v+0 == 2 then + minetest.set_node({x=150, y=9, z=5}, {name="default:sandstone"}) + minetest.set_node({x=146, y=9, z=5}, {name="default:sandstone"}) + minetest.set_node({x=150, y=9, z=1}, {name="default:sandstone"}) + minetest.set_node({x=146, y=9, z=1}, {name="default:sandstone"}) + minetest.set_node({x=150, y=10, z=5}, {name="default:sandstone"}) + minetest.set_node({x=146, y=10, z=5}, {name="default:sandstone"}) + minetest.set_node({x=150, y=10, z=1}, {name="default:sandstone"}) + minetest.set_node({x=146, y=10, z=1}, {name="default:sandstone"}) + minetest.set_node({x=148, y=10, z=3}, {name="default:sandstone"}) + elseif v+0 == 3 then + minetest.set_node({x=149, y=10, z=6}, {name="default:sandstone"}) + minetest.set_node({x=148, y=10, z=6}, {name="default:sandstone"}) + minetest.set_node({x=147, y=10, z=6}, {name="default:sandstone"}) + minetest.set_node({x=149, y=10, z=0}, {name="default:sandstone"}) + minetest.set_node({x=148, y=10, z=0}, {name="default:sandstone"}) + minetest.set_node({x=147, y=10, z=0}, {name="default:sandstone"}) + minetest.set_node({x=145, y=10, z=2}, {name="default:sandstone"}) + minetest.set_node({x=145, y=10, z=3}, {name="default:sandstone"}) + minetest.set_node({x=145, y=10, z=4}, {name="default:sandstone"}) + minetest.set_node({x=151, y=10, z=2}, {name="default:sandstone"}) + minetest.set_node({x=151, y=10, z=3}, {name="default:sandstone"}) + minetest.set_node({x=151, y=10, z=4}, {name="default:sandstone"}) + elseif v+0 == 4 then + minetest.set_node({x=148, y=11, z=3}, {name="default:sandstone"}) + minetest.set_node({x=148, y=12, z=3}, {name="default:sandstone"}) + minetest.set_node({x=148, y=13, z=3}, {name="default:water_source"}) + elseif v+0 == 0 then + for i=145,151 do + for k=9,13 do + for j=0,6 do + minetest.set_node({x=i, y=k, z=j}, {name="air"}) + end + end + end + end +end +function Sandmine(v,player) + if v+0 == 1 then + minetest.set_node({x=129, y=9, z=10}, {name="default:sandstone"}) + minetest.set_node({x=131, y=9, z=10}, {name="default:sandstone"}) + minetest.set_node({x=130, y=9, z=9}, {name="default:sandstone"}) + minetest.set_node({x=130, y=9, z=11}, {name="default:sandstone"}) + minetest.set_node({x=130, y=10, z=10}, {name="default:sandstone"}) + + minetest.set_node({x=127, y=9, z=7}, {name="default:sandstone"}) + minetest.set_node({x=129, y=9, z=7}, {name="default:sandstone"}) + minetest.set_node({x=128, y=9, z=6}, {name="default:sandstone"}) + minetest.set_node({x=128, y=9, z=8}, {name="default:sandstone"}) + minetest.set_node({x=128, y=10, z=7}, {name="default:sandstone"}) + + minetest.set_node({x=128, y=9, z=13}, {name="default:sandstone"}) + minetest.set_node({x=130, y=9, z=13}, {name="default:sandstone"}) + minetest.set_node({x=129, y=9, z=12}, {name="default:sandstone"}) + minetest.set_node({x=129, y=9, z=14}, {name="default:sandstone"}) + minetest.set_node({x=129, y=10, z=13}, {name="default:sandstone"}) + + minetest.set_node({x=125, y=9, z=11}, {name="default:sandstone"}) + minetest.set_node({x=127, y=9, z=11}, {name="default:sandstone"}) + minetest.set_node({x=126, y=9, z=10}, {name="default:sandstone"}) + minetest.set_node({x=126, y=9, z=12}, {name="default:sandstone"}) + minetest.set_node({x=126, y=10, z=11}, {name="default:sandstone"}) + + minetest.set_node({x=124, y=9, z=8}, {name="default:sandstone"}) + minetest.set_node({x=126, y=9, z=8}, {name="default:sandstone"}) + minetest.set_node({x=125, y=9, z=7}, {name="default:sandstone"}) + minetest.set_node({x=125, y=9, z=9}, {name="default:sandstone"}) + minetest.set_node({x=125, y=10, z=8}, {name="default:sandstone"}) + + minetest.set_node({x=124, y=9, z=14}, {name="default:sandstone"}) + minetest.set_node({x=125, y=9, z=13}, {name="default:sandstone"}) + minetest.set_node({x=126, y=9, z=14}, {name="default:sandstone"}) + minetest.set_node({x=125, y=10, z=14}, {name="default:sandstone"}) + + minetest.set_node({x=123, y=9, z=9}, {name="default:sandstone"}) + minetest.set_node({x=123, y=9, z=11}, {name="default:sandstone"}) + minetest.set_node({x=124, y=9, z=10}, {name="default:sandstone"}) + minetest.set_node({x=123, y=10, z=10}, {name="default:sandstone"}) + elseif v+0 == 2 then + minetest.set_node({x=130, y=11, z=10}, {name="default:sandstone"}) + minetest.set_node({x=128, y=11, z=7}, {name="default:sandstone"}) + minetest.set_node({x=129, y=11, z=13}, {name="default:sandstone"}) + minetest.set_node({x=126, y=11, z=11}, {name="default:sandstone"}) + minetest.set_node({x=125, y=11, z=8}, {name="default:sandstone"}) + minetest.set_node({x=125, y=11, z=14}, {name="default:sandstone"}) + minetest.set_node({x=123, y=11, z=10}, {name="default:sandstone"}) + minetest.set_node({x=131, y=9, z=12}, {name="default:desert_sandstone"}) + minetest.set_node({x=130, y=9, z=8}, {name="default:desert_sandstone"}) + minetest.set_node({x=127, y=9, z=9}, {name="default:desert_sandstone"}) + minetest.set_node({x=127, y=9, z=13}, {name="default:desert_sandstone"}) + minetest.set_node({x=126, y=9, z=6}, {name="default:desert_sandstone"}) + minetest.set_node({x=124, y=9, z=12}, {name="default:desert_sandstone"}) + minetest.set_node({x=123, y=9, z=7}, {name="default:desert_sandstone"}) + + elseif v+0 == 0 then + for j=123,131 do + for i=6,14 do + for k=9,14 do + minetest.set_node({x=j, y=k, z=i}, {name="air"}) + end + end + end + minetest.set_node({x=130, y=9, z=10}, {name="default:sandstone"}) + minetest.set_node({x=128, y=9, z=7}, {name="default:sandstone"}) + minetest.set_node({x=129, y=9, z=13}, {name="default:sandstone"}) + minetest.set_node({x=126, y=9, z=11}, {name="default:sandstone"}) + minetest.set_node({x=125, y=9, z=8}, {name="default:sandstone"}) + minetest.set_node({x=125, y=9, z=14}, {name="default:sandstone"}) + minetest.set_node({x=123, y=9, z=10}, {name="default:sandstone"}) + end +end +function Battleground(v,player) + if v+0 == 1 then + for j=72,76 do + for i=80,84 do + minetest.set_node({x=j*(-1), y=9, z=i*(-1)}, {name="default:cobble"}) + end + end + elseif v+0 == 2 then + for j=72,76 do + for i=80,84 do + minetest.set_node({x=j*(-1), y=10, z=i*(-1)}, {name="default:cobble"}) + end + end + minetest.set_node({x=-74, y=10, z=-80}, {name="air"}) + elseif v+0 == 3 then + minetest.set_node({x=-72, y=11, z=-80}, {name="default:cobble"}) + minetest.set_node({x=-72, y=11, z=-82}, {name="default:cobble"}) + minetest.set_node({x=-72, y=11, z=-84}, {name="default:cobble"}) + minetest.set_node({x=-74, y=11, z=-84}, {name="default:cobble"}) + minetest.set_node({x=-76, y=11, z=-84}, {name="default:cobble"}) + minetest.set_node({x=-76, y=11, z=-82}, {name="default:cobble"}) + minetest.set_node({x=-76, y=11, z=-80}, {name="default:cobble"}) + elseif v+0 == 4 then + minetest.set_node({x=-72, y=12, z=-80}, {name="castrum:fire"}) + minetest.set_node({x=-72, y=12, z=-82}, {name="castrum:fire"}) + minetest.set_node({x=-72, y=12, z=-84}, {name="castrum:fire"}) + minetest.set_node({x=-74, y=12, z=-84}, {name="castrum:fire"}) + minetest.set_node({x=-76, y=12, z=-84}, {name="castrum:fire"}) + minetest.set_node({x=-76, y=12, z=-82}, {name="castrum:fire"}) + minetest.set_node({x=-76, y=12, z=-80}, {name="castrum:fire"}) + minetest.set_node({x=-74, y=11, z=-81}, {name="castrum:knight_dark"}) + screwdriver_handler(player, {type="node", under={x=-74, y=11, z=-81}, above={x=-74, y=11, z=-81}}, 1) + screwdriver_handler(player, {type="node", under={x=-74, y=11, z=-81}, above={x=-74, y=11, z=-81}}, 1) + elseif v+0 == 5 then + minetest.set_node({x=-72, y=11, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=11, z=-82}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=11, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=11, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=11, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=11, z=-82}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=11, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=9, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=9, z=-82}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=9, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=9, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=9, z=-82}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=9, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-74, y=9, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-73, y=10, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-75, y=10, z=-80}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=10, z=-81}, {name="default:stone_block"}) + minetest.set_node({x=-76, y=10, z=-83}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=10, z=-81}, {name="default:stone_block"}) + minetest.set_node({x=-72, y=10, z=-83}, {name="default:stone_block"}) + minetest.set_node({x=-73, y=10, z=-84}, {name="default:stone_block"}) + minetest.set_node({x=-75, y=10, z=-84}, {name="default:stone_block"}) + elseif v+0 == 0 then + for j=72,76 do + for i=80,84 do + for k=9,12 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + end +end +function Bridge_Status(player) + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Bridge_status.txt", "r") + local status = file:read("*l") + file:close() + if tonumber(level) < 9 then + minetest.chat_send_player(player:get_player_name(), "build bridge first") + elseif tonumber(level) == 9 then + if tonumber(status) == 0 then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge_status.txt", "w") + file:write("1") + file:close() + for j=36,44 do + for i=32,40 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + end + for j=36,44 do + for k=8,16 do + minetest.set_node({x=j*(-1), y=k, z=-32}, {name="default:wood"}) + end + end + minetest.set_node({x=-40, y=12, z=-32}, {name="castrum:bridge2"}) + elseif tonumber(status) == 1 then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge_status.txt", "w") + file:write("0") + file:close() + for j=36,44 do + for i=32,40 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:wood"}) + end + end + minetest.set_node({x=-40, y=8, z=-36}, {name="castrum:bridge"}) + for j=36,44 do + for k=9,16 do + minetest.set_node({x=j*(-1), y=k, z=-32}, {name="air"}) + end + end + end + elseif tonumber(level) == 10 then + if tonumber(status) == 0 then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge_status.txt", "w") + file:write("1") + file:close() + for j=36,44 do + for i=32,40 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="air"}) + end + end + for j=36,44 do + for k=8,16 do + minetest.set_node({x=j*(-1), y=k, z=-32}, {name="default:junglewood"}) + end + end + minetest.set_node({x=-40, y=12, z=-32}, {name="castrum:bridge2"}) + elseif tonumber(status) == 1 then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge_status.txt", "w") + file:write("0") + file:close() + for j=36,44 do + for i=32,40 do + minetest.set_node({x=j*(-1), y=8, z=i*(-1)}, {name="default:junglewood"}) + end + end + minetest.set_node({x=-40, y=8, z=-36}, {name="castrum:bridge"}) + for j=36,44 do + for k=9,16 do + minetest.set_node({x=j*(-1), y=k, z=-32}, {name="air"}) + end + end + end + end +end +function Add_knight(player,lv,state) + if state == true then + file = io.open(minetest.get_worldpath().."/SAVE/Knight_"..lv..".txt", "r") + local knights = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Knight_"..lv..".txt", "w") + file:write(tonumber(knights)+1) + file:close() + Update_knight(player) + end +end +local knight_pos = { + {1, -65, -54, 0}, + {2, -64, -54, 0}, + {3, -63, -54, 0}, + {4, -62, -54, 0}, + {5, -61, -54, 0}, + + {6, -60, -55, 1}, + {7, -60, -56, 1}, + {8, -60, -57, 1}, + {9, -60, -58, 1}, + {10, -60, -59, 1}, + + {11, -61, -60, 2}, + {12, -62, -60, 2}, + {13, -63, -60, 2}, + {14, -64, -60, 2}, + {15, -65, -60, 2}, + + {16, -66, -59, 3}, + {17, -66, -58, 3}, + {18, -66, -57, 3}, + {19, -66, -56, 3}, + +} +function Update_knight(player) + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight1 = file:read("*l") + file:close() + for j=59,67 do + for i=53,61 do + for k=9,9 do + minetest.set_node({x=j*(-1), y=k, z=i*(-1)}, {name="air"}) + end + end + end + minetest.set_node({x=-63, y=9, z=-57}, {name="castrum:fire"}) + for i=1,tonumber(knight1) do + minetest.set_node({x=knight_pos[i][2], y=9, z=knight_pos[i][3]}, {name="castrum:knight_lv1_sit"}) + for j=1,tonumber(knight_pos[i][4]) do + screwdriver_handler(player, {type="node", under={x=knight_pos[i][2], y=9, z=knight_pos[i][3]}, above={x=knight_pos[i][2], y=9, z=knight_pos[i][3]}}, 1) + end + end +end +function nextrange(x, max) + x = x + 1 + if x > max then + x = 0 + end + return x +end +function screwdriver_handler(user, pointed_thing, mode) + if pointed_thing.type ~= "node" then + return + end + local pos = pointed_thing.under + local keys = user:get_player_control() + local player_name = user:get_player_name() + + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return + end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + if not ndef or not ndef.paramtype2 == "facedir" or + (ndef.drawtype == "nodebox" and + not ndef.node_box.type == "fixed") or + node.param2 == nil then + return + end + + -- Set param2 + local n = node.param2 + local axisdir = math.floor(n / 4) + local rotation = n - axisdir * 4 + if mode == 1 then + n = axisdir * 4 + nextrange(rotation, 3) + elseif mode == 3 then + n = nextrange(axisdir, 5) * 4 + end + + node.param2 = n + minetest.swap_node(pos, node) +end +local home1 = {} +home1.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 6 then + label = "not build yet ("..math.floor((level/6)*100).."%)" + label2 = "Build" + need1 = "8 Cobblestone" + need2 = "10 Wooden Planks" + need3 = "Fountain lv.1" + elseif tonumber(level) == 6 then + label = (level-5).."/2" + label2 = "Upgrade" + need1 = "64 Cobblestone" + need2 = "80 Jungle Wood Planks" + need3 = "Fountain lv.3" + else + label = (level-5).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local home2 = {} +home2.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 6 then + label = "not build yet ("..math.floor((level/6)*100).."%)" + label2 = "Build" + need1 = "8 Cobblestone" + need2 = "10 Wooden Planks" + need3 = "Fountain lv.3" + else + label = (level-5).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local bridge = {} +bridge.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 9 then + label = "not build yet ("..math.floor((level/9)*100).."%)" + label2 = "Build" + need1 = "3 Wooden Planks" + elseif tonumber(level) == 9 then + label = (level-8).."/2" + label2 = "Upgrade" + need1 = "27 Jungle Wood Planks" + else + label = (level-8).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local moats = {} +moats.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Moats.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 9 then + label = "not build yet ("..math.floor((level/9)*100).."%)" + label2 = "Build" + need1 = "3 Stone Shovel" + need2 = "Bridge lv.1" + elseif tonumber(level) == 9 then + label = (level-8).."/2" + label2 = "Upgrade" + need1 = "30 Water Buckets" + need2 = "Bridge lv.2" + else + label = (level-8).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local moate = {} +moate.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Moate.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 9 then + label = "not build yet ("..math.floor((level/9)*100).."%)" + label2 = "Build" + need1 = "3 Stone Shovel" + elseif tonumber(level) == 9 then + label = (level-8).."/2" + label2 = "Upgrade" + need1 = "30 Water Buckets" + need2 = "Bridge lv.2" + else + label = (level-8).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local moatw = {} +moatw.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Moatw.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 9 then + label = "not build yet ("..math.floor((level/9)*100).."%)" + label2 = "Build" + need1 = "3 Stone Shovel" + elseif tonumber(level) == 9 then + label = (level-8).."/2" + label2 = "Upgrade" + need1 = "30 Water Buckets" + need2 = "Bridge lv.2" + else + label = (level-8).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local moatn = {} +moatn.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Moatn.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 9 then + label = "not build yet ("..math.floor((level/9)*100).."%)" + label2 = "Build" + need1 = "3 Stone Shovel" + elseif tonumber(level) == 9 then + label = (level-8).."/2" + label2 = "Upgrade" + need1 = "30 Water Buckets" + need2 = "Bridge lv.2" + else + label = (level-8).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local walls = {} +walls.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 14 then + label = "not build yet ("..math.floor((level/14)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 14 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 15 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.2" + else + label = (level-13).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local wallw = {} +wallw.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 14 then + label = "not build yet ("..math.floor((level/14)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 14 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 15 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.2" + else + label = (level-13).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local walln = {} +walln.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 14 then + label = "not build yet ("..math.floor((level/14)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 14 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 15 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.2" + else + label = (level-13).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local walle = {} +walle.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 14 then + label = "not build yet ("..math.floor((level/14)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 14 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 15 then + label = (level-13).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.3" + else + label = (level-13).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local fountain = {} +fountain.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 4 then + label = "not build yet ("..math.floor((level/4)*100).."%)" + label2 = "Build" + need1 = "10 Cobblestone" + elseif tonumber(level) == 4 then + label = (level-3).."/3" + label2 = "Upgrade" + need1 = "25 Cobblestone" + need2 = "8 Stone Pickaxe" + need3 = "Walls and Towers lv.2" + elseif tonumber(level) == 5 then + label = (level-3).."/3" + label2 = "Upgrade" + need1 = "100 Cobblestone" + need2 = "32 Stone Pickaxe" + need3 = "Walls and Towers lv.3" + else + label = (level-3).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local tower1 = {} +tower1.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 18 then + label = "not build yet ("..math.floor((level/18)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 18 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 19 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.3" + else + label = (level-17).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local tower2 = {} +tower2.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 18 then + label = "not build yet ("..math.floor((level/18)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 18 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 19 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.3" + else + label = (level-17).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local tower3 = {} +tower3.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 18 then + label = "not build yet ("..math.floor((level/18)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 18 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 19 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.3" + else + label = (level-17).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local tower4 = {} +tower4.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 18 then + label = "not build yet ("..math.floor((level/18)*100).."%)" + label2 = "Build" + need1 = "3 Cobblestone" + elseif tonumber(level) == 18 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "10 Cobblestone" + need2 = "3 Stone Sword" + need3 = "Fountain lv.1" + elseif tonumber(level) == 19 then + label = (level-17).."/3" + label2 = "Upgrade" + need1 = "40 Cobblestone" + need2 = "12 Stone Sword" + need3 = "Fountain lv.3" + else + label = (level-17).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local smithy = {} +smithy.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Smithy.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 6 then + label = "not build yet ("..math.floor((level/6)*100).."%)" + label2 = "Build" + need1 = "8 Cobblestone" + need2 = "6 Wooden Planks" + else + label = (level-5).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + if tonumber(level) > 5 then + formspec = formspec.."button[0,3;5,1;;Crafting]" + end + formspec = formspec.."button[0,4;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local stable = {} +stable.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Stable.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + if tonumber(level) < 7 then + label = "not build yet ("..math.floor((level/7)*100).."%)" + else + label = (level-6).."/1" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."button[0,1;5,1;;Upgrade]" + --.."button[0,5;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local mine = {} +mine.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 1 then + label = "not build yet ("..math.floor((level/1)*100).."%)" + label2 = "Build" + need1 = "Fountain lv.3" + elseif tonumber(level) == 1 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 1" + elseif tonumber(level) == 2 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 2" + else + label = (level).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local quarry = {} +quarry.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "r") + local level = file:read("*l") + file:close() + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) == 0 then + label = (level+1).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 1" + elseif tonumber(level) == 1 then + label = (level+1).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 2" + need2 = "Fountain lv.1" + else + label = (level+1).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local tree = {} +tree.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 1 then + label = "not build yet ("..math.floor((level/1)*100).."%)" + label2 = "Build" + need1 = "Fountain lv.1" + elseif tonumber(level) == 1 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 1" + elseif tonumber(level) == 2 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 2" + need2 = "Fountain lv.2" + else + label = (level).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local pier = {} +pier.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Pier.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 5 then + label = "not build yet ("..math.floor((level/5)*100).."%)" + label2 = "Build" + need1 = "5 Wooden Planks" + elseif tonumber(level) == 5 then + label = (level-4).."/2" + label2 = "Upgrade" + need1 = "25 Jungle Wood Planks" + else + label = (level-4).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local ship1 = {} +ship1.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 5 then + label = "not build yet ("..math.floor((level/5)*100).."%)" + label2 = "Build" + need1 = "10 Wooden Planks" + need2 = "Fountain lv.2" + else + label = (level-4).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + if tonumber(level) > 4 then + formspec = formspec.."button[0,3;5,1;;Go to Island]" + end + formspec = formspec--.."button[0,4;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local craft = {} +craft.get_formspec = function(player, pos) + if player == nil then + return + end + item = "" + need1 = "" + need2 = "" + if player:get_attribute("item") ~= nil then + item = player:get_attribute("item") + end + if player:get_attribute("need1") ~= nil then + need1 = player:get_attribute("need1") + end + if player:get_attribute("need2") ~= nil then + need2 = player:get_attribute("need2") + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;For: "..item.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."button[0,2;5,1;;Craft]" + .."button[0,3;1,1;;Soul]" + .."button[1,3;1,1;;Steel\nIngot]" + .."button[0,4;1,1;;Stone\nShovel]" + .."button[1,4;1,1;;Stone\nPickaxe]" + .."button[2,4;1,1;;Stone\nSword]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + .."image_button[3.9,-0.3;0.8,0.8;;back;<]" + return formspec +end +local lake = {} +lake.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 1 then + label = "not build yet ("..math.floor((level/1)*100).."%)" + label2 = "Build" + need1 = "Fountain lv.2" + elseif tonumber(level) == 1 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 1" + elseif tonumber(level) == 2 then + label = (level).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 2" + need2 = "Fountain lv.3" + else + label = (level).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local barracks = {} +barracks.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 6 then + label = "not build yet ("..math.floor((level/6)*100).."%)" + label2 = "Build" + need1 = "5 Water Buckets" + need2 = "20 Cobblestone" + need3 = "20 Wooden Planks" + else + label = (level-5).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + if tonumber(level) > 5 then + formspec = formspec.."button[0,3;5,1;;Get Knights]" + end + formspec = formspec--.."button[0,4;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local camp1 = {} +camp1.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 1 then + label = "not build yet ("..math.floor((level/1)*100).."%)" + label2 = "Build" + need1 = "Home 1 lv.1" + else + label = (level).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local knight = {} +knight.get_formspec = function(player, pos) + if player == nil then + return + end + item = "" + need1 = "" + need2 = "" + max = 0 + max1 = 0 + max2 = 0 + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local home1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "r") + local home2 = file:read("*l") + file:close() + if tonumber(home1) == 6 then + max1 = max1+8 + elseif tonumber(home1) == 7 then + max1 = max1+11 + end + if tonumber(home2) == 6 then + max1 = max1+8 + end + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local camp1 = file:read("*l") + file:close() + if tonumber(camp1) == 1 then + max2 = max2+20 + end + if max1 > max2 then + max = max2 + elseif max2 > max1 then + max = max1 + else + max = max1 + end + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight_1 = file:read("*l") + file:close() + + if player:get_attribute("2item") ~= nil then + item = player:get_attribute("2item") + end + if player:get_attribute("2need1") ~= nil then + need1 = player:get_attribute("2need1") + end + if player:get_attribute("2need2") ~= nil then + need2 = player:get_attribute("2need2") + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;For: "..item.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[3.9,0.5;You have:"..knight_1.."/"..max.."]" + .."button[0,2;5,1;;Get Knight]" + .."button[0,3;1,1;;Knight\nlv.1]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + .."image_button[3.9,-0.3;0.8,0.8;;back;<]" + return formspec +end +local battleground = {} +battleground.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 4 then + label = "not build yet ("..math.floor((level/4)*100).."%)" + label2 = "Build" + need1 = "Fountain lv.1" + need2 = "4 Cobblestone" + elseif tonumber(level) == 4 then + label = (level-3).."/2" + label2 = "Upgrade" + need1 = "Completed chapter 1" + need2 = "Fountain lv.2" + need3 = "40 Cobblestone" + else + label = (level-3).."/2" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + if tonumber(chapter) == 1 and tonumber(level) > 3 then + formspec = formspec.."button[0,3;5,1;;Start Chapter 1]" + elseif tonumber(chapter) == 2 and tonumber(level) > 4 then + formspec = formspec.."button[0,3;5,1;;Start Chapter 2]" + elseif tonumber(chapter) == 2 and tonumber(level) > 3 then + formspec = formspec.."button[0,3;5,1;;Start Chapter 2 (battleground lv.2 needed)]" + elseif tonumber(chapter) == 3 and tonumber(level) > 4 then + formspec = formspec.."button[0,3;5,1;;Start Chapter 3 (comming soon)]" + end + formspec = formspec--.."button[0,4;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_walle = {} +island_walle.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 7 then + label = "not build yet ("..math.floor((level/7)*100).."%)" + label2 = "Build" + need1 = "3 Sand" + else + label = (level-6).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_wallw = {} +island_wallw.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 7 then + label = "not build yet ("..math.floor((level/7)*100).."%)" + label2 = "Build" + need1 = "3 Sand" + else + label = (level-6).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_walls = {} +island_walls.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 7 then + label = "not build yet ("..math.floor((level/7)*100).."%)" + label2 = "Build" + need1 = "3 Sand" + else + label = (level-6).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_walln = {} +island_walln.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 7 then + label = "not build yet ("..math.floor((level/7)*100).."%)" + label2 = "Build" + need1 = "3 Sand" + else + label = (level-6).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_ship1 = {} +island_ship1.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + label = (level-4).."/1" + label2 = "Upgrade (comming soon)" + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + .."button[0,3;5,1;;Go Back]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local island_fountain = {} +island_fountain.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "r") + local level = file:read("*l") + file:close() + local label = "" + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) < 4 then + label = "not build yet ("..math.floor((level/4)*100).."%)" + label2 = "Build" + need1 = "10 Sand" + else + label = (level-3).."/1" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +local sandmine = {} +sandmine.get_formspec = function(player, pos) + if player == nil then + return + end + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "r") + local level = file:read("*l") + file:close() + local label2 = "" + local need1 = "" + local need2 = "" + local need3 = "" + local need4 = "" + if tonumber(level) == 0 then + label = (level+1).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 1" + elseif tonumber(level) == 1 then + label = (level+1).."/3" + label2 = "Upgrade" + need1 = "Completed chapter 2" + need2 = "Island Fountain lv.1" + else + label = (level+1).."/3" + label2 = "Upgrade (comming soon)" + end + formspec = "size[5,6.5]" + .."background[5,6.5;1,1;gui_formbg.png;true]" + .."listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + .."bgcolor[#080808BB;true]" + .."label[0,0;Level: "..label.."]" + .."label[0,0.5;You need:]" + .."label[0,0.8;"..need1.."]" + .."label[0,1.1;"..need2.."]" + .."label[0,1.4;"..need3.."]" + .."label[0,1.7;"..need4.."]" + .."button[0,2;5,1;;"..label2.."]" + --.."button[0,3;5,1;;del]" + .."image_button[4.5,-0.3;0.8,0.8;;esc;X]" + return formspec +end +minetest.register_node("castrum:home_1",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Home 1", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "home1" , home1.get_formspec(player)) + end, +}) + +minetest.register_node("castrum:home_2",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Home 2", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "home2" , home2.get_formspec(player)) + end, +}) + +minetest.register_node("castrum:bridge",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Bridge", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "bridge" , bridge.get_formspec(player)) + end, +}) + +minetest.register_node("castrum:bridge2",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Bridge", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "bridge2" , bridge.get_formspec(player)) + end, +}) + +minetest.register_node("castrum:moat_south",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Moat South", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "moats" , moats.get_formspec(player)) + end, +}) +minetest.register_node("castrum:moat_east",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Moat East", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "moate" , moate.get_formspec(player)) + end, +}) +minetest.register_node("castrum:moat_west",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Moat West", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "moatw" , moatw.get_formspec(player)) + end, +}) +minetest.register_node("castrum:moat_north",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Moat North", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "moatn" , moatn.get_formspec(player)) + end, +}) +minetest.register_node("castrum:wall_south",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Wall South", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "walls" , walls.get_formspec(player)) + end, +}) +minetest.register_node("castrum:wall_east",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Wall East", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "walle" , walle.get_formspec(player)) + end, +}) +minetest.register_node("castrum:wall_west",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Wall West", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "wallw" , wallw.get_formspec(player)) + end, +}) +minetest.register_node("castrum:wall_north",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Wall North", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "walln" , walln.get_formspec(player)) + end, +}) +minetest.register_node("castrum:fountain",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Fountain", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "fountain" , fountain.get_formspec(player)) + end, +}) +minetest.register_node("castrum:tower1",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Tower 1", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "tower1" , tower1.get_formspec(player)) + end, +}) +minetest.register_node("castrum:tower2",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Tower 2", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "tower2" , tower2.get_formspec(player)) + end, +}) +minetest.register_node("castrum:tower3",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Tower 3", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "tower3" , tower3.get_formspec(player)) + end, +}) +minetest.register_node("castrum:tower4",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Tower 4", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "tower4" , tower4.get_formspec(player)) + end, +}) +minetest.register_node("castrum:smithy",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Smithy", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "smithy" , smithy.get_formspec(player)) + end, +}) +minetest.register_node("castrum:stable",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Stable", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "stable" , stable.get_formspec(player)) + end, +}) +minetest.register_node("castrum:mine",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Mine", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "mine" , mine.get_formspec(player)) + end, +}) +minetest.register_node("castrum:quarry",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Quarry", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "quarry" , quarry.get_formspec(player)) + end, +}) +minetest.register_node("castrum:tree",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Tree", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "tree" , tree.get_formspec(player)) + end, +}) +minetest.register_node("castrum:pier",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Pier", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "pier" , pier.get_formspec(player)) + end, +}) +minetest.register_node("castrum:ship1",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Ship 1", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "ship1" , ship1.get_formspec(player)) + end, +}) +minetest.register_node("castrum:lake",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Lake", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "lake" , lake.get_formspec(player)) + end, +}) +minetest.register_node("castrum:barracks",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Barracks", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "barracks" , barracks.get_formspec(player)) + end, +}) +minetest.register_node("castrum:camp1",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Camp 1", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "camp1" , camp1.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_walle",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Walle", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_walle" , island_walle.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_wallw",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Wallw", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_wallw" , island_wallw.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_walls",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Walls", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_walls" , island_walls.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_walln",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Walln", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_walln" , island_walln.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_fountain",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Fountain", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_fountain" , island_fountain.get_formspec(player)) + end, +}) +minetest.register_node("castrum:island_ship1",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Island Ship 1", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "island_ship1" , island_ship1.get_formspec(player)) + end, +}) +minetest.register_node("castrum:sandmine",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Sandmine", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "sandmine" , sandmine.get_formspec(player)) + end, +}) +minetest.register_node("castrum:battleground",{ + tiles = {"default_diamond_block.png"}, + description = "Configurate Battleground", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + minetest.show_formspec(player:get_player_name(), "battleground" , battleground.get_formspec(player)) + end, +}) +minetest.register_node("castrum:bridge_status",{ + tiles = {"castrum_bridge_status.png"}, + description = "Change Bridge Status", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, + on_punch = function(pos, node, player, pointed_thing) + Bridge_Status(player) + end, +}) +minetest.register_node("castrum:fight1",{ + tiles = {"castrum_fight1.png"}, + description = "Fight 1", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, +}) +minetest.register_node("castrum:fight2",{ + tiles = {"castrum_fight2.png"}, + description = "Fight 2", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, +}) +minetest.register_craftitem("castrum:soul", { + description = "Soul", + inventory_image = "castrum_soul.png", +}) +minetest.register_craftitem("castrum:shovel_stone", { + description = "Stone Shovel", + inventory_image = "default_tool_stoneshovel.png", +}) +minetest.register_craftitem("castrum:sword_stone", { + description = "Stone Sword", + inventory_image = "default_tool_stonesword.png", +}) +minetest.register_craftitem("castrum:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "default_tool_stonepick.png", +}) +minetest.register_craftitem("castrum:bucket_water", { + description = "Water Bucket", + inventory_image = "bucket_water.png", +}) +minetest.register_node("castrum:cobble",{ + tiles = {"default_cobble.png"}, + description = "Cobble", + --groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, +}) +minetest.register_node("castrum:comming_soon",{ + tiles = {"castrum_comming_soon.png"}, + description = "Comming soon", + groups = {snappy=1,choppy=2,oddly_breakable_by_hand=2,flammable=3}, +}) +minetest.register_node("castrum:character1", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"character.png"}, + paramtype = "light", + paramtype2 = "facedir", + --groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:castrum_knight1", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"castrum_knight.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:castrum_knight2", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"castrum_knight2.png"}, + paramtype = "light", + paramtype2 = "facedir", + --groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:knight_dark", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"castrum_knight_dark.png"}, + paramtype = "light", + paramtype2 = "facedir", + --groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:knight1_sit", { + description = "character", + drawtype = "mesh", + mesh = "character2.obj", + tiles = {"castrum_knight.png"}, + paramtype = "light", + paramtype2 = "facedir", + --groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:knight_lv1", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"castrum_knight_lv1.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {snappy=3}, +}) +minetest.register_node("castrum:knight_lv1_sit", { + description = "character", + drawtype = "mesh", + mesh = "character2.obj", + tiles = {"castrum_knight_lv1.png"}, + paramtype = "light", + paramtype2 = "facedir", + --groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:knight_lv1_dark", { + description = "character", + drawtype = "mesh", + mesh = "character.obj", + tiles = {"castrum_knight_lv1_dark.png"}, + paramtype = "light", + paramtype2 = "facedir", + groups = {cracky=3, oddly_breakable_by_hand=2}, +}) +minetest.register_node("castrum:fire", { + description = "Fire", + drawtype = "firelike", + tiles = { + { + name = "fire_basic_flame_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1 + }, + }, + }, + inventory_image = "fire_basic_flame.png", + paramtype = "light", + light_source = 13, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + damage_per_second = 4, + groups = {igniter = 2, dig_immediate = 3}, + drop = "", +}) + +minetest.register_node("castrum:water", { + description = "Water Source", + drawtype = "liquid", + tiles = { + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + -- New-style water source material (mostly unused) + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + post_effect_color = {a = 103, r = 30, g = 60, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) +minetest.register_on_player_receive_fields(function(player, formname, fields) + local player_inv = player:get_inventory() + if formname == "home1" then + for k, v in pairs(fields) do + if v == "del" then + Home1(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "home1" , home1.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 6 and inv:contains_item("main", "default:cobble 8") and inv:contains_item("main", "default:wood 10") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 8") + inv:remove_item("main", "default:wood 10") + upgrade = true + elseif tonumber(level) < 6 and inv:contains_item("main", "default:cobble 8") and inv:contains_item("main", "default:wood 10") then + txt = "build fountain first" + elseif tonumber(level) == 6 and inv:contains_item("main", "default:cobble 64") and inv:contains_item("main", "default:junglewood 80") and tonumber(fountain) > 5 then + inv:remove_item("main", "default:junglewood 80") + inv:remove_item("main", "default:wood 64") + upgrade = true + elseif tonumber(level) == 6 and inv:contains_item("main", "default:cobble 64") and inv:contains_item("main", "default:junglewood 80") then + txt = "upgrade fountain to lv.3 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 7 and upgrade then + Home1(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "home1" , home1.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "home2" then + for k, v in pairs(fields) do + if v == "del" then + Home2(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "home2" , home2.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 6 and inv:contains_item("main", "default:cobble 8") and inv:contains_item("main", "default:wood 10") and tonumber(fountain) > 5 then + inv:remove_item("main", "default:cobble 8") + inv:remove_item("main", "default:wood 10") + upgrade = true + elseif tonumber(level) < 6 and inv:contains_item("main", "default:cobble 8") and inv:contains_item("main", "default:wood 10") then + txt = "upgrade fountain to lv.3 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 6 and upgrade then + Home2(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "home2" , home2.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "bridge" then + for k, v in pairs(fields) do + if v == "del" then + Bridge(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "bridge" , bridge.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) < 9 and inv:contains_item("main", "default:wood 3") then + inv:remove_item("main", "default:wood 3") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "default:junglewood 27") then + inv:remove_item("main", "default:junglewood 27") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), "not enough items") + end + if (tonumber(level)) < 10 and upgrade then + Bridge(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "bridge" , bridge.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "bridge2" then + for k, v in pairs(fields) do + if v == "del" then + Bridge2(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "bridge" , bridge.get_formspec(player)) + elseif v == "Upgrade" then + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) == 9 and inv:contains_item("main", "default:junglewood 27") then + inv:remove_item("main", "default:junglewood 27") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), "not enough items") + end + if (tonumber(level)) < 10 and upgrade then + Bridge2(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "bridge" , bridge.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "moats" then + for k, v in pairs(fields) do + if v == "del" then + Moat_south(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moats.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "moats" , moats.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Moats.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local bridge = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 9 and inv:contains_item("main", "castrum:shovel_stone 3") and tonumber(bridge) > 8 then + inv:remove_item("main", "castrum:shovel_stone 3") + upgrade = true + elseif tonumber(level) < 9 and inv:contains_item("main", "castrum:shovel_stone 3") then + txt = "build bridge first" + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") and tonumber(bridge) > 9 then + inv:remove_item("main", "castrum:bucket_water 30") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") then + txt = "upgrade bridge to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 10 and upgrade then + Moat_south(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moats.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "moats" , moats.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "walls" then + for k, v in pairs(fields) do + if v == "del" then + Wall_south(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "walls" , walls.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 14 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 16 and upgrade then + Wall_south(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "walls" , walls.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "fountain" then + for k, v in pairs(fields) do + if v == "del" then + Fountain(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "fountain" , fountain.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local level = file:read("*l") + file:close() + + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "r") + local tower1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "r") + local tower2 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "r") + local tower3 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "r") + local tower4 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "r") + local walln = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "r") + local walls = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "r") + local walle = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "r") + local wallw = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 4 and inv:contains_item("main", "default:cobble 10") then + inv:remove_item("main", "default:cobble 10") + upgrade = true + elseif tonumber(level) == 4 and inv:contains_item("main", "default:cobble 25") and inv:contains_item("main", "castrum:pick_stone 8") and tonumber(tower1) > 18 and tonumber(tower2) > 18 and tonumber(tower3) > 18 and tonumber(tower4) > 18 and tonumber(walle) > 14 and tonumber(wallw) > 14 and tonumber(walln) > 14 and tonumber(walls) > 14 then + inv:remove_item("main", "default:cobble 25") + inv:remove_item("main", "castrum:pick_stone 8") + upgrade = true + elseif tonumber(level) == 4 and inv:contains_item("main", "default:cobble 25") and inv:contains_item("main", "castrum:pick_stone 8") then + txt = "upgrade walls and towers to lv.2 first" + elseif tonumber(level) == 5 and inv:contains_item("main", "default:cobble 100") and inv:contains_item("main", "castrum:pick_stone 32") and tonumber(tower1) > 19 and tonumber(tower2) > 19 and tonumber(tower3) > 19 and tonumber(tower4) > 19 and tonumber(walle) > 15 and tonumber(wallw) > 15 and tonumber(walln) > 15 and tonumber(walls) > 15 then + inv:remove_item("main", "default:cobble 100") + inv:remove_item("main", "castrum:pick_stone 32") + upgrade = true + elseif tonumber(level) == 5 and inv:contains_item("main", "default:cobble 100") and inv:contains_item("main", "castrum:pick_stone 32") then + txt = "upgrade walls and towers to lv.3 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 6 and upgrade then + Fountain(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "fountain" , fountain.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "tower1" then + for k, v in pairs(fields) do + if v == "del" then + Tower1(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "tower1" , tower1.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 18 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 20 and upgrade then + Tower1(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "tower1" , tower1.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "walle" then + for k, v in pairs(fields) do + if v == "del" then + Wall_east(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "walle" , walle.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 14 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 16 and upgrade then + Wall_east(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "walle" , walle.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "tower2" then + for k, v in pairs(fields) do + if v == "del" then + Tower2(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "tower2" , tower2.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 18 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 20 and upgrade then + Tower2(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "tower2" , tower2.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "wallw" then + for k, v in pairs(fields) do + if v == "del" then + Wall_west(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "wallw" , wallw.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 14 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 16 and upgrade then + Wall_west(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "wallw" , wallw.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "walln" then + for k, v in pairs(fields) do + if v == "del" then + Wall_north(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "walln" , walln.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 14 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 14 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 15 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 16 and upgrade then + Wall_north(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "walln" , walln.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "moate" then + for k, v in pairs(fields) do + if v == "del" then + Moat_east(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moate.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "moate" , moate.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Moate.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local bridge = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) < 9 and inv:contains_item("main", "castrum:shovel_stone 3") then + inv:remove_item("main", "castrum:shovel_stone 3") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") and tonumber(bridge) > 9 then + inv:remove_item("main", "castrum:bucket_water 30") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") then + txt = "upgrade bridge to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 10 and upgrade then + Moat_east(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moate.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "moate" , moate.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "tower3" then + for k, v in pairs(fields) do + if v == "del" then + Tower3(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "tower3" , tower3.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 18 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 20 and upgrade then + Tower3(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "tower3" , tower3.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "moatn" then + for k, v in pairs(fields) do + if v == "del" then + Moat_north(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moatn.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "moatn" , moatn.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Moatn.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local bridge = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) < 9 and inv:contains_item("main", "castrum:shovel_stone 3") then + inv:remove_item("main", "castrum:shovel_stone 3") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") and tonumber(bridge) > 9 then + inv:remove_item("main", "castrum:bucket_water 30") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") then + txt = "upgrade bridge to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 10 and upgrade then + Moat_north(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moatn.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "moatn" , moatn.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "moatw" then + for k, v in pairs(fields) do + if v == "del" then + Moat_west(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moatw.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "moatw" , moatw.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Moatw.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local bridge = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) < 9 and inv:contains_item("main", "castrum:shovel_stone 3") then + inv:remove_item("main", "castrum:shovel_stone 3") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") and tonumber(bridge) > 9 then + inv:remove_item("main", "castrum:bucket_water 30") + upgrade = true + elseif tonumber(level) == 9 and inv:contains_item("main", "castrum:bucket_water 30") then + txt = "upgrade bridge to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 10 and upgrade then + Moat_west(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Moatw.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "moatw" , moatw.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "tower4" then + for k, v in pairs(fields) do + if v == "del" then + Tower4(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "tower4" , tower4.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 18 and inv:contains_item("main", "default:cobble 3") then + inv:remove_item("main", "default:cobble 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") and tonumber(fountain) > 3 then + inv:remove_item("main", "default:cobble 10") + inv:remove_item("main", "castrum:sword_stone 3") + upgrade = true + elseif tonumber(level) == 18 and inv:contains_item("main", "default:cobble 10") and inv:contains_item("main", "castrum:sword_stone 3") then + txt = "build fountain first" + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:cobble 40") + inv:remove_item("main", "castrum:sword_stone 12") + upgrade = true + elseif tonumber(level) == 19 and inv:contains_item("main", "default:cobble 40") and inv:contains_item("main", "castrum:sword_stone 12") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 20 and upgrade then + Tower4(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "tower4" , tower4.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "smithy" then + for k, v in pairs(fields) do + if v == "del" then + Smithy(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Smithy.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "smithy" , smithy.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Smithy.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) < 6 and inv:contains_item("main", "default:cobble 8") and inv:contains_item("main", "default:wood 6") then + inv:remove_item("main", "default:cobble 8") + inv:remove_item("main", "default:wood 6") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), "not enough items") + end + if (tonumber(level)) < 6 and upgrade then + Smithy(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Smithy.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "smithy" , smithy.get_formspec(player)) + elseif v == "Crafting" then + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "stable" then + for k, v in pairs(fields) do + if v == "del" then + Stable(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Stable.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "stable" , stable.get_formspec(player)) + elseif v == "Upgrade" then + file = io.open(minetest.get_worldpath().."/SAVE/Stable.txt", "r") + local level = file:read("*l") + file:close() + if (tonumber(level)) < 7 then + Stable(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Stable.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "stable" , stable.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "mine" then + for k, v in pairs(fields) do + if v == "del" then + Mine(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "mine" , mine.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + local txt = "not enough items" + if tonumber(level) < 1 and tonumber(fountain) > 5 then + upgrade = true + elseif tonumber(level) < 1 then + txt = "upgrade fountain to lv.3 first" + elseif tonumber(level) == 1 and tonumber(chapter) > 1 then + upgrade = true + elseif tonumber(level) == 2 and tonumber(chapter) > 2 then + upgrade = true + elseif tonumber(level) == 1 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 2 then + txt = "complete chapter 2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 3 and upgrade then + Mine(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "mine" , mine.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "quarry" then + for k, v in pairs(fields) do + if v == "del" then + Quarry(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "quarry" , quarry.get_formspec(player)) + elseif v == "Upgrade" then + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local txt = "not enough items" + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) == 0 and tonumber(chapter) > 1 then + upgrade = true + elseif tonumber(level) == 1 and tonumber(chapter) > 2 and tonumber(fountain) > 3 then + upgrade = true + elseif tonumber(level) == 0 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 1 and tonumber(fountain) > 3 then + txt = "complete chapter 2 first" + elseif tonumber(level) == 1 then + txt = "build fountain first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 2 and upgrade then + Quarry(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "quarry" , quarry.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "tree" then + for k, v in pairs(fields) do + if v == "del" then + Tree(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "tree" , tree.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + local txt = "not enough items" + if tonumber(level) < 1 and tonumber(fountain) > 3 then + upgrade = true + elseif tonumber(level) < 1 then + txt = "upgrade fountain to lv.1 first" + elseif tonumber(level) == 1 and tonumber(chapter) > 1 then + upgrade = true + elseif tonumber(level) == 2 and tonumber(chapter) > 2 and tonumber(fountain) > 4 then + upgrade = true + elseif tonumber(level) == 1 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 2 and tonumber(fountain) > 4 then + txt = "complete chapter 2 first" + elseif tonumber(level) == 2 then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 3 and upgrade then + Tree(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "tree" , tree.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "pier" then + for k, v in pairs(fields) do + if v == "del" then + Pier(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Pier.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "pier" , pier.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Pier.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 5 and inv:contains_item("main", "default:wood 5") then + inv:remove_item("main", "default:wood 5") + upgrade = true + elseif tonumber(level) == 5 and inv:contains_item("main", "default:junglewood 25") then + inv:remove_item("main", "default:junglewood 25") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 6 and upgrade then + Pier(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Pier.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "pier" , pier.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "ship1" then + for k, v in pairs(fields) do + if v == "del" then + Ship1(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "ship1" , ship1.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 5 and inv:contains_item("main", "default:wood 10") and tonumber(fountain) > 4 then + inv:remove_item("main", "default:wood 10") + upgrade = true + elseif tonumber(level) < 5 and inv:contains_item("main", "default:wood 10") then + txt = "upgrade fountain to lv.2 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 5 and upgrade then + Ship1(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "ship1" , ship1.get_formspec(player)) + elseif v == "Go to Island" then + player:setpos({x=124, y=8.5, z=44}) + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "craft" then + for k, v in pairs(fields) do + if v == "Craft" then + if player:get_attribute("need1string") then + if player:get_inventory():contains_item("main", player:get_attribute("need1string")) and player:get_inventory():contains_item("main", player:get_attribute("need2string")) then + player:get_inventory():remove_item("main", player:get_attribute("need1string")) + player:get_inventory():remove_item("main", player:get_attribute("need2string")) + player:get_inventory():add_item("main", player:get_attribute("itemstring")) + else + minetest.chat_send_player(player:get_player_name(), "not enough items") + end + minetest.chat_send_player(player:get_player_name(), "select item first") + end + elseif v == "Soul" then + player:set_attribute("item", "Soul") + player:set_attribute("need1", "25 Cobblestone") + player:set_attribute("need2", "5 Water Buckets") + player:set_attribute("need1string", "default:cobble 25") + player:set_attribute("need2string", "castrum:bucket_water 5") + player:set_attribute("itemstring", "castrum:soul") + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "Steel\nIngot" then + player:set_attribute("item", "Steel Ingot") + player:set_attribute("need1", "2 Coal Lump") + player:set_attribute("need2", "1 Iron Lump") + player:set_attribute("need1string", "default:coal_lump 2") + player:set_attribute("need2string", "default:iron_lump") + player:set_attribute("itemstring", "default:steel_ingot") + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "Stone\nShovel" then + player:set_attribute("item", "Stone Shovel") + player:set_attribute("need1", "1 Cobblestone") + player:set_attribute("need2", "2 Wooden Planks") + player:set_attribute("need1string", "default:cobble") + player:set_attribute("need2string", "default:wood 2") + player:set_attribute("itemstring", "castrum:shovel_stone") + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "Stone\nPickaxe" then + player:set_attribute("item", "Stone Pickaxe") + player:set_attribute("need1", "3 Cobblestone") + player:set_attribute("need2", "2 Wooden Planks") + player:set_attribute("need1string", "default:cobble 3") + player:set_attribute("need2string", "default:wood 2") + player:set_attribute("itemstring", "castrum:pick_stone") + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "Stone\nSword" then + player:set_attribute("item", "Stone Sword") + player:set_attribute("need1", "2 Cobblestone") + player:set_attribute("need2", "1 Wooden Planks") + player:set_attribute("need1string", "default:cobble 2") + player:set_attribute("need2string", "default:wood") + player:set_attribute("itemstring", "castrum:sword_stone") + minetest.show_formspec(player:get_player_name(), "craft" , craft.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "<" then + minetest.show_formspec(player:get_player_name(), "smithy" , smithy.get_formspec(player)) + end + end + end + if formname == "new" then + minetest.show_formspec(player:get_player_name(), "", "") + end + if formname == "lake" then + for k, v in pairs(fields) do + if v == "del" then + Lake(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "lake" , lake.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + local txt = "not enough items" + if tonumber(level) < 1 and tonumber(fountain) > 4 then + upgrade = true + elseif tonumber(level) < 1 then + txt = "upgrade fountain to lv.2 first" + elseif tonumber(level) == 1 and tonumber(chapter) > 1 then + upgrade = true + elseif tonumber(level) == 2 and tonumber(chapter) > 2 and tonumber(fountain) > 5 then + upgrade = true + elseif tonumber(level) == 1 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 2 and tonumber(fountain) > 5 then + txt = "complete chapter 2 first" + elseif tonumber(level) == 2 then + txt = "upgrade fountain to lv.3 first" + end + + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 3 and upgrade then + Lake(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "lake" , lake.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "barracks" then + for k, v in pairs(fields) do + if v == "del" then + Barracks(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "barracks" , barracks.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 6 and inv:contains_item("main", "default:wood 20") and inv:contains_item("main", "default:cobble 20") and inv:contains_item("main", "castrum:bucket_water 5") then + inv:remove_item("main", "default:wood 20") + inv:remove_item("main", "default:cobble 20") + inv:remove_item("main", "castrum:bucket_water 5") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 6 and upgrade then + Barracks(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "barracks" , barracks.get_formspec(player)) + elseif v == "Get Knights" then + minetest.show_formspec(player:get_player_name(), "knight" , knight.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "camp1" then + for k, v in pairs(fields) do + if v == "del" then + Camp1(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "camp1" , camp1.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local home1 = file:read("*l") + file:close() + local txt = "not enough items" + if tonumber(level) < 1 and tonumber(home1) > 5 then + upgrade = true + elseif tonumber(level) < 1 then + txt = "build home 1 first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 1 and upgrade then + Camp1(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "camp1" , camp1.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "knight" then + for k, v in pairs(fields) do + if v == "Get Knight" then + max = 0 + max1 = 0 + max2 = 0 + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local home1 = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "r") + local home2 = file:read("*l") + file:close() + if tonumber(home1) == 6 then + max1 = max1+8 + elseif tonumber(home1) == 7 then + max1 = max1+11 + end + if tonumber(home2) == 6 then + max1 = max1+8 + end + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local camp1 = file:read("*l") + file:close() + if tonumber(camp1) == 1 then + max2 = max2+20 + end + if max1 > max2 then + max = max2 + elseif max2 > max1 then + max = max1 + else + max = max1 + end + file = io.open(minetest.get_worldpath().."/SAVE/Knight_1.txt", "r") + local knight_1 = file:read("*l") + file:close() + if tonumber(knight_1) < max then + if player:get_attribute("2need1string") then + if player:get_inventory():contains_item("main", player:get_attribute("2need1string")) and player:get_inventory():contains_item("main", player:get_attribute("2need2string")) then + player:get_inventory():remove_item("main", player:get_attribute("2need1string")) + player:get_inventory():remove_item("main", player:get_attribute("2need2string")) + Add_knight(player,player:get_attribute("knightlv"),true) + else + minetest.chat_send_player(player:get_player_name(), "not enough items") + end + else + minetest.chat_send_player(player:get_player_name(), "select knight first") + end + else + minetest.chat_send_player(player:get_player_name(), "you can only have "..max.." knights") + end + minetest.show_formspec(player:get_player_name(), "knight" , knight.get_formspec(player)) + elseif v == "Knight\nlv.1" then + player:set_attribute("2item", "Knight lv.1") + player:set_attribute("2need1", "1 Soul") + player:set_attribute("2need2", "3 Water Bucket") + player:set_attribute("2need1string", "castrum:soul") + player:set_attribute("2need2string", "castrum:bucket_water 3") + player:set_attribute("knightlv", "1") + minetest.show_formspec(player:get_player_name(), "knight" , knight.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "<" then + minetest.show_formspec(player:get_player_name(), "barracks" , barracks.get_formspec(player)) + end + end + end + if formname == "battleground" then + for k, v in pairs(fields) do + if v == "del" then + Battleground(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "battleground" , battleground.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + + local txt = "not enough items" + if tonumber(level) < 4 and tonumber(fountain) > 3 and inv:contains_item("main", "default:cobble 4") then + upgrade = true + inv:remove_item("main", "default:cobble 4") + elseif tonumber(level) < 4 and inv:contains_item("main", "default:cobble 4") then + txt = "build fountain first" + elseif tonumber(level) == 4 and tonumber(fountain) > 4 and inv:contains_item("main", "default:cobble 40") and tonumber(chapter) > 1 then + upgrade = true + inv:remove_item("main", "default:cobble 40") + elseif tonumber(level) == 4 and inv:contains_item("main", "default:cobble 40") and tonumber(fountain) > 4 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 4 and inv:contains_item("main", "default:cobble 40") then + txt = "upgrade fountain to lv.2 first" + end + + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 5 and upgrade then + Battleground(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "battleground" , battleground.get_formspec(player)) + elseif v == "Start Chapter 1" then + get_fight(1,player) + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "Start Chapter 2" then + get_fight(2,player) + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_walle" then + for k, v in pairs(fields) do + if v == "del" then + Island_Walle(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "island_walle" , island_walle.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 7 and inv:contains_item("main", "default:sand 3") then + inv:remove_item("main", "default:sand 3") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 7 and upgrade then + Island_Walle(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "island_walle" , island_walle.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_wallw" then + for k, v in pairs(fields) do + if v == "del" then + Island_Wallw(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "island_wallw" , island_wallw.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 7 and inv:contains_item("main", "default:sand 3") then + inv:remove_item("main", "default:sand 3") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 7 and upgrade then + Island_Wallw(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "island_wallw" , island_wallw.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_walls" then + for k, v in pairs(fields) do + if v == "del" then + Island_Walls(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "island_walls" , island_walls.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 7 and inv:contains_item("main", "default:sand 3") then + inv:remove_item("main", "default:sand 3") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 7 and upgrade then + Island_Walls(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "island_walls" , island_walls.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_walln" then + for k, v in pairs(fields) do + if v == "del" then + Island_Walln(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "island_walln" , island_walln.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 7 and inv:contains_item("main", "default:sand 3") then + inv:remove_item("main", "default:sand 3") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 7 and upgrade then + Island_Walln(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "island_walln" , island_walln.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_fountain" then + for k, v in pairs(fields) do + if v == "del" then + Island_Fountain(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "island_fountain" , island_fountain.get_formspec(player)) + elseif v == "Upgrade" or v == "Build" then + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "r") + local level = file:read("*l") + file:close() + local inv = player:get_inventory() + local upgrade = false + local txt = "not enough items" + if tonumber(level) < 4 and inv:contains_item("main", "default:sand 10") then + inv:remove_item("main", "default:sand 10") + upgrade = true + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 4 and upgrade then + Island_Fountain(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "island_fountain" , island_fountain.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "sandmine" then + for k, v in pairs(fields) do + if v == "del" then + Sandmine(0,player) + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "w") + file:write("0") + file:close() + minetest.show_formspec(player:get_player_name(), "sandmine" , sandmine.get_formspec(player)) + elseif v == "Upgrade" then + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "r") + local level = file:read("*l") + file:close() + file = io.open(minetest.get_worldpath().."/SAVE/Chapter.txt", "r") + local chapter = file:read("*l") + file:close() + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "r") + local fountain = file:read("*l") + file:close() + + local txt = "not enough items" + local inv = player:get_inventory() + local upgrade = false + if tonumber(level) == 0 and tonumber(chapter) > 1 then + upgrade = true + elseif tonumber(level) == 0 then + txt = "complete chapter 1 first" + elseif tonumber(level) == 1 and tonumber(chapter) > 2 and tonumber(fountain) > 3 then + upgrade = true + elseif tonumber(level) == 1 and tonumber(fountain) > 3 then + txt = "complete chapter 2 first" + elseif tonumber(level) == 1 then + txt = "build island fountain first" + end + if upgrade == false then + minetest.chat_send_player(player:get_player_name(), txt) + end + if (tonumber(level)) < 2 and upgrade then + Sandmine(tonumber(level)+1,player) + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "w") + file:write(tonumber(level)+1) + file:close() + end + minetest.show_formspec(player:get_player_name(), "sandmine" , sandmine.get_formspec(player)) + elseif v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end + if formname == "island_ship1" then + for k, v in pairs(fields) do + if v == "X" then + minetest.show_formspec(player:get_player_name(), "", "") + elseif v == "Go Back" then + player:setpos({x=-7, y=8.5, z=-58}) + minetest.show_formspec(player:get_player_name(), "", "") + end + end + end +end) \ No newline at end of file diff --git a/mods/castrum/models/castrum_knight.png b/mods/castrum/models/castrum_knight.png new file mode 100644 index 0000000..d90d7ed Binary files /dev/null and b/mods/castrum/models/castrum_knight.png differ diff --git a/mods/castrum/models/castrum_knight2.png b/mods/castrum/models/castrum_knight2.png new file mode 100644 index 0000000..0402ade Binary files /dev/null and b/mods/castrum/models/castrum_knight2.png differ diff --git a/mods/castrum/models/castrum_knight_dark.png b/mods/castrum/models/castrum_knight_dark.png new file mode 100644 index 0000000..494ab38 Binary files /dev/null and b/mods/castrum/models/castrum_knight_dark.png differ diff --git a/mods/castrum/models/castrum_knight_lv1.png b/mods/castrum/models/castrum_knight_lv1.png new file mode 100644 index 0000000..bd06735 Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv1.png differ diff --git a/mods/castrum/models/castrum_knight_lv1_dark.png b/mods/castrum/models/castrum_knight_lv1_dark.png new file mode 100644 index 0000000..17731b2 Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv1_dark.png differ diff --git a/mods/castrum/models/castrum_knight_lv2.png b/mods/castrum/models/castrum_knight_lv2.png new file mode 100644 index 0000000..186d7c8 Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv2.png differ diff --git a/mods/castrum/models/castrum_knight_lv3.png b/mods/castrum/models/castrum_knight_lv3.png new file mode 100644 index 0000000..3f97a90 Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv3.png differ diff --git a/mods/castrum/models/castrum_knight_lv4.png b/mods/castrum/models/castrum_knight_lv4.png new file mode 100644 index 0000000..ba7e23e Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv4.png differ diff --git a/mods/castrum/models/castrum_knight_lv5.png b/mods/castrum/models/castrum_knight_lv5.png new file mode 100644 index 0000000..2759c12 Binary files /dev/null and b/mods/castrum/models/castrum_knight_lv5.png differ diff --git a/mods/castrum/models/character.b3d b/mods/castrum/models/character.b3d new file mode 100644 index 0000000..9ab4543 Binary files /dev/null and b/mods/castrum/models/character.b3d differ diff --git a/mods/castrum/models/character.mtl b/mods/castrum/models/character.mtl new file mode 100644 index 0000000..b1e1381 --- /dev/null +++ b/mods/castrum/models/character.mtl @@ -0,0 +1,13 @@ +# Blender MTL File: 'character.blend' +# Material Count: 1 + +newmtl Character +Ns 96.078431 +Ka 1.000000 1.000000 1.000000 +Kd 0.640000 0.640000 0.640000 +Ks 0.000000 0.000000 0.000000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 1 +map_Kd D:\minetest-0.4.16\games\castrum\mods\default\models\character.png diff --git a/mods/castrum/models/character.obj b/mods/castrum/models/character.obj new file mode 100644 index 0000000..13c7b7b --- /dev/null +++ b/mods/castrum/models/character.obj @@ -0,0 +1,256 @@ +# Blender v2.79 (sub 0) OBJ File: 'character.blend' +# www.blender.org +mtllib character.mtl +o Player_Cube +v -0.200000 0.180102 0.100754 +v -0.200000 0.180102 -0.100755 +v -0.200000 0.860203 0.100754 +v -0.200000 0.860203 -0.100755 +v -0.400000 0.860205 -0.100755 +v -0.400000 0.860205 0.100754 +v -0.200000 0.860205 0.100754 +v -0.200000 0.860205 -0.100755 +v -0.400000 0.180103 -0.100755 +v -0.400000 0.180103 0.100754 +v -0.200000 0.180103 0.100754 +v -0.200000 0.180103 -0.100755 +v -0.200000 -0.500000 0.100754 +v -0.200000 -0.500000 -0.100755 +v -0.200000 0.180102 0.100754 +v -0.200000 0.180102 -0.100755 +v -0.200000 0.860203 0.201509 +v -0.200000 0.860203 -0.201510 +v -0.200000 1.263227 0.201509 +v -0.200000 1.263227 -0.201510 +v 0.200000 0.180102 -0.100755 +v 0.200000 0.180102 0.100754 +v 0.200000 0.860203 -0.100755 +v 0.200000 0.860203 0.100754 +v 0.200000 0.180103 -0.100755 +v 0.200000 0.180103 0.100754 +v 0.400000 0.180103 0.100754 +v 0.400000 0.180103 -0.100755 +v 0.200000 0.860205 -0.100755 +v 0.200000 0.860205 0.100754 +v 0.400000 0.860205 0.100754 +v 0.400000 0.860205 -0.100755 +v 0.000000 -0.500000 -0.100755 +v -0.000000 -0.500000 0.100754 +v 0.000000 0.180102 0.100754 +v 0.000000 0.180102 -0.100755 +v 0.200000 0.860203 -0.201510 +v 0.200000 0.860203 0.201509 +v 0.200000 1.263227 -0.201510 +v 0.200000 1.263227 0.201509 +v 0.200000 0.180102 -0.100755 +v 0.200000 0.180102 0.100754 +v 0.200000 -0.500000 -0.100755 +v 0.200000 -0.500000 0.100754 +v 0.000000 -0.500000 -0.100755 +v 0.000000 -0.500000 0.100754 +v 0.000000 0.180102 0.100754 +v 0.000000 0.180102 -0.100755 +v -0.220000 0.840354 0.221660 +v -0.220000 0.840354 -0.221660 +v -0.220000 1.283679 0.221660 +v -0.220000 1.283679 -0.221660 +v 0.220000 0.840354 -0.221660 +v 0.220000 0.840354 0.221660 +v 0.220000 1.283679 -0.221660 +v 0.220000 1.283679 0.221660 +v -0.200000 0.180102 0.137469 +v -0.200000 0.860203 0.137469 +v 0.200000 0.180102 0.137469 +v 0.200000 0.860203 0.137469 +v 0.200000 0.860203 0.100754 +v 0.200000 0.180102 0.100754 +v -0.200000 0.180102 0.100754 +v -0.200000 0.860203 0.100754 +vt 0.625000 0.375000 +vt 0.500000 0.375000 +vt 0.500000 0.000000 +vt 0.625000 0.000000 +vt 0.437500 0.375000 +vt 0.437500 0.000000 +vt 0.312500 0.375000 +vt 0.312500 0.000000 +vt 0.562500 0.375000 +vt 0.562500 0.500000 +vt 0.437500 0.500000 +vt 0.437500 0.375000 +vt 0.437500 0.500000 +vt 0.312500 0.500000 +vt 0.125000 0.375000 +vt 0.125000 0.000000 +vt 0.187500 0.000000 +vt 0.187500 0.375000 +vt 0.812500 0.375000 +vt 0.875000 0.375000 +vt 0.875000 0.000000 +vt 0.812500 0.000000 +vt 0.750000 0.375000 +vt 0.750000 0.000000 +vt 0.187500 0.375000 +vt 0.187500 0.500000 +vt 0.125000 0.500000 +vt 0.125000 0.375000 +vt 0.000000 0.375000 +vt 0.062500 0.375000 +vt 0.062500 0.000000 +vt 0.000000 0.000000 +vt 0.500000 0.750000 +vt 0.375000 0.750000 +vt 0.375000 0.500000 +vt 0.500000 0.500000 +vt 0.250000 0.750000 +vt 0.250000 0.500000 +vt 0.125000 0.750000 +vt 0.125000 0.500000 +vt 0.375000 0.750000 +vt 0.375000 1.000000 +vt 0.250000 1.000000 +vt 0.250000 0.750000 +vt 0.250000 1.000000 +vt 0.125000 1.000000 +vt 0.187500 0.375000 +vt 0.250000 0.375000 +vt 0.250000 0.000000 +vt 0.187500 0.000000 +vt 0.062500 0.375000 +vt 0.062500 0.000000 +vt 0.125000 0.375000 +vt 0.125000 0.000000 +vt 0.750000 0.375000 +vt 0.812500 0.375000 +vt 0.812500 0.500000 +vt 0.750000 0.500000 +vt 0.687500 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.500000 +vt 0.687500 0.500000 +vt 0.250000 0.000000 +vt 0.250000 0.375000 +vt 0.000000 0.375000 +vt 0.000000 0.000000 +vt 0.250000 0.375000 +vt 0.250000 0.000000 +vt 0.000000 0.750000 +vt 0.000000 0.500000 +vt 0.125000 0.375000 +vt 0.125000 0.500000 +vt 0.062500 0.500000 +vt 0.062500 0.375000 +vt 0.687500 0.375000 +vt 0.687500 0.000000 +vt 0.625000 0.375000 +vt 0.625000 0.000000 +vt 0.625000 0.375000 +vt 0.625000 0.000000 +vt 0.687500 0.000000 +vt 0.687500 0.500000 +vt 0.750000 0.500000 +vt 0.750000 0.000000 +vt 0.187500 0.375000 +vt 0.125000 0.375000 +vt 0.125000 0.500000 +vt 0.187500 0.500000 +vt 0.812500 0.000000 +vt 0.812500 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.500000 +vt 0.812500 0.500000 +vt 0.812500 0.375000 +vt 0.875000 0.000000 +vt 0.875000 0.375000 +vt 0.125000 0.375000 +vt 0.062500 0.375000 +vt 0.062500 0.500000 +vt 0.125000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 0.875000 0.500000 +vt 1.000000 0.500000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.875000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.750000 0.750000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.375000 +vt 0.875000 0.375000 +vt 0.875000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.375000 +vt 1.000000 0.000000 +vt 0.875000 0.000000 +vt 0.875000 0.375000 +vt 1.000000 0.343750 +vt 0.875000 0.343750 +vt 0.984375 0.000000 +vt 0.984375 0.375000 +vt 0.890625 0.375000 +vt 0.890625 0.000000 +vt 0.875000 0.031250 +vt 1.000000 0.031250 +vn -0.0000 0.0000 1.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +usemtl Character +s off +f 24/1/1 3/2/1 1/3/1 22/4/1 +f 3/2/2 4/5/2 2/6/2 1/3/2 +f 4/5/3 23/7/3 21/8/3 2/6/3 +f 21/9/4 22/10/4 1/11/4 2/12/4 +f 4/5/5 3/13/5 24/14/5 23/7/5 +f 48/15/2 45/16/2 46/17/2 47/18/2 +f 7/19/1 6/20/1 10/21/1 11/22/1 +f 8/23/6 7/19/6 11/22/6 12/24/6 +f 33/25/4 34/26/4 13/27/4 14/28/4 +f 15/29/2 16/30/2 14/31/2 13/32/2 +f 40/33/1 19/34/1 17/35/1 38/36/1 +f 19/34/2 20/37/2 18/38/2 17/35/2 +f 20/37/3 39/39/3 37/40/3 18/38/3 +f 37/41/4 38/42/4 17/43/4 18/44/4 +f 20/37/5 19/45/5 40/46/5 39/39/5 +f 35/47/1 15/48/1 13/49/1 34/50/1 +f 41/51/3 43/52/3 45/16/3 48/15/3 +f 16/30/3 36/53/3 33/54/3 14/31/3 +f 25/55/4 28/56/4 27/57/4 26/58/4 +f 32/59/5 29/60/5 30/61/5 31/62/5 +f 47/18/1 46/17/1 44/63/1 42/64/1 +f 36/53/6 35/47/6 34/50/6 33/54/6 +f 42/65/6 44/66/6 43/52/6 41/51/6 +f 24/67/6 22/68/6 21/8/6 23/7/6 +f 40/69/6 38/70/6 37/40/6 39/39/6 +f 16/71/5 15/72/5 35/73/5 36/74/5 +f 5/75/3 8/23/3 12/24/3 9/76/3 +f 6/77/2 5/75/2 9/76/2 10/78/2 +f 31/79/6 27/80/6 28/81/6 32/59/6 +f 5/75/5 6/82/5 7/83/5 8/23/5 +f 32/59/3 28/81/3 25/84/3 29/60/3 +f 45/85/4 43/86/4 44/87/4 46/88/4 +f 29/60/2 25/84/2 26/89/2 30/90/2 +f 12/91/4 11/92/4 10/93/4 9/94/4 +f 30/90/1 26/89/1 27/95/1 31/96/1 +f 41/97/5 48/98/5 47/99/5 42/100/5 +f 56/101/1 51/102/1 49/103/1 54/104/1 +f 51/102/2 52/105/2 50/106/2 49/103/2 +f 52/105/3 55/107/3 53/108/3 50/106/3 +f 53/109/4 54/110/4 49/111/4 50/112/4 +f 52/105/5 51/113/5 56/114/5 55/107/5 +f 56/115/6 54/116/6 53/108/6 55/107/6 +f 60/117/1 58/118/1 57/119/1 59/120/1 +f 61/121/3 62/122/3 63/123/3 64/124/3 +f 58/118/5 60/117/5 61/125/5 64/126/5 +f 60/117/6 59/120/6 62/127/6 61/128/6 +f 57/119/2 58/118/2 64/129/2 63/130/2 +f 59/120/4 57/119/4 63/131/4 62/132/4 diff --git a/mods/castrum/models/character.png b/mods/castrum/models/character.png new file mode 100644 index 0000000..0502178 Binary files /dev/null and b/mods/castrum/models/character.png differ diff --git a/mods/castrum/models/character2.mtl b/mods/castrum/models/character2.mtl new file mode 100644 index 0000000..b7207e5 --- /dev/null +++ b/mods/castrum/models/character2.mtl @@ -0,0 +1,13 @@ +# Blender MTL File: 'None' +# Material Count: 1 + +newmtl Character +Ns 94.117647 +Ka 1.000000 1.000000 1.000000 +Kd 0.640000 0.640000 0.640000 +Ks 0.000000 0.000000 0.000000 +Ke 0.000000 0.000000 0.000000 +Ni 1.000000 +d 1.000000 +illum 2 +map_Kd D:\minetest-0.4.16\games\castrum\mods\default\models\character.png diff --git a/mods/castrum/models/character2.obj b/mods/castrum/models/character2.obj new file mode 100644 index 0000000..9185ed7 --- /dev/null +++ b/mods/castrum/models/character2.obj @@ -0,0 +1,256 @@ +# Blender v2.79 (sub 0) OBJ File: '' +# www.blender.org +mtllib character2.mtl +o Player_Cube +v 0.198781 0.287138 0.300130 +v -0.204244 0.287138 0.300129 +v -0.204244 -0.392962 0.300129 +v 0.198781 -0.392962 0.300129 +v -0.204244 0.287138 0.098619 +v -0.204244 -0.392962 0.098619 +v 0.198781 0.287138 0.098619 +v 0.198781 -0.392962 0.098619 +v -0.002731 -0.292207 0.199374 +v -0.002731 -0.292207 -0.480724 +v -0.002731 -0.493718 -0.480724 +v -0.002731 -0.493718 0.199374 +v -0.204244 0.287138 0.300130 +v -0.405756 0.287138 0.300130 +v -0.405756 -0.392962 0.300129 +v -0.204244 -0.392962 0.300129 +v -0.204244 0.287138 0.098619 +v -0.204244 -0.392962 0.098619 +v -0.002731 -0.292207 -0.480724 +v -0.002731 -0.493718 -0.480724 +v -0.204244 -0.493718 -0.480724 +v -0.204244 -0.292207 -0.480724 +v -0.204244 -0.493718 0.199374 +v -0.204244 -0.292207 0.199374 +v 0.198781 0.690160 0.400885 +v -0.204244 0.690160 0.400885 +v -0.204244 0.287137 0.400885 +v 0.198781 0.287137 0.400885 +v -0.204244 0.690160 -0.002136 +v -0.204244 0.287138 -0.002136 +v 0.198781 0.690160 -0.002136 +v 0.198781 0.287138 -0.002136 +v -0.002731 -0.493718 0.199374 +v 0.198781 -0.292207 0.199374 +v 0.198781 -0.292207 -0.480724 +v -0.002731 -0.292207 0.199374 +v 0.198781 -0.392962 0.098619 +v 0.400294 -0.392962 0.098619 +v 0.400294 -0.392962 0.300129 +v 0.198781 -0.392962 0.300129 +v 0.400294 0.287138 0.098619 +v 0.198781 0.287138 0.098619 +v 0.198781 0.287138 0.300130 +v 0.400294 0.287138 0.300130 +v 0.198781 -0.493718 -0.480724 +v 0.198781 -0.493718 0.199374 +v -0.405756 0.287138 0.098619 +v -0.405756 -0.392962 0.098619 +v 0.218933 0.710612 0.421036 +v -0.224395 0.710612 0.421036 +v -0.224395 0.267288 0.421036 +v 0.218933 0.267288 0.421036 +v -0.224395 0.710612 -0.022287 +v -0.224395 0.267288 -0.022287 +v 0.218933 0.710612 -0.022287 +v 0.218933 0.267288 -0.022287 +v 0.198781 0.287138 0.336845 +v -0.204244 0.287138 0.336845 +v -0.204244 -0.392962 0.336845 +v 0.198781 -0.392962 0.336845 +v 0.198781 0.287138 0.300130 +v 0.198781 -0.392962 0.300129 +v -0.204244 -0.392962 0.300129 +v -0.204244 0.287138 0.300130 +vt 0.625000 0.375000 +vt 0.500000 0.375000 +vt 0.500000 0.000000 +vt 0.625000 0.000000 +vt 0.437500 0.375000 +vt 0.437500 0.000000 +vt 0.312500 0.375000 +vt 0.312500 0.000000 +vt 0.562500 0.375000 +vt 0.562500 0.500000 +vt 0.437500 0.500000 +vt 0.437500 0.375000 +vt 0.437500 0.500000 +vt 0.312500 0.500000 +vt 0.125000 0.375000 +vt 0.125000 0.000000 +vt 0.187500 0.000000 +vt 0.187500 0.375000 +vt 0.812500 0.375000 +vt 0.875000 0.375000 +vt 0.875000 0.000000 +vt 0.812500 0.000000 +vt 0.750000 0.375000 +vt 0.750000 0.000000 +vt 0.187500 0.375000 +vt 0.187500 0.500000 +vt 0.125000 0.500000 +vt 0.125000 0.375000 +vt 0.000000 0.375000 +vt 0.062500 0.375000 +vt 0.062500 0.000000 +vt 0.000000 0.000000 +vt 0.500000 0.750000 +vt 0.375000 0.750000 +vt 0.375000 0.500000 +vt 0.500000 0.500000 +vt 0.250000 0.750000 +vt 0.250000 0.500000 +vt 0.125000 0.750000 +vt 0.125000 0.500000 +vt 0.375000 0.750000 +vt 0.375000 1.000000 +vt 0.250000 1.000000 +vt 0.250000 0.750000 +vt 0.250000 1.000000 +vt 0.125000 1.000000 +vt 0.187500 0.375000 +vt 0.250000 0.375000 +vt 0.250000 0.000000 +vt 0.187500 0.000000 +vt 0.062500 0.375000 +vt 0.062500 0.000000 +vt 0.125000 0.375000 +vt 0.125000 0.000000 +vt 0.750000 0.375000 +vt 0.812500 0.375000 +vt 0.812500 0.500000 +vt 0.750000 0.500000 +vt 0.687500 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.500000 +vt 0.687500 0.500000 +vt 0.250000 0.000000 +vt 0.250000 0.375000 +vt 0.000000 0.375000 +vt 0.000000 0.000000 +vt 0.250000 0.375000 +vt 0.250000 0.000000 +vt 0.000000 0.750000 +vt 0.000000 0.500000 +vt 0.125000 0.375000 +vt 0.125000 0.500000 +vt 0.062500 0.500000 +vt 0.062500 0.375000 +vt 0.687500 0.375000 +vt 0.687500 0.000000 +vt 0.625000 0.375000 +vt 0.625000 0.000000 +vt 0.625000 0.375000 +vt 0.625000 0.000000 +vt 0.687500 0.000000 +vt 0.687500 0.500000 +vt 0.750000 0.500000 +vt 0.750000 0.000000 +vt 0.187500 0.375000 +vt 0.125000 0.375000 +vt 0.125000 0.500000 +vt 0.187500 0.500000 +vt 0.812500 0.000000 +vt 0.812500 0.375000 +vt 0.750000 0.375000 +vt 0.750000 0.500000 +vt 0.812500 0.500000 +vt 0.812500 0.375000 +vt 0.875000 0.000000 +vt 0.875000 0.375000 +vt 0.125000 0.375000 +vt 0.062500 0.375000 +vt 0.062500 0.500000 +vt 0.125000 0.500000 +vt 1.000000 0.750000 +vt 0.875000 0.750000 +vt 0.875000 0.500000 +vt 1.000000 0.500000 +vt 0.750000 0.750000 +vt 0.750000 0.500000 +vt 0.625000 0.750000 +vt 0.625000 0.500000 +vt 0.875000 0.750000 +vt 0.875000 1.000000 +vt 0.750000 1.000000 +vt 0.750000 0.750000 +vt 0.750000 1.000000 +vt 0.625000 1.000000 +vt 0.500000 0.750000 +vt 0.500000 0.500000 +vt 1.000000 0.375000 +vt 0.875000 0.375000 +vt 0.875000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.375000 +vt 1.000000 0.000000 +vt 0.875000 0.000000 +vt 0.875000 0.375000 +vt 1.000000 0.343750 +vt 0.875000 0.343750 +vt 0.984375 0.000000 +vt 0.984375 0.375000 +vt 0.890625 0.375000 +vt 0.890625 0.000000 +vt 0.875000 0.031250 +vt 1.000000 0.031250 +vn -0.0000 -0.0000 1.0000 +vn -1.0000 0.0000 0.0000 +vn 0.0000 0.0000 -1.0000 +vn 0.0000 -1.0000 0.0000 +vn 0.0000 1.0000 0.0000 +vn 1.0000 0.0000 0.0000 +usemtl Character +s 1 +f 1/1/1 2/2/1 3/3/1 4/4/1 +f 2/2/2 5/5/2 6/6/2 3/3/2 +f 5/5/3 7/7/3 8/8/3 6/6/3 +f 8/9/4 4/10/4 3/11/4 6/12/4 +f 5/5/5 2/13/5 1/14/5 7/7/5 +f 9/15/2 10/16/2 11/17/2 12/18/2 +f 13/19/1 14/20/1 15/21/1 16/22/1 +f 17/23/6 13/19/6 16/22/6 18/24/6 +f 19/25/3 20/26/3 21/27/3 22/28/3 +f 23/29/2 24/30/2 22/31/2 21/32/2 +f 25/33/1 26/34/1 27/35/1 28/36/1 +f 26/34/2 29/37/2 30/38/2 27/35/2 +f 29/37/3 31/39/3 32/40/3 30/38/3 +f 32/41/4 28/42/4 27/43/4 30/44/4 +f 29/37/5 26/45/5 25/46/5 31/39/5 +f 33/47/4 23/48/4 21/49/4 20/50/4 +f 34/51/5 35/52/5 10/16/5 9/15/5 +f 24/30/5 36/53/5 19/54/5 22/31/5 +f 37/55/4 38/56/4 39/57/4 40/58/4 +f 41/59/5 42/60/5 43/61/5 44/62/5 +f 12/18/4 11/17/4 45/63/4 46/64/4 +f 36/53/6 33/47/6 20/50/6 19/54/6 +f 46/65/6 45/66/6 35/52/6 34/51/6 +f 1/67/6 4/68/6 8/8/6 7/7/6 +f 25/69/6 28/70/6 32/40/6 31/39/6 +f 24/71/1 23/72/1 33/73/1 36/74/1 +f 47/75/3 17/23/3 18/24/3 48/76/3 +f 14/77/2 47/75/2 48/76/2 15/78/2 +f 44/79/6 39/80/6 38/81/6 41/59/6 +f 47/75/5 14/82/5 13/83/5 17/23/5 +f 41/59/3 38/81/3 37/84/3 42/60/3 +f 10/85/3 35/86/3 45/87/3 11/88/3 +f 42/60/2 37/84/2 40/89/2 43/90/2 +f 18/91/4 16/92/4 15/93/4 48/94/4 +f 43/90/1 40/89/1 39/95/1 44/96/1 +f 34/97/1 9/98/1 12/99/1 46/100/1 +f 49/101/1 50/102/1 51/103/1 52/104/1 +f 50/102/2 53/105/2 54/106/2 51/103/2 +f 53/105/3 55/107/3 56/108/3 54/106/3 +f 56/109/4 52/110/4 51/111/4 54/112/4 +f 53/105/5 50/113/5 49/114/5 55/107/5 +f 49/115/6 52/116/6 56/108/6 55/107/6 +f 57/117/1 58/118/1 59/119/1 60/120/1 +f 61/121/3 62/122/3 63/123/3 64/124/3 +f 58/118/5 57/117/5 61/125/5 64/126/5 +f 57/117/6 60/120/6 62/127/6 61/128/6 +f 59/119/2 58/118/2 64/129/2 63/130/2 +f 60/120/4 59/119/4 63/131/4 62/132/4 diff --git a/mods/castrum/textures/castrum_bridge_status.png b/mods/castrum/textures/castrum_bridge_status.png new file mode 100644 index 0000000..59aab6c Binary files /dev/null and b/mods/castrum/textures/castrum_bridge_status.png differ diff --git a/mods/castrum/textures/castrum_comming_soon.png b/mods/castrum/textures/castrum_comming_soon.png new file mode 100644 index 0000000..4e65121 Binary files /dev/null and b/mods/castrum/textures/castrum_comming_soon.png differ diff --git a/mods/castrum/textures/castrum_fight1.png b/mods/castrum/textures/castrum_fight1.png new file mode 100644 index 0000000..e4d3775 Binary files /dev/null and b/mods/castrum/textures/castrum_fight1.png differ diff --git a/mods/castrum/textures/castrum_fight2.png b/mods/castrum/textures/castrum_fight2.png new file mode 100644 index 0000000..95b6a7c Binary files /dev/null and b/mods/castrum/textures/castrum_fight2.png differ diff --git a/mods/castrum/textures/castrum_soul.png b/mods/castrum/textures/castrum_soul.png new file mode 100644 index 0000000..b3a3422 Binary files /dev/null and b/mods/castrum/textures/castrum_soul.png differ diff --git a/mods/castrum/update.lua b/mods/castrum/update.lua new file mode 100644 index 0000000..abba922 --- /dev/null +++ b/mods/castrum/update.lua @@ -0,0 +1,238 @@ +minetest.register_chatcommand("update", { + params = "", + description = "Run this command after update", + func = function(name, param) + local player = minetest.get_player_by_name(name) + + file = io.open(minetest.get_worldpath().."/SAVE/Home1.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Home1(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Home2.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Home2(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Barracks.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Barracks(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Battleground.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Battleground(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Bridge.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Bridge(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Camp1(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Fountain.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Fountain(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Lake.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Lake(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Mine.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Mine(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Moate.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Moat_east(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Moatw.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Moat_west(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Moats.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Moat_south(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Moatn.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Moat_north(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Pier.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Pier(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Quarry.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Quarry(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Ship1.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Ship1(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Smithy.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Smithy(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Tower1.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Tower1(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Tower2.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Tower2(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Tower3.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Tower3(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Tower4.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Tower4(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Tree.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Tree(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Walle.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Wall_east(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Wallw.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Wall_west(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Walls.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Wall_south(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Walln.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Wall_north(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Fountain.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Island_Fountain(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walln.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Island_Walln(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walls.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Island_Walls(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Wallw.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Island_Wallw(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Island_Walle.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Island_Walle(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Sandmine.txt", "r") + local level = file:read("*l") + file:close() + for i=1,tonumber(level) do + Sandmine(i,player) + end + + file = io.open(minetest.get_worldpath().."/SAVE/Camp1.txt", "r") + local level = file:read("*l") + file:close() + if tonumber(level) > 0 then + Update_knight(player) + end + end, +}) \ No newline at end of file diff --git a/mods/creative/README.txt b/mods/creative/README.txt new file mode 100644 index 0000000..82357f3 --- /dev/null +++ b/mods/creative/README.txt @@ -0,0 +1,12 @@ +Minetest Game mod: creative +=========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Jean-Patrick G. (kilbith) (MIT) + +Author of media (textures) +-------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0) diff --git a/mods/creative/depends.txt b/mods/creative/depends.txt new file mode 100644 index 0000000..975e652 --- /dev/null +++ b/mods/creative/depends.txt @@ -0,0 +1,2 @@ +default +sfinv diff --git a/mods/creative/init.lua b/mods/creative/init.lua new file mode 100644 index 0000000..51d6f79 --- /dev/null +++ b/mods/creative/init.lua @@ -0,0 +1,63 @@ +creative = {} + +local creative_mode_cache = minetest.settings:get_bool("creative_mode") + +function creative.is_enabled_for(name) + return creative_mode_cache +end + +dofile(minetest.get_modpath("creative") .. "/inventory.lua") + +if creative_mode_cache then + -- Dig time is modified according to difference (leveldiff) between tool + -- 'maxlevel' and node 'level'. Digtime is divided by the larger of + -- leveldiff and 1. + -- To speed up digging in creative, hand 'maxlevel' and 'digtime' have been + -- increased such that nodes of differing levels have an insignificant + -- effect on digtime. + local digtime = 42 + local caps = {times = {digtime, digtime, digtime}, uses = 0, maxlevel = 256} + + minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x = 1, y = 1, z = 2.5}, + range = 10, + tool_capabilities = { + full_punch_interval = 0.5, + max_drop_level = 3, + groupcaps = { + crumbly = caps, + cracky = caps, + snappy = caps, + choppy = caps, + oddly_breakable_by_hand = caps, + }, + damage_groups = {fleshy = 10}, + } + }) +end + +-- Unlimited node placement +minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) + return creative.is_enabled_for(placer:get_player_name()) +end) + +-- Don't pick up if the item is already in the inventory +local old_handle_node_drops = minetest.handle_node_drops +function minetest.handle_node_drops(pos, drops, digger) + if not digger or not digger:is_player() then + return + end + if not creative.is_enabled_for(digger:get_player_name()) then + return old_handle_node_drops(pos, drops, digger) + end + local inv = digger:get_inventory() + if inv then + for _, item in ipairs(drops) do + if not inv:contains_item("main", item, true) then + inv:add_item("main", item) + end + end + end +end diff --git a/mods/creative/inventory.lua b/mods/creative/inventory.lua new file mode 100644 index 0000000..0e1d813 --- /dev/null +++ b/mods/creative/inventory.lua @@ -0,0 +1,177 @@ +local player_inventory = {} + +function creative.init_creative_inventory(player) + local player_name = player:get_player_name() + player_inventory[player_name] = { + size = 0, + filter = "", + start_i = 0 + } + + minetest.create_detached_inventory("creative_" .. player_name, { + allow_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + if not to_list == "main" then + return count + else + return 0 + end + end, + allow_put = function(inv, listname, index, stack, player2) + return 0 + end, + allow_take = function(inv, listname, index, stack, player2) + return -1 + end, + on_move = function(inv, from_list, from_index, to_list, to_index, count, player2) + end, + on_put = function(inv, listname, index, stack, player2) + end, + on_take = function(inv, listname, index, stack, player2) + if stack and stack:get_count() > 0 then + minetest.log("action", player_name .. " takes " .. stack:get_name().. " from creative inventory") + end + end, + }, player_name) + + return player_inventory[player_name] +end + +function creative.update_creative_inventory(player_name, tab_content) + local creative_list = {} + local inv = player_inventory[player_name] or + creative.init_creative_inventory(minetest.get_player_by_name(player_name)) + local player_inv = minetest.get_inventory({type = "detached", name = "creative_" .. player_name}) + + for name, def in pairs(tab_content) do + if not (def.groups.not_in_creative_inventory == 1) and + def.description and def.description ~= "" and + (def.name:find(inv.filter, 1, true) or + def.description:lower():find(inv.filter, 1, true)) then + creative_list[#creative_list+1] = name + end + end + + table.sort(creative_list) + player_inv:set_size("main", #creative_list) + player_inv:set_list("main", creative_list) + inv.size = #creative_list +end + +-- Create the trash field +local trash = minetest.create_detached_inventory("creative_trash", { + -- Allow the stack to be placed and remove it in on_put() + -- This allows the creative inventory to restore the stack + allow_put = function(inv, listname, index, stack, player) + return stack:get_count() + end, + on_put = function(inv, listname) + inv:set_list(listname, {}) + end, +}) +trash:set_size("main", 1) + +creative.formspec_add = "" + +function creative.register_tab(name, title, items) + sfinv.register_page("creative:" .. name, { + title = title, + is_in_nav = function(self, player, context) + return creative.is_enabled_for(player:get_player_name()) + end, + get = function(self, player, context) + local player_name = player:get_player_name() + creative.update_creative_inventory(player_name, items) + local inv = player_inventory[player_name] + local start_i = inv.start_i or 0 + local pagenum = math.floor(start_i / (3*8) + 1) + local pagemax = math.ceil(inv.size / (3*8)) + return sfinv.make_formspec(player, context, + "label[6.2,3.35;" .. minetest.colorize("#FFFF00", tostring(pagenum)) .. " / " .. tostring(pagemax) .. "]" .. + [[ + image[4.06,3.4;0.8,0.8;creative_trash_icon.png] + listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF] + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + list[detached:creative_trash;main;4,3.3;1,1;] + listring[] + button[5.4,3.2;0.8,0.9;creative_prev;<] + button[7.25,3.2;0.8,0.9;creative_next;>] + button[2.1,3.4;0.8,0.5;creative_search;?] + button[2.75,3.4;0.8,0.5;creative_clear;X] + tooltip[creative_search;Search] + tooltip[creative_clear;Reset] + listring[current_player;main] + field_close_on_enter[creative_filter;false] + ]] .. + "field[0.3,3.5;2.2,1;creative_filter;;" .. minetest.formspec_escape(inv.filter) .. "]" .. + "listring[detached:creative_" .. player_name .. ";main]" .. + "list[detached:creative_" .. player_name .. ";main;0,0;8,3;" .. tostring(start_i) .. "]" .. + default.get_hotbar_bg(0,4.7) .. + default.gui_bg .. default.gui_bg_img .. default.gui_slots + .. creative.formspec_add, false) + end, + on_enter = function(self, player, context) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + if inv then + inv.start_i = 0 + end + end, + on_player_receive_fields = function(self, player, context, fields) + local player_name = player:get_player_name() + local inv = player_inventory[player_name] + assert(inv) + + if fields.creative_clear then + inv.start_i = 0 + inv.filter = "" + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif fields.creative_search or + fields.key_enter_field == "creative_filter" then + inv.start_i = 0 + inv.filter = fields.creative_filter:lower() + creative.update_creative_inventory(player_name, items) + sfinv.set_player_inventory_formspec(player, context) + elseif not fields.quit then + local start_i = inv.start_i or 0 + + if fields.creative_prev then + start_i = start_i - 3*8 + if start_i < 0 then + start_i = inv.size - (inv.size % (3*8)) + if inv.size == start_i then + start_i = math.max(0, inv.size - (3*8)) + end + end + elseif fields.creative_next then + start_i = start_i + 3*8 + if start_i >= inv.size then + start_i = 0 + end + end + + inv.start_i = start_i + sfinv.set_player_inventory_formspec(player, context) + end + end + }) +end + +minetest.register_on_joinplayer(function(player) + creative.update_creative_inventory(player:get_player_name(), minetest.registered_items) +end) + +creative.register_tab("all", "All", minetest.registered_items) +creative.register_tab("nodes", "Nodes", minetest.registered_nodes) +creative.register_tab("tools", "Tools", minetest.registered_tools) +creative.register_tab("craftitems", "Items", minetest.registered_craftitems) + +local old_homepage_name = sfinv.get_homepage_name +function sfinv.get_homepage_name(player) + if creative.is_enabled_for(player:get_player_name()) then + return "creative:all" + else + return old_homepage_name(player) + end +end diff --git a/mods/creative/license.txt b/mods/creative/license.txt new file mode 100644 index 0000000..4ad1d5f --- /dev/null +++ b/mods/creative/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2016 Jean-Patrick G. (kilbith) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/creative/textures/creative_trash_icon.png b/mods/creative/textures/creative_trash_icon.png new file mode 100644 index 0000000..e789ad6 Binary files /dev/null and b/mods/creative/textures/creative_trash_icon.png differ diff --git a/mods/default/README.txt b/mods/default/README.txt new file mode 100644 index 0000000..8af65a9 --- /dev/null +++ b/mods/default/README.txt @@ -0,0 +1,300 @@ +Minetest Game mod: default +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures, models and sounds) +---------------------------------------------- +Everything not listed in here: +celeron55, Perttu Ahola (CC BY-SA 3.0) + +Cisoun's texture pack (CC BY-SA 3.0): + default_jungletree.png + default_lava.png + default_leaves.png + default_sapling.png + default_bush_sapling.png + default_stone.png + default_tree.png + default_tree_top.png + default_water.png + +Cisoun's conifers mod (CC BY-SA 3.0): + default_pine_needles.png + +Originating from G4JC's Almost MC Texture Pack (CC BY-SA 3.0): + default_torch.png + default_torch_on_ceiling.png + default_torch_on_floor.png + +VanessaE's animated torches (CC BY-SA 3.0): + default_torch_animated.png + default_torch_on_ceiling_animated.png + default_torch_on_floor_animated.png + default_torch_on_floor.png + +RealBadAngel's animated water (CC BY-SA 3.0): + default_water_source_animated.png + default_water_flowing_animated.png + +VanessaE (CC BY-SA 3.0): + default_desert_sand.png + default_desert_stone.png + default_sand.png + default_mese_crystal.png + default_mese_crystal_fragment.png + +Calinou (CC BY-SA 3.0): + default_brick.png + default_papyrus.png + default_mineral_copper.png + default_glass_detail.png + +MirceaKitsune (CC BY-SA 3.0): + character.x + +Jordach (CC BY-SA 3.0): + character.png + +PilzAdam (CC BY-SA 3.0): + default_jungleleaves.png + default_junglesapling.png + default_obsidian_glass.png + default_obsidian_shard.png + default_mineral_gold.png + +jojoa1997 (CC BY-SA 3.0): + default_obsidian.png + +InfinityProject (CC BY-SA 3.0): + default_mineral_diamond.png + +Splizard (CC BY-SA 3.0): + default_pine_sapling.png + +Zeg9 (CC BY-SA 3.0): + default_coal_block.png + +paramat (CC BY-SA 3.0): + wieldhand.png -- Copied from character.png by Jordach (CC BY-SA 3.0) + default_pinetree.png + default_pinetree_top.png + default_pinewood.png + default_acacia_leaves.png + default_acacia_leaves_simple.png + default_acacia_sapling.png + default_acacia_bush_sapling.png + default_acacia_tree.png + default_acacia_tree_top.png + default_acacia_wood.png + default_acacia_bush_stem.png + default_bush_stem.png + default_junglewood.png + default_jungletree_top.png + default_sandstone_brick.png + default_obsidian_brick.png + default_stone_brick.png + default_desert_stone_brick.png + default_sandstone_block.png + default_obsidian_block.png + default_stone_block.png + default_desert_stone_block.png + default_river_water.png + default_river_water_source_animated.png + default_river_water_flowing_animated.png + default_dry_grass.png + default_dry_grass_side.png + default_dry_grass_*.png + default_grass.png + default_grass_side.png + default_mese_block.png + default_silver_sand.png + default_mese_post_light_side.png + default_mese_post_light_side_dark.png + default_mese_post_light_top.png + default_silver_sandstone.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) + default_silver_sandstone_brick.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) + default_silver_sandstone_block.png -- Derived from a texture by GreenXenith (CC-BY-SA 3.0) + +brunob.santos (CC BY-SA 4.0): + default_desert_cobble.png + +BlockMen (CC BY-SA 3.0): + default_aspen_leaves.png -- Derived from Sofar's texture + default_wood.png + default_clay_brick.png + default_iron_ingot.png + default_gold_ingot.png + default_tool_steelsword.png + default_diamond.png + default_book.png + default_tool_*.png + default_lava_source_animated.png + default_lava_flowing_animated.png + default_stick.png + default_chest_front.png + default_chest_lock.png + default_chest_side.png + default_chest_top.png + default_mineral_mese.png + default_meselamp.png + bubble.png + gui_*.png + +Wuzzy (CC BY-SA 3.0): + default_bookshelf_slot.png (based on default_book.png) + +sofar (CC BY-SA 3.0): + default_book_written.png, based on default_book.png + default_aspen_sapling + default_aspen_tree + default_aspen_tree_top, derived from default_pine_tree_top (by paramat) + default_aspen_wood, derived from default_pine_wood (by paramat) + default_chest_inside + +sofar (WTFPL): + default_gravel.png -- Derived from Gambit's PixelBOX texture pack light gravel + +Neuromancer (CC BY-SA 2.0): + default_cobble.png, based on texture by Brane praefect + default_mossycobble.png, based on texture by Brane praefect + +Neuromancer (CC BY-SA 3.0): + default_dirt.png + default_furnace_*.png + +Gambit (CC BY-SA 3.0): + default_bronze_ingot.png + default_copper_ingot.png + default_copper_lump.png + default_iron_lump.png + default_gold_lump.png + default_clay_lump.png + default_coal.png + default_grass_*.png + default_paper.png + default_diamond_block.png + default_ladder_steel.png + default_sign_wall_wood.png + default_flint.png + default_snow.png + default_snow_side.png + default_snowball.png + default_key.png + default_key_skeleton.png + +asl97 (CC BY-SA 3.0): + default_ice.png + +KevDoy (CC BY-SA 3.0) + heart.png + +Pithydon (CC BY-SA 3.0) + default_coral_brown.png + default_coral_orange.png + default_coral_skeleton.png + +Ferk (CC0 1.0) + default_item_smoke.png + default_item_smoke.ogg, based on sound by http://opengameart.org/users/bart + +npx (CC BY-SA 3.0) + default_rainforest_litter.png + default_rainforest_litter_side.png + +kaeza (CC-BY-SA 3.0): + default_desert_sandstone.png + default_desert_sandstone_brick.png + default_desert_sandstone_block.png + +kilbith (CC BY-SA 3.0): + default_steel_block.png + default_copper_block.png + default_bronze_block.png + default_gold_block.png + default_tin_block.png + default_mineral_tin.png + default_tin_ingot.png + default_tin_lump.png + +Glass breaking sounds (CC BY 3.0): + 1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ + 2: http://www.freesound.org/people/Tomlija/sounds/97669/ + 3: http://www.freesound.org/people/lsprice/sounds/88808/ + +sonictechtonic (CC BY 3.0): +https://www.freesound.org/people/sonictechtonic/sounds/241872/ + player_damage.ogg + +Mito551 (sounds) (CC BY-SA 3.0): + default_dig_choppy.ogg + default_dig_cracky.ogg + default_dig_crumbly.1.ogg + default_dig_crumbly.2.ogg + default_dig_dig_immediate.ogg + default_dig_oddly_breakable_by_hand.ogg + default_dug_node.1.ogg + default_dug_node.2.ogg + default_grass_footstep.1.ogg + default_grass_footstep.2.ogg + default_grass_footstep.3.ogg + default_gravel_footstep.1.ogg + default_gravel_footstep.2.ogg + default_gravel_footstep.3.ogg + default_gravel_footstep.4.ogg + default_grass_footstep.1.ogg + default_place_node.1.ogg + default_place_node.2.ogg + default_place_node.3.ogg + default_place_node_hard.1.ogg + default_place_node_hard.2.ogg + default_snow_footstep.1.ogg + default_snow_footstep.2.ogg + default_hard_footstep.1.ogg + default_hard_footstep.2.ogg + default_hard_footstep.3.ogg + default_sand_footstep.1.ogg + default_sand_footstep.2.ogg + default_wood_footstep.1.ogg + default_wood_footstep.2.ogg + default_dirt_footstep.1.ogg + default_dirt_footstep.2.ogg + default_glass_footstep.ogg + +Metal sounds: + default_dig_metal.ogg - yadronoff - CC-BY-3.0 + - https://www.freesound.org/people/yadronoff/sounds/320397/ + default_dug_metal.*.ogg - Iwan Gabovitch - qubodup - CC0 + - http://opengameart.org/users/qubodup + default_metal_footstep.*.ogg - Ottomaani138 - CC0 + - https://www.freesound.org/people/Ottomaani138/sounds/232692/ + default_place_node_metal.*.ogg - Ogrebane - CC0 + - http://opengameart.org/content/wood-and-metal-sound-effects-volume-2 + +Tool breaking sounds added by sofar: CC-BY-3.0 + default_tool_breaks.* - http://www.freesound.org/people/HerbertBoland/sounds/33206/ + +AGFX (CC BY 3.0) +https://www.freesound.org/people/AGFX/packs/1253/ + default_water_footstep.1.ogg + default_water_footstep.2.ogg + default_water_footstep.3.ogg +(default_water_footstep.4.ogg is silent) + +blukotek (CC0 1.0) +https://www.freesound.org/people/blukotek/sounds/251660/ + default_dig_snappy.ogg + +Chests sounds added by sofar, derived of several files mixed together: + default_chest_open.ogg + default_chest_close.ogg + - http://www.freesound.org/people/Sevin7/sounds/269722/ CC0 + - http://www.freesound.org/people/Percy%20Duke/sounds/23448/ CC-BY-3.0 + - http://www.freesound.org/people/kingsamas/sounds/135576/ CC-BY-3.0 + - http://www.freesound.org/people/bulbastre/sounds/126887/ CC-BY-3.0 + - http://www.freesound.org/people/Yoyodaman234/sounds/183541/ CC0 + diff --git a/mods/default/aliases.lua b/mods/default/aliases.lua new file mode 100644 index 0000000..6db3fc8 --- /dev/null +++ b/mods/default/aliases.lua @@ -0,0 +1,77 @@ +-- mods/default/aliases.lua + +-- Aliases to support loading worlds using nodes following the old naming convention +-- These can also be helpful when using chat commands, for example /giveme +minetest.register_alias("stone", "default:stone") +minetest.register_alias("stone_with_coal", "default:stone_with_coal") +minetest.register_alias("stone_with_iron", "default:stone_with_iron") +minetest.register_alias("dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("dirt_with_grass_footsteps", "default:dirt_with_grass_footsteps") +minetest.register_alias("dirt", "default:dirt") +minetest.register_alias("sand", "default:sand") +minetest.register_alias("gravel", "default:gravel") +minetest.register_alias("sandstone", "default:sandstone") +minetest.register_alias("clay", "default:clay") +minetest.register_alias("brick", "default:brick") +minetest.register_alias("tree", "default:tree") +minetest.register_alias("jungletree", "default:jungletree") +minetest.register_alias("junglegrass", "default:junglegrass") +minetest.register_alias("leaves", "default:leaves") +minetest.register_alias("cactus", "default:cactus") +minetest.register_alias("papyrus", "default:papyrus") +minetest.register_alias("bookshelf", "default:bookshelf") +minetest.register_alias("glass", "default:glass") +minetest.register_alias("wooden_fence", "default:fence_wood") +minetest.register_alias("rail", "carts:rail") +minetest.register_alias("ladder", "default:ladder_wood") +minetest.register_alias("wood", "default:wood") +minetest.register_alias("mese", "default:mese") +minetest.register_alias("cloud", "default:cloud") +minetest.register_alias("water_flowing", "default:water_flowing") +minetest.register_alias("water_source", "default:water_source") +minetest.register_alias("lava_flowing", "default:lava_flowing") +minetest.register_alias("lava_source", "default:lava_source") +minetest.register_alias("torch", "default:torch") +minetest.register_alias("sign_wall", "default:sign_wall_wood") +minetest.register_alias("furnace", "default:furnace") +minetest.register_alias("chest", "default:chest") +minetest.register_alias("locked_chest", "default:chest_locked") +minetest.register_alias("cobble", "default:cobble") +minetest.register_alias("mossycobble", "default:mossycobble") +minetest.register_alias("steelblock", "default:steelblock") +minetest.register_alias("sapling", "default:sapling") +minetest.register_alias("apple", "default:apple") + +minetest.register_alias("WPick", "default:pick_wood") +minetest.register_alias("STPick", "default:pick_stone") +minetest.register_alias("SteelPick", "default:pick_steel") +minetest.register_alias("MesePick", "default:pick_mese") +minetest.register_alias("WShovel", "default:shovel_wood") +minetest.register_alias("STShovel", "default:shovel_stone") +minetest.register_alias("SteelShovel", "default:shovel_steel") +minetest.register_alias("WAxe", "default:axe_wood") +minetest.register_alias("STAxe", "default:axe_stone") +minetest.register_alias("SteelAxe", "default:axe_steel") +minetest.register_alias("WSword", "default:sword_wood") +minetest.register_alias("STSword", "default:sword_stone") +minetest.register_alias("SteelSword", "default:sword_steel") + +minetest.register_alias("Stick", "default:stick") +minetest.register_alias("paper", "default:paper") +minetest.register_alias("book", "default:book") +minetest.register_alias("lump_of_coal", "default:coal_lump") +minetest.register_alias("lump_of_iron", "default:iron_lump") +minetest.register_alias("lump_of_clay", "default:clay_lump") +minetest.register_alias("steel_ingot", "default:steel_ingot") +minetest.register_alias("clay_brick", "default:clay_brick") +minetest.register_alias("snow", "default:snow") + +-- 'mese_block' was used for a while for the block form of mese +minetest.register_alias("default:mese_block", "default:mese") + +-- Aliases for corrected pine node names +minetest.register_alias("default:pinetree", "default:pine_tree") +minetest.register_alias("default:pinewood", "default:pine_wood") + +minetest.register_alias("default:ladder", "default:ladder_wood") +minetest.register_alias("default:sign_wall", "default:sign_wall_wood") diff --git a/mods/default/crafting.lua b/mods/default/crafting.lua new file mode 100644 index 0000000..50ffb1a --- /dev/null +++ b/mods/default/crafting.lua @@ -0,0 +1,1229 @@ +-- mods/default/crafting.lua + +minetest.register_craft({ + output = 'default:wood 4', + recipe = { + {'default:tree'}, + } +}) + +minetest.register_craft({ + output = 'default:junglewood 4', + recipe = { + {'default:jungletree'}, + } +}) + +minetest.register_craft({ + output = 'default:pine_wood 4', + recipe = { + {'default:pine_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood 4', + recipe = { + {'default:acacia_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:aspen_wood 4', + recipe = { + {'default:aspen_tree'}, + } +}) + +minetest.register_craft({ + output = 'default:wood', + recipe = { + {'default:bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:acacia_wood', + recipe = { + {'default:acacia_bush_stem'}, + } +}) + +minetest.register_craft({ + output = 'default:stick 4', + recipe = { + {'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall_steel 3', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:sign_wall_wood 3', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:torch 4', + recipe = { + {'default:coal_lump'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:pick_wood', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_stone', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:pick_diamond', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'', 'group:stick', ''}, + {'', 'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_wood', + recipe = { + {'group:wood'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_stone', + recipe = { + {'group:stone'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_steel', + recipe = { + {'default:steel_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_bronze', + recipe = { + {'default:bronze_ingot'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_mese', + recipe = { + {'default:mese_crystal'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:shovel_diamond', + recipe = { + {'default:diamond'}, + {'group:stick'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:wood', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stone', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'default:diamond', 'group:stick'}, + {'', 'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:axe_wood', + recipe = { + {'group:wood', 'group:wood'}, + {'group:stick', 'group:wood'}, + {'group:stick',''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_stone', + recipe = { + {'group:stone', 'group:stone'}, + {'group:stick', 'group:stone'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'group:stick', 'default:steel_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_bronze', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot'}, + {'group:stick', 'default:bronze_ingot'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal'}, + {'group:stick', 'default:mese_crystal'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:axe_diamond', + recipe = { + {'default:diamond', 'default:diamond'}, + {'group:stick', 'default:diamond'}, + {'group:stick', ''}, + } +}) + +minetest.register_craft({ + output = 'default:sword_wood', + recipe = { + {'group:wood'}, + {'group:wood'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_stone', + recipe = { + {'group:stone'}, + {'group:stone'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_steel', + recipe = { + {'default:steel_ingot'}, + {'default:steel_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_bronze', + recipe = { + {'default:bronze_ingot'}, + {'default:bronze_ingot'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_mese', + recipe = { + {'default:mese_crystal'}, + {'default:mese_crystal'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:sword_diamond', + recipe = { + {'default:diamond'}, + {'default:diamond'}, + {'group:stick'}, + } +}) + +minetest.register_craft({ + output = 'default:skeleton_key', + recipe = { + {'default:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:chest', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', '', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = 'default:chest_locked', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'default:steel_ingot', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft( { + type = "shapeless", + output = "default:chest_locked", + recipe = {"default:chest", "default:steel_ingot"}, +}) + +minetest.register_craft({ + output = 'default:furnace', + recipe = { + {'group:stone', 'group:stone', 'group:stone'}, + {'group:stone', '', 'group:stone'}, + {'group:stone', 'group:stone', 'group:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:coalblock', + recipe = { + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + {'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:coal_lump 9', + recipe = { + {'default:coalblock'}, + } +}) + +minetest.register_craft({ + output = 'default:steelblock', + recipe = { + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:steel_ingot 9', + recipe = { + {'default:steelblock'}, + } +}) + +minetest.register_craft({ + output = 'default:copperblock', + recipe = { + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + {'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:copper_ingot 9', + recipe = { + {'default:copperblock'}, + } +}) + +minetest.register_craft({ + output = "default:tinblock", + recipe = { + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + {"default:tin_ingot", "default:tin_ingot", "default:tin_ingot"}, + } +}) + +minetest.register_craft({ + output = "default:tin_ingot 9", + recipe = { + {"default:tinblock"}, + } +}) + +minetest.register_craft({ + output = "default:bronze_ingot 9", + recipe = { + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + } +}) + +minetest.register_craft({ + output = 'default:bronzeblock', + recipe = { + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + {'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:bronze_ingot 9', + recipe = { + {'default:bronzeblock'}, + } +}) + +minetest.register_craft({ + output = 'default:goldblock', + recipe = { + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + {'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:gold_ingot 9', + recipe = { + {'default:goldblock'}, + } +}) + +minetest.register_craft({ + output = 'default:diamondblock', + recipe = { + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + {'default:diamond', 'default:diamond', 'default:diamond'}, + } +}) + +minetest.register_craft({ + output = 'default:diamond 9', + recipe = { + {'default:diamondblock'}, + } +}) + +minetest.register_craft({ + output = "default:sandstone", + recipe = { + {"default:sand", "default:sand"}, + {"default:sand", "default:sand"}, + } +}) + +minetest.register_craft({ + output = "default:sand 4", + recipe = { + {"default:sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:sandstonebrick 4", + recipe = { + {"default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:sandstone_block 9", + recipe = { + {"default:sandstone", "default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone", "default:sandstone"}, + {"default:sandstone", "default:sandstone", "default:sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone", + recipe = { + {"default:desert_sand", "default:desert_sand"}, + {"default:desert_sand", "default:desert_sand"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sand 4", + recipe = { + {"default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone_brick 4", + recipe = { + {"default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:desert_sandstone_block 9", + recipe = { + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + {"default:desert_sandstone", "default:desert_sandstone", "default:desert_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone", + recipe = { + {"default:silver_sand", "default:silver_sand"}, + {"default:silver_sand", "default:silver_sand"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sand 4", + recipe = { + {"default:silver_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone_brick 4", + recipe = { + {"default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone"}, + } +}) + +minetest.register_craft({ + output = "default:silver_sandstone_block 9", + recipe = { + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, + {"default:silver_sandstone", "default:silver_sandstone", "default:silver_sandstone"}, + } +}) + +minetest.register_craft({ + output = 'default:clay', + recipe = { + {'default:clay_lump', 'default:clay_lump'}, + {'default:clay_lump', 'default:clay_lump'}, + } +}) + +minetest.register_craft({ + output = 'default:clay_lump 4', + recipe = { + {'default:clay'}, + } +}) + +minetest.register_craft({ + output = 'default:brick', + recipe = { + {'default:clay_brick', 'default:clay_brick'}, + {'default:clay_brick', 'default:clay_brick'}, + } +}) + +minetest.register_craft({ + output = 'default:clay_brick 4', + recipe = { + {'default:brick'}, + } +}) + +minetest.register_craft({ + output = 'default:paper', + recipe = { + {'default:papyrus', 'default:papyrus', 'default:papyrus'}, + } +}) + +minetest.register_craft({ + output = 'default:book', + recipe = { + {'default:paper'}, + {'default:paper'}, + {'default:paper'}, + } +}) + +minetest.register_craft({ + output = 'default:bookshelf', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'default:book', 'default:book', 'default:book'}, + {'group:wood', 'group:wood', 'group:wood'}, + } +}) + +minetest.register_craft({ + output = "default:ladder_wood 5", + recipe = { + {"group:stick", "", "group:stick"}, + {"group:stick", "group:stick", "group:stick"}, + {"group:stick", "", "group:stick"}, + } +}) + +minetest.register_craft({ + output = 'default:ladder_steel 15', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', '', 'default:steel_ingot'}, + } +}) + +minetest.register_craft({ + output = 'default:mese', + recipe = { + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + {'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal 9', + recipe = { + {'default:mese'}, + } +}) + +minetest.register_craft({ + output = 'default:mese_crystal_fragment 9', + recipe = { + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = "default:mese_crystal", + recipe = { + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + {"default:mese_crystal_fragment", "default:mese_crystal_fragment", "default:mese_crystal_fragment"}, + } +}) + +minetest.register_craft({ + output = 'default:meselamp', + recipe = { + {'default:glass'}, + {'default:mese_crystal'}, + } +}) + +minetest.register_craft({ + output = "default:mese_post_light 3", + recipe = { + {"", "default:glass", ""}, + {"default:mese_crystal", "default:mese_crystal", "default:mese_crystal"}, + {"", "group:wood", ""}, + } +}) + +minetest.register_craft({ + output = 'default:obsidian_shard 9', + recipe = { + {'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:obsidian', + recipe = { + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + {'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, + } +}) + +minetest.register_craft({ + output = 'default:obsidianbrick 4', + recipe = { + {'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian'} + } +}) + +minetest.register_craft({ + output = 'default:obsidian_block 9', + recipe = { + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + {'default:obsidian', 'default:obsidian', 'default:obsidian'}, + } +}) + +minetest.register_craft({ + output = 'default:stonebrick 4', + recipe = { + {'default:stone', 'default:stone'}, + {'default:stone', 'default:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:stone_block 9', + recipe = { + {'default:stone', 'default:stone', 'default:stone'}, + {'default:stone', 'default:stone', 'default:stone'}, + {'default:stone', 'default:stone', 'default:stone'}, + } +}) + +minetest.register_craft({ + output = 'default:desert_stonebrick 4', + recipe = { + {'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone'}, + } +}) + +minetest.register_craft({ + output = 'default:desert_stone_block 9', + recipe = { + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + {'default:desert_stone', 'default:desert_stone', 'default:desert_stone'}, + } +}) + +minetest.register_craft({ + output = 'default:snowblock', + recipe = { + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + {'default:snow', 'default:snow', 'default:snow'}, + } +}) + +minetest.register_craft({ + output = 'default:snow 9', + recipe = { + {'default:snowblock'}, + } +}) + +-- +-- Crafting (tool repair) +-- +minetest.register_craft({ + type = "toolrepair", + additional_wear = -0.02, +}) + +-- +-- Cooking recipes +-- + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "group:sand", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:obsidian_glass", + recipe = "default:obsidian_shard", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:stone", + recipe = "default:mossycobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:desert_stone", + recipe = "default:desert_cobble", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:steel_ingot", + recipe = "default:iron_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:copper_ingot", + recipe = "default:copper_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:tin_ingot", + recipe = "default:tin_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:gold_ingot", + recipe = "default:gold_lump", +}) + +minetest.register_craft({ + type = "cooking", + output = "default:clay_brick", + recipe = "default:clay_lump", +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:skeleton_key', + cooktime = 5, +}) + +minetest.register_craft({ + type = 'cooking', + output = 'default:gold_ingot', + recipe = 'default:key', + cooktime = 5, +}) + +-- +-- Fuels +-- + +-- Support use of group:tree +minetest.register_craft({ + type = "fuel", + recipe = "group:tree", + burntime = 30, +}) + +-- Burn time for all woods are in order of wood density, +-- which is also the order of wood colour darkness: +-- aspen, pine, apple, acacia, jungle + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_tree", + burntime = 22, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_tree", + burntime = 26, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:tree", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_tree", + burntime = 34, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:jungletree", + burntime = 38, +}) + + +-- Support use of group:wood +minetest.register_craft({ + type = "fuel", + recipe = "group:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglewood", + burntime = 9, +}) + + +-- Support use of group:sapling +minetest.register_craft({ + type = "fuel", + recipe = "group:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_sapling", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_sapling", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:aspen_sapling", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:pine_sapling", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sapling", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_sapling", + burntime = 11, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglesapling", + burntime = 12, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_aspen_wood", + burntime = 5, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_pine_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_wood", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_acacia_wood", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:fence_junglewood", + burntime = 9, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:bush_stem", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:acacia_bush_stem", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:junglegrass", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:leaves", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:cactus", + burntime = 15, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:papyrus", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bookshelf", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:ladder_wood", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:lava_source", + burntime = 60, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:torch", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sign_wall_wood", + burntime = 10, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:chest_locked", + burntime = 30, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:apple", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coal_lump", + burntime = 40, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:coalblock", + burntime = 370, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:grass_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_grass_1", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:paper", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:book_written", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:dry_shrub", + burntime = 2, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "group:stick", + burntime = 1, +}) + + +minetest.register_craft({ + type = "fuel", + recipe = "default:pick_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:shovel_wood", + burntime = 4, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:axe_wood", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "default:sword_wood", + burntime = 5, +}) diff --git a/mods/default/craftitems.lua b/mods/default/craftitems.lua new file mode 100644 index 0000000..33cdd5f --- /dev/null +++ b/mods/default/craftitems.lua @@ -0,0 +1,334 @@ +-- mods/default/craftitems.lua + +minetest.register_craftitem("default:stick", { + description = "Stick", + inventory_image = "default_stick.png", + groups = {stick = 1, flammable = 2}, +}) + +minetest.register_craftitem("default:paper", { + description = "Paper", + inventory_image = "default_paper.png", + groups = {flammable = 3}, +}) + + +local lpp = 14 -- Lines per book's page +local function book_on_use(itemstack, user) + local player_name = user:get_player_name() + local meta = itemstack:get_meta() + local title, text, owner = "", "", player_name + local page, page_max, lines, string = 1, 1, {}, "" + + -- Backwards compatibility + local old_data = minetest.deserialize(itemstack:get_metadata()) + if old_data then + meta:from_table({ fields = old_data }) + end + + local data = meta:to_table().fields + + if data.owner then + title = data.title + text = data.text + owner = data.owner + + for str in (text .. "\n"):gmatch("([^\n]*)[\n]") do + lines[#lines+1] = str + end + + if data.page then + page = data.page + page_max = data.page_max + + for i = ((lpp * page) - lpp) + 1, lpp * page do + if not lines[i] then break end + string = string .. lines[i] .. "\n" + end + end + end + + local formspec + if owner == player_name then + formspec = "size[8,8]" .. default.gui_bg .. + default.gui_bg_img .. + "field[0.5,1;7.5,0;title;Title:;" .. + minetest.formspec_escape(title) .. "]" .. + "textarea[0.5,1.5;7.5,7;text;Contents:;" .. + minetest.formspec_escape(text) .. "]" .. + "button_exit[2.5,7.5;3,1;save;Save]" + else + formspec = "size[8,8]" .. default.gui_bg .. + default.gui_bg_img .. + "label[0.5,0.5;by " .. owner .. "]" .. + "tablecolumns[color;text]" .. + "tableoptions[background=#00000000;highlight=#00000000;border=false]" .. + "table[0.4,0;7,0.5;title;#FFFF00," .. minetest.formspec_escape(title) .. "]" .. + "textarea[0.5,1.5;7.5,7;;" .. + minetest.formspec_escape(string ~= "" and string or text) .. ";]" .. + "button[2.4,7.6;0.8,0.8;book_prev;<]" .. + "label[3.2,7.7;Page " .. page .. " of " .. page_max .. "]" .. + "button[4.9,7.6;0.8,0.8;book_next;>]" + end + + minetest.show_formspec(player_name, "default:book", formspec) + return itemstack +end + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "default:book" then return end + local inv = player:get_inventory() + local stack = player:get_wielded_item() + + if fields.save and fields.title ~= "" and fields.text ~= "" then + local new_stack, data + if stack:get_name() ~= "default:book_written" then + local count = stack:get_count() + if count == 1 then + stack:set_name("default:book_written") + else + stack:set_count(count - 1) + new_stack = ItemStack("default:book_written") + end + else + data = stack:get_meta():to_table().fields + end + + if data and data.owner and data.owner ~= player:get_player_name() then + return + end + + if not data then data = {} end + data.title = fields.title + data.owner = player:get_player_name() + data.description = "\""..fields.title.."\" by "..data.owner + data.text = fields.text + data.text_len = #data.text + data.page = 1 + data.page_max = math.ceil((#data.text:gsub("[^\n]", "") + 1) / lpp) + + if new_stack then + new_stack:get_meta():from_table({ fields = data }) + if inv:room_for_item("main", new_stack) then + inv:add_item("main", new_stack) + else + minetest.add_item(player:getpos(), new_stack) + end + else + stack:get_meta():from_table({ fields = data }) + end + + elseif fields.book_next or fields.book_prev then + local data = stack:get_meta():to_table().fields + if not data or not data.page then + return + end + + data.page = tonumber(data.page) + data.page_max = tonumber(data.page_max) + + if fields.book_next then + data.page = data.page + 1 + if data.page > data.page_max then + data.page = 1 + end + else + data.page = data.page - 1 + if data.page == 0 then + data.page = data.page_max + end + end + + stack:get_meta():from_table({fields = data}) + stack = book_on_use(stack, player) + end + + -- Update stack + player:set_wielded_item(stack) +end) + +minetest.register_craftitem("default:book", { + description = "Book", + inventory_image = "default_book.png", + groups = {book = 1, flammable = 3}, + on_use = book_on_use, +}) + +minetest.register_craftitem("default:book_written", { + description = "Book With Text", + inventory_image = "default_book_written.png", + groups = {book = 1, not_in_creative_inventory = 1, flammable = 3}, + stack_max = 1, + on_use = book_on_use, +}) + +minetest.register_craft({ + type = "shapeless", + output = "default:book_written", + recipe = {"default:book", "default:book_written"} +}) + +minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) + if itemstack:get_name() ~= "default:book_written" then + return + end + + local original + local index + for i = 1, player:get_inventory():get_size("craft") do + if old_craft_grid[i]:get_name() == "default:book_written" then + original = old_craft_grid[i] + index = i + end + end + if not original then + return + end + local copymeta = original:get_meta():to_table() + -- copy of the book held by player's mouse cursor + itemstack:get_meta():from_table(copymeta) + -- put the book with metadata back in the craft grid + craft_inv:set_stack("craft", index, original) +end) + +minetest.register_craftitem("default:skeleton_key", { + description = "Skeleton Key", + inventory_image = "default_key_skeleton.png", + groups = {key = 1}, + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + + if not node then + return itemstack + end + + local on_skeleton_key_use = minetest.registered_nodes[node.name].on_skeleton_key_use + if not on_skeleton_key_use then + return itemstack + end + + -- make a new key secret in case the node callback needs it + local random = math.random + local newsecret = string.format( + "%04x%04x%04x%04x", + random(2^16) - 1, random(2^16) - 1, + random(2^16) - 1, random(2^16) - 1) + + local secret, _, _ = on_skeleton_key_use(pos, user, newsecret) + + if secret then + local inv = minetest.get_inventory({type="player", name=user:get_player_name()}) + + -- update original itemstack + itemstack:take_item() + + -- finish and return the new key + local new_stack = ItemStack("default:key") + local meta = new_stack:get_meta() + meta:set_string("secret", secret) + meta:set_string("description", "Key to "..user:get_player_name().."'s " + ..minetest.registered_nodes[node.name].description) + + if itemstack:get_count() == 0 then + itemstack = new_stack + else + if inv:add_item("main", new_stack):get_count() > 0 then + minetest.add_item(user:getpos(), new_stack) + end -- else: added to inventory successfully + end + + return itemstack + end + end +}) + +minetest.register_craftitem("default:coal_lump", { + description = "Coal Lump", + inventory_image = "default_coal_lump.png", + groups = {coal = 1, flammable = 1} +}) + +minetest.register_craftitem("default:iron_lump", { + description = "Iron Lump", + inventory_image = "default_iron_lump.png", +}) + +minetest.register_craftitem("default:copper_lump", { + description = "Copper Lump", + inventory_image = "default_copper_lump.png", +}) + +minetest.register_craftitem("default:tin_lump", { + description = "Tin Lump", + inventory_image = "default_tin_lump.png", +}) + +minetest.register_craftitem("default:mese_crystal", { + description = "Mese Crystal", + inventory_image = "default_mese_crystal.png", +}) + +minetest.register_craftitem("default:gold_lump", { + description = "Gold Lump", + inventory_image = "default_gold_lump.png", +}) + +minetest.register_craftitem("default:diamond", { + description = "Diamond", + inventory_image = "default_diamond.png", +}) + +minetest.register_craftitem("default:clay_lump", { + description = "Clay Lump", + inventory_image = "default_clay_lump.png", +}) + +minetest.register_craftitem("default:steel_ingot", { + description = "Steel Ingot", + inventory_image = "default_steel_ingot.png", +}) + +minetest.register_craftitem("default:copper_ingot", { + description = "Copper Ingot", + inventory_image = "default_copper_ingot.png", +}) + +minetest.register_craftitem("default:tin_ingot", { + description = "Tin Ingot", + inventory_image = "default_tin_ingot.png", +}) + +minetest.register_craftitem("default:bronze_ingot", { + description = "Bronze Ingot", + inventory_image = "default_bronze_ingot.png", +}) + +minetest.register_craftitem("default:gold_ingot", { + description = "Gold Ingot", + inventory_image = "default_gold_ingot.png" +}) + +minetest.register_craftitem("default:mese_crystal_fragment", { + description = "Mese Crystal Fragment", + inventory_image = "default_mese_crystal_fragment.png", +}) + +minetest.register_craftitem("default:clay_brick", { + description = "Clay Brick", + inventory_image = "default_clay_brick.png", +}) + +minetest.register_craftitem("default:obsidian_shard", { + description = "Obsidian Shard", + inventory_image = "default_obsidian_shard.png", +}) + +minetest.register_craftitem("default:flint", { + description = "Flint", + inventory_image = "default_flint.png" +}) diff --git a/mods/default/functions.lua b/mods/default/functions.lua new file mode 100644 index 0000000..5dc22ca --- /dev/null +++ b/mods/default/functions.lua @@ -0,0 +1,574 @@ +-- mods/default/functions.lua + +-- +-- Sounds +-- + +function default.node_sound_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "", gain = 1.0} + table.dug = table.dug or + {name = "default_dug_node", gain = 0.25} + table.place = table.place or + {name = "default_place_node_hard", gain = 1.0} + return table +end + +function default.node_sound_stone_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_hard_footstep", gain = 0.3} + table.dug = table.dug or + {name = "default_hard_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_dirt_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_dirt_footstep", gain = 0.4} + table.dug = table.dug or + {name = "default_dirt_footstep", gain = 1.0} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_sand_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_sand_footstep", gain = 0.12} + table.dug = table.dug or + {name = "default_sand_footstep", gain = 0.24} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_gravel_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_gravel_footstep", gain = 0.4} + table.dug = table.dug or + {name = "default_gravel_footstep", gain = 1.0} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_wood_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_wood_footstep", gain = 0.3} + table.dug = table.dug or + {name = "default_wood_footstep", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_leaves_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_grass_footstep", gain = 0.45} + table.dug = table.dug or + {name = "default_grass_footstep", gain = 0.7} + table.place = table.place or + {name = "default_place_node", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_glass_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_glass_footstep", gain = 0.3} + table.dig = table.dig or + {name = "default_glass_footstep", gain = 0.5} + table.dug = table.dug or + {name = "default_break_glass", gain = 1.0} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_metal_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_metal_footstep", gain = 0.4} + table.dig = table.dig or + {name = "default_dig_metal", gain = 0.5} + table.dug = table.dug or + {name = "default_dug_metal", gain = 0.5} + table.place = table.place or + {name = "default_place_node_metal", gain = 0.5} + default.node_sound_defaults(table) + return table +end + +function default.node_sound_water_defaults(table) + table = table or {} + table.footstep = table.footstep or + {name = "default_water_footstep", gain = 0.2} + default.node_sound_defaults(table) + return table +end + +-- +-- Lavacooling +-- + +default.cool_lava = function(pos, node) + if node.name == "default:lava_source" then + minetest.set_node(pos, {name = "default:obsidian"}) + else -- Lava flowing + minetest.set_node(pos, {name = "default:stone"}) + end + minetest.sound_play("default_cool_lava", + {pos = pos, max_hear_distance = 16, gain = 0.25}) +end + +if minetest.settings:get_bool("enable_lavacooling") ~= false then + minetest.register_abm({ + label = "Lava cooling", + nodenames = {"default:lava_source", "default:lava_flowing"}, + neighbors = {"group:cools_lava", "group:water"}, + interval = 1, + chance = 2, + catch_up = false, + action = default.cool_lava, + }) +end + +-- +-- optimized helper to put all items in an inventory into a drops list +-- + +function default.get_inventory_drops(pos, inventory, drops) + local inv = minetest.get_meta(pos):get_inventory() + local n = #drops + for i = 1, inv:get_size(inventory) do + local stack = inv:get_stack(inventory, i) + if stack:get_count() > 0 then + drops[n+1] = stack:to_table() + n = n + 1 + end + end +end + +-- +-- Papyrus and cactus growing +-- + +-- wrapping the functions in abm action is necessary to make overriding them possible + +function default.grow_cactus(pos, node) + if node.param2 >= 4 then + return + end + pos.y = pos.y - 1 + if minetest.get_item_group(minetest.get_node(pos).name, "sand") == 0 then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:cactus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + if minetest.get_node_light(pos) < 13 then + return + end + minetest.set_node(pos, {name = "default:cactus"}) + return true +end + +function default.grow_papyrus(pos, node) + pos.y = pos.y - 1 + local name = minetest.get_node(pos).name + if name ~= "default:dirt_with_grass" and name ~= "default:dirt" then + return + end + if not minetest.find_node_near(pos, 3, {"group:water"}) then + return + end + pos.y = pos.y + 1 + local height = 0 + while node.name == "default:papyrus" and height < 4 do + height = height + 1 + pos.y = pos.y + 1 + node = minetest.get_node(pos) + end + if height == 4 or node.name ~= "air" then + return + end + if minetest.get_node_light(pos) < 13 then + return + end + minetest.set_node(pos, {name = "default:papyrus"}) + return true +end + +minetest.register_abm({ + label = "Grow cactus", + nodenames = {"default:cactus"}, + neighbors = {"group:sand"}, + interval = 12, + chance = 83, + action = default.grow_cactus +}) + +minetest.register_abm({ + label = "Grow papyrus", + nodenames = {"default:papyrus"}, + neighbors = {"default:dirt", "default:dirt_with_grass"}, + interval = 14, + chance = 71, + action = default.grow_papyrus +}) + + +-- +-- dig upwards +-- + +function default.dig_up(pos, node, digger) + if digger == nil then return end + local np = {x = pos.x, y = pos.y + 1, z = pos.z} + local nn = minetest.get_node(np) + if nn.name == node.name then + minetest.node_dig(np, nn, digger) + end +end + + +-- +-- Fence registration helper +-- + +function default.register_fence(name, def) + minetest.register_craft({ + output = name .. " 4", + recipe = { + { def.material, 'group:stick', def.material }, + { def.material, 'group:stick', def.material }, + } + }) + + local fence_texture = "default_fence_overlay.png^" .. def.texture .. + "^default_fence_overlay.png^[makealpha:255,126,126" + -- Allow almost everything to be overridden + local default_fields = { + paramtype = "light", + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/8, -1/2, -1/8, 1/8, 1/2, 1/8}}, + -- connect_top = + -- connect_bottom = + connect_front = {{-1/16,3/16,-1/2,1/16,5/16,-1/8}, + {-1/16,-5/16,-1/2,1/16,-3/16,-1/8}}, + connect_left = {{-1/2,3/16,-1/16,-1/8,5/16,1/16}, + {-1/2,-5/16,-1/16,-1/8,-3/16,1/16}}, + connect_back = {{-1/16,3/16,1/8,1/16,5/16,1/2}, + {-1/16,-5/16,1/8,1/16,-3/16,1/2}}, + connect_right = {{1/8,3/16,-1/16,1/2,5/16,1/16}, + {1/8,-5/16,-1/16,1/2,-3/16,1/16}}, + }, + connects_to = {"group:fence", "group:wood", "group:tree"}, + inventory_image = fence_texture, + wield_image = fence_texture, + tiles = {def.texture}, + sunlight_propagates = true, + is_ground_content = false, + groups = {}, + } + for k, v in pairs(default_fields) do + if not def[k] then + def[k] = v + end + end + + -- Always add to the fence group, even if no group provided + def.groups.fence = 1 + + def.texture = nil + def.material = nil + + minetest.register_node(name, def) +end + + +-- +-- Leafdecay +-- + +-- Prevent decay of placed leaves + +default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) + if placer and not placer:get_player_control().sneak then + local node = minetest.get_node(pos) + node.param2 = 1 + minetest.set_node(pos, node) + end +end + +-- Leafdecay +local function leafdecay_after_destruct(pos, oldnode, def) + for _, v in pairs(minetest.find_nodes_in_area(vector.subtract(pos, def.radius), + vector.add(pos, def.radius), def.leaves)) do + local node = minetest.get_node(v) + local timer = minetest.get_node_timer(v) + if node.param2 == 0 and not timer:is_started() then + timer:start(math.random(20, 120) / 10) + end + end +end + +local function leafdecay_on_timer(pos, def) + if minetest.find_node_near(pos, def.radius, def.trunks) then + return false + end + + local node = minetest.get_node(pos) + local drops = minetest.get_node_drops(node.name) + for _, item in ipairs(drops) do + local is_leaf + for _, v in pairs(def.leaves) do + if v == item then + is_leaf = true + end + end + if minetest.get_item_group(item, "leafdecay_drop") ~= 0 or + not is_leaf then + minetest.add_item({ + x = pos.x - 0.5 + math.random(), + y = pos.y - 0.5 + math.random(), + z = pos.z - 0.5 + math.random(), + }, item) + end + end + + minetest.remove_node(pos) + minetest.check_for_falling(pos) +end + +function default.register_leafdecay(def) + assert(def.leaves) + assert(def.trunks) + assert(def.radius) + for _, v in pairs(def.trunks) do + minetest.override_item(v, { + after_destruct = function(pos, oldnode) + leafdecay_after_destruct(pos, oldnode, def) + end, + }) + end + for _, v in pairs(def.leaves) do + minetest.override_item(v, { + on_timer = function(pos) + leafdecay_on_timer(pos, def) + end, + }) + end +end + +-- +-- Convert dirt to something that fits the environment +-- + +minetest.register_abm({ + label = "Grass spread", + nodenames = {"default:dirt"}, + neighbors = { + "air", + "group:grass", + "group:dry_grass", + "default:snow", + }, + interval = 6, + chance = 50, + catch_up = false, + action = function(pos, node) + -- Check for darkness: night, shadow or under a light-blocking node + -- Returns if ignore above + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + if (minetest.get_node_light(above) or 0) < 13 then + return + end + + -- Look for spreading dirt-type neighbours + local p2 = minetest.find_node_near(pos, 1, "group:spreading_dirt_type") + if p2 then + local n3 = minetest.get_node(p2) + minetest.set_node(pos, {name = n3.name}) + return + end + + -- Else, any seeding nodes on top? + local name = minetest.get_node(above).name + -- Snow check is cheapest, so comes first + if name == "default:snow" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + -- Most likely case first + elseif minetest.get_item_group(name, "grass") ~= 0 then + minetest.set_node(pos, {name = "default:dirt_with_grass"}) + elseif minetest.get_item_group(name, "dry_grass") ~= 0 then + minetest.set_node(pos, {name = "default:dirt_with_dry_grass"}) + end + end +}) + + +-- +-- Grass and dry grass removed in darkness +-- + +minetest.register_abm({ + label = "Grass covered", + nodenames = {"group:spreading_dirt_type"}, + interval = 8, + chance = 50, + catch_up = false, + action = function(pos, node) + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local name = minetest.get_node(above).name + local nodedef = minetest.registered_nodes[name] + if name ~= "ignore" and nodedef and not ((nodedef.sunlight_propagates or + nodedef.paramtype == "light") and + nodedef.liquidtype == "none") then + minetest.set_node(pos, {name = "default:dirt"}) + end + end +}) + + +-- +-- Moss growth on cobble near water +-- + +minetest.register_abm({ + label = "Moss growth", + nodenames = {"default:cobble", "stairs:slab_cobble", "stairs:stair_cobble", "walls:cobble"}, + neighbors = {"group:water"}, + interval = 16, + chance = 200, + catch_up = false, + action = function(pos, node) + if node.name == "default:cobble" then + minetest.set_node(pos, {name = "default:mossycobble"}) + elseif node.name == "stairs:slab_cobble" then + minetest.set_node(pos, {name = "stairs:slab_mossycobble", param2 = node.param2}) + elseif node.name == "stairs:stair_cobble" then + minetest.set_node(pos, {name = "stairs:stair_mossycobble", param2 = node.param2}) + elseif node.name == "walls:cobble" then + minetest.set_node(pos, {name = "walls:mossycobble", param2 = node.param2}) + end + end +}) + + +-- +-- Checks if specified volume intersects a protected volume +-- + +function default.intersects_protection(minp, maxp, player_name, interval) + -- 'interval' is the largest allowed interval for the 3D lattice of checks + + -- Compute the optimal float step 'd' for each axis so that all corners and + -- borders are checked. 'd' will be smaller or equal to 'interval'. + -- Subtracting 1e-4 ensures that the max co-ordinate will be reached by the + -- for loop (which might otherwise not be the case due to rounding errors). + local d = {} + for _, c in pairs({"x", "y", "z"}) do + if maxp[c] > minp[c] then + d[c] = (maxp[c] - minp[c]) / math.ceil((maxp[c] - minp[c]) / interval) - 1e-4 + elseif maxp[c] == minp[c] then + d[c] = 1 -- Any value larger than 0 to avoid division by zero + else -- maxp[c] < minp[c], print error and treat as protection intersected + minetest.log("error", "maxp < minp in 'default.intersects_protection()'") + return true + end + end + + for zf = minp.z, maxp.z, d.z do + local z = math.floor(zf + 0.5) + for yf = minp.y, maxp.y, d.y do + local y = math.floor(yf + 0.5) + for xf = minp.x, maxp.x, d.x do + local x = math.floor(xf + 0.5) + if minetest.is_protected({x = x, y = y, z = z}, player_name) then + return true + end + end + end + end + + return false +end + + +-- +-- Coral death near air +-- + +minetest.register_abm({ + nodenames = {"default:coral_brown", "default:coral_orange"}, + neighbors = {"air"}, + interval = 17, + chance = 5, + catch_up = false, + action = function(pos, node) + minetest.set_node(pos, {name = "default:coral_skeleton"}) + end, +}) + + +-- +-- NOTICE: This method is not an official part of the API yet! +-- This method may change in future. +-- + +function default.can_interact_with_node(player, pos) + if player then + if minetest.check_player_privs(player, "protection_bypass") then + return true + end + else + return false + end + + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + + if not owner or owner == "" or owner == player:get_player_name() then + return true + end + + -- is player wielding the right key? + local item = player:get_wielded_item() + if item:get_name() == "default:key" then + local key_meta = item:get_meta() + + if key_meta:get_string("secret") == "" then + local key_oldmeta = item:get_metadata() + if key_oldmeta == "" or not minetest.parse_json(key_oldmeta) then + return false + end + + key_meta:set_string("secret", minetest.parse_json(key_oldmeta).secret) + item:set_metadata("") + end + + return meta:get_string("key_lock_secret") == key_meta:get_string("secret") + end + + return false +end diff --git a/mods/default/furnace.lua b/mods/default/furnace.lua new file mode 100644 index 0000000..4b82205 --- /dev/null +++ b/mods/default/furnace.lua @@ -0,0 +1,330 @@ + +-- +-- Formspecs +-- + +local function active_formspec(fuel_percent, item_percent) + local formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. + (100-fuel_percent)..":default_furnace_fire_fg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:".. + (item_percent)..":gui_furnace_arrow_fg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + return formspec +end + +local inactive_formspec = + "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_name;src;2.75,0.5;1,1;]".. + "list[current_name;fuel;2.75,2.5;1,1;]".. + "image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. + "image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "list[current_name;dst;4.75,0.96;2,2;]".. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "listring[current_name;dst]".. + "listring[current_player;main]".. + "listring[current_name;src]".. + "listring[current_player;main]".. + "listring[current_name;fuel]".. + "listring[current_player;main]".. + default.get_hotbar_bg(0, 4.25) + +-- +-- Node callback functions that are the same for active and inactive furnace +-- + +local function can_dig(pos, player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") +end + +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + if listname == "fuel" then + if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then + if inv:is_empty("src") then + meta:set_string("infotext", "Furnace is empty") + end + return stack:get_count() + else + return 0 + end + elseif listname == "src" then + return stack:get_count() + elseif listname == "dst" then + return 0 + end +end + +local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + local stack = inv:get_stack(from_list, from_index) + return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) +end + +local function allow_metadata_inventory_take(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +end + +local function swap_node(pos, name) + local node = minetest.get_node(pos) + if node.name == name then + return + end + node.name = name + minetest.swap_node(pos, node) +end + +local function furnace_node_timer(pos, elapsed) + -- + -- Inizialize metadata + -- + local meta = minetest.get_meta(pos) + local fuel_time = meta:get_float("fuel_time") or 0 + local src_time = meta:get_float("src_time") or 0 + local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 + + local inv = meta:get_inventory() + local srclist, fuellist + + local cookable, cooked + local fuel + + local update = true + while update do + update = false + + srclist = inv:get_list("src") + fuellist = inv:get_list("fuel") + + -- + -- Cooking + -- + + -- Check if we have cookable content + local aftercooked + cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) + cookable = cooked.time ~= 0 + + -- Check if we have enough fuel to burn + if fuel_time < fuel_totaltime then + -- The furnace is currently active and has enough fuel + fuel_time = fuel_time + elapsed + -- If there is a cookable item then check if it is ready yet + if cookable then + src_time = src_time + elapsed + if src_time >= cooked.time then + -- Place result in dst list if possible + if inv:room_for_item("dst", cooked.item) then + inv:add_item("dst", cooked.item) + inv:set_stack("src", 1, aftercooked.items[1]) + src_time = src_time - cooked.time + update = true + end + end + end + else + -- Furnace ran out of fuel + if cookable then + -- We need to get new fuel + local afterfuel + fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) + + if fuel.time == 0 then + -- No valid fuel in fuel list + fuel_totaltime = 0 + src_time = 0 + else + -- Take fuel from fuel list + inv:set_stack("fuel", 1, afterfuel.items[1]) + update = true + fuel_totaltime = fuel.time + (fuel_time - fuel_totaltime) + src_time = src_time + elapsed + end + else + -- We don't need to get new fuel since there is no cookable item + fuel_totaltime = 0 + src_time = 0 + end + fuel_time = 0 + end + + elapsed = 0 + end + + if fuel and fuel_totaltime > fuel.time then + fuel_totaltime = fuel.time + end + if srclist[1]:is_empty() then + src_time = 0 + end + + -- + -- Update formspec, infotext and node + -- + local formspec = inactive_formspec + local item_state + local item_percent = 0 + if cookable then + item_percent = math.floor(src_time / cooked.time * 100) + if item_percent > 100 then + item_state = "100% (output full)" + else + item_state = item_percent .. "%" + end + else + if srclist[1]:is_empty() then + item_state = "Empty" + else + item_state = "Not cookable" + end + end + + local fuel_state = "Empty" + local active = "inactive " + local result = false + + if fuel_totaltime ~= 0 then + active = "active " + local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) + fuel_state = fuel_percent .. "%" + formspec = active_formspec(fuel_percent, item_percent) + swap_node(pos, "default:furnace_active") + -- make sure timer restarts automatically + result = true + else + if not fuellist[1]:is_empty() then + fuel_state = "0%" + end + swap_node(pos, "default:furnace") + -- stop timer on the inactive furnace + minetest.get_node_timer(pos):stop() + end + + local infotext = "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" + + -- + -- Set meta values + -- + meta:set_float("fuel_totaltime", fuel_totaltime) + meta:set_float("fuel_time", fuel_time) + meta:set_float("src_time", src_time) + meta:set_string("formspec", formspec) + meta:set_string("infotext", infotext) + + return result +end + +-- +-- Node definitions +-- + +minetest.register_node("default:furnace", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", "default_furnace_front.png" + }, + paramtype2 = "facedir", + groups = {cracky=2}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + + can_dig = can_dig, + + on_timer = furnace_node_timer, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", inactive_formspec) + local inv = meta:get_inventory() + inv:set_size('src', 1) + inv:set_size('fuel', 1) + inv:set_size('dst', 4) + end, + + on_metadata_inventory_move = function(pos) + minetest.get_node_timer(pos):start(1.0) + end, + on_metadata_inventory_put = function(pos) + -- start timer function, it will sort out whether furnace can burn or not. + minetest.get_node_timer(pos):start(1.0) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "src", drops) + default.get_inventory_drops(pos, "fuel", drops) + default.get_inventory_drops(pos, "dst", drops) + drops[#drops+1] = "default:furnace" + minetest.remove_node(pos) + return drops + end, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + +minetest.register_node("default:furnace_active", { + description = "Furnace", + tiles = { + "default_furnace_top.png", "default_furnace_bottom.png", + "default_furnace_side.png", "default_furnace_side.png", + "default_furnace_side.png", + { + image = "default_furnace_front_active.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1.5 + }, + } + }, + paramtype2 = "facedir", + light_source = 8, + drop = "default:furnace", + groups = {cracky=2, not_in_creative_inventory=1}, + legacy_facedir_simple = true, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + on_timer = furnace_node_timer, + + can_dig = can_dig, + + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_move = allow_metadata_inventory_move, + allow_metadata_inventory_take = allow_metadata_inventory_take, +}) + diff --git a/mods/default/init.lua b/mods/default/init.lua new file mode 100644 index 0000000..7b5f62f --- /dev/null +++ b/mods/default/init.lua @@ -0,0 +1,52 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + +-- The API documentation in here was moved into game_api.txt + +-- Definitions made by this mod that other mods can use too +default = {} + +default.LIGHT_MAX = 14 + +-- GUI related stuff +default.gui_bg = "bgcolor[#080808BB;true]" +default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" +default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" + +function default.get_hotbar_bg(x,y) + local out = "" + for i=0,7,1 do + out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" + end + return out +end + +default.gui_survival_form = "size[8,8.5]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[current_player;main;0,4.25;8,1;]".. + "list[current_player;main;0,5.5;8,3;8]".. + "list[current_player;craft;1.75,0.5;3,3;]".. + "list[current_player;craftpreview;5.75,1.5;1,1;]".. + "image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. + "listring[current_player;main]".. + "listring[current_player;craft]".. + default.get_hotbar_bg(0,4.25) + +-- Load files +local default_path = minetest.get_modpath("default") + +dofile(default_path.."/functions.lua") +dofile(default_path.."/trees.lua") +dofile(default_path.."/nodes.lua") +dofile(default_path.."/furnace.lua") +dofile(default_path.."/torch.lua") +dofile(default_path.."/tools.lua") +dofile(default_path.."/item_entity.lua") +dofile(default_path.."/craftitems.lua") +dofile(default_path.."/crafting.lua") +dofile(default_path.."/mapgen.lua") +dofile(default_path.."/player.lua") +dofile(default_path.."/aliases.lua") +dofile(default_path.."/legacy.lua") diff --git a/mods/default/item_entity.lua b/mods/default/item_entity.lua new file mode 100644 index 0000000..c34e60e --- /dev/null +++ b/mods/default/item_entity.lua @@ -0,0 +1,74 @@ +-- mods/default/item_entity.lua + +local builtin_item = minetest.registered_entities["__builtin:item"] + +local item = { + set_item = function(self, itemstring) + builtin_item.set_item(self, itemstring) + + local stack = ItemStack(itemstring) + local itemdef = minetest.registered_items[stack:get_name()] + if itemdef and itemdef.groups.flammable ~= 0 then + self.flammable = itemdef.groups.flammable + end + end, + + burn_up = function(self) + -- disappear in a smoke puff + self.object:remove() + local p = self.object:getpos() + minetest.sound_play("default_item_smoke", { + pos = p, + max_hear_distance = 8, + }) + minetest.add_particlespawner({ + amount = 3, + time = 0.1, + minpos = {x = p.x - 0.1, y = p.y + 0.1, z = p.z - 0.1 }, + maxpos = {x = p.x + 0.1, y = p.y + 0.2, z = p.z + 0.1 }, + minvel = {x = 0, y = 2.5, z = 0}, + maxvel = {x = 0, y = 2.5, z = 0}, + minacc = {x = -0.15, y = -0.02, z = -0.15}, + maxacc = {x = 0.15, y = -0.01, z = 0.15}, + minexptime = 4, + maxexptime = 6, + minsize = 5, + maxsize = 5, + collisiondetection = true, + texture = "default_item_smoke.png" + }) + end, + + on_step = function(self, dtime) + builtin_item.on_step(self, dtime) + + if self.flammable then + -- flammable, check for igniters + self.ignite_timer = (self.ignite_timer or 0) + dtime + if self.ignite_timer > 10 then + self.ignite_timer = 0 + + local node = minetest.get_node_or_nil(self.object:getpos()) + if not node then + return + end + + -- Immediately burn up flammable items in lava + if minetest.get_item_group(node.name, "lava") > 0 then + self:burn_up() + else + -- otherwise there'll be a chance based on its igniter value + local burn_chance = self.flammable + * minetest.get_item_group(node.name, "igniter") + if burn_chance > 0 and math.random(0, burn_chance) ~= 0 then + self:burn_up() + end + end + end + end + end, +} + +-- set defined item as new __builtin:item, with the old one as fallback table +setmetatable(item, builtin_item) +minetest.register_entity(":__builtin:item", item) diff --git a/mods/default/legacy.lua b/mods/default/legacy.lua new file mode 100644 index 0000000..a8c8ad5 --- /dev/null +++ b/mods/default/legacy.lua @@ -0,0 +1,25 @@ +-- mods/default/legacy.lua + +-- Horrible stuff to support old code registering falling nodes +-- Don't use this and never do what this does, it's completely wrong! +-- (More specifically, the client and the C++ code doesn't get the group) +function default.register_falling_node(nodename, texture) + minetest.log("error", debug.traceback()) + minetest.log('error', "WARNING: default.register_falling_node is deprecated") + if minetest.registered_nodes[nodename] then + minetest.registered_nodes[nodename].groups.falling_node = 1 + end +end + +function default.spawn_falling_node(p, nodename) + spawn_falling_node(p, nodename) +end + +-- Liquids +WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha +WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity +LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity +LIGHT_MAX = default.LIGHT_MAX + +-- Formspecs +default.gui_suvival_form = default.gui_survival_form diff --git a/mods/default/license.txt b/mods/default/license.txt new file mode 100644 index 0000000..72af728 --- /dev/null +++ b/mods/default/license.txt @@ -0,0 +1,177 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2011-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2010-2016: + celeron55, Perttu Ahola + Cisoun + G4JC + VanessaE + RealBadAngel + Calinou + MirceaKitsune + Jordach + PilzAdam + jojoa1997 + InfinityProject + Splizard + Zeg9 + paramat + BlockMen + sofar + Neuromancer + Gambit + asl97 + KevDoy + Mito551 + GreenXenith + kaeza + kilbith + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 brunob.santos + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/4.0/ + +----------------------- + +Attribution-ShareAlike 2.0 Generic (CC BY-SA 2.0) +Copyright (C) 2014-2016 Neuromancer + + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/2.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2009 cmusounddesign +Copyright (C) 2010 Tomlija +Copyright (C) 2010 lsprice +Copyright (C) 2014 sonictechtonic +Copyright (C) 2015 yadronoff +Copyright (C) 2007 HerbertBoland +Copyright (C) 2006 AGFX + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/default/mapgen.lua b/mods/default/mapgen.lua new file mode 100644 index 0000000..1305226 --- /dev/null +++ b/mods/default/mapgen.lua @@ -0,0 +1,1826 @@ +-- +-- Aliases for map generators +-- + +minetest.register_alias("mapgen_stone", "default:stone") +minetest.register_alias("mapgen_dirt", "default:dirt") +minetest.register_alias("mapgen_dirt_with_grass", "default:dirt_with_grass") +minetest.register_alias("mapgen_sand", "default:sand") +minetest.register_alias("mapgen_water_source", "default:water_source") +minetest.register_alias("mapgen_river_water_source", "default:river_water_source") +minetest.register_alias("mapgen_lava_source", "default:lava_source") +minetest.register_alias("mapgen_gravel", "default:gravel") +minetest.register_alias("mapgen_desert_stone", "default:desert_stone") +minetest.register_alias("mapgen_desert_sand", "default:desert_sand") +minetest.register_alias("mapgen_dirt_with_snow", "default:dirt_with_snow") +minetest.register_alias("mapgen_snowblock", "default:snowblock") +minetest.register_alias("mapgen_snow", "default:snow") +minetest.register_alias("mapgen_ice", "default:ice") +minetest.register_alias("mapgen_sandstone", "default:sandstone") + +-- Flora + +minetest.register_alias("mapgen_tree", "default:tree") +minetest.register_alias("mapgen_leaves", "default:leaves") +minetest.register_alias("mapgen_apple", "default:apple") +minetest.register_alias("mapgen_jungletree", "default:jungletree") +minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves") +minetest.register_alias("mapgen_junglegrass", "default:junglegrass") +minetest.register_alias("mapgen_pine_tree", "default:pine_tree") +minetest.register_alias("mapgen_pine_needles", "default:pine_needles") + +-- Dungeons + +minetest.register_alias("mapgen_cobble", "default:cobble") +minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") +minetest.register_alias("mapgen_mossycobble", "default:mossycobble") +minetest.register_alias("mapgen_stair_desert_stone", "stairs:stair_desert_stone") +minetest.register_alias("mapgen_sandstonebrick", "default:sandstonebrick") +minetest.register_alias("mapgen_stair_sandstone_block", "stairs:stair_sandstone_block") + + +-- +-- Register ores +-- + +-- Blob ores +-- These first to avoid other ores in blobs + +-- Mgv6 + +function default.register_mgv6_blob_ores() + + -- Clay + -- This first to avoid clay in sand blobs + + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -15, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Sand + + minetest.register_ore({ + ore_type = "blob", + ore = "default:sand", + wherein = {"default:stone", "default:desert_stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Dirt + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.0 + }, + }) + + -- Gravel + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.0 + }, + }) +end + + +-- All mapgens except mgv6 + +function default.register_blob_ores() + + -- Clay + + minetest.register_ore({ + ore_type = "blob", + ore = "default:clay", + wherein = {"default:sand"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -15, + y_max = 0, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = -316, + octaves = 1, + persist = 0.0 + }, + }) + + -- Silver sand + + minetest.register_ore({ + ore_type = "blob", + ore = "default:silver_sand", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 2316, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground", + "floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"} + }) + + -- Dirt + + minetest.register_ore({ + ore_type = "blob", + ore = "default:dirt", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 17676, + octaves = 1, + persist = 0.0 + }, + biomes = {"taiga", "snowy_grassland", "grassland", "coniferous_forest", + "deciduous_forest", "deciduous_forest_shore", "savanna", "savanna_shore", + "rainforest", "rainforest_swamp", "floatland_grassland", + "floatland_coniferous_forest"} + }) + + -- Gravel + + minetest.register_ore({ + ore_type = "blob", + ore = "default:gravel", + wherein = {"default:stone"}, + clust_scarcity = 16 * 16 * 16, + clust_size = 5, + y_min = -31000, + y_max = 31000, + noise_threshold = 0.0, + noise_params = { + offset = 0.5, + scale = 0.2, + spread = {x = 5, y = 5, z = 5}, + seed = 766, + octaves = 1, + persist = 0.0 + }, + biomes = {"icesheet_ocean", "tundra", "tundra_beach", "tundra_ocean", + "taiga", "taiga_ocean", "snowy_grassland", "snowy_grassland_ocean", + "grassland", "grassland_dunes", "grassland_ocean", "coniferous_forest", + "coniferous_forest_dunes", "coniferous_forest_ocean", "deciduous_forest", + "deciduous_forest_shore", "deciduous_forest_ocean", "cold_desert", + "cold_desert_ocean", "savanna", "savanna_shore", "savanna_ocean", + "rainforest", "rainforest_swamp", "rainforest_ocean", "underground", + "floatland_ocean", "floatland_grassland", "floatland_coniferous_forest"} + }) +end + + +-- Scatter ores +-- All mapgens + +function default.register_ores() + + -- Coal + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8 * 8 * 8, + clust_num_ores = 9, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 8 * 8 * 8, + clust_num_ores = 8, + clust_size = 3, + y_min = -31000, + y_max = 64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_coal", + wherein = "default:stone", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 27, + clust_size = 6, + y_min = -31000, + y_max = 0, + }) + + -- Iron + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 12, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 7 * 7 * 7, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = 0, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_iron", + wherein = "default:stone", + clust_scarcity = 24 * 24 * 24, + clust_num_ores = 27, + clust_size = 6, + y_min = -31000, + y_max = -64, + }) + + -- Copper + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 12 * 12 * 12, + clust_num_ores = 4, + clust_size = 3, + y_min = -63, + y_max = -16, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_copper", + wherein = "default:stone", + clust_scarcity = 9 * 9 * 9, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -64, + }) + + -- Tin + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 10 * 10 * 10, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 4, + clust_size = 3, + y_min = -127, + y_max = -32, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_tin", + wherein = "default:stone", + clust_scarcity = 10 * 10 * 10, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -128, + }) + + -- Gold + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_gold", + wherein = "default:stone", + clust_scarcity = 13 * 13 * 13, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Mese crystal + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 5, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 18 * 18 * 18, + clust_num_ores = 3, + clust_size = 2, + y_min = -255, + y_max = -64, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_mese", + wherein = "default:stone", + clust_scarcity = 14 * 14 * 14, + clust_num_ores = 5, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Diamond + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 4, + clust_size = 3, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 17 * 17 * 17, + clust_num_ores = 4, + clust_size = 3, + y_min = -255, + y_max = -128, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:stone_with_diamond", + wherein = "default:stone", + clust_scarcity = 15 * 15 * 15, + clust_num_ores = 4, + clust_size = 3, + y_min = -31000, + y_max = -256, + }) + + -- Mese block + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 36 * 36 * 36, + clust_num_ores = 3, + clust_size = 2, + y_min = 1025, + y_max = 31000, + }) + + minetest.register_ore({ + ore_type = "scatter", + ore = "default:mese", + wherein = "default:stone", + clust_scarcity = 36 * 36 * 36, + clust_num_ores = 3, + clust_size = 2, + y_min = -31000, + y_max = -1024, + }) +end + + +-- +-- Register biomes +-- + +-- All mapgens except mgv6 + +function default.register_biomes(upper_limit) + + -- Icesheet + + minetest.register_biome({ + name = "icesheet", + node_dust = "default:snowblock", + node_top = "default:snowblock", + depth_top = 1, + node_filler = "default:snowblock", + depth_filler = 3, + node_stone = "default:ice", + node_water_top = "default:ice", + depth_water_top = 10, + --node_water = "", + node_river_water = "default:ice", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -8, + y_max = upper_limit, + heat_point = 0, + humidity_point = 73, + }) + + minetest.register_biome({ + name = "icesheet_ocean", + node_dust = "default:snowblock", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + node_water_top = "default:ice", + depth_water_top = 10, + --node_water = "", + --node_river_water = "", + y_min = -112, + y_max = -9, + heat_point = 0, + humidity_point = 73, + }) + + -- Tundra + + minetest.register_biome({ + name = "tundra", + node_dust = "default:snowblock", + --node_top = , + --depth_top = , + --node_filler = , + --depth_filler = , + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = 2, + y_max = upper_limit, + heat_point = 0, + humidity_point = 40, + }) + + minetest.register_biome({ + name = "tundra_beach", + --node_dust = "", + node_top = "default:gravel", + depth_top = 1, + node_filler = "default:gravel", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -3, + y_max = 1, + heat_point = 0, + humidity_point = 40, + }) + + minetest.register_biome({ + name = "tundra_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:gravel", + depth_riverbed = 2, + y_min = -112, + y_max = -4, + heat_point = 0, + humidity_point = 40, + }) + + -- Taiga + + minetest.register_biome({ + name = "taiga", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 2, + y_max = upper_limit, + heat_point = 25, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "taiga_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 1, + heat_point = 25, + humidity_point = 70, + }) + + -- Snowy grassland + + minetest.register_biome({ + name = "snowy_grassland", + node_dust = "default:snow", + node_top = "default:dirt_with_snow", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 20, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "snowy_grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 20, + humidity_point = 35, + }) + + -- Grassland + + minetest.register_biome({ + name = "grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = upper_limit, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 2, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 50, + humidity_point = 35, + }) + + minetest.register_biome({ + name = "grassland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 50, + humidity_point = 35, + }) + + -- Coniferous forest + + minetest.register_biome({ + name = "coniferous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 6, + y_max = upper_limit, + heat_point = 45, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "coniferous_forest_dunes", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = 5, + heat_point = 45, + humidity_point = 70, + }) + + minetest.register_biome({ + name = "coniferous_forest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 45, + humidity_point = 70, + }) + + -- Deciduous forest + + minetest.register_biome({ + name = "deciduous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = upper_limit, + heat_point = 60, + humidity_point = 68, + }) + + minetest.register_biome({ + name = "deciduous_forest_shore", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 60, + humidity_point = 68, + }) + + minetest.register_biome({ + name = "deciduous_forest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 60, + humidity_point = 68, + }) + + -- Desert + + minetest.register_biome({ + name = "desert", + --node_dust = "", + node_top = "default:desert_sand", + depth_top = 1, + node_filler = "default:desert_sand", + depth_filler = 1, + node_stone = "default:desert_stone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 92, + humidity_point = 16, + }) + + minetest.register_biome({ + name = "desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:desert_stone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 92, + humidity_point = 16, + }) + + -- Sandstone desert + + minetest.register_biome({ + name = "sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 60, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "sandstone_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 60, + humidity_point = 0, + }) + + -- Cold desert + + minetest.register_biome({ + name = "cold_desert", + --node_dust = "", + node_top = "default:silver_sand", + depth_top = 1, + node_filler = "default:silver_sand", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 5, + y_max = upper_limit, + heat_point = 40, + humidity_point = 0, + }) + + minetest.register_biome({ + name = "cold_desert_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = 4, + heat_point = 40, + humidity_point = 0, + }) + + -- Savanna + + minetest.register_biome({ + name = "savanna", + --node_dust = "", + node_top = "default:dirt_with_dry_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = upper_limit, + heat_point = 89, + humidity_point = 42, + }) + + minetest.register_biome({ + name = "savanna_shore", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 89, + humidity_point = 42, + }) + + minetest.register_biome({ + name = "savanna_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 89, + humidity_point = 42, + }) + + -- Rainforest + + minetest.register_biome({ + name = "rainforest", + --node_dust = "", + node_top = "default:dirt_with_rainforest_litter", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = 1, + y_max = upper_limit, + heat_point = 86, + humidity_point = 65, + }) + + minetest.register_biome({ + name = "rainforest_swamp", + --node_dust = "", + node_top = "default:dirt", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -1, + y_max = 0, + heat_point = 86, + humidity_point = 65, + }) + + minetest.register_biome({ + name = "rainforest_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + node_riverbed = "default:sand", + depth_riverbed = 2, + y_min = -112, + y_max = -2, + heat_point = 86, + humidity_point = 65, + }) + + -- Underground + + minetest.register_biome({ + name = "underground", + --node_dust = "", + --node_top = "", + --depth_top = , + --node_filler = "", + --depth_filler = , + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + y_min = -31000, + y_max = -113, + heat_point = 50, + humidity_point = 50, + }) +end + + +-- Biomes for floatlands + +function default.register_floatland_biomes(floatland_level, shadow_limit) + + -- Coniferous forest + + minetest.register_biome({ + name = "floatland_coniferous_forest", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 70, + }) + + -- Grassland + + minetest.register_biome({ + name = "floatland_grassland", + --node_dust = "", + node_top = "default:dirt_with_grass", + depth_top = 1, + node_filler = "default:dirt", + depth_filler = 1, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 35, + }) + + -- Sandstone desert + + minetest.register_biome({ + name = "floatland_sandstone_desert", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 1, + node_stone = "default:sandstone", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = floatland_level + 2, + y_max = 31000, + heat_point = 50, + humidity_point = 0, + }) + + -- Floatland ocean / underground + + minetest.register_biome({ + name = "floatland_ocean", + --node_dust = "", + node_top = "default:sand", + depth_top = 1, + node_filler = "default:sand", + depth_filler = 3, + --node_stone = "", + --node_water_top = "", + --depth_water_top = , + --node_water = "", + --node_river_water = "", + --node_riverbed = "", + --depth_riverbed = , + y_min = shadow_limit, + y_max = floatland_level + 1, + heat_point = 50, + humidity_point = 50, + }) +end + + +-- +-- Register decorations +-- + +-- Mgv6 + +function default.register_mgv6_decorations() + + -- Papyrus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x = 100, y = 100, z = 100}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + y_min = 1, + y_max = 1, + decoration = "default:papyrus", + height = 2, + height_max = 4, + spawn_by = "default:water_source", + num_spawn_by = 1, + }) + + -- Cacti + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.012, + scale = 0.024, + spread = {x = 100, y = 100, z = 100}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:cactus", + height = 3, + height_max = 4, + }) + + -- Long grasses + + for length = 1, 5 do + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.007, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:grass_"..length, + }) + end + + -- Dry shrubs + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.035, + spread = {x = 100, y = 100, z = 100}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "default:dry_shrub", + }) +end + + +-- All mapgens except mgv6 + +local function register_grass_decoration(offset, scale, length) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass", "default:sand"}, + sidelen = 16, + noise_params = { + offset = offset, + scale = scale, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"grassland", "grassland_dunes", "deciduous_forest", + "coniferous_forest", "coniferous_forest_dunes", + "floatland_grassland", "floatland_coniferous_forest"}, + y_min = 1, + y_max = 31000, + decoration = "default:grass_" .. length, + }) +end + +local function register_dry_grass_decoration(offset, scale, length) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = offset, + scale = scale, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + decoration = "default:dry_grass_" .. length, + }) +end + + +function default.register_decorations() + + -- Apple tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.036, + scale = 0.022, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/apple_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0018, + scale = 0.0011, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/apple_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Jungle tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, + fill_ratio = 0.1, + biomes = {"rainforest", "rainforest_swamp"}, + y_min = -1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_rainforest_litter", "default:dirt"}, + sidelen = 16, + fill_ratio = 0.005, + biomes = {"rainforest", "rainforest_swamp"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/jungle_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Taiga and temperate coniferous forest pine tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.036, + scale = 0.022, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"taiga", "coniferous_forest", "floatland_coniferous_forest"}, + y_min = 2, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/pine_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_snow", "default:dirt_with_grass"}, + sidelen = 80, + noise_params = { + offset = 0.0018, + scale = 0.0011, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"taiga", "coniferous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/pine_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Acacia tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.002, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_tree.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.001, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Aspen tree and log + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0, + scale = -0.015, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_tree.mts", + flags = "place_center_x, place_center_z", + }) + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0.0, + scale = -0.0008, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/aspen_log.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Large cactus + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.0003, + scale = 0.0009, + spread = {x = 200, y = 200, z = 200}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert"}, + y_min = 5, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/large_cactus.mts", + flags = "place_center_x", + rotation = "random", + }) + + -- Cactus + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand"}, + sidelen = 16, + noise_params = { + offset = -0.0003, + scale = 0.0009, + spread = {x = 200, y = 200, z = 200}, + seed = 230, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert"}, + y_min = 5, + y_max = 31000, + decoration = "default:cactus", + height = 2, + height_max = 5, + }) + + -- Papyrus + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.3, + scale = 0.7, + spread = {x = 200, y = 200, z = 200}, + seed = 354, + octaves = 3, + persist = 0.7 + }, + biomes = {"savanna_shore"}, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("default") .. "/schematics/papyrus.mts", + }) + + -- Bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_grass", "default:dirt_with_snow"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 137, + octaves = 3, + persist = 0.7, + }, + biomes = {"snowy_grassland", "grassland", "deciduous_forest", + "floatland_grassland"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Acacia bush + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt_with_dry_grass"}, + sidelen = 16, + noise_params = { + offset = -0.004, + scale = 0.01, + spread = {x = 100, y = 100, z = 100}, + seed = 90155, + octaves = 3, + persist = 0.7, + }, + biomes = {"savanna"}, + y_min = 1, + y_max = 31000, + schematic = minetest.get_modpath("default") .. "/schematics/acacia_bush.mts", + flags = "place_center_x, place_center_z", + }) + + -- Grasses + + register_grass_decoration(-0.03, 0.09, 5) + register_grass_decoration(-0.015, 0.075, 4) + register_grass_decoration(0, 0.06, 3) + register_grass_decoration(0.015, 0.045, 2) + register_grass_decoration(0.03, 0.03, 1) + + -- Dry grasses + + register_dry_grass_decoration(0.01, 0.05, 5) + register_dry_grass_decoration(0.03, 0.03, 4) + register_dry_grass_decoration(0.05, 0.01, 3) + register_dry_grass_decoration(0.07, -0.01, 2) + register_dry_grass_decoration(0.09, -0.03, 1) + + -- Junglegrass + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_rainforest_litter"}, + sidelen = 16, + fill_ratio = 0.1, + biomes = {"rainforest"}, + y_min = 1, + y_max = 31000, + decoration = "default:junglegrass", + }) + + -- Dry shrub + + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:desert_sand", + "default:sand", "default:silver_sand"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.02, + spread = {x = 200, y = 200, z = 200}, + seed = 329, + octaves = 3, + persist = 0.6 + }, + biomes = {"desert", "sandstone_desert", "cold_desert"}, + y_min = 2, + y_max = 31000, + decoration = "default:dry_shrub", + }) + + -- Coral reef + + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:sand"}, + noise_params = { + offset = -0.15, + scale = 0.1, + spread = {x = 100, y = 100, z = 100}, + seed = 7013, + octaves = 3, + persist = 1, + }, + biomes = { + "desert_ocean", + "savanna_ocean", + "rainforest_ocean", + }, + y_min = -8, + y_max = -2, + schematic = minetest.get_modpath("default") .. "/schematics/corals.mts", + flags = "place_center_x, place_center_z", + rotation = "random", + }) +end + + +-- +-- Detect mapgen, flags and parameters to select functions +-- + +-- Get setting or default +local mgv7_spflags = minetest.get_mapgen_setting("mgv7_spflags") or + "mountains, ridges, nofloatlands" +local captures_float = string.match(mgv7_spflags, "floatlands") +local captures_nofloat = string.match(mgv7_spflags, "nofloatlands") + +local mgv7_floatland_level = minetest.get_mapgen_setting("mgv7_floatland_level") or 1280 +local mgv7_shadow_limit = minetest.get_mapgen_setting("mgv7_shadow_limit") or 1024 + +minetest.clear_registered_biomes() +minetest.clear_registered_ores() +minetest.clear_registered_decorations() + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then + default.register_mgv6_blob_ores() + default.register_ores() + default.register_mgv6_decorations() +elseif mg_name == "v7" and captures_float == "floatlands" and + captures_nofloat ~= "nofloatlands" then + -- Mgv7 with floatlands + default.register_biomes(mgv7_shadow_limit - 1) + default.register_floatland_biomes(mgv7_floatland_level, mgv7_shadow_limit) + default.register_blob_ores() + default.register_ores() + default.register_decorations() +else + default.register_biomes(31000) + default.register_blob_ores() + default.register_ores() + default.register_decorations() +end diff --git a/mods/default/models/character.b3d b/mods/default/models/character.b3d new file mode 100644 index 0000000..9ab4543 Binary files /dev/null and b/mods/default/models/character.b3d differ diff --git a/mods/default/models/character.blend b/mods/default/models/character.blend new file mode 100644 index 0000000..fca9f65 Binary files /dev/null and b/mods/default/models/character.blend differ diff --git a/mods/default/models/character.png b/mods/default/models/character.png new file mode 100644 index 0000000..0502178 Binary files /dev/null and b/mods/default/models/character.png differ diff --git a/mods/default/models/chest_open.obj b/mods/default/models/chest_open.obj new file mode 100644 index 0000000..72ba175 --- /dev/null +++ b/mods/default/models/chest_open.obj @@ -0,0 +1,79 @@ +# Blender v2.78 (sub 0) OBJ File: 'chest-open.blend' +# www.blender.org +o Top_Cube.002_None_Top_Cube.002_None_bottom +v -0.500000 0.408471 0.720970 +v -0.500000 1.115578 0.013863 +v -0.500000 0.894607 -0.207108 +v -0.500000 0.187501 0.499999 +v 0.500000 1.115578 0.013863 +v 0.500000 0.408471 0.720970 +v 0.500000 0.187501 0.499999 +v 0.500000 0.894607 -0.207108 +v -0.500000 0.187500 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 0.187500 -0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 -0.500000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.0000 +vt 0.0000 1.0000 +vt 1.0000 1.0000 +vt 1.0000 0.6875 +vt 0.0000 0.6875 +vt 1.0000 1.0000 +vt 0.0000 0.6875 +vt 1.0000 0.6875 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 0.0000 0.0000 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 1.0000 1.0000 +vt 1.0000 0.6875 +vt 1.0000 0.0000 +vt 0.0000 1.0000 +vt 0.0000 0.6875 +vt 0.0000 0.6875 +vt 0.0000 0.0000 +vt 1.0000 0.5000 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5000 +vt 0.0000 0.0000 +vt 1.0000 0.0000 +vn 0.0000 0.7071 0.7071 +vn -0.0000 -1.0000 -0.0000 +vn -1.0000 0.0000 0.0000 +vn 1.0000 0.0000 -0.0000 +vn 0.0000 -0.7071 0.7071 +vn 0.0000 0.0000 1.0000 +vn -0.0000 0.7071 -0.7071 +vn -0.0000 0.0000 -1.0000 +vn -0.0000 -0.7071 -0.7071 +vn -0.0000 1.0000 -0.0000 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Top +s off +f 6/1/1 5/2/1 2/3/1 1/4/1 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Bottom +f 11/5/2 10/6/2 14/7/2 13/8/2 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Right-Left +f 1/9/3 2/10/3 3/11/3 4/12/3 +f 5/13/4 6/1/4 7/14/4 8/15/4 +f 4/12/3 9/16/3 10/17/3 11/18/3 +f 12/19/4 7/14/4 13/8/4 14/20/4 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Back +f 6/21/5 1/9/5 4/12/5 7/22/5 +f 7/22/6 4/12/6 11/18/6 13/23/6 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Front +f 2/10/7 5/24/7 8/25/7 3/11/7 +f 9/16/8 12/26/8 14/27/8 10/17/8 +g Top_Cube.002_None_Top_Cube.002_None_bottom_Top_Cube.002_None_Top_Cube.002_None_bottom_Inside +f 4/28/9 3/29/9 8/30/9 7/31/9 +f 7/31/10 12/32/10 9/33/10 4/28/10 diff --git a/mods/default/models/torch_ceiling.obj b/mods/default/models/torch_ceiling.obj new file mode 100644 index 0000000..ea51f3c --- /dev/null +++ b/mods/default/models/torch_ceiling.obj @@ -0,0 +1,58 @@ +# Blender v2.77 (sub 0) OBJ File: 'torch_ceiling.blend' +# www.blender.org +mtllib torch_ceiling.mtl +o Cube_Cube.001 +v -0.062469 -0.047331 0.068152 +v -0.062469 -0.559515 -0.164388 +v -0.062469 0.004344 -0.045667 +v -0.062469 -0.507839 -0.278206 +v 0.062531 -0.047331 0.068152 +v 0.062531 -0.559515 -0.164388 +v 0.062531 0.004344 -0.045667 +v 0.062531 -0.507839 -0.278206 +v 0.353584 0.040000 0.363553 +v 0.353584 -0.397500 0.363553 +v -0.353522 0.040000 -0.343553 +v -0.353522 -0.397500 -0.343553 +v 0.353584 0.040000 -0.343553 +v -0.353522 0.040000 0.363553 +v 0.353584 -0.397500 -0.343553 +v -0.353522 -0.397500 0.363553 +vt 0.5625 0.5000 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.5000 +vt 0.4375 0.0000 +vt 0.5625 0.0000 +vt 0.5625 0.1250 +vt 0.4375 0.1250 +vt 0.5625 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.6250 +vt 0.4375 0.0000 +vt 0.5625 0.6250 +vt 0.5625 0.0000 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vt 0.0000 0.5625 +vt 0.0000 0.5625 +vt 1.0000 0.5625 +vt 1.0000 1.0000 +vt 0.0000 1.0000 +vn 0.0000 0.9105 0.4134 +vn -0.0000 -0.4134 0.9105 +vn -1.0000 0.0000 0.0000 +vn 0.7071 0.0000 -0.7071 +vn 0.7071 0.0000 0.7071 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/9/2 4/6/2 8/5/2 7/10/2 +f 1/11/3 3/9/3 4/6/3 2/12/3 +f 5/13/2 1/11/2 2/12/2 6/14/2 +f 7/10/3 8/5/3 6/14/3 5/13/3 +usemtl Material.002 +f 9/15/4 10/16/4 12/17/4 11/18/4 +f 13/19/5 14/20/5 16/21/5 15/22/5 diff --git a/mods/default/models/torch_floor.obj b/mods/default/models/torch_floor.obj new file mode 100644 index 0000000..e2487ef --- /dev/null +++ b/mods/default/models/torch_floor.obj @@ -0,0 +1,50 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_floor.blend' +# www.blender.org +mtllib torch_floor.mtl +o Cube_Cube.001 +v 0.062500 0.062500 -0.062500 +v 0.062500 -0.500000 -0.062500 +v 0.062500 0.062500 0.062500 +v 0.062500 -0.500000 0.062500 +v -0.062500 0.062500 -0.062500 +v -0.062500 -0.500000 -0.062500 +v -0.062500 0.062500 0.062500 +v -0.062500 -0.500000 0.062500 +v -0.353553 -0.500000 0.353553 +v -0.353553 0.500000 0.353553 +v 0.353553 -0.500000 -0.353553 +v 0.353553 0.500000 -0.353553 +v -0.353553 -0.500000 -0.353553 +v 0.353553 -0.500000 0.353553 +v -0.353553 0.500000 -0.353553 +v 0.353553 0.500000 0.353553 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.000000 -0.707100 +vn -0.707100 -0.000000 0.707100 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/9/4 10/10/4 12/11/4 11/12/4 +f 13/12/5 14/9/5 16/10/5 15/11/5 diff --git a/mods/default/models/torch_wall.obj b/mods/default/models/torch_wall.obj new file mode 100644 index 0000000..57baa9e --- /dev/null +++ b/mods/default/models/torch_wall.obj @@ -0,0 +1,64 @@ +# Blender v2.76 (sub 11) OBJ File: 'torch_wall.blend' +# www.blender.org +mtllib torch_wall.mtl +o Cube_Cube.001 +v 0.062469 -0.195248 0.023570 +v 0.062469 -0.476498 -0.463570 +v 0.062469 -0.303502 0.086070 +v 0.062469 -0.584752 -0.401070 +v -0.062531 -0.195248 0.023570 +v -0.062531 -0.476498 -0.463570 +v -0.062531 -0.303502 0.086070 +v -0.062531 -0.584752 -0.401070 +v -0.353584 -0.613553 0.022500 +v -0.353584 -0.613553 0.460000 +v 0.353522 0.093553 0.022500 +v 0.353522 0.093553 0.460000 +v -0.353584 0.093553 0.022500 +v 0.353522 -0.613553 0.022500 +v -0.353584 0.093553 0.460000 +v 0.353522 -0.613553 0.460000 +v 0.353553 0.056811 -0.121957 +v 0.353553 -0.224439 -0.609096 +v -0.353553 -0.555561 0.231596 +v -0.353553 -0.836811 -0.255543 +v -0.353553 0.056811 -0.121957 +v -0.353553 -0.224439 -0.609096 +v 0.353553 -0.555561 0.231596 +v 0.353553 -0.836811 -0.255543 +vt 0.562500 0.500000 +vt 0.562500 0.625000 +vt 0.437500 0.625000 +vt 0.437500 0.500000 +vt 0.437500 0.000000 +vt 0.562500 0.000000 +vt 0.562500 0.125000 +vt 0.437500 0.125000 +vt 0.000000 0.562500 +vt 0.000000 -0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.562500 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn -0.000000 0.500000 0.866000 +vn -0.000000 0.866000 -0.500000 +vn 1.000000 0.000000 0.000000 +vn -0.707100 0.612400 -0.353600 +vn -0.707100 -0.612400 0.353600 +vn -0.707100 0.707100 -0.000000 +vn -0.707100 -0.707100 -0.000000 +g Cube_Cube.001_Cube_Cube.001_Material.001 +usemtl Material.001 +s off +f 3/1/1 1/2/1 5/3/1 7/4/1 +f 8/5/1 4/6/1 2/7/1 6/8/1 +f 3/2/2 4/6/2 8/5/2 7/3/2 +f 1/3/3 3/2/3 4/6/3 2/5/3 +f 5/2/2 1/3/2 2/5/2 6/6/2 +f 7/3/3 8/5/3 6/6/3 5/2/3 +f 17/9/4 18/10/4 20/11/4 19/12/4 +f 21/9/5 22/10/5 24/11/5 23/12/5 +g Cube_Cube.001_Cube_Cube.001_Material.002 +usemtl Material.002 +f 9/12/6 10/13/6 12/14/6 11/9/6 +f 13/9/7 14/12/7 16/13/7 15/14/7 diff --git a/mods/default/nodes.lua b/mods/default/nodes.lua new file mode 100644 index 0000000..ceaa802 --- /dev/null +++ b/mods/default/nodes.lua @@ -0,0 +1,2441 @@ +-- mods/default/nodes.lua + + +--[[ Node name convention: + +Although many node names are in combined-word form, the required form for new +node names is words separated by underscores. If both forms are used in written +language (for example pinewood and pine wood) the underscore form should be used. + +--]] + + +--[[ Index: + +Stone +----- +(1. Material 2. Cobble variant 3. Brick variant 4. Modified forms) + +default:stone +default:cobble +default:stonebrick +default:stone_block +default:mossycobble + +default:desert_stone +default:desert_cobble +default:desert_stonebrick +default:desert_stone_block + +default:sandstone +default:sandstonebrick +default:sandstone_block +default:desert_sandstone +default:desert_sandstone_brick +default:desert_sandstone_block +default:silver_sandstone +default:silver_sandstone_brick +default:silver_sandstone_block + +default:obsidian +default:obsidianbrick +default:obsidian_block + +Soft / Non-Stone +---------------- +(1. Material 2. Modified forms) + +default:dirt +default:dirt_with_grass +default:dirt_with_grass_footsteps +default:dirt_with_dry_grass +default:dirt_with_snow +default:dirt_with_rainforest_litter + +default:sand +default:desert_sand +default:silver_sand + +default:gravel + +default:clay + +default:snow +default:snowblock + +default:ice + +Trees +----- +(1. Trunk 2. Fabricated trunk 3. Leaves 4. Sapling 5. Fruits) + +default:tree +default:wood +default:leaves +default:sapling +default:apple + +default:jungletree +default:junglewood +default:jungleleaves +default:junglesapling + +default:pine_tree +default:pine_wood +default:pine_needles +default:pine_sapling + +default:acacia_tree +default:acacia_wood +default:acacia_leaves +default:acacia_sapling + +default:aspen_tree +default:aspen_wood +default:aspen_leaves +default:aspen_sapling + +Ores +---- +(1. In stone 2. Blocks) + +default:stone_with_coal +default:coalblock + +default:stone_with_iron +default:steelblock + +default:stone_with_copper +default:copperblock + +default:stone_with_tin +default:tinblock + +default:bronzeblock + +default:stone_with_gold +default:goldblock + +default:stone_with_mese +default:mese + +default:stone_with_diamond +default:diamondblock + +Plantlife +--------- + +default:cactus +default:papyrus +default:dry_shrub +default:junglegrass + +default:grass_1 +default:grass_2 +default:grass_3 +default:grass_4 +default:grass_5 + +default:dry_grass_1 +default:dry_grass_2 +default:dry_grass_3 +default:dry_grass_4 +default:dry_grass_5 + +default:bush_stem +default:bush_leaves +default:bush_sapling +default:acacia_bush_stem +default:acacia_bush_leaves +default:acacia_bush_sapling + +Corals +------ + +default:coral_brown +default:coral_orange +default:coral_skeleton + +Liquids +------- +(1. Source 2. Flowing) + +default:water_source +default:water_flowing + +default:river_water_source +default:river_water_flowing + +default:lava_source +default:lava_flowing + +Tools / "Advanced" crafting / Non-"natural" +------------------------------------------- + +default:chest +default:chest_locked + +default:bookshelf + +default:sign_wall_wood +default:sign_wall_steel + +default:ladder_wood +default:ladder_steel + +default:fence_wood +default:fence_acacia_wood +default:fence_junglewood +default:fence_pine_wood +default:fence_aspen_wood + +default:glass +default:obsidian_glass + +default:brick + +default:meselamp +default:mese_post_light + +Misc +---- + +default:cloud + +--]] + +-- +-- Stone +-- + +minetest.register_node("default:stone", { + description = "Stone", + tiles = {"default_stone.png"}, + groups = {cracky = 3, stone = 1}, + drop = 'default:cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:cobble", { + description = "Cobblestone", + tiles = {"default_cobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stonebrick", { + description = "Stone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_stone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:stone_block", { + description = "Stone Block", + tiles = {"default_stone_block.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mossycobble", { + description = "Mossy Cobblestone", + tiles = {"default_mossycobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:desert_stone", { + description = "Desert Stone", + tiles = {"default_desert_stone.png"}, + groups = {cracky = 3, stone = 1}, + drop = 'default:desert_cobble', + legacy_mineral = true, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_cobble", { + description = "Desert Cobblestone", + tiles = {"default_desert_cobble.png"}, + is_ground_content = false, + groups = {cracky = 3, stone = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stonebrick", { + description = "Desert Stone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_desert_stone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_stone_block", { + description = "Desert Stone Block", + tiles = {"default_desert_stone_block.png"}, + is_ground_content = false, + groups = {cracky = 2, stone = 1}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstone", { + description = "Sandstone", + tiles = {"default_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstonebrick", { + description = "Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:sandstone_block", { + description = "Sandstone Block", + tiles = {"default_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_sandstone", { + description = "Desert Sandstone", + tiles = {"default_desert_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_sandstone_brick", { + description = "Desert Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_desert_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:desert_sandstone_block", { + description = "Desert Sandstone Block", + tiles = {"default_desert_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone", { + description = "Silver Sandstone", + tiles = {"default_silver_sandstone.png"}, + groups = {crumbly = 1, cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone_brick", { + description = "Silver Sandstone Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_silver_sandstone_brick.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:silver_sandstone_block", { + description = "Silver Sandstone Block", + tiles = {"default_silver_sandstone_block.png"}, + is_ground_content = false, + groups = {cracky = 2}, + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:obsidian", { + description = "Obsidian", + tiles = {"default_obsidian.png"}, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +minetest.register_node("default:obsidianbrick", { + description = "Obsidian Brick", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_obsidian_brick.png"}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +minetest.register_node("default:obsidian_block", { + description = "Obsidian Block", + tiles = {"default_obsidian_block.png"}, + is_ground_content = false, + sounds = default.node_sound_stone_defaults(), + groups = {cracky = 1, level = 2}, +}) + +-- +-- Soft / Non-Stone +-- + +minetest.register_node("default:dirt", { + description = "Dirt", + tiles = {"default_dirt.png"}, + groups = {crumbly = 3, soil = 1}, + sounds = default.node_sound_dirt_defaults(), +}) + +minetest.register_node("default:dirt_with_grass", { + description = "Dirt with Grass", + tiles = {"default_grass.png", "default_dirt.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.25}, + }), +}) + +minetest.register_node("default:dirt_with_grass_footsteps", { + description = "Dirt with Grass and Footsteps", + tiles = {"default_grass.png^default_footprint.png", "default_dirt.png", + {name = "default_dirt.png^default_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, not_in_creative_inventory = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.25}, + }), +}) + +minetest.register_node("default:dirt_with_dry_grass", { + description = "Dirt with Dry Grass", + tiles = {"default_dry_grass.png", + "default_dirt.png", + {name = "default_dirt.png^default_dry_grass_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.4}, + }), +}) + +minetest.register_node("default:dirt_with_snow", { + description = "Dirt with Snow", + tiles = {"default_snow.png", "default_dirt.png", + {name = "default_dirt.png^default_snow_side.png", + tileable_vertical = false}}, + groups = {crumbly = 3, spreading_dirt_type = 1, snowy = 1}, + drop = 'default:dirt', + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + }), +}) + +minetest.register_node("default:dirt_with_rainforest_litter", { + description = "Dirt with Rainforest Litter", + tiles = { + "default_rainforest_litter.png", + "default_dirt.png", + {name = "default_dirt.png^default_rainforest_litter_side.png", + tileable_vertical = false} + }, + groups = {crumbly = 3, soil = 1, spreading_dirt_type = 1}, + drop = "default:dirt", + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_grass_footstep", gain = 0.4}, + }), +}) + +minetest.register_node("default:sand", { + description = "Sand", + tiles = {"default_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:desert_sand", { + description = "Desert Sand", + tiles = {"default_desert_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + +minetest.register_node("default:silver_sand", { + description = "Silver Sand", + tiles = {"default_silver_sand.png"}, + groups = {crumbly = 3, falling_node = 1, sand = 1}, + sounds = default.node_sound_sand_defaults(), +}) + + +minetest.register_node("default:gravel", { + description = "Gravel", + tiles = {"default_gravel.png"}, + groups = {crumbly = 2, falling_node = 1}, + sounds = default.node_sound_gravel_defaults(), + drop = { + max_items = 1, + items = { + {items = {'default:flint'}, rarity = 16}, + {items = {'default:gravel'}} + } + } +}) + +minetest.register_node("default:clay", { + description = "Clay", + tiles = {"default_clay.png"}, + groups = {crumbly = 3}, + drop = 'default:clay_lump 4', + sounds = default.node_sound_dirt_defaults(), +}) + + +minetest.register_node("default:snow", { + description = "Snow", + tiles = {"default_snow.png"}, + inventory_image = "default_snowball.png", + wield_image = "default_snowball.png", + paramtype = "light", + buildable_to = true, + floodable = true, + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, -0.25, 0.5}, + }, + }, + groups = {crumbly = 3, falling_node = 1, puts_out_fire = 1, snowy = 1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + dug = {name = "default_snow_footstep", gain = 0.2}, + dig = {name = "default_snow_footstep", gain = 0.2} + }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, +}) + +minetest.register_node("default:snowblock", { + description = "Snow Block", + tiles = {"default_snow.png"}, + groups = {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1}, + sounds = default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + dug = {name = "default_snow_footstep", gain = 0.2}, + dig = {name = "default_snow_footstep", gain = 0.2} + }), + + on_construct = function(pos) + pos.y = pos.y - 1 + if minetest.get_node(pos).name == "default:dirt_with_grass" then + minetest.set_node(pos, {name = "default:dirt_with_snow"}) + end + end, +}) + +minetest.register_node("default:ice", { + description = "Ice", + tiles = {"default_ice.png"}, + is_ground_content = false, + paramtype = "light", + groups = {cracky = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +-- +-- Trees +-- + +minetest.register_node("default:tree", { + description = "Tree", + tiles = {"default_tree_top.png", "default_tree_top.png", "default_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:wood", { + description = "Wooden Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_wood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:sapling", { + description = "Sapling", + drawtype = "plantlike", + tiles = {"default_sapling.png"}, + inventory_image = "default_sapling.png", + wield_image = "default_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 6, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +minetest.register_node("default:leaves", { + description = "Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves.png"}, + special_tiles = {"default_leaves_simple.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + { + -- player will get sapling with 1/20 chance + items = {'default:sapling'}, + rarity = 20, + }, + { + -- player will get leaves only if he get no saplings, + -- this is because max_items is 1 + items = {'default:leaves'}, + } + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:apple", { + description = "Apple", + drawtype = "plantlike", + tiles = {"default_apple.png"}, + inventory_image = "default_apple.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + is_ground_content = false, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -7 / 16, -3 / 16, 3 / 16, 4 / 16, 3 / 16} + }, + groups = {fleshy = 3, dig_immediate = 3, flammable = 2, + leafdecay = 3, leafdecay_drop = 1}, + on_use = minetest.item_eat(2), + sounds = default.node_sound_leaves_defaults(), + + after_place_node = function(pos, placer, itemstack) + if placer:is_player() then + minetest.set_node(pos, {name = "default:apple", param2 = 1}) + end + end, +}) + + +minetest.register_node("default:jungletree", { + description = "Jungle Tree", + tiles = {"default_jungletree_top.png", "default_jungletree_top.png", + "default_jungletree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:junglewood", { + description = "Jungle Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_junglewood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:jungleleaves", { + description = "Jungle Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_jungleleaves.png"}, + special_tiles = {"default_jungleleaves_simple.png"}, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {'default:junglesapling'}, rarity = 20}, + {items = {'default:jungleleaves'}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:junglesapling", { + description = "Jungle Sapling", + drawtype = "plantlike", + tiles = {"default_junglesapling.png"}, + inventory_image = "default_junglesapling.png", + wield_image = "default_junglesapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:junglesapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 15, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + + +minetest.register_node("default:pine_tree", { + description = "Pine Tree", + tiles = {"default_pine_tree_top.png", "default_pine_tree_top.png", + "default_pine_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:pine_wood", { + description = "Pine Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_pine_wood.png"}, + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:pine_needles",{ + description = "Pine Needles", + drawtype = "allfaces_optional", + tiles = {"default_pine_needles.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:pine_sapling"}, rarity = 20}, + {items = {"default:pine_needles"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:pine_sapling", { + description = "Pine Sapling", + drawtype = "plantlike", + tiles = {"default_pine_sapling.png"}, + inventory_image = "default_pine_sapling.png", + wield_image = "default_pine_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 3, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:pine_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 12, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + + +minetest.register_node("default:acacia_tree", { + description = "Acacia Tree", + tiles = {"default_acacia_tree_top.png", "default_acacia_tree_top.png", + "default_acacia_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:acacia_wood", { + description = "Acacia Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_acacia_wood.png"}, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:acacia_leaves", { + description = "Acacia Leaves", + drawtype = "allfaces_optional", + tiles = {"default_acacia_leaves.png"}, + special_tiles = {"default_acacia_leaves_simple.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:acacia_sapling"}, rarity = 20}, + {items = {"default:acacia_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:acacia_sapling", { + description = "Acacia Tree Sapling", + drawtype = "plantlike", + tiles = {"default_acacia_sapling.png"}, + inventory_image = "default_acacia_sapling.png", + wield_image = "default_acacia_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 7 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:acacia_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -4, y = 1, z = -4}, + {x = 4, y = 6, z = 4}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +minetest.register_node("default:aspen_tree", { + description = "Aspen Tree", + tiles = {"default_aspen_tree_top.png", "default_aspen_tree_top.png", + "default_aspen_tree.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {tree = 1, choppy = 3, oddly_breakable_by_hand = 1, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_place = minetest.rotate_node +}) + +minetest.register_node("default:aspen_wood", { + description = "Aspen Wood Planks", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_aspen_wood.png"}, + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3, wood = 1}, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:aspen_leaves", { + description = "Aspen Leaves", + drawtype = "allfaces_optional", + tiles = {"default_aspen_leaves.png"}, + waving = 1, + paramtype = "light", + is_ground_content = false, + groups = {snappy = 3, leafdecay = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:aspen_sapling"}, rarity = 20}, + {items = {"default:aspen_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:aspen_sapling", { + description = "Aspen Tree Sapling", + drawtype = "plantlike", + tiles = {"default_aspen_sapling.png"}, + inventory_image = "default_aspen_sapling.png", + wield_image = "default_aspen_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 0.5, 3 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 3, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(2400,4800)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:aspen_sapling", + -- minp, maxp to be checked, relative to sapling pos + -- minp_relative.y = 1 because sapling pos has been checked + {x = -2, y = 1, z = -2}, + {x = 2, y = 12, z = 2}, + -- maximum interval of interior volume check + 4) + + return itemstack + end, +}) + +-- +-- Ores +-- + +minetest.register_node("default:stone_with_coal", { + description = "Coal Ore", + tiles = {"default_stone.png^default_mineral_coal.png"}, + groups = {cracky = 3}, + drop = 'default:coal_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coalblock", { + description = "Coal Block", + tiles = {"default_coal_block.png"}, + is_ground_content = false, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:stone_with_iron", { + description = "Iron Ore", + tiles = {"default_stone.png^default_mineral_iron.png"}, + groups = {cracky = 2}, + drop = 'default:iron_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:steelblock", { + description = "Steel Block", + tiles = {"default_steel_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_copper", { + description = "Copper Ore", + tiles = {"default_stone.png^default_mineral_copper.png"}, + groups = {cracky = 2}, + drop = 'default:copper_lump', + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:copperblock", { + description = "Copper Block", + tiles = {"default_copper_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_tin", { + description = "Tin Ore", + tiles = {"default_stone.png^default_mineral_tin.png"}, + groups = {cracky = 2}, + drop = "default:tin_lump", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:tinblock", { + description = "Tin Block", + tiles = {"default_tin_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:bronzeblock", { + description = "Bronze Block", + tiles = {"default_bronze_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_mese", { + description = "Mese Ore", + tiles = {"default_stone.png^default_mineral_mese.png"}, + groups = {cracky = 1}, + drop = "default:mese_crystal", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:mese", { + description = "Mese Block", + tiles = {"default_mese_block.png"}, + paramtype = "light", + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_stone_defaults(), + light_source = 3, +}) + + +minetest.register_node("default:stone_with_gold", { + description = "Gold Ore", + tiles = {"default_stone.png^default_mineral_gold.png"}, + groups = {cracky = 2}, + drop = "default:gold_lump", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:goldblock", { + description = "Gold Block", + tiles = {"default_gold_block.png"}, + is_ground_content = false, + groups = {cracky = 1}, + sounds = default.node_sound_metal_defaults(), +}) + + +minetest.register_node("default:stone_with_diamond", { + description = "Diamond Ore", + tiles = {"default_stone.png^default_mineral_diamond.png"}, + groups = {cracky = 1}, + drop = "default:diamond", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:diamondblock", { + description = "Diamond Block", + tiles = {"default_diamond_block.png"}, + is_ground_content = false, + groups = {cracky = 1, level = 3}, + sounds = default.node_sound_stone_defaults(), +}) + +-- +-- Plantlife (non-cubic) +-- + +minetest.register_node("default:cactus", { + description = "Cactus", + tiles = {"default_cactus_top.png", "default_cactus_top.png", + "default_cactus_side.png"}, + paramtype2 = "facedir", + groups = {choppy = 3}, + sounds = default.node_sound_wood_defaults(), + on_place = minetest.rotate_node, +}) + +minetest.register_node("default:papyrus", { + description = "Papyrus", + drawtype = "plantlike", + tiles = {"default_papyrus.png"}, + inventory_image = "default_papyrus.png", + wield_image = "default_papyrus.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, 0.5, 6 / 16}, + }, + groups = {snappy = 3, flammable = 2}, + sounds = default.node_sound_leaves_defaults(), + + after_dig_node = function(pos, node, metadata, digger) + default.dig_up(pos, node, digger) + end, +}) + +minetest.register_node("default:dry_shrub", { + description = "Dry Shrub", + drawtype = "plantlike", + waving = 1, + tiles = {"default_dry_shrub.png"}, + inventory_image = "default_dry_shrub.png", + wield_image = "default_dry_shrub.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, attached_node = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-5 / 16, -0.5, -5 / 16, 5 / 16, 4 / 16, 5 / 16}, + }, +}) + +minetest.register_node("default:junglegrass", { + description = "Jungle Grass", + drawtype = "plantlike", + waving = 1, + visual_scale = 1.69, + tiles = {"default_junglegrass.png"}, + inventory_image = "default_junglegrass.png", + wield_image = "default_junglegrass.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flora = 1, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 1.19, 7 / 16}, + }, +}) + + +minetest.register_node("default:grass_1", { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_1.png"}, + -- Use texture of a taller grass stage in inventory + inventory_image = "default_grass_3.png", + wield_image = "default_grass_3.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flora = 1, attached_node = 1, grass = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -5 / 16, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random grass node + local stack = ItemStack("default:grass_" .. math.random(1,5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:grass_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 5 do + minetest.register_node("default:grass_" .. i, { + description = "Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_grass_" .. i .. ".png"}, + inventory_image = "default_grass_" .. i .. ".png", + wield_image = "default_grass_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + drop = "default:grass_1", + groups = {snappy = 3, flora = 1, attached_node = 1, + not_in_creative_inventory = 1, grass = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, + }, + }) +end + + +minetest.register_node("default:dry_grass_1", { + description = "Dry Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_dry_grass_1.png"}, + inventory_image = "default_dry_grass_3.png", + wield_image = "default_dry_grass_3.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, + attached_node = 1, dry_grass = 1}, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -3 / 16, 6 / 16}, + }, + + on_place = function(itemstack, placer, pointed_thing) + -- place a random dry grass node + local stack = ItemStack("default:dry_grass_" .. math.random(1, 5)) + local ret = minetest.item_place(stack, placer, pointed_thing) + return ItemStack("default:dry_grass_1 " .. + itemstack:get_count() - (1 - ret:get_count())) + end, +}) + +for i = 2, 5 do + minetest.register_node("default:dry_grass_" .. i, { + description = "Dry Grass", + drawtype = "plantlike", + waving = 1, + tiles = {"default_dry_grass_" .. i .. ".png"}, + inventory_image = "default_dry_grass_" .. i .. ".png", + wield_image = "default_dry_grass_" .. i .. ".png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, flammable = 3, flora = 1, attached_node = 1, + not_in_creative_inventory=1, dry_grass = 1}, + drop = "default:dry_grass_1", + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = {-6 / 16, -0.5, -6 / 16, 6 / 16, -1 / 16, 6 / 16}, + }, + }) +end + + +minetest.register_node("default:bush_stem", { + description = "Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_bush_stem.png"}, + inventory_image = "default_bush_stem.png", + wield_image = "default_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + }, +}) + +minetest.register_node("default:bush_leaves", { + description = "Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:bush_sapling"}, rarity = 5}, + {items = {"default:bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:bush_sapling", { + description = "Bush Sapling", + drawtype = "plantlike", + tiles = {"default_bush_sapling.png"}, + inventory_image = "default_bush_sapling.png", + wield_image = "default_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, 2 / 16, 4 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + +minetest.register_node("default:acacia_bush_stem", { + description = "Acacia Bush Stem", + drawtype = "plantlike", + visual_scale = 1.41, + tiles = {"default_acacia_bush_stem.png"}, + inventory_image = "default_acacia_bush_stem.png", + wield_image = "default_acacia_bush_stem.png", + paramtype = "light", + sunlight_propagates = true, + groups = {choppy = 2, oddly_breakable_by_hand = 1, flammable = 2}, + sounds = default.node_sound_wood_defaults(), + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, 0.5, 7 / 16}, + }, +}) + +minetest.register_node("default:acacia_bush_leaves", { + description = "Acacia Bush Leaves", + drawtype = "allfaces_optional", + waving = 1, + tiles = {"default_acacia_leaves_simple.png"}, + paramtype = "light", + groups = {snappy = 3, flammable = 2, leaves = 1}, + drop = { + max_items = 1, + items = { + {items = {"default:acacia_bush_sapling"}, rarity = 5}, + {items = {"default:acacia_bush_leaves"}} + } + }, + sounds = default.node_sound_leaves_defaults(), + + after_place_node = default.after_place_leaves, +}) + +minetest.register_node("default:acacia_bush_sapling", { + description = "Acacia Bush Sapling", + drawtype = "plantlike", + tiles = {"default_acacia_bush_sapling.png"}, + inventory_image = "default_acacia_bush_sapling.png", + wield_image = "default_acacia_bush_sapling.png", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + on_timer = default.grow_sapling, + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, 2 / 16, 3 / 16} + }, + groups = {snappy = 2, dig_immediate = 3, flammable = 2, + attached_node = 1, sapling = 1}, + sounds = default.node_sound_leaves_defaults(), + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end, + + on_place = function(itemstack, placer, pointed_thing) + itemstack = default.sapling_on_place(itemstack, placer, pointed_thing, + "default:acacia_bush_sapling", + -- minp, maxp to be checked, relative to sapling pos + {x = -1, y = 0, z = -1}, + {x = 1, y = 1, z = 1}, + -- maximum interval of interior volume check + 2) + + return itemstack + end, +}) + + +-- +-- Corals +-- + +minetest.register_node("default:coral_brown", { + description = "Brown Coral", + tiles = {"default_coral_brown.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_orange", { + description = "Orange Coral", + tiles = {"default_coral_orange.png"}, + groups = {cracky = 3}, + drop = "default:coral_skeleton", + sounds = default.node_sound_stone_defaults(), +}) + +minetest.register_node("default:coral_skeleton", { + description = "Coral Skeleton", + tiles = {"default_coral_skeleton.png"}, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +-- +-- Liquids +-- + +minetest.register_node("default:water_source", { + description = "Water Source", + drawtype = "liquid", + tiles = { + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + -- New-style water source material (mostly unused) + { + name = "default_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a = 103, r = 30, g = 60, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + +minetest.register_node("default:water_flowing", { + description = "Flowing Water", + drawtype = "flowingliquid", + tiles = {"default_water.png"}, + special_tiles = { + { + name = "default_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:water_flowing", + liquid_alternative_source = "default:water_source", + liquid_viscosity = 1, + post_effect_color = {a = 103, r = 30, g = 60, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + + +minetest.register_node("default:river_water_source", { + description = "River Water Source", + drawtype = "liquid", + tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + }, + }, + special_tiles = { + { + name = "default_river_water_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 2.0, + }, + backface_culling = false, + }, + }, + alpha = 160, + paramtype = "light", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + +minetest.register_node("default:river_water_flowing", { + description = "Flowing River Water", + drawtype = "flowingliquid", + tiles = {"default_river_water.png"}, + special_tiles = { + { + name = "default_river_water_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + { + name = "default_river_water_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 0.8, + }, + }, + }, + alpha = 160, + paramtype = "light", + paramtype2 = "flowingliquid", + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:river_water_flowing", + liquid_alternative_source = "default:river_water_source", + liquid_viscosity = 1, + liquid_renewable = false, + liquid_range = 2, + post_effect_color = {a = 103, r = 30, g = 76, b = 90}, + groups = {water = 3, liquid = 3, puts_out_fire = 1, + not_in_creative_inventory = 1, cools_lava = 1}, + sounds = default.node_sound_water_defaults(), +}) + + +minetest.register_node("default:lava_source", { + description = "Lava Source", + drawtype = "liquid", + tiles = { + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + }, + }, + special_tiles = { + -- New-style lava source material (mostly unused) + { + name = "default_lava_source_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.0, + }, + backface_culling = false, + }, + }, + paramtype = "light", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "source", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a = 191, r = 255, g = 64, b = 0}, + groups = {lava = 3, liquid = 2, igniter = 1}, +}) + +minetest.register_node("default:lava_flowing", { + description = "Flowing Lava", + drawtype = "flowingliquid", + tiles = {"default_lava.png"}, + special_tiles = { + { + name = "default_lava_flowing_animated.png", + backface_culling = false, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + { + name = "default_lava_flowing_animated.png", + backface_culling = true, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 3.3, + }, + }, + }, + paramtype = "light", + paramtype2 = "flowingliquid", + light_source = default.LIGHT_MAX - 1, + walkable = false, + pointable = false, + diggable = false, + buildable_to = true, + is_ground_content = false, + drop = "", + drowning = 1, + liquidtype = "flowing", + liquid_alternative_flowing = "default:lava_flowing", + liquid_alternative_source = "default:lava_source", + liquid_viscosity = 7, + liquid_renewable = false, + damage_per_second = 4 * 2, + post_effect_color = {a = 191, r = 255, g = 64, b = 0}, + groups = {lava = 3, liquid = 2, igniter = 1, + not_in_creative_inventory = 1}, +}) + +-- +-- Tools / "Advanced" crafting / Non-"natural" +-- + +local function get_chest_formspec(pos) + local spos = pos.x .. "," .. pos.y .. "," .. pos.z + local formspec = + "size[8,9]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[nodemeta:" .. spos .. ";main;0,0.3;8,4;]" .. + "list[current_player;main;0,4.85;8,1;]" .. + "list[current_player;main;0,6.08;8,3;8]" .. + "listring[nodemeta:" .. spos .. ";main]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,4.85) + return formspec +end + +local function chest_lid_obstructed(pos) + local above = { x = pos.x, y = pos.y + 1, z = pos.z } + local def = minetest.registered_nodes[minetest.get_node(above).name] + -- allow ladders, signs, wallmounted things and torches to not obstruct + if def.drawtype == "airlike" or + def.drawtype == "signlike" or + def.drawtype == "torchlike" or + (def.drawtype == "nodebox" and def.paramtype2 == "wallmounted") then + return false + end + return true +end + +local open_chests = {} + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "default:chest" then + return + end + if not player or not fields.quit then + return + end + local pn = player:get_player_name() + + if not open_chests[pn] then + return + end + + local pos = open_chests[pn].pos + local sound = open_chests[pn].sound + local swap = open_chests[pn].swap + local node = minetest.get_node(pos) + + open_chests[pn] = nil + for k, v in pairs(open_chests) do + if v.pos.x == pos.x and v.pos.y == pos.y and v.pos.z == pos.z then + return true + end + end + minetest.after(0.2, minetest.swap_node, pos, { name = "default:" .. swap, + param2 = node.param2 }) + minetest.sound_play(sound, {gain = 0.3, pos = pos, max_hear_distance = 10}) + return true +end) + +function default.register_chest(name, d) + local def = table.copy(d) + def.drawtype = "mesh" + def.visual = "mesh" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.legacy_facedir_simple = true + def.is_ground_content = false + + if def.protected then + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Locked Chest") + meta:set_string("owner", "") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name() or "") + meta:set_string("infotext", "Locked Chest (owned by " .. + meta:get_string("owner") .. ")") + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") and + default.can_interact_with_node(player, pos) + end + def.allow_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return count + end + def.allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.allow_metadata_inventory_take = function(pos, listname, index, stack, player) + if not default.can_interact_with_node(player, pos) then + return 0 + end + return stack:get_count() + end + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + if not default.can_interact_with_node(clicker, pos) then + return itemstack + end + + minetest.sound_play(def.sound_open, {gain = 0.3, + pos = pos, max_hear_distance = 10}) + if not chest_lid_obstructed(pos) then + minetest.swap_node(pos, + { name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", get_chest_formspec(pos)) + open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + def.on_blast = function() end + def.on_key_use = function(pos, player) + local secret = minetest.get_meta(pos):get_string("key_lock_secret") + local itemstack = player:get_wielded_item() + local key_meta = itemstack:get_meta() + + if key_meta:get_string("secret") == "" then + key_meta:set_string("secret", minetest.parse_json(itemstack:get_metadata()).secret) + itemstack:set_metadata("") + end + + if secret ~= key_meta:get_string("secret") then + return + end + + minetest.show_formspec( + player:get_player_name(), + "default:chest_locked", + get_chest_formspec(pos) + ) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pn = player:get_player_name() + + -- verify placer is owner of lockable chest + if owner ~= pn then + minetest.record_protection_violation(pos, pn) + minetest.chat_send_player(pn, "You do not own this chest.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked chest", owner + end + else + def.on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("infotext", "Chest") + local inv = meta:get_inventory() + inv:set_size("main", 8*4) + end + def.can_dig = function(pos,player) + local meta = minetest.get_meta(pos); + local inv = meta:get_inventory() + return inv:is_empty("main") + end + def.on_rightclick = function(pos, node, clicker) + minetest.sound_play(def.sound_open, {gain = 0.3, pos = pos, + max_hear_distance = 10}) + if not chest_lid_obstructed(pos) then + minetest.swap_node(pos, { + name = "default:" .. name .. "_open", + param2 = node.param2 }) + end + minetest.after(0.2, minetest.show_formspec, + clicker:get_player_name(), + "default:chest", get_chest_formspec(pos)) + open_chests[clicker:get_player_name()] = { pos = pos, + sound = def.sound_close, swap = name } + end + end + + def.on_metadata_inventory_move = function(pos, from_list, from_index, + to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in chest at " .. minetest.pos_to_string(pos)) + end + def.on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves " .. stack:get_name() .. + " to chest at " .. minetest.pos_to_string(pos)) + end + def.on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes " .. stack:get_name() .. + " from chest at " .. minetest.pos_to_string(pos)) + end + def.on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "main", drops) + drops[#drops+1] = "default:chest" + minetest.remove_node(pos) + return drops + end + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_opened.mesh = "chest_open.obj" + def_opened.drop = "default:" .. name + def_opened.groups.not_in_creative_inventory = 1 + def_opened.selection_box = { + type = "fixed", + fixed = { -1/2, -1/2, -1/2, 1/2, 3/16, 1/2 }, + } + def_opened.can_dig = function() + return false + end + + def_closed.mesh = nil + def_closed.drawtype = nil + def_closed.tiles[6] = def.tiles[5] -- swap textures around for "normal" + def_closed.tiles[5] = def.tiles[3] -- drawtype to make them match the mesh + def_closed.tiles[3] = def.tiles[3].."^[transformFX" + + minetest.register_node("default:" .. name, def_closed) + minetest.register_node("default:" .. name .. "_open", def_opened) + + -- convert old chests to this new variant + minetest.register_lbm({ + label = "update chests to opening chests", + name = "default:upgrade_" .. name .. "_v2", + nodenames = {"default:" .. name}, + action = function(pos, node) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", nil) + local inv = meta:get_inventory() + local list = inv:get_list("default:chest") + if list then + inv:set_size("main", 8*4) + inv:set_list("main", list) + inv:set_list("default:chest", nil) + end + end + }) +end + + +default.register_chest("chest", { + description = "Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_front.png", + "default_chest_inside.png" + }, + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {}, +}) + +default.register_chest("chest_locked", { + description = "Locked Chest", + tiles = { + "default_chest_top.png", + "default_chest_top.png", + "default_chest_side.png", + "default_chest_side.png", + "default_chest_lock.png", + "default_chest_inside.png" + }, + sounds = default.node_sound_wood_defaults(), + sound_open = "default_chest_open", + sound_close = "default_chest_close", + groups = {choppy = 2, oddly_breakable_by_hand = 2}, + protected = true, +}) + +local bookshelf_formspec = + "size[8,7;]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[context;books;0,0.3;8,2;]" .. + "list[current_player;main;0,2.85;8,1;]" .. + "list[current_player;main;0,4.08;8,3;8]" .. + "listring[context;books]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0,2.85) + +local function get_bookshelf_formspec(inv) + local formspec = bookshelf_formspec + local invlist = inv and inv:get_list("books") + -- Inventory slots overlay + local bx, by = 0, 0.3 + for i = 1, 16 do + if i == 9 then + bx = 0 + by = by + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. bx .. "," .. by .. ";1,1;default_bookshelf_slot.png]" + end + bx = bx + 1 + end + return formspec +end + +minetest.register_node("default:bookshelf", { + description = "Bookshelf", + tiles = {"default_wood.png", "default_wood.png", "default_wood.png", + "default_wood.png", "default_bookshelf.png", "default_bookshelf.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(nil)) + local inv = meta:get_inventory() + inv:set_size("books", 8 * 2) + end, + can_dig = function(pos,player) + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("books") + end, + allow_metadata_inventory_put = function(pos, listname, index, stack) + if minetest.get_item_group(stack:get_name(), "book") ~= 0 then + return stack:get_count() + end + return 0 + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves stuff to bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes stuff from bookshelf at " .. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_bookshelf_formspec(meta:get_inventory())) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "books", drops) + drops[#drops+1] = "default:bookshelf" + minetest.remove_node(pos) + return drops + end, +}) + +local function register_sign(material, desc, def) + minetest.register_node("default:sign_wall_" .. material, { + description = desc .. " Sign", + drawtype = "nodebox", + tiles = {"default_sign_wall_" .. material .. ".png"}, + inventory_image = "default_sign_" .. material .. ".png", + wield_image = "default_sign_" .. material .. ".png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + is_ground_content = false, + walkable = false, + node_box = { + type = "wallmounted", + wall_top = {-0.4375, 0.4375, -0.3125, 0.4375, 0.5, 0.3125}, + wall_bottom = {-0.4375, -0.5, -0.3125, 0.4375, -0.4375, 0.3125}, + wall_side = {-0.5, -0.3125, -0.4375, -0.4375, 0.3125, 0.4375}, + }, + groups = def.groups, + legacy_wallmounted = true, + sounds = def.sounds, + + on_construct = function(pos) + --local n = minetest.get_node(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", "field[text;;${text}]") + end, + on_receive_fields = function(pos, formname, fields, sender) + --print("Sign at "..minetest.pos_to_string(pos).." got "..dump(fields)) + local player_name = sender:get_player_name() + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) + return + end + local meta = minetest.get_meta(pos) + if not fields.text then return end + minetest.log("action", (player_name or "") .. " wrote \"" .. + fields.text .. "\" to sign at " .. minetest.pos_to_string(pos)) + meta:set_string("text", fields.text) + meta:set_string("infotext", '"' .. fields.text .. '"') + end, + }) +end + +register_sign("wood", "Wooden", { + sounds = default.node_sound_wood_defaults(), + groups = {choppy = 2, attached_node = 1, flammable = 2, oddly_breakable_by_hand = 3} +}) + +register_sign("steel", "Steel", { + sounds = default.node_sound_metal_defaults(), + groups = {cracky = 2, attached_node = 1} +}) + +minetest.register_node("default:ladder_wood", { + description = "Wooden Ladder", + drawtype = "signlike", + tiles = {"default_ladder_wood.png"}, + inventory_image = "default_ladder_wood.png", + wield_image = "default_ladder_wood.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {choppy = 2, oddly_breakable_by_hand = 3, flammable = 2}, + legacy_wallmounted = true, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:ladder_steel", { + description = "Steel Ladder", + drawtype = "signlike", + tiles = {"default_ladder_steel.png"}, + inventory_image = "default_ladder_steel.png", + wield_image = "default_ladder_steel.png", + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + climbable = true, + is_ground_content = false, + selection_box = { + type = "wallmounted", + --wall_top = = + --wall_bottom = = + --wall_side = = + }, + groups = {cracky = 2}, + sounds = default.node_sound_metal_defaults(), +}) + +default.register_fence("default:fence_wood", { + description = "Wooden Fence", + texture = "default_fence_wood.png", + inventory_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_acacia_wood", { + description = "Acacia Fence", + texture = "default_fence_acacia_wood.png", + inventory_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_acacia_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_junglewood", { + description = "Jungle Wood Fence", + texture = "default_fence_junglewood.png", + inventory_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_junglewood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_pine_wood", { + description = "Pine Fence", + texture = "default_fence_pine_wood.png", + inventory_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_pine_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +default.register_fence("default:fence_aspen_wood", { + description = "Aspen Fence", + texture = "default_fence_aspen_wood.png", + inventory_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + wield_image = "default_fence_overlay.png^default_aspen_wood.png^default_fence_overlay.png^[makealpha:255,126,126", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults() +}) + +minetest.register_node("default:glass", { + description = "Glass", + drawtype = "glasslike_framed_optional", + tiles = {"default_glass.png", "default_glass_detail.png"}, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_node("default:obsidian_glass", { + description = "Obsidian Glass", + drawtype = "glasslike_framed_optional", + tiles = {"default_obsidian_glass.png", "default_obsidian_glass_detail.png"}, + paramtype = "light", + paramtype2 = "glasslikeliquidlevel", + is_ground_content = false, + sunlight_propagates = true, + sounds = default.node_sound_glass_defaults(), + groups = {cracky = 3}, +}) + + +minetest.register_node("default:brick", { + description = "Brick Block", + paramtype2 = "facedir", + place_param2 = 0, + tiles = {"default_brick.png"}, + is_ground_content = false, + groups = {cracky = 3}, + sounds = default.node_sound_stone_defaults(), +}) + + +minetest.register_node("default:meselamp", { + description = "Mese Lamp", + drawtype = "glasslike", + tiles = {"default_meselamp.png"}, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky = 3, oddly_breakable_by_hand = 3}, + sounds = default.node_sound_glass_defaults(), + light_source = default.LIGHT_MAX, +}) + +minetest.register_node("default:mese_post_light", { + description = "Mese Post Light", + tiles = {"default_mese_post_light_top.png", "default_mese_post_light_top.png", + "default_mese_post_light_side_dark.png", "default_mese_post_light_side_dark.png", + "default_mese_post_light_side.png", "default_mese_post_light_side.png"}, + wield_image = "default_mese_post_light_side.png", + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = { + {-2 / 16, -8 / 16, -2 / 16, 2 / 16, 8 / 16, 2 / 16}, + }, + }, + paramtype = "light", + light_source = default.LIGHT_MAX, + sunlight_propagates = true, + is_ground_content = false, + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + sounds = default.node_sound_wood_defaults(), +}) + +-- +-- Misc +-- + +minetest.register_node("default:cloud", { + description = "Cloud", + tiles = {"default_cloud.png"}, + is_ground_content = false, + sounds = default.node_sound_defaults(), + groups = {not_in_creative_inventory = 1}, +}) + +-- +-- register trees for leafdecay +-- + +if minetest.get_mapgen_setting("mg_name") == "v6" then + default.register_leafdecay({ + trunks = {"default:tree"}, + leaves = {"default:apple", "default:leaves"}, + radius = 2, + }) + + default.register_leafdecay({ + trunks = {"default:jungletree"}, + leaves = {"default:jungleleaves"}, + radius = 3, + }) + + default.register_leafdecay({ + trunks = {"default:pine_tree"}, + leaves = {"default:pine_needles"}, + radius = 3, + }) +else + default.register_leafdecay({ + trunks = {"default:tree"}, + leaves = {"default:apple", "default:leaves"}, + radius = 3, + }) + + default.register_leafdecay({ + trunks = {"default:jungletree"}, + leaves = {"default:jungleleaves"}, + radius = 2, + }) + + default.register_leafdecay({ + trunks = {"default:pine_tree"}, + leaves = {"default:pine_needles"}, + radius = 2, + }) +end + +default.register_leafdecay({ + trunks = {"default:acacia_tree"}, + leaves = {"default:acacia_leaves"}, + radius = 2, +}) + +default.register_leafdecay({ + trunks = {"default:aspen_tree"}, + leaves = {"default:aspen_leaves"}, + radius = 3, +}) + +default.register_leafdecay({ + trunks = {"default:bush_stem"}, + leaves = {"default:bush_leaves"}, + radius = 1, +}) + +default.register_leafdecay({ + trunks = {"default:acacia_bush_stem"}, + leaves = {"default:acacia_bush_leaves"}, + radius = 1, +}) diff --git a/mods/default/player.lua b/mods/default/player.lua new file mode 100644 index 0000000..0a2078d --- /dev/null +++ b/mods/default/player.lua @@ -0,0 +1,154 @@ +-- Minetest 0.4 mod: player +-- See README.txt for licensing and other information. + +-- Player animation blending +-- Note: This is currently broken due to a bug in Irrlicht, leave at 0 +local animation_blend = 0 + +default.registered_player_models = { } + +-- Local for speed. +local models = default.registered_player_models + +function default.player_register_model(name, def) + models[name] = def +end + +-- Default player appearance +default.player_register_model("character.b3d", { + animation_speed = 30, + textures = {"character.png", }, + animations = { + -- Standard animations. + stand = { x= 0, y= 79, }, + lay = { x=162, y=166, }, + walk = { x=168, y=187, }, + mine = { x=189, y=198, }, + walk_mine = { x=200, y=219, }, + sit = { x= 81, y=160, }, + }, +}) + +-- Player stats and animations +local player_model = {} +local player_textures = {} +local player_anim = {} +local player_sneak = {} +default.player_attached = {} + +function default.player_get_animation(player) + local name = player:get_player_name() + return { + model = player_model[name], + textures = player_textures[name], + animation = player_anim[name], + } +end + +-- Called when a player's appearance needs to be updated +function default.player_set_model(player, model_name) + local name = player:get_player_name() + local model = models[model_name] + if model then + if player_model[name] == model_name then + return + end + player:set_properties({ + mesh = model_name, + textures = player_textures[name] or model.textures, + visual = "mesh", + visual_size = model.visual_size or {x=1, y=1}, + }) + default.player_set_animation(player, "stand") + else + player:set_properties({ + textures = { "player.png", "player_back.png", }, + visual = "upright_sprite", + }) + end + player_model[name] = model_name +end + +function default.player_set_textures(player, textures) + local name = player:get_player_name() + player_textures[name] = textures + player:set_properties({textures = textures,}) +end + +function default.player_set_animation(player, anim_name, speed) + local name = player:get_player_name() + if player_anim[name] == anim_name then + return + end + local model = player_model[name] and models[player_model[name]] + if not (model and model.animations[anim_name]) then + return + end + local anim = model.animations[anim_name] + player_anim[name] = anim_name + player:set_animation(anim, speed or model.animation_speed, animation_blend) +end + +-- Update appearance when the player joins +minetest.register_on_joinplayer(function(player) + default.player_attached[player:get_player_name()] = false + default.player_set_model(player, "character.b3d") + player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) + + player:hud_set_hotbar_image("gui_hotbar.png") + player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") +end) + +minetest.register_on_leaveplayer(function(player) + local name = player:get_player_name() + player_model[name] = nil + player_anim[name] = nil + player_textures[name] = nil +end) + +-- Localize for better performance. +local player_set_animation = default.player_set_animation +local player_attached = default.player_attached + +-- Check each player and apply animations +minetest.register_globalstep(function(dtime) + for _, player in pairs(minetest.get_connected_players()) do + local name = player:get_player_name() + local model_name = player_model[name] + local model = model_name and models[model_name] + if model and not player_attached[name] then + local controls = player:get_player_control() + local walking = false + local animation_speed_mod = model.animation_speed or 30 + + -- Determine if the player is walking + if controls.up or controls.down or controls.left or controls.right then + walking = true + end + + -- Determine if the player is sneaking, and reduce animation speed if so + if controls.sneak then + animation_speed_mod = animation_speed_mod / 2 + end + + -- Apply animations based on what the player is doing + if player:get_hp() == 0 then + player_set_animation(player, "lay") + elseif walking then + if player_sneak[name] ~= controls.sneak then + player_anim[name] = nil + player_sneak[name] = controls.sneak + end + if controls.LMB then + player_set_animation(player, "walk_mine", animation_speed_mod) + else + player_set_animation(player, "walk", animation_speed_mod) + end + elseif controls.LMB then + player_set_animation(player, "mine") + else + player_set_animation(player, "stand", animation_speed_mod) + end + end + end +end) diff --git a/mods/default/schematics/acacia_bush.mts b/mods/default/schematics/acacia_bush.mts new file mode 100644 index 0000000..df95586 Binary files /dev/null and b/mods/default/schematics/acacia_bush.mts differ diff --git a/mods/default/schematics/acacia_log.mts b/mods/default/schematics/acacia_log.mts new file mode 100644 index 0000000..037bca8 Binary files /dev/null and b/mods/default/schematics/acacia_log.mts differ diff --git a/mods/default/schematics/acacia_tree.mts b/mods/default/schematics/acacia_tree.mts new file mode 100644 index 0000000..4732ade Binary files /dev/null and b/mods/default/schematics/acacia_tree.mts differ diff --git a/mods/default/schematics/acacia_tree_from_sapling.mts b/mods/default/schematics/acacia_tree_from_sapling.mts new file mode 100644 index 0000000..23e8e4b Binary files /dev/null and b/mods/default/schematics/acacia_tree_from_sapling.mts differ diff --git a/mods/default/schematics/apple_log.mts b/mods/default/schematics/apple_log.mts new file mode 100644 index 0000000..e7ee8f2 Binary files /dev/null and b/mods/default/schematics/apple_log.mts differ diff --git a/mods/default/schematics/apple_tree.mts b/mods/default/schematics/apple_tree.mts new file mode 100644 index 0000000..2bd57c1 Binary files /dev/null and b/mods/default/schematics/apple_tree.mts differ diff --git a/mods/default/schematics/apple_tree_from_sapling.mts b/mods/default/schematics/apple_tree_from_sapling.mts new file mode 100644 index 0000000..d258ab1 Binary files /dev/null and b/mods/default/schematics/apple_tree_from_sapling.mts differ diff --git a/mods/default/schematics/aspen_log.mts b/mods/default/schematics/aspen_log.mts new file mode 100644 index 0000000..180e6fd Binary files /dev/null and b/mods/default/schematics/aspen_log.mts differ diff --git a/mods/default/schematics/aspen_tree.mts b/mods/default/schematics/aspen_tree.mts new file mode 100644 index 0000000..429a831 Binary files /dev/null and b/mods/default/schematics/aspen_tree.mts differ diff --git a/mods/default/schematics/aspen_tree_from_sapling.mts b/mods/default/schematics/aspen_tree_from_sapling.mts new file mode 100644 index 0000000..b7ab3ee Binary files /dev/null and b/mods/default/schematics/aspen_tree_from_sapling.mts differ diff --git a/mods/default/schematics/bush.mts b/mods/default/schematics/bush.mts new file mode 100644 index 0000000..d08cf5f Binary files /dev/null and b/mods/default/schematics/bush.mts differ diff --git a/mods/default/schematics/corals.mts b/mods/default/schematics/corals.mts new file mode 100644 index 0000000..e1bd7de Binary files /dev/null and b/mods/default/schematics/corals.mts differ diff --git a/mods/default/schematics/jungle_log.mts b/mods/default/schematics/jungle_log.mts new file mode 100644 index 0000000..54fa16d Binary files /dev/null and b/mods/default/schematics/jungle_log.mts differ diff --git a/mods/default/schematics/jungle_tree.mts b/mods/default/schematics/jungle_tree.mts new file mode 100644 index 0000000..01a1b11 Binary files /dev/null and b/mods/default/schematics/jungle_tree.mts differ diff --git a/mods/default/schematics/jungle_tree_from_sapling.mts b/mods/default/schematics/jungle_tree_from_sapling.mts new file mode 100644 index 0000000..f93f014 Binary files /dev/null and b/mods/default/schematics/jungle_tree_from_sapling.mts differ diff --git a/mods/default/schematics/large_cactus.mts b/mods/default/schematics/large_cactus.mts new file mode 100644 index 0000000..b71077b Binary files /dev/null and b/mods/default/schematics/large_cactus.mts differ diff --git a/mods/default/schematics/papyrus.mts b/mods/default/schematics/papyrus.mts new file mode 100644 index 0000000..1333a7c Binary files /dev/null and b/mods/default/schematics/papyrus.mts differ diff --git a/mods/default/schematics/pine_log.mts b/mods/default/schematics/pine_log.mts new file mode 100644 index 0000000..744c38b Binary files /dev/null and b/mods/default/schematics/pine_log.mts differ diff --git a/mods/default/schematics/pine_tree.mts b/mods/default/schematics/pine_tree.mts new file mode 100644 index 0000000..6f27d83 Binary files /dev/null and b/mods/default/schematics/pine_tree.mts differ diff --git a/mods/default/schematics/pine_tree_from_sapling.mts b/mods/default/schematics/pine_tree_from_sapling.mts new file mode 100644 index 0000000..e42a996 Binary files /dev/null and b/mods/default/schematics/pine_tree_from_sapling.mts differ diff --git a/mods/default/schematics/snowy_pine_tree_from_sapling.mts b/mods/default/schematics/snowy_pine_tree_from_sapling.mts new file mode 100644 index 0000000..0692049 Binary files /dev/null and b/mods/default/schematics/snowy_pine_tree_from_sapling.mts differ diff --git a/mods/default/sounds/default_break_glass.1.ogg b/mods/default/sounds/default_break_glass.1.ogg new file mode 100644 index 0000000..b1ccc5f Binary files /dev/null and b/mods/default/sounds/default_break_glass.1.ogg differ diff --git a/mods/default/sounds/default_break_glass.2.ogg b/mods/default/sounds/default_break_glass.2.ogg new file mode 100644 index 0000000..b6cc9e8 Binary files /dev/null and b/mods/default/sounds/default_break_glass.2.ogg differ diff --git a/mods/default/sounds/default_break_glass.3.ogg b/mods/default/sounds/default_break_glass.3.ogg new file mode 100644 index 0000000..ae6a6bf Binary files /dev/null and b/mods/default/sounds/default_break_glass.3.ogg differ diff --git a/mods/default/sounds/default_chest_close.ogg b/mods/default/sounds/default_chest_close.ogg new file mode 100644 index 0000000..53ff23d Binary files /dev/null and b/mods/default/sounds/default_chest_close.ogg differ diff --git a/mods/default/sounds/default_chest_open.ogg b/mods/default/sounds/default_chest_open.ogg new file mode 100644 index 0000000..c73c072 Binary files /dev/null and b/mods/default/sounds/default_chest_open.ogg differ diff --git a/mods/default/sounds/default_cool_lava.1.ogg b/mods/default/sounds/default_cool_lava.1.ogg new file mode 100644 index 0000000..42506dd Binary files /dev/null and b/mods/default/sounds/default_cool_lava.1.ogg differ diff --git a/mods/default/sounds/default_cool_lava.2.ogg b/mods/default/sounds/default_cool_lava.2.ogg new file mode 100644 index 0000000..2747ab8 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.2.ogg differ diff --git a/mods/default/sounds/default_cool_lava.3.ogg b/mods/default/sounds/default_cool_lava.3.ogg new file mode 100644 index 0000000..8baeac3 Binary files /dev/null and b/mods/default/sounds/default_cool_lava.3.ogg differ diff --git a/mods/default/sounds/default_dig_choppy.ogg b/mods/default/sounds/default_dig_choppy.ogg new file mode 100644 index 0000000..e2ecd84 Binary files /dev/null and b/mods/default/sounds/default_dig_choppy.ogg differ diff --git a/mods/default/sounds/default_dig_cracky.ogg b/mods/default/sounds/default_dig_cracky.ogg new file mode 100644 index 0000000..da11679 Binary files /dev/null and b/mods/default/sounds/default_dig_cracky.ogg differ diff --git a/mods/default/sounds/default_dig_crumbly.ogg b/mods/default/sounds/default_dig_crumbly.ogg new file mode 100644 index 0000000..a0b2a1f Binary files /dev/null and b/mods/default/sounds/default_dig_crumbly.ogg differ diff --git a/mods/default/sounds/default_dig_dig_immediate.ogg b/mods/default/sounds/default_dig_dig_immediate.ogg new file mode 100644 index 0000000..e65d766 Binary files /dev/null and b/mods/default/sounds/default_dig_dig_immediate.ogg differ diff --git a/mods/default/sounds/default_dig_metal.ogg b/mods/default/sounds/default_dig_metal.ogg new file mode 100644 index 0000000..0b58509 Binary files /dev/null and b/mods/default/sounds/default_dig_metal.ogg differ diff --git a/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg new file mode 100644 index 0000000..ef4d7b1 Binary files /dev/null and b/mods/default/sounds/default_dig_oddly_breakable_by_hand.ogg differ diff --git a/mods/default/sounds/default_dig_snappy.ogg b/mods/default/sounds/default_dig_snappy.ogg new file mode 100644 index 0000000..3686fcd Binary files /dev/null and b/mods/default/sounds/default_dig_snappy.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.1.ogg b/mods/default/sounds/default_dirt_footstep.1.ogg new file mode 100644 index 0000000..84a197d Binary files /dev/null and b/mods/default/sounds/default_dirt_footstep.1.ogg differ diff --git a/mods/default/sounds/default_dirt_footstep.2.ogg b/mods/default/sounds/default_dirt_footstep.2.ogg new file mode 100644 index 0000000..2e23b8a Binary files /dev/null and b/mods/default/sounds/default_dirt_footstep.2.ogg differ diff --git a/mods/default/sounds/default_dug_metal.1.ogg b/mods/default/sounds/default_dug_metal.1.ogg new file mode 100644 index 0000000..5d6cb5b Binary files /dev/null and b/mods/default/sounds/default_dug_metal.1.ogg differ diff --git a/mods/default/sounds/default_dug_metal.2.ogg b/mods/default/sounds/default_dug_metal.2.ogg new file mode 100644 index 0000000..63567fc Binary files /dev/null and b/mods/default/sounds/default_dug_metal.2.ogg differ diff --git a/mods/default/sounds/default_dug_node.1.ogg b/mods/default/sounds/default_dug_node.1.ogg new file mode 100644 index 0000000..c04975d Binary files /dev/null and b/mods/default/sounds/default_dug_node.1.ogg differ diff --git a/mods/default/sounds/default_dug_node.2.ogg b/mods/default/sounds/default_dug_node.2.ogg new file mode 100644 index 0000000..9f20926 Binary files /dev/null and b/mods/default/sounds/default_dug_node.2.ogg differ diff --git a/mods/default/sounds/default_glass_footstep.ogg b/mods/default/sounds/default_glass_footstep.ogg new file mode 100644 index 0000000..191287a Binary files /dev/null and b/mods/default/sounds/default_glass_footstep.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.1.ogg b/mods/default/sounds/default_grass_footstep.1.ogg new file mode 100644 index 0000000..22d1ad6 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.1.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.2.ogg b/mods/default/sounds/default_grass_footstep.2.ogg new file mode 100644 index 0000000..4ccd8a0 Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.2.ogg differ diff --git a/mods/default/sounds/default_grass_footstep.3.ogg b/mods/default/sounds/default_grass_footstep.3.ogg new file mode 100644 index 0000000..20db84e Binary files /dev/null and b/mods/default/sounds/default_grass_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.1.ogg b/mods/default/sounds/default_gravel_footstep.1.ogg new file mode 100644 index 0000000..8d260ce Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.1.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.2.ogg b/mods/default/sounds/default_gravel_footstep.2.ogg new file mode 100644 index 0000000..2aba2c6 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.2.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.3.ogg b/mods/default/sounds/default_gravel_footstep.3.ogg new file mode 100644 index 0000000..1bcd8a1 Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.3.ogg differ diff --git a/mods/default/sounds/default_gravel_footstep.4.ogg b/mods/default/sounds/default_gravel_footstep.4.ogg new file mode 100644 index 0000000..696c9ff Binary files /dev/null and b/mods/default/sounds/default_gravel_footstep.4.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.1.ogg b/mods/default/sounds/default_hard_footstep.1.ogg new file mode 100644 index 0000000..1748bc5 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.1.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.2.ogg b/mods/default/sounds/default_hard_footstep.2.ogg new file mode 100644 index 0000000..fe39fd7 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.2.ogg differ diff --git a/mods/default/sounds/default_hard_footstep.3.ogg b/mods/default/sounds/default_hard_footstep.3.ogg new file mode 100644 index 0000000..5030e06 Binary files /dev/null and b/mods/default/sounds/default_hard_footstep.3.ogg differ diff --git a/mods/default/sounds/default_item_smoke.ogg b/mods/default/sounds/default_item_smoke.ogg new file mode 100644 index 0000000..038a46e Binary files /dev/null and b/mods/default/sounds/default_item_smoke.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.1.ogg b/mods/default/sounds/default_metal_footstep.1.ogg new file mode 100644 index 0000000..841286b Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.1.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.2.ogg b/mods/default/sounds/default_metal_footstep.2.ogg new file mode 100644 index 0000000..aa61ed3 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.2.ogg differ diff --git a/mods/default/sounds/default_metal_footstep.3.ogg b/mods/default/sounds/default_metal_footstep.3.ogg new file mode 100644 index 0000000..4cc1ca4 Binary files /dev/null and b/mods/default/sounds/default_metal_footstep.3.ogg differ diff --git a/mods/default/sounds/default_place_node.1.ogg b/mods/default/sounds/default_place_node.1.ogg new file mode 100644 index 0000000..46b9756 Binary files /dev/null and b/mods/default/sounds/default_place_node.1.ogg differ diff --git a/mods/default/sounds/default_place_node.2.ogg b/mods/default/sounds/default_place_node.2.ogg new file mode 100644 index 0000000..d34c01a Binary files /dev/null and b/mods/default/sounds/default_place_node.2.ogg differ diff --git a/mods/default/sounds/default_place_node.3.ogg b/mods/default/sounds/default_place_node.3.ogg new file mode 100644 index 0000000..fc29365 Binary files /dev/null and b/mods/default/sounds/default_place_node.3.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.1.ogg b/mods/default/sounds/default_place_node_hard.1.ogg new file mode 100644 index 0000000..9f97fac Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.1.ogg differ diff --git a/mods/default/sounds/default_place_node_hard.2.ogg b/mods/default/sounds/default_place_node_hard.2.ogg new file mode 100644 index 0000000..1d3b3de Binary files /dev/null and b/mods/default/sounds/default_place_node_hard.2.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.1.ogg b/mods/default/sounds/default_place_node_metal.1.ogg new file mode 100644 index 0000000..5da085e Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.1.ogg differ diff --git a/mods/default/sounds/default_place_node_metal.2.ogg b/mods/default/sounds/default_place_node_metal.2.ogg new file mode 100644 index 0000000..5ee67fc Binary files /dev/null and b/mods/default/sounds/default_place_node_metal.2.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.1.ogg b/mods/default/sounds/default_sand_footstep.1.ogg new file mode 100644 index 0000000..65b68c7 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.1.ogg differ diff --git a/mods/default/sounds/default_sand_footstep.2.ogg b/mods/default/sounds/default_sand_footstep.2.ogg new file mode 100644 index 0000000..57f35f3 Binary files /dev/null and b/mods/default/sounds/default_sand_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.1.ogg b/mods/default/sounds/default_snow_footstep.1.ogg new file mode 100644 index 0000000..3260b91 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.1.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.2.ogg b/mods/default/sounds/default_snow_footstep.2.ogg new file mode 100644 index 0000000..4aac1e7 Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.2.ogg differ diff --git a/mods/default/sounds/default_snow_footstep.3.ogg b/mods/default/sounds/default_snow_footstep.3.ogg new file mode 100644 index 0000000..cf4235b Binary files /dev/null and b/mods/default/sounds/default_snow_footstep.3.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.1.ogg b/mods/default/sounds/default_tool_breaks.1.ogg new file mode 100644 index 0000000..2a571ae Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.1.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.2.ogg b/mods/default/sounds/default_tool_breaks.2.ogg new file mode 100644 index 0000000..1789352 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.2.ogg differ diff --git a/mods/default/sounds/default_tool_breaks.3.ogg b/mods/default/sounds/default_tool_breaks.3.ogg new file mode 100644 index 0000000..a99c4b7 Binary files /dev/null and b/mods/default/sounds/default_tool_breaks.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.1.ogg b/mods/default/sounds/default_water_footstep.1.ogg new file mode 100644 index 0000000..63b9744 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.1.ogg differ diff --git a/mods/default/sounds/default_water_footstep.2.ogg b/mods/default/sounds/default_water_footstep.2.ogg new file mode 100644 index 0000000..8d79c1f Binary files /dev/null and b/mods/default/sounds/default_water_footstep.2.ogg differ diff --git a/mods/default/sounds/default_water_footstep.3.ogg b/mods/default/sounds/default_water_footstep.3.ogg new file mode 100644 index 0000000..f889150 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.3.ogg differ diff --git a/mods/default/sounds/default_water_footstep.4.ogg b/mods/default/sounds/default_water_footstep.4.ogg new file mode 100644 index 0000000..6f1eab8 Binary files /dev/null and b/mods/default/sounds/default_water_footstep.4.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.1.ogg b/mods/default/sounds/default_wood_footstep.1.ogg new file mode 100644 index 0000000..34f63a1 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.1.ogg differ diff --git a/mods/default/sounds/default_wood_footstep.2.ogg b/mods/default/sounds/default_wood_footstep.2.ogg new file mode 100644 index 0000000..124fc29 Binary files /dev/null and b/mods/default/sounds/default_wood_footstep.2.ogg differ diff --git a/mods/default/sounds/player_damage.ogg b/mods/default/sounds/player_damage.ogg new file mode 100644 index 0000000..7888087 Binary files /dev/null and b/mods/default/sounds/player_damage.ogg differ diff --git a/mods/default/textures/bubble.png b/mods/default/textures/bubble.png new file mode 100644 index 0000000..100fe15 Binary files /dev/null and b/mods/default/textures/bubble.png differ diff --git a/mods/default/textures/crack_anylength.png b/mods/default/textures/crack_anylength.png new file mode 100644 index 0000000..297eced Binary files /dev/null and b/mods/default/textures/crack_anylength.png differ diff --git a/mods/default/textures/default_acacia_bush_sapling.png b/mods/default/textures/default_acacia_bush_sapling.png new file mode 100644 index 0000000..940b3aa Binary files /dev/null and b/mods/default/textures/default_acacia_bush_sapling.png differ diff --git a/mods/default/textures/default_acacia_bush_stem.png b/mods/default/textures/default_acacia_bush_stem.png new file mode 100644 index 0000000..2903915 Binary files /dev/null and b/mods/default/textures/default_acacia_bush_stem.png differ diff --git a/mods/default/textures/default_acacia_leaves.png b/mods/default/textures/default_acacia_leaves.png new file mode 100644 index 0000000..626e1b3 Binary files /dev/null and b/mods/default/textures/default_acacia_leaves.png differ diff --git a/mods/default/textures/default_acacia_leaves_simple.png b/mods/default/textures/default_acacia_leaves_simple.png new file mode 100644 index 0000000..3c7015b Binary files /dev/null and b/mods/default/textures/default_acacia_leaves_simple.png differ diff --git a/mods/default/textures/default_acacia_sapling.png b/mods/default/textures/default_acacia_sapling.png new file mode 100644 index 0000000..07170a0 Binary files /dev/null and b/mods/default/textures/default_acacia_sapling.png differ diff --git a/mods/default/textures/default_acacia_tree.png b/mods/default/textures/default_acacia_tree.png new file mode 100644 index 0000000..58bb3c4 Binary files /dev/null and b/mods/default/textures/default_acacia_tree.png differ diff --git a/mods/default/textures/default_acacia_tree_top.png b/mods/default/textures/default_acacia_tree_top.png new file mode 100644 index 0000000..a8a0ce0 Binary files /dev/null and b/mods/default/textures/default_acacia_tree_top.png differ diff --git a/mods/default/textures/default_acacia_wood.png b/mods/default/textures/default_acacia_wood.png new file mode 100644 index 0000000..b5abf1e Binary files /dev/null and b/mods/default/textures/default_acacia_wood.png differ diff --git a/mods/default/textures/default_apple.png b/mods/default/textures/default_apple.png new file mode 100644 index 0000000..7549bfd Binary files /dev/null and b/mods/default/textures/default_apple.png differ diff --git a/mods/default/textures/default_aspen_leaves.png b/mods/default/textures/default_aspen_leaves.png new file mode 100644 index 0000000..7306423 Binary files /dev/null and b/mods/default/textures/default_aspen_leaves.png differ diff --git a/mods/default/textures/default_aspen_sapling.png b/mods/default/textures/default_aspen_sapling.png new file mode 100644 index 0000000..f8d9136 Binary files /dev/null and b/mods/default/textures/default_aspen_sapling.png differ diff --git a/mods/default/textures/default_aspen_tree.png b/mods/default/textures/default_aspen_tree.png new file mode 100644 index 0000000..cfb05fc Binary files /dev/null and b/mods/default/textures/default_aspen_tree.png differ diff --git a/mods/default/textures/default_aspen_tree_top.png b/mods/default/textures/default_aspen_tree_top.png new file mode 100644 index 0000000..fcca038 Binary files /dev/null and b/mods/default/textures/default_aspen_tree_top.png differ diff --git a/mods/default/textures/default_aspen_wood.png b/mods/default/textures/default_aspen_wood.png new file mode 100644 index 0000000..2b584b3 Binary files /dev/null and b/mods/default/textures/default_aspen_wood.png differ diff --git a/mods/default/textures/default_book.png b/mods/default/textures/default_book.png new file mode 100644 index 0000000..448a7df Binary files /dev/null and b/mods/default/textures/default_book.png differ diff --git a/mods/default/textures/default_book_written.png b/mods/default/textures/default_book_written.png new file mode 100644 index 0000000..9196ac6 Binary files /dev/null and b/mods/default/textures/default_book_written.png differ diff --git a/mods/default/textures/default_bookshelf.png b/mods/default/textures/default_bookshelf.png new file mode 100644 index 0000000..10d6483 Binary files /dev/null and b/mods/default/textures/default_bookshelf.png differ diff --git a/mods/default/textures/default_bookshelf_slot.png b/mods/default/textures/default_bookshelf_slot.png new file mode 100644 index 0000000..715a3dc Binary files /dev/null and b/mods/default/textures/default_bookshelf_slot.png differ diff --git a/mods/default/textures/default_brick.png b/mods/default/textures/default_brick.png new file mode 100644 index 0000000..ab19121 Binary files /dev/null and b/mods/default/textures/default_brick.png differ diff --git a/mods/default/textures/default_bronze_block.png b/mods/default/textures/default_bronze_block.png new file mode 100644 index 0000000..1d0c9d5 Binary files /dev/null and b/mods/default/textures/default_bronze_block.png differ diff --git a/mods/default/textures/default_bronze_ingot.png b/mods/default/textures/default_bronze_ingot.png new file mode 100644 index 0000000..6cccdf6 Binary files /dev/null and b/mods/default/textures/default_bronze_ingot.png differ diff --git a/mods/default/textures/default_bush_sapling.png b/mods/default/textures/default_bush_sapling.png new file mode 100644 index 0000000..905ba4b Binary files /dev/null and b/mods/default/textures/default_bush_sapling.png differ diff --git a/mods/default/textures/default_bush_stem.png b/mods/default/textures/default_bush_stem.png new file mode 100644 index 0000000..18b615f Binary files /dev/null and b/mods/default/textures/default_bush_stem.png differ diff --git a/mods/default/textures/default_cactus_side.png b/mods/default/textures/default_cactus_side.png new file mode 100644 index 0000000..8d6c40c Binary files /dev/null and b/mods/default/textures/default_cactus_side.png differ diff --git a/mods/default/textures/default_cactus_top.png b/mods/default/textures/default_cactus_top.png new file mode 100644 index 0000000..cf46aa2 Binary files /dev/null and b/mods/default/textures/default_cactus_top.png differ diff --git a/mods/default/textures/default_chest_front.png b/mods/default/textures/default_chest_front.png new file mode 100644 index 0000000..85227d8 Binary files /dev/null and b/mods/default/textures/default_chest_front.png differ diff --git a/mods/default/textures/default_chest_inside.png b/mods/default/textures/default_chest_inside.png new file mode 100644 index 0000000..5f7b6b1 Binary files /dev/null and b/mods/default/textures/default_chest_inside.png differ diff --git a/mods/default/textures/default_chest_lock.png b/mods/default/textures/default_chest_lock.png new file mode 100644 index 0000000..73f46c7 Binary files /dev/null and b/mods/default/textures/default_chest_lock.png differ diff --git a/mods/default/textures/default_chest_side.png b/mods/default/textures/default_chest_side.png new file mode 100644 index 0000000..44a65a4 Binary files /dev/null and b/mods/default/textures/default_chest_side.png differ diff --git a/mods/default/textures/default_chest_top.png b/mods/default/textures/default_chest_top.png new file mode 100644 index 0000000..f4a92ee Binary files /dev/null and b/mods/default/textures/default_chest_top.png differ diff --git a/mods/default/textures/default_clay.png b/mods/default/textures/default_clay.png new file mode 100644 index 0000000..76e5a40 Binary files /dev/null and b/mods/default/textures/default_clay.png differ diff --git a/mods/default/textures/default_clay_brick.png b/mods/default/textures/default_clay_brick.png new file mode 100644 index 0000000..dc7a431 Binary files /dev/null and b/mods/default/textures/default_clay_brick.png differ diff --git a/mods/default/textures/default_clay_lump.png b/mods/default/textures/default_clay_lump.png new file mode 100644 index 0000000..c1d0220 Binary files /dev/null and b/mods/default/textures/default_clay_lump.png differ diff --git a/mods/default/textures/default_cloud.png b/mods/default/textures/default_cloud.png new file mode 100644 index 0000000..faf0ec1 Binary files /dev/null and b/mods/default/textures/default_cloud.png differ diff --git a/mods/default/textures/default_coal_block.png b/mods/default/textures/default_coal_block.png new file mode 100644 index 0000000..6fe9ed9 Binary files /dev/null and b/mods/default/textures/default_coal_block.png differ diff --git a/mods/default/textures/default_coal_lump.png b/mods/default/textures/default_coal_lump.png new file mode 100644 index 0000000..792961d Binary files /dev/null and b/mods/default/textures/default_coal_lump.png differ diff --git a/mods/default/textures/default_cobble.png b/mods/default/textures/default_cobble.png new file mode 100644 index 0000000..d379840 Binary files /dev/null and b/mods/default/textures/default_cobble.png differ diff --git a/mods/default/textures/default_copper_block.png b/mods/default/textures/default_copper_block.png new file mode 100644 index 0000000..8533754 Binary files /dev/null and b/mods/default/textures/default_copper_block.png differ diff --git a/mods/default/textures/default_copper_ingot.png b/mods/default/textures/default_copper_ingot.png new file mode 100644 index 0000000..bcad9c0 Binary files /dev/null and b/mods/default/textures/default_copper_ingot.png differ diff --git a/mods/default/textures/default_copper_lump.png b/mods/default/textures/default_copper_lump.png new file mode 100644 index 0000000..998c592 Binary files /dev/null and b/mods/default/textures/default_copper_lump.png differ diff --git a/mods/default/textures/default_coral_brown.png b/mods/default/textures/default_coral_brown.png new file mode 100644 index 0000000..8a775fe Binary files /dev/null and b/mods/default/textures/default_coral_brown.png differ diff --git a/mods/default/textures/default_coral_orange.png b/mods/default/textures/default_coral_orange.png new file mode 100644 index 0000000..cefac62 Binary files /dev/null and b/mods/default/textures/default_coral_orange.png differ diff --git a/mods/default/textures/default_coral_skeleton.png b/mods/default/textures/default_coral_skeleton.png new file mode 100644 index 0000000..fa48f15 Binary files /dev/null and b/mods/default/textures/default_coral_skeleton.png differ diff --git a/mods/default/textures/default_desert_cobble.png b/mods/default/textures/default_desert_cobble.png new file mode 100644 index 0000000..184a9d8 Binary files /dev/null and b/mods/default/textures/default_desert_cobble.png differ diff --git a/mods/default/textures/default_desert_sand.png b/mods/default/textures/default_desert_sand.png new file mode 100644 index 0000000..371b8c7 Binary files /dev/null and b/mods/default/textures/default_desert_sand.png differ diff --git a/mods/default/textures/default_desert_sandstone.png b/mods/default/textures/default_desert_sandstone.png new file mode 100644 index 0000000..52e445f Binary files /dev/null and b/mods/default/textures/default_desert_sandstone.png differ diff --git a/mods/default/textures/default_desert_sandstone_block.png b/mods/default/textures/default_desert_sandstone_block.png new file mode 100644 index 0000000..8fc54e7 Binary files /dev/null and b/mods/default/textures/default_desert_sandstone_block.png differ diff --git a/mods/default/textures/default_desert_sandstone_brick.png b/mods/default/textures/default_desert_sandstone_brick.png new file mode 100644 index 0000000..ab58db5 Binary files /dev/null and b/mods/default/textures/default_desert_sandstone_brick.png differ diff --git a/mods/default/textures/default_desert_stone.png b/mods/default/textures/default_desert_stone.png new file mode 100644 index 0000000..5d3aded Binary files /dev/null and b/mods/default/textures/default_desert_stone.png differ diff --git a/mods/default/textures/default_desert_stone_block.png b/mods/default/textures/default_desert_stone_block.png new file mode 100644 index 0000000..9eb8e92 Binary files /dev/null and b/mods/default/textures/default_desert_stone_block.png differ diff --git a/mods/default/textures/default_desert_stone_brick.png b/mods/default/textures/default_desert_stone_brick.png new file mode 100644 index 0000000..a603d18 Binary files /dev/null and b/mods/default/textures/default_desert_stone_brick.png differ diff --git a/mods/default/textures/default_diamond.png b/mods/default/textures/default_diamond.png new file mode 100644 index 0000000..a8dac74 Binary files /dev/null and b/mods/default/textures/default_diamond.png differ diff --git a/mods/default/textures/default_diamond_block.png b/mods/default/textures/default_diamond_block.png new file mode 100644 index 0000000..20c33ed Binary files /dev/null and b/mods/default/textures/default_diamond_block.png differ diff --git a/mods/default/textures/default_dirt.png b/mods/default/textures/default_dirt.png new file mode 100644 index 0000000..ca7e4ae Binary files /dev/null and b/mods/default/textures/default_dirt.png differ diff --git a/mods/default/textures/default_dry_grass.png b/mods/default/textures/default_dry_grass.png new file mode 100644 index 0000000..03455c3 Binary files /dev/null and b/mods/default/textures/default_dry_grass.png differ diff --git a/mods/default/textures/default_dry_grass_1.png b/mods/default/textures/default_dry_grass_1.png new file mode 100644 index 0000000..5cf68a3 Binary files /dev/null and b/mods/default/textures/default_dry_grass_1.png differ diff --git a/mods/default/textures/default_dry_grass_2.png b/mods/default/textures/default_dry_grass_2.png new file mode 100644 index 0000000..c925ace Binary files /dev/null and b/mods/default/textures/default_dry_grass_2.png differ diff --git a/mods/default/textures/default_dry_grass_3.png b/mods/default/textures/default_dry_grass_3.png new file mode 100644 index 0000000..4e4d84e Binary files /dev/null and b/mods/default/textures/default_dry_grass_3.png differ diff --git a/mods/default/textures/default_dry_grass_4.png b/mods/default/textures/default_dry_grass_4.png new file mode 100644 index 0000000..d315849 Binary files /dev/null and b/mods/default/textures/default_dry_grass_4.png differ diff --git a/mods/default/textures/default_dry_grass_5.png b/mods/default/textures/default_dry_grass_5.png new file mode 100644 index 0000000..871d04c Binary files /dev/null and b/mods/default/textures/default_dry_grass_5.png differ diff --git a/mods/default/textures/default_dry_grass_side.png b/mods/default/textures/default_dry_grass_side.png new file mode 100644 index 0000000..ef375b7 Binary files /dev/null and b/mods/default/textures/default_dry_grass_side.png differ diff --git a/mods/default/textures/default_dry_shrub.png b/mods/default/textures/default_dry_shrub.png new file mode 100644 index 0000000..e8a7f27 Binary files /dev/null and b/mods/default/textures/default_dry_shrub.png differ diff --git a/mods/default/textures/default_fence_acacia_wood.png b/mods/default/textures/default_fence_acacia_wood.png new file mode 100644 index 0000000..3b973f3 Binary files /dev/null and b/mods/default/textures/default_fence_acacia_wood.png differ diff --git a/mods/default/textures/default_fence_aspen_wood.png b/mods/default/textures/default_fence_aspen_wood.png new file mode 100644 index 0000000..0a6558e Binary files /dev/null and b/mods/default/textures/default_fence_aspen_wood.png differ diff --git a/mods/default/textures/default_fence_junglewood.png b/mods/default/textures/default_fence_junglewood.png new file mode 100644 index 0000000..c390941 Binary files /dev/null and b/mods/default/textures/default_fence_junglewood.png differ diff --git a/mods/default/textures/default_fence_overlay.png b/mods/default/textures/default_fence_overlay.png new file mode 100644 index 0000000..718184c Binary files /dev/null and b/mods/default/textures/default_fence_overlay.png differ diff --git a/mods/default/textures/default_fence_pine_wood.png b/mods/default/textures/default_fence_pine_wood.png new file mode 100644 index 0000000..74609d9 Binary files /dev/null and b/mods/default/textures/default_fence_pine_wood.png differ diff --git a/mods/default/textures/default_fence_wood.png b/mods/default/textures/default_fence_wood.png new file mode 100644 index 0000000..1e76430 Binary files /dev/null and b/mods/default/textures/default_fence_wood.png differ diff --git a/mods/default/textures/default_flint.png b/mods/default/textures/default_flint.png new file mode 100644 index 0000000..226c740 Binary files /dev/null and b/mods/default/textures/default_flint.png differ diff --git a/mods/default/textures/default_footprint.png b/mods/default/textures/default_footprint.png new file mode 100644 index 0000000..41d9546 Binary files /dev/null and b/mods/default/textures/default_footprint.png differ diff --git a/mods/default/textures/default_furnace_bottom.png b/mods/default/textures/default_furnace_bottom.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_bottom.png differ diff --git a/mods/default/textures/default_furnace_fire_bg.png b/mods/default/textures/default_furnace_fire_bg.png new file mode 100644 index 0000000..126204a Binary files /dev/null and b/mods/default/textures/default_furnace_fire_bg.png differ diff --git a/mods/default/textures/default_furnace_fire_fg.png b/mods/default/textures/default_furnace_fire_fg.png new file mode 100644 index 0000000..63888f3 Binary files /dev/null and b/mods/default/textures/default_furnace_fire_fg.png differ diff --git a/mods/default/textures/default_furnace_front.png b/mods/default/textures/default_furnace_front.png new file mode 100644 index 0000000..8c1798e Binary files /dev/null and b/mods/default/textures/default_furnace_front.png differ diff --git a/mods/default/textures/default_furnace_front_active.png b/mods/default/textures/default_furnace_front_active.png new file mode 100644 index 0000000..ea43ed9 Binary files /dev/null and b/mods/default/textures/default_furnace_front_active.png differ diff --git a/mods/default/textures/default_furnace_side.png b/mods/default/textures/default_furnace_side.png new file mode 100644 index 0000000..33408cf Binary files /dev/null and b/mods/default/textures/default_furnace_side.png differ diff --git a/mods/default/textures/default_furnace_top.png b/mods/default/textures/default_furnace_top.png new file mode 100644 index 0000000..b79ed06 Binary files /dev/null and b/mods/default/textures/default_furnace_top.png differ diff --git a/mods/default/textures/default_glass.png b/mods/default/textures/default_glass.png new file mode 100644 index 0000000..da25402 Binary files /dev/null and b/mods/default/textures/default_glass.png differ diff --git a/mods/default/textures/default_glass_detail.png b/mods/default/textures/default_glass_detail.png new file mode 100644 index 0000000..d38dbb7 Binary files /dev/null and b/mods/default/textures/default_glass_detail.png differ diff --git a/mods/default/textures/default_gold_block.png b/mods/default/textures/default_gold_block.png new file mode 100644 index 0000000..170d50b Binary files /dev/null and b/mods/default/textures/default_gold_block.png differ diff --git a/mods/default/textures/default_gold_ingot.png b/mods/default/textures/default_gold_ingot.png new file mode 100644 index 0000000..ba66471 Binary files /dev/null and b/mods/default/textures/default_gold_ingot.png differ diff --git a/mods/default/textures/default_gold_lump.png b/mods/default/textures/default_gold_lump.png new file mode 100644 index 0000000..d5a1be7 Binary files /dev/null and b/mods/default/textures/default_gold_lump.png differ diff --git a/mods/default/textures/default_grass.png b/mods/default/textures/default_grass.png new file mode 100644 index 0000000..0181fab Binary files /dev/null and b/mods/default/textures/default_grass.png differ diff --git a/mods/default/textures/default_grass_1.png b/mods/default/textures/default_grass_1.png new file mode 100644 index 0000000..e9faa2c Binary files /dev/null and b/mods/default/textures/default_grass_1.png differ diff --git a/mods/default/textures/default_grass_2.png b/mods/default/textures/default_grass_2.png new file mode 100644 index 0000000..03729a0 Binary files /dev/null and b/mods/default/textures/default_grass_2.png differ diff --git a/mods/default/textures/default_grass_3.png b/mods/default/textures/default_grass_3.png new file mode 100644 index 0000000..92ca1b5 Binary files /dev/null and b/mods/default/textures/default_grass_3.png differ diff --git a/mods/default/textures/default_grass_4.png b/mods/default/textures/default_grass_4.png new file mode 100644 index 0000000..c782a33 Binary files /dev/null and b/mods/default/textures/default_grass_4.png differ diff --git a/mods/default/textures/default_grass_5.png b/mods/default/textures/default_grass_5.png new file mode 100644 index 0000000..b727e9c Binary files /dev/null and b/mods/default/textures/default_grass_5.png differ diff --git a/mods/default/textures/default_grass_side.png b/mods/default/textures/default_grass_side.png new file mode 100644 index 0000000..bfd538d Binary files /dev/null and b/mods/default/textures/default_grass_side.png differ diff --git a/mods/default/textures/default_gravel.png b/mods/default/textures/default_gravel.png new file mode 100644 index 0000000..8852d38 Binary files /dev/null and b/mods/default/textures/default_gravel.png differ diff --git a/mods/default/textures/default_ice.png b/mods/default/textures/default_ice.png new file mode 100644 index 0000000..2874e1e Binary files /dev/null and b/mods/default/textures/default_ice.png differ diff --git a/mods/default/textures/default_iron_lump.png b/mods/default/textures/default_iron_lump.png new file mode 100644 index 0000000..db61a94 Binary files /dev/null and b/mods/default/textures/default_iron_lump.png differ diff --git a/mods/default/textures/default_item_smoke.png b/mods/default/textures/default_item_smoke.png new file mode 100644 index 0000000..d62fb3b Binary files /dev/null and b/mods/default/textures/default_item_smoke.png differ diff --git a/mods/default/textures/default_junglegrass.png b/mods/default/textures/default_junglegrass.png new file mode 100644 index 0000000..25abb71 Binary files /dev/null and b/mods/default/textures/default_junglegrass.png differ diff --git a/mods/default/textures/default_jungleleaves.png b/mods/default/textures/default_jungleleaves.png new file mode 100644 index 0000000..5afcc36 Binary files /dev/null and b/mods/default/textures/default_jungleleaves.png differ diff --git a/mods/default/textures/default_jungleleaves_simple.png b/mods/default/textures/default_jungleleaves_simple.png new file mode 100644 index 0000000..7165100 Binary files /dev/null and b/mods/default/textures/default_jungleleaves_simple.png differ diff --git a/mods/default/textures/default_junglesapling.png b/mods/default/textures/default_junglesapling.png new file mode 100644 index 0000000..05e1e50 Binary files /dev/null and b/mods/default/textures/default_junglesapling.png differ diff --git a/mods/default/textures/default_jungletree.png b/mods/default/textures/default_jungletree.png new file mode 100644 index 0000000..2cf77a6 Binary files /dev/null and b/mods/default/textures/default_jungletree.png differ diff --git a/mods/default/textures/default_jungletree_top.png b/mods/default/textures/default_jungletree_top.png new file mode 100644 index 0000000..439f078 Binary files /dev/null and b/mods/default/textures/default_jungletree_top.png differ diff --git a/mods/default/textures/default_junglewood.png b/mods/default/textures/default_junglewood.png new file mode 100644 index 0000000..8d17917 Binary files /dev/null and b/mods/default/textures/default_junglewood.png differ diff --git a/mods/default/textures/default_key.png b/mods/default/textures/default_key.png new file mode 100644 index 0000000..783d313 Binary files /dev/null and b/mods/default/textures/default_key.png differ diff --git a/mods/default/textures/default_key_skeleton.png b/mods/default/textures/default_key_skeleton.png new file mode 100644 index 0000000..2b3497d Binary files /dev/null and b/mods/default/textures/default_key_skeleton.png differ diff --git a/mods/default/textures/default_ladder_steel.png b/mods/default/textures/default_ladder_steel.png new file mode 100644 index 0000000..a312f3e Binary files /dev/null and b/mods/default/textures/default_ladder_steel.png differ diff --git a/mods/default/textures/default_ladder_wood.png b/mods/default/textures/default_ladder_wood.png new file mode 100644 index 0000000..c167fff Binary files /dev/null and b/mods/default/textures/default_ladder_wood.png differ diff --git a/mods/default/textures/default_lava.png b/mods/default/textures/default_lava.png new file mode 100644 index 0000000..e8958de Binary files /dev/null and b/mods/default/textures/default_lava.png differ diff --git a/mods/default/textures/default_lava_flowing_animated.png b/mods/default/textures/default_lava_flowing_animated.png new file mode 100644 index 0000000..2ec0746 Binary files /dev/null and b/mods/default/textures/default_lava_flowing_animated.png differ diff --git a/mods/default/textures/default_lava_source_animated.png b/mods/default/textures/default_lava_source_animated.png new file mode 100644 index 0000000..32267a6 Binary files /dev/null and b/mods/default/textures/default_lava_source_animated.png differ diff --git a/mods/default/textures/default_leaves.png b/mods/default/textures/default_leaves.png new file mode 100644 index 0000000..ba09fe1 Binary files /dev/null and b/mods/default/textures/default_leaves.png differ diff --git a/mods/default/textures/default_leaves_simple.png b/mods/default/textures/default_leaves_simple.png new file mode 100644 index 0000000..eb60f9f Binary files /dev/null and b/mods/default/textures/default_leaves_simple.png differ diff --git a/mods/default/textures/default_mese_block.png b/mods/default/textures/default_mese_block.png new file mode 100644 index 0000000..e30994e Binary files /dev/null and b/mods/default/textures/default_mese_block.png differ diff --git a/mods/default/textures/default_mese_crystal.png b/mods/default/textures/default_mese_crystal.png new file mode 100644 index 0000000..f1d71f1 Binary files /dev/null and b/mods/default/textures/default_mese_crystal.png differ diff --git a/mods/default/textures/default_mese_crystal_fragment.png b/mods/default/textures/default_mese_crystal_fragment.png new file mode 100644 index 0000000..d5416ab Binary files /dev/null and b/mods/default/textures/default_mese_crystal_fragment.png differ diff --git a/mods/default/textures/default_mese_post_light_side.png b/mods/default/textures/default_mese_post_light_side.png new file mode 100644 index 0000000..c23b551 Binary files /dev/null and b/mods/default/textures/default_mese_post_light_side.png differ diff --git a/mods/default/textures/default_mese_post_light_side_dark.png b/mods/default/textures/default_mese_post_light_side_dark.png new file mode 100644 index 0000000..c4fc7ce Binary files /dev/null and b/mods/default/textures/default_mese_post_light_side_dark.png differ diff --git a/mods/default/textures/default_mese_post_light_top.png b/mods/default/textures/default_mese_post_light_top.png new file mode 100644 index 0000000..6834bd3 Binary files /dev/null and b/mods/default/textures/default_mese_post_light_top.png differ diff --git a/mods/default/textures/default_meselamp.png b/mods/default/textures/default_meselamp.png new file mode 100644 index 0000000..0c3a1a1 Binary files /dev/null and b/mods/default/textures/default_meselamp.png differ diff --git a/mods/default/textures/default_mineral_coal.png b/mods/default/textures/default_mineral_coal.png new file mode 100644 index 0000000..6d1386b Binary files /dev/null and b/mods/default/textures/default_mineral_coal.png differ diff --git a/mods/default/textures/default_mineral_copper.png b/mods/default/textures/default_mineral_copper.png new file mode 100644 index 0000000..c4c518e Binary files /dev/null and b/mods/default/textures/default_mineral_copper.png differ diff --git a/mods/default/textures/default_mineral_diamond.png b/mods/default/textures/default_mineral_diamond.png new file mode 100644 index 0000000..39c0f83 Binary files /dev/null and b/mods/default/textures/default_mineral_diamond.png differ diff --git a/mods/default/textures/default_mineral_gold.png b/mods/default/textures/default_mineral_gold.png new file mode 100644 index 0000000..2220add Binary files /dev/null and b/mods/default/textures/default_mineral_gold.png differ diff --git a/mods/default/textures/default_mineral_iron.png b/mods/default/textures/default_mineral_iron.png new file mode 100644 index 0000000..bfec8b1 Binary files /dev/null and b/mods/default/textures/default_mineral_iron.png differ diff --git a/mods/default/textures/default_mineral_mese.png b/mods/default/textures/default_mineral_mese.png new file mode 100644 index 0000000..6952670 Binary files /dev/null and b/mods/default/textures/default_mineral_mese.png differ diff --git a/mods/default/textures/default_mineral_tin.png b/mods/default/textures/default_mineral_tin.png new file mode 100644 index 0000000..232d4b5 Binary files /dev/null and b/mods/default/textures/default_mineral_tin.png differ diff --git a/mods/default/textures/default_mossycobble.png b/mods/default/textures/default_mossycobble.png new file mode 100644 index 0000000..1ae7c91 Binary files /dev/null and b/mods/default/textures/default_mossycobble.png differ diff --git a/mods/default/textures/default_obsidian.png b/mods/default/textures/default_obsidian.png new file mode 100644 index 0000000..8f4a49c Binary files /dev/null and b/mods/default/textures/default_obsidian.png differ diff --git a/mods/default/textures/default_obsidian_block.png b/mods/default/textures/default_obsidian_block.png new file mode 100644 index 0000000..7e1d4d3 Binary files /dev/null and b/mods/default/textures/default_obsidian_block.png differ diff --git a/mods/default/textures/default_obsidian_brick.png b/mods/default/textures/default_obsidian_brick.png new file mode 100644 index 0000000..30c67ca Binary files /dev/null and b/mods/default/textures/default_obsidian_brick.png differ diff --git a/mods/default/textures/default_obsidian_glass.png b/mods/default/textures/default_obsidian_glass.png new file mode 100644 index 0000000..d5ac83d Binary files /dev/null and b/mods/default/textures/default_obsidian_glass.png differ diff --git a/mods/default/textures/default_obsidian_glass_detail.png b/mods/default/textures/default_obsidian_glass_detail.png new file mode 100644 index 0000000..a8bbec9 Binary files /dev/null and b/mods/default/textures/default_obsidian_glass_detail.png differ diff --git a/mods/default/textures/default_obsidian_shard.png b/mods/default/textures/default_obsidian_shard.png new file mode 100644 index 0000000..a988d8c Binary files /dev/null and b/mods/default/textures/default_obsidian_shard.png differ diff --git a/mods/default/textures/default_paper.png b/mods/default/textures/default_paper.png new file mode 100644 index 0000000..8f23924 Binary files /dev/null and b/mods/default/textures/default_paper.png differ diff --git a/mods/default/textures/default_papyrus.png b/mods/default/textures/default_papyrus.png new file mode 100644 index 0000000..a85e809 Binary files /dev/null and b/mods/default/textures/default_papyrus.png differ diff --git a/mods/default/textures/default_pine_needles.png b/mods/default/textures/default_pine_needles.png new file mode 100644 index 0000000..ad7373b Binary files /dev/null and b/mods/default/textures/default_pine_needles.png differ diff --git a/mods/default/textures/default_pine_sapling.png b/mods/default/textures/default_pine_sapling.png new file mode 100644 index 0000000..c30131d Binary files /dev/null and b/mods/default/textures/default_pine_sapling.png differ diff --git a/mods/default/textures/default_pine_tree.png b/mods/default/textures/default_pine_tree.png new file mode 100644 index 0000000..4a5328f Binary files /dev/null and b/mods/default/textures/default_pine_tree.png differ diff --git a/mods/default/textures/default_pine_tree_top.png b/mods/default/textures/default_pine_tree_top.png new file mode 100644 index 0000000..8705710 Binary files /dev/null and b/mods/default/textures/default_pine_tree_top.png differ diff --git a/mods/default/textures/default_pine_wood.png b/mods/default/textures/default_pine_wood.png new file mode 100644 index 0000000..6844ceb Binary files /dev/null and b/mods/default/textures/default_pine_wood.png differ diff --git a/mods/default/textures/default_rainforest_litter.png b/mods/default/textures/default_rainforest_litter.png new file mode 100644 index 0000000..d762deb Binary files /dev/null and b/mods/default/textures/default_rainforest_litter.png differ diff --git a/mods/default/textures/default_rainforest_litter_side.png b/mods/default/textures/default_rainforest_litter_side.png new file mode 100644 index 0000000..7ccb11d Binary files /dev/null and b/mods/default/textures/default_rainforest_litter_side.png differ diff --git a/mods/default/textures/default_river_water.png b/mods/default/textures/default_river_water.png new file mode 100644 index 0000000..3b55c5f Binary files /dev/null and b/mods/default/textures/default_river_water.png differ diff --git a/mods/default/textures/default_river_water_flowing_animated.png b/mods/default/textures/default_river_water_flowing_animated.png new file mode 100644 index 0000000..536acc5 Binary files /dev/null and b/mods/default/textures/default_river_water_flowing_animated.png differ diff --git a/mods/default/textures/default_river_water_source_animated.png b/mods/default/textures/default_river_water_source_animated.png new file mode 100644 index 0000000..daa5653 Binary files /dev/null and b/mods/default/textures/default_river_water_source_animated.png differ diff --git a/mods/default/textures/default_sand.png b/mods/default/textures/default_sand.png new file mode 100644 index 0000000..645a300 Binary files /dev/null and b/mods/default/textures/default_sand.png differ diff --git a/mods/default/textures/default_sandstone.png b/mods/default/textures/default_sandstone.png new file mode 100644 index 0000000..16e3d13 Binary files /dev/null and b/mods/default/textures/default_sandstone.png differ diff --git a/mods/default/textures/default_sandstone_block.png b/mods/default/textures/default_sandstone_block.png new file mode 100644 index 0000000..2e06491 Binary files /dev/null and b/mods/default/textures/default_sandstone_block.png differ diff --git a/mods/default/textures/default_sandstone_brick.png b/mods/default/textures/default_sandstone_brick.png new file mode 100644 index 0000000..e7150e5 Binary files /dev/null and b/mods/default/textures/default_sandstone_brick.png differ diff --git a/mods/default/textures/default_sapling.png b/mods/default/textures/default_sapling.png new file mode 100644 index 0000000..3fd64f0 Binary files /dev/null and b/mods/default/textures/default_sapling.png differ diff --git a/mods/default/textures/default_sign_steel.png b/mods/default/textures/default_sign_steel.png new file mode 100644 index 0000000..3ca0c59 Binary files /dev/null and b/mods/default/textures/default_sign_steel.png differ diff --git a/mods/default/textures/default_sign_wall_steel.png b/mods/default/textures/default_sign_wall_steel.png new file mode 100644 index 0000000..2227477 Binary files /dev/null and b/mods/default/textures/default_sign_wall_steel.png differ diff --git a/mods/default/textures/default_sign_wall_wood.png b/mods/default/textures/default_sign_wall_wood.png new file mode 100644 index 0000000..40552c7 Binary files /dev/null and b/mods/default/textures/default_sign_wall_wood.png differ diff --git a/mods/default/textures/default_sign_wood.png b/mods/default/textures/default_sign_wood.png new file mode 100644 index 0000000..d0559da Binary files /dev/null and b/mods/default/textures/default_sign_wood.png differ diff --git a/mods/default/textures/default_silver_sand.png b/mods/default/textures/default_silver_sand.png new file mode 100644 index 0000000..c4a8f73 Binary files /dev/null and b/mods/default/textures/default_silver_sand.png differ diff --git a/mods/default/textures/default_silver_sandstone.png b/mods/default/textures/default_silver_sandstone.png new file mode 100644 index 0000000..eac62cb Binary files /dev/null and b/mods/default/textures/default_silver_sandstone.png differ diff --git a/mods/default/textures/default_silver_sandstone_block.png b/mods/default/textures/default_silver_sandstone_block.png new file mode 100644 index 0000000..9997461 Binary files /dev/null and b/mods/default/textures/default_silver_sandstone_block.png differ diff --git a/mods/default/textures/default_silver_sandstone_brick.png b/mods/default/textures/default_silver_sandstone_brick.png new file mode 100644 index 0000000..93d87a5 Binary files /dev/null and b/mods/default/textures/default_silver_sandstone_brick.png differ diff --git a/mods/default/textures/default_snow.png b/mods/default/textures/default_snow.png new file mode 100644 index 0000000..fcbef0e Binary files /dev/null and b/mods/default/textures/default_snow.png differ diff --git a/mods/default/textures/default_snow_side.png b/mods/default/textures/default_snow_side.png new file mode 100644 index 0000000..03456c8 Binary files /dev/null and b/mods/default/textures/default_snow_side.png differ diff --git a/mods/default/textures/default_snowball.png b/mods/default/textures/default_snowball.png new file mode 100644 index 0000000..3a4dc1f Binary files /dev/null and b/mods/default/textures/default_snowball.png differ diff --git a/mods/default/textures/default_steel_block.png b/mods/default/textures/default_steel_block.png new file mode 100644 index 0000000..7f49f61 Binary files /dev/null and b/mods/default/textures/default_steel_block.png differ diff --git a/mods/default/textures/default_steel_ingot.png b/mods/default/textures/default_steel_ingot.png new file mode 100644 index 0000000..8100b01 Binary files /dev/null and b/mods/default/textures/default_steel_ingot.png differ diff --git a/mods/default/textures/default_stick.png b/mods/default/textures/default_stick.png new file mode 100644 index 0000000..0378d07 Binary files /dev/null and b/mods/default/textures/default_stick.png differ diff --git a/mods/default/textures/default_stone.png b/mods/default/textures/default_stone.png new file mode 100644 index 0000000..63cb7c4 Binary files /dev/null and b/mods/default/textures/default_stone.png differ diff --git a/mods/default/textures/default_stone_block.png b/mods/default/textures/default_stone_block.png new file mode 100644 index 0000000..3b771e7 Binary files /dev/null and b/mods/default/textures/default_stone_block.png differ diff --git a/mods/default/textures/default_stone_brick.png b/mods/default/textures/default_stone_brick.png new file mode 100644 index 0000000..4dbb49d Binary files /dev/null and b/mods/default/textures/default_stone_brick.png differ diff --git a/mods/default/textures/default_tin_block.png b/mods/default/textures/default_tin_block.png new file mode 100644 index 0000000..72759b0 Binary files /dev/null and b/mods/default/textures/default_tin_block.png differ diff --git a/mods/default/textures/default_tin_ingot.png b/mods/default/textures/default_tin_ingot.png new file mode 100644 index 0000000..eed5361 Binary files /dev/null and b/mods/default/textures/default_tin_ingot.png differ diff --git a/mods/default/textures/default_tin_lump.png b/mods/default/textures/default_tin_lump.png new file mode 100644 index 0000000..72bd339 Binary files /dev/null and b/mods/default/textures/default_tin_lump.png differ diff --git a/mods/default/textures/default_tool_bronzeaxe.png b/mods/default/textures/default_tool_bronzeaxe.png new file mode 100644 index 0000000..8ae43b5 Binary files /dev/null and b/mods/default/textures/default_tool_bronzeaxe.png differ diff --git a/mods/default/textures/default_tool_bronzepick.png b/mods/default/textures/default_tool_bronzepick.png new file mode 100644 index 0000000..c88a5f0 Binary files /dev/null and b/mods/default/textures/default_tool_bronzepick.png differ diff --git a/mods/default/textures/default_tool_bronzeshovel.png b/mods/default/textures/default_tool_bronzeshovel.png new file mode 100644 index 0000000..d7d800e Binary files /dev/null and b/mods/default/textures/default_tool_bronzeshovel.png differ diff --git a/mods/default/textures/default_tool_bronzesword.png b/mods/default/textures/default_tool_bronzesword.png new file mode 100644 index 0000000..cdab898 Binary files /dev/null and b/mods/default/textures/default_tool_bronzesword.png differ diff --git a/mods/default/textures/default_tool_diamondaxe.png b/mods/default/textures/default_tool_diamondaxe.png new file mode 100644 index 0000000..e32a0bf Binary files /dev/null and b/mods/default/textures/default_tool_diamondaxe.png differ diff --git a/mods/default/textures/default_tool_diamondpick.png b/mods/default/textures/default_tool_diamondpick.png new file mode 100644 index 0000000..f9883c6 Binary files /dev/null and b/mods/default/textures/default_tool_diamondpick.png differ diff --git a/mods/default/textures/default_tool_diamondshovel.png b/mods/default/textures/default_tool_diamondshovel.png new file mode 100644 index 0000000..d0fe24d Binary files /dev/null and b/mods/default/textures/default_tool_diamondshovel.png differ diff --git a/mods/default/textures/default_tool_diamondsword.png b/mods/default/textures/default_tool_diamondsword.png new file mode 100644 index 0000000..dbccd0e Binary files /dev/null and b/mods/default/textures/default_tool_diamondsword.png differ diff --git a/mods/default/textures/default_tool_meseaxe.png b/mods/default/textures/default_tool_meseaxe.png new file mode 100644 index 0000000..c01fb4f Binary files /dev/null and b/mods/default/textures/default_tool_meseaxe.png differ diff --git a/mods/default/textures/default_tool_mesepick.png b/mods/default/textures/default_tool_mesepick.png new file mode 100644 index 0000000..1b2e25b Binary files /dev/null and b/mods/default/textures/default_tool_mesepick.png differ diff --git a/mods/default/textures/default_tool_meseshovel.png b/mods/default/textures/default_tool_meseshovel.png new file mode 100644 index 0000000..00813a2 Binary files /dev/null and b/mods/default/textures/default_tool_meseshovel.png differ diff --git a/mods/default/textures/default_tool_mesesword.png b/mods/default/textures/default_tool_mesesword.png new file mode 100644 index 0000000..d395d3a Binary files /dev/null and b/mods/default/textures/default_tool_mesesword.png differ diff --git a/mods/default/textures/default_tool_steelaxe.png b/mods/default/textures/default_tool_steelaxe.png new file mode 100644 index 0000000..1528cad Binary files /dev/null and b/mods/default/textures/default_tool_steelaxe.png differ diff --git a/mods/default/textures/default_tool_steelpick.png b/mods/default/textures/default_tool_steelpick.png new file mode 100644 index 0000000..a7543a1 Binary files /dev/null and b/mods/default/textures/default_tool_steelpick.png differ diff --git a/mods/default/textures/default_tool_steelshovel.png b/mods/default/textures/default_tool_steelshovel.png new file mode 100644 index 0000000..65e4045 Binary files /dev/null and b/mods/default/textures/default_tool_steelshovel.png differ diff --git a/mods/default/textures/default_tool_steelsword.png b/mods/default/textures/default_tool_steelsword.png new file mode 100644 index 0000000..630a339 Binary files /dev/null and b/mods/default/textures/default_tool_steelsword.png differ diff --git a/mods/default/textures/default_tool_stoneaxe.png b/mods/default/textures/default_tool_stoneaxe.png new file mode 100644 index 0000000..cc36054 Binary files /dev/null and b/mods/default/textures/default_tool_stoneaxe.png differ diff --git a/mods/default/textures/default_tool_stonepick.png b/mods/default/textures/default_tool_stonepick.png new file mode 100644 index 0000000..237d739 Binary files /dev/null and b/mods/default/textures/default_tool_stonepick.png differ diff --git a/mods/default/textures/default_tool_stoneshovel.png b/mods/default/textures/default_tool_stoneshovel.png new file mode 100644 index 0000000..11711bd Binary files /dev/null and b/mods/default/textures/default_tool_stoneshovel.png differ diff --git a/mods/default/textures/default_tool_stonesword.png b/mods/default/textures/default_tool_stonesword.png new file mode 100644 index 0000000..1a493ac Binary files /dev/null and b/mods/default/textures/default_tool_stonesword.png differ diff --git a/mods/default/textures/default_tool_woodaxe.png b/mods/default/textures/default_tool_woodaxe.png new file mode 100644 index 0000000..68f1fd8 Binary files /dev/null and b/mods/default/textures/default_tool_woodaxe.png differ diff --git a/mods/default/textures/default_tool_woodpick.png b/mods/default/textures/default_tool_woodpick.png new file mode 100644 index 0000000..0aed583 Binary files /dev/null and b/mods/default/textures/default_tool_woodpick.png differ diff --git a/mods/default/textures/default_tool_woodshovel.png b/mods/default/textures/default_tool_woodshovel.png new file mode 100644 index 0000000..dcef2b5 Binary files /dev/null and b/mods/default/textures/default_tool_woodshovel.png differ diff --git a/mods/default/textures/default_tool_woodsword.png b/mods/default/textures/default_tool_woodsword.png new file mode 100644 index 0000000..c78ba50 Binary files /dev/null and b/mods/default/textures/default_tool_woodsword.png differ diff --git a/mods/default/textures/default_torch_animated.png b/mods/default/textures/default_torch_animated.png new file mode 100644 index 0000000..cdf33ef Binary files /dev/null and b/mods/default/textures/default_torch_animated.png differ diff --git a/mods/default/textures/default_torch_on_ceiling_animated.png b/mods/default/textures/default_torch_on_ceiling_animated.png new file mode 100644 index 0000000..3a8b5ad Binary files /dev/null and b/mods/default/textures/default_torch_on_ceiling_animated.png differ diff --git a/mods/default/textures/default_torch_on_floor.png b/mods/default/textures/default_torch_on_floor.png new file mode 100644 index 0000000..bc4bdd6 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor.png differ diff --git a/mods/default/textures/default_torch_on_floor_animated.png b/mods/default/textures/default_torch_on_floor_animated.png new file mode 100644 index 0000000..ad51c03 Binary files /dev/null and b/mods/default/textures/default_torch_on_floor_animated.png differ diff --git a/mods/default/textures/default_tree.png b/mods/default/textures/default_tree.png new file mode 100644 index 0000000..10e297b Binary files /dev/null and b/mods/default/textures/default_tree.png differ diff --git a/mods/default/textures/default_tree_top.png b/mods/default/textures/default_tree_top.png new file mode 100644 index 0000000..da99bce Binary files /dev/null and b/mods/default/textures/default_tree_top.png differ diff --git a/mods/default/textures/default_water.png b/mods/default/textures/default_water.png new file mode 100644 index 0000000..00500e9 Binary files /dev/null and b/mods/default/textures/default_water.png differ diff --git a/mods/default/textures/default_water_flowing_animated.png b/mods/default/textures/default_water_flowing_animated.png new file mode 100644 index 0000000..070d797 Binary files /dev/null and b/mods/default/textures/default_water_flowing_animated.png differ diff --git a/mods/default/textures/default_water_source_animated.png b/mods/default/textures/default_water_source_animated.png new file mode 100644 index 0000000..7e7f9ff Binary files /dev/null and b/mods/default/textures/default_water_source_animated.png differ diff --git a/mods/default/textures/default_wood.png b/mods/default/textures/default_wood.png new file mode 100644 index 0000000..af56d6c Binary files /dev/null and b/mods/default/textures/default_wood.png differ diff --git a/mods/default/textures/gui_formbg.png b/mods/default/textures/gui_formbg.png new file mode 100644 index 0000000..c543466 Binary files /dev/null and b/mods/default/textures/gui_formbg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_bg.png b/mods/default/textures/gui_furnace_arrow_bg.png new file mode 100644 index 0000000..046d8cd Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_bg.png differ diff --git a/mods/default/textures/gui_furnace_arrow_fg.png b/mods/default/textures/gui_furnace_arrow_fg.png new file mode 100644 index 0000000..8d3c396 Binary files /dev/null and b/mods/default/textures/gui_furnace_arrow_fg.png differ diff --git a/mods/default/textures/gui_hb_bg.png b/mods/default/textures/gui_hb_bg.png new file mode 100644 index 0000000..99248e1 Binary files /dev/null and b/mods/default/textures/gui_hb_bg.png differ diff --git a/mods/default/textures/gui_hotbar.png b/mods/default/textures/gui_hotbar.png new file mode 100644 index 0000000..73fb3ca Binary files /dev/null and b/mods/default/textures/gui_hotbar.png differ diff --git a/mods/default/textures/gui_hotbar_selected.png b/mods/default/textures/gui_hotbar_selected.png new file mode 100644 index 0000000..40bafe6 Binary files /dev/null and b/mods/default/textures/gui_hotbar_selected.png differ diff --git a/mods/default/textures/heart.png b/mods/default/textures/heart.png new file mode 100644 index 0000000..6d4e228 Binary files /dev/null and b/mods/default/textures/heart.png differ diff --git a/mods/default/textures/player.png b/mods/default/textures/player.png new file mode 100644 index 0000000..6d61c43 Binary files /dev/null and b/mods/default/textures/player.png differ diff --git a/mods/default/textures/player_back.png b/mods/default/textures/player_back.png new file mode 100644 index 0000000..5e9ef05 Binary files /dev/null and b/mods/default/textures/player_back.png differ diff --git a/mods/default/textures/wieldhand.png b/mods/default/textures/wieldhand.png new file mode 100644 index 0000000..69f4b7b Binary files /dev/null and b/mods/default/textures/wieldhand.png differ diff --git a/mods/default/tools.lua b/mods/default/tools.lua new file mode 100644 index 0000000..45c779f --- /dev/null +++ b/mods/default/tools.lua @@ -0,0 +1,419 @@ +-- mods/default/tools.lua + +-- The hand +minetest.register_item(":", { + type = "none", + wield_image = "wieldhand.png", + wield_scale = {x=1,y=1,z=2.5}, + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level = 0, + groupcaps = { + crumbly = {times={[2]=3.00, [3]=0.70}, uses=0, maxlevel=1}, + snappy = {times={[3]=0.40}, uses=0, maxlevel=1}, + oddly_breakable_by_hand = {times={[1]=3.50,[2]=2.00,[3]=0.70}, uses=0} + }, + damage_groups = {fleshy=1}, + } +}) + +-- +-- Picks +-- + +minetest.register_tool("default:pick_wood", { + description = "Wooden Pickaxe", + inventory_image = "default_tool_woodpick.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + cracky = {times={[3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_stone", { + description = "Stone Pickaxe", + inventory_image = "default_tool_stonepick.png", + tool_capabilities = { + full_punch_interval = 1.3, + max_drop_level=0, + groupcaps={ + cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_steel", { + description = "Steel Pickaxe", + inventory_image = "default_tool_steelpick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_bronze", { + description = "Bronze Pickaxe", + inventory_image = "default_tool_bronzepick.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_mese", { + description = "Mese Pickaxe", + inventory_image = "default_tool_mesepick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:pick_diamond", { + description = "Diamond Pickaxe", + inventory_image = "default_tool_diamondpick.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=3, + groupcaps={ + cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=5}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Shovels +-- + +minetest.register_tool("default:shovel_wood", { + description = "Wooden Shovel", + inventory_image = "default_tool_woodshovel.png", + wield_image = "default_tool_woodshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_stone", { + description = "Stone Shovel", + inventory_image = "default_tool_stoneshovel.png", + wield_image = "default_tool_stoneshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.4, + max_drop_level=0, + groupcaps={ + crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_steel", { + description = "Steel Shovel", + inventory_image = "default_tool_steelshovel.png", + wield_image = "default_tool_steelshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_bronze", { + description = "Bronze Shovel", + inventory_image = "default_tool_bronzeshovel.png", + wield_image = "default_tool_bronzeshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.1, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_mese", { + description = "Mese Shovel", + inventory_image = "default_tool_meseshovel.png", + wield_image = "default_tool_meseshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=3, + groupcaps={ + crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:shovel_diamond", { + description = "Diamond Shovel", + inventory_image = "default_tool_diamondshovel.png", + wield_image = "default_tool_diamondshovel.png^[transformR90", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Axes +-- + +minetest.register_tool("default:axe_wood", { + description = "Wooden Axe", + inventory_image = "default_tool_woodaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=0, + groupcaps={ + choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_stone", { + description = "Stone Axe", + inventory_image = "default_tool_stoneaxe.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + choppy={times={[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=3}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_steel", { + description = "Steel Axe", + inventory_image = "default_tool_steelaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_bronze", { + description = "Bronze Axe", + inventory_image = "default_tool_bronzeaxe.png", + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_mese", { + description = "Mese Axe", + inventory_image = "default_tool_meseaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:axe_diamond", { + description = "Diamond Axe", + inventory_image = "default_tool_diamondaxe.png", + tool_capabilities = { + full_punch_interval = 0.9, + max_drop_level=1, + groupcaps={ + choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=7}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +-- +-- Swords +-- + +minetest.register_tool("default:sword_wood", { + description = "Wooden Sword", + inventory_image = "default_tool_woodsword.png", + tool_capabilities = { + full_punch_interval = 1, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1}, + }, + damage_groups = {fleshy=2}, + }, + groups = {flammable = 2}, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_stone", { + description = "Stone Sword", + inventory_image = "default_tool_stonesword.png", + tool_capabilities = { + full_punch_interval = 1.2, + max_drop_level=0, + groupcaps={ + snappy={times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1}, + }, + damage_groups = {fleshy=4}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_steel", { + description = "Steel Sword", + inventory_image = "default_tool_steelsword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_bronze", { + description = "Bronze Sword", + inventory_image = "default_tool_bronzesword.png", + tool_capabilities = { + full_punch_interval = 0.8, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2}, + }, + damage_groups = {fleshy=6}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_mese", { + description = "Mese Sword", + inventory_image = "default_tool_mesesword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3}, + }, + damage_groups = {fleshy=7}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:sword_diamond", { + description = "Diamond Sword", + inventory_image = "default_tool_diamondsword.png", + tool_capabilities = { + full_punch_interval = 0.7, + max_drop_level=1, + groupcaps={ + snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, + }, + damage_groups = {fleshy=8}, + }, + sound = {breaks = "default_tool_breaks"}, +}) + +minetest.register_tool("default:key", { + description = "Key", + inventory_image = "default_key.png", + groups = {key = 1, not_in_creative_inventory = 1}, + stack_max = 1, + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + if pointed_thing.type ~= "node" then + return itemstack + end + + local pos = pointed_thing.under + node = minetest.get_node(pos) + + if not node or node.name == "ignore" then + return itemstack + end + + local ndef = minetest.registered_nodes[node.name] + if not ndef then + return itemstack + end + + local on_key_use = ndef.on_key_use + if on_key_use then + on_key_use(pos, placer) + end + + return nil + end +}) diff --git a/mods/default/torch.lua b/mods/default/torch.lua new file mode 100644 index 0000000..3c3ae96 --- /dev/null +++ b/mods/default/torch.lua @@ -0,0 +1,146 @@ + +--[[ + +Torch mod - formerly mod "Torches" +====================== + +(c) Copyright BlockMen (2013-2015) +(C) Copyright sofar (2016) + +This mod changes the default torch drawtype from "torchlike" to "mesh", +giving the torch a three dimensional appearance. The mesh contains the +proper pixel mapping to make the animation appear as a particle above +the torch, while in fact the animation is just the texture of the mesh. + + +License: +~~~~~~~~ +(c) Copyright BlockMen (2013-2015) + +Textures and Meshes/Models: +CC-BY 3.0 BlockMen +Note that the models were entirely done from scratch by sofar. + +Code: +Licensed under the GNU LGPL version 2.1 or higher. +You can redistribute it and/or modify it under +the terms of the GNU Lesser General Public License +as published by the Free Software Foundation; + +You should have received a copy of the GNU Lesser General Public +License along with this library; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt + +--]] + +minetest.register_node("default:torch", { + description = "Torch", + drawtype = "mesh", + mesh = "torch_floor.obj", + inventory_image = "default_torch_on_floor.png", + wield_image = "default_torch_on_floor.png", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + liquids_pointable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_bottom = {-1/8, -1/2, -1/8, 1/8, 2/16, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local def = minetest.registered_nodes[node.name] + if def and def.on_rightclick and + ((not placer) or (placer and not placer:get_player_control().sneak)) then + return def.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + local above = pointed_thing.above + local wdir = minetest.dir_to_wallmounted(vector.subtract(under, above)) + local fakestack = itemstack + if wdir == 0 then + fakestack:set_name("default:torch_ceiling") + elseif wdir == 1 then + fakestack:set_name("default:torch") + else + fakestack:set_name("default:torch_wall") + end + + itemstack = minetest.item_place(fakestack, placer, pointed_thing, wdir) + itemstack:set_name("default:torch") + + return itemstack + end +}) + +minetest.register_node("default:torch_wall", { + drawtype = "mesh", + mesh = "torch_wall.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_side = {-1/2, -1/2, -1/8, -1/8, 1/8, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_node("default:torch_ceiling", { + drawtype = "mesh", + mesh = "torch_ceiling.obj", + tiles = {{ + name = "default_torch_on_floor_animated.png", + animation = {type = "vertical_frames", aspect_w = 16, aspect_h = 16, length = 3.3} + }}, + paramtype = "light", + paramtype2 = "wallmounted", + sunlight_propagates = true, + walkable = false, + light_source = 12, + groups = {choppy=2, dig_immediate=3, flammable=1, not_in_creative_inventory=1, attached_node=1, torch=1}, + drop = "default:torch", + selection_box = { + type = "wallmounted", + wall_top = {-1/8, -1/16, -5/16, 1/8, 1/2, 1/8}, + }, + sounds = default.node_sound_wood_defaults(), +}) + +minetest.register_lbm({ + name = "default:3dtorch", + nodenames = {"default:torch", "torches:floor", "torches:wall"}, + action = function(pos, node) + if node.param2 == 0 then + minetest.set_node(pos, {name = "default:torch_ceiling", + param2 = node.param2}) + elseif node.param2 == 1 then + minetest.set_node(pos, {name = "default:torch", + param2 = node.param2}) + else + minetest.set_node(pos, {name = "default:torch_wall", + param2 = node.param2}) + end + end +}) diff --git a/mods/default/trees.lua b/mods/default/trees.lua new file mode 100644 index 0000000..81c9831 --- /dev/null +++ b/mods/default/trees.lua @@ -0,0 +1,535 @@ +local random = math.random + +-- +-- Grow trees from saplings +-- + +-- 'can grow' function + +function default.can_grow(pos) + local node_under = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) + if not node_under then + return false + end + local name_under = node_under.name + local is_soil = minetest.get_item_group(name_under, "soil") + if is_soil == 0 then + return false + end + local light_level = minetest.get_node_light(pos) + if not light_level or light_level < 13 then + return false + end + return true +end + + +-- 'is snow nearby' function + +local function is_snow_nearby(pos) + return minetest.find_node_near(pos, 1, {"group:snowy"}) +end + + +-- Sapling ABM + +function default.grow_sapling(pos) + if not default.can_grow(pos) then + -- try a bit later again + minetest.get_node_timer(pos):start(math.random(240, 600)) + return + end + + local mg_name = minetest.get_mapgen_setting("mg_name") + local node = minetest.get_node(pos) + if node.name == "default:sapling" then + minetest.log("action", "A sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + if mg_name == "v6" then + default.grow_tree(pos, random(1, 4) == 1) + else + default.grow_new_apple_tree(pos) + end + elseif node.name == "default:junglesapling" then + minetest.log("action", "A jungle sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + if mg_name == "v6" then + default.grow_jungle_tree(pos) + else + default.grow_new_jungle_tree(pos) + end + elseif node.name == "default:pine_sapling" then + minetest.log("action", "A pine sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + local snow = is_snow_nearby(pos) + if mg_name == "v6" then + default.grow_pine_tree(pos, snow) + elseif snow then + default.grow_new_snowy_pine_tree(pos) + else + default.grow_new_pine_tree(pos) + end + elseif node.name == "default:acacia_sapling" then + minetest.log("action", "An acacia sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_acacia_tree(pos) + elseif node.name == "default:aspen_sapling" then + minetest.log("action", "An aspen sapling grows into a tree at ".. + minetest.pos_to_string(pos)) + default.grow_new_aspen_tree(pos) + elseif node.name == "default:bush_sapling" then + minetest.log("action", "A bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_bush(pos) + elseif node.name == "default:acacia_bush_sapling" then + minetest.log("action", "An acacia bush sapling grows into a bush at ".. + minetest.pos_to_string(pos)) + default.grow_acacia_bush(pos) + end +end + +minetest.register_lbm({ + name = "default:convert_saplings_to_node_timer", + nodenames = {"default:sapling", "default:junglesapling", + "default:pine_sapling", "default:acacia_sapling", + "default:aspen_sapling"}, + action = function(pos) + minetest.get_node_timer(pos):start(math.random(1200, 2400)) + end +}) + +-- +-- Tree generation +-- + +-- Apple tree and jungle tree trunk and leaves function + +local function add_trunk_and_leaves(data, a, pos, tree_cid, leaves_cid, + height, size, iters, is_apple_tree) + local x, y, z = pos.x, pos.y, pos.z + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_apple = minetest.get_content_id("default:apple") + + -- Trunk + data[a:index(x, y, z)] = tree_cid -- Force-place lowest trunk node to replace sapling + for yy = y + 1, y + height - 1 do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == leaves_cid then + data[vi] = tree_cid + end + end + + -- Force leaves near the trunk + for z_dist = -1, 1 do + for y_dist = -size, 1 do + local vi = a:index(x - 1, y + height + y_dist, z + z_dist) + for x_dist = -1, 1 do + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + vi = vi + 1 + end + end + end + + -- Randomly add leaves in 2x2x2 clusters. + for i = 1, iters do + local clust_x = x + random(-size, size - 1) + local clust_y = y + height + random(-size, 0) + local clust_z = z + random(-size, size - 1) + + for xi = 0, 1 do + for yi = 0, 1 do + for zi = 0, 1 do + local vi = a:index(clust_x + xi, clust_y + yi, clust_z + zi) + if data[vi] == c_air or data[vi] == c_ignore then + if is_apple_tree and random(1, 8) == 1 then + data[vi] = c_apple + else + data[vi] = leaves_cid + end + end + end + end + end + end +end + + +-- Apple tree + +function default.grow_tree(pos, is_apple_tree, bad) + --[[ + NOTE: Tree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(4, 5) + local c_tree = minetest.get_content_id("default:tree") + local c_leaves = minetest.get_content_id("default:leaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 2, y = y, z = z - 2}, + {x = x + 2, y = y + height + 1, z = z + 2} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_tree, c_leaves, height, 2, 8, is_apple_tree) + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- Jungle tree + +function default.grow_jungle_tree(pos, bad) + --[[ + NOTE: Jungletree-placing code is currently duplicated in the engine + and in games that have saplings; both are deprecated but not + replaced yet + --]] + if bad then + error("Deprecated use of default.grow_jungle_tree") + end + + local x, y, z = pos.x, pos.y, pos.z + local height = random(8, 12) + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_jungletree = minetest.get_content_id("default:jungletree") + local c_jungleleaves = minetest.get_content_id("default:jungleleaves") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 3, y = y - 1, z = z - 3}, + {x = x + 3, y = y + height + 1, z = z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + add_trunk_and_leaves(data, a, pos, c_jungletree, c_jungleleaves, + height, 3, 30, false) + + -- Roots + for z_dist = -1, 1 do + local vi_1 = a:index(x - 1, y - 1, z + z_dist) + local vi_2 = a:index(x - 1, y, z + z_dist) + for x_dist = -1, 1 do + if random(1, 3) >= 2 then + if data[vi_1] == c_air or data[vi_1] == c_ignore then + data[vi_1] = c_jungletree + elseif data[vi_2] == c_air or data[vi_2] == c_ignore then + data[vi_2] = c_jungletree + end + end + vi_1 = vi_1 + 1 + vi_2 = vi_2 + 1 + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- Pine tree from mg mapgen mod, design by sfan5, pointy top added by paramat + +local function add_pine_needles(data, vi, c_air, c_ignore, c_snow, c_pine_needles) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or node_id == c_snow then + data[vi] = c_pine_needles + end +end + +local function add_snow(data, vi, c_air, c_ignore, c_snow) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore then + data[vi] = c_snow + end +end + +function default.grow_pine_tree(pos, snow) + local x, y, z = pos.x, pos.y, pos.z + local maxy = y + random(9, 13) -- Trunk top + + local c_air = minetest.get_content_id("air") + local c_ignore = minetest.get_content_id("ignore") + local c_pine_tree = minetest.get_content_id("default:pine_tree") + local c_pine_needles = minetest.get_content_id("default:pine_needles") + local c_snow = minetest.get_content_id("default:snow") + + local vm = minetest.get_voxel_manip() + local minp, maxp = vm:read_from_map( + {x = x - 3, y = y, z = z - 3}, + {x = x + 3, y = maxy + 3, z = z + 3} + ) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm:get_data() + + -- Upper branches layer + local dev = 3 + for yy = maxy - 1, maxy + 1 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Centre top nodes + add_pine_needles(data, a:index(x, maxy + 1, z), c_air, c_ignore, c_snow, + c_pine_needles) + add_pine_needles(data, a:index(x, maxy + 2, z), c_air, c_ignore, c_snow, + c_pine_needles) -- Paramat added a pointy top node + if snow then + add_snow(data, a:index(x, maxy + 3, z), c_air, c_ignore, c_snow) + end + + -- Lower branches layer + local my = 0 + for i = 1, 20 do -- Random 2x2 squares of needles + local xi = x + random(-3, 2) + local yy = maxy + random(-6, -5) + local zi = z + random(-3, 2) + if yy > my then + my = yy + end + for zz = zi, zi+1 do + local vi = a:index(xi, yy, zz) + local via = a:index(xi, yy + 1, zz) + for xx = xi, xi + 1 do + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + vi = vi + 1 + via = via + 1 + end + end + end + + dev = 2 + for yy = my + 1, my + 2 do + for zz = z - dev, z + dev do + local vi = a:index(x - dev, yy, zz) + local via = a:index(x - dev, yy + 1, zz) + for xx = x - dev, x + dev do + if random() < 0.95 - dev * 0.05 then + add_pine_needles(data, vi, c_air, c_ignore, c_snow, + c_pine_needles) + if snow then + add_snow(data, via, c_air, c_ignore, c_snow) + end + end + vi = vi + 1 + via = via + 1 + end + end + dev = dev - 1 + end + + -- Trunk + -- Force-place lowest trunk node to replace sapling + data[a:index(x, y, z)] = c_pine_tree + for yy = y + 1, maxy do + local vi = a:index(x, yy, z) + local node_id = data[vi] + if node_id == c_air or node_id == c_ignore or + node_id == c_pine_needles or node_id == c_snow then + data[vi] = c_pine_tree + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() +end + + +-- New apple tree + +function default.grow_new_apple_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/apple_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + +-- New jungle tree + +function default.grow_new_jungle_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/jungle_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + +-- New pine tree + +function default.grow_new_pine_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/pine_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "0", nil, false) +end + + +-- New snowy pine tree + +function default.grow_new_snowy_pine_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/snowy_pine_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "random", nil, false) +end + + +-- New acacia tree + +function default.grow_new_acacia_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/acacia_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 4, y = pos.y - 1, z = pos.z - 4}, + path, "random", nil, false) +end + + +-- New aspen tree + +function default.grow_new_aspen_tree(pos) + local path = minetest.get_modpath("default") .. + "/schematics/aspen_tree_from_sapling.mts" + minetest.place_schematic({x = pos.x - 2, y = pos.y - 1, z = pos.z - 2}, + path, "0", nil, false) +end + + +-- Bushes do not need 'from sapling' schematic variants because +-- only the stem node is force-placed in the schematic. + +-- Bush + +function default.grow_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + path, "0", nil, false) +end + + +-- Acacia bush + +function default.grow_acacia_bush(pos) + local path = minetest.get_modpath("default") .. + "/schematics/acacia_bush.mts" + minetest.place_schematic({x = pos.x - 1, y = pos.y - 1, z = pos.z - 1}, + path, "0", nil, false) +end + + +-- +-- Sapling 'on place' function to check protection of node and resulting tree volume +-- + +function default.sapling_on_place(itemstack, placer, pointed_thing, + sapling_name, minp_relative, maxp_relative, interval) + -- Position of sapling + local pos = pointed_thing.under + local node = minetest.get_node_or_nil(pos) + local pdef = node and minetest.registered_nodes[node.name] + + if pdef and pdef.on_rightclick and not placer:get_player_control().sneak then + return pdef.on_rightclick(pos, node, placer, itemstack, pointed_thing) + end + + if not pdef or not pdef.buildable_to then + pos = pointed_thing.above + node = minetest.get_node_or_nil(pos) + pdef = node and minetest.registered_nodes[node.name] + if not pdef or not pdef.buildable_to then + return itemstack + end + end + + local player_name = placer:get_player_name() + -- Check sapling position for protection + if minetest.is_protected(pos, player_name) then + minetest.record_protection_violation(pos, player_name) + return itemstack + end + -- Check tree volume for protection + if default.intersects_protection( + vector.add(pos, minp_relative), + vector.add(pos, maxp_relative), + player_name, + interval) then + minetest.record_protection_violation(pos, player_name) + -- Print extra information to explain + minetest.chat_send_player(player_name, "Tree will intersect protection") + return itemstack + end + + minetest.log("action", player_name .. " places node " + .. sapling_name .. " at " .. minetest.pos_to_string(pos)) + + local take_item = not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) + local newnode = {name = sapling_name} + local ndef = minetest.registered_nodes[sapling_name] + minetest.set_node(pos, newnode) + + -- Run callback + if ndef and ndef.after_place_node then + -- Deepcopy place_to and pointed_thing because callback can modify it + if ndef.after_place_node(table.copy(pos), placer, + itemstack, table.copy(pointed_thing)) then + take_item = false + end + end + + -- Run script hook + for _, callback in ipairs(minetest.registered_on_placenodes) do + -- Deepcopy pos, node and pointed_thing because callback can modify them + if callback(table.copy(pos), table.copy(newnode), + placer, table.copy(node or {}), + itemstack, table.copy(pointed_thing)) then + take_item = false + end + end + + if take_item then + itemstack:take_item() + end + + return itemstack +end diff --git a/mods/doors/README.txt b/mods/doors/README.txt new file mode 100644 index 0000000..9ad7093 --- /dev/null +++ b/mods/doors/README.txt @@ -0,0 +1,84 @@ +Minetest Game mod: doors +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) + +Modified by BlockMen (MIT): Added sounds, glass doors (glass, obsidian glass) and trapdoor. + +Modified by sofar (sofar@foo-projects.org) (MIT): +Added Steel trapdoor. +Re-implemented most of the door algorithms, added meshes, UV wrapped texture. +Added doors API to facilitate coding mods accessing and operating doors. +Added Fence Gate model, code, and sounds. + +Various Minetest developers and contributors (MIT) + + +Authors of media (textures) +--------------------------- +Following textures created by Fernando Zapata (CC BY-SA 3.0): + door_wood.png + door_wood_a.png + door_wood_a_r.png + door_wood_b.png + door_wood_b_r.png + +Following textures created by BlockMen (CC BY-SA 3.0): + door_trapdoor.png + door_obsidian_glass_side.png + +Following textures created by celeron55 (CC BY-SA 3.0): + door_glass_a.png + door_glass_b.png + +Following textures created by PenguinDad (CC BY-SA 4.0): + door_glass.png + door_obsidian_glass.png + +Following textures created by sofar (CC-BY-SA-3.0): + doors_trapdoor_steel.png + doors_trapdoor_steel_side.png + door_trapdoor_side.png + +Obsidian door textures by red-001 based on textures by Pilzadam and BlockMen (CC BY-SA 3.0): + door_obsidian_glass.png + +Glass door textures by red-001 based on textures by celeron55 (CC BY-SA 3.0): + door_glass.png + +All other textures (created by PilzAdam) (CC BY-SA 3.0): + +Door textures were converted to the new texture map by sofar, paramat and +red-001, under the same license as the originals. + + +Authors of media (models) +------------------------- +Door 3d models by sofar (CC-BY-SA-3.0) + - door_a.obj + - door_b.obj +Fence gate models by sofar (CC-BY-SA-3.0) + - fencegate_open.obj + - fencegate_closed.obj + + +Authors of media (sounds) +------------------------- +Opening-Sound created by CGEffex (CC BY 3.0), modified by BlockMen + door_open.ogg +Closing-Sound created by bennstir (CC BY 3.0) + door_close.ogg +fencegate_open.ogg: + http://www.freesound.org/people/mhtaylor67/sounds/126041/ - (CC0 1.0) +fencegate_close.ogg: + http://www.freesound.org/people/BarkersPinhead/sounds/274807/ - (CC-BY-3.0) + http://www.freesound.org/people/rivernile7/sounds/249573/ - (CC-BY-3.0) +Steel door sounds open & close (CC-BY-3.0) by HazMatt + - http://www.freesound.org/people/HazMattt/sounds/187283/ + doors_steel_door_open.ogg + doors_steel_door_close.ogg +doors_glass_door_open.ogg, doors_glass_door_close.ogg: + https://www.freesound.org/people/SkeetMasterFunk69/sounds/235546/ (CC0 1.0) diff --git a/mods/doors/depends.txt b/mods/doors/depends.txt new file mode 100644 index 0000000..5e28bee --- /dev/null +++ b/mods/doors/depends.txt @@ -0,0 +1,2 @@ +default +screwdriver? diff --git a/mods/doors/init.lua b/mods/doors/init.lua new file mode 100644 index 0000000..a07b4ae --- /dev/null +++ b/mods/doors/init.lua @@ -0,0 +1,853 @@ +-- our API object +doors = {} + +-- private data +local _doors = {} +_doors.registered_doors = {} +_doors.registered_trapdoors = {} + +local function replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("doors_owner") + if owner and owner ~= "" then + meta:set_string("owner", owner) + meta:set_string("doors_owner", "") + end +end + +-- returns an object to a door object or nil +function doors.get(pos) + local node_name = minetest.get_node(pos).name + if _doors.registered_doors[node_name] then + -- A normal upright door + return { + pos = pos, + open = function(self, player) + if self:state() then + return false + end + return _doors.door_toggle(self.pos, nil, player) + end, + close = function(self, player) + if not self:state() then + return false + end + return _doors.door_toggle(self.pos, nil, player) + end, + toggle = function(self, player) + return _doors.door_toggle(self.pos, nil, player) + end, + state = function(self) + local state = minetest.get_meta(self.pos):get_int("state") + return state %2 == 1 + end + } + elseif _doors.registered_trapdoors[node_name] then + -- A trapdoor + return { + pos = pos, + open = function(self, player) + if self:state() then + return false + end + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + close = function(self, player) + if not self:state() then + return false + end + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + toggle = function(self, player) + return _doors.trapdoor_toggle(self.pos, nil, player) + end, + state = function(self) + return minetest.get_node(self.pos).name:sub(-5) == "_open" + end + } + else + return nil + end +end + +-- this hidden node is placed on top of the bottom, and prevents +-- nodes from being placed in the top half of the door. +minetest.register_node("doors:hidden", { + description = "Hidden Door Segment", + -- can't use airlike otherwise falling nodes will turn to entities + -- and will be forever stuck until door is removed. + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + -- has to be walkable for falling nodes to stop falling. + walkable = true, + pointable = false, + diggable = false, + buildable_to = false, + floodable = false, + drop = "", + groups = {not_in_creative_inventory = 1}, + on_blast = function() end, + tiles = {"doors_blank.png"}, + -- 1px transparent block inside door hinge near node top. + node_box = { + type = "fixed", + fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, + }, + -- collision_box needed otherise selection box would be full node size + collision_box = { + type = "fixed", + fixed = {-15/32, 13/32, -15/32, -13/32, 1/2, -13/32}, + }, +}) + +-- table used to aid door opening/closing +local transform = { + { + {v = "_a", param2 = 3}, + {v = "_a", param2 = 0}, + {v = "_a", param2 = 1}, + {v = "_a", param2 = 2}, + }, + { + {v = "_b", param2 = 1}, + {v = "_b", param2 = 2}, + {v = "_b", param2 = 3}, + {v = "_b", param2 = 0}, + }, + { + {v = "_b", param2 = 1}, + {v = "_b", param2 = 2}, + {v = "_b", param2 = 3}, + {v = "_b", param2 = 0}, + }, + { + {v = "_a", param2 = 3}, + {v = "_a", param2 = 0}, + {v = "_a", param2 = 1}, + {v = "_a", param2 = 2}, + }, +} + +function _doors.door_toggle(pos, node, clicker) + local meta = minetest.get_meta(pos) + node = node or minetest.get_node(pos) + local def = minetest.registered_nodes[node.name] + local name = def.door.name + + local state = meta:get_string("state") + if state == "" then + -- fix up lvm-placed right-hinged doors, default closed + if node.name:sub(-2) == "_b" then + state = 2 + else + state = 0 + end + else + state = tonumber(state) + end + + replace_old_owner_information(pos) + + if clicker and not default.can_interact_with_node(clicker, pos) then + return false + end + + -- until Lua-5.2 we have no bitwise operators :( + if state % 2 == 1 then + state = state - 1 + else + state = state + 1 + end + + local dir = node.param2 + if state % 2 == 0 then + minetest.sound_play(def.door.sounds[1], + {pos = pos, gain = 0.3, max_hear_distance = 10}) + else + minetest.sound_play(def.door.sounds[2], + {pos = pos, gain = 0.3, max_hear_distance = 10}) + end + + minetest.swap_node(pos, { + name = name .. transform[state + 1][dir+1].v, + param2 = transform[state + 1][dir+1].param2 + }) + meta:set_int("state", state) + + return true +end + + +local function on_place_node(place_to, newnode, + placer, oldnode, itemstack, pointed_thing) + -- Run script hook + for _, callback in ipairs(minetest.registered_on_placenodes) do + -- Deepcopy pos, node and pointed_thing because callback can modify them + local place_to_copy = {x = place_to.x, y = place_to.y, z = place_to.z} + local newnode_copy = + {name = newnode.name, param1 = newnode.param1, param2 = newnode.param2} + local oldnode_copy = + {name = oldnode.name, param1 = oldnode.param1, param2 = oldnode.param2} + local pointed_thing_copy = { + type = pointed_thing.type, + above = vector.new(pointed_thing.above), + under = vector.new(pointed_thing.under), + ref = pointed_thing.ref, + } + callback(place_to_copy, newnode_copy, placer, + oldnode_copy, itemstack, pointed_thing_copy) + end +end + +local function can_dig_door(pos, digger) + replace_old_owner_information(pos) + if default.can_interact_with_node(digger, pos) then + return true + else + minetest.record_protection_violation(pos, digger:get_player_name()) + return false + end +end + +function doors.register(name, def) + if not name:find(":") then + name = "doors:" .. name + end + + -- replace old doors of this type automatically + minetest.register_lbm({ + name = ":doors:replace_" .. name:gsub(":", "_"), + nodenames = {name.."_b_1", name.."_b_2"}, + action = function(pos, node) + local l = tonumber(node.name:sub(-1)) + local meta = minetest.get_meta(pos) + local h = meta:get_int("right") + 1 + local p2 = node.param2 + local replace = { + {{type = "a", state = 0}, {type = "a", state = 3}}, + {{type = "b", state = 1}, {type = "b", state = 2}} + } + local new = replace[l][h] + -- retain infotext and doors_owner fields + minetest.swap_node(pos, {name = name .. "_" .. new.type, param2 = p2}) + meta:set_int("state", new.state) + -- properly place doors:hidden at the right spot + local p3 = p2 + if new.state >= 2 then + p3 = (p3 + 3) % 4 + end + if new.state % 2 == 1 then + if new.state >= 2 then + p3 = (p3 + 1) % 4 + else + p3 = (p3 + 3) % 4 + end + end + -- wipe meta on top node as it's unused + minetest.set_node({x = pos.x, y = pos.y + 1, z = pos.z}, + {name = "doors:hidden", param2 = p3}) + end + }) + + minetest.register_craftitem(":" .. name, { + description = def.description, + inventory_image = def.inventory_image, + groups = table.copy(def.groups), + + on_place = function(itemstack, placer, pointed_thing) + local pos + + if not pointed_thing.type == "node" then + return itemstack + end + + local node = minetest.get_node(pointed_thing.under) + local pdef = minetest.registered_nodes[node.name] + if pdef and pdef.on_rightclick and + not placer:get_player_control().sneak then + return pdef.on_rightclick(pointed_thing.under, + node, placer, itemstack, pointed_thing) + end + + if pdef and pdef.buildable_to then + pos = pointed_thing.under + else + pos = pointed_thing.above + node = minetest.get_node(pos) + pdef = minetest.registered_nodes[node.name] + if not pdef or not pdef.buildable_to then + return itemstack + end + end + + local above = {x = pos.x, y = pos.y + 1, z = pos.z} + local top_node = minetest.get_node_or_nil(above) + local topdef = top_node and minetest.registered_nodes[top_node.name] + + if not topdef or not topdef.buildable_to then + return itemstack + end + + local pn = placer:get_player_name() + if minetest.is_protected(pos, pn) or minetest.is_protected(above, pn) then + return itemstack + end + + local dir = minetest.dir_to_facedir(placer:get_look_dir()) + + local ref = { + {x = -1, y = 0, z = 0}, + {x = 0, y = 0, z = 1}, + {x = 1, y = 0, z = 0}, + {x = 0, y = 0, z = -1}, + } + + local aside = { + x = pos.x + ref[dir + 1].x, + y = pos.y + ref[dir + 1].y, + z = pos.z + ref[dir + 1].z, + } + + local state = 0 + if minetest.get_item_group(minetest.get_node(aside).name, "door") == 1 then + state = state + 2 + minetest.set_node(pos, {name = name .. "_b", param2 = dir}) + minetest.set_node(above, {name = "doors:hidden", param2 = (dir + 3) % 4}) + else + minetest.set_node(pos, {name = name .. "_a", param2 = dir}) + minetest.set_node(above, {name = "doors:hidden", param2 = dir}) + end + + local meta = minetest.get_meta(pos) + meta:set_int("state", state) + + if def.protected then + meta:set_string("owner", pn) + meta:set_string("infotext", "Owned by " .. pn) + end + + if not (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) then + itemstack:take_item() + end + + minetest.sound_play(def.sounds.place, {pos = pos}) + + on_place_node(pos, minetest.get_node(pos), + placer, node, itemstack, pointed_thing) + + return itemstack + end + }) + def.inventory_image = nil + + if def.recipe then + minetest.register_craft({ + output = name, + recipe = def.recipe, + }) + end + def.recipe = nil + + if not def.sounds then + def.sounds = default.node_sound_wood_defaults() + end + + if not def.sound_open then + def.sound_open = "doors_door_open" + end + + if not def.sound_close then + def.sound_close = "doors_door_close" + end + + def.groups.not_in_creative_inventory = 1 + def.groups.door = 1 + def.drop = name + def.door = { + name = name, + sounds = { def.sound_close, def.sound_open }, + } + + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + _doors.door_toggle(pos, node, clicker) + return itemstack + end + def.after_dig_node = function(pos, node, meta, digger) + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + minetest.check_for_falling({x = pos.x, y = pos.y + 1, z = pos.z}) + end + def.on_rotate = function(pos, node, user, mode, new_param2) + return false + end + + if def.protected then + def.can_dig = can_dig_door + def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this locked door.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked door", owner + end + else + def.on_blast = function(pos, intensity) + minetest.remove_node(pos) + -- hidden node doesn't get blasted away. + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + return {name} + end + end + + def.on_destruct = function(pos) + minetest.remove_node({x = pos.x, y = pos.y + 1, z = pos.z}) + end + + def.drawtype = "mesh" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.sunlight_propagates = true + def.walkable = true + def.is_ground_content = false + def.buildable_to = false + def.selection_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}} + def.collision_box = {type = "fixed", fixed = {-1/2,-1/2,-1/2,1/2,3/2,-6/16}} + + def.mesh = "door_a.obj" + minetest.register_node(":" .. name .. "_a", def) + + def.mesh = "door_b.obj" + minetest.register_node(":" .. name .. "_b", def) + + _doors.registered_doors[name .. "_a"] = true + _doors.registered_doors[name .. "_b"] = true +end + +doors.register("door_wood", { + tiles = {{ name = "doors_door_wood.png", backface_culling = true }}, + description = "Wooden Door", + inventory_image = "doors_item_wood.png", + groups = {}, + recipe = { + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"}, + {"group:wood", "group:wood"}, + } +}) + +doors.register("door_steel", { + tiles = {{name = "doors_door_steel.png", backface_culling = true}}, + description = "Steel Door", + inventory_image = "doors_item_steel.png", + protected = true, + groups = {cracky = 1, level = 2}, + sounds = default.node_sound_metal_defaults(), + sound_open = "doors_steel_door_open", + sound_close = "doors_steel_door_close", + recipe = { + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot"}, + } +}) + +doors.register("door_glass", { + tiles = {"doors_door_glass.png"}, + description = "Glass Door", + inventory_image = "doors_item_glass.png", + groups = {cracky=3, oddly_breakable_by_hand=3}, + sounds = default.node_sound_glass_defaults(), + sound_open = "doors_glass_door_open", + sound_close = "doors_glass_door_close", + recipe = { + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"}, + {"default:glass", "default:glass"}, + } +}) + +doors.register("door_obsidian_glass", { + tiles = {"doors_door_obsidian_glass.png"}, + description = "Obsidian Glass Door", + inventory_image = "doors_item_obsidian_glass.png", + groups = {cracky=3}, + sounds = default.node_sound_glass_defaults(), + sound_open = "doors_glass_door_open", + sound_close = "doors_glass_door_close", + recipe = { + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"}, + {"default:obsidian_glass", "default:obsidian_glass"}, + }, +}) + +-- Capture mods using the old API as best as possible. +function doors.register_door(name, def) + if def.only_placer_can_open then + def.protected = true + end + def.only_placer_can_open = nil + + local i = name:find(":") + local modname = name:sub(1, i - 1) + if not def.tiles then + if def.protected then + def.tiles = {{name = "doors_door_steel.png", backface_culling = true}} + else + def.tiles = {{name = "doors_door_wood.png", backface_culling = true}} + end + minetest.log("warning", modname .. " registered door \"" .. name .. "\" " .. + "using deprecated API method \"doors.register_door()\" but " .. + "did not provide the \"tiles\" parameter. A fallback tiledef " .. + "will be used instead.") + end + + doors.register(name, def) +end + +----trapdoor---- + +function _doors.trapdoor_toggle(pos, node, clicker) + node = node or minetest.get_node(pos) + + replace_old_owner_information(pos) + + if clicker and not default.can_interact_with_node(clicker, pos) then + return false + end + + local def = minetest.registered_nodes[node.name] + + if string.sub(node.name, -5) == "_open" then + minetest.sound_play(def.sound_close, + {pos = pos, gain = 0.3, max_hear_distance = 10}) + minetest.swap_node(pos, {name = string.sub(node.name, 1, + string.len(node.name) - 5), param1 = node.param1, param2 = node.param2}) + else + minetest.sound_play(def.sound_open, + {pos = pos, gain = 0.3, max_hear_distance = 10}) + minetest.swap_node(pos, {name = node.name .. "_open", + param1 = node.param1, param2 = node.param2}) + end +end + +function doors.register_trapdoor(name, def) + if not name:find(":") then + name = "doors:" .. name + end + + local name_closed = name + local name_opened = name.."_open" + + def.on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + _doors.trapdoor_toggle(pos, node, clicker) + return itemstack + end + + -- Common trapdoor configuration + def.drawtype = "nodebox" + def.paramtype = "light" + def.paramtype2 = "facedir" + def.is_ground_content = false + + if def.protected then + def.can_dig = can_dig_door + def.after_place_node = function(pos, placer, itemstack, pointed_thing) + local pn = placer:get_player_name() + local meta = minetest.get_meta(pos) + meta:set_string("owner", pn) + meta:set_string("infotext", "Owned by "..pn) + + return (creative and creative.is_enabled_for and creative.is_enabled_for(pn)) + end + + def.on_blast = function() end + def.on_key_use = function(pos, player) + local door = doors.get(pos) + door:toggle(player) + end + def.on_skeleton_key_use = function(pos, player, newsecret) + replace_old_owner_information(pos) + local meta = minetest.get_meta(pos) + local owner = meta:get_string("owner") + local pname = player:get_player_name() + + -- verify placer is owner of lockable door + if owner ~= pname then + minetest.record_protection_violation(pos, pname) + minetest.chat_send_player(pname, "You do not own this trapdoor.") + return nil + end + + local secret = meta:get_string("key_lock_secret") + if secret == "" then + secret = newsecret + meta:set_string("key_lock_secret", secret) + end + + return secret, "a locked trapdoor", owner + end + else + def.on_blast = function(pos, intensity) + minetest.remove_node(pos) + return {name} + end + end + + if not def.sounds then + def.sounds = default.node_sound_wood_defaults() + end + + if not def.sound_open then + def.sound_open = "doors_door_open" + end + + if not def.sound_close then + def.sound_close = "doors_door_close" + end + + local def_opened = table.copy(def) + local def_closed = table.copy(def) + + def_closed.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -6/16, 0.5} + } + def_closed.tiles = {def.tile_front, + def.tile_front .. '^[transformFY', + def.tile_side, def.tile_side, + def.tile_side, def.tile_side} + + def_opened.node_box = { + type = "fixed", + fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, 6/16, 0.5, 0.5, 0.5} + } + def_opened.tiles = {def.tile_side, def.tile_side, + def.tile_side .. '^[transform3', + def.tile_side .. '^[transform1', + def.tile_front .. '^[transform46', + def.tile_front .. '^[transform6'} + + def_opened.drop = name_closed + def_opened.groups.not_in_creative_inventory = 1 + + minetest.register_node(name_opened, def_opened) + minetest.register_node(name_closed, def_closed) + + _doors.registered_trapdoors[name_opened] = true + _doors.registered_trapdoors[name_closed] = true +end + +doors.register_trapdoor("doors:trapdoor", { + description = "Trapdoor", + inventory_image = "doors_trapdoor.png", + wield_image = "doors_trapdoor.png", + tile_front = "doors_trapdoor.png", + tile_side = "doors_trapdoor_side.png", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2, door = 1}, +}) + +doors.register_trapdoor("doors:trapdoor_steel", { + description = "Steel Trapdoor", + inventory_image = "doors_trapdoor_steel.png", + wield_image = "doors_trapdoor_steel.png", + tile_front = "doors_trapdoor_steel.png", + tile_side = "doors_trapdoor_steel_side.png", + protected = true, + sounds = default.node_sound_metal_defaults(), + sound_open = "doors_steel_door_open", + sound_close = "doors_steel_door_close", + groups = {cracky = 1, level = 2, door = 1}, +}) + +minetest.register_craft({ + output = 'doors:trapdoor 2', + recipe = { + {'group:wood', 'group:wood', 'group:wood'}, + {'group:wood', 'group:wood', 'group:wood'}, + {'', '', ''}, + } +}) + +minetest.register_craft({ + output = 'doors:trapdoor_steel', + recipe = { + {'default:steel_ingot', 'default:steel_ingot'}, + {'default:steel_ingot', 'default:steel_ingot'}, + } +}) + + +----fence gate---- + +function doors.register_fencegate(name, def) + local fence = { + description = def.description, + drawtype = "mesh", + tiles = {def.texture}, + paramtype = "light", + paramtype2 = "facedir", + sunlight_propagates = true, + is_ground_content = false, + drop = name .. "_closed", + connect_sides = {"left", "right"}, + groups = def.groups, + sounds = def.sounds, + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + local node_def = minetest.registered_nodes[node.name] + minetest.swap_node(pos, {name = node_def.gate, param2 = node.param2}) + minetest.sound_play(node_def.sound, {pos = pos, gain = 0.3, + max_hear_distance = 8}) + return itemstack + end, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}, + }, + } + + if not fence.sounds then + fence.sounds = default.node_sound_wood_defaults() + end + + fence.groups.fence = 1 + + local fence_closed = table.copy(fence) + fence_closed.mesh = "doors_fencegate_closed.obj" + fence_closed.gate = name .. "_open" + fence_closed.sound = "doors_fencegate_open" + fence_closed.collision_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/4, 1/2, 1/2, 1/4}, + } + + local fence_open = table.copy(fence) + fence_open.mesh = "doors_fencegate_open.obj" + fence_open.gate = name .. "_closed" + fence_open.sound = "doors_fencegate_close" + fence_open.groups.not_in_creative_inventory = 1 + fence_open.collision_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/4, -3/8, 1/2, 1/4}, + {-1/2, -3/8, -1/2, -3/8, 3/8, 0}}, + } + + minetest.register_node(":" .. name .. "_closed", fence_closed) + minetest.register_node(":" .. name .. "_open", fence_open) + + minetest.register_craft({ + output = name .. "_closed", + recipe = { + {"default:stick", def.material, "default:stick"}, + {"default:stick", def.material, "default:stick"} + } + }) +end + +doors.register_fencegate("doors:gate_wood", { + description = "Wooden Fence Gate", + texture = "default_wood.png", + material = "default:wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_acacia_wood", { + description = "Acacia Fence Gate", + texture = "default_acacia_wood.png", + material = "default:acacia_wood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_junglewood", { + description = "Jungle Wood Fence Gate", + texture = "default_junglewood.png", + material = "default:junglewood", + groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2} +}) + +doors.register_fencegate("doors:gate_pine_wood", { + description = "Pine Fence Gate", + texture = "default_pine_wood.png", + material = "default:pine_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} +}) + +doors.register_fencegate("doors:gate_aspen_wood", { + description = "Aspen Fence Gate", + texture = "default_aspen_wood.png", + material = "default:aspen_wood", + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3} +}) + + +----fuels---- + +minetest.register_craft({ + type = "fuel", + recipe = "doors:trapdoor", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:door_wood", + burntime = 14, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_wood_closed", + burntime = 7, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_acacia_wood_closed", + burntime = 8, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_junglewood_closed", + burntime = 9, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_pine_wood_closed", + burntime = 6, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "doors:gate_aspen_wood_closed", + burntime = 5, +}) diff --git a/mods/doors/license.txt b/mods/doors/license.txt new file mode 100644 index 0000000..8ce73c4 --- /dev/null +++ b/mods/doors/license.txt @@ -0,0 +1,164 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar (sofar@foo-projects.org) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures, models and sounds) +----------------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2011-2016 Fernando Zapata +Copyright (C) 2014-2016 celeron55 +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 sofar +Copyright (C) 2016 red-001 +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) +Copyright (C) 2014-2016 PenguinDad + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/4.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2014 CGEffex +Copyright (C) 2014 bennstir +Copyright (C) 2016 BarkersPinhead +Copyright (C) 2016 rivernile7 +Copyright (C) 2016 HazMatt + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ + +----------------------- + +CC0 1.0 Universal (CC0 1.0) Public Domain Dedication +mhtaylor67 +SkeetMasterFunk69 + +No Copyright + +The person who associated a work with this deed has dedicated the work to the public +domain by waiving all of his or her rights to the work worldwide under copyright law, +including all related and neighboring rights, to the extent allowed by law. + +You can copy, modify, distribute and perform the work, even for commercial purposes, all +without asking permission. See Other Information below. + +Other Information + +In no way are the patent or trademark rights of any person affected by CC0, nor are the +rights that other persons may have in the work or in how the work is used, such as +publicity or privacy rights. +Unless expressly stated otherwise, the person who associated a work with this deed makes +no warranties about the work, and disclaims liability for all uses of the work, to the +fullest extent permitted by applicable law. +When using or citing the work, you should not imply endorsement by the author or the +affirmer. + +For more details: +https://creativecommons.org/publicdomain/zero/1.0/ diff --git a/mods/doors/models/door_a.obj b/mods/doors/models/door_a.obj new file mode 100644 index 0000000..bd5127b --- /dev/null +++ b/mods/doors/models/door_a.obj @@ -0,0 +1,40 @@ +# Blender v2.76 (sub 0) OBJ File: 'door_a.blend' +# www.blender.org +mtllib door_a.mtl +o Cube_Cube.001 +v 0.499000 -0.499000 -0.499000 +v 0.499000 1.499000 -0.499000 +v 0.499000 -0.499000 -0.375000 +v 0.499000 1.499000 -0.375000 +v -0.499000 -0.499000 -0.499000 +v -0.499000 1.499000 -0.499000 +v -0.499000 -0.499000 -0.375000 +v -0.499000 1.499000 -0.375000 +vt 0.842105 1.000000 +vt 0.894737 1.000000 +vt 0.894737 0.000000 +vt 0.842105 0.000000 +vt 0.421053 1.000000 +vt 0.421053 0.000000 +vt 0.947368 1.000000 +vt 0.947368 0.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.500000 +vt 0.947368 0.500000 +vt 1.000000 1.000000 +vt 1.000000 0.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 2/1/1 4/2/1 3/3/1 1/4/1 +f 4/5/2 8/1/2 7/4/2 3/6/2 +f 8/2/3 6/7/3 5/8/3 7/3/3 +f 6/9/4 2/5/4 1/6/4 5/10/4 +f 1/11/5 3/12/5 7/7/5 5/13/5 +f 6/14/6 8/8/6 4/12/6 2/11/6 diff --git a/mods/doors/models/door_b.obj b/mods/doors/models/door_b.obj new file mode 100644 index 0000000..c5607b8 --- /dev/null +++ b/mods/doors/models/door_b.obj @@ -0,0 +1,40 @@ +# Blender v2.76 (sub 0) OBJ File: 'door_b.blend' +# www.blender.org +mtllib door_b.mtl +o Cube_Cube.001 +v -0.499000 -0.499000 -0.499000 +v -0.499000 1.499000 -0.499000 +v -0.499000 -0.499000 -0.375000 +v -0.499000 1.499000 -0.375000 +v 0.499000 -0.499000 -0.499000 +v 0.499000 1.499000 -0.499000 +v 0.499000 -0.499000 -0.375000 +v 0.499000 1.499000 -0.375000 +vt 0.842105 1.000000 +vt 0.842105 0.000000 +vt 0.894737 0.000000 +vt 0.894737 1.000000 +vt 0.421053 1.000000 +vt 0.421053 0.000000 +vt 0.947368 0.000000 +vt 0.947368 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.500000 +vt 0.947368 0.500000 +vt 1.000000 1.000000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +usemtl None +s off +f 2/1/1 1/2/1 3/3/1 4/4/1 +f 4/5/2 3/6/2 7/2/2 8/1/2 +f 8/4/3 7/3/3 5/7/3 6/8/3 +f 6/9/4 5/10/4 1/6/4 2/5/4 +f 1/11/5 5/12/5 7/13/5 3/7/5 +f 6/8/6 2/13/6 4/12/6 8/14/6 diff --git a/mods/doors/models/doors_fencegate_closed.obj b/mods/doors/models/doors_fencegate_closed.obj new file mode 100644 index 0000000..0050f70 --- /dev/null +++ b/mods/doors/models/doors_fencegate_closed.obj @@ -0,0 +1,106 @@ +# Blender v2.76 (sub 0) OBJ File: 'gate_closed.blend' +# www.blender.org +mtllib gate_closed.mtl +o Cube_Cube.001 +v -0.625000 -0.500000 0.125000 +v -0.625000 0.500100 0.125000 +v -0.625000 -0.500000 -0.125000 +v -0.625000 0.500100 -0.125000 +v -0.375000 -0.500000 0.125000 +v -0.375000 0.500100 0.125000 +v -0.375000 -0.500000 -0.125000 +v -0.375000 0.500100 -0.125000 +v 0.375000 -0.500000 0.125000 +v 0.375000 0.500100 0.125000 +v 0.375000 -0.500000 -0.125000 +v 0.375000 0.500100 -0.125000 +v 0.625000 -0.500000 0.125000 +v 0.625000 0.500100 0.125000 +v 0.625000 -0.500000 -0.125000 +v 0.625000 0.500100 -0.125000 +v -0.375000 0.187500 0.062500 +v -0.375000 0.312500 0.062500 +v -0.375000 0.187500 -0.062500 +v -0.375000 0.312500 -0.062500 +v 0.375000 0.187500 0.062500 +v 0.375000 0.312500 0.062500 +v 0.375000 0.187500 -0.062500 +v 0.375000 0.312500 -0.062500 +v -0.374831 0.187348 0.062500 +v -0.156342 0.187363 0.062500 +v -0.374831 0.187348 -0.062500 +v -0.156342 0.187363 -0.062500 +v 0.374981 -0.343683 0.062500 +v 0.375065 -0.187304 0.062500 +v 0.374981 -0.343683 -0.062500 +v 0.375065 -0.187304 -0.062500 +vt 0.000000 0.750000 +vt 0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 0.250000 +vt 0.000000 0.250000 +vt -0.000000 0.000000 +vt 0.250000 0.000000 +vt 0.250000 0.250000 +vt 0.250000 0.750000 +vt 0.250000 1.000000 +vt 0.500000 -0.000000 +vt 0.500000 0.250000 +vt 0.500000 0.750000 +vt 0.500000 1.000000 +vt 1.000000 0.625000 +vt 0.000000 0.625000 +vt 1.000000 0.875000 +vt 0.000000 0.875000 +vt -0.000000 0.687500 +vt 0.000000 0.562500 +vt 1.000000 0.562500 +vt 1.000000 0.687500 +vt 0.813740 0.249033 +vt 0.201557 0.249293 +vt 0.120995 0.125498 +vt 0.987404 0.125469 +vt 0.125000 0.375000 +vt 0.812500 0.375000 +vt 0.937500 0.500000 +vt 0.062500 0.500000 +vt 0.000000 0.125000 +vt 1.000000 0.125000 +vt 0.312500 0.437500 +vt 0.312500 0.312500 +vt 1.000000 0.312500 +vt 1.000000 0.437500 +vn -1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn -0.578000 -0.816100 0.000000 +vn 0.576200 0.817300 0.000000 +usemtl None +s off +f 2/1/1 4/2/1 3/3/1 1/4/1 +f 4/4/2 8/5/2 7/6/2 3/1/2 +f 8/7/3 6/8/3 5/9/3 7/10/3 +f 6/2/4 2/9/4 1/8/4 5/3/4 +f 1/9/5 3/10/5 7/11/5 5/12/5 +f 6/6/6 8/1/6 4/13/6 2/14/6 +f 10/1/1 12/2/1 11/3/1 9/4/1 +f 12/2/2 16/9/2 15/8/2 11/3/2 +f 16/7/3 14/8/3 13/9/3 15/10/3 +f 14/4/4 10/5/4 9/6/4 13/1/4 +f 9/12/5 11/11/5 15/15/5 13/16/5 +f 14/14/6 16/13/6 12/17/6 10/18/6 +f 20/2/2 24/3/2 23/19/2 19/20/2 +f 22/1/4 18/4/4 17/21/4 21/22/4 +f 17/23/5 19/24/5 23/25/5 21/26/5 +f 22/21/6 24/5/6 20/6/6 18/22/6 +f 28/27/2 32/28/2 31/29/2 27/30/2 +f 30/31/4 26/32/4 25/33/4 29/34/4 +f 25/35/7 27/10/7 31/7/7 29/36/7 +f 30/37/8 32/38/8 28/39/8 26/40/8 diff --git a/mods/doors/models/doors_fencegate_open.obj b/mods/doors/models/doors_fencegate_open.obj new file mode 100644 index 0000000..3fb727f --- /dev/null +++ b/mods/doors/models/doors_fencegate_open.obj @@ -0,0 +1,112 @@ +# Blender v2.76 (sub 0) OBJ File: 'gate_open.blend' +# www.blender.org +mtllib gate_open.mtl +o Cube_Cube.001 +v -0.625000 -0.500000 0.125000 +v -0.625000 0.500100 0.125000 +v -0.625000 -0.500000 -0.125000 +v -0.625000 0.500100 -0.125000 +v -0.375000 -0.500000 0.125000 +v -0.375000 0.500100 0.125000 +v -0.375000 -0.500000 -0.125000 +v -0.375000 0.500100 -0.125000 +v 0.375000 -0.500000 0.125000 +v 0.375000 0.500100 0.125000 +v 0.375000 -0.500000 -0.125000 +v 0.375000 0.500100 -0.125000 +v 0.625000 -0.500000 0.125000 +v 0.625000 0.500100 0.125000 +v 0.625000 -0.500000 -0.125000 +v 0.625000 0.500100 -0.125000 +v 0.434859 0.187500 -0.872359 +v 0.434859 0.312500 -0.872359 +v 0.559859 0.187500 -0.872359 +v 0.559859 0.312500 -0.872359 +v 0.434859 0.187500 -0.122359 +v 0.434859 0.312500 -0.122359 +v 0.559859 0.187500 -0.122359 +v 0.559859 0.312500 -0.122359 +v 0.434859 0.187348 -0.872190 +v 0.434859 0.187363 -0.653701 +v 0.559859 0.187348 -0.872190 +v 0.559859 0.187363 -0.653701 +v 0.434859 -0.343683 -0.122379 +v 0.434859 -0.187304 -0.122294 +v 0.559859 -0.343683 -0.122379 +v 0.559859 -0.187304 -0.122294 +v 0.499560 -0.442900 0.005495 +vt 0.000000 0.750000 +vt 0.000000 0.500000 +vt 1.000000 0.500000 +vt 1.000000 0.750000 +vt 1.000000 1.000000 +vt -0.000000 1.000000 +vt 1.000000 -0.000000 +vt 1.000000 0.250000 +vt 0.000000 0.250000 +vt -0.000000 0.000000 +vt 0.250000 0.000000 +vt 0.250000 0.250000 +vt 0.250000 0.750000 +vt 0.250000 1.000000 +vt 0.500000 -0.000000 +vt 0.500000 0.250000 +vt 0.500000 0.750000 +vt 0.500000 1.000000 +vt 1.000000 0.625000 +vt 0.000000 0.625000 +vt 1.000000 0.875000 +vt 0.000000 0.875000 +vt -0.000000 0.687500 +vt 0.000000 0.562500 +vt 1.000000 0.562500 +vt 1.000000 0.687500 +vt 0.813740 0.249033 +vt 0.201557 0.249293 +vt 0.120995 0.125498 +vt 0.987404 0.125469 +vt 0.125000 0.375000 +vt 0.812500 0.375000 +vt 0.937500 0.500000 +vt 0.062500 0.500000 +vt 0.000000 0.125000 +vt 1.000000 0.125000 +vt 0.312500 0.437500 +vt 0.312500 0.312500 +vt 1.000000 0.312500 +vt 1.000000 0.437500 +vt 0.312500 0.625000 +vt 0.312500 0.500000 +vt 0.187500 0.500000 +vt 0.187500 0.625000 +vn -1.000000 0.000000 0.000000 +vn 0.000000 0.000000 -1.000000 +vn 1.000000 0.000000 0.000000 +vn 0.000000 0.000000 1.000000 +vn 0.000000 -1.000000 0.000000 +vn 0.000000 1.000000 0.000000 +vn 0.000000 -0.816100 -0.578000 +vn 0.000000 0.817300 0.576200 +usemtl None +s off +f 2/1/1 4/2/1 3/3/1 1/4/1 +f 4/4/2 8/5/2 7/6/2 3/1/2 +f 8/7/3 6/8/3 5/9/3 7/10/3 +f 6/2/4 2/9/4 1/8/4 5/3/4 +f 1/9/5 3/10/5 7/11/5 5/12/5 +f 6/6/6 8/1/6 4/13/6 2/14/6 +f 10/1/1 12/2/1 11/3/1 9/4/1 +f 12/2/2 16/9/2 15/8/2 11/3/2 +f 16/7/3 14/8/3 13/9/3 15/10/3 +f 14/4/4 10/5/4 9/6/4 13/1/4 +f 9/12/5 11/11/5 15/15/5 13/16/5 +f 14/14/6 16/13/6 12/17/6 10/18/6 +f 20/2/3 24/3/3 23/19/3 19/20/3 +f 22/1/1 18/4/1 17/21/1 21/22/1 +f 17/23/5 19/24/5 23/25/5 21/26/5 +f 22/21/6 24/5/6 20/6/6 18/22/6 +f 28/27/3 32/28/3 31/29/3 27/30/3 +f 30/31/1 26/32/1 25/33/1 29/34/1 +f 25/35/7 27/10/7 31/7/7 29/36/7 +f 30/37/8 32/38/8 28/39/8 26/40/8 +f 17/41/2 18/42/2 20/43/2 19/44/2 diff --git a/mods/doors/sounds/doors_door_close.ogg b/mods/doors/sounds/doors_door_close.ogg new file mode 100644 index 0000000..fede4af Binary files /dev/null and b/mods/doors/sounds/doors_door_close.ogg differ diff --git a/mods/doors/sounds/doors_door_open.ogg b/mods/doors/sounds/doors_door_open.ogg new file mode 100644 index 0000000..9a4c4f1 Binary files /dev/null and b/mods/doors/sounds/doors_door_open.ogg differ diff --git a/mods/doors/sounds/doors_fencegate_close.ogg b/mods/doors/sounds/doors_fencegate_close.ogg new file mode 100644 index 0000000..d42590f Binary files /dev/null and b/mods/doors/sounds/doors_fencegate_close.ogg differ diff --git a/mods/doors/sounds/doors_fencegate_open.ogg b/mods/doors/sounds/doors_fencegate_open.ogg new file mode 100644 index 0000000..f6dfd1d Binary files /dev/null and b/mods/doors/sounds/doors_fencegate_open.ogg differ diff --git a/mods/doors/sounds/doors_glass_door_close.ogg b/mods/doors/sounds/doors_glass_door_close.ogg new file mode 100644 index 0000000..b3c1355 Binary files /dev/null and b/mods/doors/sounds/doors_glass_door_close.ogg differ diff --git a/mods/doors/sounds/doors_glass_door_open.ogg b/mods/doors/sounds/doors_glass_door_open.ogg new file mode 100644 index 0000000..66e6812 Binary files /dev/null and b/mods/doors/sounds/doors_glass_door_open.ogg differ diff --git a/mods/doors/sounds/doors_steel_door_close.ogg b/mods/doors/sounds/doors_steel_door_close.ogg new file mode 100644 index 0000000..aea7be6 Binary files /dev/null and b/mods/doors/sounds/doors_steel_door_close.ogg differ diff --git a/mods/doors/sounds/doors_steel_door_open.ogg b/mods/doors/sounds/doors_steel_door_open.ogg new file mode 100644 index 0000000..de87477 Binary files /dev/null and b/mods/doors/sounds/doors_steel_door_open.ogg differ diff --git a/mods/doors/textures/doors_blank.png b/mods/doors/textures/doors_blank.png new file mode 100644 index 0000000..1914264 Binary files /dev/null and b/mods/doors/textures/doors_blank.png differ diff --git a/mods/doors/textures/doors_door_glass.png b/mods/doors/textures/doors_door_glass.png new file mode 100644 index 0000000..26c427b Binary files /dev/null and b/mods/doors/textures/doors_door_glass.png differ diff --git a/mods/doors/textures/doors_door_obsidian_glass.png b/mods/doors/textures/doors_door_obsidian_glass.png new file mode 100644 index 0000000..07ac5b2 Binary files /dev/null and b/mods/doors/textures/doors_door_obsidian_glass.png differ diff --git a/mods/doors/textures/doors_door_steel.png b/mods/doors/textures/doors_door_steel.png new file mode 100644 index 0000000..f42f335 Binary files /dev/null and b/mods/doors/textures/doors_door_steel.png differ diff --git a/mods/doors/textures/doors_door_wood.png b/mods/doors/textures/doors_door_wood.png new file mode 100644 index 0000000..7b18203 Binary files /dev/null and b/mods/doors/textures/doors_door_wood.png differ diff --git a/mods/doors/textures/doors_item_glass.png b/mods/doors/textures/doors_item_glass.png new file mode 100644 index 0000000..791a58a Binary files /dev/null and b/mods/doors/textures/doors_item_glass.png differ diff --git a/mods/doors/textures/doors_item_obsidian_glass.png b/mods/doors/textures/doors_item_obsidian_glass.png new file mode 100644 index 0000000..1026d43 Binary files /dev/null and b/mods/doors/textures/doors_item_obsidian_glass.png differ diff --git a/mods/doors/textures/doors_item_steel.png b/mods/doors/textures/doors_item_steel.png new file mode 100644 index 0000000..dd99e13 Binary files /dev/null and b/mods/doors/textures/doors_item_steel.png differ diff --git a/mods/doors/textures/doors_item_wood.png b/mods/doors/textures/doors_item_wood.png new file mode 100644 index 0000000..d3a62ab Binary files /dev/null and b/mods/doors/textures/doors_item_wood.png differ diff --git a/mods/doors/textures/doors_trapdoor.png b/mods/doors/textures/doors_trapdoor.png new file mode 100644 index 0000000..e92c8b2 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor.png differ diff --git a/mods/doors/textures/doors_trapdoor_side.png b/mods/doors/textures/doors_trapdoor_side.png new file mode 100644 index 0000000..c45d870 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_side.png differ diff --git a/mods/doors/textures/doors_trapdoor_steel.png b/mods/doors/textures/doors_trapdoor_steel.png new file mode 100644 index 0000000..4ba507d Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_steel.png differ diff --git a/mods/doors/textures/doors_trapdoor_steel_side.png b/mods/doors/textures/doors_trapdoor_steel_side.png new file mode 100644 index 0000000..44c4344 Binary files /dev/null and b/mods/doors/textures/doors_trapdoor_steel_side.png differ diff --git a/mods/dye/README.txt b/mods/dye/README.txt new file mode 100644 index 0000000..a2fbdd2 --- /dev/null +++ b/mods/dye/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: dye +====================== +See license.txt for license information. +See init.lua for documentation. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Perttu Ahola (celeron55) (CC BY-SA 3.0) diff --git a/mods/dye/depends.txt b/mods/dye/depends.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/dye/init.lua b/mods/dye/init.lua new file mode 100644 index 0000000..8028457 --- /dev/null +++ b/mods/dye/init.lua @@ -0,0 +1,112 @@ +-- Other mods can use these for looping through available colors + +dye = {} +dye.basecolors = {"white", "grey", "black", "red", "yellow", "green", "cyan", "blue", "magenta"} +dye.excolors = {"white", "lightgrey", "grey", "darkgrey", "black", "red", "orange", "yellow", + "lime", "green", "aqua", "cyan", "sky_blue", "blue", "violet", "magenta", "red_violet"} + +-- Make dye names and descriptions available globally + +dye.dyes = { + {"white", "White"}, + {"grey", "Grey"}, + {"dark_grey", "Dark grey"}, + {"black", "Black"}, + {"violet", "Violet"}, + {"blue", "Blue"}, + {"cyan", "Cyan"}, + {"dark_green", "Dark green"}, + {"green", "Green"}, + {"yellow", "Yellow"}, + {"brown", "Brown"}, + {"orange", "Orange"}, + {"red", "Red"}, + {"magenta", "Magenta"}, + {"pink", "Pink"}, +} + +-- This collection of colors is partly a historic thing, partly something else + +local dyes = { + {"white", "White dye", {dye=1, basecolor_white=1, excolor_white=1, unicolor_white=1}}, + {"grey", "Grey dye", {dye=1, basecolor_grey=1, excolor_grey=1, unicolor_grey=1}}, + {"dark_grey", "Dark grey dye", {dye=1, basecolor_grey=1, excolor_darkgrey=1, unicolor_darkgrey=1}}, + {"black", "Black dye", {dye=1, basecolor_black=1, excolor_black=1, unicolor_black=1}}, + {"violet", "Violet dye", {dye=1, basecolor_magenta=1, excolor_violet=1, unicolor_violet=1}}, + {"blue", "Blue dye", {dye=1, basecolor_blue=1, excolor_blue=1, unicolor_blue=1}}, + {"cyan", "Cyan dye", {dye=1, basecolor_cyan=1, excolor_cyan=1, unicolor_cyan=1}}, + {"dark_green", "Dark green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_dark_green=1}}, + {"green", "Green dye", {dye=1, basecolor_green=1, excolor_green=1, unicolor_green=1}}, + {"yellow", "Yellow dye", {dye=1, basecolor_yellow=1, excolor_yellow=1, unicolor_yellow=1}}, + {"brown", "Brown dye", {dye=1, basecolor_brown=1, excolor_orange=1, unicolor_dark_orange=1}}, + {"orange", "Orange dye", {dye=1, basecolor_orange=1, excolor_orange=1, unicolor_orange=1}}, + {"red", "Red dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_red=1}}, + {"magenta", "Magenta dye", {dye=1, basecolor_magenta=1, excolor_red_violet=1, unicolor_red_violet=1}}, + {"pink", "Pink dye", {dye=1, basecolor_red=1, excolor_red=1, unicolor_light_red=1}}, +} + +-- Define items + +for _, row in ipairs(dyes) do + local name = row[1] + local description = row[2] + local groups = row[3] + local item_name = "dye:" .. name + local item_image = "dye_" .. name .. ".png" + minetest.register_craftitem(item_name, { + inventory_image = item_image, + description = description, + groups = groups + }) + minetest.register_craft({ + type = "shapeless", + output = item_name .. " 4", + recipe = {"group:flower,color_" .. name}, + }) +end + +-- Manually add coal->black dye + +minetest.register_craft({ + type = "shapeless", + output = "dye:black 4", + recipe = {"group:coal"}, +}) + +-- Mix recipes +local dye_recipes = { + -- src1, src2, dst + -- RYB mixes + {"red", "blue", "violet"}, -- "purple" + {"yellow", "red", "orange"}, + {"yellow", "blue", "green"}, + -- RYB complementary mixes + {"yellow", "violet", "dark_grey"}, + {"blue", "orange", "dark_grey"}, + -- CMY mixes - approximation + {"cyan", "yellow", "green"}, + {"cyan", "magenta", "blue"}, + {"yellow", "magenta", "red"}, + -- other mixes that result in a color we have + {"red", "green", "brown"}, + {"magenta", "blue", "violet"}, + {"green", "blue", "cyan"}, + {"pink", "violet", "magenta"}, + -- mixes with black + {"white", "black", "grey"}, + {"grey", "black", "dark_grey"}, + {"green", "black", "dark_green"}, + {"orange", "black", "brown"}, + -- mixes with white + {"white", "red", "pink"}, + {"white", "dark_grey", "grey"}, + {"white", "dark_green", "green"}, +} + +for _, mix in pairs(dye_recipes) do + minetest.register_craft({ + type = "shapeless", + output = 'dye:' .. mix[3] .. ' 2', + recipe = {'dye:' .. mix[1], 'dye:' .. mix[2]}, + }) +end diff --git a/mods/dye/license.txt b/mods/dye/license.txt new file mode 100644 index 0000000..bf9d350 --- /dev/null +++ b/mods/dye/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/dye/textures/dye_black.png b/mods/dye/textures/dye_black.png new file mode 100644 index 0000000..1055b6c Binary files /dev/null and b/mods/dye/textures/dye_black.png differ diff --git a/mods/dye/textures/dye_blue.png b/mods/dye/textures/dye_blue.png new file mode 100644 index 0000000..d1377c6 Binary files /dev/null and b/mods/dye/textures/dye_blue.png differ diff --git a/mods/dye/textures/dye_brown.png b/mods/dye/textures/dye_brown.png new file mode 100644 index 0000000..77d475c Binary files /dev/null and b/mods/dye/textures/dye_brown.png differ diff --git a/mods/dye/textures/dye_cyan.png b/mods/dye/textures/dye_cyan.png new file mode 100644 index 0000000..239d66c Binary files /dev/null and b/mods/dye/textures/dye_cyan.png differ diff --git a/mods/dye/textures/dye_dark_green.png b/mods/dye/textures/dye_dark_green.png new file mode 100644 index 0000000..9606ccf Binary files /dev/null and b/mods/dye/textures/dye_dark_green.png differ diff --git a/mods/dye/textures/dye_dark_grey.png b/mods/dye/textures/dye_dark_grey.png new file mode 100644 index 0000000..060737b Binary files /dev/null and b/mods/dye/textures/dye_dark_grey.png differ diff --git a/mods/dye/textures/dye_green.png b/mods/dye/textures/dye_green.png new file mode 100644 index 0000000..0d99ee1 Binary files /dev/null and b/mods/dye/textures/dye_green.png differ diff --git a/mods/dye/textures/dye_grey.png b/mods/dye/textures/dye_grey.png new file mode 100644 index 0000000..5efb028 Binary files /dev/null and b/mods/dye/textures/dye_grey.png differ diff --git a/mods/dye/textures/dye_magenta.png b/mods/dye/textures/dye_magenta.png new file mode 100644 index 0000000..c84df62 Binary files /dev/null and b/mods/dye/textures/dye_magenta.png differ diff --git a/mods/dye/textures/dye_orange.png b/mods/dye/textures/dye_orange.png new file mode 100644 index 0000000..0844907 Binary files /dev/null and b/mods/dye/textures/dye_orange.png differ diff --git a/mods/dye/textures/dye_pink.png b/mods/dye/textures/dye_pink.png new file mode 100644 index 0000000..c3dec22 Binary files /dev/null and b/mods/dye/textures/dye_pink.png differ diff --git a/mods/dye/textures/dye_red.png b/mods/dye/textures/dye_red.png new file mode 100644 index 0000000..14eafbf Binary files /dev/null and b/mods/dye/textures/dye_red.png differ diff --git a/mods/dye/textures/dye_violet.png b/mods/dye/textures/dye_violet.png new file mode 100644 index 0000000..600cbb4 Binary files /dev/null and b/mods/dye/textures/dye_violet.png differ diff --git a/mods/dye/textures/dye_white.png b/mods/dye/textures/dye_white.png new file mode 100644 index 0000000..2a840a4 Binary files /dev/null and b/mods/dye/textures/dye_white.png differ diff --git a/mods/dye/textures/dye_yellow.png b/mods/dye/textures/dye_yellow.png new file mode 100644 index 0000000..fe75775 Binary files /dev/null and b/mods/dye/textures/dye_yellow.png differ diff --git a/mods/farming/README.txt b/mods/farming/README.txt new file mode 100644 index 0000000..3ccd8c3 --- /dev/null +++ b/mods/farming/README.txt @@ -0,0 +1,37 @@ +Minetest Game mod: farming +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by PilzAdam (MIT) +webdesigner97 (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Created by PilzAdam (CC BY 3.0): + farming_bread.png + farming_soil.png + farming_soil_wet.png + farming_soil_wet_side.png + farming_string.png + +Created by BlockMen (CC BY 3.0): + farming_tool_diamondhoe.png + farming_tool_mesehoe.png + farming_tool_bronzehoe.png + farming_tool_steelhoe.png + farming_tool_stonehoe.png + farming_tool_woodhoe.png + +Created by MasterGollum (CC BY 3.0): + farming_straw.png + +Created by Gambit (CC BY 3.0): + farming_wheat.png + farming_wheat_*.png + farming_cotton_*.png + farming_flour.png + farming_cotton_seed.png + farming_wheat_seed.png diff --git a/mods/farming/api.lua b/mods/farming/api.lua new file mode 100644 index 0000000..35a77e9 --- /dev/null +++ b/mods/farming/api.lua @@ -0,0 +1,404 @@ + +-- Wear out hoes, place soil +-- TODO Ignore group:flower +farming.registered_plants = {} + +farming.hoe_on_use = function(itemstack, user, pointed_thing, uses) + local pt = pointed_thing + -- check if pointing at a node + if not pt then + return + end + if pt.type ~= "node" then + return + end + + local under = minetest.get_node(pt.under) + local p = {x=pt.under.x, y=pt.under.y+1, z=pt.under.z} + local above = minetest.get_node(p) + + -- return if any of the nodes is not registered + if not minetest.registered_nodes[under.name] then + return + end + if not minetest.registered_nodes[above.name] then + return + end + + -- check if the node above the pointed thing is air + if above.name ~= "air" then + return + end + + -- check if pointing at soil + if minetest.get_item_group(under.name, "soil") ~= 1 then + return + end + + -- check if (wet) soil defined + local regN = minetest.registered_nodes + if regN[under.name].soil == nil or regN[under.name].soil.wet == nil or regN[under.name].soil.dry == nil then + return + end + + if minetest.is_protected(pt.under, user:get_player_name()) then + minetest.record_protection_violation(pt.under, user:get_player_name()) + return + end + if minetest.is_protected(pt.above, user:get_player_name()) then + minetest.record_protection_violation(pt.above, user:get_player_name()) + return + end + + -- turn the node into soil and play sound + minetest.set_node(pt.under, {name = regN[under.name].soil.dry}) + minetest.sound_play("default_dig_crumbly", { + pos = pt.under, + gain = 0.5, + }) + + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(user:get_player_name())) then + -- wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(65535/(uses-1)) + -- tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = pt.above, gain = 0.5}) + end + end + return itemstack +end + +-- Register new hoes +farming.register_hoe = function(name, def) + -- Check for : prefix (register new hoes in your mod's namespace) + if name:sub(1,1) ~= ":" then + name = ":" .. name + end + -- Check def table + if def.description == nil then + def.description = "Hoe" + end + if def.inventory_image == nil then + def.inventory_image = "unknown_item.png" + end + if def.recipe == nil then + def.recipe = { + {"air","air",""}, + {"","group:stick",""}, + {"","group:stick",""} + } + end + if def.max_uses == nil then + def.max_uses = 30 + end + -- Register the tool + minetest.register_tool(name, { + description = def.description, + inventory_image = def.inventory_image, + on_use = function(itemstack, user, pointed_thing) + return farming.hoe_on_use(itemstack, user, pointed_thing, def.max_uses) + end, + groups = def.groups, + sound = {breaks = "default_tool_breaks"}, + }) + -- Register its recipe + if def.material == nil then + minetest.register_craft({ + output = name:sub(2), + recipe = def.recipe + }) + else + minetest.register_craft({ + output = name:sub(2), + recipe = { + {def.material, def.material, ""}, + {"", "group:stick", ""}, + {"", "group:stick", ""} + } + }) + -- Reverse Recipe + minetest.register_craft({ + output = name:sub(2), + recipe = { + {"", def.material, def.material}, + {"", "group:stick", ""}, + {"", "group:stick", ""} + } + }) + end +end + +-- how often node timers for plants will tick, +/- some random value +local function tick(pos) + minetest.get_node_timer(pos):start(math.random(166, 286)) +end +-- how often a growth failure tick is retried (e.g. too dark) +local function tick_again(pos) + minetest.get_node_timer(pos):start(math.random(40, 80)) +end + +-- Seed placement +farming.place_seed = function(itemstack, placer, pointed_thing, plantname) + local pt = pointed_thing + -- check if pointing at a node + if not pt then + return itemstack + end + if pt.type ~= "node" then + return itemstack + end + + local under = minetest.get_node(pt.under) + local above = minetest.get_node(pt.above) + + if minetest.is_protected(pt.under, placer:get_player_name()) then + minetest.record_protection_violation(pt.under, placer:get_player_name()) + return + end + if minetest.is_protected(pt.above, placer:get_player_name()) then + minetest.record_protection_violation(pt.above, placer:get_player_name()) + return + end + + -- return if any of the nodes is not registered + if not minetest.registered_nodes[under.name] then + return itemstack + end + if not minetest.registered_nodes[above.name] then + return itemstack + end + + -- check if pointing at the top of the node + if pt.above.y ~= pt.under.y+1 then + return itemstack + end + + -- check if you can replace the node above the pointed node + if not minetest.registered_nodes[above.name].buildable_to then + return itemstack + end + + -- check if pointing at soil + if minetest.get_item_group(under.name, "soil") < 2 then + return itemstack + end + + -- add the node and remove 1 item from the itemstack + minetest.add_node(pt.above, {name = plantname, param2 = 1}) + tick(pt.above) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) then + itemstack:take_item() + end + return itemstack +end + +farming.grow_plant = function(pos, elapsed) + local node = minetest.get_node(pos) + local name = node.name + local def = minetest.registered_nodes[name] + + if not def.next_plant then + -- disable timer for fully grown plant + return + end + + -- grow seed + if minetest.get_item_group(node.name, "seed") and def.fertility then + local soil_node = minetest.get_node_or_nil({x = pos.x, y = pos.y - 1, z = pos.z}) + if not soil_node then + tick_again(pos) + return + end + -- omitted is a check for light, we assume seeds can germinate in the dark. + for _, v in pairs(def.fertility) do + if minetest.get_item_group(soil_node.name, v) ~= 0 then + local placenode = {name = def.next_plant} + if def.place_param2 then + placenode.param2 = def.place_param2 + end + minetest.swap_node(pos, placenode) + if minetest.registered_nodes[def.next_plant].next_plant then + tick(pos) + return + end + end + end + + return + end + + -- check if on wet soil + local below = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) + if minetest.get_item_group(below.name, "soil") < 3 then + tick_again(pos) + return + end + + -- check light + local light = minetest.get_node_light(pos) + if not light or light < def.minlight or light > def.maxlight then + tick_again(pos) + return + end + + -- grow + local placenode = {name = def.next_plant} + if def.place_param2 then + placenode.param2 = def.place_param2 + end + minetest.swap_node(pos, placenode) + + -- new timer needed? + if minetest.registered_nodes[def.next_plant].next_plant then + tick(pos) + end + return +end + +-- Register plants +farming.register_plant = function(name, def) + local mname = name:split(":")[1] + local pname = name:split(":")[2] + + -- Check def table + if not def.description then + def.description = "Seed" + end + if not def.inventory_image then + def.inventory_image = "unknown_item.png" + end + if not def.steps then + return nil + end + if not def.minlight then + def.minlight = 1 + end + if not def.maxlight then + def.maxlight = 14 + end + if not def.fertility then + def.fertility = {} + end + + farming.registered_plants[pname] = def + + -- Register seed + local lbm_nodes = {mname .. ":seed_" .. pname} + local g = {seed = 1, snappy = 3, attached_node = 1, flammable = 2} + for k, v in pairs(def.fertility) do + g[v] = 1 + end + minetest.register_node(":" .. mname .. ":seed_" .. pname, { + description = def.description, + tiles = {def.inventory_image}, + inventory_image = def.inventory_image, + wield_image = def.inventory_image, + drawtype = "signlike", + groups = g, + paramtype = "light", + paramtype2 = "wallmounted", + place_param2 = def.place_param2 or nil, -- this isn't actually used for placement + walkable = false, + sunlight_propagates = true, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + fertility = def.fertility, + sounds = default.node_sound_dirt_defaults({ + dig = {name = "", gain = 0}, + dug = {name = "default_grass_footstep", gain = 0.2}, + place = {name = "default_place_node", gain = 0.25}, + }), + + on_place = function(itemstack, placer, pointed_thing) + local under = pointed_thing.under + local node = minetest.get_node(under) + local udef = minetest.registered_nodes[node.name] + if udef and udef.on_rightclick and + not (placer and placer:get_player_control().sneak) then + return udef.on_rightclick(under, node, placer, itemstack, + pointed_thing) or itemstack + end + + return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname) + end, + next_plant = mname .. ":" .. pname .. "_1", + on_timer = farming.grow_plant, + minlight = def.minlight, + maxlight = def.maxlight, + }) + + -- Register harvest + minetest.register_craftitem(":" .. mname .. ":" .. pname, { + description = pname:gsub("^%l", string.upper), + inventory_image = mname .. "_" .. pname .. ".png", + groups = {flammable = 2}, + }) + + -- Register growing steps + for i = 1, def.steps do + local base_rarity = 1 + if def.steps ~= 1 then + base_rarity = 8 - (i - 1) * 7 / (def.steps - 1) + end + local drop = { + items = { + {items = {mname .. ":" .. pname}, rarity = base_rarity}, + {items = {mname .. ":" .. pname}, rarity = base_rarity * 2}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity}, + {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2}, + } + } + local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} + nodegroups[pname] = i + + local next_plant = nil + + if i < def.steps then + next_plant = mname .. ":" .. pname .. "_" .. (i + 1) + lbm_nodes[#lbm_nodes + 1] = mname .. ":" .. pname .. "_" .. i + end + + minetest.register_node(":" .. mname .. ":" .. pname .. "_" .. i, { + drawtype = "plantlike", + waving = 1, + tiles = {mname .. "_" .. pname .. "_" .. i .. ".png"}, + paramtype = "light", + paramtype2 = def.paramtype2 or nil, + place_param2 = def.place_param2 or nil, + walkable = false, + buildable_to = true, + drop = drop, + selection_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, -5/16, 0.5}, + }, + groups = nodegroups, + sounds = default.node_sound_leaves_defaults(), + next_plant = next_plant, + on_timer = farming.grow_plant, + minlight = def.minlight, + maxlight = def.maxlight, + }) + end + + -- replacement LBM for pre-nodetimer plants + minetest.register_lbm({ + name = ":" .. mname .. ":start_nodetimer_" .. pname, + nodenames = lbm_nodes, + action = function(pos, node) + tick_again(pos) + end, + }) + + -- Return + local r = { + seed = mname .. ":seed_" .. pname, + harvest = mname .. ":" .. pname + } + return r +end diff --git a/mods/farming/depends.txt b/mods/farming/depends.txt new file mode 100644 index 0000000..470ec30 --- /dev/null +++ b/mods/farming/depends.txt @@ -0,0 +1,2 @@ +default +wool diff --git a/mods/farming/hoes.lua b/mods/farming/hoes.lua new file mode 100644 index 0000000..5aae390 --- /dev/null +++ b/mods/farming/hoes.lua @@ -0,0 +1,42 @@ +farming.register_hoe(":farming:hoe_wood", { + description = "Wooden Hoe", + inventory_image = "farming_tool_woodhoe.png", + max_uses = 30, + material = "group:wood", + groups = {flammable = 2}, +}) + +farming.register_hoe(":farming:hoe_stone", { + description = "Stone Hoe", + inventory_image = "farming_tool_stonehoe.png", + max_uses = 90, + material = "group:stone" +}) + +farming.register_hoe(":farming:hoe_steel", { + description = "Steel Hoe", + inventory_image = "farming_tool_steelhoe.png", + max_uses = 200, + material = "default:steel_ingot" +}) + +farming.register_hoe(":farming:hoe_bronze", { + description = "Bronze Hoe", + inventory_image = "farming_tool_bronzehoe.png", + max_uses = 220, + material = "default:bronze_ingot" +}) + +farming.register_hoe(":farming:hoe_mese", { + description = "Mese Hoe", + inventory_image = "farming_tool_mesehoe.png", + max_uses = 350, + material = "default:mese_crystal" +}) + +farming.register_hoe(":farming:hoe_diamond", { + description = "Diamond Hoe", + inventory_image = "farming_tool_diamondhoe.png", + max_uses = 500, + material = "default:diamond" +}) diff --git a/mods/farming/init.lua b/mods/farming/init.lua new file mode 100644 index 0000000..97dc9b4 --- /dev/null +++ b/mods/farming/init.lua @@ -0,0 +1,109 @@ +-- Global farming namespace +farming = {} +farming.path = minetest.get_modpath("farming") + +-- Load files +dofile(farming.path .. "/api.lua") +dofile(farming.path .. "/nodes.lua") +dofile(farming.path .. "/hoes.lua") + +-- WHEAT +farming.register_plant("farming:wheat", { + description = "Wheat seed", + paramtype2 = "meshoptions", + inventory_image = "farming_wheat_seed.png", + steps = 8, + minlight = 13, + maxlight = default.LIGHT_MAX, + fertility = {"grassland"}, + groups = {flammable = 4}, + place_param2 = 3, +}) +minetest.register_craftitem("farming:flour", { + description = "Flour", + inventory_image = "farming_flour.png", + groups = {flammable = 1}, +}) + +minetest.register_craftitem("farming:bread", { + description = "Bread", + inventory_image = "farming_bread.png", + on_use = minetest.item_eat(5), + groups = {flammable = 2}, +}) + +minetest.register_craft({ + type = "shapeless", + output = "farming:flour", + recipe = {"farming:wheat", "farming:wheat", "farming:wheat", "farming:wheat"} +}) + +minetest.register_craft({ + type = "cooking", + cooktime = 15, + output = "farming:bread", + recipe = "farming:flour" +}) + +-- Cotton +farming.register_plant("farming:cotton", { + description = "Cotton seed", + inventory_image = "farming_cotton_seed.png", + steps = 8, + minlight = 13, + maxlight = default.LIGHT_MAX, + fertility = {"grassland", "desert"}, + groups = {flammable = 4}, +}) + +minetest.register_alias("farming:string", "farming:cotton") + +minetest.register_craft({ + output = "wool:white", + recipe = { + {"farming:cotton", "farming:cotton"}, + {"farming:cotton", "farming:cotton"}, + } +}) + +-- Straw +minetest.register_craft({ + output = "farming:straw 3", + recipe = { + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + {"farming:wheat", "farming:wheat", "farming:wheat"}, + } +}) + +minetest.register_craft({ + output = "farming:wheat 3", + recipe = { + {"farming:straw"}, + } +}) + +-- Fuels +minetest.register_craft({ + type = "fuel", + recipe = "farming:straw", + burntime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:wheat", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:cotton", + burntime = 1, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:hoe_wood", + burntime = 5, +}) diff --git a/mods/farming/license.txt b/mods/farming/license.txt new file mode 100644 index 0000000..8cbb63a --- /dev/null +++ b/mods/farming/license.txt @@ -0,0 +1,61 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 webdesigner97 +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +License of media (textures) +--------------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2012-2016 PilzAdam +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2015-2016 MasterGollum +Copyright (C) 2015-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua new file mode 100644 index 0000000..c969d31 --- /dev/null +++ b/mods/farming/nodes.lua @@ -0,0 +1,171 @@ +minetest.override_item("default:dirt", { + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:dirt_with_grass", { + soil = { + base = "default:dirt_with_grass", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:dirt_with_dry_grass", { + soil = { + base = "default:dirt_with_dry_grass", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:dirt_with_rainforest_litter", { + soil = { + base = "default:dirt_with_rainforest_litter", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.register_node("farming:soil", { + description = "Soil", + tiles = {"default_dirt.png^farming_soil.png", "default_dirt.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1, soil=2, grassland = 1, field = 1}, + sounds = default.node_sound_dirt_defaults(), + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.register_node("farming:soil_wet", { + description = "Wet Soil", + tiles = {"default_dirt.png^farming_soil_wet.png", "default_dirt.png^farming_soil_wet_side.png"}, + drop = "default:dirt", + groups = {crumbly=3, not_in_creative_inventory=1, soil=3, wet = 1, grassland = 1, field = 1}, + sounds = default.node_sound_dirt_defaults(), + soil = { + base = "default:dirt", + dry = "farming:soil", + wet = "farming:soil_wet" + } +}) + +minetest.override_item("default:desert_sand", { + groups = {crumbly=3, falling_node=1, sand=1, soil = 1}, + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) +minetest.register_node("farming:desert_sand_soil", { + description = "Desert Sand Soil", + drop = "default:desert_sand", + tiles = {"farming_desert_sand_soil.png", "default_desert_sand.png"}, + groups = {crumbly=3, not_in_creative_inventory = 1, falling_node=1, sand=1, soil = 2, desert = 1, field = 1}, + sounds = default.node_sound_sand_defaults(), + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) + +minetest.register_node("farming:desert_sand_soil_wet", { + description = "Wet Desert Sand Soil", + drop = "default:desert_sand", + tiles = {"farming_desert_sand_soil_wet.png", "farming_desert_sand_soil_wet_side.png"}, + groups = {crumbly=3, falling_node=1, sand=1, not_in_creative_inventory=1, soil=3, wet = 1, desert = 1, field = 1}, + sounds = default.node_sound_sand_defaults(), + soil = { + base = "default:desert_sand", + dry = "farming:desert_sand_soil", + wet = "farming:desert_sand_soil_wet" + } +}) + +minetest.register_node("farming:straw", { + description = "Straw", + tiles = {"farming_straw.png"}, + is_ground_content = false, + groups = {snappy=3, flammable=4, fall_damage_add_percent=-30}, + sounds = default.node_sound_leaves_defaults(), +}) + +minetest.register_abm({ + label = "Farming soil", + nodenames = {"group:field"}, + interval = 15, + chance = 4, + action = function(pos, node) + local n_def = minetest.registered_nodes[node.name] or nil + local wet = n_def.soil.wet or nil + local base = n_def.soil.base or nil + local dry = n_def.soil.dry or nil + if not n_def or not n_def.soil or not wet or not base or not dry then + return + end + + pos.y = pos.y + 1 + local nn = minetest.get_node_or_nil(pos) + if not nn or not nn.name then + return + end + local nn_def = minetest.registered_nodes[nn.name] or nil + pos.y = pos.y - 1 + + if nn_def and nn_def.walkable and minetest.get_item_group(nn.name, "plant") == 0 then + minetest.set_node(pos, {name = base}) + return + end + -- check if there is water nearby + local wet_lvl = minetest.get_item_group(node.name, "wet") + if minetest.find_node_near(pos, 3, {"group:water"}) then + -- if it is dry soil and not base node, turn it into wet soil + if wet_lvl == 0 then + minetest.set_node(pos, {name = wet}) + end + else + -- only turn back if there are no unloaded blocks (and therefore + -- possible water sources) nearby + if not minetest.find_node_near(pos, 3, {"ignore"}) then + -- turn it back into base if it is already dry + if wet_lvl == 0 then + -- only turn it back if there is no plant/seed on top of it + if minetest.get_item_group(nn.name, "plant") == 0 and minetest.get_item_group(nn.name, "seed") == 0 then + minetest.set_node(pos, {name = base}) + end + + -- if its wet turn it back into dry soil + elseif wet_lvl == 1 then + minetest.set_node(pos, {name = dry}) + end + end + end + end, +}) + + +for i = 1, 5 do + minetest.override_item("default:grass_"..i, {drop = { + max_items = 1, + items = { + {items = {'farming:seed_wheat'},rarity = 5}, + {items = {'default:grass_1'}}, + } + }}) +end + +minetest.override_item("default:junglegrass", {drop = { + max_items = 1, + items = { + {items = {'farming:seed_cotton'},rarity = 8}, + {items = {'default:junglegrass'}}, + } +}}) diff --git a/mods/farming/textures/farming_bread.png b/mods/farming/textures/farming_bread.png new file mode 100644 index 0000000..0c25678 Binary files /dev/null and b/mods/farming/textures/farming_bread.png differ diff --git a/mods/farming/textures/farming_cotton.png b/mods/farming/textures/farming_cotton.png new file mode 100644 index 0000000..e2bbfd7 Binary files /dev/null and b/mods/farming/textures/farming_cotton.png differ diff --git a/mods/farming/textures/farming_cotton_1.png b/mods/farming/textures/farming_cotton_1.png new file mode 100644 index 0000000..5fc2180 Binary files /dev/null and b/mods/farming/textures/farming_cotton_1.png differ diff --git a/mods/farming/textures/farming_cotton_2.png b/mods/farming/textures/farming_cotton_2.png new file mode 100644 index 0000000..db4f4a3 Binary files /dev/null and b/mods/farming/textures/farming_cotton_2.png differ diff --git a/mods/farming/textures/farming_cotton_3.png b/mods/farming/textures/farming_cotton_3.png new file mode 100644 index 0000000..df3d7a7 Binary files /dev/null and b/mods/farming/textures/farming_cotton_3.png differ diff --git a/mods/farming/textures/farming_cotton_4.png b/mods/farming/textures/farming_cotton_4.png new file mode 100644 index 0000000..f314b07 Binary files /dev/null and b/mods/farming/textures/farming_cotton_4.png differ diff --git a/mods/farming/textures/farming_cotton_5.png b/mods/farming/textures/farming_cotton_5.png new file mode 100644 index 0000000..3e89085 Binary files /dev/null and b/mods/farming/textures/farming_cotton_5.png differ diff --git a/mods/farming/textures/farming_cotton_6.png b/mods/farming/textures/farming_cotton_6.png new file mode 100644 index 0000000..f4bd4fb Binary files /dev/null and b/mods/farming/textures/farming_cotton_6.png differ diff --git a/mods/farming/textures/farming_cotton_7.png b/mods/farming/textures/farming_cotton_7.png new file mode 100644 index 0000000..466d40a Binary files /dev/null and b/mods/farming/textures/farming_cotton_7.png differ diff --git a/mods/farming/textures/farming_cotton_8.png b/mods/farming/textures/farming_cotton_8.png new file mode 100644 index 0000000..f835ba5 Binary files /dev/null and b/mods/farming/textures/farming_cotton_8.png differ diff --git a/mods/farming/textures/farming_cotton_seed.png b/mods/farming/textures/farming_cotton_seed.png new file mode 100644 index 0000000..f1d5b8a Binary files /dev/null and b/mods/farming/textures/farming_cotton_seed.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil.png b/mods/farming/textures/farming_desert_sand_soil.png new file mode 100644 index 0000000..3c09ef0 Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil_wet.png b/mods/farming/textures/farming_desert_sand_soil_wet.png new file mode 100644 index 0000000..facc83e Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil_wet.png differ diff --git a/mods/farming/textures/farming_desert_sand_soil_wet_side.png b/mods/farming/textures/farming_desert_sand_soil_wet_side.png new file mode 100644 index 0000000..41e5a04 Binary files /dev/null and b/mods/farming/textures/farming_desert_sand_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_flour.png b/mods/farming/textures/farming_flour.png new file mode 100644 index 0000000..b1a9783 Binary files /dev/null and b/mods/farming/textures/farming_flour.png differ diff --git a/mods/farming/textures/farming_soil.png b/mods/farming/textures/farming_soil.png new file mode 100644 index 0000000..5cd3e68 Binary files /dev/null and b/mods/farming/textures/farming_soil.png differ diff --git a/mods/farming/textures/farming_soil_wet.png b/mods/farming/textures/farming_soil_wet.png new file mode 100644 index 0000000..0b4487d Binary files /dev/null and b/mods/farming/textures/farming_soil_wet.png differ diff --git a/mods/farming/textures/farming_soil_wet_side.png b/mods/farming/textures/farming_soil_wet_side.png new file mode 100644 index 0000000..f0b1bd4 Binary files /dev/null and b/mods/farming/textures/farming_soil_wet_side.png differ diff --git a/mods/farming/textures/farming_straw.png b/mods/farming/textures/farming_straw.png new file mode 100644 index 0000000..f9f5fe7 Binary files /dev/null and b/mods/farming/textures/farming_straw.png differ diff --git a/mods/farming/textures/farming_tool_bronzehoe.png b/mods/farming/textures/farming_tool_bronzehoe.png new file mode 100644 index 0000000..2802d11 Binary files /dev/null and b/mods/farming/textures/farming_tool_bronzehoe.png differ diff --git a/mods/farming/textures/farming_tool_diamondhoe.png b/mods/farming/textures/farming_tool_diamondhoe.png new file mode 100644 index 0000000..66f1042 Binary files /dev/null and b/mods/farming/textures/farming_tool_diamondhoe.png differ diff --git a/mods/farming/textures/farming_tool_mesehoe.png b/mods/farming/textures/farming_tool_mesehoe.png new file mode 100644 index 0000000..4534fba Binary files /dev/null and b/mods/farming/textures/farming_tool_mesehoe.png differ diff --git a/mods/farming/textures/farming_tool_steelhoe.png b/mods/farming/textures/farming_tool_steelhoe.png new file mode 100644 index 0000000..d057af2 Binary files /dev/null and b/mods/farming/textures/farming_tool_steelhoe.png differ diff --git a/mods/farming/textures/farming_tool_stonehoe.png b/mods/farming/textures/farming_tool_stonehoe.png new file mode 100644 index 0000000..55d8123 Binary files /dev/null and b/mods/farming/textures/farming_tool_stonehoe.png differ diff --git a/mods/farming/textures/farming_tool_woodhoe.png b/mods/farming/textures/farming_tool_woodhoe.png new file mode 100644 index 0000000..a287152 Binary files /dev/null and b/mods/farming/textures/farming_tool_woodhoe.png differ diff --git a/mods/farming/textures/farming_wheat.png b/mods/farming/textures/farming_wheat.png new file mode 100644 index 0000000..1e0ad3b Binary files /dev/null and b/mods/farming/textures/farming_wheat.png differ diff --git a/mods/farming/textures/farming_wheat_1.png b/mods/farming/textures/farming_wheat_1.png new file mode 100644 index 0000000..c16ad94 Binary files /dev/null and b/mods/farming/textures/farming_wheat_1.png differ diff --git a/mods/farming/textures/farming_wheat_2.png b/mods/farming/textures/farming_wheat_2.png new file mode 100644 index 0000000..baddb4c Binary files /dev/null and b/mods/farming/textures/farming_wheat_2.png differ diff --git a/mods/farming/textures/farming_wheat_3.png b/mods/farming/textures/farming_wheat_3.png new file mode 100644 index 0000000..36ebb19 Binary files /dev/null and b/mods/farming/textures/farming_wheat_3.png differ diff --git a/mods/farming/textures/farming_wheat_4.png b/mods/farming/textures/farming_wheat_4.png new file mode 100644 index 0000000..735ed77 Binary files /dev/null and b/mods/farming/textures/farming_wheat_4.png differ diff --git a/mods/farming/textures/farming_wheat_5.png b/mods/farming/textures/farming_wheat_5.png new file mode 100644 index 0000000..f40b5f0 Binary files /dev/null and b/mods/farming/textures/farming_wheat_5.png differ diff --git a/mods/farming/textures/farming_wheat_6.png b/mods/farming/textures/farming_wheat_6.png new file mode 100644 index 0000000..e9c78e0 Binary files /dev/null and b/mods/farming/textures/farming_wheat_6.png differ diff --git a/mods/farming/textures/farming_wheat_7.png b/mods/farming/textures/farming_wheat_7.png new file mode 100644 index 0000000..cc26ca9 Binary files /dev/null and b/mods/farming/textures/farming_wheat_7.png differ diff --git a/mods/farming/textures/farming_wheat_8.png b/mods/farming/textures/farming_wheat_8.png new file mode 100644 index 0000000..d050093 Binary files /dev/null and b/mods/farming/textures/farming_wheat_8.png differ diff --git a/mods/farming/textures/farming_wheat_seed.png b/mods/farming/textures/farming_wheat_seed.png new file mode 100644 index 0000000..a9031fb Binary files /dev/null and b/mods/farming/textures/farming_wheat_seed.png differ diff --git a/mods/fire/README.txt b/mods/fire/README.txt new file mode 100644 index 0000000..099da1c --- /dev/null +++ b/mods/fire/README.txt @@ -0,0 +1,35 @@ +Minetest Game mod: fire +======================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures and sounds) +-------------------------------------- +Everything not listed in here: +Copyright (C) 2012 Perttu Ahola (celeron55) (CC BY-SA 3.0) + +Muadtralk (CC BY-SA 3.0) + fire_basic_flame_animated.png + +Gambit (CC BY-SA 3.0) + fire_flint_steel.png + +dobroide (CC BY 3.0) +http://www.freesound.org/people/dobroide/sounds/4211/ + fire_small.ogg + +Dynamicell (CC BY 3.0) +http://www.freesound.org/people/Dynamicell/sounds/17548/ + fire_large.ogg + fire_fire.*.ogg + +fire_small.ogg and fire_large.ogg are unused but kept temporarily to not break +other mods that may use them. + +Benboncan (CC BY 3.0) +https://www.freesound.org/people/Benboncan/sounds/66457/ + fire_flint_and_steel.ogg diff --git a/mods/fire/depends.txt b/mods/fire/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/fire/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/fire/init.lua b/mods/fire/init.lua new file mode 100644 index 0000000..f97636b --- /dev/null +++ b/mods/fire/init.lua @@ -0,0 +1,365 @@ +-- Global namespace for functions + +fire = {} + + +-- +-- Items +-- + +-- Flame nodes + +minetest.register_node("fire:basic_flame", { + drawtype = "firelike", + tiles = { + { + name = "fire_basic_flame_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1 + }, + }, + }, + inventory_image = "fire_basic_flame.png", + paramtype = "light", + light_source = 13, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + damage_per_second = 4, + groups = {igniter = 2, dig_immediate = 3, not_in_creative_inventory = 1}, + on_timer = function(pos) + local f = minetest.find_node_near(pos, 1, {"group:flammable"}) + if not f then + minetest.remove_node(pos) + return + end + -- Restart timer + return true + end, + drop = "", + + on_construct = function(pos) + minetest.get_node_timer(pos):start(math.random(30, 60)) + end, +}) + +minetest.register_node("fire:permanent_flame", { + description = "Permanent Flame", + drawtype = "firelike", + tiles = { + { + name = "fire_basic_flame_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1 + }, + }, + }, + inventory_image = "fire_basic_flame.png", + paramtype = "light", + light_source = 13, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + damage_per_second = 4, + groups = {igniter = 2, dig_immediate = 3}, + drop = "", +}) + + +-- Flint and steel + +minetest.register_tool("fire:flint_and_steel", { + description = "Flint and Steel", + inventory_image = "fire_flint_steel.png", + sound = {breaks = "default_tool_breaks"}, + + on_use = function(itemstack, user, pointed_thing) + local sound_pos = pointed_thing.above or user:get_pos() + minetest.sound_play( + "fire_flint_and_steel", + {pos = sound_pos, gain = 0.5, max_hear_distance = 8} + ) + local player_name = user:get_player_name() + if pointed_thing.type == "node" then + local node_under = minetest.get_node(pointed_thing.under).name + local nodedef = minetest.registered_nodes[node_under] + if not nodedef then + return + end + if minetest.is_protected(pointed_thing.under, player_name) then + minetest.chat_send_player(player_name, "This area is protected") + return + end + if nodedef.on_ignite then + nodedef.on_ignite(pointed_thing.under, user) + elseif minetest.get_item_group(node_under, "flammable") >= 1 + and minetest.get_node(pointed_thing.above).name == "air" then + minetest.set_node(pointed_thing.above, {name = "fire:basic_flame"}) + end + end + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) then + -- Wear tool + local wdef = itemstack:get_definition() + itemstack:add_wear(1000) + -- Tool break sound + if itemstack:get_count() == 0 and wdef.sound and wdef.sound.breaks then + minetest.sound_play(wdef.sound.breaks, {pos = sound_pos, gain = 0.5}) + end + return itemstack + end + end +}) + +minetest.register_craft({ + output = "fire:flint_and_steel", + recipe = { + {"default:flint", "default:steel_ingot"} + } +}) + + +-- Override coalblock to enable permanent flame above +-- Coalblock is non-flammable to avoid unwanted basic_flame nodes + +minetest.override_item("default:coalblock", { + after_destruct = function(pos, oldnode) + pos.y = pos.y + 1 + if minetest.get_node(pos).name == "fire:permanent_flame" then + minetest.remove_node(pos) + end + end, + on_ignite = function(pos, igniter) + local flame_pos = {x = pos.x, y = pos.y + 1, z = pos.z} + if minetest.get_node(flame_pos).name == "air" then + minetest.set_node(flame_pos, {name = "fire:permanent_flame"}) + end + end, +}) + + +-- +-- Sound +-- + +local flame_sound = minetest.settings:get_bool("flame_sound") +if flame_sound == nil then + -- Enable if no setting present + flame_sound = true +end + +if flame_sound then + + local handles = {} + local timer = 0 + + -- Parameters + + local radius = 8 -- Flame node search radius around player + local cycle = 3 -- Cycle time for sound updates + + -- Update sound for player + + function fire.update_player_sound(player) + local player_name = player:get_player_name() + -- Search for flame nodes in radius around player + local ppos = player:getpos() + local areamin = vector.subtract(ppos, radius) + local areamax = vector.add(ppos, radius) + local fpos, num = minetest.find_nodes_in_area( + areamin, + areamax, + {"fire:basic_flame", "fire:permanent_flame"} + ) + -- Total number of flames in radius + local flames = (num["fire:basic_flame"] or 0) + + (num["fire:permanent_flame"] or 0) + -- Stop previous sound + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + -- If flames + if flames > 0 then + -- Find centre of flame positions + local fposmid = fpos[1] + -- If more than 1 flame + if #fpos > 1 then + local fposmin = areamax + local fposmax = areamin + for i = 1, #fpos do + local fposi = fpos[i] + if fposi.x > fposmax.x then + fposmax.x = fposi.x + end + if fposi.y > fposmax.y then + fposmax.y = fposi.y + end + if fposi.z > fposmax.z then + fposmax.z = fposi.z + end + if fposi.x < fposmin.x then + fposmin.x = fposi.x + end + if fposi.y < fposmin.y then + fposmin.y = fposi.y + end + if fposi.z < fposmin.z then + fposmin.z = fposi.z + end + end + fposmid = vector.divide(vector.add(fposmin, fposmax), 2) + end + -- Play sound + local handle = minetest.sound_play( + "fire_fire", + { + pos = fposmid, + to_player = player_name, + gain = math.min(0.06 * (1 + flames * 0.125), 0.18), + max_hear_distance = 32, + loop = true, -- In case of lag + } + ) + -- Store sound handle for this player + if handle then + handles[player_name] = handle + end + end + end + + -- Cycle for updating players sounds + + minetest.register_globalstep(function(dtime) + timer = timer + dtime + if timer < cycle then + return + end + + timer = 0 + local players = minetest.get_connected_players() + for n = 1, #players do + fire.update_player_sound(players[n]) + end + end) + + -- Stop sound and clear handle on player leave + + minetest.register_on_leaveplayer(function(player) + local player_name = player:get_player_name() + if handles[player_name] then + minetest.sound_stop(handles[player_name]) + handles[player_name] = nil + end + end) +end + + +-- Deprecated function kept temporarily to avoid crashes if mod fire nodes call it + +function fire.update_sounds_around(pos) +end + + +-- +-- ABMs +-- + +-- Extinguish all flames quickly with water, snow, ice + +minetest.register_abm({ + label = "Extinguish flame", + nodenames = {"fire:basic_flame", "fire:permanent_flame"}, + neighbors = {"group:puts_out_fire"}, + interval = 3, + chance = 1, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + minetest.remove_node(pos) + minetest.sound_play("fire_extinguish_flame", + {pos = pos, max_hear_distance = 16, gain = 0.15}) + end, +}) + + +-- Enable the following ABMs according to 'enable fire' setting + +local fire_enabled = minetest.settings:get_bool("enable_fire") +if fire_enabled == nil then + -- enable_fire setting not specified, check for disable_fire + local fire_disabled = minetest.settings:get_bool("disable_fire") + if fire_disabled == nil then + -- Neither setting specified, check whether singleplayer + fire_enabled = minetest.is_singleplayer() + else + fire_enabled = not fire_disabled + end +end + +if not fire_enabled then + + -- Remove basic flames only if fire disabled + + minetest.register_abm({ + label = "Remove disabled fire", + nodenames = {"fire:basic_flame"}, + interval = 7, + chance = 1, + catch_up = false, + action = minetest.remove_node, + }) + +else -- Fire enabled + + -- Ignite neighboring nodes, add basic flames + + minetest.register_abm({ + label = "Ignite flame", + nodenames = {"group:flammable"}, + neighbors = {"group:igniter"}, + interval = 7, + chance = 12, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + -- If there is water or stuff like that around node, don't ignite + if minetest.find_node_near(pos, 1, {"group:puts_out_fire"}) then + return + end + local p = minetest.find_node_near(pos, 1, {"air"}) + if p then + minetest.set_node(p, {name = "fire:basic_flame"}) + end + end, + }) + + -- Remove flammable nodes around basic flame + + minetest.register_abm({ + label = "Remove flammable nodes", + nodenames = {"fire:basic_flame"}, + neighbors = "group:flammable", + interval = 5, + chance = 18, + catch_up = false, + action = function(pos, node, active_object_count, active_object_count_wider) + local p = minetest.find_node_near(pos, 1, {"group:flammable"}) + if p then + local flammable_node = minetest.get_node(p) + local def = minetest.registered_nodes[flammable_node.name] + if def.on_burn then + def.on_burn(p) + else + minetest.remove_node(p) + minetest.check_for_falling(p) + end + end + end, + }) + +end diff --git a/mods/fire/license.txt b/mods/fire/license.txt new file mode 100644 index 0000000..43f9cd7 --- /dev/null +++ b/mods/fire/license.txt @@ -0,0 +1,84 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures and sounds) +--------------------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Muadtralk +Copyright (C) 2013-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ + +----------------------- + +Attribution 3.0 Unported (CC BY 3.0) +Copyright (C) 2005 dobroide +Copyright (C) 2006 Dynamicell +Copyright (C) 2009 Benboncan + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by/3.0/ diff --git a/mods/fire/sounds/fire_extinguish_flame.1.ogg b/mods/fire/sounds/fire_extinguish_flame.1.ogg new file mode 100644 index 0000000..42506dd Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.1.ogg differ diff --git a/mods/fire/sounds/fire_extinguish_flame.2.ogg b/mods/fire/sounds/fire_extinguish_flame.2.ogg new file mode 100644 index 0000000..2747ab8 Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.2.ogg differ diff --git a/mods/fire/sounds/fire_extinguish_flame.3.ogg b/mods/fire/sounds/fire_extinguish_flame.3.ogg new file mode 100644 index 0000000..8baeac3 Binary files /dev/null and b/mods/fire/sounds/fire_extinguish_flame.3.ogg differ diff --git a/mods/fire/sounds/fire_fire.1.ogg b/mods/fire/sounds/fire_fire.1.ogg new file mode 100644 index 0000000..cbfee4c Binary files /dev/null and b/mods/fire/sounds/fire_fire.1.ogg differ diff --git a/mods/fire/sounds/fire_fire.2.ogg b/mods/fire/sounds/fire_fire.2.ogg new file mode 100644 index 0000000..e8d0eb1 Binary files /dev/null and b/mods/fire/sounds/fire_fire.2.ogg differ diff --git a/mods/fire/sounds/fire_fire.3.ogg b/mods/fire/sounds/fire_fire.3.ogg new file mode 100644 index 0000000..5cad3d9 Binary files /dev/null and b/mods/fire/sounds/fire_fire.3.ogg differ diff --git a/mods/fire/sounds/fire_flint_and_steel.ogg b/mods/fire/sounds/fire_flint_and_steel.ogg new file mode 100644 index 0000000..6996e16 Binary files /dev/null and b/mods/fire/sounds/fire_flint_and_steel.ogg differ diff --git a/mods/fire/sounds/fire_large.ogg b/mods/fire/sounds/fire_large.ogg new file mode 100644 index 0000000..fe78e62 Binary files /dev/null and b/mods/fire/sounds/fire_large.ogg differ diff --git a/mods/fire/sounds/fire_small.ogg b/mods/fire/sounds/fire_small.ogg new file mode 100644 index 0000000..5aac595 Binary files /dev/null and b/mods/fire/sounds/fire_small.ogg differ diff --git a/mods/fire/textures/fire_basic_flame.png b/mods/fire/textures/fire_basic_flame.png new file mode 100644 index 0000000..1da0702 Binary files /dev/null and b/mods/fire/textures/fire_basic_flame.png differ diff --git a/mods/fire/textures/fire_basic_flame_animated.png b/mods/fire/textures/fire_basic_flame_animated.png new file mode 100644 index 0000000..1cdd9fd Binary files /dev/null and b/mods/fire/textures/fire_basic_flame_animated.png differ diff --git a/mods/fire/textures/fire_flint_steel.png b/mods/fire/textures/fire_flint_steel.png new file mode 100644 index 0000000..c262ebc Binary files /dev/null and b/mods/fire/textures/fire_flint_steel.png differ diff --git a/mods/flowers/README.txt b/mods/flowers/README.txt new file mode 100644 index 0000000..2a5e4de --- /dev/null +++ b/mods/flowers/README.txt @@ -0,0 +1,26 @@ +Minetest Game mod: flowers +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Ironzorg (MIT) and VanessaE (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +RHRhino (CC BY-SA 3.0): + flowers_dandelion_white.png + flowers_dandelion_yellow.png + flowers_geranium.png + flowers_rose.png + flowers_tulip.png + flowers_viola.png + +Gambit (CC BY-SA 3.0): + flowers_mushroom_brown.png + flowers_mushroom_red.png + flowers_waterlily.png + +yyt16384 (CC BY-SA 3.0): + flowers_waterlily_bottom.png, derived from Gambit's texture diff --git a/mods/flowers/depends.txt b/mods/flowers/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/flowers/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/flowers/init.lua b/mods/flowers/init.lua new file mode 100644 index 0000000..cb5b219 --- /dev/null +++ b/mods/flowers/init.lua @@ -0,0 +1,304 @@ +-- Minetest 0.4 mod: default +-- See README.txt for licensing and other information. + + +-- Namespace for functions + +flowers = {} + + +-- Map Generation + +dofile(minetest.get_modpath("flowers") .. "/mapgen.lua") + + +-- +-- Flowers +-- + +-- Aliases for original flowers mod + +minetest.register_alias("flowers:flower_rose", "flowers:rose") +minetest.register_alias("flowers:flower_tulip", "flowers:tulip") +minetest.register_alias("flowers:flower_dandelion_yellow", "flowers:dandelion_yellow") +minetest.register_alias("flowers:flower_geranium", "flowers:geranium") +minetest.register_alias("flowers:flower_viola", "flowers:viola") +minetest.register_alias("flowers:flower_dandelion_white", "flowers:dandelion_white") + + +-- Flower registration + +local function add_simple_flower(name, desc, box, f_groups) + -- Common flowers' groups + f_groups.snappy = 3 + f_groups.flower = 1 + f_groups.flora = 1 + f_groups.attached_node = 1 + + minetest.register_node("flowers:" .. name, { + description = desc, + drawtype = "plantlike", + waving = 1, + tiles = {"flowers_" .. name .. ".png"}, + inventory_image = "flowers_" .. name .. ".png", + wield_image = "flowers_" .. name .. ".png", + sunlight_propagates = true, + paramtype = "light", + walkable = false, + buildable_to = true, + stack_max = 99, + groups = f_groups, + sounds = default.node_sound_leaves_defaults(), + selection_box = { + type = "fixed", + fixed = box + } + }) +end + +flowers.datas = { + { + "rose", + "Rose", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 5 / 16, 2 / 16}, + {color_red = 1, flammable = 1} + }, + { + "tulip", + "Orange Tulip", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 3 / 16, 2 / 16}, + {color_orange = 1, flammable = 1} + }, + { + "dandelion_yellow", + "Yellow Dandelion", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 4 / 16, 2 / 16}, + {color_yellow = 1, flammable = 1} + }, + { + "geranium", + "Blue Geranium", + {-2 / 16, -0.5, -2 / 16, 2 / 16, 2 / 16, 2 / 16}, + {color_blue = 1, flammable = 1} + }, + { + "viola", + "Viola", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -1 / 16, 5 / 16}, + {color_violet = 1, flammable = 1} + }, + { + "dandelion_white", + "White dandelion", + {-5 / 16, -0.5, -5 / 16, 5 / 16, -2 / 16, 5 / 16}, + {color_white = 1, flammable = 1} + }, +} + +for _,item in pairs(flowers.datas) do + add_simple_flower(unpack(item)) +end + + +-- Flower spread +-- Public function to enable override by mods + +function flowers.flower_spread(pos, node) + pos.y = pos.y - 1 + local under = minetest.get_node(pos) + pos.y = pos.y + 1 + -- Replace flora with dry shrub in desert sand and silver sand, + -- as this is the only way to generate them. + -- However, preserve grasses in sand dune biomes. + if minetest.get_item_group(under.name, "sand") == 1 and + under.name ~= "default:sand" then + minetest.set_node(pos, {name = "default:dry_shrub"}) + return + end + + if minetest.get_item_group(under.name, "soil") == 0 then + return + end + + local light = minetest.get_node_light(pos) + if not light or light < 13 then + return + end + + local pos0 = vector.subtract(pos, 4) + local pos1 = vector.add(pos, 4) + if #minetest.find_nodes_in_area(pos0, pos1, "group:flora") > 3 then + return + end + + local soils = minetest.find_nodes_in_area_under_air( + pos0, pos1, "group:soil") + if #soils > 0 then + local seedling = soils[math.random(#soils)] + local seedling_above = + {x = seedling.x, y = seedling.y + 1, z = seedling.z} + light = minetest.get_node_light(seedling_above) + if not light or light < 13 or + -- Desert sand is in the soil group + minetest.get_node(seedling).name == "default:desert_sand" then + return + end + + minetest.set_node(seedling_above, {name = node.name}) + end +end + +minetest.register_abm({ + label = "Flower spread", + nodenames = {"group:flora"}, + interval = 13, + chance = 96, + action = function(...) + flowers.flower_spread(...) + end, +}) + + +-- +-- Mushrooms +-- + +minetest.register_node("flowers:mushroom_red", { + description = "Red Mushroom", + tiles = {"flowers_mushroom_red.png"}, + inventory_image = "flowers_mushroom_red.png", + wield_image = "flowers_mushroom_red.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(-5), + selection_box = { + type = "fixed", + fixed = {-4 / 16, -0.5, -4 / 16, 4 / 16, -1 / 16, 4 / 16}, + } +}) + +minetest.register_node("flowers:mushroom_brown", { + description = "Brown Mushroom", + tiles = {"flowers_mushroom_brown.png"}, + inventory_image = "flowers_mushroom_brown.png", + wield_image = "flowers_mushroom_brown.png", + drawtype = "plantlike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + buildable_to = true, + groups = {snappy = 3, attached_node = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + on_use = minetest.item_eat(1), + selection_box = { + type = "fixed", + fixed = {-3 / 16, -0.5, -3 / 16, 3 / 16, -2 / 16, 3 / 16}, + } +}) + + +-- Mushroom spread and death + +minetest.register_abm({ + label = "Mushroom spread", + nodenames = {"flowers:mushroom_brown", "flowers:mushroom_red"}, + interval = 11, + chance = 50, + action = function(pos, node) + if minetest.get_node_light(pos, nil) == 15 then + minetest.remove_node(pos) + return + end + local random = { + x = pos.x + math.random(-2, 2), + y = pos.y + math.random(-1, 1), + z = pos.z + math.random(-2, 2) + } + local random_node = minetest.get_node_or_nil(random) + if not random_node or random_node.name ~= "air" then + return + end + local node_under = minetest.get_node_or_nil({x = random.x, + y = random.y - 1, z = random.z}) + if not node_under then + return + end + + if (minetest.get_item_group(node_under.name, "soil") ~= 0 or + minetest.get_item_group(node_under.name, "tree") ~= 0) and + minetest.get_node_light(pos, 0.5) <= 3 and + minetest.get_node_light(random, 0.5) <= 3 then + minetest.set_node(random, {name = node.name}) + end + end +}) + + +-- These old mushroom related nodes can be simplified now + +minetest.register_alias("flowers:mushroom_spores_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_spores_red", "flowers:mushroom_red") +minetest.register_alias("flowers:mushroom_fertile_brown", "flowers:mushroom_brown") +minetest.register_alias("flowers:mushroom_fertile_red", "flowers:mushroom_red") +minetest.register_alias("mushroom:brown_natural", "flowers:mushroom_brown") +minetest.register_alias("mushroom:red_natural", "flowers:mushroom_red") + + +-- +-- Waterlily +-- + +minetest.register_node("flowers:waterlily", { + description = "Waterlily", + drawtype = "nodebox", + paramtype = "light", + paramtype2 = "facedir", + tiles = {"flowers_waterlily.png", "flowers_waterlily_bottom.png"}, + inventory_image = "flowers_waterlily.png", + wield_image = "flowers_waterlily.png", + liquids_pointable = true, + walkable = false, + buildable_to = true, + sunlight_propagates = true, + floodable = true, + groups = {snappy = 3, flower = 1, flammable = 1}, + sounds = default.node_sound_leaves_defaults(), + node_placement_prediction = "", + node_box = { + type = "fixed", + fixed = {-0.5, -31 / 64, -0.5, 0.5, -15 / 32, 0.5} + }, + selection_box = { + type = "fixed", + fixed = {-7 / 16, -0.5, -7 / 16, 7 / 16, -15 / 32, 7 / 16} + }, + + on_place = function(itemstack, placer, pointed_thing) + local pos = pointed_thing.above + local node = minetest.get_node(pointed_thing.under).name + local def = minetest.registered_nodes[node] + local player_name = placer:get_player_name() + + if def and def.liquidtype == "source" and + minetest.get_item_group(node, "water") > 0 then + if not minetest.is_protected(pos, player_name) then + minetest.set_node(pos, {name = "flowers:waterlily", + param2 = math.random(0, 3)}) + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(player_name)) then + itemstack:take_item() + end + else + minetest.chat_send_player(player_name, "Node is protected") + minetest.record_protection_violation(pos, player_name) + end + end + + return itemstack + end +}) diff --git a/mods/flowers/license.txt b/mods/flowers/license.txt new file mode 100644 index 0000000..d301162 --- /dev/null +++ b/mods/flowers/license.txt @@ -0,0 +1,62 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Ironzorg, VanessaE +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 RHRhino +Copyright (C) 2015-2016 Gambit +Copyright (C) 2016 yyt16384 + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/flowers/mapgen.lua b/mods/flowers/mapgen.lua new file mode 100644 index 0000000..2b96090 --- /dev/null +++ b/mods/flowers/mapgen.lua @@ -0,0 +1,171 @@ +-- +-- Mgv6 +-- + +local function register_mgv6_flower(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.006, + spread = {x = 100, y = 100, z = 100}, + seed = 436, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "flowers:"..name, + }) +end + +local function register_mgv6_mushroom(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.04, + spread = {x = 100, y = 100, z = 100}, + seed = 7133, + octaves = 3, + persist = 0.6 + }, + y_min = 1, + y_max = 30, + decoration = "flowers:"..name, + spawn_by = "default:tree", + num_spawn_by = 1, + }) +end + +local function register_mgv6_waterlily() + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.12, + scale = 0.3, + spread = {x = 100, y = 100, z = 100}, + seed = 33, + octaves = 3, + persist = 0.7 + }, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("flowers").."/schematics/waterlily.mts", + rotation = "random", + }) +end + +function flowers.register_mgv6_decorations() + register_mgv6_flower("rose") + register_mgv6_flower("tulip") + register_mgv6_flower("dandelion_yellow") + register_mgv6_flower("geranium") + register_mgv6_flower("viola") + register_mgv6_flower("dandelion_white") + + register_mgv6_mushroom("mushroom_brown") + register_mgv6_mushroom("mushroom_red") + + register_mgv6_waterlily() +end + + +-- +-- All other biome API mapgens +-- + +local function register_flower(seed, name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = -0.015, + scale = 0.025, + spread = {x = 200, y = 200, z = 200}, + seed = seed, + octaves = 3, + persist = 0.6 + }, + biomes = {"grassland", "deciduous_forest", "coniferous_forest", + "floatland_grassland", "floatland_coniferous_forest"}, + y_min = 1, + y_max = 31000, + decoration = "flowers:"..name, + }) +end + +local function register_mushroom(name) + minetest.register_decoration({ + deco_type = "simple", + place_on = {"default:dirt_with_grass"}, + sidelen = 16, + noise_params = { + offset = 0, + scale = 0.006, + spread = {x = 250, y = 250, z = 250}, + seed = 2, + octaves = 3, + persist = 0.66 + }, + biomes = {"deciduous_forest", "coniferous_forest", + "floatland_coniferous_forest"}, + y_min = 1, + y_max = 31000, + decoration = "flowers:"..name, + }) +end + +local function register_waterlily() + minetest.register_decoration({ + deco_type = "schematic", + place_on = {"default:dirt"}, + sidelen = 16, + noise_params = { + offset = -0.12, + scale = 0.3, + spread = {x = 200, y = 200, z = 200}, + seed = 33, + octaves = 3, + persist = 0.7 + }, + biomes = {"rainforest_swamp", "savanna_shore", "deciduous_forest_shore"}, + y_min = 0, + y_max = 0, + schematic = minetest.get_modpath("flowers") .. "/schematics/waterlily.mts", + rotation = "random", + }) +end + +function flowers.register_decorations() + register_flower(436, "rose") + register_flower(19822, "tulip") + register_flower(1220999, "dandelion_yellow") + register_flower(36662, "geranium") + register_flower(1133, "viola") + register_flower(73133, "dandelion_white") + + register_mushroom("mushroom_brown") + register_mushroom("mushroom_red") + + register_waterlily() +end + + +-- +-- Detect mapgen to select functions +-- + +local mg_name = minetest.get_mapgen_setting("mg_name") +if mg_name == "v6" then + flowers.register_mgv6_decorations() +else + flowers.register_decorations() +end diff --git a/mods/flowers/schematics/waterlily.mts b/mods/flowers/schematics/waterlily.mts new file mode 100644 index 0000000..69e1d8e Binary files /dev/null and b/mods/flowers/schematics/waterlily.mts differ diff --git a/mods/flowers/textures/flowers_dandelion_white.png b/mods/flowers/textures/flowers_dandelion_white.png new file mode 100644 index 0000000..1bc02fb Binary files /dev/null and b/mods/flowers/textures/flowers_dandelion_white.png differ diff --git a/mods/flowers/textures/flowers_dandelion_yellow.png b/mods/flowers/textures/flowers_dandelion_yellow.png new file mode 100644 index 0000000..ec11c1c Binary files /dev/null and b/mods/flowers/textures/flowers_dandelion_yellow.png differ diff --git a/mods/flowers/textures/flowers_geranium.png b/mods/flowers/textures/flowers_geranium.png new file mode 100644 index 0000000..88de1d7 Binary files /dev/null and b/mods/flowers/textures/flowers_geranium.png differ diff --git a/mods/flowers/textures/flowers_mushroom_brown.png b/mods/flowers/textures/flowers_mushroom_brown.png new file mode 100644 index 0000000..33ffcd4 Binary files /dev/null and b/mods/flowers/textures/flowers_mushroom_brown.png differ diff --git a/mods/flowers/textures/flowers_mushroom_red.png b/mods/flowers/textures/flowers_mushroom_red.png new file mode 100644 index 0000000..a68f5d5 Binary files /dev/null and b/mods/flowers/textures/flowers_mushroom_red.png differ diff --git a/mods/flowers/textures/flowers_rose.png b/mods/flowers/textures/flowers_rose.png new file mode 100644 index 0000000..e3b841d Binary files /dev/null and b/mods/flowers/textures/flowers_rose.png differ diff --git a/mods/flowers/textures/flowers_tulip.png b/mods/flowers/textures/flowers_tulip.png new file mode 100644 index 0000000..471fcd3 Binary files /dev/null and b/mods/flowers/textures/flowers_tulip.png differ diff --git a/mods/flowers/textures/flowers_viola.png b/mods/flowers/textures/flowers_viola.png new file mode 100644 index 0000000..ca2d750 Binary files /dev/null and b/mods/flowers/textures/flowers_viola.png differ diff --git a/mods/flowers/textures/flowers_waterlily.png b/mods/flowers/textures/flowers_waterlily.png new file mode 100644 index 0000000..305c445 Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily.png differ diff --git a/mods/flowers/textures/flowers_waterlily_bottom.png b/mods/flowers/textures/flowers_waterlily_bottom.png new file mode 100644 index 0000000..3dbeaf4 Binary files /dev/null and b/mods/flowers/textures/flowers_waterlily_bottom.png differ diff --git a/mods/give_initial_stuff/README.txt b/mods/give_initial_stuff/README.txt new file mode 100644 index 0000000..cbd240f --- /dev/null +++ b/mods/give_initial_stuff/README.txt @@ -0,0 +1,8 @@ +Minetest Game mod: give_initial_stuff +===================================== +See license.txt for license information. + +Authors of source code +---------------------- +Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) diff --git a/mods/give_initial_stuff/depends.txt b/mods/give_initial_stuff/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/mods/give_initial_stuff/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/mods/give_initial_stuff/init.lua b/mods/give_initial_stuff/init.lua new file mode 100644 index 0000000..4815bd8 --- /dev/null +++ b/mods/give_initial_stuff/init.lua @@ -0,0 +1,44 @@ +local stuff_string = minetest.settings:get("initial_stuff") or + "default:pick_steel,default:axe_steel,default:shovel_steel," .. + "default:torch 99,default:cobble 99" + +give_initial_stuff = { + items = {} +} + +function give_initial_stuff.give(player) + minetest.log("action", + "Giving initial stuff to player " .. player:get_player_name()) + local inv = player:get_inventory() + for _, stack in ipairs(give_initial_stuff.items) do + inv:add_item("main", stack) + end +end + +function give_initial_stuff.add(stack) + give_initial_stuff.items[#give_initial_stuff.items + 1] = ItemStack(stack) +end + +function give_initial_stuff.clear() + give_initial_stuff.items = {} +end + +function give_initial_stuff.add_from_csv(str) + local items = str:split(",") + for _, itemname in ipairs(items) do + give_initial_stuff.add(itemname) + end +end + +function give_initial_stuff.set_list(list) + give_initial_stuff.items = list +end + +function give_initial_stuff.get_list() + return give_initial_stuff.items +end + +give_initial_stuff.add_from_csv(stuff_string) +if minetest.settings:get_bool("give_initial_stuff") then + minetest.register_on_newplayer(give_initial_stuff.give) +end diff --git a/mods/give_initial_stuff/license.txt b/mods/give_initial_stuff/license.txt new file mode 100644 index 0000000..8134c92 --- /dev/null +++ b/mods/give_initial_stuff/license.txt @@ -0,0 +1,25 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/killme/init.lua b/mods/killme/init.lua new file mode 100644 index 0000000..9b67475 --- /dev/null +++ b/mods/killme/init.lua @@ -0,0 +1,24 @@ +minetest.register_chatcommand("killme", { + description = "Kill yourself to respawn", + func = function(name) + local player = minetest.get_player_by_name(name) + if player then + if minetest.settings:get_bool("enable_damage") then + player:set_hp(0) + return true + else + for _, callback in pairs(core.registered_on_respawnplayers) do + if callback(player) then + return true + end + end + + -- There doesn't seem to be a way to get a default spawn pos from the lua API + return false, "No static_spawnpoint defined" + end + else + -- Show error message if used when not logged in, eg: from IRC mod + return false, "You need to be online to be killed!" + end + end +}) diff --git a/mods/mapfix/LICENSE b/mods/mapfix/LICENSE new file mode 100644 index 0000000..cb15575 --- /dev/null +++ b/mods/mapfix/LICENSE @@ -0,0 +1,4 @@ +GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + +See http://www.gnu.org/licenses/gpl-3.0.en.html diff --git a/mods/mapfix/README.md b/mods/mapfix/README.md new file mode 100644 index 0000000..2ea9d90 --- /dev/null +++ b/mods/mapfix/README.md @@ -0,0 +1,13 @@ +#mapfix + +Fix some map errors (flow and light problems) + +![Before](http://i.imgur.com/T3csYME.png) +![After](http://i.imgur.com/d0V0aO7.png) +Look at the water and the jungle trunk at the center. + + +##minetest.conf settings +* mapfix_default_size (by default 40) : size used when omitted +* mapfix_max_size (by default 50) : maximum size allowed for players +* mapfix_delay (by default 15) : minimal delay in seconds between 2 "/mapfix" (to avoid server freezing) \ No newline at end of file diff --git a/mods/mapfix/description.txt b/mods/mapfix/description.txt new file mode 100644 index 0000000..0b43266 --- /dev/null +++ b/mods/mapfix/description.txt @@ -0,0 +1 @@ +Fix some map errors (flow and light problems) diff --git a/mods/mapfix/init.lua b/mods/mapfix/init.lua new file mode 100644 index 0000000..10fa0f6 --- /dev/null +++ b/mods/mapfix/init.lua @@ -0,0 +1,48 @@ +local function mapfix(minp, maxp) + local vm = minetest.get_voxel_manip(minp, maxp) + vm:update_liquids() + vm:write_to_map() + vm:update_map() + local emin, emax = vm:get_emerged_area() + print(minetest.pos_to_string(emin), minetest.pos_to_string(emax)) +end + +local previous = os.time() + +local default_size = tonumber(minetest.settings:get("mapfix_default_size")) or 24 +local max_size = tonumber(minetest.settings:get("mapfix_max_size")) or 32 +local delay = tonumber(minetest.settings:get("mapfix_delay")) or 15 + +minetest.register_chatcommand("mapfix", { + params = "", + description = "Recalculate the flowing liquids and the light of a chunk", + func = function(name, param) + local pos = vector.round(minetest.get_player_by_name(name):getpos()) + local size = tonumber(param) or default_size + + if size >= 121 then + return false, "Radius is too big" + end + local privs = minetest.check_player_privs(name, {server=true}) + local time = os.time() + + if not privs then + if size > max_size then + return false, "You need the server privilege to exceed the radius of " .. max_size .. " blocks" + elseif time - previous < delay then + return false, "Wait at least " .. delay .. " seconds from the previous \"/mapfix\"." + end + previous = time + end + + minetest.log("action", name .. " uses mapfix at " .. minetest.pos_to_string(vector.round(pos)) .. " with radius " .. size) + + size = math.max(math.floor(size - 8), 0) -- When passed to get_voxel_manip, positions are rounded up, to a multiple of 16 nodes in each direction. By subtracting 8 it's rounded to the nearest chunk border. max is used to avoid negative radius. + + local minp = vector.subtract(pos, size) + local maxp = vector.add(pos, size) + + mapfix(minp, maxp) + return true, "Done." + end, +}) diff --git a/mods/mapfix/mod.conf b/mods/mapfix/mod.conf new file mode 100644 index 0000000..cc610a4 --- /dev/null +++ b/mods/mapfix/mod.conf @@ -0,0 +1 @@ +name = mapfix diff --git a/mods/screwdriver/README.txt b/mods/screwdriver/README.txt new file mode 100644 index 0000000..9d39c58 --- /dev/null +++ b/mods/screwdriver/README.txt @@ -0,0 +1,13 @@ +Minetest Game mod: screwdriver +============================== +See license.txt for license information. + +License of source code +---------------------- +Originally by RealBadAngel, Maciej Kasatkin (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +License of media (textures) +--------------------------- +Created by Gambit (CC BY-SA 3.0): + screwdriver.png diff --git a/mods/screwdriver/init.lua b/mods/screwdriver/init.lua new file mode 100644 index 0000000..e76f054 --- /dev/null +++ b/mods/screwdriver/init.lua @@ -0,0 +1,170 @@ +screwdriver = {} + +screwdriver.ROTATE_FACE = 1 +screwdriver.ROTATE_AXIS = 2 +screwdriver.disallow = function(pos, node, user, mode, new_param2) + return false +end +screwdriver.rotate_simple = function(pos, node, user, mode, new_param2) + if mode ~= screwdriver.ROTATE_FACE then + return false + end +end + +-- For attached wallmounted nodes: returns true if rotation is valid +-- simplified version of minetest:builtin/game/falling.lua#L148. +local function check_attached_node(pos, rotation) + local d = minetest.wallmounted_to_dir(rotation) + local p2 = vector.add(pos, d) + local n = minetest.get_node(p2).name + local def2 = minetest.registered_nodes[n] + if def2 and not def2.walkable then + return false + end + return true +end + +screwdriver.rotate = {} + +local facedir_tbl = { + [screwdriver.ROTATE_FACE] = { + [0] = 1, [1] = 2, [2] = 3, [3] = 0, + [4] = 5, [5] = 6, [6] = 7, [7] = 4, + [8] = 9, [9] = 10, [10] = 11, [11] = 8, + [12] = 13, [13] = 14, [14] = 15, [15] = 12, + [16] = 17, [17] = 18, [18] = 19, [19] = 16, + [20] = 21, [21] = 22, [22] = 23, [23] = 20, + }, + [screwdriver.ROTATE_AXIS] = { + [0] = 4, [1] = 4, [2] = 4, [3] = 4, + [4] = 8, [5] = 8, [6] = 8, [7] = 8, + [8] = 12, [9] = 12, [10] = 12, [11] = 12, + [12] = 16, [13] = 16, [14] = 16, [15] = 16, + [16] = 20, [17] = 20, [18] = 20, [19] = 20, + [20] = 0, [21] = 0, [22] = 0, [23] = 0, + }, +} + +screwdriver.rotate.facedir = function(pos, node, mode) + local rotation = node.param2 % 32 -- get first 5 bits + local other = node.param2 - rotation + rotation = facedir_tbl[mode][rotation] or 0 + return rotation + other +end + +screwdriver.rotate.colorfacedir = screwdriver.rotate.facedir + +local wallmounted_tbl = { + [screwdriver.ROTATE_FACE] = {[2] = 5, [3] = 4, [4] = 2, [5] = 3, [1] = 0, [0] = 1}, + [screwdriver.ROTATE_AXIS] = {[2] = 5, [3] = 4, [4] = 2, [5] = 1, [1] = 0, [0] = 3} +} + +screwdriver.rotate.wallmounted = function(pos, node, mode) + local rotation = node.param2 % 8 -- get first 3 bits + local other = node.param2 - rotation + rotation = wallmounted_tbl[mode][rotation] or 0 + if minetest.get_item_group(node.name, "attached_node") ~= 0 then + -- find an acceptable orientation + for i = 1, 5 do + if not check_attached_node(pos, rotation) then + rotation = wallmounted_tbl[mode][rotation] or 0 + else + break + end + end + end + return rotation + other +end + +screwdriver.rotate.colorwallmounted = screwdriver.rotate.wallmounted + +-- Handles rotation +screwdriver.handler = function(itemstack, user, pointed_thing, mode, uses) + if pointed_thing.type ~= "node" then + return + end + + local pos = pointed_thing.under + + if minetest.is_protected(pos, user:get_player_name()) then + minetest.record_protection_violation(pos, user:get_player_name()) + return + end + + local node = minetest.get_node(pos) + local ndef = minetest.registered_nodes[node.name] + if not ndef then + return itemstack + end + -- can we rotate this paramtype2? + local fn = screwdriver.rotate[ndef.paramtype2] + if not fn and not ndef.on_rotate then + return itemstack + end + + local should_rotate = true + local new_param2 + if fn then + new_param2 = fn(pos, node, mode) + else + new_param2 = node.param2 + end + + -- Node provides a handler, so let the handler decide instead if the node can be rotated + if ndef.on_rotate then + -- Copy pos and node because callback can modify it + local result = ndef.on_rotate(vector.new(pos), + {name = node.name, param1 = node.param1, param2 = node.param2}, + user, mode, new_param2) + if result == false then -- Disallow rotation + return itemstack + elseif result == true then + should_rotate = false + end + elseif ndef.on_rotate == false then + return itemstack + elseif ndef.can_dig and not ndef.can_dig(pos, user) then + return itemstack + end + + if should_rotate and new_param2 ~= node.param2 then + node.param2 = new_param2 + minetest.swap_node(pos, node) + minetest.check_for_falling(pos) + end + + if not (creative and creative.is_enabled_for + and creative.is_enabled_for(user:get_player_name())) then + itemstack:add_wear(65535 / ((uses or 200) - 1)) + end + + return itemstack +end + +-- Screwdriver +minetest.register_tool("screwdriver:screwdriver", { + description = "Screwdriver (left-click rotates face, right-click rotates axis)", + inventory_image = "screwdriver.png", + on_use = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_FACE, 200) + return itemstack + end, + on_place = function(itemstack, user, pointed_thing) + screwdriver.handler(itemstack, user, pointed_thing, screwdriver.ROTATE_AXIS, 200) + return itemstack + end, +}) + + +minetest.register_craft({ + output = "screwdriver:screwdriver", + recipe = { + {"default:steel_ingot"}, + {"group:stick"} + } +}) + +minetest.register_alias("screwdriver:screwdriver1", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver2", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver3", "screwdriver:screwdriver") +minetest.register_alias("screwdriver:screwdriver4", "screwdriver:screwdriver") diff --git a/mods/screwdriver/license.txt b/mods/screwdriver/license.txt new file mode 100644 index 0000000..d9b721b --- /dev/null +++ b/mods/screwdriver/license.txt @@ -0,0 +1,50 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2013-2016 RealBadAngel, Maciej Kasatkin +Copyright (C) 2013-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2013-2016 Gambit + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/screwdriver/textures/screwdriver.png b/mods/screwdriver/textures/screwdriver.png new file mode 100644 index 0000000..b2a56d5 Binary files /dev/null and b/mods/screwdriver/textures/screwdriver.png differ diff --git a/mods/sethome/README.txt b/mods/sethome/README.txt new file mode 100644 index 0000000..6f0a282 --- /dev/null +++ b/mods/sethome/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: sethome +========================== +See license.txt for license information. + +Authors of source code +---------------------- +sfan5 (MIT) diff --git a/mods/sethome/init.lua b/mods/sethome/init.lua new file mode 100644 index 0000000..13a33e5 --- /dev/null +++ b/mods/sethome/init.lua @@ -0,0 +1,97 @@ + +sethome = {} + +local homes_file = minetest.get_worldpath() .. "/homes" +local homepos = {} + +local function loadhomes() + local input = io.open(homes_file, "r") + if not input then + return -- no longer an error + end + + -- Iterate over all stored positions in the format "x y z player" for each line + for pos, name in input:read("*a"):gmatch("(%S+ %S+ %S+)%s([%w_-]+)[\r\n]") do + homepos[name] = minetest.string_to_pos(pos) + end + input:close() +end + +loadhomes() + +sethome.set = function(name, pos) + local player = minetest.get_player_by_name(name) + if not player or not pos then + return false + end + player:set_attribute("sethome:home", minetest.pos_to_string(pos)) + + -- remove `name` from the old storage file + local data = {} + local output = io.open(homes_file, "w") + if output then + homepos[name] = nil + for i, v in pairs(homepos) do + table.insert(data, string.format("%.1f %.1f %.1f %s\n", v.x, v.y, v.z, i)) + end + output:write(table.concat(data)) + io.close(output) + return true + end + return true -- if the file doesn't exist - don't return an error. +end + +sethome.get = function(name) + local player = minetest.get_player_by_name(name) + local pos = minetest.string_to_pos(player:get_attribute("sethome:home")) + if pos then + return pos + end + + -- fetch old entry from storage table + pos = homepos[name] + if pos then + return vector.new(pos) + else + return nil + end +end + +sethome.go = function(name) + local pos = sethome.get(name) + local player = minetest.get_player_by_name(name) + if player and pos then + player:setpos(pos) + return true + end + return false +end + +minetest.register_privilege("home", { + description = "Can use /sethome and /home", + give_to_singleplayer = false +}) + +minetest.register_chatcommand("home", { + description = "Teleport you to your home point", + privs = {home = true}, + func = function(name) + if sethome.go(name) then + return true, "Teleported to home!" + end + return false, "Set a home using /sethome" + end, +}) + +minetest.register_chatcommand("sethome", { + description = "Set your home point", + privs = {home = true}, + func = function(name) + name = name or "" -- fallback to blank name if nil + local player = minetest.get_player_by_name(name) + if player and sethome.set(name, player:getpos()) then + return true, "Home set!" + end + return false, "Player not found!" + end, +}) diff --git a/mods/sethome/license.txt b/mods/sethome/license.txt new file mode 100644 index 0000000..09f03b0 --- /dev/null +++ b/mods/sethome/license.txt @@ -0,0 +1,24 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 sfan5 + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT diff --git a/mods/sfinv/README.md b/mods/sfinv/README.md new file mode 100644 index 0000000..6ff3392 --- /dev/null +++ b/mods/sfinv/README.md @@ -0,0 +1,21 @@ +Simple Fast Inventory +==================== + +![SFINV Screeny](https://cdn.pbrd.co/images/1yQhd1TI.png) + +A cleaner, simpler, solution to having an advanced inventory in Minetest. + +Written by rubenwardy. +License: MIT + +See game_api.txt for this mod's API + +License of source code and media files: +--------------------------------------- +Copyright (C) 2016 rubenwardy + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/mods/sfinv/api.lua b/mods/sfinv/api.lua new file mode 100644 index 0000000..bd6de1e --- /dev/null +++ b/mods/sfinv/api.lua @@ -0,0 +1,170 @@ +sfinv = { + pages = {}, + pages_unordered = {}, + contexts = {}, + enabled = true +} + +function sfinv.register_page(name, def) + assert(name, "Invalid sfinv page. Requires a name") + assert(def, "Invalid sfinv page. Requires a def[inition] table") + assert(def.get, "Invalid sfinv page. Def requires a get function.") + assert(not sfinv.pages[name], "Attempt to register already registered sfinv page " .. dump(name)) + + sfinv.pages[name] = def + def.name = name + table.insert(sfinv.pages_unordered, def) +end + +function sfinv.override_page(name, def) + assert(name, "Invalid sfinv page override. Requires a name") + assert(def, "Invalid sfinv page override. Requires a def[inition] table") + local page = sfinv.pages[name] + assert(page, "Attempt to override sfinv page " .. dump(name) .. " which does not exist.") + for key, value in pairs(def) do + page[key] = value + end +end + +function sfinv.get_nav_fs(player, context, nav, current_idx) + -- Only show tabs if there is more than one page + if #nav > 1 then + return "tabheader[0,0;tabs;" .. table.concat(nav, ",") .. ";" .. current_idx .. ";true;false]" + else + return "" + end +end + +local theme_main = "bgcolor[#080808BB;true]" .. default.gui_bg .. + default.gui_bg_img + +local theme_inv = default.gui_slots .. [[ + list[current_player;main;0,4.7;8,1;] + list[current_player;main;0,5.85;8,3;8] + ]] + +function sfinv.make_formspec(player, context, content, show_inv, size) + local tmp = { + size or "size[8,8.6]", + theme_main, + sfinv.get_nav_fs(player, context, context.nav_titles, context.nav_idx), + content + } + if show_inv then + tmp[#tmp + 1] = theme_inv + end + return table.concat(tmp, "") +end + +function sfinv.get_homepage_name(player) + return "sfinv:crafting" +end + +function sfinv.get_formspec(player, context) + -- Generate navigation tabs + local nav = {} + local nav_ids = {} + local current_idx = 1 + for i, pdef in pairs(sfinv.pages_unordered) do + if not pdef.is_in_nav or pdef:is_in_nav(player, context) then + nav[#nav + 1] = pdef.title + nav_ids[#nav_ids + 1] = pdef.name + if pdef.name == context.page then + current_idx = #nav_ids + end + end + end + context.nav = nav_ids + context.nav_titles = nav + context.nav_idx = current_idx + + -- Generate formspec + local page = sfinv.pages[context.page] or sfinv.pages["404"] + if page then + return page:get(player, context) + else + local old_page = context.page + context.page = sfinv.get_homepage_name(player) + assert(sfinv.pages[context.page], "[sfinv] Invalid homepage") + minetest.log("warning", "[sfinv] Couldn't find " .. dump(old_page) .. " so using switching to homepage") + return sfinv.get_formspec(player, context) + end +end + +function sfinv.get_or_create_context(player) + local name = player:get_player_name() + local context = sfinv.contexts[name] + if not context then + context = { + page = sfinv.get_homepage_name(player) + } + sfinv.contexts[name] = context + end + return context +end + +function sfinv.set_context(player, context) + sfinv.contexts[player:get_player_name()] = context +end + +function sfinv.set_player_inventory_formspec(player, context) + local fs = sfinv.get_formspec(player, + context or sfinv.get_or_create_context(player)) + player:set_inventory_formspec(fs) +end + +function sfinv.set_page(player, pagename) + local context = sfinv.get_or_create_context(player) + local oldpage = sfinv.pages[context.page] + if oldpage and oldpage.on_leave then + oldpage:on_leave(player, context) + end + context.page = pagename + local page = sfinv.pages[pagename] + if page.on_enter then + page:on_enter(player, context) + end + sfinv.set_player_inventory_formspec(player, context) +end + +minetest.register_on_joinplayer(function(player) + if sfinv.enabled then + sfinv.set_player_inventory_formspec(player) + end +end) + +minetest.register_on_leaveplayer(function(player) + sfinv.contexts[player:get_player_name()] = nil +end) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname ~= "" or not sfinv.enabled then + return false + end + + -- Get Context + local name = player:get_player_name() + local context = sfinv.contexts[name] + if not context then + sfinv.set_player_inventory_formspec(player) + return false + end + + -- Was a tab selected? + if fields.tabs and context.nav then + local tid = tonumber(fields.tabs) + if tid and tid > 0 then + local id = context.nav[tid] + local page = sfinv.pages[id] + if id and page then + sfinv.set_page(player, id) + end + end + else + -- Pass event to page + local page = sfinv.pages[context.page] + if page and page.on_player_receive_fields then + return page:on_player_receive_fields(player, context, fields) + end + end +end) diff --git a/mods/sfinv/depends.txt b/mods/sfinv/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/sfinv/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/sfinv/init.lua b/mods/sfinv/init.lua new file mode 100644 index 0000000..f030222 --- /dev/null +++ b/mods/sfinv/init.lua @@ -0,0 +1,22 @@ +dofile(minetest.get_modpath("sfinv") .. "/api.lua") + +sfinv.register_page("sfinv:crafting", { + title = "Crafting", + get = function(self, player, context) + return sfinv.make_formspec(player, context, [[ + list[current_player;craft;1.75,0.5;3,3;] + list[current_player;craftpreview;5.75,1.5;1,1;] + image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270] + listring[current_player;main] + listring[current_player;craft] + image[0,4.75;1,1;gui_hb_bg.png] + image[1,4.75;1,1;gui_hb_bg.png] + image[2,4.75;1,1;gui_hb_bg.png] + image[3,4.75;1,1;gui_hb_bg.png] + image[4,4.75;1,1;gui_hb_bg.png] + image[5,4.75;1,1;gui_hb_bg.png] + image[6,4.75;1,1;gui_hb_bg.png] + image[7,4.75;1,1;gui_hb_bg.png] + ]], true) + end +}) diff --git a/mods/stairs/README.txt b/mods/stairs/README.txt new file mode 100644 index 0000000..d32cd71 --- /dev/null +++ b/mods/stairs/README.txt @@ -0,0 +1,16 @@ +Minetest Game mod: stairs +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Kahrl (LGPL 2.1) and +celeron55, Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (models) +------------------------- +Jean-Patrick G. (kilbith) (CC BY-SA 3.0): + stairs_stair.obj + + diff --git a/mods/stairs/depends.txt b/mods/stairs/depends.txt new file mode 100644 index 0000000..d77ba25 --- /dev/null +++ b/mods/stairs/depends.txt @@ -0,0 +1,2 @@ +default +farming diff --git a/mods/stairs/init.lua b/mods/stairs/init.lua new file mode 100644 index 0000000..90172ef --- /dev/null +++ b/mods/stairs/init.lua @@ -0,0 +1,613 @@ +-- Minetest 0.4 mod: stairs +-- See README.txt for licensing and other information. + + +-- Global namespace for functions + +stairs = {} + + +-- Register aliases for new pine node names + +minetest.register_alias("stairs:stair_pinewood", "stairs:stair_pine_wood") +minetest.register_alias("stairs:slab_pinewood", "stairs:slab_pine_wood") + + +-- Get setting for replace ABM + +local replace = minetest.settings:get_bool("enable_stairs_replace_abm") + +local function rotate_and_place(itemstack, placer, pointed_thing) + local p0 = pointed_thing.under + local p1 = pointed_thing.above + local param2 = 0 + + local placer_pos = placer:getpos() + if placer_pos then + param2 = minetest.dir_to_facedir(vector.subtract(p1, placer_pos)) + end + + local finepos = minetest.pointed_thing_to_face_pos(placer, pointed_thing) + local fpos = finepos.y % 1 + + if p0.y - 1 == p1.y or (fpos > 0 and fpos < 0.5) + or (fpos < -0.5 and fpos > -0.999999999) then + param2 = param2 + 20 + if param2 == 21 then + param2 = 23 + elseif param2 == 23 then + param2 = 21 + end + end + return minetest.item_place(itemstack, placer, pointed_thing, param2) +end + +-- Register stairs. +-- Node will be called stairs:stair_ + +function stairs.register_stair(subname, recipeitem, groups, images, description, sounds) + groups.stair = 1 + minetest.register_node(":stairs:stair_" .. subname, { + description = description, + drawtype = "mesh", + mesh = "stairs_stair.obj", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + selection_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + collision_box = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + {-0.5, 0, 0, 0.5, 0.5, 0.5}, + }, + }, + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return itemstack + end + + return rotate_and_place(itemstack, placer, pointed_thing) + end, + }) + + -- for replace ABM + if replace then + minetest.register_node(":stairs:stair_" .. subname .. "upside_down", { + replace_name = "stairs:stair_" .. subname, + groups = {slabs_replace = 1}, + }) + end + + if recipeitem then + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 8', + recipe = { + {recipeitem, "", ""}, + {recipeitem, recipeitem, ""}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Flipped recipe for the silly minecrafters + minetest.register_craft({ + output = 'stairs:stair_' .. subname .. ' 8', + recipe = { + {"", "", recipeitem}, + {"", recipeitem, recipeitem}, + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:stair_' .. subname, + burntime = math.floor(baseburntime * 0.75), + }) + end + end +end + + +-- Slab facedir to placement 6d matching table +local slab_trans_dir = {[0] = 8, 0, 2, 1, 3, 4} + +-- Register slabs. +-- Node will be called stairs:slab_ + +function stairs.register_slab(subname, recipeitem, groups, images, description, sounds) + groups.slab = 1 + minetest.register_node(":stairs:slab_" .. subname, { + description = description, + drawtype = "nodebox", + tiles = images, + paramtype = "light", + paramtype2 = "facedir", + is_ground_content = false, + groups = groups, + sounds = sounds, + node_box = { + type = "fixed", + fixed = {-0.5, -0.5, -0.5, 0.5, 0, 0.5}, + }, + on_place = function(itemstack, placer, pointed_thing) + local under = minetest.get_node(pointed_thing.under) + local wield_item = itemstack:get_name() + local creative_enabled = (creative and creative.is_enabled_for + and creative.is_enabled_for(placer:get_player_name())) + + if under and under.name:find("stairs:slab_") then + -- place slab using under node orientation + local dir = minetest.dir_to_facedir(vector.subtract( + pointed_thing.above, pointed_thing.under), true) + + local p2 = under.param2 + + -- combine two slabs if possible + if slab_trans_dir[math.floor(p2 / 4)] == dir + and wield_item == under.name then + + if not recipeitem then + return itemstack + end + local player_name = placer:get_player_name() + if minetest.is_protected(pointed_thing.under, player_name) and not + minetest.check_player_privs(placer, "protection_bypass") then + minetest.record_protection_violation(pointed_thing.under, + player_name) + return + end + minetest.set_node(pointed_thing.under, {name = recipeitem, param2 = p2}) + if not creative_enabled then + itemstack:take_item() + end + return itemstack + end + + -- Placing a slab on an upside down slab should make it right-side up. + if p2 >= 20 and dir == 8 then + p2 = p2 - 20 + -- same for the opposite case: slab below normal slab + elseif p2 <= 3 and dir == 4 then + p2 = p2 + 20 + end + + -- else attempt to place node with proper param2 + minetest.item_place_node(ItemStack(wield_item), placer, pointed_thing, p2) + if not creative_enabled then + itemstack:take_item() + end + return itemstack + else + return rotate_and_place(itemstack, placer, pointed_thing) + end + end, + }) + + -- for replace ABM + if replace then + minetest.register_node(":stairs:slab_" .. subname .. "upside_down", { + replace_name = "stairs:slab_".. subname, + groups = {slabs_replace = 1}, + }) + end + + if recipeitem then + minetest.register_craft({ + output = 'stairs:slab_' .. subname .. ' 6', + recipe = { + {recipeitem, recipeitem, recipeitem}, + }, + }) + + -- Fuel + local baseburntime = minetest.get_craft_result({ + method = "fuel", + width = 1, + items = {recipeitem} + }).time + if baseburntime > 0 then + minetest.register_craft({ + type = "fuel", + recipe = 'stairs:slab_' .. subname, + burntime = math.floor(baseburntime * 0.5), + }) + end + end +end + + +-- Optionally replace old "upside_down" nodes with new param2 versions. +-- Disabled by default. + +if replace then + minetest.register_abm({ + label = "Slab replace", + nodenames = {"group:slabs_replace"}, + interval = 16, + chance = 1, + action = function(pos, node) + node.name = minetest.registered_nodes[node.name].replace_name + node.param2 = node.param2 + 20 + if node.param2 == 21 then + node.param2 = 23 + elseif node.param2 == 23 then + node.param2 = 21 + end + minetest.set_node(pos, node) + end, + }) +end + + +-- Stair/slab registration function. +-- Nodes will be called stairs:{stair,slab}_ + +function stairs.register_stair_and_slab(subname, recipeitem, + groups, images, desc_stair, desc_slab, sounds) + stairs.register_stair(subname, recipeitem, groups, images, desc_stair, sounds) + stairs.register_slab(subname, recipeitem, groups, images, desc_slab, sounds) +end + + +-- Register default stairs and slabs + +stairs.register_stair_and_slab( + "wood", + "default:wood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_wood.png"}, + "Wooden Stair", + "Wooden Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "junglewood", + "default:junglewood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_junglewood.png"}, + "Jungle Wood Stair", + "Jungle Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "pine_wood", + "default:pine_wood", + {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + {"default_pine_wood.png"}, + "Pine Wood Stair", + "Pine Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "acacia_wood", + "default:acacia_wood", + {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, + {"default_acacia_wood.png"}, + "Acacia Wood Stair", + "Acacia Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "aspen_wood", + "default:aspen_wood", + {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + {"default_aspen_wood.png"}, + "Aspen Wood Stair", + "Aspen Wood Slab", + default.node_sound_wood_defaults() +) + +stairs.register_stair_and_slab( + "stone", + "default:stone", + {cracky = 3}, + {"default_stone.png"}, + "Stone Stair", + "Stone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "cobble", + "default:cobble", + {cracky = 3}, + {"default_cobble.png"}, + "Cobblestone Stair", + "Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "mossycobble", + nil, + {cracky = 3}, + {"default_mossycobble.png"}, + "Mossy Cobblestone Stair", + "Mossy Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "stonebrick", + "default:stonebrick", + {cracky = 2}, + {"default_stone_brick.png"}, + "Stone Brick Stair", + "Stone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "stone_block", + "default:stone_block", + {cracky = 2}, + {"default_stone_block.png"}, + "Stone Block Stair", + "Stone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stone", + "default:desert_stone", + {cracky = 3}, + {"default_desert_stone.png"}, + "Desert Stone Stair", + "Desert Stone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_cobble", + "default:desert_cobble", + {cracky = 3}, + {"default_desert_cobble.png"}, + "Desert Cobblestone Stair", + "Desert Cobblestone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stonebrick", + "default:desert_stonebrick", + {cracky = 2}, + {"default_desert_stone_brick.png"}, + "Desert Stone Brick Stair", + "Desert Stone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_stone_block", + "default:desert_stone_block", + {cracky = 2}, + {"default_desert_stone_block.png"}, + "Desert Stone Block Stair", + "Desert Stone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstone", + "default:sandstone", + {crumbly = 1, cracky = 3}, + {"default_sandstone.png"}, + "Sandstone Stair", + "Sandstone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstonebrick", + "default:sandstonebrick", + {cracky = 2}, + {"default_sandstone_brick.png"}, + "Sandstone Brick Stair", + "Sandstone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "sandstone_block", + "default:sandstone_block", + {cracky = 2}, + {"default_sandstone_block.png"}, + "Sandstone Block Stair", + "Sandstone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_sandstone", + "default:desert_sandstone", + {crumbly = 1, cracky = 3}, + {"default_desert_sandstone.png"}, + "Desert Sandstone Stair", + "Desert Sandstone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_sandstone_brick", + "default:desert_sandstone_brick", + {cracky = 2}, + {"default_desert_sandstone_brick.png"}, + "Desert Sandstone Brick Stair", + "Desert Sandstone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "desert_sandstone_block", + "default:desert_sandstone_block", + {cracky = 2}, + {"default_desert_sandstone_block.png"}, + "Desert Sandstone Block Stair", + "Desert Sandstone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "silver_sandstone", + "default:silver_sandstone", + {crumbly = 1, cracky = 3}, + {"default_silver_sandstone.png"}, + "Silver Sandstone Stair", + "Silver Sandstone Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "silver_sandstone_brick", + "default:silver_sandstone_brick", + {cracky = 2}, + {"default_silver_sandstone_brick.png"}, + "Silver Sandstone Brick Stair", + "Silver Sandstone Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "silver_sandstone_block", + "default:silver_sandstone_block", + {cracky = 2}, + {"default_silver_sandstone_block.png"}, + "Silver Sandstone Block Stair", + "Silver Sandstone Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidian", + "default:obsidian", + {cracky = 1, level = 2}, + {"default_obsidian.png"}, + "Obsidian Stair", + "Obsidian Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidianbrick", + "default:obsidianbrick", + {cracky = 1, level = 2}, + {"default_obsidian_brick.png"}, + "Obsidian Brick Stair", + "Obsidian Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "obsidian_block", + "default:obsidian_block", + {cracky = 1, level = 2}, + {"default_obsidian_block.png"}, + "Obsidian Block Stair", + "Obsidian Block Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "brick", + "default:brick", + {cracky = 3}, + {"default_brick.png"}, + "Brick Stair", + "Brick Slab", + default.node_sound_stone_defaults() +) + +stairs.register_stair_and_slab( + "straw", + "farming:straw", + {snappy = 3, flammable = 4}, + {"farming_straw.png"}, + "Straw Stair", + "Straw Slab", + default.node_sound_leaves_defaults() +) + +stairs.register_stair_and_slab( + "steelblock", + "default:steelblock", + {cracky = 1, level = 2}, + {"default_steel_block.png"}, + "Steel Block Stair", + "Steel Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "copperblock", + "default:copperblock", + {cracky = 1, level = 2}, + {"default_copper_block.png"}, + "Copper Block Stair", + "Copper Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "bronzeblock", + "default:bronzeblock", + {cracky = 1, level = 2}, + {"default_bronze_block.png"}, + "Bronze Block Stair", + "Bronze Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "goldblock", + "default:goldblock", + {cracky = 1}, + {"default_gold_block.png"}, + "Gold Block Stair", + "Gold Block Slab", + default.node_sound_metal_defaults() +) + +stairs.register_stair_and_slab( + "ice", + "default:ice", + {cracky = 3, puts_out_fire = 1, cools_lava = 1}, + {"default_ice.png"}, + "Ice Stair", + "Ice Slab", + default.node_sound_glass_defaults() +) + +stairs.register_stair_and_slab( + "snowblock", + "default:snowblock", + {crumbly = 3, puts_out_fire = 1, cools_lava = 1, snowy = 1}, + {"default_snow.png"}, + "Snow Block Stair", + "Snow Block Slab", + default.node_sound_dirt_defaults({ + footstep = {name = "default_snow_footstep", gain = 0.15}, + dug = {name = "default_snow_footstep", gain = 0.2}, + dig = {name = "default_snow_footstep", gain = 0.2} + }) +) diff --git a/mods/stairs/license.txt b/mods/stairs/license.txt new file mode 100644 index 0000000..8f16bbd --- /dev/null +++ b/mods/stairs/license.txt @@ -0,0 +1,51 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2011-2016 Kahrl +Copyright (C) 2011-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (models) +-------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2015-2016 Jean-Patrick G. (kilbith) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/stairs/models/stairs_stair.obj b/mods/stairs/models/stairs_stair.obj new file mode 100644 index 0000000..198edf6 --- /dev/null +++ b/mods/stairs/models/stairs_stair.obj @@ -0,0 +1,115 @@ +# Blender v2.72 (sub 0) OBJ File: '' +# www.blender.org +mtllib stairs.mtl +o stairs_top +v -0.500000 0.000000 -0.500000 +v -0.500000 0.000000 0.000000 +v 0.500000 0.000000 0.000000 +v 0.500000 0.000000 -0.500000 +v -0.500000 0.500000 0.000000 +v 0.500000 0.500000 0.000000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +vt 0.000000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn 0.000000 1.000000 0.000000 +g stairs_top +usemtl None +s off +f 4/1/1 1/2/1 2/3/1 3/4/1 +f 7/5/1 8/6/1 6/4/1 5/3/1 +o stairs_bottom +v -0.500000 -0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 -1.000000 -0.000000 +g stairs_bottom +usemtl None +s off +f 11/7/2 9/8/2 10/9/2 12/10/2 +o stairs_right +v -0.500000 0.000000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 0.000000 0.000000 +v -0.500000 -0.500000 0.500000 +v -0.500000 0.500000 0.000000 +v -0.500000 0.500000 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.000000 +vt 0.500000 0.500000 +vt 1.000000 1.000000 +vt 0.500000 1.000000 +vt 1.000000 0.000000 +vn -1.000000 0.000000 0.000000 +g stairs_right +usemtl None +s off +f 13/11/3 14/12/3 15/13/3 +f 15/13/3 18/14/3 17/15/3 +f 14/12/3 16/16/3 15/13/3 +f 16/16/3 18/14/3 15/13/3 +o stairs_left +v 0.500000 0.000000 0.000000 +v 0.500000 -0.500000 -0.500000 +v 0.500000 0.000000 -0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 0.500000 0.000000 +v 0.500000 0.500000 0.500000 +vt 0.500000 0.500000 +vt 1.000000 0.000000 +vt 1.000000 0.500000 +vt 0.500000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 1.000000 0.000000 0.000000 +g stairs_left +usemtl None +s off +f 19/17/4 20/18/4 21/19/4 +f 19/17/4 23/20/4 24/21/4 +f 20/18/4 19/17/4 22/22/4 +f 19/17/4 24/21/4 22/22/4 +o stairs_back +v -0.500000 -0.500000 0.500000 +v 0.500000 -0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v 0.500000 0.500000 0.500000 +vt 1.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vn 0.000000 -0.000000 1.000000 +g stairs_back +usemtl None +s off +f 26/23/5 28/24/5 27/25/5 25/26/5 +o stairs_front +v -0.500000 0.000000 -0.500000 +v -0.500000 -0.500000 -0.500000 +v -0.500000 0.000000 0.000000 +v 0.500000 0.000000 0.000000 +v 0.500000 -0.500000 -0.500000 +v 0.500000 0.000000 -0.500000 +v -0.500000 0.500000 0.000000 +v 0.500000 0.500000 0.000000 +vt 1.000000 0.000000 +vt 1.000000 0.500000 +vt 0.000000 0.500000 +vt 0.000000 0.000000 +vt 1.000000 1.000000 +vt 0.000000 1.000000 +vn 0.000000 0.000000 -1.000000 +g stairs_front +usemtl None +s off +f 30/27/6 29/28/6 34/29/6 33/30/6 +f 31/28/6 35/31/6 36/32/6 32/29/6 diff --git a/mods/tnt/README.txt b/mods/tnt/README.txt new file mode 100644 index 0000000..4e74841 --- /dev/null +++ b/mods/tnt/README.txt @@ -0,0 +1,44 @@ +Minetest Game mod: tnt +====================== +See license.txt for license information. + +Authors of source code +---------------------- +PilzAdam (MIT) +ShadowNinja (MIT) +sofar (sofar@foo-projects.org) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +BlockMen (CC BY-SA 3.0): +All textures not mentioned below. + +ShadowNinja (CC BY-SA 3.0): +tnt_smoke.png + +Wuzzy (CC BY-SA 3.0): +All gunpowder textures except tnt_gunpowder_inventory.png. + +sofar (sofar@foo-projects.org) (CC BY-SA 3.0): +tnt_blast.png + +Introduction +------------ +This mod adds TNT to Minetest. TNT is a tool to help the player +in mining. + +How to use the mod: +Craft gunpowder by placing coal and gravel in the crafting area. +The gunpowder can be used to craft TNT or as fuse for TNT. +To craft TNT place items like this: +-- wood - gunpowder -- wood - +gunpowder gunpowder gunpowder +-- wood - gunpowder -- wood - + +There are different ways to blow up TNT: + 1. Hit it with a torch. + 2. Hit a gunpowder fuse that leads to a TNT block with a torch or flint-and-steel. + 3. Activate it with mesecons (fastest way). + +Be aware of the damage radius of 6 blocks! diff --git a/mods/tnt/depends.txt b/mods/tnt/depends.txt new file mode 100644 index 0000000..5ff216f --- /dev/null +++ b/mods/tnt/depends.txt @@ -0,0 +1,3 @@ +default +fire + diff --git a/mods/tnt/init.lua b/mods/tnt/init.lua new file mode 100644 index 0000000..f54b2f1 --- /dev/null +++ b/mods/tnt/init.lua @@ -0,0 +1,645 @@ +tnt = {} + +-- Default to enabled when in singleplayer +local enable_tnt = minetest.settings:get_bool("enable_tnt") +if enable_tnt == nil then + enable_tnt = minetest.is_singleplayer() +end + +-- loss probabilities array (one in X will be lost) +local loss_prob = {} + +loss_prob["default:cobble"] = 3 +loss_prob["default:dirt"] = 4 + +local tnt_radius = tonumber(minetest.settings:get("tnt_radius") or 3) + +-- Fill a list with data for content IDs, after all nodes are registered +local cid_data = {} +minetest.after(0, function() + for name, def in pairs(minetest.registered_nodes) do + cid_data[minetest.get_content_id(name)] = { + name = name, + drops = def.drops, + flammable = def.groups.flammable, + on_blast = def.on_blast, + } + end +end) + +local function rand_pos(center, pos, radius) + local def + local reg_nodes = minetest.registered_nodes + local i = 0 + repeat + -- Give up and use the center if this takes too long + if i > 4 then + pos.x, pos.z = center.x, center.z + break + end + pos.x = center.x + math.random(-radius, radius) + pos.z = center.z + math.random(-radius, radius) + def = reg_nodes[minetest.get_node(pos).name] + i = i + 1 + until def and not def.walkable +end + +local function eject_drops(drops, pos, radius) + local drop_pos = vector.new(pos) + for _, item in pairs(drops) do + local count = math.min(item:get_count(), item:get_stack_max()) + while count > 0 do + local take = math.max(1,math.min(radius * radius, + count, + item:get_stack_max())) + rand_pos(pos, drop_pos, radius) + local dropitem = ItemStack(item) + dropitem:set_count(take) + local obj = minetest.add_item(drop_pos, dropitem) + if obj then + obj:get_luaentity().collect = true + obj:setacceleration({x = 0, y = -10, z = 0}) + obj:setvelocity({x = math.random(-3, 3), + y = math.random(0, 10), + z = math.random(-3, 3)}) + end + count = count - take + end + end +end + +local function add_drop(drops, item) + item = ItemStack(item) + local name = item:get_name() + if loss_prob[name] ~= nil and math.random(1, loss_prob[name]) == 1 then + return + end + + local drop = drops[name] + if drop == nil then + drops[name] = item + else + drop:set_count(drop:get_count() + item:get_count()) + end +end + +local basic_flame_on_construct -- cached value +local function destroy(drops, npos, cid, c_air, c_fire, + on_blast_queue, on_construct_queue, + ignore_protection, ignore_on_blast) + if not ignore_protection and minetest.is_protected(npos, "") then + return cid + end + + local def = cid_data[cid] + + if not def then + return c_air + elseif not ignore_on_blast and def.on_blast then + on_blast_queue[#on_blast_queue + 1] = { + pos = vector.new(npos), + on_blast = def.on_blast + } + return cid + elseif def.flammable then + on_construct_queue[#on_construct_queue + 1] = { + fn = basic_flame_on_construct, + pos = vector.new(npos) + } + return c_fire + else + local node_drops = minetest.get_node_drops(def.name, "") + for _, item in pairs(node_drops) do + add_drop(drops, item) + end + return c_air + end +end + +local function calc_velocity(pos1, pos2, old_vel, power) + -- Avoid errors caused by a vector of zero length + if vector.equals(pos1, pos2) then + return old_vel + end + + local vel = vector.direction(pos1, pos2) + vel = vector.normalize(vel) + vel = vector.multiply(vel, power) + + -- Divide by distance + local dist = vector.distance(pos1, pos2) + dist = math.max(dist, 1) + vel = vector.divide(vel, dist) + + -- Add old velocity + vel = vector.add(vel, old_vel) + + -- randomize it a bit + vel = vector.add(vel, { + x = math.random() - 0.5, + y = math.random() - 0.5, + z = math.random() - 0.5, + }) + + -- Limit to terminal velocity + dist = vector.length(vel) + if dist > 250 then + vel = vector.divide(vel, dist / 250) + end + return vel +end + +local function entity_physics(pos, radius, drops) + local objs = minetest.get_objects_inside_radius(pos, radius) + for _, obj in pairs(objs) do + local obj_pos = obj:getpos() + local dist = math.max(1, vector.distance(pos, obj_pos)) + + local damage = (4 / dist) * radius + if obj:is_player() then + -- currently the engine has no method to set + -- player velocity. See #2960 + -- instead, we knock the player back 1.0 node, and slightly upwards + local dir = vector.normalize(vector.subtract(obj_pos, pos)) + local moveoff = vector.multiply(dir, dist + 1.0) + local newpos = vector.add(pos, moveoff) + newpos = vector.add(newpos, {x = 0, y = 0.2, z = 0}) + obj:setpos(newpos) + + obj:set_hp(obj:get_hp() - damage) + else + local do_damage = true + local do_knockback = true + local entity_drops = {} + local luaobj = obj:get_luaentity() + local objdef = minetest.registered_entities[luaobj.name] + + if objdef and objdef.on_blast then + do_damage, do_knockback, entity_drops = objdef.on_blast(luaobj, damage) + end + + if do_knockback then + local obj_vel = obj:getvelocity() + obj:setvelocity(calc_velocity(pos, obj_pos, + obj_vel, radius * 10)) + end + if do_damage then + if not obj:get_armor_groups().immortal then + obj:punch(obj, 1.0, { + full_punch_interval = 1.0, + damage_groups = {fleshy = damage}, + }, nil) + end + end + for _, item in pairs(entity_drops) do + add_drop(drops, item) + end + end + end +end + +local function add_effects(pos, radius, drops) + minetest.add_particle({ + pos = pos, + velocity = vector.new(), + acceleration = vector.new(), + expirationtime = 0.4, + size = radius * 10, + collisiondetection = false, + vertical = false, + texture = "tnt_boom.png", + }) + minetest.add_particlespawner({ + amount = 64, + time = 0.5, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -10, y = -10, z = -10}, + maxvel = {x = 10, y = 10, z = 10}, + minacc = vector.new(), + maxacc = vector.new(), + minexptime = 1, + maxexptime = 2.5, + minsize = radius * 3, + maxsize = radius * 5, + texture = "tnt_smoke.png", + }) + + -- we just dropped some items. Look at the items entities and pick + -- one of them to use as texture + local texture = "tnt_blast.png" --fallback texture + local most = 0 + for name, stack in pairs(drops) do + local count = stack:get_count() + if count > most then + most = count + local def = minetest.registered_nodes[name] + if def and def.tiles and def.tiles[1] then + texture = def.tiles[1] + end + end + end + + minetest.add_particlespawner({ + amount = 64, + time = 0.1, + minpos = vector.subtract(pos, radius / 2), + maxpos = vector.add(pos, radius / 2), + minvel = {x = -3, y = 0, z = -3}, + maxvel = {x = 3, y = 5, z = 3}, + minacc = {x = 0, y = -10, z = 0}, + maxacc = {x = 0, y = -10, z = 0}, + minexptime = 0.8, + maxexptime = 2.0, + minsize = radius * 0.66, + maxsize = radius * 2, + texture = texture, + collisiondetection = true, + }) +end + +function tnt.burn(pos, nodename) + local name = nodename or minetest.get_node(pos).name + local def = minetest.registered_nodes[name] + if not def then + return + elseif def.on_ignite then + def.on_ignite(pos) + elseif minetest.get_item_group(name, "tnt") > 0 then + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.get_node_timer(pos):start(1) + end +end + +local function tnt_explode(pos, radius, ignore_protection, ignore_on_blast) + pos = vector.round(pos) + -- scan for adjacent TNT nodes first, and enlarge the explosion + local vm1 = VoxelManip() + local p1 = vector.subtract(pos, 2) + local p2 = vector.add(pos, 2) + local minp, maxp = vm1:read_from_map(p1, p2) + local a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + local data = vm1:get_data() + local count = 0 + local c_tnt = minetest.get_content_id("tnt:tnt") + local c_tnt_burning = minetest.get_content_id("tnt:tnt_burning") + local c_tnt_boom = minetest.get_content_id("tnt:boom") + local c_air = minetest.get_content_id("air") + + for z = pos.z - 2, pos.z + 2 do + for y = pos.y - 2, pos.y + 2 do + local vi = a:index(pos.x - 2, y, z) + for x = pos.x - 2, pos.x + 2 do + local cid = data[vi] + if cid == c_tnt or cid == c_tnt_boom or cid == c_tnt_burning then + count = count + 1 + data[vi] = c_air + end + vi = vi + 1 + end + end + end + + vm1:set_data(data) + vm1:write_to_map() + + -- recalculate new radius + radius = math.floor(radius * math.pow(count, 1/3)) + + -- perform the explosion + local vm = VoxelManip() + local pr = PseudoRandom(os.time()) + p1 = vector.subtract(pos, radius) + p2 = vector.add(pos, radius) + minp, maxp = vm:read_from_map(p1, p2) + a = VoxelArea:new({MinEdge = minp, MaxEdge = maxp}) + data = vm:get_data() + + local drops = {} + local on_blast_queue = {} + local on_construct_queue = {} + basic_flame_on_construct = minetest.registered_nodes["fire:basic_flame"].on_construct + + local c_fire = minetest.get_content_id("fire:basic_flame") + for z = -radius, radius do + for y = -radius, radius do + local vi = a:index(pos.x + (-radius), pos.y + y, pos.z + z) + for x = -radius, radius do + local r = vector.length(vector.new(x, y, z)) + if (radius * radius) / (r * r) >= (pr:next(80, 125) / 100) then + local cid = data[vi] + local p = {x = pos.x + x, y = pos.y + y, z = pos.z + z} + if cid ~= c_air then + data[vi] = destroy(drops, p, cid, c_air, c_fire, + on_blast_queue, on_construct_queue, + ignore_protection, ignore_on_blast) + end + end + vi = vi + 1 + end + end + end + + vm:set_data(data) + vm:write_to_map() + vm:update_map() + vm:update_liquids() + + -- call check_single_for_falling for everything within 1.5x blast radius + for y = -radius * 1.5, radius * 1.5 do + for z = -radius * 1.5, radius * 1.5 do + for x = -radius * 1.5, radius * 1.5 do + local rad = {x = x, y = y, z = z} + local s = vector.add(pos, rad) + local r = vector.length(rad) + if r / radius < 1.4 then + minetest.check_single_for_falling(s) + end + end + end + end + + for _, queued_data in pairs(on_blast_queue) do + local dist = math.max(1, vector.distance(queued_data.pos, pos)) + local intensity = (radius * radius) / (dist * dist) + local node_drops = queued_data.on_blast(queued_data.pos, intensity) + if node_drops then + for _, item in pairs(node_drops) do + add_drop(drops, item) + end + end + end + + for _, queued_data in pairs(on_construct_queue) do + queued_data.fn(queued_data.pos) + end + + return drops, radius +end + +function tnt.boom(pos, def) + minetest.sound_play("tnt_explode", {pos = pos, gain = 1.5, max_hear_distance = 2*64}) + minetest.set_node(pos, {name = "tnt:boom"}) + local drops, radius = tnt_explode(pos, def.radius, def.ignore_protection, + def.ignore_on_blast) + -- append entity drops + local damage_radius = (radius / def.radius) * def.damage_radius + entity_physics(pos, damage_radius, drops) + if not def.disable_drops then + eject_drops(drops, pos, radius) + end + add_effects(pos, radius, drops) + minetest.log("action", "A TNT explosion occurred at " .. minetest.pos_to_string(pos) .. + " with radius " .. radius) +end + +minetest.register_node("tnt:boom", { + drawtype = "airlike", + light_source = default.LIGHT_MAX, + walkable = false, + drop = "", + groups = {dig_immediate = 3}, + on_construct = function(pos) + minetest.get_node_timer(pos):start(0.4) + end, + on_timer = function(pos, elapsed) + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, +}) + +minetest.register_node("tnt:gunpowder", { + description = "Gun Powder", + drawtype = "raillike", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + walkable = false, + tiles = { + "tnt_gunpowder_straight.png", + "tnt_gunpowder_curved.png", + "tnt_gunpowder_t_junction.png", + "tnt_gunpowder_crossing.png" + }, + inventory_image = "tnt_gunpowder_inventory.png", + wield_image = "tnt_gunpowder_inventory.png", + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + groups = {dig_immediate = 2, attached_node = 1, flammable = 5, + connect_to_raillike = minetest.raillike_group("gunpowder")}, + sounds = default.node_sound_leaves_defaults(), + + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites tnt:gunpowder at " .. + minetest.pos_to_string(pos)) + end + end, + on_blast = function(pos, intensity) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_burn = function(pos) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = "tnt:gunpowder_burning"}) + end, +}) + +minetest.register_node("tnt:gunpowder_burning", { + drawtype = "raillike", + paramtype = "light", + sunlight_propagates = true, + walkable = false, + light_source = 5, + tiles = {{ + name = "tnt_gunpowder_burning_straight_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_curved_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_t_junction_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + { + name = "tnt_gunpowder_burning_crossing_animated.png", + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }}, + selection_box = { + type = "fixed", + fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2}, + }, + drop = "", + groups = { + dig_immediate = 2, + attached_node = 1, + connect_to_raillike = minetest.raillike_group("gunpowder") + }, + sounds = default.node_sound_leaves_defaults(), + on_timer = function(pos, elapsed) + for dx = -1, 1 do + for dz = -1, 1 do + for dy = -1, 1 do + if not (dx == 0 and dz == 0) then + tnt.burn({ + x = pos.x + dx, + y = pos.y + dy, + z = pos.z + dz, + }) + end + end + end + end + minetest.remove_node(pos) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_gunpowder_burning", {pos = pos, gain = 2}) + minetest.get_node_timer(pos):start(1) + end, +}) + +minetest.register_craft({ + output = "tnt:gunpowder 5", + type = "shapeless", + recipe = {"default:coal_lump", "default:gravel"} +}) + +if enable_tnt then + minetest.register_craft({ + output = "tnt:tnt", + recipe = { + {"group:wood", "tnt:gunpowder", "group:wood"}, + {"tnt:gunpowder", "tnt:gunpowder", "tnt:gunpowder"}, + {"group:wood", "tnt:gunpowder", "group:wood"} + } + }) + + minetest.register_abm({ + label = "TNT ignition", + nodenames = {"group:tnt", "tnt:gunpowder"}, + neighbors = {"fire:basic_flame", "default:lava_source", "default:lava_flowing"}, + interval = 4, + chance = 1, + action = function(pos, node) + tnt.burn(pos, node.name) + end, + }) +end + +function tnt.register_tnt(def) + local name + if not def.name:find(':') then + name = "tnt:" .. def.name + else + name = def.name + def.name = def.name:match(":([%w_]+)") + end + if not def.tiles then def.tiles = {} end + local tnt_top = def.tiles.top or def.name .. "_top.png" + local tnt_bottom = def.tiles.bottom or def.name .. "_bottom.png" + local tnt_side = def.tiles.side or def.name .. "_side.png" + local tnt_burning = def.tiles.burning or def.name .. "_top_burning_animated.png" + if not def.damage_radius then def.damage_radius = def.radius * 2 end + + if enable_tnt then + minetest.register_node(":" .. name, { + description = def.description, + tiles = {tnt_top, tnt_bottom, tnt_side}, + is_ground_content = false, + groups = {dig_immediate = 2, mesecon = 2, tnt = 1, flammable = 5}, + sounds = default.node_sound_wood_defaults(), + on_punch = function(pos, node, puncher) + if puncher:get_wielded_item():get_name() == "default:torch" then + minetest.set_node(pos, {name = name .. "_burning"}) + minetest.log("action", puncher:get_player_name() .. + " ignites " .. node.name .. " at " .. + minetest.pos_to_string(pos)) + end + end, + on_blast = function(pos, intensity) + minetest.after(0.1, function() + tnt.boom(pos, def) + end) + end, + mesecons = {effector = + {action_on = + function(pos) + tnt.boom(pos, def) + end + } + }, + on_burn = function(pos) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + on_ignite = function(pos, igniter) + minetest.set_node(pos, {name = name .. "_burning"}) + end, + }) + end + + minetest.register_node(":" .. name .. "_burning", { + tiles = { + { + name = tnt_burning, + animation = { + type = "vertical_frames", + aspect_w = 16, + aspect_h = 16, + length = 1, + } + }, + tnt_bottom, tnt_side + }, + light_source = 5, + drop = "", + sounds = default.node_sound_wood_defaults(), + groups = {falling_node = 1}, + on_timer = function(pos, elapsed) + tnt.boom(pos, def) + end, + -- unaffected by explosions + on_blast = function() end, + on_construct = function(pos) + minetest.sound_play("tnt_ignite", {pos = pos}) + minetest.get_node_timer(pos):start(4) + minetest.check_for_falling(pos) + end, + }) +end + +tnt.register_tnt({ + name = "tnt:tnt", + description = "TNT", + radius = tnt_radius, +}) diff --git a/mods/tnt/license.txt b/mods/tnt/license.txt new file mode 100644 index 0000000..210f2bd --- /dev/null +++ b/mods/tnt/license.txt @@ -0,0 +1,65 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 PilzAdam +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2016 sofar (sofar@foo-projects.org) +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2014-2016 ShadowNinja +Copyright (C) 2015-2016 Wuzzy +Copyright (C) 2016 sofar (sofar@foo-projects.org) + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/tnt/sounds/tnt_explode.ogg b/mods/tnt/sounds/tnt_explode.ogg new file mode 100644 index 0000000..a414ea0 Binary files /dev/null and b/mods/tnt/sounds/tnt_explode.ogg differ diff --git a/mods/tnt/sounds/tnt_gunpowder_burning.ogg b/mods/tnt/sounds/tnt_gunpowder_burning.ogg new file mode 100644 index 0000000..5c5bfaf Binary files /dev/null and b/mods/tnt/sounds/tnt_gunpowder_burning.ogg differ diff --git a/mods/tnt/sounds/tnt_ignite.ogg b/mods/tnt/sounds/tnt_ignite.ogg new file mode 100644 index 0000000..199f206 Binary files /dev/null and b/mods/tnt/sounds/tnt_ignite.ogg differ diff --git a/mods/tnt/textures/tnt_blast.png b/mods/tnt/textures/tnt_blast.png new file mode 100644 index 0000000..bbb1096 Binary files /dev/null and b/mods/tnt/textures/tnt_blast.png differ diff --git a/mods/tnt/textures/tnt_boom.png b/mods/tnt/textures/tnt_boom.png new file mode 100644 index 0000000..c848bfc Binary files /dev/null and b/mods/tnt/textures/tnt_boom.png differ diff --git a/mods/tnt/textures/tnt_bottom.png b/mods/tnt/textures/tnt_bottom.png new file mode 100644 index 0000000..95f66cb Binary files /dev/null and b/mods/tnt/textures/tnt_bottom.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png new file mode 100644 index 0000000..a901f7b Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_crossing_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png new file mode 100644 index 0000000..bc01806 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_curved_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png new file mode 100644 index 0000000..c860ace Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_straight_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png new file mode 100644 index 0000000..a556072 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_burning_t_junction_animated.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_crossing.png b/mods/tnt/textures/tnt_gunpowder_crossing.png new file mode 100644 index 0000000..916c84e Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_crossing.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_curved.png b/mods/tnt/textures/tnt_gunpowder_curved.png new file mode 100644 index 0000000..cb8b4ea Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_curved.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_inventory.png b/mods/tnt/textures/tnt_gunpowder_inventory.png new file mode 100644 index 0000000..105a2d2 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_inventory.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_straight.png b/mods/tnt/textures/tnt_gunpowder_straight.png new file mode 100644 index 0000000..8ab0e3c Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_straight.png differ diff --git a/mods/tnt/textures/tnt_gunpowder_t_junction.png b/mods/tnt/textures/tnt_gunpowder_t_junction.png new file mode 100644 index 0000000..ac997a7 Binary files /dev/null and b/mods/tnt/textures/tnt_gunpowder_t_junction.png differ diff --git a/mods/tnt/textures/tnt_side.png b/mods/tnt/textures/tnt_side.png new file mode 100644 index 0000000..d303473 Binary files /dev/null and b/mods/tnt/textures/tnt_side.png differ diff --git a/mods/tnt/textures/tnt_smoke.png b/mods/tnt/textures/tnt_smoke.png new file mode 100644 index 0000000..488b50f Binary files /dev/null and b/mods/tnt/textures/tnt_smoke.png differ diff --git a/mods/tnt/textures/tnt_top.png b/mods/tnt/textures/tnt_top.png new file mode 100644 index 0000000..31b807c Binary files /dev/null and b/mods/tnt/textures/tnt_top.png differ diff --git a/mods/tnt/textures/tnt_top_burning.png b/mods/tnt/textures/tnt_top_burning.png new file mode 100644 index 0000000..fc0d490 Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning.png differ diff --git a/mods/tnt/textures/tnt_top_burning_animated.png b/mods/tnt/textures/tnt_top_burning_animated.png new file mode 100644 index 0000000..18a270f Binary files /dev/null and b/mods/tnt/textures/tnt_top_burning_animated.png differ diff --git a/mods/vessels/README.txt b/mods/vessels/README.txt new file mode 100644 index 0000000..5bb798c --- /dev/null +++ b/mods/vessels/README.txt @@ -0,0 +1,22 @@ +Minetest Game mod: vessels +========================== +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Vanessa Ezekowitz (LGPL 2.1) +Modified by Perttu Ahola (LGPL 2.1) +Various Minetest developers and contributors (LGPL 2.1) + +Authors of media (textures) +--------------------------- +All not listed below, Vanessa Ezekowitz (CC BY-SA 3.0) + +The following textures were modified by Thomas-S (CC BY-SA 3.0): + vessels_drinking_glass.png + vessels_drinking_glass_inv.png + vessels_glass_bottle.png + vessels_steel_bottle.png + +The following texture was created by Wuzzy (CC BY-SA 3.0): + vessels_shelf_slot.png (based on vessels_glass_bottle.png) diff --git a/mods/vessels/depends.txt b/mods/vessels/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/vessels/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/vessels/init.lua b/mods/vessels/init.lua new file mode 100644 index 0000000..688413f --- /dev/null +++ b/mods/vessels/init.lua @@ -0,0 +1,216 @@ +-- Minetest 0.4 mod: vessels +-- See README.txt for licensing and other information. + +local vessels_shelf_formspec = + "size[8,7;]" .. + default.gui_bg .. + default.gui_bg_img .. + default.gui_slots .. + "list[context;vessels;0,0.3;8,2;]" .. + "list[current_player;main;0,2.85;8,1;]" .. + "list[current_player;main;0,4.08;8,3;8]" .. + "listring[context;vessels]" .. + "listring[current_player;main]" .. + default.get_hotbar_bg(0, 2.85) + +local function get_vessels_shelf_formspec(inv) + local formspec = vessels_shelf_formspec + local invlist = inv and inv:get_list("vessels") + -- Inventory slots overlay + local vx, vy = 0, 0.3 + for i = 1, 16 do + if i == 9 then + vx = 0 + vy = vy + 1 + end + if not invlist or invlist[i]:is_empty() then + formspec = formspec .. + "image[" .. vx .. "," .. vy .. ";1,1;vessels_shelf_slot.png]" + end + vx = vx + 1 + end + return formspec +end + +minetest.register_node("vessels:shelf", { + description = "Vessels Shelf", + tiles = {"default_wood.png", "default_wood.png", "default_wood.png", + "default_wood.png", "vessels_shelf.png", "vessels_shelf.png"}, + paramtype2 = "facedir", + is_ground_content = false, + groups = {choppy = 3, oddly_breakable_by_hand = 2, flammable = 3}, + sounds = default.node_sound_wood_defaults(), + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(nil)) + local inv = meta:get_inventory() + inv:set_size("vessels", 8 * 2) + end, + can_dig = function(pos,player) + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("vessels") + end, + allow_metadata_inventory_put = function(pos, listname, index, stack, player) + if minetest.get_item_group(stack:get_name(), "vessel") ~= 0 then + return stack:get_count() + end + return 0 + end, + on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) + minetest.log("action", player:get_player_name() .. + " moves stuff in vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_put = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " moves stuff to vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_metadata_inventory_take = function(pos, listname, index, stack, player) + minetest.log("action", player:get_player_name() .. + " takes stuff from vessels shelf at ".. minetest.pos_to_string(pos)) + local meta = minetest.get_meta(pos) + meta:set_string("formspec", get_vessels_shelf_formspec(meta:get_inventory())) + end, + on_blast = function(pos) + local drops = {} + default.get_inventory_drops(pos, "vessels", drops) + drops[#drops + 1] = "vessels:shelf" + minetest.remove_node(pos) + return drops + end, +}) + +minetest.register_craft({ + output = "vessels:shelf", + recipe = { + {"group:wood", "group:wood", "group:wood"}, + {"group:vessel", "group:vessel", "group:vessel"}, + {"group:wood", "group:wood", "group:wood"}, + } +}) + +minetest.register_node("vessels:glass_bottle", { + description = "Glass Bottle (empty)", + drawtype = "plantlike", + tiles = {"vessels_glass_bottle.png"}, + inventory_image = "vessels_glass_bottle.png", + wield_image = "vessels_glass_bottle.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "vessels:glass_bottle 10", + recipe = { + {"default:glass", "", "default:glass"}, + {"default:glass", "", "default:glass"}, + {"", "default:glass", ""} + } +}) + +minetest.register_node("vessels:drinking_glass", { + description = "Drinking Glass (empty)", + drawtype = "plantlike", + tiles = {"vessels_drinking_glass.png"}, + inventory_image = "vessels_drinking_glass_inv.png", + wield_image = "vessels_drinking_glass.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_glass_defaults(), +}) + +minetest.register_craft( { + output = "vessels:drinking_glass 14", + recipe = { + {"default:glass", "", "default:glass"}, + {"default:glass", "", "default:glass"}, + {"default:glass", "default:glass", "default:glass"} + } +}) + +minetest.register_node("vessels:steel_bottle", { + description = "Heavy Steel Bottle (empty)", + drawtype = "plantlike", + tiles = {"vessels_steel_bottle.png"}, + inventory_image = "vessels_steel_bottle.png", + wield_image = "vessels_steel_bottle.png", + paramtype = "light", + is_ground_content = false, + walkable = false, + selection_box = { + type = "fixed", + fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25} + }, + groups = {vessel = 1, dig_immediate = 3, attached_node = 1}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craft( { + output = "vessels:steel_bottle 5", + recipe = { + {"default:steel_ingot", "", "default:steel_ingot"}, + {"default:steel_ingot", "", "default:steel_ingot"}, + {"", "default:steel_ingot", ""} + } +}) + + +-- Glass and steel recycling + +minetest.register_craftitem("vessels:glass_fragments", { + description = "Pile of Glass Fragments", + inventory_image = "vessels_glass_fragments.png", +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:glass_bottle", + "vessels:glass_bottle", + }, +}) + +minetest.register_craft( { + type = "shapeless", + output = "vessels:glass_fragments", + recipe = { + "vessels:drinking_glass", + "vessels:drinking_glass", + }, +}) + +minetest.register_craft({ + type = "cooking", + output = "default:glass", + recipe = "vessels:glass_fragments", +}) + +minetest.register_craft( { + type = "cooking", + output = "default:steel_ingot", + recipe = "vessels:steel_bottle", +}) + +minetest.register_craft({ + type = "fuel", + recipe = "vessels:shelf", + burntime = 30, +}) diff --git a/mods/vessels/license.txt b/mods/vessels/license.txt new file mode 100644 index 0000000..de16a3b --- /dev/null +++ b/mods/vessels/license.txt @@ -0,0 +1,52 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2012-2016 celeron55, Perttu Ahola +Copyright (C) 2012-2016 Various Minetest developers and contributors + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Vanessa Ezekowitz +Copyright (C) 2016 Thomas-S + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/vessels/textures/vessels_drinking_glass.png b/mods/vessels/textures/vessels_drinking_glass.png new file mode 100644 index 0000000..d5037b8 Binary files /dev/null and b/mods/vessels/textures/vessels_drinking_glass.png differ diff --git a/mods/vessels/textures/vessels_drinking_glass_inv.png b/mods/vessels/textures/vessels_drinking_glass_inv.png new file mode 100644 index 0000000..9992bd9 Binary files /dev/null and b/mods/vessels/textures/vessels_drinking_glass_inv.png differ diff --git a/mods/vessels/textures/vessels_glass_bottle.png b/mods/vessels/textures/vessels_glass_bottle.png new file mode 100644 index 0000000..6ea37db Binary files /dev/null and b/mods/vessels/textures/vessels_glass_bottle.png differ diff --git a/mods/vessels/textures/vessels_glass_fragments.png b/mods/vessels/textures/vessels_glass_fragments.png new file mode 100644 index 0000000..7c6c488 Binary files /dev/null and b/mods/vessels/textures/vessels_glass_fragments.png differ diff --git a/mods/vessels/textures/vessels_shelf.png b/mods/vessels/textures/vessels_shelf.png new file mode 100644 index 0000000..87c69b2 Binary files /dev/null and b/mods/vessels/textures/vessels_shelf.png differ diff --git a/mods/vessels/textures/vessels_shelf_slot.png b/mods/vessels/textures/vessels_shelf_slot.png new file mode 100644 index 0000000..ff29082 Binary files /dev/null and b/mods/vessels/textures/vessels_shelf_slot.png differ diff --git a/mods/vessels/textures/vessels_steel_bottle.png b/mods/vessels/textures/vessels_steel_bottle.png new file mode 100644 index 0000000..61d3071 Binary files /dev/null and b/mods/vessels/textures/vessels_steel_bottle.png differ diff --git a/mods/walls/README.txt b/mods/walls/README.txt new file mode 100644 index 0000000..0389174 --- /dev/null +++ b/mods/walls/README.txt @@ -0,0 +1,7 @@ +Minetest Game mod: walls +======================== +See license.txt for license information. + +Authors of source code +---------------------- +Auke Kok (LGPL 2.1) diff --git a/mods/walls/depends.txt b/mods/walls/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/walls/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/walls/init.lua b/mods/walls/init.lua new file mode 100644 index 0000000..bee8e46 --- /dev/null +++ b/mods/walls/init.lua @@ -0,0 +1,46 @@ +walls = {} + +walls.register = function(wall_name, wall_desc, wall_texture, wall_mat, wall_sounds) + -- inventory node, and pole-type wall start item + minetest.register_node(wall_name, { + description = wall_desc, + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}}, + -- connect_bottom = + connect_front = {{-3/16, -1/2, -1/2, 3/16, 3/8, -1/4}}, + connect_left = {{-1/2, -1/2, -3/16, -1/4, 3/8, 3/16}}, + connect_back = {{-3/16, -1/2, 1/4, 3/16, 3/8, 1/2}}, + connect_right = {{ 1/4, -1/2, -3/16, 1/2, 3/8, 3/16}}, + }, + connects_to = { "group:wall", "group:stone" }, + paramtype = "light", + is_ground_content = false, + tiles = { wall_texture, }, + walkable = true, + groups = { cracky = 3, wall = 1, stone = 2 }, + sounds = wall_sounds, + }) + + -- crafting recipe + minetest.register_craft({ + output = wall_name .. " 6", + recipe = { + { '', '', '' }, + { wall_mat, wall_mat, wall_mat}, + { wall_mat, wall_mat, wall_mat}, + } + }) + +end + +walls.register("walls:cobble", "Cobblestone Wall", "default_cobble.png", + "default:cobble", default.node_sound_stone_defaults()) + +walls.register("walls:mossycobble", "Mossy Cobblestone Wall", "default_mossycobble.png", + "default:mossycobble", default.node_sound_stone_defaults()) + +walls.register("walls:desertcobble", "Desert Cobblestone Wall", "default_desert_cobble.png", + "default:desert_cobble", default.node_sound_stone_defaults()) + diff --git a/mods/walls/license.txt b/mods/walls/license.txt new file mode 100644 index 0000000..ccfaf1c --- /dev/null +++ b/mods/walls/license.txt @@ -0,0 +1,14 @@ +License of source code +---------------------- + +GNU Lesser General Public License, version 2.1 +Copyright (C) 2015 Auke Kok + +This program is free software; you can redistribute it and/or modify it under the terms +of the GNU Lesser General Public License as published by the Free Software Foundation; +either version 2.1 of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; +without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +See the GNU Lesser General Public License for more details: +https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html diff --git a/mods/wool/README.txt b/mods/wool/README.txt new file mode 100644 index 0000000..a66677d --- /dev/null +++ b/mods/wool/README.txt @@ -0,0 +1,16 @@ +Minetest Game mod: wool +======================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by Perttu Ahola (celeron55) (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +Cisoun (CC BY-SA 3.0): + wool_black.png wool_brown.png wool_dark_green.png wool_green.png + wool_magenta.png wool_pink.png wool_violet.png wool_yellow.png + wool_blue.png wool_cyan.png wool_dark_grey.png wool_grey.png + wool_orange.png wool_red.png wool_white.png diff --git a/mods/wool/depends.txt b/mods/wool/depends.txt new file mode 100644 index 0000000..4ad96d5 --- /dev/null +++ b/mods/wool/depends.txt @@ -0,0 +1 @@ +default diff --git a/mods/wool/init.lua b/mods/wool/init.lua new file mode 100644 index 0000000..a36e4dd --- /dev/null +++ b/mods/wool/init.lua @@ -0,0 +1,47 @@ +-- This uses a trick: you can first define the recipes using all of the base +-- colors, and then some recipes using more specific colors for a few non-base +-- colors available. When crafting, the last recipes will be checked first. + +local dyes = { + {"white", "White", "basecolor_white"}, + {"grey", "Grey", "basecolor_grey"}, + {"black", "Black", "basecolor_black"}, + {"red", "Red", "basecolor_red"}, + {"yellow", "Yellow", "basecolor_yellow"}, + {"green", "Green", "basecolor_green"}, + {"cyan", "Cyan", "basecolor_cyan"}, + {"blue", "Blue", "basecolor_blue"}, + {"magenta", "Magenta", "basecolor_magenta"}, + {"orange", "Orange", "excolor_orange"}, + {"violet", "Violet", "excolor_violet"}, + {"brown", "Brown", "unicolor_dark_orange"}, + {"pink", "Pink", "unicolor_light_red"}, + {"dark_grey", "Dark Grey", "unicolor_darkgrey"}, + {"dark_green", "Dark Green", "unicolor_dark_green"}, +} + +for i = 1, #dyes do + local name, desc, craft_color_group = unpack(dyes[i]) + + minetest.register_node("wool:" .. name, { + description = desc .. " Wool", + tiles = {"wool_" .. name .. ".png"}, + is_ground_content = false, + groups = {snappy = 2, choppy = 2, oddly_breakable_by_hand = 3, + flammable = 3, wool = 1}, + sounds = default.node_sound_defaults(), + }) + + minetest.register_craft{ + type = "shapeless", + output = "wool:" .. name, + recipe = {"group:dye," .. craft_color_group, "group:wool"}, + } +end + + +-- legacy + +-- Backwards compatibility with jordach's 16-color wool mod +minetest.register_alias("wool:dark_blue", "wool:blue") +minetest.register_alias("wool:gold", "wool:yellow") diff --git a/mods/wool/license.txt b/mods/wool/license.txt new file mode 100644 index 0000000..9310163 --- /dev/null +++ b/mods/wool/license.txt @@ -0,0 +1,60 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2012-2016 Perttu Ahola (celeron55) +Copyright (C) 2012-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2012-2016 Cisoun + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/wool/textures/wool_black.png b/mods/wool/textures/wool_black.png new file mode 100644 index 0000000..700d439 Binary files /dev/null and b/mods/wool/textures/wool_black.png differ diff --git a/mods/wool/textures/wool_blue.png b/mods/wool/textures/wool_blue.png new file mode 100644 index 0000000..a074986 Binary files /dev/null and b/mods/wool/textures/wool_blue.png differ diff --git a/mods/wool/textures/wool_brown.png b/mods/wool/textures/wool_brown.png new file mode 100644 index 0000000..2620dfd Binary files /dev/null and b/mods/wool/textures/wool_brown.png differ diff --git a/mods/wool/textures/wool_cyan.png b/mods/wool/textures/wool_cyan.png new file mode 100644 index 0000000..395b6ac Binary files /dev/null and b/mods/wool/textures/wool_cyan.png differ diff --git a/mods/wool/textures/wool_dark_green.png b/mods/wool/textures/wool_dark_green.png new file mode 100644 index 0000000..0e73999 Binary files /dev/null and b/mods/wool/textures/wool_dark_green.png differ diff --git a/mods/wool/textures/wool_dark_grey.png b/mods/wool/textures/wool_dark_grey.png new file mode 100644 index 0000000..7253696 Binary files /dev/null and b/mods/wool/textures/wool_dark_grey.png differ diff --git a/mods/wool/textures/wool_green.png b/mods/wool/textures/wool_green.png new file mode 100644 index 0000000..dcb663b Binary files /dev/null and b/mods/wool/textures/wool_green.png differ diff --git a/mods/wool/textures/wool_grey.png b/mods/wool/textures/wool_grey.png new file mode 100644 index 0000000..2f4c338 Binary files /dev/null and b/mods/wool/textures/wool_grey.png differ diff --git a/mods/wool/textures/wool_magenta.png b/mods/wool/textures/wool_magenta.png new file mode 100644 index 0000000..5c2c4a7 Binary files /dev/null and b/mods/wool/textures/wool_magenta.png differ diff --git a/mods/wool/textures/wool_orange.png b/mods/wool/textures/wool_orange.png new file mode 100644 index 0000000..a059f36 Binary files /dev/null and b/mods/wool/textures/wool_orange.png differ diff --git a/mods/wool/textures/wool_pink.png b/mods/wool/textures/wool_pink.png new file mode 100644 index 0000000..8e90140 Binary files /dev/null and b/mods/wool/textures/wool_pink.png differ diff --git a/mods/wool/textures/wool_red.png b/mods/wool/textures/wool_red.png new file mode 100644 index 0000000..da12ecf Binary files /dev/null and b/mods/wool/textures/wool_red.png differ diff --git a/mods/wool/textures/wool_violet.png b/mods/wool/textures/wool_violet.png new file mode 100644 index 0000000..d7d6783 Binary files /dev/null and b/mods/wool/textures/wool_violet.png differ diff --git a/mods/wool/textures/wool_white.png b/mods/wool/textures/wool_white.png new file mode 100644 index 0000000..88f1e2f Binary files /dev/null and b/mods/wool/textures/wool_white.png differ diff --git a/mods/wool/textures/wool_yellow.png b/mods/wool/textures/wool_yellow.png new file mode 100644 index 0000000..2b0f048 Binary files /dev/null and b/mods/wool/textures/wool_yellow.png differ diff --git a/mods/worldedit/.gitignore b/mods/worldedit/.gitignore new file mode 100644 index 0000000..5236e1e --- /dev/null +++ b/mods/worldedit/.gitignore @@ -0,0 +1,2 @@ +*~ + diff --git a/mods/worldedit/ChatCommands.md b/mods/worldedit/ChatCommands.md new file mode 100644 index 0000000..9d74c53 --- /dev/null +++ b/mods/worldedit/ChatCommands.md @@ -0,0 +1,476 @@ +Chat Commands +------------- +For more information, see the [README](README.md). + +Many commands also have shorter names that can be typed faster. For example, if we wanted to use `//move ? 5`, we could instead type `//m ? 5`. All shortened names are listed below: + +| Short Name | Original Name | +|:-----------|:-------------------| +| `//i` | `//inspect` | +| `//rst` | `//reset` | +| `//mk` | `//mark` | +| `//umk` | `//unmark` | +| `//1` | `//pos1` | +| `//2` | `//pos2` | +| `//fp` | `//fixedpos` | +| `//v` | `//volume` | +| `//s` | `//set` | +| `//r` | `//replace` | +| `//ri` | `//replaceinverse` | +| `//hcube` | `//hollowcube` | +| `//hspr` | `//hollowsphere` | +| `//spr` | `//sphere` | +| `//hdo` | `//hollowdome` | +| `//do` | `//dome` | +| `//hcyl` | `//hollowcylinder` | +| `//cyl` | `//cylinder` | +| `//hpyr` | `//hollowpyramid` | +| `//pyr` | `//pyramid` | + +### `//about` + +Get information about the mod. + + //about + +### `//inspect on/off/1/0/true/false/yes/no/enable/disable/` + +Enable or disable node inspection. + + //inspect on + //inspect off + //inspect 1 + //inspect 0 + //inspect true + //inspect false + //inspect yes + //inspect no + //inspect enable + //inspect disable + //inspect + +### `//reset` + +Reset the region so that it is empty. + + //reset + +### `//mark` + +Show markers at the region positions. + + //mark + +### `//unmark` + +Hide markers if currently shown. + + //unmark + +### `//pos1` + +Set WorldEdit region position 1 to the player's location. + + //pos1 + +### `//pos2` + +Set WorldEdit region position 2 to the player's location. + + //pos2 + +### `//p set/set1/set2/get` + +Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching nodes, or display the current WorldEdit region. + + //p set + //p set1 + //p set2 + //p get + +### `//fixedpos set1 x y z` + +Set a WorldEdit region position to the position at (``, ``, ``). + + //fixedpos set1 0 0 0 + //fixedpos set1 -30 5 28 + //fixedpos set2 1004 -200 432 + +### `//volume` + +Display the volume of the current WorldEdit region. + + //volume + +### `//deleteblocks` + +Delete the MapBlocks (16x16x16 units) that contain the selected region. This means that mapgen will be invoked for that area. As only whole MapBlocks get removed, the deleted area is usually larger than the selected one. Also, mapgen can trigger mechanisms like mud reflow or cavegen, which affects nodes (up to 112 nodes away) outside the MapBlock, so dont use this near buildings. Note that active entities are not part of a MapBlock and do not get deleted. + + //deleteblocks + +### `//set ` + +Set the current WorldEdit region to ``. + + //set air + //set cactus + //set Blue Lightstone + //set dirt with grass + +### `//param2 ` + +Set the param2 value of all nodes in the current WorldEdit region to ``. + +### `//mix ...` + +Fill the current WorldEdit region with a random mix of ``, `...`. + + //mix air + //mix cactus stone glass sandstone + //mix Bronze + //mix default:cobble air + +### `//replace ` + +Replace all instances of `` with `` in the current WorldEdit region. + + //replace Cobblestone air + //replace lightstone_blue glass + //replace dirt Bronze Block + //replace mesecons:wire_00000000_off flowers:flower_tulip + +### `//replaceinverse ` + +Replace all nodes other than `` with `` in the current WorldEdit region. + + //replaceinverse Cobblestone air + //replaceinverse flowers:flower_waterlily glass + //replaceinverse dirt Bronze Block + //replaceinverse mesecons:wire_00000000_off flowers:flower_tulip + +### `//hollowcube ` + +Adds a hollow cube with its ground level centered at WorldEdit position 1 with dimensions `` x `` x ``, composed of ``. + + //hollowcube 6 5 6 Diamond Block + +### `//cube ` + +Adds a cube with its ground level centered at WorldEdit position 1 with dimensions `` x `` x ``, composed of ``. + + //cube 6 5 6 Diamond Block + //cube 7 2 1 default:cobble + +### `//hollowsphere ` + +Add hollow sphere centered at WorldEdit position 1 with radius ``, composed of ``. + + //hollowsphere 5 Diamond Block + //hollowsphere 12 glass + //hollowsphere 17 mesecons:wire_00000000_off + +### `//sphere ` + +Add sphere centered at WorldEdit position 1 with radius ``, composed of ``. + + //sphere 5 Diamond Block + //sphere 12 glass + //sphere 17 mesecons:wire_00000000_off + +### `//hollowdome ` + +Add hollow dome centered at WorldEdit position 1 with radius ``, composed of ``. + + //hollowdome 5 Diamond Block + //hollowdome -12 glass + //hollowdome 17 mesecons:wire_00000000_off + +### `//dome ` + +Add dome centered at WorldEdit position 1 with radius ``, composed of ``. + + //dome 5 Diamond Block + //dome -12 glass + //dome 17 mesecons:wire_00000000_off + +### `//hollowcylinder x/y/z/? [radius2] ` + +Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length ``, base radius `` (and top radius `[radius2]`), composed of ``. + +Despite its name this command allows you to create cones (`radius2` = 0) as well as any shapes inbetween (0 < `radius2` < `radius1`). +Swapping `radius1` and `radius2` will create the same object but upside-down. + + //hollowcylinder x +5 8 Bronze Block + //hollowcylinder y 28 10 glass + //hollowcylinder z -12 3 mesecons:wire_00000000_off + //hollowcylinder ? 2 4 default:stone + + //hollowcylinder y 10 10 0 walls:cobble + //hollowcylinder x 6 0 5 Dirt + //hollowcylinder z 20 10 20 default:desert_stone + +### `//cylinder x/y/z/? [radius2] ` + +Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length ``, base radius `` (and top radius `[radius2]`), composed of ``. +Can also create shapes other than cylinders, e.g. cones (see documentation above). + + //cylinder x +5 8 Bronze Block + //cylinder y 28 10 glass + //cylinder z -12 3 mesecons:wire_00000000_off + //cylinder ? 2 4 default:stone + + //cylinder y 10 10 0 walls:cobble + //cylinder x 6 0 5 Dirt + //cylinder z 20 10 20 default:desert_stone + +### `//hollowpyramid x/y/z? ` + +Add hollow pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height ``, composed of ``. + + //hollowpyramid x 8 Diamond Block + //hollowpyramid y -5 glass + //hollowpyramid z 2 mesecons:wire_00000000_off + //hollowpyramid ? 12 mesecons:wire_00000000_off + +### `//pyramid x/y/z? ` + +Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height ``, composed of ``. + + //pyramid x 8 Diamond Block + //pyramid y -5 glass + //pyramid z 2 mesecons:wire_00000000_off + //pyramid ? 12 mesecons:wire_00000000_off + +### `//spiral ` + +Add spiral centered at WorldEdit position 1 with side length ``, height ``, space between walls ``, composed of ``. + + //spiral 20 5 3 Diamond Block + //spiral 5 2 1 glass + //spiral 7 1 5 mesecons:wire_00000000_off + +### `//copy x/y/z/? ` + +Copy the current WorldEdit region along the x/y/z/? axis by `` nodes. + + //copy x 15 + //copy y -7 + //copy z +4 + //copy ? 8 + +### `//move x/y/z/? ` + +Move the current WorldEdit positions and region along the x/y/z/? axis by `` nodes. + + //move x 15 + //move y -7 + //move z +4 + //move ? -1 + +### `//stack x/y/z/? ` + +Stack the current WorldEdit region along the x/y/z/? axis `` times. + + //stack x 3 + //stack y -1 + //stack z +5 + //stack ? 12 + +### `//stack2 ` + +Stack the current WorldEdit region `` times by offset ``, ``, ``. + + //stack2 5 3 8 2 + //stack2 1 -1 -1 -1 + +### `//scale ` + +Scale the current WorldEdit positions and region by a factor of positive integer `` with position 1 as the origin. + + //scale 2 + //scale 1 + //scale 10 + +### `//transpose x/y/z/? x/y/z/?` + +Transpose the current WorldEdit positions and region along the x/y/z/? and x/y/z/? axes. + + //transpose x y + //transpose x z + //transpose y z + //transpose ? y + +### `//flip x/y/z/?` + +Flip the current WorldEdit region along the x/y/z/? axis. + + //flip x + //flip y + //flip z + //flip ? + +### `//rotate x/y/z/? ` + +Rotate the current WorldEdit positions and region along the x/y/z/? axis by angle `` (90 degree increment). + + //rotate x 90 + //rotate y 180 + //rotate z 270 + //rotate ? -90 + +### `//orient ` + +Rotate oriented nodes in the current WorldEdit region around the Y axis by angle `` (90 degree increment) + + //orient 90 + //orient 180 + //orient 270 + //orient -90 + +### `//fixlight` + +Fixes the lighting in the current WorldEdit region. + + //fixlight + +### `//drain` + +Removes any fluid node within the current WorldEdit region. + + //drain + +### `//hide` + +Hide all nodes in the current WorldEdit region non-destructively. + + //hide + +### `//suppress ` + +Suppress all in the current WorldEdit region non-destructively. + + //suppress Diamond Block + //suppress glass + //suppress mesecons:wire_00000000_off + +### `//highlight ` + +Highlight in the current WorldEdit region by hiding everything else non-destructively. + + //highlight Diamond Block + //highlight glass + //highlight mesecons:wire_00000000_off + +### `//restore` + +Restores nodes hidden with WorldEdit in the current WorldEdit region. + + //restore + +### `//save ` + +Save the current WorldEdit region to "(world folder)/schems/``.we". + + //save some random filename + //save huge_base + +### `//allocate ` + +Set the region defined by nodes from "(world folder)/schems/``.we" as the current WorldEdit region. + + //allocate some random filename + //allocate huge_base + +### `//load ` + +Load nodes from "(world folder)/schems/``.we" with position 1 of the current WorldEdit region as the origin. + + //load some random filename + //load huge_base + +### `//lua ` + +Executes `` as a Lua chunk in the global namespace. + + //lua worldedit.pos1["singleplayer"] = {x=0, y=0, z=0} + //lua worldedit.rotate(worldedit.pos1["singleplayer"], worldedit.pos2["singleplayer"], "y", 90) + +### `//luatransform ` + +Executes `` as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region. + + //luatransform minetest.add_node(pos, {name="default:stone"}) + //luatransform if minetest.get_node(pos).name == "air" then minetest.add_node(pos, {name="default:water_source"}) + +### `//mtschemcreate ` + +Save the current WorldEdit region using the Minetest Schematic format to "(world folder)/schems/``.mts". + + //mtschemcreate some random filename + //mtschemcreate huge_base + +### `//mtschemplace ` + +Load nodes from "(world folder)/schems/``.mts" with position 1 of the current WorldEdit region as the origin. + + //mtschemplace some random filename + //mtschemplace huge_base + +### `//mtschemprob start/finish/get` + +After using `//mtschemprob start` all nodes punched will bring up a text field where a probablity can be entered. +This mode can be left with `//mtschemprob finish`. `//mtschemprob get` will display the probabilities saved for the nodes. + + //mtschemprob get + +### `//clearobjects` + +Clears all objects within the WorldEdit region. + + //clearobjects + +### `//shift x/y/z/?/up/down/left/right/front/back [+|-]` + +Shifts the selection area by `[+|-]` without touching its contents. The shifting axis can be absolute (`x/y/z`) or +relative (`up/down/left/right/front/back`). + + //shift left 5 + +### `//expand [+|-]x/y/z/?/up/down/left/right/front/back [reverse-amount]` + +Expands the selection by `` in the selected absolute or relative axis. If specified, the selection can be expanded in the +opposite direction over the same axis by `[reverse-amount]`. + + //expand right 7 5 + +### `//contract [+|-]x/y/z/?/up/down/left/right/front/back [reverse-amount]` + +Contracts the selection by `` in the selected absolute or relative axis. If specified, the selection can be contracted in the +opposite direction over the same axis by `[reverse-amount]`. + + //expand right 7 5 + +### `//outset [hv] ` + +Expands the selection in all directions by ``. If specified, the selection can be expanded horizontally in the x and z axes `[h]` +or vertically in the y axis `[v]`. + + //outset v 5 + +### `//inset [hv] ` + +Contracts the selection in all directions by ``. If specified, the selection can be contracted horizontally in the x and z axes `[h]` +or vertically in the y axis `[v]`. + + //outset v 5 + +### `//brush none/ [parameters]` + +Assigns the given `` to the currently held brush item, it will be ran with the first pointed solid node (as determined via raycast) as +WorldEdit position 1 when using that specific brush item. +Passing `none` instead clears the command assigned to the currently held brush item. +Note that this functionality requires the `worldedit_brush` mod enabled. + + //brush cube 8 8 8 Cobblestone + //brush spr 12 glass + //brush none diff --git a/mods/worldedit/LICENSE.txt b/mods/worldedit/LICENSE.txt new file mode 100644 index 0000000..dba13ed --- /dev/null +++ b/mods/worldedit/LICENSE.txt @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/mods/worldedit/README.md b/mods/worldedit/README.md new file mode 100644 index 0000000..c781e57 --- /dev/null +++ b/mods/worldedit/README.md @@ -0,0 +1,161 @@ +WorldEdit v1.2 +============== +The ultimate in-game world editing tool for [Minetest](http://minetest.net/)! Tons of functionality to help with building, fixing, and more. + +For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?id=572) at the Minetest forums. + +# New users should see the [tutorial](Tutorial.md). + +![Screenshot](http://i.imgur.com/lwhodrv.png) + +Installing +---------- + +If you are using Windows, consider installing this mod using [MODSTER](https://forum.minetest.net/viewtopic.php?id=6497), a super simple mod installer that will take care of everything for you. If you are using MODSTER, skip directly to step 6 in the instructions below. + +There is a nice installation guide over at the [Minetest Wiki](http://wiki.minetest.com/wiki/Installing_mods). Here is a short summary: + +1. Download the mod from the [official releases page](https://github.com/Uberi/Minetest-WorldEdit/releases). The download links are labelled "Source Code". If you are using Windows, you will probably want to download the ZIP version. +2. You should have a file named `SOMETHING.zip` or `SOMETHING.tar.gz`. +3. Extract this file using your archiver of choice. If you are using Windows, open the ZIP file and move the folder inside to a safe place outside of the ZIP file. +4. Make sure that you now have a folder with a file named README.md inside it. If you just have another folder inside this folder, use this nested folder instead. +5. Move this folder into the `MINETEST_FOLDER/mods` folder, where `MINETEST_FOLDER` is the folder Minetest is located in. +6. Open Minetest to a world selection screen. +7. Select a world you want to use WorldEdit in by left clicking on it once, and press the **Configure** button. +8. You should have a mod selection screen. Select the one named something like `Minetest-WorldEdit` by left clicking once and press the **Enable MP** button. +9. Press the **Save** button. You can now use WorldEdit in that world. Repeat steps 7 to 9 to enable WorldEdit for other worlds too. + +If you are having trouble, try asking for help in the [IRC channel](http://webchat.freenode.net/?channels=#minetest) (faster but may not always have helpers online) or ask on the [forum topic](https://forum.minetest.net/viewtopic.php?id=572) (slower but more likely to get help). + +Usage +----- +WorldEdit works primarily through the WorldEdit GUI and chat commands. Depending on your key bindings, you can invoke chat entry with the "t" key, and open the chat console with the "F10" key. + +WorldEdit has a huge potential for abuse by untrusted players. Therefore, users will not be able to use WorldEdit unless they have the `worldedit` privelege. This is available by default in single player, but in multiplayer the permission must be explicitly given by someone with the right credentials, using the follwoing chat command: `/grant worldedit`. This privelege can later be removed using the following chat command: `/revoke worldedit`. + +Certain functions/commands such as WorldEdit `//lua` and `//luatransform` chat commands additionally require the `server` privilege. This is because it is extremely dangerous to give access to these commands to untrusted players, since they essentially are able to control the computer the server is running on. Give this privilege only to people you trust with your computer. + +For in-game information about these commands, type `/help ` in the chat. For example, to learn more about the `//copy` command, simply type `/help /copy` to display information relevant to copying a region. + +Interface +--------- +WorldEdit is accessed in-game in two main ways. + +The GUI adds a screen to each player's inventory that gives access to various WorldEdit functions. The [tutorial](Tutorial.md) and the [Chat Commands Reference](ChatCommands.md) may be helpful in learning to use it. + +The chat interface adds many chat commands that perform various WorldEdit powered tasks. It is documented in the [Chat Commands Reference](ChatCommands.md). + +Compatibility +------------- +This mod supports Minetest versions 0.4.8 and newer. Older versions of WorldEdit may work with older versions of Minetest, but are not recommended or supported. + +WorldEdit works quite well with other mods, and does not have any known mod conflicts. + +WorldEdit GUI requires one of [sfinv](https://github.com/minetest/minetest_game/tree/master/mods/sfinv) (included in minetest_game since 0.4.15), [Unified Inventory](https://forum.minetest.net/viewtopic.php?id=3933) or [Inventory++](https://forum.minetest.net/viewtopic.php?id=6204). + +If you use any other inventory manager mods, note that they may conflict with the WorldEdit GUI. If this is the case, it may be necessary to disable them. + +WorldEdit API +------------- +WorldEdit exposes all significant functionality in a simple Lua interface. + +Adding WorldEdit to the file "depends.txt" in your mod gives you access to all of the `worldedit` functions. The API is useful for tasks such as high-performance node manipulation, alternative interfaces, and map creation. + +AGPLv3 compatible mods may further include WorldEdit files in their own mods. This may be useful if a modder wishes to completely avoid any dependencies on WorldEdit. Note that it is required to give credit to the authors. + +This API is documented in the [WorldEdit API Reference](WorldEdit%20API.md). + +Axes +---- +The coordinate system is the same as that used by Minetest; positive Y is upwards, positive X is rightwards, and positive Z is forwards, if a player is facing North (positive Z axis). + +When an axis is specified in a WorldEdit chat command, it is specified as one of the following values: `x`, `y`, `z`, or `?`. + +In the GUI, there is a dropdown menu for this purpose. The "Look direction" option has the same effect as `?` does in chat commands. + +The value `?` represents the axis the player is currently facing. If the player is facing more than one axis, the axis the player face direction is closest to will be used. + +Nodes +----- +Node names are required for many types of commands that identify or modify specific types of nodes. They can be specified in a number of ways. + +First, by description - the tooltip that appears when hovering over the item in an inventory. This is case insensitive and includes values such as "Cobblestone" and "bronze block". Note that certain commands (namely, `//replace` and `//replaceinverse`) do not support descriptions that contain spaces in the `` field. + +Second, by name - the node name that is defined by code, but without the mod name prefix. This is case sensitive and includes values such as "piston_normal_off" and "cactus". Nodes defined in the `default` mod always take precedence over other nodes when searching for the correct one, and if there are multiple possible nodes (such as "a:celery" and "b:celery"), one is chosen in no particular order. + +Finally, by full name - the unambiguous identifier of the node, prefixes and all. This is case sensitive and includes values such as "default:stone" and "mesecons:wire_00000000_off". + +The node name "air" can be used anywhere a normal node name can, and acts as a blank node. This is useful for clearing or removing nodes. For example, `//set air` would remove all the nodes in the current WorldEdit region. Similarly, `//sphere 10 air`, when WorldEdit position 1 underground, would dig a large sphere out of the ground. + +Regions +------- +Most WorldEdit commands operate on regions. Regions are a set of two positions that define a 3D cuboid. They are local to each player and chat commands affect only the region for the player giving the commands. + +Each positions together define two opposing corners of the cube. With two opposing corners it is possible to determine both the location and dimensions of the region. + +Regions are not saved between server restarts. They start off as empty regions, and cannot be used with most WorldEdit commands until they are set to valid values. + +Markers +------- +Entities are used to mark the location of the WorldEdit regions. They appear as boxes containing the number 1 or 2, and represent position 1 and 2 of the WorldEdit region, respectively. + +To remove the entities, simply punch them. This does not reset the positions themselves. + +Schematics +---------- +WorldEdit supports two different types of schematics. + +The first is the WorldEdit Schematic format, with the file extension ".we", and in some older versions, ".wem". There have been several previous versions of the WorldEdit Schematic format, but WorldEdit is capable of loading any past versions, and will always support them - there is no need to worry about schematics becoming obselete. + +As of version 5, WorldEdit schematics include a header. The header is seperated from the content by a colon (`:`). It contains fields seperated by commas (`,`). Currently only one field is used, which contains the version in ASCII decimal. + +The current version of the WorldEdit Schematic format is essentially an array of node data tables in Lua 5.1 table syntax preceded by a header. +Specifically it looks like this: + + 5:return { + { + y = , + x = , + z = , + name = , + param1 = , + param2 = , + meta = , + }, + <...> + } + + +The ordering of the values and minor aspects of the syntax, such as trailing commas or newlines, are not guaranteed to stay the same in future versions. + +The WorldEdit Schematic format is accessed via the WorldEdit API, or WorldEdit serialization chat commands such as `//serialize` and `//deserialize`. + +The second is the Minetest Schematic format (MTS). The details of this format may be found in the Minetest documentation and are out of the scope of this document. Access to this format is done via specialized MTS commands such as `//mtschemcreate` and `//mtschemplace`. + +Authors +------- +WorldEdit would not be possible without the contributions of many developers and designers. Below, they are listed alphabetically: + + cheapie + cornernote + cyisfor + danierukun + electricface + est31 + kaeza + khonkhortisan + pickardjoe + Sebastien Ponce + sfan5 + ShadowNinja + spillz + Uberi/Temperest + +License +------- +Copyright 2013 sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote). + +This mod is licensed under the [GNU Affero General Public License](http://www.gnu.org/licenses/agpl-3.0.html). + +Basically, this means everyone is free to use, modify, and distribute the files, as long as these modifications are also licensed the same way. +Most importantly, the Affero variant of the GPL requires you to publish your modifications in source form, even if the mod is run only on the server, and not distributed. diff --git a/mods/worldedit/Tutorial.md b/mods/worldedit/Tutorial.md new file mode 100644 index 0000000..bcac1aa --- /dev/null +++ b/mods/worldedit/Tutorial.md @@ -0,0 +1,120 @@ +WorldEdit Tutorial +================== +This is a step-by-step tutorial outlining the basic usage of WorldEdit. For more information, see the [README](README.md). + +Let's start with a few assumptions: + +* You have a compatible version of Minetest working. + * See the [README](README.md) for compatibility information. +* You have WorldEdit installed as a mod. + * If using Windows, [MODSTER](https://forum.minetest.net/viewtopic.php?pid=101463) makes installing mods totally painless. + * Simply download the file, extract the archive, and move it to the correct mod folder for Minetest. + * See the installation instructions in [README](README.md) if you need more details. +* You are familiar with the basics of the game. + * How to walk, jump, and climb. + * How to dig, place, and punch blocks. + * One of the following: + * How to type into the chat and read text from it. + * How to open the inventory screen and press buttons on it. + +Overview +-------- +WorldEdit has a "region", which is simply a cuboid area defined by two markers, both of which the player can move around. Every player can have their own region with their own two markers. + +WorldEdit GUI buttons and chat commands generally work inside the region selected, or around the first marker. + +If you are using the chat commands, follow the steps under **Chat Commands**. If you are using the WorldEdit GUI, follow the steps under **WorldEdit GUI**. + +Step 1: Selecting a region +-------------------------- +### Chat Commands + +In the chat prompt, enter `//p set`. In the chat, you are prompted to punch two nodes to set the positions of the two markers. + +Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1. + +Walk away from the node you just punched. Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2. + +### WorldEdit GUI + +Open the main WorldEdit GUI from your inventory screen. The icon looks like a globe with a red dot in the center. + +Press the "Get/Set Positions" button. On the new screen, press the "Set Position 1" button. The inventory screen should close. + +Punch a nearby node. Be careful of breakable ones such as torches. A black cube reading "1" will appear around the node. This is the marker for WorldEdit position 1. + +Walk away from the node you just punched. Open your inventory again. It should be on the same page as it was before. + +Press the "Set Position 2" button. The inventory screen should close. + +Now, punch another node. A black cube reading "2" will appear around the node. This is the marker for WorldEdit position 2. + +Step 2: Region commands +----------------------- +### Chat Commands + +In the chat prompt, enter `//set mese`. In the chat, you will see a message showing the number of nodes set after a small delay. + +Look at the place between the two markers: it is now filled with MESE blocks! + +The `//set ` command fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only. + +Now, try a few different variations, such as `//set torch`, `//set cobble`, and `//set water`. + +### WorldEdit GUI + +Open the main WorldEdit GUI from your inventory screen. + +Press the "Set Nodes" button. You should see a new screen with various options for setting nodes. + +Enter "mese" in the "Name" field. Press Search if you would like to see what the node you just entered looks like. + +Press the "Set Nodes" button on this screen. In the chat, you will see a message showing the number of nodes set after a small delay. + +Look at the place between the two markers: it is now filled with MESE blocks! + +The "Set Nodes" function fills the region with whatever node you want. It is a region-oriented command, which means it works inside the WorldEdit region only. + +Now, try a few different variations on the node name, such as "torch", "cobble", and "water". + +Step 3: Position commands +------------------------- +### Chat Commands + +In the chat prompt, enter `//hollowdome 30 glass`. In the chat, you will see a message showing the number of nodes set after a small delay. + +Look around marker 1: it is now surrounded by a hollow glass dome! + +The `//hollowdome ` command creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region. + +### WorldEdit GUI + +Open the main WorldEdit GUI from your inventory screen. + +Press the "Sphere/Dome" button. You should see a new screen with various options for making spheres or domes. + +Enter "glass" in the "Name" field. Press Search if you would like to see what the node you just entered looks like. + +Enter "30" in the "Radius" field. + +Press the "Hollow Dome" button on this screen. In the chat, you will see a message showing the number of nodes added after a small delay. + +Look around marker 1: it is now surrounded by a hollow glass dome! + +The "Hollow Dome" function creates a hollow dome centered around marker 1, made of any node you want. It is a position-oriented command, which means it works around marker 1 and can go outside the WorldEdit region. + +Step 4: Other commands +---------------------- +### Chat Commands + +There are many more commands than what is shown here. See the [Chat Commands Reference](ChatCommands.md) for a detailed list of them, along with descriptions and examples for every single one. + +If you're in-game and forgot how a command works, just use the `/help ` command, without the first forward slash. For example, to see some information about the `//set ` command mentioned earlier, simply use `/help /set`. + +A very useful command to check out is the `//save ` command, which can save everything inside the WorldEdit region to a file, stored on the computer hosting the server (the player's computer, in single player mode). You can then later use `//load ` to load the data in a file into a world, even another world on another computer. + +### WorldEdit GUI + +This only scratches the surface of what WorldEdit is capable of. Most of the functions in the WorldEdit GUI correspond to chat commands, and so the [Chat Commands Reference](ChatCommands.md) may be useful if you get stuck. + +It is helpful to explore the various buttons in the interface and check out what they do. Learning the chat command interface is also useful if you use WorldEdit intensively - an experienced chat command user can usually work faster than an experienced WorldEdit GUI user. \ No newline at end of file diff --git a/mods/worldedit/WorldEdit API.md b/mods/worldedit/WorldEdit API.md new file mode 100644 index 0000000..3263ddf --- /dev/null +++ b/mods/worldedit/WorldEdit API.md @@ -0,0 +1,237 @@ +WorldEdit API +============= +The WorldEdit API is composed of multiple modules, each of which is independent and can be used without the other. Each module is contained within a single file. + +If needed, individual modules such as visualization.lua can be removed without affecting the rest of the program. The only file that cannot be removed is init.lua, which is necessary for the mod to run. + +For more information, see the [README](README.md). + +General +------- + +### value = worldedit.version + +Contains the current version of WorldEdit in a table of the form `{major=MAJOR_INTEGER, minor=MINOR_INTEGER}`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for version checking purposes. + +### value = worldedit.version_string + +Contains the current version of WorldEdit in the form of a string `"MAJOR_INTEGER.MINOR_INTEGER"`, where `MAJOR_INTEGER` is the major version (the number before the period) as an integer, and `MINOR_INTEGER` is the minor version (the number after the period) as an integer. This is intended for display purposes. + +Manipulations +------------- +Contained in manipulations.lua, this module allows several node operations to be applied over a region. + +### count = worldedit.set(pos1, pos2, node_name) + +Sets a region defined by positions `pos1` and `pos2` to `node_name`. To clear a region, use "air" as the value of `node_name`. + +Returns the number of nodes set. + +### `count = worldedit.set_param2(pos1, pos2, param2)` + +Sets the param2 values of all nodes in a region defined by positions `pos1` and `pos2` to `param2`. + +Returns the number of nodes set. + +### count = worldedit.replace(pos1, pos2, searchnode, replacenode) + +Replaces all instances of `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`. + +Returns the number of nodes replaced. + +### count = worldedit.replaceinverse(pos1, pos2, searchnode, replacenode) + +Replaces all nodes other than `searchnode` with `replacenode` in a region defined by positions `pos1` and `pos2`. + +Returns the number of nodes replaced. + +### count = worldedit.copy(pos1, pos2, axis, amount) + +Copies the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes. + +Returns the number of nodes copied. + +### count = worldedit.copy2(pos1, pos2, off) + +Copies the region defined by positions `pos1` and `pos2` by the offset vector `off`. + +Returns the number of nodes copied. + +### count = worldedit.move(pos1, pos2, axis, amount) + +Moves the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") by `amount` nodes. + +Returns the number of nodes moved. + +### count = worldedit.stack(pos1, pos2, axis, count) + +Duplicates the region defined by positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z") `count` times. + +Returns the number of nodes stacked. + +### count = worldedit.stack2(pos1, pos2, direction, amount) + +Duplicates the region defined by positions `pos1` and `pos2` `amount` times with offset vector `direction`. + +Returns the number of nodes stacked. + +### count, newpos1, newpos2 = worldedit.stretch(pos1, pos2, stretchx, stretchy, stretchz) + +Stretches the region defined by positions `pos1` and `pos2` by an factor of positive integers `stretchx`, `stretchy`. and `stretchz` along the X, Y, and Z axes, respectively, with `pos1` as the origin. + +Returns the number of nodes stretched, the new scaled position 1, and the new scaled position 2. + +### count, newpos1, newpos2 = worldedit.transpose(pos1, pos2, axis1, axis2) + +Transposes a region defined by the positions `pos1` and `pos2` between the `axis1` and `axis2` axes ("x" or "y" or "z"). + +Returns the number of nodes transposed, the new transposed position 1, and the new transposed position 2. + +### count = worldedit.flip(pos1, pos2, axis) + +Flips a region defined by the positions `pos1` and `pos2` along the `axis` axis ("x" or "y" or "z"). + +Returns the number of nodes flipped. + +### count, newpos2, newpos2 = worldedit.rotate(pos1, pos2, angle) + +Rotates a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise around the y axis (supporting 90 degree increments only). + +Returns the number of nodes rotated, the new position 1, and the new position 2. + +### count = worldedit.orient(pos1, pos2, angle) + +Rotates all oriented nodes in a region defined by the positions `pos1` and `pos2` by `angle` degrees clockwise (90 degree increment) around the Y axis. + +Returns the number of nodes oriented. + +### count = worldedit.fixlight(pos1, pos2) + +Fixes the lighting in a region defined by positions `pos1` and `pos2`. + +Returns the number of nodes updated. + +### count = worldedit.clearobjects(pos1, pos2) + +Clears all objects in a region defined by the positions `pos1` and `pos2`. + +Returns the number of objects cleared. + +Primitives +---------- +Contained in primitives.lua, this module allows the creation of several geometric primitives. + +### count = worldedit.cube(pos, width, height, length, node_name, hollow) + +Adds a cube with its ground level centered at `pos`, the dimensions `width` x `height` x `length`, composed of `node_name`. + +Returns the number of nodes added. + +### count = worldedit.sphere(pos, radius, node_name, hollow) + +Adds a sphere centered at `pos` with radius `radius`, composed of `node_name`. + +Returns the number of nodes added. + +### count = worldedit.dome(pos, radius, node_name, hollow) + +Adds a dome centered at `pos` with radius `radius`, composed of `node_name`. + +Returns the number of nodes added. + +### count = worldedit.cylinder(pos, axis, length, radius1, radius2, node_name, hollow) + +Adds a cylinder-like at `pos` along the `axis` axis ("x" or "y" or "z") with length `length`, base radius `radius1` and top radius `radius2`, composed of `node_name`. + +Returns the number of nodes added. + +### count = worldedit.pyramid(pos, axis, height, node_name, hollow) + +Adds a pyramid centered at `pos` along the `axis` axis ("x" or "y" or "z") with height `height`, composed of `node_name`. + +Returns the number of nodes added. + +### count = worldedit.spiral(pos, length, height, spacer, node_name) + +Adds a spiral centered at `pos` with side length `length`, height `height`, space between walls `spacer`, composed of `node_name`. + +Returns the number of nodes added. + +Visualization +------------- +Contained in visualization.lua, this module allows nodes to be visualized in different ways. + +### volume = worldedit.volume(pos1, pos2) + +Determines the volume of the region defined by positions `pos1` and `pos2`. + +Returns the volume. + +### count = worldedit.hide(pos1, pos2) + +Hides all nodes in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes. + +Returns the number of nodes hidden. + +### count = worldedit.suppress(pos1, pos2, node_name) + +Suppresses all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively replacing them with invisible nodes. + +Returns the number of nodes suppressed. + +### count = worldedit.highlight(pos1, pos2, node_name) + +Highlights all instances of `node_name` in a region defined by positions `pos1` and `pos2` by non-destructively hiding all other nodes. + +Returns the number of nodes found. + +### count = worldedit.restore(pos1, pos2) + +Restores all nodes hidden with WorldEdit functions in a region defined by positions `pos1` and `pos2`. + +Returns the number of nodes restored. + +Serialization +------------- +Contained in serialization.lua, this module allows regions of nodes to be serialized and deserialized to formats suitable for use outside Minetest. + +### version, extra_fields, content = worldedit.read_header(value) + +Reads the header from serialized data `value`. + +Returns the version as a positive integer (nil for unknown versions), +extra header fields (nil if not supported), and the content after the header. + +### data, count = worldedit.serialize(pos1, pos2) + +Converts the region defined by positions `pos1` and `pos2` into a single string. + +Returns the serialized data and the number of nodes serialized, or nil. + +### pos1, pos2, count = worldedit.allocate(origin_pos, value) + +Determines the volume the nodes represented by string `value` would occupy if deserialized at `origin_pos`. + +Returns the two corner positions and the number of nodes, or nil. + +### count = worldedit.deserialize(origin_pos, value) + +Loads the nodes represented by string `value` at position `origin_pos`. + +Returns the number of nodes deserialized or nil. + +Code +---- +Contained in code.lua, this module allows arbitrary Lua code to be used with WorldEdit. + +### error = worldedit.lua(code) + +Executes `code` as a Lua chunk in the global namespace. + +Returns an error if the code fails or nil otherwise. + +### error = worldedit.luatransform(pos1, pos2, code) + +Executes `code` as a Lua chunk in the global namespace with the variable `pos` available, for each node in a region defined by positions `pos1` and `pos2`. + +Returns an error if the code fails or nil otherwise. diff --git a/mods/worldedit/config.ld b/mods/worldedit/config.ld new file mode 100644 index 0000000..69be224 --- /dev/null +++ b/mods/worldedit/config.ld @@ -0,0 +1,12 @@ +project = "WorldEdit" +title = "WorldEdit API Documentation" +description = "Minetest mod to mass-modify nodes" +format = "markdown" +file = {"worldedit"} +topics = { + "README.md", + "Tutorial.md", + "ChatCommands.md", + "LICENSE.txt" +} + diff --git a/mods/worldedit/modpack.txt b/mods/worldedit/modpack.txt new file mode 100644 index 0000000..e69de29 diff --git a/mods/worldedit/worldedit/code.lua b/mods/worldedit/worldedit/code.lua new file mode 100644 index 0000000..48c992e --- /dev/null +++ b/mods/worldedit/worldedit/code.lua @@ -0,0 +1,52 @@ +--- Lua code execution functions. +-- @module worldedit.code + +--- Executes `code` as a Lua chunk in the global namespace. +-- @return An error message if the code fails, or nil on success. +function worldedit.lua(code) + local func, err = loadstring(code) + if not func then -- Syntax error + return err + end + local good, err = pcall(func) + if not good then -- Runtime error + return err + end + return nil +end + + +--- Executes `code` as a Lua chunk in the global namespace with the variable +-- pos available, for each node in a region defined by positions `pos1` and +-- `pos2`. +-- @return An error message if the code fails, or nil on success. +function worldedit.luatransform(pos1, pos2, code) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local factory, err = loadstring("return function(pos) " .. code .. " end") + if not factory then -- Syntax error + return err + end + local func = factory() + + worldedit.keep_loaded(pos1, pos2) + + local pos = {x=pos1.x, y=0, z=0} + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local good, err = pcall(func, pos) + if not good then -- Runtime error + return err + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return nil +end + diff --git a/mods/worldedit/worldedit/common.lua b/mods/worldedit/worldedit/common.lua new file mode 100644 index 0000000..be9a2c9 --- /dev/null +++ b/mods/worldedit/worldedit/common.lua @@ -0,0 +1,114 @@ +--- Common functions [INTERNAL]. All of these functions are internal! +-- @module worldedit.common + +--- Copies and modifies positions `pos1` and `pos2` so that each component of +-- `pos1` is less than or equal to the corresponding component of `pos2`. +-- Returns the new positions. +function worldedit.sort_pos(pos1, pos2) + pos1 = {x=pos1.x, y=pos1.y, z=pos1.z} + pos2 = {x=pos2.x, y=pos2.y, z=pos2.z} + if pos1.x > pos2.x then + pos2.x, pos1.x = pos1.x, pos2.x + end + if pos1.y > pos2.y then + pos2.y, pos1.y = pos1.y, pos2.y + end + if pos1.z > pos2.z then + pos2.z, pos1.z = pos1.z, pos2.z + end + return pos1, pos2 +end + + +--- Determines the volume of the region defined by positions `pos1` and `pos2`. +-- @return The volume. +function worldedit.volume(pos1, pos2) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + return (pos2.x - pos1.x + 1) * + (pos2.y - pos1.y + 1) * + (pos2.z - pos1.z + 1) +end + + +--- Gets other axes given an axis. +-- @raise Axis must be x, y, or z! +function worldedit.get_axis_others(axis) + if axis == "x" then + return "y", "z" + elseif axis == "y" then + return "x", "z" + elseif axis == "z" then + return "x", "y" + else + error("Axis must be x, y, or z!") + end +end + + +function worldedit.keep_loaded(pos1, pos2) + local manip = minetest.get_voxel_manip() + manip:read_from_map(pos1, pos2) +end + + +local mh = {} +worldedit.manip_helpers = mh + + +--- Generates an empty VoxelManip data table for an area. +-- @return The empty data table. +function mh.get_empty_data(area) + -- Fill emerged area with ignore so that blocks in the area that are + -- only partially modified aren't overwriten. + local data = {} + local c_ignore = minetest.get_content_id("ignore") + for i = 1, worldedit.volume(area.MinEdge, area.MaxEdge) do + data[i] = c_ignore + end + return data +end + + +function mh.init(pos1, pos2) + local manip = minetest.get_voxel_manip() + local emerged_pos1, emerged_pos2 = manip:read_from_map(pos1, pos2) + local area = VoxelArea:new({MinEdge=emerged_pos1, MaxEdge=emerged_pos2}) + return manip, area +end + + +function mh.init_radius(pos, radius) + local pos1 = vector.subtract(pos, radius) + local pos2 = vector.add(pos, radius) + return mh.init(pos1, pos2) +end + + +function mh.init_axis_radius(base_pos, axis, radius) + return mh.init_axis_radius_length(base_pos, axis, radius, radius) +end + + +function mh.init_axis_radius_length(base_pos, axis, radius, length) + local other1, other2 = worldedit.get_axis_others(axis) + local pos1 = { + [axis] = base_pos[axis], + [other1] = base_pos[other1] - radius, + [other2] = base_pos[other2] - radius + } + local pos2 = { + [axis] = base_pos[axis] + length, + [other1] = base_pos[other1] + radius, + [other2] = base_pos[other2] + radius + } + return mh.init(pos1, pos2) +end + + +function mh.finish(manip, data) + -- Update map + manip:set_data(data) + manip:write_to_map() + manip:update_map() +end + diff --git a/mods/worldedit/worldedit/compatibility.lua b/mods/worldedit/worldedit/compatibility.lua new file mode 100644 index 0000000..1f6e02b --- /dev/null +++ b/mods/worldedit/worldedit/compatibility.lua @@ -0,0 +1,74 @@ +--- Compatibility functions. +-- @module worldedit.compatibility + +local function deprecated(new_func) + local info = debug.getinfo(1, "n") + local msg = "worldedit." .. info.name .. "() is deprecated." + if new_func then + msg = msg .. " Use worldedit." .. new_func .. "() instead." + end + minetest.log("deprecated", msg) +end + +worldedit.allocate_old = worldedit.allocate + +worldedit.deserialize_old = worldedit.deserialize + +function worldedit.metasave(pos1, pos2, filename) + deprecated("save") + local file, err = io.open(filename, "wb") + if err then return 0 end + local data, count = worldedit.serialize(pos1, pos2) + file:write(data) + file:close() + return count +end + +function worldedit.metaload(originpos, filename) + deprecated("load") + filename = minetest.get_worldpath() .. "/schems/" .. file .. ".wem" + local file, err = io.open(filename, "wb") + if err then return 0 end + local data = file:read("*a") + return worldedit.deserialize(originpos, data) +end + +function worldedit.scale(pos1, pos2, factor) + deprecated("stretch") + return worldedit.stretch(pos1, pos2, factor, factor, factor) +end + +function worldedit.valueversion(value) + deprecated("read_header") + local version = worldedit.read_header(value) + if not version or version > worldedit.LATEST_SERIALIZATION_VERSION then + return 0 + end + return version +end + +function worldedit.replaceinverse(pos1, pos2, search_node, replace_node) + deprecated("replace") + return worldedit.replace(pos1, pos2, search_node, replace_node, true) +end + +function worldedit.clearobjects(...) + deprecated("clear_objects") + return worldedit.clear_objects(...) +end + +function worldedit.hollow_sphere(pos, radius, node_name) + deprecated("sphere") + return worldedit.sphere(pos, radius, node_name, true) +end + +function worldedit.hollow_dome(pos, radius, node_name) + deprecated("dome") + return worldedit.dome(pos, radius, node_name, true) +end + +function worldedit.hollow_cylinder(pos, axis, length, radius, node_name) + deprecated("cylinder") + return worldedit.cylinder(pos, axis, length, radius, node_name, true) +end + diff --git a/mods/worldedit/worldedit/cuboid.lua b/mods/worldedit/worldedit/cuboid.lua new file mode 100644 index 0000000..ce20761 --- /dev/null +++ b/mods/worldedit/worldedit/cuboid.lua @@ -0,0 +1,258 @@ +-- Expands or contracts the cuboid in all axes by amount (positive or negative) +worldedit.cuboid_volumetric_expand = function(name, amount) + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + + if pos1 == nil or pos2 == nil then + return false, "Undefined cuboid" + end + + local delta1 = vector.new() + local delta2 = vector.new() + local delta_dir1 + local delta_dir2 + + delta1 = vector.add(delta1, amount) + delta2 = vector.add(delta2, amount) + delta_dir1, delta_dir2 = worldedit.get_expansion_directions(pos1, pos2) + delta1 = vector.multiply(delta1, delta_dir1) + delta2 = vector.multiply(delta2, delta_dir2) + worldedit.pos1[name] = vector.add(pos1, delta1) + worldedit.pos2[name] = vector.add(pos2, delta2) + + return true +end + + +-- Expands or contracts the cuboid in a single axis by amount (positive or negative) +worldedit.cuboid_linear_expand = function(name, axis, direction, amount) + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + + if pos1 == nil or pos2 == nil then + return false, "undefined cuboid" + end + + if direction ~= 1 and direction ~= -1 then + return false, "invalid marker" + end + + local marker = worldedit.marker_get_closest_to_axis(name, axis, direction) + local deltavect = vector.new() + + if axis == 'x' then + deltavect.x = amount * direction + elseif axis == 'y' then + deltavect.y = amount * direction + elseif axis == 'z' then + deltavect.z = amount * direction + else + return false, "invalid axis" + end + + worldedit.marker_move(name, marker, deltavect) + return true +end + + +-- Shifts the cuboid by '+-amount' in axis 'axis' +worldedit.cuboid_shift = function(name, axis, amount) + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + + if pos1 == nil or pos2 == nil then + return false, "undefined cuboid" + end + + if axis == 'x' then + worldedit.pos1[name].x = pos1.x + amount + worldedit.pos2[name].x = pos2.x + amount + elseif axis == 'y' then + worldedit.pos1[name].y = pos1.y + amount + worldedit.pos2[name].y = pos2.y + amount + elseif axis == 'z' then + worldedit.pos1[name].z = pos1.z + amount + worldedit.pos2[name].z = pos2.z + amount + else + return false, "invalid axis" + end + + return true +end + + +-- Moves the location of a single marker by adding deltavector +worldedit.marker_move = function(name, marker, deltavector) + if marker ~= 1 and marker ~= 2 then + return false + end + + if marker == 1 then + local pos = worldedit.pos1[name] + worldedit.pos1[name] = vector.add(deltavector, pos) + else + local pos = worldedit.pos2[name] + worldedit.pos2[name] = vector.add(deltavector, pos) + end + + return true +end + +-- Updates the location ingame of the markers +worldedit.marker_update = function(name, marker) + if marker == nil then + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + elseif marker == 1 then + worldedit.mark_pos1(name) + elseif marker == 2 then + worldedit.mark_pos2(name) + else + minetest.debug( + "worldedit: Invalid execution of function update_markers") + end +end + + +-- Returns two vectors with the directions for volumetric expansion +worldedit.get_expansion_directions = function(mark1, mark2) + if mark1 == nil or mark2 == nil then + return + end + local dir1 = vector.new() + local dir2 = vector.new() + + if mark1.x < mark2.x then + dir1.x = -1 + dir2.x = 1 + else + dir1.x = 1 + dir2.x = -1 + end + if mark1.y < mark2.y then + dir1.y = -1 + dir2.y = 1 + else + dir1.y = 1 + dir2.y = -1 + end + if mark1.z < mark2.z then + dir1.z = -1 + dir2.z = 1 + else + dir1.z = 1 + dir2.z = -1 + end + return dir1, dir2 +end + + +-- Return the marker that is closest to the player +worldedit.marker_get_closest_to_player = function(name) + local playerpos = minetest.get_player_by_name(name):getpos() + local dist1 = vector.distance(playerpos, worldedit.pos1[name]) + local dist2 = vector.distance(playerpos, worldedit.pos2[name]) + + if dist1 < dist2 then + return 1 + else + return 2 + end +end + + +-- Returns the closest marker to the specified axis and direction +worldedit.marker_get_closest_to_axis = function(name, axis, direction) + local pos1 = vector.new() + local pos2 = vector.new() + + if direction ~= 1 and direction ~= -1 then + return nil + end + + if axis == 'x' then + pos1.x = worldedit.pos1[name].x * direction + pos2.x = worldedit.pos2[name].x * direction + if pos1.x > pos2.x then + return 1 + else + return 2 + end + elseif axis == 'y' then + pos1.y = worldedit.pos1[name].y * direction + pos2.y = worldedit.pos2[name].y * direction + if pos1.y > pos2.y then + return 1 + else + return 2 + end + elseif axis == 'z' then + pos1.z = worldedit.pos1[name].z * direction + pos2.z = worldedit.pos2[name].z * direction + if pos1.z > pos2.z then + return 1 + else + return 2 + end + else + return nil + end +end + + +-- Translates up, down, left, right, front, back to their corresponding axes and +-- directions according to faced direction +worldedit.translate_direction = function(name, direction) + local axis, dir = worldedit.player_axis(name) + local resaxis, resdir + + if direction == "up" then + return 'y', 1 + end + + if direction == "down" then + return 'y', -1 + end + + if direction == "front" then + if axis == "y" then + resaxis = nil + resdir = nil + else + resaxis = axis + resdir = dir + end + end + + if direction == "back" then + if axis == "y" then + resaxis = nil + resdir = nil + else + resaxis = axis + resdir = -dir + end + end + + if direction == "left" then + if axis == 'x' then + resaxis = 'z' + resdir = dir + elseif axis == 'z' then + resaxis = 'x' + resdir = -dir + end + end + + if direction == "right" then + if axis == 'x' then + resaxis = 'z' + resdir = -dir + elseif axis == 'z' then + resaxis = 'x' + resdir = dir + end + end + + return resaxis, resdir +end \ No newline at end of file diff --git a/mods/worldedit/worldedit/init.lua b/mods/worldedit/worldedit/init.lua new file mode 100644 index 0000000..8c828c2 --- /dev/null +++ b/mods/worldedit/worldedit/init.lua @@ -0,0 +1,48 @@ +--- Worldedit. +-- @module worldedit +-- @release 1.2 +-- @copyright 2013 sfan5, Anthony Zhang (Uberi/Temperest), and Brett O'Donnell (cornernote). +-- @license GNU Affero General Public License version 3 (AGPLv3) +-- @author sfan5 +-- @author Anthony Zang (Uberi/Temperest) +-- @author Bret O'Donnel (cornernote) +-- @author ShadowNinja + + +worldedit = {} + +local ver = {major=1, minor=2} +worldedit.version = ver +worldedit.version_string = string.format("%d.%d", ver.major, ver.minor) + +if not minetest.get_voxel_manip then + local err_msg = "This version of WorldEdit requires Minetest 0.4.8 or later! You have an old version." + minetest.log("error", string.rep("#", 128)) + minetest.log("error", err_msg) + minetest.log("error", string.rep("#", 128)) + error(err_msg) +end + +local path = minetest.get_modpath(minetest.get_current_modname()) + +local function load_module(path) + local file = io.open(path, "r") + if not file then return end + file:close() + return dofile(path) +end + +dofile(path .. "/common.lua") +load_module(path .. "/manipulations.lua") +load_module(path .. "/primitives.lua") +load_module(path .. "/visualization.lua") +load_module(path .. "/serialization.lua") +load_module(path .. "/code.lua") +load_module(path .. "/compatibility.lua") +load_module(path .. "/cuboid.lua") + + +if minetest.setting_getbool("log_mods") then + print("[WorldEdit] Loaded!") +end + diff --git a/mods/worldedit/worldedit/manipulations.lua b/mods/worldedit/worldedit/manipulations.lua new file mode 100644 index 0000000..d86cbf8 --- /dev/null +++ b/mods/worldedit/worldedit/manipulations.lua @@ -0,0 +1,649 @@ +--- Generic node manipulations. +-- @module worldedit.manipulations + +local mh = worldedit.manip_helpers + + +--- Sets a region to `node_names`. +-- @param pos1 +-- @param pos2 +-- @param node_names Node name or list of node names. +-- @return The number of nodes set. +function worldedit.set(pos1, pos2, node_names) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local manip, area = mh.init(pos1, pos2) + local data = mh.get_empty_data(area) + + if type(node_names) == "string" then -- Only one type of node + local id = minetest.get_content_id(node_names) + -- Fill area with node + for i in area:iterp(pos1, pos2) do + data[i] = id + end + else -- Several types of nodes specified + local node_ids = {} + for i, v in ipairs(node_names) do + node_ids[i] = minetest.get_content_id(v) + end + -- Fill area randomly with nodes + local id_count, rand = #node_ids, math.random + for i in area:iterp(pos1, pos2) do + data[i] = node_ids[rand(id_count)] + end + end + + mh.finish(manip, data) + + return worldedit.volume(pos1, pos2) +end + +--- Sets param2 of a region. +-- @param pos1 +-- @param pos2 +-- @param param2 Value of param2 to set +-- @return The number of nodes set. +function worldedit.set_param2(pos1, pos2, param2) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local manip, area = mh.init(pos1, pos2) + local param2_data = manip:get_param2_data() + + -- Set param2 for every node + for i in area:iterp(pos1, pos2) do + param2_data[i] = param2 + end + + -- Update map + manip:set_param2_data(param2_data) + manip:write_to_map() + manip:update_map() + + return worldedit.volume(pos1, pos2) +end + +--- Replaces all instances of `search_node` with `replace_node` in a region. +-- When `inverse` is `true`, replaces all instances that are NOT `search_node`. +-- @return The number of nodes replaced. +function worldedit.replace(pos1, pos2, search_node, replace_node, inverse) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local manip, area = mh.init(pos1, pos2) + local data = manip:get_data() + + local search_id = minetest.get_content_id(search_node) + local replace_id = minetest.get_content_id(replace_node) + + local count = 0 + + --- TODO: This could be shortened by checking `inverse` in the loop, + -- but that would have a speed penalty. Is the penalty big enough + -- to matter? + if not inverse then + for i in area:iterp(pos1, pos2) do + if data[i] == search_id then + data[i] = replace_id + count = count + 1 + end + end + else + for i in area:iterp(pos1, pos2) do + if data[i] ~= search_id then + data[i] = replace_id + count = count + 1 + end + end + end + + mh.finish(manip, data) + + return count +end + + +--- Duplicates a region `amount` times with offset vector `direction`. +-- Stacking is spread across server steps, one copy per step. +-- @return The number of nodes stacked. +function worldedit.stack2(pos1, pos2, direction, amount, finished) + local i = 0 + local translated = {x=0, y=0, z=0} + local function next_one() + if i < amount then + i = i + 1 + translated.x = translated.x + direction.x + translated.y = translated.y + direction.y + translated.z = translated.z + direction.z + worldedit.copy2(pos1, pos2, translated) + minetest.after(0, next_one) + else + if finished then + finished() + end + end + end + next_one() + return worldedit.volume(pos1, pos2) * amount +end + + +--- Copies a region along `axis` by `amount` nodes. +-- @param pos1 +-- @param pos2 +-- @param axis Axis ("x", "y", or "z") +-- @param amount +-- @return The number of nodes copied. +function worldedit.copy(pos1, pos2, axis, amount) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local get_node, get_meta, set_node = minetest.get_node, + minetest.get_meta, minetest.set_node + -- Copy things backwards when negative to avoid corruption. + -- FIXME: Lots of code duplication here. + if amount < 0 then + local pos = {} + pos.x = pos1.x + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) -- Obtain current node + local meta = get_meta(pos):to_table() -- Get meta of current node + local value = pos[axis] -- Store current position + pos[axis] = value + amount -- Move along axis + set_node(pos, node) -- Copy node to new position + get_meta(pos):from_table(meta) -- Set metadata of new node + pos[axis] = value -- Restore old position + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + else + local pos = {} + pos.x = pos2.x + while pos.x >= pos1.x do + pos.y = pos2.y + while pos.y >= pos1.y do + pos.z = pos2.z + while pos.z >= pos1.z do + local node = get_node(pos) -- Obtain current node + local meta = get_meta(pos):to_table() -- Get meta of current node + local value = pos[axis] -- Store current position + pos[axis] = value + amount -- Move along axis + set_node(pos, node) -- Copy node to new position + get_meta(pos):from_table(meta) -- Set metadata of new node + pos[axis] = value -- Restore old position + pos.z = pos.z - 1 + end + pos.y = pos.y - 1 + end + pos.x = pos.x - 1 + end + end + return worldedit.volume(pos1, pos2) +end + +--- Copies a region by offset vector `off`. +-- @param pos1 +-- @param pos2 +-- @param off +-- @return The number of nodes copied. +function worldedit.copy2(pos1, pos2, off) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local get_node, get_meta, set_node = minetest.get_node, + minetest.get_meta, minetest.set_node + local pos = {} + pos.x = pos2.x + while pos.x >= pos1.x do + pos.y = pos2.y + while pos.y >= pos1.y do + pos.z = pos2.z + while pos.z >= pos1.z do + local node = get_node(pos) -- Obtain current node + local meta = get_meta(pos):to_table() -- Get meta of current node + local newpos = vector.add(pos, off) -- Calculate new position + set_node(newpos, node) -- Copy node to new position + get_meta(newpos):from_table(meta) -- Set metadata of new node + pos.z = pos.z - 1 + end + pos.y = pos.y - 1 + end + pos.x = pos.x - 1 + end + return worldedit.volume(pos1, pos2) +end + +--- Moves a region along `axis` by `amount` nodes. +-- @return The number of nodes moved. +function worldedit.move(pos1, pos2, axis, amount) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + --- TODO: Move slice by slice using schematic method in the move axis + -- and transfer metadata in separate loop (and if the amount is + -- greater than the length in the axis, copy whole thing at a time and + -- erase original after, using schematic method). + local get_node, get_meta, set_node, remove_node = minetest.get_node, + minetest.get_meta, minetest.set_node, minetest.remove_node + -- Copy things backwards when negative to avoid corruption. + --- FIXME: Lots of code duplication here. + if amount < 0 then + local pos = {} + pos.x = pos1.x + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) -- Obtain current node + local meta = get_meta(pos):to_table() -- Get metadata of current node + remove_node(pos) -- Remove current node + local value = pos[axis] -- Store current position + pos[axis] = value + amount -- Move along axis + set_node(pos, node) -- Move node to new position + get_meta(pos):from_table(meta) -- Set metadata of new node + pos[axis] = value -- Restore old position + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + else + local pos = {} + pos.x = pos2.x + while pos.x >= pos1.x do + pos.y = pos2.y + while pos.y >= pos1.y do + pos.z = pos2.z + while pos.z >= pos1.z do + local node = get_node(pos) -- Obtain current node + local meta = get_meta(pos):to_table() -- Get metadata of current node + remove_node(pos) -- Remove current node + local value = pos[axis] -- Store current position + pos[axis] = value + amount -- Move along axis + set_node(pos, node) -- Move node to new position + get_meta(pos):from_table(meta) -- Set metadata of new node + pos[axis] = value -- Restore old position + pos.z = pos.z - 1 + end + pos.y = pos.y - 1 + end + pos.x = pos.x - 1 + end + end + return worldedit.volume(pos1, pos2) +end + + +--- Duplicates a region along `axis` `amount` times. +-- Stacking is spread across server steps, one copy per step. +-- @param pos1 +-- @param pos2 +-- @param axis Axis direction, "x", "y", or "z". +-- @param count +-- @return The number of nodes stacked. +function worldedit.stack(pos1, pos2, axis, count) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + local length = pos2[axis] - pos1[axis] + 1 + if count < 0 then + count = -count + length = -length + end + local amount = 0 + local copy = worldedit.copy + local i = 1 + local function next_one() + if i <= count then + i = i + 1 + amount = amount + length + copy(pos1, pos2, axis, amount) + minetest.after(0, next_one) + end + end + next_one() + return worldedit.volume(pos1, pos2) * count +end + + +--- Stretches a region by a factor of positive integers along the X, Y, and Z +-- axes, respectively, with `pos1` as the origin. +-- @param pos1 +-- @param pos2 +-- @param stretch_x Amount to stretch along X axis. +-- @param stretch_y Amount to stretch along Y axis. +-- @param stretch_z Amount to stretch along Z axis. +-- @return The number of nodes scaled. +-- @return The new scaled position 1. +-- @return The new scaled position 2. +function worldedit.stretch(pos1, pos2, stretch_x, stretch_y, stretch_z) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + -- Prepare schematic of large node + local get_node, get_meta, place_schematic = minetest.get_node, + minetest.get_meta, minetest.place_schematic + local placeholder_node = {name="", param1=255, param2=0} + local nodes = {} + for i = 1, stretch_x * stretch_y * stretch_z do + nodes[i] = placeholder_node + end + local schematic = {size={x=stretch_x, y=stretch_y, z=stretch_z}, data=nodes} + + local size_x, size_y, size_z = stretch_x - 1, stretch_y - 1, stretch_z - 1 + + local new_pos2 = { + x = pos1.x + (pos2.x - pos1.x) * stretch_x + size_x, + y = pos1.y + (pos2.y - pos1.y) * stretch_y + size_y, + z = pos1.z + (pos2.z - pos1.z) * stretch_z + size_z, + } + worldedit.keep_loaded(pos1, new_pos2) + + local pos = {x=pos2.x, y=0, z=0} + local big_pos = {x=0, y=0, z=0} + while pos.x >= pos1.x do + pos.y = pos2.y + while pos.y >= pos1.y do + pos.z = pos2.z + while pos.z >= pos1.z do + local node = get_node(pos) -- Get current node + local meta = get_meta(pos):to_table() -- Get meta of current node + + -- Calculate far corner of the big node + local pos_x = pos1.x + (pos.x - pos1.x) * stretch_x + local pos_y = pos1.y + (pos.y - pos1.y) * stretch_y + local pos_z = pos1.z + (pos.z - pos1.z) * stretch_z + + -- Create large node + placeholder_node.name = node.name + placeholder_node.param2 = node.param2 + big_pos.x, big_pos.y, big_pos.z = pos_x, pos_y, pos_z + place_schematic(big_pos, schematic) + + -- Fill in large node meta + if next(meta.fields) ~= nil or next(meta.inventory) ~= nil then + -- Node has meta fields + for x = 0, size_x do + for y = 0, size_y do + for z = 0, size_z do + big_pos.x = pos_x + x + big_pos.y = pos_y + y + big_pos.z = pos_z + z + -- Set metadata of new node + get_meta(big_pos):from_table(meta) + end + end + end + end + pos.z = pos.z - 1 + end + pos.y = pos.y - 1 + end + pos.x = pos.x - 1 + end + return worldedit.volume(pos1, pos2) * stretch_x * stretch_y * stretch_z, pos1, new_pos2 +end + + +--- Transposes a region between two axes. +-- @return The number of nodes transposed. +-- @return The new transposed position 1. +-- @return The new transposed position 2. +function worldedit.transpose(pos1, pos2, axis1, axis2) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local compare + local extent1, extent2 = pos2[axis1] - pos1[axis1], pos2[axis2] - pos1[axis2] + + if extent1 > extent2 then + compare = function(extent1, extent2) + return extent1 > extent2 + end + else + compare = function(extent1, extent2) + return extent1 < extent2 + end + end + + -- Calculate the new position 2 after transposition + local new_pos2 = {x=pos2.x, y=pos2.y, z=pos2.z} + new_pos2[axis1] = pos1[axis1] + extent2 + new_pos2[axis2] = pos1[axis2] + extent1 + + local upper_bound = {x=pos2.x, y=pos2.y, z=pos2.z} + if upper_bound[axis1] < new_pos2[axis1] then upper_bound[axis1] = new_pos2[axis1] end + if upper_bound[axis2] < new_pos2[axis2] then upper_bound[axis2] = new_pos2[axis2] end + worldedit.keep_loaded(pos1, upper_bound) + + local pos = {x=pos1.x, y=0, z=0} + local get_node, get_meta, set_node = minetest.get_node, + minetest.get_meta, minetest.set_node + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local extent1, extent2 = pos[axis1] - pos1[axis1], pos[axis2] - pos1[axis2] + if compare(extent1, extent2) then -- Transpose only if below the diagonal + local node1 = get_node(pos) + local meta1 = get_meta(pos):to_table() + local value1, value2 = pos[axis1], pos[axis2] -- Save position values + pos[axis1], pos[axis2] = pos1[axis1] + extent2, pos1[axis2] + extent1 -- Swap axis extents + local node2 = get_node(pos) + local meta2 = get_meta(pos):to_table() + set_node(pos, node1) + get_meta(pos):from_table(meta1) + pos[axis1], pos[axis2] = value1, value2 -- Restore position values + set_node(pos, node2) + get_meta(pos):from_table(meta2) + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return worldedit.volume(pos1, pos2), pos1, new_pos2 +end + + +--- Flips a region along `axis`. +-- @return The number of nodes flipped. +function worldedit.flip(pos1, pos2, axis) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + --- TODO: Flip the region slice by slice along the flip axis using schematic method. + local pos = {x=pos1.x, y=0, z=0} + local start = pos1[axis] + pos2[axis] + pos2[axis] = pos1[axis] + math.floor((pos2[axis] - pos1[axis]) / 2) + local get_node, get_meta, set_node = minetest.get_node, + minetest.get_meta, minetest.set_node + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node1 = get_node(pos) + local meta1 = get_meta(pos):to_table() + local value = pos[axis] -- Save position + pos[axis] = start - value -- Shift position + local node2 = get_node(pos) + local meta2 = get_meta(pos):to_table() + set_node(pos, node1) + get_meta(pos):from_table(meta1) + pos[axis] = value -- Restore position + set_node(pos, node2) + get_meta(pos):from_table(meta2) + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return worldedit.volume(pos1, pos2) +end + + +--- Rotates a region clockwise around an axis. +-- @param pos1 +-- @param pos2 +-- @param axis Axis ("x", "y", or "z"). +-- @param angle Angle in degrees (90 degree increments only). +-- @return The number of nodes rotated. +-- @return The new first position. +-- @return The new second position. +function worldedit.rotate(pos1, pos2, axis, angle) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local other1, other2 = worldedit.get_axis_others(axis) + angle = angle % 360 + + local count + if angle == 90 then + worldedit.flip(pos1, pos2, other1) + count, pos1, pos2 = worldedit.transpose(pos1, pos2, other1, other2) + elseif angle == 180 then + worldedit.flip(pos1, pos2, other1) + count = worldedit.flip(pos1, pos2, other2) + elseif angle == 270 then + worldedit.flip(pos1, pos2, other2) + count, pos1, pos2 = worldedit.transpose(pos1, pos2, other1, other2) + else + error("Only 90 degree increments are supported!") + end + return count, pos1, pos2 +end + + +--- Rotates all oriented nodes in a region clockwise around the Y axis. +-- @param pos1 +-- @param pos2 +-- @param angle Angle in degrees (90 degree increments only). +-- @return The number of nodes oriented. +-- TODO: Support 6D facedir rotation along arbitrary axis. +function worldedit.orient(pos1, pos2, angle) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + local registered_nodes = minetest.registered_nodes + + local wallmounted = { + [90] = {[0]=0, 1, 5, 4, 2, 3}, + [180] = {[0]=0, 1, 3, 2, 5, 4}, + [270] = {[0]=0, 1, 4, 5, 3, 2} + } + local facedir = { + [90] = {[0]=1, 2, 3, 0}, + [180] = {[0]=2, 3, 0, 1}, + [270] = {[0]=3, 0, 1, 2} + } + + angle = angle % 360 + if angle == 0 then + return 0 + end + if angle % 90 ~= 0 then + error("Only 90 degree increments are supported!") + end + local wallmounted_substitution = wallmounted[angle] + local facedir_substitution = facedir[angle] + + worldedit.keep_loaded(pos1, pos2) + + local count = 0 + local set_node, get_node, get_meta, swap_node = minetest.set_node, + minetest.get_node, minetest.get_meta, minetest.swap_node + local pos = {x=pos1.x, y=0, z=0} + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) + local def = registered_nodes[node.name] + if def then + if def.paramtype2 == "wallmounted" then + node.param2 = wallmounted_substitution[node.param2] + local meta = get_meta(pos):to_table() + set_node(pos, node) + get_meta(pos):from_table(meta) + count = count + 1 + elseif def.paramtype2 == "facedir" then + node.param2 = facedir_substitution[node.param2] + local meta = get_meta(pos):to_table() + set_node(pos, node) + get_meta(pos):from_table(meta) + count = count + 1 + end + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return count +end + + +--- Attempts to fix the lighting in a region. +-- @return The number of nodes updated. +function worldedit.fixlight(pos1, pos2) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local vmanip = minetest.get_voxel_manip(pos1, pos2) + vmanip:write_to_map() + vmanip:update_map() -- this updates the lighting + + return worldedit.volume(pos1, pos2) +end + + +--- Clears all objects in a region. +-- @return The number of objects cleared. +function worldedit.clear_objects(pos1, pos2) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + -- Offset positions to include full nodes (positions are in the center of nodes) + local pos1x, pos1y, pos1z = pos1.x - 0.5, pos1.y - 0.5, pos1.z - 0.5 + local pos2x, pos2y, pos2z = pos2.x + 0.5, pos2.y + 0.5, pos2.z + 0.5 + + -- Center of region + local center = { + x = pos1x + ((pos2x - pos1x) / 2), + y = pos1y + ((pos2y - pos1y) / 2), + z = pos1z + ((pos2z - pos1z) / 2) + } + -- Bounding sphere radius + local radius = math.sqrt( + (center.x - pos1x) ^ 2 + + (center.y - pos1y) ^ 2 + + (center.z - pos1z) ^ 2) + local count = 0 + for _, obj in pairs(minetest.get_objects_inside_radius(center, radius)) do + local entity = obj:get_luaentity() + -- Avoid players and WorldEdit entities + if not obj:is_player() and (not entity or + not entity.name:find("^worldedit:")) then + local pos = obj:getpos() + if pos.x >= pos1x and pos.x <= pos2x and + pos.y >= pos1y and pos.y <= pos2y and + pos.z >= pos1z and pos.z <= pos2z then + -- Inside region + obj:remove() + count = count + 1 + end + end + end + return count +end + diff --git a/mods/worldedit/worldedit/primitives.lua b/mods/worldedit/worldedit/primitives.lua new file mode 100644 index 0000000..251620d --- /dev/null +++ b/mods/worldedit/worldedit/primitives.lua @@ -0,0 +1,329 @@ +--- Functions for creating primitive shapes. +-- @module worldedit.primitives + +local mh = worldedit.manip_helpers + + +--- Adds a cube +-- @param pos Position of ground level center of cube +-- @param width Cube width. (x) +-- @param height Cube height. (y) +-- @param length Cube length. (z) +-- @param node_name Name of node to make cube of. +-- @param hollow Whether the cube should be hollow. +-- @return The number of nodes added. +function worldedit.cube(pos, width, height, length, node_name, hollow) + -- Set up voxel manipulator + local basepos = vector.subtract(pos, {x=math.floor(width/2), y=0, z=math.floor(length/2)}) + local manip, area = mh.init(basepos, vector.add(basepos, {x=width, y=height, z=length})) + local data = mh.get_empty_data(area) + + -- Add cube + local node_id = minetest.get_content_id(node_name) + local stride = {x=1, y=area.ystride, z=area.zstride} + local offset = vector.subtract(basepos, area.MinEdge) + local count = 0 + + for z = 0, length-1 do + local index_z = (offset.z + z) * stride.z + 1 -- +1 for 1-based indexing + for y = 0, height-1 do + local index_y = index_z + (offset.y + y) * stride.y + for x = 0, width-1 do + local is_wall = z == 0 or z == length-1 + or y == 0 or y == height-1 + or x == 0 or x == width-1 + if not hollow or is_wall then + local i = index_y + (offset.x + x) + data[i] = node_id + count = count + 1 + end + end + end + end + + mh.finish(manip, data) + return count +end + +--- Adds a sphere of `node_name` centered at `pos`. +-- @param pos Position to center sphere at. +-- @param radius Sphere radius. +-- @param node_name Name of node to make shere of. +-- @param hollow Whether the sphere should be hollow. +-- @return The number of nodes added. +function worldedit.sphere(pos, radius, node_name, hollow) + local manip, area = mh.init_radius(pos, radius) + + local data = mh.get_empty_data(area) + + -- Fill selected area with node + local node_id = minetest.get_content_id(node_name) + local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) + local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z + local stride_z, stride_y = area.zstride, area.ystride + local count = 0 + for z = -radius, radius do + -- Offset contributed by z plus 1 to make it 1-indexed + local new_z = (z + offset_z) * stride_z + 1 + for y = -radius, radius do + local new_y = new_z + (y + offset_y) * stride_y + for x = -radius, radius do + local squared = x * x + y * y + z * z + if squared <= max_radius and (not hollow or squared >= min_radius) then + -- Position is on surface of sphere + local i = new_y + (x + offset_x) + data[i] = node_id + count = count + 1 + end + end + end + end + + mh.finish(manip, data) + + return count +end + + +--- Adds a dome. +-- @param pos Position to center dome at. +-- @param radius Dome radius. Negative for concave domes. +-- @param node_name Name of node to make dome of. +-- @param hollow Whether the dome should be hollow. +-- @return The number of nodes added. +-- TODO: Add axis option. +function worldedit.dome(pos, radius, node_name, hollow) + local min_y, max_y = 0, radius + if radius < 0 then + radius = -radius + min_y, max_y = -radius, 0 + end + + local manip, area = mh.init_axis_radius(pos, "y", radius) + local data = mh.get_empty_data(area) + + -- Add dome + local node_id = minetest.get_content_id(node_name) + local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) + local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z + local stride_z, stride_y = area.zstride, area.ystride + local count = 0 + for z = -radius, radius do + local new_z = (z + offset_z) * stride_z + 1 --offset contributed by z plus 1 to make it 1-indexed + for y = min_y, max_y do + local new_y = new_z + (y + offset_y) * stride_y + for x = -radius, radius do + local squared = x * x + y * y + z * z + if squared <= max_radius and (not hollow or squared >= min_radius) then + -- Position is in dome + local i = new_y + (x + offset_x) + data[i] = node_id + count = count + 1 + end + end + end + end + + mh.finish(manip, data) + + return count +end + +--- Adds a cylinder. +-- @param pos Position to center base of cylinder at. +-- @param axis Axis ("x", "y", or "z") +-- @param length Cylinder length. +-- @param radius1 Cylinder base radius. +-- @param radius2 Cylinder top radius. +-- @param node_name Name of node to make cylinder of. +-- @param hollow Whether the cylinder should be hollow. +-- @return The number of nodes added. +function worldedit.cylinder(pos, axis, length, radius1, radius2, node_name, hollow) + local other1, other2 = worldedit.get_axis_others(axis) + + -- Backwards compatibility + if type(radius2) == "string" then + hollow = node_name + node_name = radius2 + radius2 = radius1 -- straight cylinder + end + + -- Handle negative lengths + local current_pos = {x=pos.x, y=pos.y, z=pos.z} + if length < 0 then + length = -length + current_pos[axis] = current_pos[axis] - length + radius1, radius2 = radius2, radius1 + end + + -- Set up voxel manipulator + local manip, area = mh.init_axis_radius_length(current_pos, axis, math.max(radius1, radius2), length) + local data = mh.get_empty_data(area) + + -- Add desired shape (anything inbetween cylinder & cone) + local node_id = minetest.get_content_id(node_name) + local stride = {x=1, y=area.ystride, z=area.zstride} + local offset = { + x = current_pos.x - area.MinEdge.x, + y = current_pos.y - area.MinEdge.y, + z = current_pos.z - area.MinEdge.z, + } + local count = 0 + for i = 0, length - 1 do + -- Calulate radius for this "height" in the cylinder + local radius = radius1 + (radius2 - radius1) * (i + 1) / length + radius = math.floor(radius + 0.5) -- round + local min_radius, max_radius = radius * (radius - 1), radius * (radius + 1) + + for index2 = -radius, radius do + -- Offset contributed by other axis 1 plus 1 to make it 1-indexed + local new_index2 = (index2 + offset[other1]) * stride[other1] + 1 + for index3 = -radius, radius do + local new_index3 = new_index2 + (index3 + offset[other2]) * stride[other2] + local squared = index2 * index2 + index3 * index3 + if squared <= max_radius and (not hollow or squared >= min_radius) then + -- Position is in cylinder, add node here + local vi = new_index3 + (offset[axis] + i) * stride[axis] + data[vi] = node_id + count = count + 1 + end + end + end + end + + mh.finish(manip, data) + + return count +end + + +--- Adds a pyramid. +-- @param pos Position to center base of pyramid at. +-- @param axis Axis ("x", "y", or "z") +-- @param height Pyramid height. +-- @param node_name Name of node to make pyramid of. +-- @param hollow Whether the pyramid should be hollow. +-- @return The number of nodes added. +function worldedit.pyramid(pos, axis, height, node_name, hollow) + local other1, other2 = worldedit.get_axis_others(axis) + + -- Set up voxel manipulator + -- FIXME: passing negative causes mis-sorted pos to be passed + -- into mh.init() which is technically not allowed but works + local manip, area = mh.init_axis_radius(pos, axis, height) + local data = mh.get_empty_data(area) + + -- Handle inverted pyramids + local step + if height > 0 then + height = height - 1 + step = 1 + else + height = height + 1 + step = -1 + end + + -- Add pyramid + local node_id = minetest.get_content_id(node_name) + local stride = {x=1, y=area.ystride, z=area.zstride} + local offset = { + x = pos.x - area.MinEdge.x, + y = pos.y - area.MinEdge.y, + z = pos.z - area.MinEdge.z, + } + local size = math.abs(height * step) + local count = 0 + -- For each level of the pyramid + for index1 = 0, height, step do + -- Offset contributed by axis plus 1 to make it 1-indexed + local new_index1 = (index1 + offset[axis]) * stride[axis] + 1 + for index2 = -size, size do + local new_index2 = new_index1 + (index2 + offset[other1]) * stride[other1] + for index3 = -size, size do + local i = new_index2 + (index3 + offset[other2]) * stride[other2] + if (not hollow or size - math.abs(index2) < 2 or size - math.abs(index3) < 2) then + data[i] = node_id + count = count + 1 + end + end + end + size = size - 1 + end + + mh.finish(manip, data) + + return count +end + +--- Adds a spiral. +-- @param pos Position to center spiral at. +-- @param length Spral length. +-- @param height Spiral height. +-- @param spacer Space between walls. +-- @param node_name Name of node to make spiral of. +-- @return Number of nodes added. +-- TODO: Add axis option. +function worldedit.spiral(pos, length, height, spacer, node_name) + local extent = math.ceil(length / 2) + + local manip, area = mh.init_axis_radius_length(pos, "y", extent, height) + local data = mh.get_empty_data(area) + + -- Set up variables + local node_id = minetest.get_content_id(node_name) + local stride = {x=1, y=area.ystride, z=area.zstride} + local offset_x, offset_y, offset_z = pos.x - area.MinEdge.x, pos.y - area.MinEdge.y, pos.z - area.MinEdge.z + local i = offset_z * stride.z + offset_y * stride.y + offset_x + 1 + + -- Add first column + local count = height + local column = i + for y = 1, height do + data[column] = node_id + column = column + stride.y + end + + -- Add spiral segments + local stride_axis, stride_other = stride.x, stride.z + local sign = -1 + local segment_length = 0 + spacer = spacer + 1 + -- Go through each segment except the last + for segment = 1, math.floor(length / spacer) * 2 do + -- Change sign and length every other turn starting with the first + if segment % 2 == 1 then + sign = -sign + segment_length = segment_length + spacer + end + -- Fill segment + for index = 1, segment_length do + -- Move along the direction of the segment + i = i + stride_axis * sign + local column = i + -- Add column + for y = 1, height do + data[column] = node_id + column = column + stride.y + end + end + count = count + segment_length * height + stride_axis, stride_other = stride_other, stride_axis -- Swap axes + end + + -- Add shorter final segment + sign = -sign + for index = 1, segment_length do + i = i + stride_axis * sign + local column = i + -- Add column + for y = 1, height do + data[column] = node_id + column = column + stride.y + end + end + count = count + segment_length * height + + mh.finish(manip, data) + + return count +end diff --git a/mods/worldedit/worldedit/serialization.lua b/mods/worldedit/worldedit/serialization.lua new file mode 100644 index 0000000..8cff9b8 --- /dev/null +++ b/mods/worldedit/worldedit/serialization.lua @@ -0,0 +1,239 @@ +--- Schematic serialization and deserialiation. +-- @module worldedit.serialization + +worldedit.LATEST_SERIALIZATION_VERSION = 5 +local LATEST_SERIALIZATION_HEADER = worldedit.LATEST_SERIALIZATION_VERSION .. ":" + + +--[[ +Serialization version history: + 1: Original format. Serialized Lua table with a weird linked format... + 2: Position and node seperated into sub-tables in fields `1` and `2`. + 3: List of nodes, one per line, with fields seperated by spaces. + Format: + 4: Serialized Lua table containing a list of nodes with `x`, `y`, `z`, + `name`, `param1`, `param2`, and `meta` fields. + 5: Added header and made `param1`, `param2`, and `meta` fields optional. + Header format: ,,...: +--]] + + +--- Reads the header of serialized data. +-- @param value Serialized WorldEdit data. +-- @return The version as a positive natural number, or 0 for unknown versions. +-- @return Extra header fields as a list of strings, or nil if not supported. +-- @return Content (data after header). +function worldedit.read_header(value) + if value:find("^[0-9]+[%-:]") then + local header_end = value:find(":", 1, true) + local header = value:sub(1, header_end - 1):split(",") + local version = tonumber(header[1]) + table.remove(header, 1) + local content = value:sub(header_end + 1) + return version, header, content + end + -- Old versions that didn't include a header with a version number + if value:find("([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)") and not value:find("%{") then -- List format + return 3, nil, value + elseif value:find("^[^\"']+%{%d+%}") then + if value:find("%[\"meta\"%]") then -- Meta flat table format + return 2, nil, value + end + return 1, nil, value -- Flat table format + elseif value:find("%{") then -- Raw nested table format + return 4, nil, value + end + return nil +end + + +--- Converts the region defined by positions `pos1` and `pos2` +-- into a single string. +-- @return The serialized data. +-- @return The number of nodes serialized. +function worldedit.serialize(pos1, pos2) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local pos = {x=pos1.x, y=0, z=0} + local count = 0 + local result = {} + local get_node, get_meta = minetest.get_node, minetest.get_meta + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) + if node.name ~= "air" and node.name ~= "ignore" then + count = count + 1 + local meta = get_meta(pos):to_table() + + local meta_empty = true + -- Convert metadata item stacks to item strings + for name, inventory in pairs(meta.inventory) do + for index, stack in ipairs(inventory) do + meta_empty = false + inventory[index] = stack.to_string and stack:to_string() or stack + end + end + for k in pairs(meta) do + if k ~= "inventory" then + meta_empty = false + break + end + end + + result[count] = { + x = pos.x - pos1.x, + y = pos.y - pos1.y, + z = pos.z - pos1.z, + name = node.name, + param1 = node.param1 ~= 0 and node.param1 or nil, + param2 = node.param2 ~= 0 and node.param2 or nil, + meta = not meta_empty and meta or nil, + } + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + -- Serialize entries + result = minetest.serialize(result) + return LATEST_SERIALIZATION_HEADER .. result, count +end + + +--- Loads the schematic in `value` into a node list in the latest format. +-- Contains code based on [table.save/table.load](http://lua-users.org/wiki/SaveTableToFile) +-- by ChillCode, available under the MIT license. +-- @return A node list in the latest format, or nil on failure. +local function load_schematic(value) + local version, header, content = worldedit.read_header(value) + local nodes = {} + if version == 1 or version == 2 then -- Original flat table format + local tables = minetest.deserialize(content) + if not tables then return nil end + + -- Transform the node table into an array of nodes + for i = 1, #tables do + for j, v in pairs(tables[i]) do + if type(v) == "table" then + tables[i][j] = tables[v[1]] + end + end + end + nodes = tables[1] + + if version == 1 then --original flat table format + for i, entry in ipairs(nodes) do + local pos = entry[1] + entry.x, entry.y, entry.z = pos.x, pos.y, pos.z + entry[1] = nil + local node = entry[2] + entry.name, entry.param1, entry.param2 = node.name, node.param1, node.param2 + entry[2] = nil + end + end + elseif version == 3 then -- List format + for x, y, z, name, param1, param2 in content:gmatch( + "([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)%s+" .. + "([^%s]+)%s+(%d+)%s+(%d+)[^\r\n]*[\r\n]*") do + param1, param2 = tonumber(param1), tonumber(param2) + table.insert(nodes, { + x = tonumber(x), + y = tonumber(y), + z = tonumber(z), + name = name, + param1 = param1 ~= 0 and param1 or nil, + param2 = param2 ~= 0 and param2 or nil, + }) + end + elseif version == 4 or version == 5 then -- Nested table format + if not jit then + -- This is broken for larger tables in the current version of LuaJIT + nodes = minetest.deserialize(content) + else + -- XXX: This is a filthy hack that works surprisingly well - in LuaJIT, `minetest.deserialize` will fail due to the register limit + nodes = {} + content = content:gsub("return%s*{", "", 1):gsub("}%s*$", "", 1) -- remove the starting and ending values to leave only the node data + local escaped = content:gsub("\\\\", "@@"):gsub("\\\"", "@@"):gsub("(\"[^\"]*\")", function(s) return string.rep("@", #s) end) + local startpos, startpos1, endpos = 1, 1 + while true do -- go through each individual node entry (except the last) + startpos, endpos = escaped:find("},%s*{", startpos) + if not startpos then + break + end + local current = content:sub(startpos1, startpos) + local entry = minetest.deserialize("return " .. current) + table.insert(nodes, entry) + startpos, startpos1 = endpos, endpos + end + local entry = minetest.deserialize("return " .. content:sub(startpos1)) -- process the last entry + table.insert(nodes, entry) + end + else + return nil + end + return nodes +end + +--- Determines the volume the nodes represented by string `value` would occupy +-- if deserialized at `origin_pos`. +-- @return Low corner position. +-- @return High corner position. +-- @return The number of nodes. +function worldedit.allocate(origin_pos, value) + local nodes = load_schematic(value) + if not nodes then return nil end + return worldedit.allocate_with_nodes(origin_pos, nodes) +end + + +-- Internal +function worldedit.allocate_with_nodes(origin_pos, nodes) + local huge = math.huge + local pos1x, pos1y, pos1z = huge, huge, huge + local pos2x, pos2y, pos2z = -huge, -huge, -huge + local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z + for i, entry in ipairs(nodes) do + local x, y, z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z + if x < pos1x then pos1x = x end + if y < pos1y then pos1y = y end + if z < pos1z then pos1z = z end + if x > pos2x then pos2x = x end + if y > pos2y then pos2y = y end + if z > pos2z then pos2z = z end + end + local pos1 = {x=pos1x, y=pos1y, z=pos1z} + local pos2 = {x=pos2x, y=pos2y, z=pos2z} + return pos1, pos2, #nodes +end + + +--- Loads the nodes represented by string `value` at position `origin_pos`. +-- @return The number of nodes deserialized. +function worldedit.deserialize(origin_pos, value) + local nodes = load_schematic(value) + if not nodes then return nil end + + local pos1, pos2 = worldedit.allocate_with_nodes(origin_pos, nodes) + worldedit.keep_loaded(pos1, pos2) + + local origin_x, origin_y, origin_z = origin_pos.x, origin_pos.y, origin_pos.z + local count = 0 + local add_node, get_meta = minetest.add_node, minetest.get_meta + for i, entry in ipairs(nodes) do + entry.x, entry.y, entry.z = origin_x + entry.x, origin_y + entry.y, origin_z + entry.z + -- Entry acts as both position and node + add_node(entry, entry) + if entry.meta then + get_meta(entry):from_table(entry.meta) + end + end + return #nodes +end + diff --git a/mods/worldedit/worldedit/textures/worldedit_wand.png b/mods/worldedit/worldedit/textures/worldedit_wand.png new file mode 100644 index 0000000..13eb121 Binary files /dev/null and b/mods/worldedit/worldedit/textures/worldedit_wand.png differ diff --git a/mods/worldedit/worldedit/visualization.lua b/mods/worldedit/worldedit/visualization.lua new file mode 100644 index 0000000..dce6bfa --- /dev/null +++ b/mods/worldedit/worldedit/visualization.lua @@ -0,0 +1,131 @@ +--- Functions for visibly hiding nodes +-- @module worldedit.visualization + +minetest.register_node("worldedit:placeholder", { + drawtype = "airlike", + paramtype = "light", + sunlight_propagates = true, + diggable = false, + walkable = false, + groups = {not_in_creative_inventory=1}, +}) + +--- Hides all nodes in a region defined by positions `pos1` and `pos2` by +-- non-destructively replacing them with invisible nodes. +-- @return The number of nodes hidden. +function worldedit.hide(pos1, pos2) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local pos = {x=pos1.x, y=0, z=0} + local get_node, get_meta, swap_node = minetest.get_node, + minetest.get_meta, minetest.swap_node + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) + if node.name ~= "air" and node.name ~= "worldedit:placeholder" then + -- Save the node's original name + get_meta(pos):set_string("worldedit_placeholder", node.name) + -- Swap in placeholder node + node.name = "worldedit:placeholder" + swap_node(pos, node) + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return worldedit.volume(pos1, pos2) +end + +--- Suppresses all instances of `node_name` in a region defined by positions +-- `pos1` and `pos2` by non-destructively replacing them with invisible nodes. +-- @return The number of nodes suppressed. +function worldedit.suppress(pos1, pos2, node_name) + -- Ignore placeholder supression + if node_name == "worldedit:placeholder" then + return 0 + end + + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local nodes = minetest.find_nodes_in_area(pos1, pos2, node_name) + local get_node, get_meta, swap_node = minetest.get_node, + minetest.get_meta, minetest.swap_node + for _, pos in ipairs(nodes) do + local node = get_node(pos) + -- Save the node's original name + get_meta(pos):set_string("worldedit_placeholder", node.name) + -- Swap in placeholder node + node.name = "worldedit:placeholder" + swap_node(pos, node) + end + return #nodes +end + +--- Highlights all instances of `node_name` in a region defined by positions +-- `pos1` and `pos2` by non-destructively hiding all other nodes. +-- @return The number of nodes found. +function worldedit.highlight(pos1, pos2, node_name) + pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local pos = {x=pos1.x, y=0, z=0} + local get_node, get_meta, swap_node = minetest.get_node, + minetest.get_meta, minetest.swap_node + local count = 0 + while pos.x <= pos2.x do + pos.y = pos1.y + while pos.y <= pos2.y do + pos.z = pos1.z + while pos.z <= pos2.z do + local node = get_node(pos) + if node.name == node_name then -- Node found + count = count + 1 + elseif node.name ~= "worldedit:placeholder" then -- Hide other nodes + -- Save the node's original name + get_meta(pos):set_string("worldedit_placeholder", node.name) + -- Swap in placeholder node + node.name = "worldedit:placeholder" + swap_node(pos, node) + end + pos.z = pos.z + 1 + end + pos.y = pos.y + 1 + end + pos.x = pos.x + 1 + end + return count +end + +-- Restores all nodes hidden with WorldEdit functions in a region defined +-- by positions `pos1` and `pos2`. +-- @return The number of nodes restored. +function worldedit.restore(pos1, pos2) + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + worldedit.keep_loaded(pos1, pos2) + + local nodes = minetest.find_nodes_in_area(pos1, pos2, "worldedit:placeholder") + local get_node, get_meta, swap_node = minetest.get_node, + minetest.get_meta, minetest.swap_node + for _, pos in ipairs(nodes) do + local node = get_node(pos) + local meta = get_meta(pos) + local data = meta:to_table() + node.name = data.fields.worldedit_placeholder + data.fields.worldedit_placeholder = nil + meta:from_table(data) + swap_node(pos, node) + end + return #nodes +end + diff --git a/mods/worldedit/worldedit_brush/depends.txt b/mods/worldedit/worldedit_brush/depends.txt new file mode 100644 index 0000000..f886436 --- /dev/null +++ b/mods/worldedit/worldedit_brush/depends.txt @@ -0,0 +1,2 @@ +worldedit +worldedit_commands diff --git a/mods/worldedit/worldedit_brush/init.lua b/mods/worldedit/worldedit_brush/init.lua new file mode 100644 index 0000000..21de630 --- /dev/null +++ b/mods/worldedit/worldedit_brush/init.lua @@ -0,0 +1,161 @@ +local modname = minetest.get_current_modname() + +-- check compatibility +if minetest.raycast == nil then + function log_unavailable_error() + minetest.log("error", + "[MOD] " .. modname .. " is not compatible with current game version, " .. + "you can disable it in the game settings!" + ) + minetest.log("verbose", + "[MOD] " .. modname .. " requires a suitable version of 0.4.16-dev or higher, " .. + "that includes support for minetest.raycast() [since 7th July 2017]" + ) + end + + if minetest.is_singleplayer() then + -- delay message until player is connected + minetest.register_on_joinplayer(log_unavailable_error) + else + log_unavailable_error() + end + + -- exit here / do not load this mod + return +end + +local BRUSH_MAX_DIST = 150 +local BRUSH_ALLOWED_COMMANDS = { + -- basically everything that only needs pos1 + "cube", + "cylinder", + "dome", + "hollowcube", + "hollowcylinder", + "hollowdome", + "hollowpyramid", + "hollowsphere", + "load", + "pyramid", + "sphere", + "spiral", + + "cyl", + "do", + "hcube", + "hcyl", + "hdo", + "hpyr", + "hspr", + "l", + "pyr", + "spr", + "spl", +} +local brush_on_use = function(itemstack, placer) + local meta = itemstack:get_meta() + local name = placer:get_player_name() + + local cmd = meta:get_string("command") + if cmd == "" then + worldedit.player_notify(name, + "This brush is not bound, use //brush to bind a command to it.") + return false + end + local cmddef = minetest.registered_chatcommands["/" .. cmd] + if cmddef == nil then return false end -- shouldn't happen as //brush checks this + local has_privs, missing_privs = minetest.check_player_privs(name, cmddef.privs) + if not has_privs then + worldedit.player_notify(name, + "Missing privileges: " .. table.concat(missing_privs, ", ")) + return false + end + + local raybegin = vector.add(placer:get_pos(), {x=0, y=2, z=0}) -- player head + local rayend = vector.add(raybegin, vector.multiply(placer:get_look_dir(), BRUSH_MAX_DIST)) + local ray = minetest.raycast(raybegin, rayend, false, true) + local pointed_thing = ray:next() + if pointed_thing == nil then + worldedit.player_notify(name, "Too far away.") + return false + end + + assert(pointed_thing.type == "node") + worldedit.pos1[name] = pointed_thing.under + worldedit.pos2[name] = nil + worldedit.mark_region(name) + -- is this a horrible hack? oh yes. + worldedit._override_safe_regions = true + local player_notify_old = worldedit.player_notify + worldedit.player_notify = function(name, msg) + if string.match(msg, "^%d") then return end -- discard "1234 nodes added." + return player_notify_old(name, msg) + end + + minetest.log("action", string.format("%s uses WorldEdit brush (//%s) at %s", + name, cmd, minetest.pos_to_string(pointed_thing.under))) + cmddef.func(name, meta:get_string("params")) + + worldedit._override_safe_regions = false + worldedit.player_notify = player_notify_old + return true +end + +minetest.register_tool(":worldedit:brush", { + description = "WorldEdit Brush", + inventory_image = "worldedit_brush.png", + stack_max = 1, -- no need to stack these (metadata prevents this anyway) + range = 0, + on_use = function(itemstack, placer, pointed_thing) + brush_on_use(itemstack, placer) + return itemstack -- nothing consumed, nothing changed + end, +}) + +minetest.register_chatcommand("/brush", { + privs = {worldedit=true}, + params = "none/ [parameters]", + description = "Assign command to WorldEdit brush item", + func = function(name, param) + local found, _, cmd, params = param:find("^([^%s]+)%s+(.+)$") + if not found then + params = "" + found, _, cmd = param:find("^(.+)$") + end + if not found then + worldedit.player_notify(name, "Invalid usage.") + return + end + + local itemstack = minetest.get_player_by_name(name):get_wielded_item() + if itemstack == nil or itemstack:get_name() ~= "worldedit:brush" then + worldedit.player_notify(name, "Not holding brush item.") + return + end + + cmd = cmd:lower() + local meta = itemstack:get_meta() + if cmd == "none" then + meta:from_table(nil) + worldedit.player_notify(name, "Brush assignment cleared.") + else + local cmddef + if table.indexof(BRUSH_ALLOWED_COMMANDS, cmd) ~= -1 then + cmddef = minetest.registered_chatcommands["/" .. cmd] + else + cmddef = nil + end + if cmddef == nil then + worldedit.player_notify(name, "Invalid command for brush use: //" .. cmd) + return + end + meta:set_string("command", cmd) + meta:set_string("params", params) + local fullcmd = "//" .. cmd .. " " .. params + meta:set_string("description", + minetest.registered_tools["worldedit:brush"].description .. ": " .. fullcmd) + worldedit.player_notify(name, "Brush assigned to command: " .. fullcmd) + end + minetest.get_player_by_name(name):set_wielded_item(itemstack) + end, +}) diff --git a/mods/worldedit/worldedit_brush/textures/worldedit_brush.png b/mods/worldedit/worldedit_brush/textures/worldedit_brush.png new file mode 100644 index 0000000..03785ff Binary files /dev/null and b/mods/worldedit/worldedit_brush/textures/worldedit_brush.png differ diff --git a/mods/worldedit/worldedit_commands/.gitignore b/mods/worldedit/worldedit_commands/.gitignore new file mode 100644 index 0000000..e4e5f6c --- /dev/null +++ b/mods/worldedit/worldedit_commands/.gitignore @@ -0,0 +1 @@ +*~ \ No newline at end of file diff --git a/mods/worldedit/worldedit_commands/cuboid.lua b/mods/worldedit/worldedit_commands/cuboid.lua new file mode 100644 index 0000000..88f0260 --- /dev/null +++ b/mods/worldedit/worldedit_commands/cuboid.lua @@ -0,0 +1,240 @@ +minetest.register_chatcommand("/outset", { + params = "[h|v] ", + description = "outset the selection", + privs = {worldedit=true}, + func = function(name, param) + local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)") + + if find == nil then + return false, "invalid usage: " .. param + end + + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + + if pos1 == nil or pos2 == nil then + return false, + "Undefined region. Region must be defined beforehand." + end + + local hv_test = dir:find("[^hv]+") + + if hv_test ~= nil then + return false, "Invalid direction." + end + + if dir == "" or dir == "hv" or dir == "vh" then + assert(worldedit.cuboid_volumetric_expand(name, amount)) + elseif dir == "h" then + assert(worldedit.cuboid_linear_expand(name, 'x', 1, amount)) + assert(worldedit.cuboid_linear_expand(name, 'x', -1, amount)) + assert(worldedit.cuboid_linear_expand(name, 'z', 1, amount)) + assert(worldedit.cuboid_linear_expand(name, 'z', -1, amount)) + elseif dir == "v" then + assert(worldedit.cuboid_linear_expand(name, 'y', 1, amount)) + assert(worldedit.cuboid_linear_expand(name, 'y', -1, amount)) + else + return false, "Invalid number of arguments" + end + + worldedit.marker_update(name) + return true, "Region outset by " .. amount .. " blocks" + end, + } +) + + +minetest.register_chatcommand("/inset", { + params = "[h|v] ", + description = "inset the selection", + privs = {worldedit=true}, + func = function(name, param) + local find, _, dir, amount = param:find("(%a*)%s*([+-]?%d+)") + + if find == nil then + return false, "invalid usage: " .. param + end + + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + + if pos1 == nil or pos2 == nil then + return false, + "Undefined region. Region must be defined beforehand." + end + + local hv_test = dir:find("[^hv]+") + + if hv_test ~= nil then + return false, "Invalid direction." + end + + if dir == "" or dir == "vh" or dir == "hv" then + assert(worldedit.cuboid_volumetric_expand(name, -amount)) + elseif dir == "h" then + assert(worldedit.cuboid_linear_expand(name, 'x', 1, -amount)) + assert(worldedit.cuboid_linear_expand(name, 'x', -1, -amount)) + assert(worldedit.cuboid_linear_expand(name, 'z', 1, -amount)) + assert(worldedit.cuboid_linear_expand(name, 'z', -1, -amount)) + elseif dir == "v" then + assert(worldedit.cuboid_linear_expand(name, 'y', 1, -amount)) + assert(worldedit.cuboid_linear_expand(name, 'y', -1, -amount)) + else + return false, "Invalid number of arguments" + end + + worldedit.marker_update(name) + return true, "Region inset by " .. amount .. " blocks" + end, + } +) + + +minetest.register_chatcommand("/shift", { + params = "[x|y|z|?|up|down|left|right|front|back] [+|-]", + description = "Moves the selection region. Does not move contents.", + privs = {worldedit=true}, + func = function(name, param) + local pos1 = worldedit.pos1[name] + local pos2 = worldedit.pos2[name] + local find, _, direction, amount = param:find("([%?%l]+)%s*([+-]?%d+)") + + if find == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + + if pos1 == nil or pos2 == nil then + worldedit.player_notify(name, + "Undefined region. Region must be defined beforehand.") + return + end + + local axis, dir + if direction == "x" or direction == "y" or direction == "z" then + axis, dir = direction, 1 + elseif direction == "?" then + axis, dir = worldedit.player_axis(name) + else + axis, dir = worldedit.translate_direction(name, direction) + end + + if axis == nil or dir == nil then + return false, "Invalid if looking straight up or down" + end + + assert(worldedit.cuboid_shift(name, axis, amount * dir)) + worldedit.marker_update(name) + + return true, "Region shifted by " .. amount .. " nodes" + end, + } +) + + +minetest.register_chatcommand("/expand", { + params = "[+|-] [reverse-amount]", + description = "expand the selection in one or two directions at once", + privs = {worldedit=true}, + func = function(name, param) + local find, _, sign, direction, amount, + rev_amount = param:find("([+-]?)([%?%l]+)%s*(%d+)%s*(%d*)") + + if find == nil then + worldedit.player_notify(name, "invalid use: " .. param) + return + end + + if worldedit.pos1[name] == nil or worldedit.pos2[name] == nil then + worldedit.player_notify(name, + "Undefined region. Region must be defined beforehand.") + return + end + + local absolute = direction:find("[xyz?]") + local dir, axis + + if rev_amount == "" then + rev_amount = 0 + end + + if absolute == nil then + axis, dir = worldedit.translate_direction(name, direction) + + if axis == nil or dir == nil then + return false, "Invalid if looking straight up or down" + end + else + if direction == "?" then + axis, dir = worldedit.player_axis(name) + else + axis = direction + dir = 1 + end + end + + if sign == "-" then + dir = -dir + end + + worldedit.cuboid_linear_expand(name, axis, dir, amount) + worldedit.cuboid_linear_expand(name, axis, -dir, rev_amount) + worldedit.marker_update(name) + return true, "Region expanded by " .. (amount + rev_amount) .. " nodes" + end, + } +) + + +minetest.register_chatcommand("/contract", { + params = "[+|-] [reverse-amount]", + description = "contract the selection in one or two directions at once", + privs = {worldedit=true}, + func = function(name, param) + local find, _, sign, direction, amount, + rev_amount = param:find("([+-]?)([%?%l]+)%s*(%d+)%s*(%d*)") + + if find == nil then + worldedit.player_notify(name, "invalid use: " .. param) + return + end + + if worldedit.pos1[name] == nil or worldedit.pos2[name] == nil then + worldedit.player_notify(name, + "Undefined region. Region must be defined beforehand.") + return + end + + local absolute = direction:find("[xyz?]") + local dir, axis + + if rev_amount == "" then + rev_amount = 0 + end + + if absolute == nil then + axis, dir = worldedit.translate_direction(name, direction) + + if axis == nil or dir == nil then + return false, "Invalid if looking straight up or down" + end + else + if direction == "?" then + axis, dir = worldedit.player_axis(name) + else + axis = direction + dir = 1 + end + end + + if sign == "-" then + dir = -dir + end + + worldedit.cuboid_linear_expand(name, axis, dir, -amount) + worldedit.cuboid_linear_expand(name, axis, -dir, -rev_amount) + worldedit.marker_update(name) + return true, "Region contracted by " .. (amount + rev_amount) .. " nodes" + end, + } +) diff --git a/mods/worldedit/worldedit_commands/depends.txt b/mods/worldedit/worldedit_commands/depends.txt new file mode 100644 index 0000000..df8caff --- /dev/null +++ b/mods/worldedit/worldedit_commands/depends.txt @@ -0,0 +1 @@ +worldedit \ No newline at end of file diff --git a/mods/worldedit/worldedit_commands/init.lua b/mods/worldedit/worldedit_commands/init.lua new file mode 100644 index 0000000..83712f0 --- /dev/null +++ b/mods/worldedit/worldedit_commands/init.lua @@ -0,0 +1,1358 @@ +minetest.register_privilege("worldedit", "Can use WorldEdit commands") + +worldedit.set_pos = {} +worldedit.inspect = {} + +worldedit.pos1 = {} +worldedit.pos2 = {} +if minetest.place_schematic then + worldedit.prob_pos = {} + worldedit.prob_list = {} +end + +dofile(minetest.get_modpath("worldedit_commands") .. "/cuboid.lua") +dofile(minetest.get_modpath("worldedit_commands") .. "/mark.lua") +dofile(minetest.get_modpath("worldedit_commands") .. "/wand.lua") +local safe_region, check_region, reset_pending = dofile(minetest.get_modpath("worldedit_commands") .. "/safe.lua") + +local function get_position(name) --position 1 retrieval function for when not using `safe_region` + local pos1 = worldedit.pos1[name] + if pos1 == nil then + worldedit.player_notify(name, "no position 1 selected") + end + return pos1 +end + +-- normalize_nodename wrapper for convenience purposes +local function get_node(name, nodename) + local node = worldedit.normalize_nodename(nodename) + if not node then + worldedit.player_notify(name, "invalid node name: " .. nodename) + return nil + end + return node +end + +function worldedit.player_notify(name, message) + minetest.chat_send_player(name, "WorldEdit -!- " .. message, false) +end + +local function string_endswith(full, part) + return full:find(part, 1, true) == #full - #part + 1 +end + +-- normalizes node "description" `nodename`, returning a string (or nil) +worldedit.normalize_nodename = function(nodename) + nodename = nodename:gsub("^%s*(.-)%s*$", "%1") -- strip spaces + if nodename == "" then return nil end + + local fullname = ItemStack({name=nodename}):get_name() -- resolve aliases + if minetest.registered_nodes[fullname] or fullname == "air" then -- full name + return fullname + end + for key, value in pairs(minetest.registered_nodes) do + if string_endswith(key, ":" .. nodename) then -- matches name (w/o mod part) + return key + end + end + nodename = nodename:lower() -- lowercase both for case insensitive comparison + for key, value in pairs(minetest.registered_nodes) do + local desc = value.description:lower() + if desc == nodename then -- matches description + return key + end + if string_endswith(desc, " block") and desc == nodename.." block" then + -- fuzzy description match (e.g. "Steel" == "Steel Block") + return key + end + end + + local match = nil + for key, value in pairs(minetest.registered_nodes) do + if value.description:lower():find(nodename, 1, true) ~= nil then + if match ~= nil then + return nil + end + match = key -- substring description match (only if no ambiguities) + end + end + return match +end + +-- Determines the axis in which a player is facing, returning an axis ("x", "y", or "z") and the sign (1 or -1) +function worldedit.player_axis(name) + local dir = minetest.get_player_by_name(name):get_look_dir() + local x, y, z = math.abs(dir.x), math.abs(dir.y), math.abs(dir.z) + if x > y then + if x > z then + return "x", dir.x > 0 and 1 or -1 + end + elseif y > z then + return "y", dir.y > 0 and 1 or -1 + end + return "z", dir.z > 0 and 1 or -1 +end + +local function mkdir(path) + if minetest.mkdir then + minetest.mkdir(path) + else + os.execute('mkdir "' .. path .. '"') + end +end + +local function check_filename(name) + return name:find("^[%w%s%^&'@{}%[%],%$=!%-#%(%)%%%.%+~_]+$") ~= nil +end + + +minetest.register_chatcommand("/about", { + params = "", + description = "Get information about the mod", + func = function(name, param) + worldedit.player_notify(name, "WorldEdit " .. worldedit.version_string .. " is available on this server. Type /help to get a list of commands, or get more information at https://github.com/Uberi/Minetest-WorldEdit/") + end, +}) + +-- mostly copied from builtin/chatcommands.lua with minor modifications +minetest.register_chatcommand("/help", { + privs = {}, + params = "[all/]", + description = "Get help for WorldEdit commands", + func = function(name, param) + local function is_we_command(cmd) + return cmd:sub(0, 1) == "/" + end + local function format_help_line(cmd, def) + local msg = minetest.colorize("#00ffff", "/"..cmd) + if def.params and def.params ~= "" then + msg = msg .. " " .. def.params + end + if def.description and def.description ~= "" then + msg = msg .. ": " .. def.description + end + return msg + end + + if not minetest.check_player_privs(name, "worldedit") then + return false, "You are not allowed to use any WorldEdit commands." + end + if param == "" then + local msg = "" + local cmds = {} + for cmd, def in pairs(minetest.chatcommands) do + if is_we_command(cmd) and minetest.check_player_privs(name, def.privs) then + cmds[#cmds + 1] = cmd:sub(2) -- strip the / + end + end + table.sort(cmds) + return true, "Available commands: " .. table.concat(cmds, " ") .. "\n" + .. "Use '//help ' to get more information," + .. " or '//help all' to list everything." + elseif param == "all" then + local cmds = {} + for cmd, def in pairs(minetest.chatcommands) do + if is_we_command(cmd) and minetest.check_player_privs(name, def.privs) then + cmds[#cmds + 1] = format_help_line(cmd, def) + end + end + table.sort(cmds) + return true, "Available commands:\n"..table.concat(cmds, "\n") + else + return minetest.chatcommands["help"].func(name, "/" .. param) + end + end, +}) + +minetest.register_chatcommand("/inspect", { + params = "on/off/1/0/true/false/yes/no/enable/disable/", + description = "Enable or disable node inspection", + privs = {worldedit=true}, + func = function(name, param) + if param == "on" or param == "1" or param == "true" or param == "yes" or param == "enable" or param == "" then + worldedit.inspect[name] = true + local axis, sign = worldedit.player_axis(name) + worldedit.player_notify(name, string.format("inspector: inspection enabled for %s, currently facing the %s axis", + name, axis .. (sign > 0 and "+" or "-"))) + elseif param == "off" or param == "0" or param == "false" or param == "no" or param == "disable" then + worldedit.inspect[name] = nil + worldedit.player_notify(name, "inspector: inspection disabled") + else + worldedit.player_notify(name, "invalid usage: " .. param) + end + end, +}) + +local function get_node_rlight(pos) + local vecs = { -- neighboring nodes + {x= 1, y= 0, z= 0}, + {x=-1, y= 0, z= 0}, + {x= 0, y= 1, z= 0}, + {x= 0, y=-1, z= 0}, + {x= 0, y= 0, z= 1}, + {x= 0, y= 0, z=-1}, + } + local ret = 0 + for _, v in ipairs(vecs) do + ret = math.max(ret, minetest.get_node_light(vector.add(pos, v))) + end + return ret +end + +minetest.register_on_punchnode(function(pos, node, puncher) + local name = puncher:get_player_name() + if worldedit.inspect[name] then + local axis, sign = worldedit.player_axis(name) + local message = string.format("inspector: %s at %s (param1=%d, param2=%d, received light=%d) punched facing the %s axis", + node.name, minetest.pos_to_string(pos), node.param1, node.param2, get_node_rlight(pos), axis .. (sign > 0 and "+" or "-")) + worldedit.player_notify(name, message) + end +end) + +minetest.register_chatcommand("/reset", { + params = "", + description = "Reset the region so that it is empty", + privs = {worldedit=true}, + func = function(name, param) + worldedit.pos1[name] = nil + worldedit.pos2[name] = nil + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + worldedit.set_pos[name] = nil + --make sure the user does not try to confirm an operation after resetting pos: + reset_pending(name) + worldedit.player_notify(name, "region reset") + end, +}) + +minetest.register_chatcommand("/mark", { + params = "", + description = "Show markers at the region positions", + privs = {worldedit=true}, + func = function(name, param) + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + worldedit.player_notify(name, "region marked") + end, +}) + +minetest.register_chatcommand("/unmark", { + params = "", + description = "Hide markers if currently shown", + privs = {worldedit=true}, + func = function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + worldedit.pos1[name] = nil + worldedit.pos2[name] = nil + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + worldedit.pos1[name] = pos1 + worldedit.pos2[name] = pos2 + worldedit.player_notify(name, "region unmarked") + end, +}) + +minetest.register_chatcommand("/pos1", { + params = "", + description = "Set WorldEdit region position 1 to the player's location", + privs = {worldedit=true}, + func = function(name, param) + local pos = minetest.get_player_by_name(name):getpos() + pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5) + worldedit.pos1[name] = pos + worldedit.mark_pos1(name) + worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos)) + end, +}) + +minetest.register_chatcommand("/pos2", { + params = "", + description = "Set WorldEdit region position 2 to the player's location", + privs = {worldedit=true}, + func = function(name, param) + local pos = minetest.get_player_by_name(name):getpos() + pos.x, pos.y, pos.z = math.floor(pos.x + 0.5), math.floor(pos.y + 0.5), math.floor(pos.z + 0.5) + worldedit.pos2[name] = pos + worldedit.mark_pos2(name) + worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos)) + end, +}) + +minetest.register_chatcommand("/p", { + params = "set/set1/set2/get", + description = "Set WorldEdit region, WorldEdit position 1, or WorldEdit position 2 by punching nodes, or display the current WorldEdit region", + privs = {worldedit=true}, + func = function(name, param) + if param == "set" then --set both WorldEdit positions + worldedit.set_pos[name] = "pos1" + worldedit.player_notify(name, "select positions by punching two nodes") + elseif param == "set1" then --set WorldEdit position 1 + worldedit.set_pos[name] = "pos1only" + worldedit.player_notify(name, "select position 1 by punching a node") + elseif param == "set2" then --set WorldEdit position 2 + worldedit.set_pos[name] = "pos2" + worldedit.player_notify(name, "select position 2 by punching a node") + elseif param == "get" then --display current WorldEdit positions + if worldedit.pos1[name] ~= nil then + worldedit.player_notify(name, "position 1: " .. minetest.pos_to_string(worldedit.pos1[name])) + else + worldedit.player_notify(name, "position 1 not set") + end + if worldedit.pos2[name] ~= nil then + worldedit.player_notify(name, "position 2: " .. minetest.pos_to_string(worldedit.pos2[name])) + else + worldedit.player_notify(name, "position 2 not set") + end + else + worldedit.player_notify(name, "unknown subcommand: " .. param) + end + end, +}) + +minetest.register_chatcommand("/fixedpos", { + params = "set1/set2 x y z", + description = "Set a WorldEdit region position to the position at (, , )", + privs = {worldedit=true}, + func = function(name, param) + local found, _, flag, x, y, z = param:find("^(set[12])%s+([+-]?%d+)%s+([+-]?%d+)%s+([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)} + if flag == "set1" then + worldedit.pos1[name] = pos + worldedit.mark_pos1(name) + worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos)) + else --flag == "set2" + worldedit.pos2[name] = pos + worldedit.mark_pos2(name) + worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos)) + end + end, +}) + +minetest.register_on_punchnode(function(pos, node, puncher) + local name = puncher:get_player_name() + if name ~= "" and worldedit.set_pos[name] ~= nil then --currently setting position + if worldedit.set_pos[name] == "pos1" then --setting position 1 + worldedit.pos1[name] = pos + worldedit.mark_pos1(name) + worldedit.set_pos[name] = "pos2" --set position 2 on the next invocation + worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos)) + elseif worldedit.set_pos[name] == "pos1only" then --setting position 1 only + worldedit.pos1[name] = pos + worldedit.mark_pos1(name) + worldedit.set_pos[name] = nil --finished setting positions + worldedit.player_notify(name, "position 1 set to " .. minetest.pos_to_string(pos)) + elseif worldedit.set_pos[name] == "pos2" then --setting position 2 + worldedit.pos2[name] = pos + worldedit.mark_pos2(name) + worldedit.set_pos[name] = nil --finished setting positions + worldedit.player_notify(name, "position 2 set to " .. minetest.pos_to_string(pos)) + elseif worldedit.set_pos[name] == "prob" then --setting Minetest schematic node probabilities + worldedit.prob_pos[name] = pos + minetest.show_formspec(puncher:get_player_name(), "prob_val_enter", "field[text;;]") + end + end +end) + +minetest.register_chatcommand("/volume", { + params = "", + description = "Display the volume of the current WorldEdit region", + privs = {worldedit=true}, + func = function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + if pos1 == nil or pos2 == nil then + worldedit.player_notify(name, "no region selected") + return nil + end + + local volume = worldedit.volume(pos1, pos2) + local abs = math.abs + worldedit.player_notify(name, "current region has a volume of " .. volume .. " nodes (" + .. abs(pos2.x - pos1.x) + 1 .. "*" + .. abs(pos2.y - pos1.y) + 1 .. "*" + .. abs(pos2.z - pos1.z) + 1 .. ")") + end, +}) + +minetest.register_chatcommand("/deleteblocks", { + params = "", + description = "remove all MapBlocks (16x16x16) containing the selected area from the map", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local success = minetest.delete_area(pos1, pos2) + if success then + worldedit.player_notify(name, "Area deleted.") + else + worldedit.player_notify(name, "There was an error during deletion of the area.") + end + end), +}) + +minetest.register_chatcommand("/set", { + params = "", + description = "Set the current WorldEdit region to ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local node = get_node(name, param) + if not node then return end + + local count = worldedit.set(worldedit.pos1[name], worldedit.pos2[name], node) + worldedit.player_notify(name, count .. " nodes set") + end, check_region), +}) + +minetest.register_chatcommand("/param2", { + params = "", + description = "Set param2 of all nodes in the current WorldEdit region to ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local param2 = tonumber(param) + if not param2 then + worldedit.player_notify(name, "Invalid or missing param2 argument") + return + elseif param2 < 0 or param2 > 255 then + worldedit.player_notify(name, "Param2 is out of range (must be between 0 and 255 inclusive)!") + return + end + + local count = worldedit.set_param2(worldedit.pos1[name], worldedit.pos2[name], param2) + worldedit.player_notify(name, count .. " nodes altered") + end, check_region), +}) + +minetest.register_chatcommand("/mix", { + params = " ...", + description = "Fill the current WorldEdit region with a random mix of , ...", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local nodes = {} + for nodename in param:gmatch("[^%s]+") do + local node = get_node(name, nodename) + if not node then return end + nodes[#nodes + 1] = node + end + + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local count = worldedit.set(pos1, pos2, nodes) + worldedit.player_notify(name, count .. " nodes set") + end, check_region), +}) + +local check_replace = function(name, param) + local found, _, searchnode, replacenode = param:find("^([^%s]+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local newsearchnode = worldedit.normalize_nodename(searchnode) + if not newsearchnode then + worldedit.player_notify(name, "invalid search node name: " .. searchnode) + return nil + end + local newreplacenode = worldedit.normalize_nodename(replacenode) + if not newreplacenode then + worldedit.player_notify(name, "invalid replace node name: " .. replacenode) + return nil + end + return check_region(name, param) +end + +minetest.register_chatcommand("/replace", { + params = " ", + description = "Replace all instances of with in the current WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, search_node, replace_node = param:find("^([^%s]+)%s+(.+)$") + local norm_search_node = worldedit.normalize_nodename(search_node) + local norm_replace_node = worldedit.normalize_nodename(replace_node) + local count = worldedit.replace(worldedit.pos1[name], worldedit.pos2[name], + norm_search_node, norm_replace_node) + worldedit.player_notify(name, count .. " nodes replaced") + end, check_replace), +}) + +minetest.register_chatcommand("/replaceinverse", { + params = " ", + description = "Replace all nodes other than with in the current WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, search_node, replace_node = param:find("^([^%s]+)%s+(.+)$") + local norm_search_node = worldedit.normalize_nodename(search_node) + local norm_replace_node = worldedit.normalize_nodename(replace_node) + local count = worldedit.replace(worldedit.pos1[name], worldedit.pos2[name], + norm_search_node, norm_replace_node, true) + worldedit.player_notify(name, count .. " nodes replaced") + end, check_replace), +}) + +local check_cube = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, w, h, l, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + return tonumber(w) * tonumber(h) * tonumber(l) +end + +minetest.register_chatcommand("/hollowcube", { + params = " ", + description = "Add a hollow cube with its ground level centered at WorldEdit position 1 with dimensions x x , composed of .", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, w, h, l, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.cube(worldedit.pos1[name], tonumber(w), tonumber(h), tonumber(l), node, true) + worldedit.player_notify(name, count .. " nodes added") + end, check_cube), +}) + +minetest.register_chatcommand("/cube", { + params = " ", + description = "Add a cube with its ground level centered at WorldEdit position 1 with dimensions x x , composed of .", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, w, h, l, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.cube(worldedit.pos1[name], tonumber(w), tonumber(h), tonumber(l), node) + worldedit.player_notify(name, count .. " nodes added") + end, check_cube), +}) + +local check_sphere = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + return math.ceil((4 * math.pi * (tonumber(radius) ^ 3)) / 3) --volume of sphere +end + +minetest.register_chatcommand("/hollowsphere", { + params = " ", + description = "Add hollow sphere centered at WorldEdit position 1 with radius , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.sphere(worldedit.pos1[name], tonumber(radius), node, true) + worldedit.player_notify(name, count .. " nodes added") + end, check_sphere), +}) + +minetest.register_chatcommand("/sphere", { + params = " ", + description = "Add sphere centered at WorldEdit position 1 with radius , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.sphere(worldedit.pos1[name], tonumber(radius), node) + worldedit.player_notify(name, count .. " nodes added") + end, check_sphere), +}) + +local check_dome = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + return math.ceil((2 * math.pi * (tonumber(radius) ^ 3)) / 3) --volume of dome +end + +minetest.register_chatcommand("/hollowdome", { + params = " ", + description = "Add hollow dome centered at WorldEdit position 1 with radius , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.dome(worldedit.pos1[name], tonumber(radius), node, true) + worldedit.player_notify(name, count .. " nodes added") + end, check_dome), +}) + +minetest.register_chatcommand("/dome", { + params = " ", + description = "Add dome centered at WorldEdit position 1 with radius , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, radius, nodename = param:find("^(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.dome(worldedit.pos1[name], tonumber(radius), node) + worldedit.player_notify(name, count .. " nodes added") + end, check_dome), +}) + +local check_cylinder = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + -- two radii + local found, _, axis, length, radius1, radius2, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + if found == nil then + -- single radius + found, _, axis, length, radius1, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$") + radius2 = radius1 + end + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + local radius = math.max(tonumber(radius1), tonumber(radius2)) + return math.ceil(math.pi * (radius ^ 2) * tonumber(length)) +end + +minetest.register_chatcommand("/hollowcylinder", { + params = "x/y/z/? [radius2] ", + description = "Add hollow cylinder at WorldEdit position 1 along the x/y/z/? axis with length , base radius (and top radius [radius2]), composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + -- two radii + local found, _, axis, length, radius1, radius2, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + if found == nil then + -- single radius + found, _, axis, length, radius1, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$") + radius2 = radius1 + end + length = tonumber(length) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + length = length * sign + end + local node = get_node(name, nodename) + local count = worldedit.cylinder(worldedit.pos1[name], axis, length, tonumber(radius1), tonumber(radius2), node, true) + worldedit.player_notify(name, count .. " nodes added") + end, check_cylinder), +}) + +minetest.register_chatcommand("/cylinder", { + params = "x/y/z/? [radius2] ", + description = "Add cylinder at WorldEdit position 1 along the x/y/z/? axis with length , base radius (and top radius [radius2]), composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + -- two radii + local found, _, axis, length, radius1, radius2, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + if found == nil then + -- single radius + found, _, axis, length, radius1, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(%d+)%s+(.+)$") + radius2 = radius1 + end + length = tonumber(length) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + length = length * sign + end + local node = get_node(name, nodename) + local count = worldedit.cylinder(worldedit.pos1[name], axis, length, tonumber(radius1), tonumber(radius2), node) + worldedit.player_notify(name, count .. " nodes added") + end, check_cylinder), +}) + +local check_pyramid = function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + height = tonumber(height) + return math.ceil(((height * 2 + 1) ^ 2) * height / 3) +end + +minetest.register_chatcommand("/hollowpyramid", { + params = "x/y/z/? ", + description = "Add hollow pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") + height = tonumber(height) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + height = height * sign + end + local node = get_node(name, nodename) + local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node, true) + worldedit.player_notify(name, count .. " nodes added") + end, check_pyramid), +}) + +minetest.register_chatcommand("/pyramid", { + params = "x/y/z/? ", + description = "Add pyramid centered at WorldEdit position 1 along the x/y/z/? axis with height , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, axis, height, nodename = param:find("^([xyz%?])%s+([+-]?%d+)%s+(.+)$") + height = tonumber(height) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + height = height * sign + end + local node = get_node(name, nodename) + local count = worldedit.pyramid(worldedit.pos1[name], axis, height, node) + worldedit.player_notify(name, count .. " nodes added") + end, check_pyramid), +}) + +minetest.register_chatcommand("/spiral", { + params = " ", + description = "Add spiral centered at WorldEdit position 1 with side length , height , space between walls , composed of ", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, length, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + local node = get_node(name, nodename) + local count = worldedit.spiral(worldedit.pos1[name], tonumber(length), tonumber(height), tonumber(space), node) + worldedit.player_notify(name, count .. " nodes added") + end, + function(name, param) + if worldedit.pos1[name] == nil then + worldedit.player_notify(name, "no position 1 selected") + return nil + end + local found, _, length, height, space, nodename = param:find("^(%d+)%s+(%d+)%s+(%d+)%s+(.+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + local node = get_node(name, nodename) + if not node then return nil end + return 1 -- TODO: return an useful value + end), +}) + +minetest.register_chatcommand("/copy", { + params = "x/y/z/? ", + description = "Copy the current WorldEdit region along the x/y/z/? axis by nodes", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + amount = tonumber(amount) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + amount = amount * sign + end + + local count = worldedit.copy(worldedit.pos1[name], worldedit.pos2[name], axis, amount) + worldedit.player_notify(name, count .. " nodes copied") + end, + function(name, param) + local volume = check_region(name, param) + return volume and volume * 2 or volume + end), +}) + +minetest.register_chatcommand("/move", { + params = "x/y/z/? ", + description = "Move the current WorldEdit region along the x/y/z/? axis by nodes", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local found, _, axis, amount = param:find("^([xyz%?])%s+([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + amount = tonumber(amount) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + amount = amount * sign + end + + local count = worldedit.move(pos1, pos2, axis, amount) + + pos1[axis] = pos1[axis] + amount + pos2[axis] = pos2[axis] + amount + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + worldedit.player_notify(name, count .. " nodes moved") + end, check_region), +}) + +minetest.register_chatcommand("/stack", { + params = "x/y/z/? ", + description = "Stack the current WorldEdit region along the x/y/z/? axis times", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$") + repetitions = tonumber(repetitions) + if axis == "?" then + local sign + axis, sign = worldedit.player_axis(name) + repetitions = repetitions * sign + end + local count = worldedit.stack(worldedit.pos1[name], worldedit.pos2[name], axis, repetitions) + worldedit.player_notify(name, count .. " nodes stacked") + end, + function(name, param) + local found, _, axis, repetitions = param:find("^([xyz%?])%s+([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + local count = check_region(name, param) + if count then return (tonumber(repetitions) + 1) * count end + return nil + end), +}) + +minetest.register_chatcommand("/stack2", { + params = " ", + description = "Stack the current WorldEdit region times by offset , , ", + privs = {worldedit=true}, + func = function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + if pos1 == nil or pos2 == nil then + worldedit.player_notify(name, "Select a position first!") + return + end + local repetitions, incs = param:match("(%d+)%s*(.+)") + if repetitions == nil then + worldedit.player_notify(name, "invalid count: " .. param) + return + end + repetitions = tonumber(repetitions) + + local x, y, z = incs:match("([+-]?%d+) ([+-]?%d+) ([+-]?%d+)") + if x == nil then + worldedit.player_notify(name, "invalid increments: " .. param) + return + end + x, y, z = tonumber(x), tonumber(y), tonumber(z) + + local count = worldedit.volume(pos1, pos2) * repetitions + + return safe_region(function() + worldedit.stack2(pos1, pos2, {x=x, y=y, z=z}, repetitions, + function() worldedit.player_notify(name, count .. " nodes stacked") end) + end, function() + return count + end)(name,param) -- more hax --wip: clean this up a little bit + end +}) + + +minetest.register_chatcommand("/stretch", { + params = " ", + description = "Scale the current WorldEdit positions and region by a factor of , , along the X, Y, and Z axes, repectively, with position 1 as the origin", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local found, _, stretchx, stretchy, stretchz = param:find("^(%d+)%s+(%d+)%s+(%d+)$") + stretchx, stretchy, stretchz = tonumber(stretchx), tonumber(stretchy), tonumber(stretchz) + local count, pos1, pos2 = worldedit.stretch(pos1, pos2, stretchx, stretchy, stretchz) + + --reset markers to scaled positions + worldedit.pos1[name] = pos1 + worldedit.pos2[name] = pos2 + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + + worldedit.player_notify(name, count .. " nodes stretched") + end, + function(name, param) + local found, _, stretchx, stretchy, stretchz = param:find("^(%d+)%s+(%d+)%s+(%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + stretchx, stretchy, stretchz = tonumber(stretchx), tonumber(stretchy), tonumber(stretchz) + if stretchx == 0 or stretchy == 0 or stretchz == 0 then + worldedit.player_notify(name, "invalid scaling factors: " .. param) + end + local count = check_region(name, param) + if count then return tonumber(stretchx) * tonumber(stretchy) * tonumber(stretchz) * count end + return nil + end), +}) + +minetest.register_chatcommand("/transpose", { + params = "x/y/z/? x/y/z/?", + description = "Transpose the current WorldEdit region along the x/y/z/? and x/y/z/? axes", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local found, _, axis1, axis2 = param:find("^([xyz%?])%s+([xyz%?])$") + if axis1 == "?" then axis1 = worldedit.player_axis(name) end + if axis2 == "?" then axis2 = worldedit.player_axis(name) end + local count, pos1, pos2 = worldedit.transpose(pos1, pos2, axis1, axis2) + + --reset markers to transposed positions + worldedit.pos1[name] = pos1 + worldedit.pos2[name] = pos2 + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + + worldedit.player_notify(name, count .. " nodes transposed") + end, + function(name, param) + local found, _, axis1, axis2 = param:find("^([xyz%?])%s+([xyz%?])$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + if axis1 == axis2 then + worldedit.player_notify(name, "invalid usage: axes must be different") + return nil + end + return check_region(name, param) + end), +}) + +minetest.register_chatcommand("/flip", { + params = "x/y/z/?", + description = "Flip the current WorldEdit region along the x/y/z/? axis", + privs = {worldedit=true}, + func = safe_region(function(name, param) + if param == "?" then param = worldedit.player_axis(name) end + local count = worldedit.flip(worldedit.pos1[name], worldedit.pos2[name], param) + worldedit.player_notify(name, count .. " nodes flipped") + end, + function(name, param) + if param ~= "x" and param ~= "y" and param ~= "z" and param ~= "?" then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + return check_region(name, param) + end), +}) + +minetest.register_chatcommand("/rotate", { + params = " ", + description = "Rotate the current WorldEdit region around the axis by angle (90 degree increment)", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + local found, _, axis, angle = param:find("^([xyz%?])%s+([+-]?%d+)$") + if axis == "?" then axis = worldedit.player_axis(name) end + local count, pos1, pos2 = worldedit.rotate(pos1, pos2, axis, angle) + + --reset markers to rotated positions + worldedit.pos1[name] = pos1 + worldedit.pos2[name] = pos2 + worldedit.mark_pos1(name) + worldedit.mark_pos2(name) + + worldedit.player_notify(name, count .. " nodes rotated") + end, + function(name, param) + local found, _, axis, angle = param:find("^([xyz%?])%s+([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + if angle % 90 ~= 0 then + worldedit.player_notify(name, "invalid usage: angle must be multiple of 90") + return nil + end + return check_region(name, param) + end), +}) + +minetest.register_chatcommand("/orient", { + params = "", + description = "Rotate oriented nodes in the current WorldEdit region around the Y axis by angle (90 degree increment)", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local found, _, angle = param:find("^([+-]?%d+)$") + local count = worldedit.orient(worldedit.pos1[name], worldedit.pos2[name], angle) + worldedit.player_notify(name, count .. " nodes oriented") + end, + function(name, param) + local found, _, angle = param:find("^([+-]?%d+)$") + if found == nil then + worldedit.player_notify(name, "invalid usage: " .. param) + return nil + end + if angle % 90 ~= 0 then + worldedit.player_notify(name, "invalid usage: angle must be multiple of 90") + return nil + end + return check_region(name, param) + end), +}) + +minetest.register_chatcommand("/fixlight", { + params = "", + description = "Fix the lighting in the current WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local count = worldedit.fixlight(worldedit.pos1[name], worldedit.pos2[name]) + worldedit.player_notify(name, count .. " nodes updated") + end), +}) + +minetest.register_chatcommand("/drain", { + params = "", + description = "Remove any fluid node within the current WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + -- TODO: make an API function for this + local count = 0 + local pos1, pos2 = worldedit.sort_pos(worldedit.pos1[name], worldedit.pos2[name]) + for x = pos1.x, pos2.x do + for y = pos1.y, pos2.y do + for z = pos1.z, pos2.z do + local n = minetest.get_node({x=x, y=y, z=z}).name + local d = minetest.registered_nodes[n] + if d ~= nil and (d["drawtype"] == "liquid" or d["drawtype"] == "flowingliquid") then + minetest.remove_node({x=x, y=y, z=z}) + count = count + 1 + end + end + end + end + worldedit.player_notify(name, count .. " nodes updated") + end), +}) + +minetest.register_chatcommand("/hide", { + params = "", + description = "Hide all nodes in the current WorldEdit region non-destructively", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local count = worldedit.hide(worldedit.pos1[name], worldedit.pos2[name]) + worldedit.player_notify(name, count .. " nodes hidden") + end), +}) + +minetest.register_chatcommand("/suppress", { + params = "", + description = "Suppress all in the current WorldEdit region non-destructively", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local node = get_node(name, param) + local count = worldedit.suppress(worldedit.pos1[name], worldedit.pos2[name], node) + worldedit.player_notify(name, count .. " nodes suppressed") + end, check_region), +}) + +minetest.register_chatcommand("/highlight", { + params = "", + description = "Highlight in the current WorldEdit region by hiding everything else non-destructively", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local node = get_node(name, param) + local count = worldedit.highlight(worldedit.pos1[name], worldedit.pos2[name], node) + worldedit.player_notify(name, count .. " nodes highlighted") + end, check_region), +}) + +minetest.register_chatcommand("/restore", { + params = "", + description = "Restores nodes hidden with WorldEdit in the current WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local count = worldedit.restore(worldedit.pos1[name], worldedit.pos2[name]) + worldedit.player_notify(name, count .. " nodes restored") + end), +}) + +minetest.register_chatcommand("/save", { + params = "", + description = "Save the current WorldEdit region to \"(world folder)/schems/.we\"", + privs = {worldedit=true}, + func = safe_region(function(name, param) + if param == "" then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + if not check_filename(param) then + worldedit.player_notify(name, "Disallowed file name: " .. param) + return + end + local result, count = worldedit.serialize(worldedit.pos1[name], + worldedit.pos2[name]) + + local path = minetest.get_worldpath() .. "/schems" + -- Create directory if it does not already exist + mkdir(path) + + local filename = path .. "/" .. param .. ".we" + local file, err = io.open(filename, "wb") + if err ~= nil then + worldedit.player_notify(name, "Could not save file to \"" .. filename .. "\"") + return + end + file:write(result) + file:flush() + file:close() + + worldedit.player_notify(name, count .. " nodes saved") + end), +}) + +minetest.register_chatcommand("/allocate", { + params = "", + description = "Set the region defined by nodes from \"(world folder)/schems/.we\" as the current WorldEdit region", + privs = {worldedit=true}, + func = function(name, param) + local pos = get_position(name) + if pos == nil then return end + + if param == "" then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + if not check_filename(param) then + worldedit.player_notify(name, "Disallowed file name: " .. param) + return + end + + local filename = minetest.get_worldpath() .. "/schems/" .. param .. ".we" + local file, err = io.open(filename, "rb") + if err ~= nil then + worldedit.player_notify(name, "could not open file \"" .. filename .. "\"") + return + end + local value = file:read("*a") + file:close() + + local version = worldedit.read_header(value) + if version == 0 then + worldedit.player_notify(name, "File is invalid!") + return + elseif version > worldedit.LATEST_SERIALIZATION_VERSION then + worldedit.player_notify(name, "File was created with newer version of WorldEdit!") + end + local nodepos1, nodepos2, count = worldedit.allocate(pos, value) + + worldedit.pos1[name] = nodepos1 + worldedit.mark_pos1(name) + worldedit.pos2[name] = nodepos2 + worldedit.mark_pos2(name) + + worldedit.player_notify(name, count .. " nodes allocated") + end, +}) + +minetest.register_chatcommand("/load", { + params = "", + description = "Load nodes from \"(world folder)/schems/[.we[m]]\" with position 1 of the current WorldEdit region as the origin", + privs = {worldedit=true}, + func = function(name, param) + local pos = get_position(name) + if pos == nil then return end + + if param == "" then + worldedit.player_notify(name, "invalid usage: " .. param) + return + end + if not string.find(param, "^[%w \t.,+-_=!@#$%%^&*()%[%]{};'\"]+$") then + worldedit.player_notify(name, "invalid file name: " .. param) + return + end + + --find the file in the world path + local testpaths = { + minetest.get_worldpath() .. "/schems/" .. param, + minetest.get_worldpath() .. "/schems/" .. param .. ".we", + minetest.get_worldpath() .. "/schems/" .. param .. ".wem", + } + local file, err + for index, path in ipairs(testpaths) do + file, err = io.open(path, "rb") + if not err then + break + end + end + if err then + worldedit.player_notify(name, "could not open file \"" .. param .. "\"") + return + end + local value = file:read("*a") + file:close() + + local version = worldedit.read_header(value) + if version == 0 then + worldedit.player_notify(name, "File is invalid!") + return + elseif version > worldedit.LATEST_SERIALIZATION_VERSION then + worldedit.player_notify(name, "File was created with newer version of WorldEdit!") + return + end + + local count = worldedit.deserialize(pos, value) + + worldedit.player_notify(name, count .. " nodes loaded") + end, +}) + +minetest.register_chatcommand("/lua", { + params = "", + description = "Executes as a Lua chunk in the global namespace", + privs = {worldedit=true, server=true}, + func = function(name, param) + local err = worldedit.lua(param) + if err then + worldedit.player_notify(name, "code error: " .. err) + minetest.log("action", name.." tried to execute "..param) + else + worldedit.player_notify(name, "code successfully executed", false) + minetest.log("action", name.." executed "..param) + end + end, +}) + +minetest.register_chatcommand("/luatransform", { + params = "", + description = "Executes as a Lua chunk in the global namespace with the variable pos available, for each node in the current WorldEdit region", + privs = {worldedit=true, server=true}, + func = safe_region(function(name, param) + local err = worldedit.luatransform(worldedit.pos1[name], worldedit.pos2[name], param) + if err then + worldedit.player_notify(name, "code error: " .. err, false) + minetest.log("action", name.." tried to execute luatransform "..param) + else + worldedit.player_notify(name, "code successfully executed", false) + minetest.log("action", name.." executed luatransform "..param) + end + end), +}) + +minetest.register_chatcommand("/mtschemcreate", { + params = "", + description = "Save the current WorldEdit region using the Minetest ".. + "Schematic format to \"(world folder)/schems/.mts\"", + privs = {worldedit=true}, + func = safe_region(function(name, param) + if param == nil then + worldedit.player_notify(name, "No filename specified") + return + end + if not check_filename(param) then + worldedit.player_notify(name, "Disallowed file name: " .. param) + return + end + + local path = minetest.get_worldpath() .. "/schems" + -- Create directory if it does not already exist + mkdir(path) + + local filename = path .. "/" .. param .. ".mts" + local ret = minetest.create_schematic(worldedit.pos1[name], + worldedit.pos2[name], worldedit.prob_list[name], + filename) + if ret == nil then + worldedit.player_notify(name, "Failed to create Minetest schematic", false) + else + worldedit.player_notify(name, "Saved Minetest schematic to " .. param, false) + end + worldedit.prob_list[name] = {} + end), +}) + +minetest.register_chatcommand("/mtschemplace", { + params = "", + description = "Load nodes from \"(world folder)/schems/.mts\" with position 1 of the current WorldEdit region as the origin", + privs = {worldedit=true}, + func = function(name, param) + if param == "" then + worldedit.player_notify(name, "no filename specified") + return + end + if not check_filename(param) then + worldedit.player_notify(name, "Disallowed file name: " .. param) + return + end + + local pos = get_position(name) + if pos == nil then return end + + local path = minetest.get_worldpath() .. "/schems/" .. param .. ".mts" + if minetest.place_schematic(pos, path) == nil then + worldedit.player_notify(name, "failed to place Minetest schematic", false) + else + worldedit.player_notify(name, "placed Minetest schematic " .. param .. + " at " .. minetest.pos_to_string(pos), false) + end + end, +}) + +minetest.register_chatcommand("/mtschemprob", { + params = "start/finish/get", + description = "Begins node probability entry for Minetest schematics, gets the nodes that have probabilities set, or ends node probability entry", + privs = {worldedit=true}, + func = function(name, param) + if param == "start" then --start probability setting + worldedit.set_pos[name] = "prob" + worldedit.prob_list[name] = {} + worldedit.player_notify(name, "select Minetest schematic probability values by punching nodes") + elseif param == "finish" then --finish probability setting + worldedit.set_pos[name] = nil + worldedit.player_notify(name, "finished Minetest schematic probability selection") + elseif param == "get" then --get all nodes that had probabilities set on them + local text = "" + local problist = worldedit.prob_list[name] + if problist == nil then + return + end + for k,v in pairs(problist) do + local prob = math.floor(((v.prob / 256) * 100) * 100 + 0.5) / 100 + text = text .. minetest.pos_to_string(v.pos) .. ": " .. prob .. "% | " + end + worldedit.player_notify(name, "currently set node probabilities:") + worldedit.player_notify(name, text) + else + worldedit.player_notify(name, "unknown subcommand: " .. param) + end + end, +}) + +minetest.register_on_player_receive_fields(function(player, formname, fields) + if formname == "prob_val_enter" and not (fields.text == "" or fields.text == nil) then + local name = player:get_player_name() + local prob_entry = {pos=worldedit.prob_pos[name], prob=tonumber(fields.text)} + local index = table.getn(worldedit.prob_list[name]) + 1 + worldedit.prob_list[name][index] = prob_entry + end +end) + +minetest.register_chatcommand("/clearobjects", { + params = "", + description = "Clears all objects within the WorldEdit region", + privs = {worldedit=true}, + func = safe_region(function(name, param) + local count = worldedit.clear_objects(worldedit.pos1[name], worldedit.pos2[name]) + worldedit.player_notify(name, count .. " objects cleared") + end), +}) diff --git a/mods/worldedit/worldedit_commands/mark.lua b/mods/worldedit/worldedit_commands/mark.lua new file mode 100644 index 0000000..bc46a7f --- /dev/null +++ b/mods/worldedit/worldedit_commands/mark.lua @@ -0,0 +1,181 @@ +worldedit.marker1 = {} +worldedit.marker2 = {} +worldedit.marker_region = {} + +--marks worldedit region position 1 +worldedit.mark_pos1 = function(name) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + + if pos1 ~= nil then + --make area stay loaded + local manip = minetest.get_voxel_manip() + manip:read_from_map(pos1, pos1) + end + if worldedit.marker1[name] ~= nil then --marker already exists + worldedit.marker1[name]:remove() --remove marker + worldedit.marker1[name] = nil + end + if pos1 ~= nil then + --add marker + worldedit.marker1[name] = minetest.add_entity(pos1, "worldedit:pos1") + if worldedit.marker1[name] ~= nil then + worldedit.marker1[name]:get_luaentity().player_name = name + end + end + worldedit.mark_region(name) +end + +--marks worldedit region position 2 +worldedit.mark_pos2 = function(name) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + + if pos2 ~= nil then + --make area stay loaded + local manip = minetest.get_voxel_manip() + manip:read_from_map(pos2, pos2) + end + if worldedit.marker2[name] ~= nil then --marker already exists + worldedit.marker2[name]:remove() --remove marker + worldedit.marker2[name] = nil + end + if pos2 ~= nil then + --add marker + worldedit.marker2[name] = minetest.add_entity(pos2, "worldedit:pos2") + if worldedit.marker2[name] ~= nil then + worldedit.marker2[name]:get_luaentity().player_name = name + end + end + worldedit.mark_region(name) +end + +worldedit.mark_region = function(name) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + + if worldedit.marker_region[name] ~= nil then --marker already exists + --wip: make the area stay loaded somehow + for _, entity in ipairs(worldedit.marker_region[name]) do + entity:remove() + end + worldedit.marker_region[name] = nil + end + + if pos1 ~= nil and pos2 ~= nil then + local pos1, pos2 = worldedit.sort_pos(pos1, pos2) + + local vec = vector.subtract(pos2, pos1) + local maxside = math.max(vec.x, math.max(vec.y, vec.z)) + local limit = tonumber(minetest.setting_get("active_object_send_range_blocks")) * 16 + if maxside > limit * 1.5 then + -- The client likely won't be able to see the plane markers as intended anyway, + -- thus don't place them and also don't load the area into memory + return + end + + local thickness = 0.2 + local sizex, sizey, sizez = (1 + pos2.x - pos1.x) / 2, (1 + pos2.y - pos1.y) / 2, (1 + pos2.z - pos1.z) / 2 + + --make area stay loaded + local manip = minetest.get_voxel_manip() + manip:read_from_map(pos1, pos2) + + local markers = {} + + --XY plane markers + for _, z in ipairs({pos1.z - 0.5, pos2.z + 0.5}) do + local marker = minetest.add_entity({x=pos1.x + sizex - 0.5, y=pos1.y + sizey - 0.5, z=z}, "worldedit:region_cube") + if marker ~= nil then + marker:set_properties({ + visual_size={x=sizex * 2, y=sizey * 2}, + collisionbox = {-sizex, -sizey, -thickness, sizex, sizey, thickness}, + }) + marker:get_luaentity().player_name = name + table.insert(markers, marker) + end + end + + --YZ plane markers + for _, x in ipairs({pos1.x - 0.5, pos2.x + 0.5}) do + local marker = minetest.add_entity({x=x, y=pos1.y + sizey - 0.5, z=pos1.z + sizez - 0.5}, "worldedit:region_cube") + if marker ~= nil then + marker:set_properties({ + visual_size={x=sizez * 2, y=sizey * 2}, + collisionbox = {-thickness, -sizey, -sizez, thickness, sizey, sizez}, + }) + marker:setyaw(math.pi / 2) + marker:get_luaentity().player_name = name + table.insert(markers, marker) + end + end + + worldedit.marker_region[name] = markers + end +end + +minetest.register_entity(":worldedit:pos1", { + initial_properties = { + visual = "cube", + visual_size = {x=1.1, y=1.1}, + textures = {"worldedit_pos1.png", "worldedit_pos1.png", + "worldedit_pos1.png", "worldedit_pos1.png", + "worldedit_pos1.png", "worldedit_pos1.png"}, + collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, + physical = false, + }, + on_step = function(self, dtime) + if worldedit.marker1[self.player_name] == nil then + self.object:remove() + end + end, + on_punch = function(self, hitter) + self.object:remove() + worldedit.marker1[self.player_name] = nil + end, +}) + +minetest.register_entity(":worldedit:pos2", { + initial_properties = { + visual = "cube", + visual_size = {x=1.1, y=1.1}, + textures = {"worldedit_pos2.png", "worldedit_pos2.png", + "worldedit_pos2.png", "worldedit_pos2.png", + "worldedit_pos2.png", "worldedit_pos2.png"}, + collisionbox = {-0.55, -0.55, -0.55, 0.55, 0.55, 0.55}, + physical = false, + }, + on_step = function(self, dtime) + if worldedit.marker2[self.player_name] == nil then + self.object:remove() + end + end, + on_punch = function(self, hitter) + self.object:remove() + worldedit.marker2[self.player_name] = nil + end, +}) + +minetest.register_entity(":worldedit:region_cube", { + initial_properties = { + visual = "upright_sprite", + visual_size = {x=1.1, y=1.1}, + textures = {"worldedit_cube.png"}, + visual_size = {x=10, y=10}, + physical = false, + }, + on_step = function(self, dtime) + if worldedit.marker_region[self.player_name] == nil then + self.object:remove() + return + end + end, + on_punch = function(self, hitter) + local markers = worldedit.marker_region[self.player_name] + if not markers then + return + end + for _, entity in ipairs(markers) do + entity:remove() + end + worldedit.marker_region[self.player_name] = nil + end, +}) + diff --git a/mods/worldedit/worldedit_commands/safe.lua b/mods/worldedit/worldedit_commands/safe.lua new file mode 100644 index 0000000..486f152 --- /dev/null +++ b/mods/worldedit/worldedit_commands/safe.lua @@ -0,0 +1,68 @@ +local safe_region_callback = {} +local safe_region_param = {} + +worldedit._override_safe_regions = false -- internal use ONLY! + +local function check_region(name, param) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] --obtain positions + if pos1 == nil or pos2 == nil then + worldedit.player_notify(name, "no region selected") + return nil + end + return worldedit.volume(pos1, pos2) +end + +--`callback` is a callback to run when the user confirms +--`nodes_needed` is a function accepting `param`, `pos1`, and `pos2` to calculate the number of nodes needed +local function safe_region(callback, nodes_needed) + --default node volume calculation + nodes_needed = nodes_needed or check_region + + return function(name, param) + --check if the operation applies to a safe number of nodes + local count = nodes_needed(name, param) + if count == nil then return end --invalid command + if worldedit._override_safe_regions or count < 10000 then + return callback(name, param) + end + + --save callback to call later + safe_region_callback[name], safe_region_param[name] = callback, param + worldedit.player_notify(name, "WARNING: this operation could affect up to " .. count .. " nodes; type //y to continue or //n to cancel") + end +end + +local function reset_pending(name) + safe_region_callback[name], safe_region_param[name] = nil, nil +end + +minetest.register_chatcommand("/y", { + params = "", + description = "Confirm a pending operation", + func = function(name) + local callback, param = safe_region_callback[name], safe_region_param[name] + if not callback then + worldedit.player_notify(name, "no operation pending") + return + end + + reset_pending(name) + callback(name, param) + end, +}) + +minetest.register_chatcommand("/n", { + params = "", + description = "Abort a pending operation", + func = function(name) + if not safe_region_callback[name] then + worldedit.player_notify(name, "no operation pending") + return + end + + reset_pending(name) + end, +}) + + +return safe_region, check_region, reset_pending diff --git a/mods/worldedit/worldedit_commands/textures/worldedit_cube.png b/mods/worldedit/worldedit_commands/textures/worldedit_cube.png new file mode 100644 index 0000000..fde36a8 Binary files /dev/null and b/mods/worldedit/worldedit_commands/textures/worldedit_cube.png differ diff --git a/mods/worldedit/worldedit_commands/textures/worldedit_pos1.png b/mods/worldedit/worldedit_commands/textures/worldedit_pos1.png new file mode 100644 index 0000000..4c304aa Binary files /dev/null and b/mods/worldedit/worldedit_commands/textures/worldedit_pos1.png differ diff --git a/mods/worldedit/worldedit_commands/textures/worldedit_pos2.png b/mods/worldedit/worldedit_commands/textures/worldedit_pos2.png new file mode 100644 index 0000000..1502f16 Binary files /dev/null and b/mods/worldedit/worldedit_commands/textures/worldedit_pos2.png differ diff --git a/mods/worldedit/worldedit_commands/wand.lua b/mods/worldedit/worldedit_commands/wand.lua new file mode 100644 index 0000000..0780801 --- /dev/null +++ b/mods/worldedit/worldedit_commands/wand.lua @@ -0,0 +1,24 @@ +minetest.register_tool(":worldedit:wand", { + description = "WorldEdit Wand tool, Left-click to set 1st position, right-click to set 2nd", + inventory_image = "worldedit_wand.png", + stack_max = 1, -- there is no need to have more than one + liquids_pointable = true, -- ground with only water on can be selected as well + + on_use = function(itemstack, placer, pointed_thing) + if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then + local name = placer:get_player_name() + worldedit.pos1[name] = pointed_thing.under + worldedit.mark_pos1(name) + end + return itemstack -- nothing consumed, nothing changed + end, + + on_place = function(itemstack, placer, pointed_thing) -- Left Click + if placer ~= nil and pointed_thing ~= nil and pointed_thing.type == "node" then + local name = placer:get_player_name() + worldedit.pos2[name] = pointed_thing.under + worldedit.mark_pos2(name) + end + return itemstack -- nothing consumed, nothing changed + end, +}) diff --git a/mods/worldedit/worldedit_gui/depends.txt b/mods/worldedit/worldedit_gui/depends.txt new file mode 100644 index 0000000..dbc8f19 --- /dev/null +++ b/mods/worldedit/worldedit_gui/depends.txt @@ -0,0 +1,7 @@ +worldedit +worldedit_commands +unified_inventory? +inventory_plus? +sfinv? +creative? +smart_inventory? diff --git a/mods/worldedit/worldedit_gui/functionality.lua b/mods/worldedit/worldedit_gui/functionality.lua new file mode 100644 index 0000000..c25b790 --- /dev/null +++ b/mods/worldedit/worldedit_gui/functionality.lua @@ -0,0 +1,790 @@ +--saved state for each player +local gui_nodename1 = {} --mapping of player names to node names +local gui_nodename2 = {} --mapping of player names to node names +local gui_axis1 = {} --mapping of player names to axes (one of 1, 2, 3, or 4, representing the axes in the `axis_indices` table below) +local gui_axis2 = {} --mapping of player names to axes (one of 1, 2, 3, or 4, representing the axes in the `axis_indices` table below) +local gui_distance1 = {} --mapping of player names to a distance (arbitrary strings may also appear as values) +local gui_distance2 = {} --mapping of player names to a distance (arbitrary strings may also appear as values) +local gui_distance3 = {} --mapping of player names to a distance (arbitrary strings may also appear as values) +local gui_count1 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values) +local gui_count2 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values) +local gui_count3 = {} --mapping of player names to a quantity (arbitrary strings may also appear as values) +local gui_angle = {} --mapping of player names to an angle (one of 90, 180, 270, representing the angle in degrees clockwise) +local gui_filename = {} --mapping of player names to file names + +--set default values +setmetatable(gui_nodename1, {__index = function() return "Cobblestone" end}) +setmetatable(gui_nodename2, {__index = function() return "Stone" end}) +setmetatable(gui_axis1, {__index = function() return 4 end}) +setmetatable(gui_axis2, {__index = function() return 1 end}) +setmetatable(gui_distance1, {__index = function() return "10" end}) +setmetatable(gui_distance2, {__index = function() return "5" end}) +setmetatable(gui_distance3, {__index = function() return "2" end}) +setmetatable(gui_count1, {__index = function() return "3" end}) +setmetatable(gui_count2, {__index = function() return "6" end}) +setmetatable(gui_count3, {__index = function() return "4" end}) +setmetatable(gui_angle, {__index = function() return 90 end}) +setmetatable(gui_filename, {__index = function() return "building" end}) + +local axis_indices = {["X axis"]=1, ["Y axis"]=2, ["Z axis"]=3, ["Look direction"]=4} +local axis_values = {"x", "y", "z", "?"} +setmetatable(axis_indices, {__index = function () return 4 end}) +setmetatable(axis_values, {__index = function () return "?" end}) + +local angle_indices = {["90 degrees"]=1, ["180 degrees"]=2, ["270 degrees"]=3} +local angle_values = {90, 180, 270} +setmetatable(angle_indices, {__index = function () return 1 end}) +setmetatable(angle_values, {__index = function () return 90 end}) + +-- given multiple sets of privileges, produces a single set of privs that would have the same effect as requiring all of them at the same time +local combine_privs = function(...) + local result = {} + for i, privs in ipairs({...}) do + for name, value in pairs(privs) do + if result[name] ~= nil and result[name] ~= value then --the priv must be both true and false, which can never happen + return {__fake_priv_that_nobody_has__=true} --privilege table that can never be satisfied + end + result[name] = value + end + end + return result +end + +-- display node (or unknown_node image otherwise) at specified pos in formspec +local formspec_node = function(pos, nodename) + return nodename and string.format("item_image[%s;1,1;%s]", pos, nodename) + or string.format("image[%s;1,1;worldedit_gui_unknown.png]", pos) +end + +-- two further priv helpers +local function we_privs(command) + return minetest.chatcommands["/" .. command].privs +end + +local function combine_we_privs(list) + local args = {} + for _, t in ipairs(list) do + table.insert(args, we_privs(t)) + end + return combine_privs(unpack(args)) +end + +worldedit.register_gui_function("worldedit_gui_about", { + name = "About", + privs = {interact=true}, + on_select = function(name) + minetest.chatcommands["/about"].func(name, "") + end, +}) + +worldedit.register_gui_function("worldedit_gui_inspect", { + name = "Toggle Inspect", + privs = we_privs("inspect"), + on_select = function(name) + minetest.chatcommands["/inspect"].func(name, worldedit.inspect[name] and "disable" or "enable") + end, +}) + +worldedit.register_gui_function("worldedit_gui_region", { + name = "Get/Set Region", + privs = combine_we_privs({"p", "pos1", "pos2", "reset", "mark", "unmark", "volume", "fixedpos"}), + get_formspec = function(name) + local pos1, pos2 = worldedit.pos1[name], worldedit.pos2[name] + return "size[9,7]" .. worldedit.get_formspec_header("worldedit_gui_region") .. + "button_exit[0,1;3,0.8;worldedit_gui_p_get;Get Positions]" .. + "button_exit[3,1;3,0.8;worldedit_gui_p_set1;Choose Position 1]" .. + "button_exit[6,1;3,0.8;worldedit_gui_p_set2;Choose Position 2]" .. + "button_exit[0,2;3,0.8;worldedit_gui_pos1;Position 1 Here]" .. + "button_exit[3,2;3,0.8;worldedit_gui_pos2;Position 2 Here]" .. + "button_exit[6,2;3,0.8;worldedit_gui_reset;Reset Region]" .. + "button_exit[0,3;3,0.8;worldedit_gui_mark;Mark Region]" .. + "button_exit[3,3;3,0.8;worldedit_gui_unmark;Unmark Region]" .. + "button_exit[6,3;3,0.8;worldedit_gui_volume;Region Volume]" .. + "label[0,4.7;Position 1]" .. + string.format("field[2,5;1.5,0.8;worldedit_gui_fixedpos_pos1x;X ;%s]", pos1 and pos1.x or "") .. + string.format("field[3.5,5;1.5,0.8;worldedit_gui_fixedpos_pos1y;Y ;%s]", pos1 and pos1.y or "") .. + string.format("field[5,5;1.5,0.8;worldedit_gui_fixedpos_pos1z;Z ;%s]", pos1 and pos1.z or "") .. + "button_exit[6.5,4.68;2.5,0.8;worldedit_gui_fixedpos_pos1_submit;Set Position 1]" .. + "label[0,6.2;Position 2]" .. + string.format("field[2,6.5;1.5,0.8;worldedit_gui_fixedpos_pos2x;X ;%s]", pos2 and pos2.x or "") .. + string.format("field[3.5,6.5;1.5,0.8;worldedit_gui_fixedpos_pos2y;Y ;%s]", pos2 and pos2.y or "") .. + string.format("field[5,6.5;1.5,0.8;worldedit_gui_fixedpos_pos2z;Z ;%s]", pos2 and pos2.z or "") .. + "button_exit[6.5,6.18;2.5,0.8;worldedit_gui_fixedpos_pos2_submit;Set Position 2]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_region", function(name, fields) + if fields.worldedit_gui_p_get then + minetest.chatcommands["/p"].func(name, "get") + return true + elseif fields.worldedit_gui_p_set1 then + minetest.chatcommands["/p"].func(name, "set1") + return true + elseif fields.worldedit_gui_p_set2 then + minetest.chatcommands["/p"].func(name, "set2") + return true + elseif fields.worldedit_gui_pos1 then + minetest.chatcommands["/pos1"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_pos2 then + minetest.chatcommands["/pos2"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_reset then + minetest.chatcommands["/reset"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_mark then + minetest.chatcommands["/mark"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_unmark then + minetest.chatcommands["/unmark"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_volume then + minetest.chatcommands["/volume"].func(name, "") + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_fixedpos_pos1_submit then + minetest.chatcommands["/fixedpos"].func(name, string.format("set1 %s %s %s", + tostring(fields.worldedit_gui_fixedpos_pos1x), + tostring(fields.worldedit_gui_fixedpos_pos1y), + tostring(fields.worldedit_gui_fixedpos_pos1z))) + worldedit.show_page(name, "worldedit_gui_region") + return true + elseif fields.worldedit_gui_fixedpos_pos2_submit then + minetest.chatcommands["/fixedpos"].func(name, string.format("set2 %s %s %s", + tostring(fields.worldedit_gui_fixedpos_pos2x), + tostring(fields.worldedit_gui_fixedpos_pos2y), + tostring(fields.worldedit_gui_fixedpos_pos2z))) + worldedit.show_page(name, "worldedit_gui_region") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_set", { + name = "Set Nodes", + privs = we_privs("set"), + get_formspec = function(name) + local node = gui_nodename1[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_set") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_set_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_set_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_set_submit;Set Nodes]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_set", function(name, fields) + if fields.worldedit_gui_set_search or fields.worldedit_gui_set_submit then + gui_nodename1[name] = tostring(fields.worldedit_gui_set_node) + worldedit.show_page(name, "worldedit_gui_set") + if fields.worldedit_gui_set_submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/set"].func(name, n) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_replace", { + name = "Replace Nodes", + privs = combine_we_privs({"replace", "replaceinverse"}), + get_formspec = function(name) + local search, replace = gui_nodename1[name], gui_nodename2[name] + local search_nodename, replace_nodename = worldedit.normalize_nodename(search), worldedit.normalize_nodename(replace) + return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_replace") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_replace_search;Name;%s]", minetest.formspec_escape(search)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_replace_search_search;Search]" .. + formspec_node("5.5,1.1", search_nodename) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_replace_replace;Name;%s]", minetest.formspec_escape(replace)) .. + "button[4,2.18;1.5,0.8;worldedit_gui_replace_replace_search;Search]" .. + formspec_node("5.5,2.1", replace_nodename) .. + "button_exit[0,3.5;3,0.8;worldedit_gui_replace_submit;Replace Nodes]" .. + "button_exit[3.5,3.5;3,0.8;worldedit_gui_replace_submit_inverse;Replace Inverse]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_replace", function(name, fields) + if fields.worldedit_gui_replace_search_search or fields.worldedit_gui_replace_replace_search + or fields.worldedit_gui_replace_submit or fields.worldedit_gui_replace_submit_inverse then + gui_nodename1[name] = tostring(fields.worldedit_gui_replace_search) + gui_nodename2[name] = tostring(fields.worldedit_gui_replace_replace) + worldedit.show_page(name, "worldedit_gui_replace") + + local submit = nil + if fields.worldedit_gui_replace_submit then + submit = "replace" + elseif fields.worldedit_gui_replace_submit_inverse then + submit = "replaceinverse" + end + if submit then + local n1 = worldedit.normalize_nodename(gui_nodename1[name]) + local n2 = worldedit.normalize_nodename(gui_nodename2[name]) + if n1 and n2 then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s", n1, n2)) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_sphere_dome", { + name = "Sphere/Dome", + privs = combine_we_privs({"hollowsphere", "sphere", "hollowdome", "dome"}), + get_formspec = function(name) + local node, radius = gui_nodename1[name], gui_distance2[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,5]" .. worldedit.get_formspec_header("worldedit_gui_sphere_dome") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_sphere_dome_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_sphere_dome_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_sphere_dome_radius;Radius;%s]", minetest.formspec_escape(radius)) .. + "button_exit[0,3.5;3,0.8;worldedit_gui_sphere_dome_submit_hollow;Hollow Sphere]" .. + "button_exit[3.5,3.5;3,0.8;worldedit_gui_sphere_dome_submit_solid;Solid Sphere]" .. + "button_exit[0,4.5;3,0.8;worldedit_gui_sphere_dome_submit_hollow_dome;Hollow Dome]" .. + "button_exit[3.5,4.5;3,0.8;worldedit_gui_sphere_dome_submit_solid_dome;Solid Dome]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_sphere_dome", function(name, fields) + if fields.worldedit_gui_sphere_dome_search + or fields.worldedit_gui_sphere_dome_submit_hollow or fields.worldedit_gui_sphere_dome_submit_solid + or fields.worldedit_gui_sphere_dome_submit_hollow_dome or fields.worldedit_gui_sphere_dome_submit_solid_dome then + gui_nodename1[name] = tostring(fields.worldedit_gui_sphere_dome_node) + gui_distance2[name] = tostring(fields.worldedit_gui_sphere_dome_radius) + worldedit.show_page(name, "worldedit_gui_sphere_dome") + + local submit = nil + if fields.worldedit_gui_sphere_dome_submit_hollow then + submit = "hollowsphere" + elseif fields.worldedit_gui_sphere_dome_submit_solid then + submit = "sphere" + elseif fields.worldedit_gui_sphere_dome_submit_hollow_dome then + submit = "hollowdome" + elseif fields.worldedit_gui_sphere_dome_submit_solid_dome then + submit = "dome" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s", gui_distance2[name], n)) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_cylinder", { + name = "Cylinder", + privs = combine_we_privs({"hollowcylinder", "cylinder"}), + get_formspec = function(name) + local node, axis, length = gui_nodename1[name], gui_axis1[name], gui_distance1[name] + local radius1, radius2 = gui_distance2[name], gui_distance3[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_cylinder") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_cylinder_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_cylinder_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_cylinder_length;Length;%s]", minetest.formspec_escape(length)) .. + string.format("dropdown[4,2.18;2.5;worldedit_gui_cylinder_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + string.format("field[0.5,3.5;2,0.8;worldedit_gui_cylinder_radius1;Base Radius;%s]", minetest.formspec_escape(radius1)) .. + string.format("field[2.5,3.5;2,0.8;worldedit_gui_cylinder_radius2;Top Radius;%s]", minetest.formspec_escape(radius2)) .. + "label[0.25,4;Equal base and top radius creates a cylinder,\n".. + "zero top radius creates a cone.\nConsult documentation for more information.]".. + "button_exit[0,5.5;3,0.8;worldedit_gui_cylinder_submit_hollow;Hollow Cylinder]" .. + "button_exit[3.5,5.5;3,0.8;worldedit_gui_cylinder_submit_solid;Solid Cylinder]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_cylinder", function(name, fields) + if fields.worldedit_gui_cylinder_search + or fields.worldedit_gui_cylinder_submit_hollow or fields.worldedit_gui_cylinder_submit_solid then + gui_nodename1[name] = tostring(fields.worldedit_gui_cylinder_node) + gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis] + gui_distance1[name] = tostring(fields.worldedit_gui_cylinder_length) + gui_distance2[name] = tostring(fields.worldedit_gui_cylinder_radius1) + gui_distance3[name] = tostring(fields.worldedit_gui_cylinder_radius2) + worldedit.show_page(name, "worldedit_gui_cylinder") + + local submit = nil + if fields.worldedit_gui_cylinder_submit_hollow then + submit = "hollowcylinder" + elseif fields.worldedit_gui_cylinder_submit_solid then + submit = "cylinder" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + local args = string.format("%s %s %s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], gui_distance2[name], gui_distance3[name], n) + minetest.chatcommands["/"..submit].func(name, args) + end + end + return true + end + if fields.worldedit_gui_cylinder_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_cylinder_axis] + worldedit.show_page(name, "worldedit_gui_cylinder") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_pyramid", { + name = "Pyramid", + privs = we_privs("pyramid"), + get_formspec = function(name) + local node, axis, length = gui_nodename1[name], gui_axis1[name], gui_distance1[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_pyramid") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_pyramid_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_pyramid_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_pyramid_length;Length;%s]", minetest.formspec_escape(length)) .. + string.format("dropdown[4,2.18;2.5;worldedit_gui_pyramid_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + "button_exit[0,3.5;3,0.8;worldedit_gui_pyramid_submit_hollow;Hollow Pyramid]" .. + "button_exit[3.5,3.5;3,0.8;worldedit_gui_pyramid_submit_solid;Solid Pyramid]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_pyramid", function(name, fields) + if fields.worldedit_gui_pyramid_search or fields.worldedit_gui_pyramid_submit_solid or fields.worldedit_gui_pyramid_submit_hollow or fields.worldedit_gui_pyramid_axis then + gui_nodename1[name] = tostring(fields.worldedit_gui_pyramid_node) + gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis] + gui_distance1[name] = tostring(fields.worldedit_gui_pyramid_length) + worldedit.show_page(name, "worldedit_gui_pyramid") + + local submit = nil + if fields.worldedit_gui_pyramid_submit_solid then + submit = "pyramid" + elseif fields.worldedit_gui_pyramid_submit_hollow then + submit = "hollowpyramid" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/"..submit].func(name, string.format("%s %s %s", axis_values[gui_axis1[name]], gui_distance1[name], n)) + end + end + return true + end + if fields.worldedit_gui_pyramid_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_pyramid_axis] + worldedit.show_page(name, "worldedit_gui_pyramid") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_spiral", { + name = "Spiral", + privs = we_privs("spiral"), + get_formspec = function(name) + local node, length, height, space = gui_nodename1[name], gui_distance1[name], gui_distance2[name], gui_distance3[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,6]" .. worldedit.get_formspec_header("worldedit_gui_spiral") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_spiral_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_spiral_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_spiral_length;Side Length;%s]", minetest.formspec_escape(length)) .. + string.format("field[0.5,3.5;4,0.8;worldedit_gui_spiral_height;Height;%s]", minetest.formspec_escape(height)) .. + string.format("field[0.5,4.5;4,0.8;worldedit_gui_spiral_space;Wall Spacing;%s]", minetest.formspec_escape(space)) .. + "button_exit[0,5.5;3,0.8;worldedit_gui_spiral_submit;Spiral]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_spiral", function(name, fields) + if fields.worldedit_gui_spiral_search or fields.worldedit_gui_spiral_submit then + gui_nodename1[name] = fields.worldedit_gui_spiral_node + gui_distance1[name] = tostring(fields.worldedit_gui_spiral_length) + gui_distance2[name] = tostring(fields.worldedit_gui_spiral_height) + gui_distance3[name] = tostring(fields.worldedit_gui_spiral_space) + worldedit.show_page(name, "worldedit_gui_spiral") + if fields.worldedit_gui_spiral_submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/spiral"].func(name, string.format("%s %s %s %s", gui_distance1[name], gui_distance2[name], gui_distance3[name], n)) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_copy_move", { + name = "Copy/Move", + privs = combine_we_privs({"copy", "move"}), + get_formspec = function(name) + local axis = gui_axis1[name] or 4 + local amount = gui_distance1[name] or "10" + return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_copy_move") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_copy_move_amount;Amount;%s]", minetest.formspec_escape(amount)) .. + string.format("dropdown[4,1.18;2.5;worldedit_gui_copy_move_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_copy_move_copy;Copy Region]" .. + "button_exit[3.5,2.5;3,0.8;worldedit_gui_copy_move_move;Move Region]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_copy_move", function(name, fields) + if fields.worldedit_gui_copy_move_copy or fields.worldedit_gui_copy_move_move then + gui_axis1[name] = axis_indices[fields.worldedit_gui_copy_move_axis] or 4 + gui_distance1[name] = tostring(fields.worldedit_gui_copy_move_amount) + worldedit.show_page(name, "worldedit_gui_copy_move") + if fields.worldedit_gui_copy_move_copy then + minetest.chatcommands["/copy"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_distance1[name])) + else --fields.worldedit_gui_copy_move_move + minetest.chatcommands["/move"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_distance1[name])) + end + return true + end + if fields.worldedit_gui_copy_move_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_copy_move_axis] or 4 + worldedit.show_page(name, "worldedit_gui_copy_move") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_stack", { + name = "Stack", + privs = we_privs("stack"), + get_formspec = function(name) + local axis, count = gui_axis1[name], gui_count1[name] + return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_stack") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_stack_count;Count;%s]", minetest.formspec_escape(count)) .. + string.format("dropdown[4,1.18;2.5;worldedit_gui_stack_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_stack_submit;Stack]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_stack", function(name, fields) + if fields.worldedit_gui_stack_submit then + gui_axis1[name] = axis_indices[fields.worldedit_gui_stack_axis] + gui_count1[name] = tostring(fields.worldedit_gui_stack_count) + worldedit.show_page(name, "worldedit_gui_stack") + minetest.chatcommands["/stack"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], gui_count1[name])) + return true + end + if fields.worldedit_gui_stack_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_stack_axis] + worldedit.show_page(name, "worldedit_gui_stack") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_stretch", { + name = "Stretch", + privs = we_privs("stretch"), + get_formspec = function(name) + local stretchx, stretchy, stretchz = gui_count1[name], gui_count2[name], gui_count3[name] + return "size[5,5]" .. worldedit.get_formspec_header("worldedit_gui_stretch") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_stretch_x;Stretch X;%s]", minetest.formspec_escape(stretchx)) .. + string.format("field[0.5,2.5;4,0.8;worldedit_gui_stretch_y;Stretch Y;%s]", minetest.formspec_escape(stretchy)) .. + string.format("field[0.5,3.5;4,0.8;worldedit_gui_stretch_z;Stretch Z;%s]", minetest.formspec_escape(stretchz)) .. + "button_exit[0,4.5;3,0.8;worldedit_gui_stretch_submit;Stretch]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_stretch", function(name, fields) + if fields.worldedit_gui_stretch_submit then + gui_count1[name] = tostring(fields.worldedit_gui_stretch_x) + gui_count2[name] = tostring(fields.worldedit_gui_stretch_y) + gui_count3[name] = tostring(fields.worldedit_gui_stretch_z) + worldedit.show_page(name, "worldedit_gui_stretch") + minetest.chatcommands["/stretch"].func(name, string.format("%s %s %s", gui_count1[name], gui_count2[name], gui_count3[name])) + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_transpose", { + name = "Transpose", + privs = we_privs("transpose"), + get_formspec = function(name) + local axis1, axis2 = gui_axis1[name], gui_axis2[name] + return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_transpose") .. + string.format("dropdown[0,1;2.5;worldedit_gui_transpose_axis1;X axis,Y axis,Z axis,Look direction;%d]", axis1) .. + string.format("dropdown[3,1;2.5;worldedit_gui_transpose_axis2;X axis,Y axis,Z axis,Look direction;%d]", axis2) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_transpose_submit;Transpose]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_transpose", function(name, fields) + if fields.worldedit_gui_transpose_submit then + gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1] + worldedit.show_page(name, "worldedit_gui_transpose") + minetest.chatcommands["/transpose"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], axis_values[gui_axis2[name]])) + return true + end + if fields.worldedit_gui_transpose_axis1 then + gui_axis1[name] = axis_indices[fields.worldedit_gui_transpose_axis1] + worldedit.show_page(name, "worldedit_gui_transpose") + return true + end + if fields.worldedit_gui_transpose_axis2 then + gui_axis2[name] = axis_indices[fields.worldedit_gui_transpose_axis2] + worldedit.show_page(name, "worldedit_gui_transpose") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_flip", { + name = "Flip", + privs = we_privs("flip"), + get_formspec = function(name) + local axis = gui_axis1[name] + return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_flip") .. + string.format("dropdown[0,1;2.5;worldedit_gui_flip_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_flip_submit;Flip]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_flip", function(name, fields) + if fields.worldedit_gui_flip_submit then + gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis] + worldedit.show_page(name, "worldedit_gui_flip") + minetest.chatcommands["/flip"].func(name, axis_values[gui_axis1[name]]) + return true + end + if fields.worldedit_gui_flip_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_flip_axis] + worldedit.show_page(name, "worldedit_gui_flip") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_rotate", { + name = "Rotate", + privs = we_privs("rotate"), + get_formspec = function(name) + local axis, angle = gui_axis1[name], gui_angle[name] + return "size[5.5,3]" .. worldedit.get_formspec_header("worldedit_gui_rotate") .. + string.format("dropdown[0,1;2.5;worldedit_gui_rotate_angle;90 degrees,180 degrees,270 degrees;%s]", angle) .. + string.format("dropdown[3,1;2.5;worldedit_gui_rotate_axis;X axis,Y axis,Z axis,Look direction;%d]", axis) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_rotate_submit;Rotate]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_rotate", function(name, fields) + if fields.worldedit_gui_rotate_submit then + gui_axis1[name] = axis_indices[fields.worldedit_gui_rotate_axis] + gui_angle[name] = angle_indices[fields.worldedit_gui_rotate_angle] + worldedit.show_page(name, "worldedit_gui_rotate") + minetest.chatcommands["/rotate"].func(name, string.format("%s %s", axis_values[gui_axis1[name]], angle_values[gui_angle[name]])) + return true + end + if fields.worldedit_gui_rotate_axis then + gui_axis1[name] = axis_indices[fields.worldedit_gui_rotate_axis] + worldedit.show_page(name, "worldedit_gui_rotate") + return true + end + if fields.worldedit_gui_rotate_angle then + gui_angle[name] = angle_indices[fields.worldedit_gui_rotate_angle] + worldedit.show_page(name, "worldedit_gui_rotate") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_orient", { + name = "Orient", + privs = we_privs("orient"), + get_formspec = function(name) + local angle = gui_angle[name] + return "size[5,3]" .. worldedit.get_formspec_header("worldedit_gui_orient") .. + string.format("dropdown[0,1;2.5;worldedit_gui_orient_angle;90 degrees,180 degrees,270 degrees;%s]", angle) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_orient_submit;Orient]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_orient", function(name, fields) + if fields.worldedit_gui_orient_submit then + gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle] + worldedit.show_page(name, "worldedit_gui_orient") + minetest.chatcommands["/orient"].func(name, tostring(angle_values[gui_angle[name]])) + return true + end + if fields.worldedit_gui_orient_angle then + gui_angle[name] = angle_indices[fields.worldedit_gui_orient_angle] + worldedit.show_page(name, "worldedit_gui_orient") + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_fixlight", { + name = "Fix Lighting", + privs = we_privs("fixlight"), + on_select = function(name) + minetest.chatcommands["/fixlight"].func(name, "") + end, +}) + +worldedit.register_gui_function("worldedit_gui_hide", { + name = "Hide Region", + privs = we_privs("hide"), + on_select = function(name) + minetest.chatcommands["/hide"].func(name, "") + end, +}) + +worldedit.register_gui_function("worldedit_gui_suppress", { + name = "Suppress Nodes", + privs = we_privs("suppress"), + get_formspec = function(name) + local node = gui_nodename1[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_suppress") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_suppress_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_suppress_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_suppress_submit;Suppress Nodes]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_suppress", function(name, fields) + if fields.worldedit_gui_suppress_search or fields.worldedit_gui_suppress_submit then + gui_nodename1[name] = tostring(fields.worldedit_gui_suppress_node) + worldedit.show_page(name, "worldedit_gui_suppress") + if fields.worldedit_gui_suppress_submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/suppress"].func(name, n) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_highlight", { + name = "Highlight Nodes", + privs = we_privs("highlight"), + get_formspec = function(name) + local node = gui_nodename1[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,3]" .. worldedit.get_formspec_header("worldedit_gui_highlight") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_highlight_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_highlight_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_highlight_submit;Highlight Nodes]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_highlight", function(name, fields) + if fields.worldedit_gui_highlight_search or fields.worldedit_gui_highlight_submit then + gui_nodename1[name] = tostring(fields.worldedit_gui_highlight_node) + worldedit.show_page(name, "worldedit_gui_highlight") + if fields.worldedit_gui_highlight_submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + minetest.chatcommands["/highlight"].func(name, n) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_restore", { + name = "Restore Region", + privs = we_privs("restore"), + on_select = function(name) + minetest.chatcommands["/restore"].func(name, "") + end, +}) + +worldedit.register_gui_function("worldedit_gui_save_load", { + name = "Save/Load", + privs = combine_we_privs({"save", "allocate", "load"}), + get_formspec = function(name) + local filename = gui_filename[name] + return "size[6,4]" .. worldedit.get_formspec_header("worldedit_gui_save_load") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_save_filename;Filename;%s]", minetest.formspec_escape(filename)) .. + "button_exit[0,2.5;3,0.8;worldedit_gui_save_load_submit_save;Save]" .. + "button_exit[3,2.5;3,0.8;worldedit_gui_save_load_submit_allocate;Allocate]" .. + "button_exit[0,3.5;3,0.8;worldedit_gui_save_load_submit_load;Load]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_save_load", function(name, fields) + if fields.worldedit_gui_save_load_submit_save or fields.worldedit_gui_save_load_submit_allocate or fields.worldedit_gui_save_load_submit_load then + gui_filename[name] = tostring(fields.worldedit_gui_save_filename) + worldedit.show_page(name, "worldedit_gui_save_load") + if fields.worldedit_gui_save_load_submit_save then + minetest.chatcommands["/save"].func(name, gui_filename[name]) + elseif fields.worldedit_gui_save_load_submit_allocate then + minetest.chatcommands["/allocate"].func(name, gui_filename[name]) + else --fields.worldedit_gui_save_load_submit_load + minetest.chatcommands["/load"].func(name, gui_filename[name]) + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_cube", { + name = "Cuboid", -- technically the command is misnamed, I know... + privs = combine_we_privs({"hollowcube", "cube"}), + get_formspec = function(name) + local width, height, length = gui_distance1[name], gui_distance2[name], gui_distance3[name] + local node = gui_nodename1[name] + local nodename = worldedit.normalize_nodename(node) + return "size[6.5,4]" .. worldedit.get_formspec_header("worldedit_gui_cube") .. + string.format("field[0.5,1.5;4,0.8;worldedit_gui_cube_node;Name;%s]", minetest.formspec_escape(node)) .. + "button[4,1.18;1.5,0.8;worldedit_gui_cube_search;Search]" .. + formspec_node("5.5,1.1", nodename) .. + string.format("field[0.5,2.5;1,0.8;worldedit_gui_cube_width;Width;%s]", minetest.formspec_escape(width)) .. + string.format("field[1.5,2.5;1,0.8;worldedit_gui_cube_height;Height;%s]", minetest.formspec_escape(height)) .. + string.format("field[2.5,2.5;1,0.8;worldedit_gui_cube_length;Length;%s]", minetest.formspec_escape(length)) .. + "button_exit[0,3.5;3,0.8;worldedit_gui_cube_submit_hollow;Hollow Cuboid]" .. + "button_exit[3.5,3.5;3,0.8;worldedit_gui_cube_submit_solid;Solid Cuboid]" + end, +}) + +worldedit.register_gui_handler("worldedit_gui_cube", function(name, fields) + if fields.worldedit_gui_cube_search + or fields.worldedit_gui_cube_submit_hollow or fields.worldedit_gui_cube_submit_solid then + gui_nodename1[name] = tostring(fields.worldedit_gui_cube_node) + gui_distance1[name] = tostring(fields.worldedit_gui_cube_width) + gui_distance2[name] = tostring(fields.worldedit_gui_cube_height) + gui_distance3[name] = tostring(fields.worldedit_gui_cube_length) + worldedit.show_page(name, "worldedit_gui_cube") + + local submit = nil + if fields.worldedit_gui_cube_submit_hollow then + submit = "hollowcube" + elseif fields.worldedit_gui_cube_submit_solid then + submit = "cube" + end + if submit then + local n = worldedit.normalize_nodename(gui_nodename1[name]) + if n then + local args = string.format("%s %s %s %s", gui_distance1[name], gui_distance2[name], gui_distance3[name], n) + minetest.chatcommands["/"..submit].func(name, args) + end + end + return true + end + return false +end) + +worldedit.register_gui_function("worldedit_gui_clearobjects", { + name = "Clear Objects", + privs = we_privs("clearobjects"), + on_select = function(name) + minetest.chatcommands["/clearobjects"].func(name, "") + end, +}) diff --git a/mods/worldedit/worldedit_gui/init.lua b/mods/worldedit/worldedit_gui/init.lua new file mode 100644 index 0000000..b88a82e --- /dev/null +++ b/mods/worldedit/worldedit_gui/init.lua @@ -0,0 +1,285 @@ +worldedit = worldedit or {} + +--[[ +Example: + + worldedit.register_gui_function("worldedit_gui_hollow_cylinder", { + name = "Make Hollow Cylinder", + privs = {worldedit=true}, + get_formspec = function(name) return "some formspec here" end, + on_select = function(name) print(name .. " clicked the button!") end, + }) + +Use `nil` for the `options` parameter to unregister the function associated with the given identifier. + +Use `nil` for the `get_formspec` field to denote that the function does not have its own screen. + +The `privs` field may not be `nil`. + +If the identifier is already registered to another function, it will be replaced by the new one. + +The `on_select` function must not call `worldedit.show_page` +]] + +worldedit.pages = {} --mapping of identifiers to options +local identifiers = {} --ordered list of identifiers +worldedit.register_gui_function = function(identifier, options) + if options.privs == nil or next(options.privs) == nil then + error("privs unset") + end + worldedit.pages[identifier] = options + table.insert(identifiers, identifier) +end + +--[[ +Example: + + worldedit.register_gui_handler("worldedit_gui_hollow_cylinder", function(name, fields) + print(minetest.serialize(fields)) + end) +]] + +worldedit.register_gui_handler = function(identifier, handler) + local enabled = true + minetest.register_on_player_receive_fields(function(player, formname, fields) + if not enabled then return false end + enabled = false + minetest.after(0.2, function() enabled = true end) + local name = player:get_player_name() + + --ensure the player has permission to perform the action + local entry = worldedit.pages[identifier] + if entry and minetest.check_player_privs(name, entry.privs) then + return handler(name, fields) + end + return false + end) +end + +worldedit.get_formspec_header = function(identifier) + local entry = worldedit.pages[identifier] or {} + return "button[0,0;2,0.5;worldedit_gui;Back]" .. + string.format("label[2,0;WorldEdit GUI > %s]", entry.name or "") +end + +local get_formspec = function(name, identifier) + if worldedit.pages[identifier] then + return worldedit.pages[identifier].get_formspec(name) + end + return worldedit.pages["worldedit_gui"].get_formspec(name) --default to showing main page if an unknown page is given +end + +--implement worldedit.show_page(name, page) in different ways depending on the available APIs +if rawget(_G, "unified_inventory") then --unified inventory installed + local old_func = worldedit.register_gui_function + worldedit.register_gui_function = function(identifier, options) + old_func(identifier, options) + unified_inventory.register_page(identifier, {get_formspec=function(player) return {formspec=options.get_formspec(player:get_player_name())} end}) + end + + unified_inventory.register_button("worldedit_gui", { + type = "image", + image = "inventory_plus_worldedit_gui.png", + }) + + minetest.register_on_player_receive_fields(function(player, formname, fields) + local name = player:get_player_name() + if fields.worldedit_gui then --main page + worldedit.show_page(name, "worldedit_gui") + return true + elseif fields.worldedit_gui_exit then --return to original page + local player = minetest.get_player_by_name(name) + if player then + unified_inventory.set_inventory_formspec(player, "craft") + end + return true + end + return false + end) + + worldedit.show_page = function(name, page) + local player = minetest.get_player_by_name(name) + if player then + player:set_inventory_formspec(get_formspec(name, page)) + end + end +elseif rawget(_G, "inventory_plus") then --inventory++ installed + minetest.register_on_joinplayer(function(player) + local can_worldedit = minetest.check_player_privs(player:get_player_name(), {worldedit=true}) + if can_worldedit then + inventory_plus.register_button(player, "worldedit_gui", "WorldEdit") + end + end) + + --show the form when the button is pressed and hide it when done + local gui_player_formspecs = {} + minetest.register_on_player_receive_fields(function(player, formname, fields) + local name = player:get_player_name() + if fields.worldedit_gui then --main page + gui_player_formspecs[name] = player:get_inventory_formspec() + worldedit.show_page(name, "worldedit_gui") + return true + elseif fields.worldedit_gui_exit then --return to original page + if gui_player_formspecs[name] then + inventory_plus.set_inventory_formspec(player, inventory_plus.get_formspec(player, "main")) + end + return true + end + return false + end) + + worldedit.show_page = function(name, page) + local player = minetest.get_player_by_name(name) + if player then + inventory_plus.set_inventory_formspec(player, get_formspec(name, page)) + end + end +elseif rawget(_G, "smart_inventory") then -- smart_inventory installed + -- redefinition: Update the code element on inventory page to show the we-page + function worldedit.show_page(name, page) + local state = smart_inventory.get_page_state("worldedit_gui", name) + if state then + state:get("code"):set_we_formspec(page) + state.location.rootState:show() -- update inventory page + end + end + + -- smart_inventory page callback. Contains just a "custom code" element + local function smart_worldedit_gui_callback(state) + local codebox = state:element("code", { name = "code", code = "" }) + function codebox:set_we_formspec(we_page) + local new_formspec = get_formspec(state.location.rootState.location.player, we_page) + new_formspec = new_formspec:gsub('button_exit','button') --no inventory closing + self.data.code = "container[1,1]".. new_formspec .. "container_end[]" + end + codebox:set_we_formspec("worldedit_gui") + + -- process input (the back button) + state:onInput(function(state, fields, player) + if fields.worldedit_gui then --main page + state:get("code"):set_we_formspec("worldedit_gui") + elseif fields.worldedit_gui_exit then --return to original page + state:get("code"):set_we_formspec("worldedit_gui") + state.location.parentState:get("crafting_button"):submit() -- switch to the crafting tab + end + end) + end + + -- all handler should return false to force inventory UI update + local orig_register_gui_handler = worldedit.register_gui_handler + worldedit.register_gui_handler = function(identifier, handler) + local wrapper = function(...) + handler(...) + return false + end + orig_register_gui_handler(identifier, wrapper) + end + + -- register the inventory button + smart_inventory.register_page({ + name = "worldedit_gui", + tooltip = "Edit your World!", + icon = "inventory_plus_worldedit_gui.png", + smartfs_callback = smart_worldedit_gui_callback, + sequence = 99 + }) +elseif rawget(_G, "sfinv") then --sfinv installed (part of minetest_game since 0.4.15) + assert(sfinv.enabled) + local orig_get = sfinv.pages["sfinv:crafting"].get + sfinv.override_page("sfinv:crafting", { + get = function(self, player, context) + local can_worldedit = minetest.check_player_privs(player, {worldedit=true}) + local fs = orig_get(self, player, context) + return fs .. (can_worldedit and "image_button[0,0;1,1;inventory_plus_worldedit_gui.png;worldedit_gui;]" or "") + end + }) + + --compatibility with pre-0.4.16 sfinv + local set_page = sfinv.set_page or function(player, name) + --assumptions: src pg has no leave callback, dst pg has no enter callback + local ctx = {page=name} + sfinv.contexts[player:get_player_name()] = ctx + sfinv.set_player_inventory_formspec(player, ctx) + end + + --show the form when the button is pressed and hide it when done + minetest.register_on_player_receive_fields(function(player, formname, fields) + if fields.worldedit_gui then --main page + worldedit.show_page(player:get_player_name(), "worldedit_gui") + return true + elseif fields.worldedit_gui_exit then --return to original page + set_page(player, "sfinv:crafting") + return true + end + return false + end) + + worldedit.show_page = function(name, page) + local player = minetest.get_player_by_name(name) + if player then + player:set_inventory_formspec(get_formspec(name, page)) + end + end +else + error( + "worldedit_gui requires a supported \"gui management\" mod to be installed\n".. + "To use the GUI you need to either\n".. + "* Use minetest_game (at least 0.4.15) or a subgame with compatible sfinv\n".. + "* Install Unified Inventory or Inventory++\n".. + "If you do not want to use worldedit_gui, disable it by editing world.mt or from the Main Menu" + ) +end + +worldedit.register_gui_function("worldedit_gui", { + name = "WorldEdit GUI", + privs = {interact=true}, + get_formspec = function(name) + --create a form with all the buttons arranged in a grid + local buttons, x, y, index = {}, 0, 1, 0 + local width, height = 3, 0.8 + local columns = 5 + for i, identifier in pairs(identifiers) do + if identifier ~= "worldedit_gui" then + local entry = worldedit.pages[identifier] + table.insert(buttons, string.format((entry.get_formspec and "button" or "button_exit") .. + "[%g,%g;%g,%g;%s;%s]", x, y, width, height, identifier, minetest.formspec_escape(entry.name))) + + index, x = index + 1, x + width + if index == columns then --row is full + x, y = 0, y + height + index = 0 + end + end + end + if index == 0 then --empty row + y = y - height + end + return string.format("size[%g,%g]", math.max(columns * width, 5), math.max(y + 0.5, 3)) .. + "button[0,0;2,0.5;worldedit_gui_exit;Back]" .. + "label[2,0;WorldEdit GUI]" .. + table.concat(buttons) + end, +}) + +worldedit.register_gui_handler("worldedit_gui", function(name, fields) + for identifier, entry in pairs(worldedit.pages) do --check for WorldEdit GUI main formspec button selection + if fields[identifier] and identifier ~= "worldedit_gui" then + --ensure player has permission to perform action + local has_privs, missing_privs = minetest.check_player_privs(name, entry.privs) + if not has_privs then + worldedit.player_notify(name, "you are not allowed to use this function (missing privileges: " .. table.concat(missing_privs, ", ") .. ")") + return false + end + if entry.on_select then + entry.on_select(name) + end + if entry.get_formspec then + worldedit.show_page(name, identifier) + end + return true + end + end + return false +end) + +dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/functionality.lua") diff --git a/mods/worldedit/worldedit_gui/textures/inventory_plus_worldedit_gui.png b/mods/worldedit/worldedit_gui/textures/inventory_plus_worldedit_gui.png new file mode 100644 index 0000000..ff9404b Binary files /dev/null and b/mods/worldedit/worldedit_gui/textures/inventory_plus_worldedit_gui.png differ diff --git a/mods/worldedit/worldedit_gui/textures/worldedit_gui_unknown.png b/mods/worldedit/worldedit_gui/textures/worldedit_gui_unknown.png new file mode 100644 index 0000000..f57436c Binary files /dev/null and b/mods/worldedit/worldedit_gui/textures/worldedit_gui_unknown.png differ diff --git a/mods/worldedit/worldedit_shortcommands/depends.txt b/mods/worldedit/worldedit_shortcommands/depends.txt new file mode 100644 index 0000000..a741c93 --- /dev/null +++ b/mods/worldedit/worldedit_shortcommands/depends.txt @@ -0,0 +1 @@ +worldedit_commands diff --git a/mods/worldedit/worldedit_shortcommands/init.lua b/mods/worldedit/worldedit_shortcommands/init.lua new file mode 100644 index 0000000..c8b0ab2 --- /dev/null +++ b/mods/worldedit/worldedit_shortcommands/init.lua @@ -0,0 +1,52 @@ +--provides shorter names for the commands in `worldedit_commands` + +--returns true if command could not be aliased, false otherwise +worldedit.alias_chatcommand = function(alias, original_command) + if not minetest.chatcommands[original_command] then + minetest.log("error", "worldedit_shortcommands: original command " .. original_command .. " does not exist") + return true + end + if minetest.chatcommands[alias] then + minetest.log("error", "worldedit_shortcommands: alias " .. alias .. " already exists") + return true + end + minetest.register_chatcommand(alias, minetest.chatcommands[original_command]) + return false +end + +worldedit.alias_chatcommand("/i", "/inspect") +worldedit.alias_chatcommand("/rst", "/reset") +worldedit.alias_chatcommand("/mk", "/mark") +worldedit.alias_chatcommand("/umk", "/unmark") +worldedit.alias_chatcommand("/1", "/pos1") +worldedit.alias_chatcommand("/2", "/pos2") +worldedit.alias_chatcommand("/fp", "/fixedpos") +worldedit.alias_chatcommand("/v", "/volume") +worldedit.alias_chatcommand("/s", "/set") +worldedit.alias_chatcommand("/r", "/replace") +worldedit.alias_chatcommand("/ri", "/replaceinverse") +worldedit.alias_chatcommand("/hcube", "/hollowcube") +worldedit.alias_chatcommand("/hspr", "/hollowsphere") +worldedit.alias_chatcommand("/spr", "/sphere") +worldedit.alias_chatcommand("/hdo", "/hollowdome") +worldedit.alias_chatcommand("/do", "/dome") +worldedit.alias_chatcommand("/hcyl", "/hollowcylinder") +worldedit.alias_chatcommand("/cyl", "/cylinder") +worldedit.alias_chatcommand("/hpyr", "/hollowpyramid") +worldedit.alias_chatcommand("/pyr", "/pyramid") +worldedit.alias_chatcommand("/spl", "/spiral") +worldedit.alias_chatcommand("/m", "/move") +worldedit.alias_chatcommand("/c", "/copy") +worldedit.alias_chatcommand("/stk", "/stack") +worldedit.alias_chatcommand("/sch", "/stretch") +worldedit.alias_chatcommand("/tps", "/transpose") +worldedit.alias_chatcommand("/fl", "/flip") +worldedit.alias_chatcommand("/rot", "/rotate") +worldedit.alias_chatcommand("/ort", "/orient") +worldedit.alias_chatcommand("/hi", "/hide") +worldedit.alias_chatcommand("/sup", "/suppress") +worldedit.alias_chatcommand("/hlt", "/highlight") +worldedit.alias_chatcommand("/rsr", "/restore") +worldedit.alias_chatcommand("/l", "/lua") +worldedit.alias_chatcommand("/lt", "/luatransform") +worldedit.alias_chatcommand("/clro", "/clearobjects") diff --git a/mods/xpanes/README.txt b/mods/xpanes/README.txt new file mode 100644 index 0000000..bcbc129 --- /dev/null +++ b/mods/xpanes/README.txt @@ -0,0 +1,21 @@ +Minetest Game mod: xpanes +========================= +See license.txt for license information. + +Authors of source code +---------------------- +Originally by xyz (MIT) +BlockMen (MIT) +sofar (MIT) +Various Minetest developers and contributors (MIT) + +Authors of media (textures) +--------------------------- +xyz (CC BY-SA 3.0): + All textures not mentioned below. + +Gambit (CC BY-SA 3.0): + xpanes_bar.png + +paramat (CC BY-SA 3.0): + xpanes_bar_top.png diff --git a/mods/xpanes/depends.txt b/mods/xpanes/depends.txt new file mode 100644 index 0000000..331d858 --- /dev/null +++ b/mods/xpanes/depends.txt @@ -0,0 +1 @@ +default \ No newline at end of file diff --git a/mods/xpanes/init.lua b/mods/xpanes/init.lua new file mode 100644 index 0000000..77278a5 --- /dev/null +++ b/mods/xpanes/init.lua @@ -0,0 +1,184 @@ + +local function is_pane(pos) + return minetest.get_item_group(minetest.get_node(pos).name, "pane") > 0 +end + +local function connects_dir(pos, name, dir) + local aside = vector.add(pos, minetest.facedir_to_dir(dir)) + if is_pane(aside) then + return true + end + + local connects_to = minetest.registered_nodes[name].connects_to + if not connects_to then + return false + end + local list = minetest.find_nodes_in_area(aside, aside, connects_to) + + if #list > 0 then + return true + end + + return false +end + +local function swap(pos, node, name, param2) + if node.name == name and node.param2 == param2 then + return + end + + minetest.set_node(pos, {name = name, param2 = param2}) +end + +local function update_pane(pos) + if not is_pane(pos) then + return + end + local node = minetest.get_node(pos) + local name = node.name + if name:sub(-5) == "_flat" then + name = name:sub(1, -6) + end + + local any = node.param2 + local c = {} + local count = 0 + for dir = 0, 3 do + c[dir] = connects_dir(pos, name, dir) + if c[dir] then + any = dir + count = count + 1 + end + end + + if count == 0 then + swap(pos, node, name .. "_flat", any) + elseif count == 1 then + swap(pos, node, name .. "_flat", (any + 1) % 4) + elseif count == 2 then + if (c[0] and c[2]) or (c[1] and c[3]) then + swap(pos, node, name .. "_flat", (any + 1) % 4) + else + swap(pos, node, name, 0) + end + else + swap(pos, node, name, 0) + end +end + +minetest.register_on_placenode(function(pos, node) + if minetest.get_item_group(node, "pane") then + update_pane(pos) + end + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +minetest.register_on_dignode(function(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end +end) + +xpanes = {} +function xpanes.register_pane(name, def) + for i = 1, 15 do + minetest.register_alias("xpanes:" .. name .. "_" .. i, "xpanes:" .. name .. "_flat") + end + + local flatgroups = table.copy(def.groups) + flatgroups.pane = 1 + minetest.register_node(":xpanes:" .. name .. "_flat", { + description = def.description, + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + inventory_image = def.inventory_image, + wield_image = def.wield_image, + paramtype2 = "facedir", + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = flatgroups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + selection_box = { + type = "fixed", + fixed = {{-1/2, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connect_sides = { "left", "right" }, + }) + + local groups = table.copy(def.groups) + groups.pane = 1 + groups.not_in_creative_inventory = 1 + minetest.register_node(":xpanes:" .. name, { + drawtype = "nodebox", + paramtype = "light", + is_ground_content = false, + sunlight_propagates = true, + description = def.description, + tiles = {def.textures[3], def.textures[3], def.textures[1]}, + groups = groups, + drop = "xpanes:" .. name .. "_flat", + sounds = def.sounds, + node_box = { + type = "connected", + fixed = {{-1/32, -1/2, -1/32, 1/32, 1/2, 1/32}}, + connect_front = {{-1/32, -1/2, -1/2, 1/32, 1/2, -1/32}}, + connect_left = {{-1/2, -1/2, -1/32, -1/32, 1/2, 1/32}}, + connect_back = {{-1/32, -1/2, 1/32, 1/32, 1/2, 1/2}}, + connect_right = {{1/32, -1/2, -1/32, 1/2, 1/2, 1/32}}, + }, + connects_to = {"group:pane", "group:stone", "group:glass", "group:wood", "group:tree"}, + }) + + minetest.register_craft({ + output = "xpanes:" .. name .. "_flat 16", + recipe = def.recipe + }) +end + +xpanes.register_pane("pane", { + description = "Glass Pane", + textures = {"default_glass.png","xpanes_pane_half.png","xpanes_white.png"}, + inventory_image = "default_glass.png", + wield_image = "default_glass.png", + sounds = default.node_sound_glass_defaults(), + groups = {snappy=2, cracky=3, oddly_breakable_by_hand=3}, + recipe = { + {"default:glass", "default:glass", "default:glass"}, + {"default:glass", "default:glass", "default:glass"} + } +}) + +xpanes.register_pane("bar", { + description = "Iron bar", + textures = {"xpanes_bar.png","xpanes_bar.png","xpanes_bar_top.png"}, + inventory_image = "xpanes_bar.png", + wield_image = "xpanes_bar.png", + groups = {cracky=2}, + sounds = default.node_sound_metal_defaults(), + recipe = { + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"}, + {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"} + } +}) + +minetest.register_lbm({ + name = "xpanes:gen2", + nodenames = {"group:pane"}, + action = function(pos, node) + update_pane(pos) + for i = 0, 3 do + local dir = minetest.facedir_to_dir(i) + update_pane(vector.add(pos, dir)) + end + end +}) diff --git a/mods/xpanes/license.txt b/mods/xpanes/license.txt new file mode 100644 index 0000000..dff7227 --- /dev/null +++ b/mods/xpanes/license.txt @@ -0,0 +1,64 @@ +License of source code +---------------------- + +The MIT License (MIT) +Copyright (C) 2014-2016 xyz +Copyright (C) 2014-2016 BlockMen +Copyright (C) 2016 Auke Kok +Copyright (C) 2014-2016 Various Minetest developers and contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy of this +software and associated documentation files (the "Software"), to deal in the Software +without restriction, including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or +substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. + +For more details: +https://opensource.org/licenses/MIT + + +Licenses of media (textures) +---------------------------- + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +Copyright (C) 2014-2016 xyz +Copyright (C) 2013-2016 Gambit +Copyright (C) 2016 paramat + +You are free to: +Share — copy and redistribute the material in any medium or format. +Adapt — remix, transform, and build upon the material for any purpose, even commercially. +The licensor cannot revoke these freedoms as long as you follow the license terms. + +Under the following terms: + +Attribution — You must give appropriate credit, provide a link to the license, and +indicate if changes were made. You may do so in any reasonable manner, but not in any way +that suggests the licensor endorses you or your use. + +ShareAlike — If you remix, transform, or build upon the material, you must distribute +your contributions under the same license as the original. + +No additional restrictions — You may not apply legal terms or technological measures that +legally restrict others from doing anything the license permits. + +Notices: + +You do not have to comply with the license for elements of the material in the public +domain or where your use is permitted by an applicable exception or limitation. +No warranties are given. The license may not give you all of the permissions necessary +for your intended use. For example, other rights such as publicity, privacy, or moral +rights may limit how you use the material. + +For more details: +http://creativecommons.org/licenses/by-sa/3.0/ diff --git a/mods/xpanes/textures/xpanes_bar.png b/mods/xpanes/textures/xpanes_bar.png new file mode 100644 index 0000000..3ea62a9 Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar.png differ diff --git a/mods/xpanes/textures/xpanes_bar_top.png b/mods/xpanes/textures/xpanes_bar_top.png new file mode 100644 index 0000000..887518a Binary files /dev/null and b/mods/xpanes/textures/xpanes_bar_top.png differ diff --git a/mods/xpanes/textures/xpanes_pane_half.png b/mods/xpanes/textures/xpanes_pane_half.png new file mode 100644 index 0000000..4e846df Binary files /dev/null and b/mods/xpanes/textures/xpanes_pane_half.png differ diff --git a/mods/xpanes/textures/xpanes_space.png b/mods/xpanes/textures/xpanes_space.png new file mode 100644 index 0000000..016cb35 Binary files /dev/null and b/mods/xpanes/textures/xpanes_space.png differ diff --git a/mods/xpanes/textures/xpanes_white.png b/mods/xpanes/textures/xpanes_white.png new file mode 100644 index 0000000..a2f4b63 Binary files /dev/null and b/mods/xpanes/textures/xpanes_white.png differ