update some more mods

master
HybridDog 2014-05-28 21:44:53 +02:00
parent ad73a08806
commit 3202e62ac3
85 changed files with 1270 additions and 286 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 555 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 548 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 584 B

16
mods/conifers/README.txt Normal file
View File

@ -0,0 +1,16 @@
--------------------------------------------------------------------------------
--
-- CONIFERS MOD
-- For Minetest
-- Created by Cisoun (cysoun[at]gmail.com).
--
-- This mod adds some conifers randomly at a certain altitude.
-- There are two types of conifers: regular and narrow.
-- You can define the altitude at which they spawn and their structure and
-- choose if you want to keep normal trees above this altitude.
--
--------------------------------------------------------------------------------
TODO:
— add a TODO list

BIN
mods/conifers/rest/c1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
mods/conifers/rest/c2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -0,0 +1,510 @@
--------------------------------------------------------------------------------
--
-- CONIFERS MOD
-- For Minetest
-- Created by Cisoun (cysoun[at]gmail.com).
--
-- This mod adds some conifers randomly at a certain altitude.
-- There are two types of conifers: regular and narrow.
-- You can define the altitude at which they spawn and their structure and
-- choose if you want to keep normal trees above this altitude.
--
--------------------------------------------------------------------------------
-- Structure definitions.
local TRUNK_MINHEIGHT = 7
local TRUNK_MAXHEIGHT = 25
local LEAVES_MINHEIGHT = 2
local LEAVES_MAXHEIGHT = 6
local LEAVES_MAXRADIUS = 5
local LEAVES_NARROWRADIUS = 3 -- For narrow typed conifers.
local CONIFERS_DISTANCE = 4
local CONIFERS_ALTITUDE = 30
local REMOVE_TREES = false -- Remove trees above CONIFERS_ALTITUDE?
local SAPLING_CHANCE = 100 -- 1/x chances to grow a sapling.
local INTERVAL = 3600
-- End of structure definitions.
conifers = {}
--------------------------------------------------------------------------------
--
-- Definitions
--
--------------------------------------------------------------------------------
--
-- Node definitions
--
minetest.register_node("conifers:trunk", {
description = "Conifer trunk",
tile_images = {
"conifers_trunktop.png",
"conifers_trunktop.png",
"conifers_trunk.png",
},
--inventory_image = minetest.inventorycube(
--"conifers_trunktop.png",
--"conifers_trunk.png",
--"conifers_trunk.png"
--),
paramtype = "facedir_simple",
material = minetest.digprop_woodlike(1.0),
groups = {
tree = 1,
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 1,
flammable = 2
},
sounds = default.node_sound_wood_defaults()
})
local tex_reversed_trunk = "conifers_trunk.png^[transformR90"
minetest.register_node("conifers:trunk_reversed", {
description = "Conifer reversed trunk",
tile_images = {
tex_reversed_trunk,
tex_reversed_trunk,
"conifers_trunktop.png",
"conifers_trunktop.png",
tex_reversed_trunk,
},
--inventory_image = minetest.inventorycube(
--"conifers_trunk.png",
--"conifers_trunktop.png",
--"conifers_trunk.png"
--),
paramtype = "facedir_simple",
material = minetest.digprop_woodlike(1.0),
legacy_facedir_simple = true,
groups = {
tree = 1,
snappy = 2,
choppy = 2,
oddly_breakable_by_hand = 1,
flammable = 2
},
sounds = default.node_sound_wood_defaults()
})
minetest.register_node("conifers:leaves", {
description = "Conifer leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tile_images = { "conifers_leaves.png" },
--inventory_image = "conifers_leaves.png",
paramtype = "light",
groups = {
snappy = 3,
--leafdecay = 3,
flammable = 2
},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'conifers:sapling'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'conifers:leaves'},
}
}
},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("conifers:leaves_special", {
description = "Bright conifer leaves",
drawtype = "allfaces_optional",
visual_scale = 1.3,
tile_images = { "conifers_leaves_special.png" },
--inventory_image = "conifers_leaves_special.png",
paramtype = "light",
groups = {
snappy = 3,
--leafdecay = 3,
flammable = 2
},
drop = {
max_items = 1,
items = {
{
-- player will get sapling with 1/20 chance
items = {'conifers:sapling'},
rarity = 20,
},
{
-- player will get leaves only if he get no saplings,
-- this is because max_items is 1
items = {'conifers:leaves'},
}
}
},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_node("conifers:sapling", {
description = "Conifer sapling",
drawtype = "plantlike",
tile_images = {"conifers_sapling.png"},
inventory_image = "conifers_sapling.png",
wield_image = "conifers_sapling.png",
paramtype = "light",
walkable = false,
groups = {
snappy = 2,
dig_immediate = 3,
flammable = 2
},
sounds = default.node_sound_defaults(),
})
--
-- Craft definitions
--
minetest.register_craft({
output = "conifers:trunk_reversed 2",
recipe = {
{"conifers:trunk", "conifers:trunk"},
}
})
minetest.register_craft({
output = "conifers:trunk 2",
recipe = {
{"conifers:trunk_reversed"},
{"conifers:trunk_reversed"}
}
})
minetest.register_craft({
output = 'default:wood 4',
recipe = {
{'conifers:trunk'}
}
})
minetest.register_craft({
output = 'default:wood 4',
recipe = {
{'conifers:trunk_reversed'}
}
})
--
-- ABM definitions
--
-- Spawn random conifers.
minetest.register_abm({
nodenames = "default:dirt_with_grass",
interval = INTERVAL,
chance = 200.2,
action = function(pos, node)
local p = {x=pos.x, y=pos.y+1, z=pos.z}
if minetest.get_node(p).name == "air"
and pos.y >= CONIFERS_ALTITUDE
and (not conifers:is_node_in_cube({"conifers:trunk"}, pos, CONIFERS_DISTANCE)) then
conifers:make_conifer(p, math.random(0, 1))
end
end
})
-- Saplings.
minetest.register_abm({
nodenames = "conifers:sapling",
interval = INTERVAL,
chance = SAPLING_CHANCE,
action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air" then
conifers:make_conifer(pos, math.random(0, 1))
end
end
})
-- Should we remove all the trees above the conifers altitude?
if REMOVE_TREES == true then
minetest.register_abm({
nodenames = {
"default:tree",
"default:leaves"
},
interval = INTERVAL/100,
chance = 1,
action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air"
and pos.y >= CONIFERS_ALTITUDE then
minetest.add_node(pos , {name = "air"})
end
end
})
end
--------------------------------------------------------------------------------
--
-- Functions
--
--------------------------------------------------------------------------------
--
-- table_contains(t, v)
--
-- Taken from the Flowers mod by erlehmann.
--
function conifers:table_contains(t, v)
for _,i in ipairs(t) do
if i == v then
return true
end
end
return false
end
--
-- is_node_in_cube(nodenames, node_pos, radius)
--
-- Taken from the Flowers mod by erlehmann.
--
function conifers:is_node_in_cube(nodenames, pos, size)
local hs = math.floor(size / 2)
for x = pos.x-size, pos.x+size do
for y = pos.y-hs, pos.y+hs do
for z = pos.z-size, pos.z+size do
n = minetest.get_node_or_nil({x=x, y=y, z=z})
if n == nil
or n.name == 'ignore'
or conifers:table_contains(nodenames, n.name) then
return true
end
end
end
end
return false
end
--
-- are_leaves_surrounded(position)
--
-- Return a boolean value set to 'true' if a leaves block is surrounded
-- by something else than
-- - air
-- - leaves
-- - special leaves
--
-- If a leaves block is surrounded by the blocks above,
-- it can be placed.
-- Otherwise, it will replace blocks we want to keep.
--
function conifers:are_leaves_surrounded(pos)
--
-- Check if a leaves block does not interfer with something else than the air or another leaves block.
--
local replacable_nodes = {
"air",
"conifers:leaves",
"conifers:leaves_special"
}
-- Let's check if the neighboring node is a replacable node.
for i = -1,1,2 do
if not (conifers:table_contains(replacable_nodes, minetest.get_node({x=pos.x+i, y=pos.y, z=pos.z}).name)
or conifers:table_contains(replacable_nodes, minetest.get_node({x=pos.x, y=pos.y, z=pos.z+i}).name)
) then
return true
end
end
return false
end
--
-- add_leaves_block(position, type of leaves, near trunk?)
--
-- Put a simple leaves block.
-- Leaves must be positioned near a trunk or surrounded by air.
-- Types of leaves are:
-- 0: dark leaves
-- 1: bright leaves (special)
--
function conifers:add_leaves_block(pos, special, near_trunk)
if (not conifers:are_leaves_surrounded(pos))
or near_trunk then
if special == 0 then
minetest.add_node(pos , { name = "conifers:leaves" })
else
minetest.add_node(pos , { name = "conifers:leaves_special" })
end
end
end
--
-- make_leaves(middle point, min radius, max radius, type of leaves)
--
-- Make a circle of leaves with a center given by 'middle point'.
-- Types of leaves are:
-- 0: dark leaves
-- 1: bright leaves (special)
--
function conifers:make_leaves(c, radius_min, radius_max, special)
--
-- Using the midpoint circle algorithm from Bresenham we can trace a circle of leaves.
--
for r = radius_min, radius_max do
local m_x = 0
local m_z = r
local m_m = 5 - 4 * r
while m_x <= m_z do
if radius_max > 1 then
if r == 1 then
-- Add a square of leaves (fixing holes near the trunk).
-- [ ] [ ]
-- [#]
-- [ ] [ ]
conifers:add_leaves_block({x = -1 + c.x, y = c.y, z = 1 + c.z}, special)
conifers:add_leaves_block({x = 1 + c.x, y = c.y, z = 1 + c.z}, special)
conifers:add_leaves_block({x = -1 + c.x, y = c.y, z = -1 + c.z}, special)
conifers:add_leaves_block({x = 1 + c.x, y = c.y, z = -1 + c.z}, special)
-- [ ]
-- [ ][#][ ]
-- [ ]
conifers:add_leaves_block({x = c.x, y = c.y, z = -1 + c.z}, special, true)
conifers:add_leaves_block({x = c.x, y = c.y, z = 1 + c.z}, special, true)
conifers:add_leaves_block({x = -1 + c.x, y = c.y, z = c.z}, special, true)
conifers:add_leaves_block({x = 1 + c.x, y = c.y, z = c.z}, special, true)
else
conifers:add_leaves_block({x = m_x + c.x, y = c.y, z = m_z + c.z}, special)
conifers:add_leaves_block({x = m_z + c.x, y = c.y, z = m_x + c.z}, special)
conifers:add_leaves_block({x = -m_x + c.x, y = c.y, z = m_z + c.z}, special)
conifers:add_leaves_block({x = -m_z + c.x, y = c.y, z = m_x + c.z}, special)
conifers:add_leaves_block({x = m_x + c.x, y = c.y, z = -m_z + c.z}, special)
conifers:add_leaves_block({x = m_z + c.x, y = c.y, z = -m_x + c.z}, special)
conifers:add_leaves_block({x = -m_x + c.x, y = c.y, z = -m_z + c.z}, special)
conifers:add_leaves_block({x = -m_z + c.x, y = c.y, z = -m_x + c.z}, special)
end
else
-- Put a small circle of leaves around the trunk.
-- [ ]
-- [ ][#][ ]
-- [ ]
conifers:add_leaves_block({x = c.x, y = c.y, z = -1 + c.z}, special, true)
conifers:add_leaves_block({x = c.x, y = c.y, z = 1 + c.z}, special, true)
conifers:add_leaves_block({x = -1 + c.x, y = c.y, z = c.z}, special, true)
conifers:add_leaves_block({x = 1 + c.x, y = c.y, z = c.z}, special, true)
end
-- Stuff...
if m_m > 0 then
m_z = m_z - 1
m_m = m_m - 8 * m_z
end
m_x = m_x + 1
m_m = m_m + 8 * m_x + 4
end
end
end
--
-- make_conifer(position, type)
--
-- Make a conifer at a given position.
-- Types are:
-- 0: regular pine
-- 1: narrow pine
--
function conifers:make_conifer(pos, conifer_type)
-- Check if we can gros a conifer at this place.
local node = minetest.get_node(pos).name
if minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name ~= "default:dirt_with_grass"
and (node ~= "air"
or node ~= "conifers:sapling"
) then
return false
--else
--if minetest.get_node({x = pos.x, y = pos.y, z = pos.z}).name == "conifers:sapling" then
--minetest.add_node(pos , {name = "air"})
--end
end
local height = math.random(TRUNK_MINHEIGHT, TRUNK_MAXHEIGHT) -- Random height of the conifer.
-- Let's check if we can grow a tree here.
-- That means, we must have a column of 'height' high which contains
-- only air.
for j = 1, height - 1 do -- Start from 1 so we can grow a sapling.
if minetest.get_node({x=pos.x, y=pos.y+j, z=pos.z}).name ~= "air" then
-- Abort
return false
end
end
local t1 = os.clock()
local leaves_height = math.random(LEAVES_MINHEIGHT, LEAVES_MAXHEIGHT) -- Level from where the leaves grow.
local current_block = {} -- Duh...
local leaves_radius = 1
local leaves_max_radius = 2
local special = math.random(0, 1)
-- Create the trunk and add the leaves.
for i = 0, height - 1 do
current_block = {x=pos.x, y=pos.y+i, z=pos.z}
-- Put a trunk block.
minetest.add_node(current_block , {name = "conifers:trunk"})
-- Put some leaves.
if i >= leaves_height then
-- Put some leaves.
conifers:make_leaves({x=pos.x, y=pos.y+leaves_height+height-1-i, z=pos.z}, 1, leaves_radius, special)
--
-- TYPE OF CONIFER
--
if conifer_type == 1 then -- Regular type
-- Prepare the next circle of leaves.
leaves_radius = leaves_radius+1
-- Check if the current radius is the maximum radius at this level.
if leaves_radius > leaves_max_radius then
leaves_radius = 1
leaves_max_radius = leaves_max_radius+1
-- Does it exceeds the maximum radius?
if leaves_max_radius > LEAVES_MAXRADIUS then
leaves_max_radius = LEAVES_MAXRADIUS
end
end
else -- Narrow type
if i % 2 == 0 then
leaves_radius = LEAVES_NARROWRADIUS-math.random(0,1)
else
leaves_radius = math.floor(LEAVES_NARROWRADIUS/2)
end
end
end
end
-- Put a top leaves block.
current_block.y = current_block.y+1
conifers:add_leaves_block(current_block, special)
-- Blahblahblah
print (string.format('[conifers] A conifer has grown at ('..pos.x..','..pos.y..','..pos.z..') with a height of '..height..' after ca. %.2fs', os.clock() - t1))
return true
end

View File

@ -0,0 +1,482 @@
minetest.register_craftitem(":farming:pumpkin_seed", {
description = "Pumpkin Seed",
inventory_image = "farming_pumpkin_seed.png",
on_place = function(itemstack, placer, pointed_thing)
local above = minetest.env:get_node(pointed_thing.above)
if above.name == "air" then
above.name = "farming:pumpkin_1"
minetest.env:set_node(pointed_thing.above, above)
itemstack:take_item(1)
return itemstack
end
end
})
minetest.register_node(":farming:pumpkin_1", {
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
drop = "",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
node_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.2, -0.5, -0.2, 0.2, -0.1, 0.2}
},
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node(":farming:pumpkin_2", {
paramtype = "light",
sunlight_propagates = true,
drawtype = "nodebox",
drop = "",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
node_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
},
},
selection_box = {
type = "fixed",
fixed = {
{-0.35, -0.5, -0.35, 0.35, 0.2, 0.35}
},
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, not_in_creative_inventory=1, plant=1},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node(":farming:pumpkin", {
description = "Pumpkin",
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2, plant=1},
sounds = default.node_sound_wood_defaults(),
on_punch = function(pos, node, puncher)
local tool = puncher:get_wielded_item():get_name()
if tool and tool == "default:sword_wood" or tool == "default:sword_stone" or tool == "default:sword_steel" then
node.name = "farming:pumpkin_face"
minetest.env:set_node(pos, node)
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
if math.random(1, 5) == 1 then
puncher:get_inventory():add_item("main", ItemStack("farming:pumpkin_seed"))
end
end
end
})
farming:add_plant("farming:pumpkin", {"farming:pumpkin_1", "farming:pumpkin_2"}, 80, 20)
minetest.register_node(":farming:pumpkin_face", {
description = "Pumpkin",
paramtype2 = "facedir",
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_node(":farming:pumpkin_face_light", {
description = "Pumpkin",
paramtype2 = "facedir",
light_source = LIGHT_MAX-2,
tiles = {"farming_pumpkin_top.png", "farming_pumpkin_top.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_side.png", "farming_pumpkin_face_light.png"},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
sounds = default.node_sound_wood_defaults(),
})
minetest.register_craft({
type = "shapeless",
output = "farming:pumpkin_face_light",
recipe = {"farming:pumpkin_face", "default:torch"}
})
-- ========= BIG PUMPKIN =========
minetest.register_node(":farming:big_pumpkin", {
description = "Big Pumpkin",
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_side.png"},
selection_box = {
type = "fixed",
fixed = {
{-1, -0.5, -1, 1, 1.5, 1}
}
},
groups = {choppy=1, oddly_breakable_by_hand=1, flammable=2, plant=1},
sounds = default.node_sound_wood_defaults(),
after_place_node = function(pos, placer)
for dx=-1,1 do
for dy=0,1 do
for dz=-1,1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
if dx ~= 0 or dy ~= 0 or dz ~= 0 then
if minetest.env:get_node(pos).name ~= "air" then
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
minetest.env:remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:big_pumpkin"))
end, placer)
return
end
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
for dy=0,1 do
pos.y = pos.y+dy
pos.z = pos.z+1
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=2})
pos.x = pos.x-1
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=2})
pos.x = pos.x+1
pos.z = pos.z-2
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=4})
pos.x = pos.x+1
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=4})
pos.z = pos.z+1
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=3})
pos.z = pos.z+1
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=3})
pos.z = pos.z-1
pos.x = pos.x-2
minetest.env:set_node(pos, {name="farming:big_pumpkin_side", param2=1})
pos.z = pos.z-1
minetest.env:set_node(pos, {name="farming:big_pumpkin_corner", param2=1})
pos.z = pos.z+1
pos.x = pos.x+1
pos.y = pos.y-dy
end
pos.y = pos.y+1
minetest.env:set_node(pos, {name="farming:big_pumpkin_top"})
end,
after_destruct = function(pos, oldnode)
for dx=-1,1 do
for dy=0,1 do
for dz=-1,1 do
pos.x = pos.x+dx
pos.y = pos.y+dy
pos.z = pos.z+dz
local name = minetest.env:get_node(pos).name
if string.find(name, "farming:big_pumpkin") then
minetest.env:remove_node(pos)
end
pos.x = pos.x-dx
pos.y = pos.y-dy
pos.z = pos.z-dz
end
end
end
end
})
minetest.register_node(":farming:big_pumpkin_side", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_top_side.png", "farming_pumpkin_big_side.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0.5, 0.5, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1, plant=1},
})
minetest.register_node(":farming:big_pumpkin_corner", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_pumpkin_big_top_corner.png", "farming_pumpkin_big_side.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, 0, 0, 0.5, 0.5}
}
},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1, plant=1},
})
minetest.register_node(":farming:big_pumpkin_top", {
paramtype = "light",
sunlight_propagates = true,
tiles = {"farming_pumpkin_big_top.png"},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
},
groups = {not_in_creative_inventory=1, plant=1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:big_pumpkin",
recipe = {"bucket:bucket_water", "farming:pumpkin"},
replacements = {
{"bucket:bucket_water", "bucket:bucket_empty"}
}
})
-- ========= SCARECROW =========
local box1 = {
{-1, -8, -1, 1, 8, 1},
}
local box2 = {
{-1, -8, -1, 1, 8, 1},
{-12, -8, -1, 12, -7, 1},
{-5, -2, -5, 5, 8, 5}
}
for j,list in ipairs(box1) do
for i,int in ipairs(list) do
list[i] = int/16
end
box1[j] = list
end
for j,list in ipairs(box2) do
for i,int in ipairs(list) do
list[i] = int/16
end
box2[j] = list
end
minetest.register_node(":farming:scarecrow", {
description = "Scarecrow",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box2
},
selection_box = {
type = "fixed",
fixed = {
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
}
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
after_place_node = function(pos, placer)
local node = minetest.env:get_node(pos)
local param2 = node.param2
pos.y = pos.y+1
if minetest.env:get_node(pos).name ~= "air" then
pos.y = pos.y-1
minetest.env:remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:scarecrow"))
end, placer)
return
end
minetest.env:set_node(pos, node)
pos.y = pos.y-1
node.name = "farming:scarecrow_bottom"
minetest.env:set_node(pos, node)
end,
after_destruct = function(pos, oldnode)
pos.y = pos.y-1
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
minetest.env:remove_node(pos)
end
end
})
minetest.register_node(":farming:scarecrow_bottom", {
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
tiles = {"default_wood.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box1
},
groups = {not_in_creative_inventory=1},
selection_box = {
type = "fixed",
fixed = {
{0, 0, 0, 0, 0, 0}
}
}
})
minetest.register_craft({
output = "farming:scarecrow",
recipe = {
{"", "farming:pumpkin_face", "",},
{"default:stick", "default:stick", "default:stick",},
{"", "default:stick", "",}
}
})
minetest.register_node(":farming:scarecrow_light", {
description = "Scarecrow",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "facedir",
light_source = LIGHT_MAX-2,
tiles = {"farming_scarecrow_top.png", "farming_scarecrow_top.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_side.png", "farming_scarecrow_front_light.png"},
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = box2
},
selection_box = {
type = "fixed",
fixed = {
{-12/16, -1.5, -0.5, 12/16, 0.5, 0.5}
}
},
groups = {choppy=2, oddly_breakable_by_hand=2, flammable=2},
after_place_node = function(pos, placer)
local node = minetest.env:get_node(pos)
local param2 = node.param2
pos.y = pos.y+1
if minetest.env:get_node(pos).name ~= "air" then
pos.y = pos.y-1
minetest.env:remove_node(pos)
minetest.after(0.1, function(placer)
local inv = placer:get_inventory()
local index = placer:get_wield_index()
inv:set_stack("main", index, ItemStack("farming:scarecrow_light"))
end, placer)
return
end
minetest.env:set_node(pos, node)
pos.y = pos.y-1
node.name = "farming:scarecrow_bottom"
minetest.env:set_node(pos, node)
end,
after_destruct = function(pos, oldnode)
pos.y = pos.y-1
if minetest.env:get_node(pos).name == "farming:scarecrow_bottom" then
minetest.env:remove_node(pos)
end
end
})
minetest.register_craft({
output = "farming:scarecrow_light",
recipe = {
{"", "farming:pumpkin_face_light", "",},
{"default:stick", "default:stick", "default:stick",},
{"", "default:stick", "",}
}
})
--===============
minetest.register_craftitem(":farming:pumpkin_bread", {
description = "Pumpkin Bread",
inventory_image = "farming_bread_pumpkin.png",
stack_max = 1,
on_use = minetest.item_eat(8)
})
minetest.register_craftitem(":farming:pumpkin_flour", {
description = "Pumpkin Flour",
inventory_image = "farming_cake_mix_pumpkin.png",
})
minetest.register_alias("farming:pumpkin_cake_mix", "farming:pumpkin_flour")
minetest.register_craft({
output = "farming:pumpkin_flour",
type = "shapeless",
recipe = {"farming:flour", "farming:pumpkin"}
})
minetest.register_craft({
type = "cooking",
output = "farming:pumpkin_bread",
recipe = "farming:pumpkin_flour",
cooktime = 10
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_seed",
burntime = 1
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_face",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:pumpkin_face_light",
burntime = 7
})
minetest.register_craft({
type = "fuel",
recipe = "farming:big_pumpkin",
burntime = 10
})
minetest.register_craft({
type = "fuel",
recipe = "farming:scarecrow",
burntime = 5
})
minetest.register_craft({
type = "fuel",
recipe = "farming:scarecrow_light",
burntime = 5
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 502 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 632 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 623 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 641 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 613 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 591 B

View File

@ -0,0 +1,40 @@
minetest.register_node(":farming:weed", {
description = "Weed",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
drawtype = "plantlike",
tiles = {"farming_weed.png"},
inventory_image = "farming_weed.png",
selection_box = {
type = "fixed",
fixed = {
{-0.5, -0.5, -0.5, 0.5, -0.5+4/16, 0.5}
},
},
groups = {snappy=3, flammable=2, plant=1},
sounds = default.node_sound_leaves_defaults()
})
minetest.register_abm({
nodenames = {"farming:soil_wet", "farming:soil"},
interval = 50,
chance = 10,
action = function(pos, node)
if minetest.env:find_node_near(pos, 4, {"farming:scarecrow", "farming:scarecrow_light"}) ~= nil then
return
end
pos.y = pos.y+1
if minetest.env:get_node(pos).name == "air" then
node.name = "farming:weed"
minetest.env:set_node(pos, node)
end
end
})
-- ========= FUEL =========
minetest.register_craft({
type = "fuel",
recipe = "farming:weed",
burntime = 1
})

View File

@ -1 +0,0 @@
default

View File

@ -1,39 +0,0 @@
-- glow/init.lua
-- mod by john and Zeg9
LIGHT_MAX = 14
minetest.register_node("glow:stone", {
description = "Glowing stone",
tile_images = {"glow_stone.png"},
light_source = LIGHT_MAX,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_node("glow:lamp", {
description = "Lamp",
tile_images = {"glow_lamp.png"},
light_source = LIGHT_MAX,
groups = {cracky=3},
sounds = default.node_sound_glass_defaults(),
})
minetest.register_craft( {
output = '"glow:stone" 2',
recipe = {
{ 'default:stone','default:coal_lump','default:stone' }
},
})
minetest.register_craft( {
output = '"glow:lamp" 6',
recipe = {
{ 'default:stick','default:glass', 'default:stick' },
{ 'default:glass','glow:stone', 'default:glass' },
{ 'default:stick','default:glass', 'default:stick' },
},
})
minetest.register_alias("glow:lantern", "glow:lamp")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

4
mods/hydro/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
## Generic ignorable patterns and files
*~
.*.swp
debug.txt

View File

@ -1,67 +1,97 @@
HYDRO_GROW_INTERVAL = 100
PLANTS = {
tomato = {name='tomato',growtype='growtall'},
peas = {name='peas',growtype='growtall'},
habanero = {name='habanero',growtype='growtall'},
grapes = {name='grapes',growtype='permaculture'},
coffee = {name='coffee',growtype='permaculture'},
roses = {name='roses',growtype='growtall',give_on_harvest='hydro:rosebush'}
local HYDRO_GROW_INTERVAL = 100
local PLANTS = {
tomato = {name='tomato', description="Tomato", growtype='growtall'},
peas = {name='peas', description="Peas", growtype='growtall'},
habanero = {name='habanero', description="Habanero", growtype='growtall'},
grapes = {name='grapes', description="Grapes", growtype='permaculture'},
coffee = {name='coffee', description="Coffee", growtype='permaculture'},
roses = {name='roses', description="Roses", growtype='growtall',give_on_harvest='hydro:rosebush'}
}
PLANTLIKE = function(nodeid, nodename,type,option)
if option == nil then option = false end
minetest.register_node("hydro:wine", {
description = 'Wine Bottle',
drawtype = "plantlike",
tile_images = {"hydro_wine.png"},
inventory_image = "hydro_wine.png",
wield_image = "hydro_wine.png",
use_texture_alpha = true,
paramtype = "light",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
sounds = default.node_sound_wood_defaults(),
walkable = false,
on_use = minetest.item_eat(1)
})
local params ={ description = nodename, drawtype = "plantlike", tile_images = {"hydro_"..nodeid..'.png'},
inventory_image = "hydro_"..nodeid..'.png', wield_image = "hydro_"..nodeid..'.png', paramtype = "light", }
if type == 'veg' then
params.groups = {snappy=2,dig_immediate=3,flammable=2}
params.sounds = default.node_sound_leaves_defaults()
if option == false then params.walkable = false end
elseif type == 'met' then -- metallic
params.groups = {cracky=3}
params.sounds = default.node_sound_stone_defaults()
elseif type == 'cri' then -- craft items
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
params.sounds = default.node_sound_wood_defaults()
if option == false then params.walkable = false end
elseif type == 'eat' then -- edible
params.groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3}
params.sounds = default.node_sound_wood_defaults()
params.walkable = false
params.on_use = minetest.item_eat(option)
end
minetest.register_node("hydro:"..nodeid, params)
end
GLOWLIKE = function(nodeid,nodename,drawtype)
if drawtype == nil then
drawtype = 'glasslike'
inv_image = minetest.inventorycube("hydro_"..nodeid..".png")
else
inv_image = "hydro_"..nodeid..".png"
end
minetest.register_node("hydro:"..nodeid, {
description = nodename,
drawtype = drawtype,
tile_images = {"hydro_"..nodeid..".png"},
inventory_image = inv_image,
light_propagates = true,
paramtype = "light",
sunlight_propagates = true,
light_source = 15 ,
is_ground_content = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
minetest.register_node("hydro:coffeecup", {
description = 'Coffee Cup',
drawtype = "plantlike",
tile_images = {"hydro_coffeecup.png"},
inventory_image = "hydro_coffeecup.png",
wield_image = "hydro_coffeecup.png",
use_texture_alpha = true,
paramtype = "light",
groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,flammable=3},
sounds = default.node_sound_wood_defaults(),
walkable = false,
on_use = minetest.item_eat(2)
})
minetest.register_node("hydro:growlamp", {
description = "Growlamp",
drawtype = 'nodebox',
node_box = {
type = "fixed",
fixed = {
{-1/16, -7/16, -1/16, 1/16, 8/16, 1/16},
{-2/16, 3/16, -2/16, 2/16, 6/16, 2/16},
{-3/16, -6/16, -2/16, 3/16, 3/16, 2/16},
{-2/16, -6/16, -3/16, 2/16, 3/16, 3/16},
}
},
tile_images = {"hydro_growlamp_top.png", "hydro_growlamp_bottom.png", "hydro_growlamp_side.png"},
--inventory_image = "hydro_growlamp_side.png",
paramtype = "light",
light_propagates = true,
sunlight_propagates = true,
light_source = 15,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_glass_defaults(),
node_placement_prediction = "hydro:coffeecup",
})
minetest.on_place = minetest.on_place or function(name, func)
local previous_on_place = minetest.registered_nodes[name].on_place
minetest.override_item(name, {
on_place = function(itemstack, placer, pointed_thing)
if func(itemstack, placer, pointed_thing) then
return previous_on_place(itemstack, placer, pointed_thing)
end
end
})
end
PLANTLIKE('wine','Wine Bottle','eat',1)
PLANTLIKE('coffeecup','Coffee Cup','eat',2)
GLOWLIKE('growlamp','Growlamp','plantlike')
minetest.on_place("hydro:growlamp", function(itemstack, placer, pointed_thing)
if not pointed_thing then
return
end
local pos = minetest.get_pointed_thing_position(pointed_thing, true)
if not pos then
return
end
local nd_above = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name
local nd_above_info = minetest.registered_nodes[nd_above]
if nd_above == "air"
or nd_above == "hydro:growlamp"
or not nd_above_info.walkable
or nd_above_info.buildable_to then
return
end
return true
end)
minetest.register_node("hydro:promix", {
description = "Promix",
tile_images = {"hydro_promix.png"},
is_ground_content = true,
groups = {crumbly=3},
sounds = default.node_sound_dirt_defaults(),
})
@ -69,7 +99,6 @@ minetest.register_node("hydro:roastedcoffee", {
description = "Roasted Coffee",
tile_images = {"hydro_roastedcoffee.png"},
inventory_image = minetest.inventorycube("hydro_roastedcoffee.png"),
is_ground_content = true,
groups = {snappy=2,cracky=3,oddly_breakable_by_hand=3},
sounds = default.node_sound_stone_defaults(),
})
@ -83,20 +112,15 @@ minetest.register_node("hydro:rosebush", {
sounds = default.node_sound_leaves_defaults(),
})
get_plantname = {} -- plants index by nodenames (tomato1, tomato2, seeds_tomato, etc..)
get_plantbynumber = {} -- plants index by number (for random select)
get_wildplants = {} -- wildplant nodenames (pop control)
local get_plantname = {} -- plants index by nodenames (tomato1, tomato2, seeds_tomato, etc..)
local get_plantbynumber = {} -- plants index by number (for random select)
local get_wildplants = {} -- wildplant nodenames (pop control)
local is_specialharvest = function(plantname)
local result = 'hydro:'..plantname
if PLANTS[plantname].give_on_harvest ~= nil then result = PLANTS[plantname].give_on_harvest end
return result
end
for index,plant in pairs(PLANTS) do
for _,plant in pairs(PLANTS) do
-- define nodes
minetest.register_node("hydro:wild_"..plant.name, {
description = "Wild Plant",
local wild_plant = "hydro:wild_"..plant.name
minetest.register_node(wild_plant, {
description = "Wild "..plant.description.." Plant",
drawtype = "plantlike",
visual_scale = 1.0,
tile_images = {"hydro_wildplant.png"},
@ -111,7 +135,7 @@ for index,plant in pairs(PLANTS) do
},
})
minetest.register_node("hydro:seeds_"..plant.name, {
description = plant.name.." Seeds",
description = plant.description.." Seeds",
drawtype = "signlike",
tile_images = {"hydro_seeds.png"},
inventory_image = "hydro_seeds.png",
@ -158,7 +182,7 @@ for index,plant in pairs(PLANTS) do
drop = '',
})
minetest.register_node('hydro:'..plant.name..'1', {
description = 'Tomato Plant (Young)',
description = plant.description..' Plant (Young)',
drawtype = 'plantlike',
visual_scale = 1.0,
tile_images = { 'hydro_'..plant.name..'1.png' },
@ -172,16 +196,8 @@ for index,plant in pairs(PLANTS) do
drop = '',
})
local after_dig_node = nil
if plant.growtype == 'permaculture' then
plant.growtype = 'growshort'
after_dig_node = function(pos,node)
minetest.env:add_node(pos,{type='node',name='hydro:'..plant.name..'1'})
end
end
minetest.register_node('hydro:'..plant.name..'2', {
description = 'Tomato Plant (Youngish)',
description = plant.description..' Plant (Youngish)',
drawtype = 'plantlike',
visual_scale = 1.0,
tile_images = { 'hydro_'..plant.name..'2.png' },
@ -195,7 +211,7 @@ for index,plant in pairs(PLANTS) do
drop = '',
})
minetest.register_node('hydro:'..plant.name..'3', {
description = 'Tomato Plant (Fruitings)',
description = plant.description..' Plant (Fruitings)',
drawtype = 'plantlike',
visual_scale = 1.0,
tile_images = { 'hydro_'..plant.name..'3.png' },
@ -211,10 +227,21 @@ for index,plant in pairs(PLANTS) do
local harvest = 'hydro:'..plant.name
if plant.give_on_harvest then harvest = plant.give_on_harvest end
if plant.give_on_harvest then
harvest = plant.give_on_harvest
end
local after_dig_node
if plant.growtype == 'permaculture' then
plant.growtype = 'growshort'
after_dig_node = function(pos)
minetest.add_node(pos, {name='hydro:'..plant.name..'1'})
end
end
minetest.register_node('hydro:'..plant.name..'4', {
description = 'Tomato Plant (Ripe)',
description = plant.description..' Plant (Ripe)',
drawtype = 'plantlike',
visual_scale = 1.0,
tile_images = { 'hydro_'..plant.name..'4.png' },
@ -238,7 +265,7 @@ for index,plant in pairs(PLANTS) do
},
})
if plant.give_on_harvest == nil then
if not plant.give_on_harvest then
minetest.register_node("hydro:"..plant.name, {
description = plant.name,
drawtype = "plantlike",
@ -253,7 +280,7 @@ for index,plant in pairs(PLANTS) do
sounds = default.node_sound_defaults(),
})
end
table.insert(get_wildplants, 'hydro:wild_'..plant.name)
table.insert(get_wildplants, wild_plant)
table.insert(get_plantbynumber, plant.name)
get_plantname["hydro:"..plant.name.."4"] = plant.name
get_plantname["hydro:"..plant.name.."3"] = plant.name
@ -265,191 +292,134 @@ for index,plant in pairs(PLANTS) do
end
-- GROW (TALL) FUNCTION
growtall = function (plantname, nodename, grnode)
if nodename == 'hydro:'..plantname..'3' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."4"})
minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."4"})
elseif nodename == 'hydro:'..plantname..'2' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."3"})
minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."3"})
elseif nodename == 'hydro:'..plantname..'1' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."2"})
minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."2"})
elseif nodename =='hydro:sproutlings_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."1"})
elseif nodename == 'hydro:seedlings_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:sproutlings_"..plantname})
elseif nodename == 'hydro:seeds_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:seedlings_"..plantname})
local function grow_plant(plantname, nodename, pos, tall)
local name, above
if nodename == 'hydro:'..plantname..'3' then
name = plantname.."4"
above = true
elseif nodename == 'hydro:'..plantname..'2' then
name = plantname.."3"
above = true
elseif nodename == 'hydro:'..plantname..'1' then
name = plantname.."2"
above = true
elseif nodename =='hydro:sproutlings_'..plantname then
name = plantname.."1"
elseif nodename == 'hydro:seedlings_'..plantname then
name = "sproutlings_"..plantname
elseif nodename == 'hydro:seeds_'..plantname then
name = "seedlings_"..plantname
else
return
end
end
growshort = function (plantname, nodename, grnode)
if nodename == 'hydro:'..plantname..'3' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."4"})
-- minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."4"})
elseif nodename == 'hydro:'..plantname..'2' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."3"})
-- minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."3"})
elseif nodename == 'hydro:'..plantname..'1' then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."2"})
-- minetest.env:add_node(grnode.grow2,{type="node",name="hydro:"..plantname.."2"})
elseif nodename =='hydro:sproutlings_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:"..plantname.."1"})
elseif nodename == 'hydro:seedlings_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:sproutlings_"..plantname})
elseif nodename == 'hydro:seeds_'..plantname then minetest.env:add_node(grnode.grow1,{type="node",name="hydro:seedlings_"..plantname})
minetest.add_node(pos, {name="hydro:"..name})
if above
and tall then
minetest.add_node({x=pos.x, y=pos.y+1, z=pos.z}, {name="hydro:"..name})
end
end
-- WILD PLANTS/SEEDS GENERATING
local function get_random(pos, seed)
return PseudoRandom(math.abs(pos.x+pos.y*3+pos.z*5)+seed)
end
minetest.register_abm({
nodenames = { "default:dirt_with_grass" },
interval = 600,
chance = 80,
action = function(pos, node, active_object_count, active_object_count_wider)
local air = { x=pos.x, y=pos.y+1,z=pos.z }
local is_air = minetest.env:get_node_or_nil(air)
if is_air ~= nil and is_air.name == 'air' then
local count = table.getn(get_plantbynumber)
local random_plant = math.random(1,count)
local nodename = "hydro:wild_"..get_plantbynumber[random_plant]
if nodename ~= "hydro:wild_rubberplant" then minetest.env:add_node({x=pos.x,y=pos.y+1,z=pos.z},{type="node",name=nodename}) end
nodenames = { "default:dirt_with_grass" },
interval = 600,
chance = 80,
action = function(p, node)
local pr = get_random(p, 17)
if pr:next(1,20) ~= 1 then
return
end
p.y = p.y+1
local is_air = minetest.get_node_or_nil(p)
if is_air
and is_air.name == 'air' then
local count = table.getn(get_plantbynumber)
local random_plant = math.random(1, count)
local nodename = "hydro:wild_"..get_plantbynumber[random_plant]
if nodename ~= "hydro:wild_rubberplant" then
minetest.add_node(p, {name=nodename})
end
end
})
minetest.register_abm({
nodenames = get_wildplants,
interval = 600,
chance = 2,
action = function(pos, node, active_object_count, active_object_count_wider)
minetest.env:remove_node({x=pos.x,y=pos.y,z=pos.z})
end
end
})
-- GROWING
minetest.register_abm({
nodenames = { "hydro:growlamp" },
interval = HYDRO_GROW_INTERVAL,
chance = 1,
action = function(pos, node, active_object_count, active_object_count_wider)
local grnode1 = {water = {x=pos.x,y=pos.y-5,z=pos.z}, mix = {x=pos.x,y=pos.y-4,z=pos.z},grow1 = {x=pos.x,y=pos.y-3,z=pos.z}, grow2 = {x=pos.x,y=pos.y-2,z=pos.z}}
local grnode2 = {water = {x=pos.x-1,y=pos.y-5,z=pos.z}, mix = {x=pos.x-1,y=pos.y-4,z=pos.z},grow1 = {x=pos.x-1, y=pos.y-3,z=pos.z}, grow2 = {x=pos.x-1,y=pos.y-2,z=pos.z}}
local grnode3 = {water = {x=pos.x+1,y=pos.y-5,z=pos.z}, mix = {x=pos.x+1,y=pos.y-4,z=pos.z},grow1 = {x=pos.x+1, y=pos.y-3,z=pos.z}, grow2 = {x=pos.x+1,y=pos.y-2,z=pos.z}}
local grnode4 = {water = {x=pos.x,y=pos.y-5,z=pos.z-1}, mix = {x=pos.x,y=pos.y-4,z=pos.z-1},grow1 = {x=pos.x, y=pos.y-3, z=pos.z-1}, grow2 = {x=pos.x,y=pos.y-2,z=pos.z-1}}
local grnode5 = {water = {x=pos.x,y=pos.y-5,z=pos.z+1}, mix = {x=pos.x,y=pos.y-4,z=pos.z+1},grow1 = {x=pos.x, y=pos.y-3, z=pos.z+1}, grow2 = {x=pos.x,y=pos.y-2,z=pos.z+1}}
local grnode6 = {water = {x=pos.x-1,y=pos.y-5,z=pos.z-1}, mix = {x=pos.x-1,y=pos.y-4,z=pos.z-1},grow1 = {x=pos.x-1,y=pos.y-3,z=pos.z-1}, grow2 = {x=pos.x-1,y=pos.y-2,z=pos.z-1}}
local grnode7 = {water = {x=pos.x-1,y=pos.y-5,z=pos.z+1}, mix = {x=pos.x-1,y=pos.y-4,z=pos.z+1},grow1 = {x=pos.x-1,y=pos.y-3,z=pos.z+1}, grow2 = {x=pos.x-1,y=pos.y-2,z=pos.z+1}}
local grnode8 = {water = {x=pos.x+1,y=pos.y-5,z=pos.z-1}, mix = {x=pos.x+1,y=pos.y-4,z=pos.z-1},grow1 = {x=pos.x+1,y=pos.y-3,z=pos.z-1}, grow2 = {x=pos.x+1,y=pos.y-2,z=pos.z-1}}
local grnode9 = {water = {x=pos.x+1,y=pos.y-5,z=pos.z+1}, mix = {x=pos.x+1,y=pos.y-4,z=pos.z+1},grow1 = {x=pos.x+1,y=pos.y-3,z=pos.z+1}, grow2 = {x=pos.x+1,y=pos.y-2,z=pos.z+1}}
local water1 = minetest.env:get_node(grnode1.water)
if water1.name == 'default:water_source' or water1.name == 'default:water_flowing' then water1 = true end
local ismix1 = minetest.env:get_node(grnode1.mix)
local water2 = minetest.env:get_node(grnode2.water)
if water2.name == 'default:water_source' or water2.name == 'default:water_flowing' then water2 = true end
local ismix2 = minetest.env:get_node(grnode2.mix)
local water3 = minetest.env:get_node(grnode3.water)
if water3.name == 'default:water_source' or water3.name == 'default:water_flowing' then water3 = true end
local ismix3 = minetest.env:get_node(grnode3.mix)
local water4 = minetest.env:get_node(grnode4.water)
if water4.name == 'default:water_source' or water4.name == 'default:water_flowing' then water4 = true end
local ismix4 = minetest.env:get_node(grnode4.mix)
local water5 = minetest.env:get_node(grnode5.water)
if water5.name == 'default:water_source' or water5.name == 'default:water_flowing' then water5 = true end
local ismix5 = minetest.env:get_node(grnode5.mix)
local water6 = minetest.env:get_node(grnode6.water)
if water6.name == 'default:water_source' or water6.name == 'default:water_flowing' then water6 = true end
local ismix6 = minetest.env:get_node(grnode6.mix)
local water7 = minetest.env:get_node(grnode7.water)
if water7.name == 'default:water_source' or water7.name == 'default:water_flowing' then water7 = true end
local ismix7 = minetest.env:get_node(grnode7.mix)
local water8 = minetest.env:get_node(grnode8.water)
if water8.name == 'default:water_source' or water8.name == 'default:water_flowing' then water8 = true end
local ismix8 = minetest.env:get_node(grnode8.mix)
local water9 = minetest.env:get_node(grnode9.water)
if water9.name == 'default:water_source' or water9.name == 'default:water_flowing' then water9 = true end
local ismix9 = minetest.env:get_node(grnode9.mix)
if water1 == true and ismix1.name == 'hydro:promix' then
local grow1 = minetest.env:get_node(grnode1.grow1)
local curplant = get_plantname[grow1.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow1.name,grnode1) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow1.name,grnode1) end -- *** GENERIC GROW FUNCTION
end
if water2 == true and ismix2.name == 'hydro:promix' then
local grow2 = minetest.env:get_node(grnode2.grow1)
local curplant = get_plantname[grow2.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow2.name,grnode2) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow2.name,grnode2) end -- *** GENERIC GROW FUNCTION
end
if water3 == true and ismix3.name == 'hydro:promix' then
local grow3 = minetest.env:get_node(grnode3.grow1)
local curplant = get_plantname[grow3.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow3.name,grnode3) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow3.name,grnode3) end -- *** GENERIC GROW FUNCTION
end
if water4 == true and ismix4.name == 'hydro:promix' then
local grow4 = minetest.env:get_node(grnode4.grow1)
local curplant = get_plantname[grow4.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow4.name,grnode4) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow4.name,grnode4) end -- *** GENERIC GROW FUNCTION
end
if water5 == true and ismix5.name == 'hydro:promix' then
local grow5 = minetest.env:get_node(grnode5.grow1)
local curplant = get_plantname[grow5.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow5.name,grnode5) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow5.name,grnode5) end -- *** GENERIC GROW FUNCTION
end
if water6 == true and ismix6.name == 'hydro:promix' then
local grow6 = minetest.env:get_node(grnode6.grow1)
local curplant = get_plantname[grow6.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow6.name,grnode6) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow6.name,grnode6) end -- *** GENERIC GROW FUNCTION
end
if water7 == true and ismix7.name == 'hydro:promix' then
local grow7 = minetest.env:get_node(grnode7.grow1)
local curplant = get_plantname[grow7.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow7.name,grnode7) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow7.name,grnode7) end -- *** GENERIC GROW FUNCTION
end
if water8 == true and ismix8.name == 'hydro:promix' then
local grow8 = minetest.env:get_node(grnode8.grow1)
local curplant = get_plantname[grow8.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow8.name,grnode8) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow8.name,grnode8) end -- *** GENERIC GROW FUNCTION
end
if water9 == true and ismix9.name == 'hydro:promix' then
local grow9 = minetest.env:get_node(grnode9.grow1)
local curplant = get_plantname[grow9.name]
if curplant ~= nil and PLANTS[curplant].growtype == 'growtall' then growtall(curplant,grow9.name,grnode9) -- *** GENERIC GROW FUNCTION
elseif curplant ~= nil and PLANTS[curplant].growtype == 'growshort' then growshort(curplant,grow9.name,grnode9) end -- *** GENERIC GROW FUNCTION
end
nodenames = { "hydro:growlamp" },
interval = HYDRO_GROW_INTERVAL,
chance = 1,
action = function(pos, node)
if minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z}).name == "air"
or minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z}).name ~= "air" then
return
end
for i = -1,1 do
for j = -1,1 do
local p = {x=pos.x+j, y=pos.y, z=pos.z+i}
local water = minetest.get_node({x=p.x, y=p.y-5, z=p.z}).name
if (water == 'default:water_source' or water == 'default:water_flowing')
and minetest.get_node({x=p.x, y=p.y-4, z=p.z}).name == 'hydro:promix' then
local grow = minetest.get_node({x=p.x, y=p.y-3, z=p.z}).name
local curplant = get_plantname[grow]
if curplant then
local growtype = PLANTS[curplant].growtype
local tall
if growtype == 'growtall' then
tall = true
end
grow_plant(curplant, grow, {x=p.x, y=p.y-3, z=p.z}, tall)
end
end
end
end
end
})
minetest.register_craft({ output = 'hydro:growlamp 1', recipe = {
{'glass', 'torch','glass'},
{'glass', 'torch','glass'},
{'glass', 'torch','glass'},
}})
minetest.register_craft({ output = 'hydro:promix 6', recipe = {
--Crafting
minetest.register_craft({
output = 'hydro:growlamp',
recipe = {
{'default:glass', 'default:torch','default:glass'},
{'default:glass', 'default:torch','default:glass'},
{'default:glass', 'default:torch','default:glass'},
}
})
minetest.register_craft({
output = 'hydro:promix 6',
recipe = {
{'', 'default:clay_lump',''},
{'default:dirt', 'default:dirt', 'default:dirt'},
{'default:dirt', 'default:dirt', 'default:dirt'},
}})
minetest.register_craft({ output = 'hydro:wine 1', recipe = {
}
})
minetest.register_craft({
output = 'hydro:wine',
recipe = {
{'default:glass', 'hydro:grapes','default:glass'},
{'default:glass', 'hydro:grapes','default:glass'},
{'default:glass', 'hydro:grapes','default:glass'},
}})
minetest.register_craft({ output = 'node "hydro:coffeecup" 1', recipe = {
}
})
minetest.register_craft({
output = "hydro:coffeecup",
recipe = {
{'','',''},
{'default:clay_lump','hydro:roastedcoffee','default:clay_lump'},
{'','default:clay_lump',''},
}})
minetest.register_craft({ type = "cooking", output = "hydro:roastedcoffee", recipe = "hydro:coffee", })
}
})
minetest.register_craft({
type = "cooking",
output = "hydro:roastedcoffee",
recipe = "hydro:coffee",
})

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 426 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 384 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 797 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 377 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 393 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 383 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 309 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 480 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 324 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 475 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 516 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 533 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 687 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 509 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 540 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 396 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 327 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 187 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 459 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 478 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 320 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 696 B

@ -0,0 +1 @@
Subproject commit 144a3f92031d2f69b0276bbc2d2a92998f56d14b

1
mods/minetest-glow Submodule

@ -0,0 +1 @@
Subproject commit 282617852b5c35cec31664bbd091e6f076b871b5