Initial upload
parent
0d9d91d563
commit
ba9b84ce1f
|
@ -0,0 +1,49 @@
|
|||
All textures included in this mod were derived from textures licensed
|
||||
under CC BY-SA 3.0, and are therefore licenced under CC BY-SA 3.0
|
||||
themselves. Specifically:
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
renew-compost.png
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
This image uses pixel data from the following images:
|
||||
* default_acacia_leaves_simple.png by paramat (CC BY-SA 3.0)
|
||||
* default_aspen_leaves.png by BlockMen (CC BY-SA 3.0)
|
||||
* This image was derived from an image by Sofar (CC BY-SA 3.0)
|
||||
* default_dirt.png by Neuromancer (CC BY-SA 3.0)
|
||||
* default_jungleleaves.png by PilzAdam (CC BY-SA 3.0)
|
||||
* default_leaves.png by Cisoun (CC BY-SA 3.0)
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
renew-grinder_front.png
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
This texture was derived from the following images, with a very slight
|
||||
addition from Alex Yst <https://y.st./>:
|
||||
* default_steel_block.png by kilbith (CC BY-SA 3.0)
|
||||
* default_furnace_front.png by Neuromancer (CC BY-SA 3.0)
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
renew-grinder_side.png
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
This texture was derived from default_steel_block.png by kilbith
|
||||
(CC BY-SA 3.0), but also inspired by (but not including material from)
|
||||
default_furnace_side.png by Neuromancer (CC BY-SA 3.0).
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
renew-grinder_top.png
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
This texture was derived from default_steel_block.png by kilbith
|
||||
(CC BY-SA 3.0), but also inspired by (but not including material from)
|
||||
default_furnace_top.png by Neuromancer (CC BY-SA 3.0).
|
||||
|
||||
-----------------------------------------------------------------------
|
||||
renew-mineral_obsidian.png
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
This image splices the mineral shape of coal ore with the pattern and
|
||||
colours of obsidian. Images used:
|
||||
* default_mineral_coal.png by Perttu "celeron55" Ahola <celeron55@gmail.com> (CC BY-SA 3.0)
|
||||
* default_obsidian.png by jojoa1997 (CC BY-SA 3.0)
|
|
@ -0,0 +1,25 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:clay_lump 8",
|
||||
recipe = {"bucket:bucket_water", "default:dirt", "group:sand", "default:iron_lump", "default:iron_lump"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
},
|
||||
})
|
|
@ -0,0 +1,64 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
minetest.register_node("renew:compost", {
|
||||
description = "Compost",
|
||||
tiles = {"renew-compost.png"},
|
||||
groups = {crumbly=3, soil=1},
|
||||
sounds = default.node_sound_dirt_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "renew:compost",
|
||||
recipe = {
|
||||
{"group:leaves", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"},
|
||||
{"group:leaves", "group:leaves", "group:leaves"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Compost rotting",
|
||||
nodenames = {"renew:compost"},
|
||||
neighbors = {"group:spreading_dirt_type", "group:flora", "flowers:mushroom_brown", "flowers:mushroom_red"},
|
||||
interval = 60,
|
||||
chance = 60,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
-- If the node above is not air, a plant, or a decomposer (a mushroom),
|
||||
-- decomposition cannot occur.
|
||||
local node_above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
if node_above.name ~= "air"
|
||||
and node_above.name ~= "flowers:mushroom_brown"
|
||||
and node_above.name ~= "flowers:mushroom_red"
|
||||
and minetest.get_item_group(node_above.name, "flora") == 0 then
|
||||
return
|
||||
end
|
||||
-- Spreading dirt types will take over compost, converting it into
|
||||
-- their specific type of dirt.
|
||||
local spreader_pos = minetest.find_node_near(pos, 1, "group:spreading_dirt_type")
|
||||
if spreader_pos then
|
||||
local spreader = minetest.get_node(spreader_pos)
|
||||
minetest.set_node(pos, {name=spreader.name})
|
||||
return
|
||||
-- If a spreading dirt type isn't around, compost will simply decompose
|
||||
-- into regular dirt, but only if something is growing on it.
|
||||
elseif node_above.name ~= "air" then
|
||||
minetest.set_node(pos, {name="default:dirt"})
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,46 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Coral Propagation",
|
||||
nodenames = {"default:coral_brown", "default:coral_orange"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 60,
|
||||
chance = 10,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
local new_pos = {
|
||||
{x=pos.x,y=pos.y+1,z=pos.z},
|
||||
{x=pos.x+1,y=pos.y,z=pos.z},
|
||||
{x=pos.x,y=pos.y,z=pos.z+1},
|
||||
{x=pos.x-1,y=pos.y,z=pos.z},
|
||||
{x=pos.x,y=pos.y,z=pos.z-1},
|
||||
{x=pos.x,y=pos.y-1,z=pos.z},
|
||||
}
|
||||
new_pos = new_pos[math.random(6)]
|
||||
local old_node = minetest.get_node_or_nil(new_pos)
|
||||
if new_pos.y >= -8 and new_pos.y <= 0 and old_node
|
||||
and minetest.get_item_group(old_node.name, "water") > 0
|
||||
and not minetest.find_node_near(new_pos, 1, "air") then
|
||||
local new_node = {
|
||||
"default:coral_brown" ,
|
||||
"default:coral_orange",
|
||||
}
|
||||
minetest.set_node(new_pos, {name = new_node[math.random(2)]})
|
||||
end
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,3 @@
|
|||
default
|
||||
flowers
|
||||
minestats?
|
|
@ -0,0 +1,31 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
-- When stone is mined, it degrades into cobble. When cobble is mined,
|
||||
-- it occasionally degrades into gravel. When gravel is mined, it
|
||||
-- more-frequently degrades into flint.
|
||||
|
||||
minetest.override_item("default:cobble", {
|
||||
drop = {
|
||||
max_items = 1,
|
||||
items = {
|
||||
{items = {"default:gravel"}, rarity = 20},
|
||||
{items = {"default:cobble"}},
|
||||
},
|
||||
},
|
||||
|
||||
})
|
|
@ -0,0 +1,28 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Snow Freezing",
|
||||
nodenames = {"default:snowblock"},
|
||||
neighbors = {"group:water"},
|
||||
interval = 60,
|
||||
chance = 16,
|
||||
catch_up = true,
|
||||
action = function(pos)
|
||||
minetest.set_node(pos, {name = "default:ice"})
|
||||
end,
|
||||
})
|
|
@ -0,0 +1,29 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
dofile(minetest.get_modpath("renew").."/clay.lua")
|
||||
dofile(minetest.get_modpath("renew").."/compost.lua")
|
||||
dofile(minetest.get_modpath("renew").."/coral.lua")
|
||||
dofile(minetest.get_modpath("renew").."/gravel.lua")
|
||||
dofile(minetest.get_modpath("renew").."/ice.lua")
|
||||
dofile(minetest.get_modpath("renew").."/lava.lua")
|
||||
dofile(minetest.get_modpath("renew").."/lava_cooling.lua")
|
||||
dofile(minetest.get_modpath("renew").."/minestats.lua")
|
||||
dofile(minetest.get_modpath("renew").."/obsidian.lua")
|
||||
dofile(minetest.get_modpath("renew").."/sand.lua")
|
||||
dofile(minetest.get_modpath("renew").."/water.lua")
|
||||
dofile(minetest.get_modpath("renew").."/waterlily.lua")
|
|
@ -0,0 +1,25 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
-- Lava was just fine before obsidian came along; obsidian ruined lava
|
||||
-- by convincing the game developers that lava shouldn't self renew (as
|
||||
-- they wanted to keep obsidian finite). This mod simply restores the
|
||||
-- old renewal mechanic for lava.
|
||||
|
||||
minetest.override_item("default:lava_flowing", {
|
||||
liquid_renewable = true,
|
||||
})
|
|
@ -0,0 +1,179 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
if minetest.settings:get_bool("enable_lavacooling") ~= false then
|
||||
local lava_cooling_abm
|
||||
|
||||
for _, ABM in next, minetest.registered_abms do
|
||||
if ABM.mod_origin == "default" and ABM.label == "Lava cooling" then
|
||||
lava_cooling_abm = ABM
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_coal(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(8 * 8 * 8) <= 9 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= 64 then
|
||||
if math.random(8 * 8 * 8) <= 8 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= 0 then
|
||||
if math.random(24 * 24 * 24) <= 27 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_iron(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(9 * 9 * 9) <= 12 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= 0 then
|
||||
if math.random(7 * 7 * 7) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= -64 then
|
||||
if math.random(24 * 24 * 24) <= 27 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_copper(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(9 * 9 * 9) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -63 and y <= -16 then
|
||||
if math.random(12 * 12 * 12) <= 4 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= -64 then
|
||||
if math.random(9 * 9 * 9) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_tin(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(10 * 10 * 10) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -127 and y <= -32 then
|
||||
if math.random(13 * 13 * 13) <= 4 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= -128 then
|
||||
if math.random(10 * 10 * 10) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_gold(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(13 * 13 * 13) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -255 and y <= -64 then
|
||||
if math.random(15 * 15 * 15) <= 3 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= -256 then
|
||||
if math.random(13 * 13 * 13) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_mese(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(14 * 14 * 14) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -255 and y <= -64 then
|
||||
if math.random(18 * 18 * 18) <= 3 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -31000 and y <= -256 then
|
||||
if math.random(14 * 14 * 14) <= 5 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function spawn_diamond(y)
|
||||
if y >= 1025 and y <= 31000 then
|
||||
if math.random(15 * 15 * 15) <= 4 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -255 and y <= -128 then
|
||||
if math.random(17 * 17 * 17) <= 4 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
if y >= -3100 and y <= -256 then
|
||||
if math.random(15 * 15 * 15) <= 4 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function lava_cooling_abm.action(pos)
|
||||
if minetest.find_node_near(pos, 1, "group:water") or pos.y < -112 then
|
||||
if spawn_coal(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_coal"})
|
||||
elseif spawn_iron(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_iron"})
|
||||
elseif spawn_copper(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_copper"})
|
||||
elseif spawn_tin(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_tin"})
|
||||
elseif spawn_gold(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_gold"})
|
||||
elseif spawn_mese(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_mese"})
|
||||
elseif spawn_diamond(pos.y) then
|
||||
minetest.set_node(pos, {name = "default:stone_with_diamond"})
|
||||
elseif spawn_diamond(pos.y) then
|
||||
minetest.set_node(pos, {name = "renew:obsidian_shard"})
|
||||
else
|
||||
minetest.set_node(pos, {name = "default:stone"})
|
||||
end
|
||||
else
|
||||
minetest.set_node(pos, {name = "default:desert_stone"})
|
||||
end
|
||||
minetest.sound_play("default_cool_lava", {pos = pos, max_hear_distance = 16, gain = 0.25})
|
||||
end
|
||||
end
|
|
@ -0,0 +1,28 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
if minetest.get_modpath("minestats") then
|
||||
__minestats__.register_is_countable(function(node_name, drop, drop_opts)
|
||||
if node_name:sub(1, 6) == "renew:" then
|
||||
local start = drop:find(":") + 1
|
||||
return drop:sub(start) == node_name:sub(7)
|
||||
else
|
||||
return (drop == "default:coral_skeleton" and minetest.get_mapgen_params().mgname ~= "v6")
|
||||
or (node_name == "default:cobble" and drop == "default:gravel")
|
||||
end
|
||||
end)
|
||||
end
|
|
@ -0,0 +1,62 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
-- This file contains numbers from the ore-spawning code from Minetest
|
||||
-- Game's default mod. That code is copyright Perttu "celeron55" Ahola
|
||||
-- <celeron55@gmail.com>, and was likewise released under the GNU
|
||||
-- LGPLv2.1+.
|
||||
|
||||
minetest.register_node("renew:obsidian_shard", {
|
||||
-- description = "Obsidian Ore",
|
||||
tiles = {"default_stone.png^renew-mineral_obsidian.png"},
|
||||
groups = {cracky = 1},
|
||||
drop = "default:obsidian_shard",
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_ore({
|
||||
ore_type = "scatter",
|
||||
ore = "renew:obsidian_shard",
|
||||
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 = "renew:obsidian_shard",
|
||||
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 = "renew:obsidian_shard",
|
||||
wherein = "default:stone",
|
||||
clust_scarcity = 15 * 15 * 15,
|
||||
clust_num_ores = 4,
|
||||
clust_size = 3,
|
||||
y_min = -31000,
|
||||
y_max = -256,
|
||||
})
|
|
@ -0,0 +1,313 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
-- This file contains a modified version of the furnace code from
|
||||
-- Minetest Game's default mod. That code is copyright Perttu
|
||||
-- "celeron55" Ahola <celeron55@gmail.com>, and was likewise released
|
||||
-- under the GNU LGPLv2.1+.
|
||||
|
||||
local grinds = {}
|
||||
|
||||
__renew__ = {
|
||||
register_grind = function(definition)
|
||||
if definition.output and definition.recipe and definition.grindtime then
|
||||
grinds[definition.recipe] = {
|
||||
item = definition.output ,
|
||||
time = definition.grindtime,
|
||||
}
|
||||
end
|
||||
end,
|
||||
unregister_grind = function(input)
|
||||
grinds[input] = nil
|
||||
end,
|
||||
get_grind_result = function(input)
|
||||
return grinds[input]
|
||||
end,
|
||||
}
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:silver_sand",
|
||||
recipe = "default:cobble",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:silver_sand",
|
||||
recipe = "default:stone",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:desert_sand",
|
||||
recipe = "default:desert_cobble",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:desert_sand",
|
||||
recipe = "default:desert_stone",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:sand",
|
||||
recipe = "default:glass",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
__renew__.register_grind({
|
||||
output = "default:sand",
|
||||
recipe = "vessels:glass_fragments",
|
||||
grindtime = 3,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "default:sand 2",
|
||||
recipe = {"default:desert_sand", "default:silver_sand"},
|
||||
})
|
||||
|
||||
minetest.register_node("renew:grinder", {
|
||||
description = "Grinder",
|
||||
tiles = {
|
||||
"renew-grinder_top.png",
|
||||
"renew-grinder_top.png",
|
||||
"renew-grinder_side.png",
|
||||
"renew-grinder_side.png",
|
||||
"renew-grinder_side.png",
|
||||
"renew-grinder_front.png",
|
||||
},
|
||||
paramtype2 = "facedir",
|
||||
groups = {cracky=1, level=2},
|
||||
is_ground_content = false,
|
||||
sounds = default.node_sound_metal_defaults(),
|
||||
on_construct = function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec",
|
||||
"size[8,8.5]"..
|
||||
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[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)
|
||||
)
|
||||
meta:set_string("infotext", "Grinder inactive (Item: Empty; Fuel: Empty)")
|
||||
local inv = meta:get_inventory()
|
||||
inv:set_size('src', 1)
|
||||
inv:set_size('fuel', 1)
|
||||
inv:set_size('dst', 4)
|
||||
end,
|
||||
can_dig = function(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,
|
||||
on_blast = function(pos)
|
||||
local drops = {"renew:grinder"}
|
||||
default.get_inventory_drops(pos, "src", drops)
|
||||
default.get_inventory_drops(pos, "fuel", drops)
|
||||
default.get_inventory_drops(pos, "dst", drops)
|
||||
minetest.remove_node(pos)
|
||||
return drops
|
||||
end,
|
||||
allow_metadata_inventory_put = function(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
|
||||
return stack:get_count()
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == "src" then
|
||||
return stack:get_count()
|
||||
elseif listname == "dst" then
|
||||
return 0
|
||||
end
|
||||
end,
|
||||
allow_metadata_inventory_move = function()
|
||||
return 0
|
||||
end,
|
||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||
if minetest.is_protected(pos, player:get_player_name()) then
|
||||
return 0
|
||||
end
|
||||
return stack:get_count()
|
||||
end,
|
||||
on_metadata_inventory_put = function(pos)
|
||||
minetest.get_node_timer(pos):start(1)
|
||||
end,
|
||||
on_timer = function(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 srcitem, fuellist
|
||||
|
||||
local grindable, ground
|
||||
local fuel
|
||||
|
||||
local update = true
|
||||
while update do
|
||||
update = false
|
||||
|
||||
srcitem = inv:get_list("src")[1]
|
||||
fuellist = inv:get_list("fuel")
|
||||
|
||||
--
|
||||
-- Grinding
|
||||
--
|
||||
|
||||
-- Check if we have grindable content
|
||||
ground = __renew__.get_grind_result(srcitem:get_name())
|
||||
grindable = ground and ground.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 grindable item then check if it is ready yet
|
||||
if grindable then
|
||||
src_time = src_time + elapsed
|
||||
if src_time >= ground.time then
|
||||
-- Place result in dst list if possible
|
||||
if inv:room_for_item("dst", ground.item) then
|
||||
inv:add_item("dst", ground.item)
|
||||
srcitem:take_item()
|
||||
inv:set_stack("src", 1, srcitem)
|
||||
src_time = src_time - ground.time
|
||||
update = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
-- Grinder ran out of fuel
|
||||
if grindable 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 grindable 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 srcitem:is_empty() then
|
||||
src_time = 0
|
||||
end
|
||||
|
||||
--
|
||||
-- Update infotext
|
||||
--
|
||||
if grindable then
|
||||
item_percent = math.floor(src_time / ground.time * 100)
|
||||
if item_percent > 100 then
|
||||
item_state = "100% (output full)"
|
||||
else
|
||||
item_state = item_percent .. "%"
|
||||
end
|
||||
else
|
||||
if srcitem:is_empty() then
|
||||
item_state = "Empty"
|
||||
else
|
||||
item_state = "Not grindable"
|
||||
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 .. "%"
|
||||
-- make sure timer restarts automatically
|
||||
result = true
|
||||
else
|
||||
if not fuellist[1]:is_empty() then
|
||||
fuel_state = "0%"
|
||||
end
|
||||
-- stop timer on the inactive furnace
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
|
||||
local infotext = "Grinder " .. 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("infotext", infotext)
|
||||
|
||||
return result
|
||||
end,
|
||||
on_metadata_inventory_take = function(pos)
|
||||
-- This allows the infotext to properly reset if the last of an item is
|
||||
-- removed.
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "renew:grinder",
|
||||
recipe = {
|
||||
{"default:steelblock", "default:diamond", "default:steelblock"},
|
||||
{"default:steelblock", "default:diamond", "default:steelblock"},
|
||||
{"default:steelblock", "default:mese" , "default:steelblock"},
|
||||
},
|
||||
})
|
Binary file not shown.
After Width: | Height: | Size: 803 B |
Binary file not shown.
After Width: | Height: | Size: 690 B |
Binary file not shown.
After Width: | Height: | Size: 554 B |
Binary file not shown.
After Width: | Height: | Size: 652 B |
Binary file not shown.
After Width: | Height: | Size: 156 B |
|
@ -0,0 +1,51 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
if minetest.get_mapgen_params().mgname == "valleys" then
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bucket:bucket_river_water",
|
||||
recipe = {"bucket:bucket_water", "default:gravel", "default:desert_sand", "bucket:bucket_empty"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
{"default:gravel", "default:gravel"},
|
||||
{"default:desert_sand", "default:desert_sand"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bucket:bucket_river_water",
|
||||
recipe = {"bucket:bucket_water", "default:gravel", "default:sand", "bucket:bucket_empty"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
{"default:gravel", "default:gravel"},
|
||||
{"default:sand", "default:sand"},
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "bucket:bucket_river_water",
|
||||
recipe = {"bucket:bucket_water", "default:gravel", "default:silver_sand", "bucket:bucket_empty"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
{"default:gravel", "default:gravel"},
|
||||
{"default:silver_sand", "default:silver_sand"},
|
||||
},
|
||||
})
|
||||
end
|
|
@ -0,0 +1,77 @@
|
|||
-- Renew mod for Minetest
|
||||
-- Copyright © 2018 Alex Yst <https://y.st./>
|
||||
|
||||
-- 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 software 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.
|
||||
|
||||
-- You should have received a copy of the GNU Lesser General Public
|
||||
-- License along with this program. If not, see
|
||||
-- <https://www.gnu.org./licenses/>.
|
||||
|
||||
minetest.register_abm({
|
||||
label = "Water lily spread",
|
||||
nodenames = {"flowers:waterlily"},
|
||||
interval = 11,
|
||||
chance = 50,
|
||||
action = function(pos)
|
||||
-- Water lilies won't propagate in darkness.
|
||||
local light = minetest.get_node_light(pos)
|
||||
if not light or light < 13 then
|
||||
return
|
||||
end
|
||||
-- Water lilies need shallow water with soil under it to spread. Using
|
||||
-- groups instead of hard-coded node names allows for better
|
||||
-- integration with third-party mods.
|
||||
local should_be_water = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
local should_be_dirt = minetest.get_node({x=pos.x, y=pos.y-2, z=pos.z})
|
||||
if minetest.get_item_group(should_be_water.name, "water") == 0
|
||||
or minetest.registered_nodes[should_be_water.name].liquidtype ~= "source"
|
||||
or minetest.get_item_group(should_be_dirt.name, "soil") == 0 then
|
||||
return
|
||||
end
|
||||
|
||||
local pos0 = vector.subtract(pos, 4)
|
||||
local pos1 = vector.add(pos, 4)
|
||||
|
||||
local waters = minetest.find_nodes_in_area_under_air(
|
||||
pos0, pos1, "group:water")
|
||||
if #waters > 0 then
|
||||
local seedling = waters[math.random(#waters)]
|
||||
local seedling_above =
|
||||
{x = seedling.x, y = seedling.y + 1, z = seedling.z}
|
||||
local light = minetest.get_node_light(seedling_above)
|
||||
local should_be_dirt = minetest.get_node({x=seedling.x, y=seedling.y-1, z=seedling.z})
|
||||
local seedling_node = minetest.get_node(seedling)
|
||||
|
||||
local nearby_lilies = #minetest.find_nodes_in_area({
|
||||
x=seedling_above.x-1,
|
||||
y=seedling_above.y,
|
||||
z=seedling_above.z-1,
|
||||
}, {
|
||||
x=seedling_above.x+1,
|
||||
y=seedling_above.y,
|
||||
z=seedling_above.z+1,
|
||||
}, "flowers:waterlily")
|
||||
|
||||
-- The new location has the same requirements as the old location, but
|
||||
-- with the added requirement that a new water lily will not grow where
|
||||
-- it would be touching five other water lilies. Water lilies grow
|
||||
-- closer together than other flowers, but even they have their density
|
||||
-- limit.
|
||||
if not light or light < 13
|
||||
or minetest.registered_nodes[seedling_node.name].liquidtype ~= "source"
|
||||
or minetest.get_item_group(should_be_dirt.name, "soil") == 0
|
||||
or nearby_lilies > 4 then
|
||||
return
|
||||
end
|
||||
minetest.set_node(seedling_above, {name = "flowers:waterlily", param2=math.random(0, 3)})
|
||||
end
|
||||
end
|
||||
})
|
Loading…
Reference in New Issue