Test with seeds.
This commit is contained in:
parent
f612208a72
commit
8ad2995de3
85
alga.lua
85
alga.lua
@ -7,80 +7,27 @@ local chan = 10
|
||||
local name = "alga"
|
||||
local desc = S("Green Alga")
|
||||
|
||||
local def
|
||||
def = {
|
||||
sand = {
|
||||
basenode = "default:sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
local def = {
|
||||
basenode = "default:sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
delay = del,
|
||||
chance = chan,
|
||||
drop = {items = {
|
||||
{
|
||||
items = {"aqua_farming:" .. name .. "_item 1"},
|
||||
items = {"aqua_farming:" .. name .. "_seed 2"},
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- sand
|
||||
|
||||
desert_sand = {
|
||||
basenode = "default:desert_sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- desert_sand
|
||||
}, -- items
|
||||
|
||||
silver_sand = {
|
||||
basenode = "default:silver_sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- silver_sand
|
||||
}, -- drop
|
||||
|
||||
dirt = {
|
||||
basenode = "default:dirt",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- dirt
|
||||
}
|
||||
} -- def
|
||||
|
||||
local basename
|
||||
|
||||
for _,value in pairs(def) do
|
||||
aqua_farming.register_plant(value)
|
||||
|
||||
basename = aqua_farming.get_nodename(value.basenode)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "aqua_farming:" .. basename .. "_with_" .. value.nodename,
|
||||
recipe = {
|
||||
{value.basenode, "aqua_farming:" .. value.nodename .. "_item"},
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
aqua_farming.register_plant(def)
|
||||
|
||||
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
|
||||
description = desc,
|
||||
|
6
init.lua
6
init.lua
@ -15,7 +15,7 @@
|
||||
aqua_farming = {}
|
||||
|
||||
aqua_farming.ver = 1
|
||||
aqua_farming.rev = 0
|
||||
aqua_farming.rev = 1
|
||||
|
||||
aqua_farming.modpath = minetest.get_modpath(minetest.get_current_modname())
|
||||
aqua_farming.modname = minetest.get_current_modname()
|
||||
@ -35,8 +35,8 @@ aqua_farming.S = S
|
||||
|
||||
dofile(aqua_farming.modpath .. "/lib.lua")
|
||||
dofile(aqua_farming.modpath .. "/alga.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_strawberry.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_grass.lua")
|
||||
--dofile(aqua_farming.modpath .. "/sea_strawberry.lua")
|
||||
--dofile(aqua_farming.modpath .. "/sea_grass.lua")
|
||||
dofile(aqua_farming.modpath .. "/sea_anemone.lua")
|
||||
dofile(aqua_farming.modpath .. "/support_mods.lua")
|
||||
|
||||
|
80
lib.lua
80
lib.lua
@ -68,11 +68,6 @@ end -- function aqua_farming.register_abm
|
||||
|
||||
function aqua_farming.register_plant(node_def)
|
||||
|
||||
if(minetest.registered_nodes[node_def.basenode] == nil) then
|
||||
aqua_farming.report("Unknown Basenode: " .. node_def.basenode .. ".")
|
||||
return
|
||||
end -- if(not minetest_registered_nodes
|
||||
|
||||
if(node_def.steps <= 0 or node_def.steps == nil) then
|
||||
aqua_farming.report("Node: aqua_farming:" .. node_def.nodename .. " has no steps.")
|
||||
return
|
||||
@ -90,37 +85,57 @@ function aqua_farming.register_plant(node_def)
|
||||
|
||||
end -- if(min_light > light_max
|
||||
|
||||
local basename = aqua_farming.get_nodename(node_def.basenode)
|
||||
local base_description = minetest.registered_nodes[node_def.basenode].description
|
||||
|
||||
minetest.register_node("aqua_farming:" .. basename .. "_with_" .. node_def.nodename, {
|
||||
description = base_description .. S(" with ") .. node_def.description,
|
||||
minetest.register_node("aqua_farming:" .. node_def.nodename .. "_seed", {
|
||||
description = node_def.description .. " " .. S("Seeds"),
|
||||
tiles = minetest.registered_nodes[node_def.basenode].tiles,
|
||||
groups = minetest.registered_nodes[node_def.basenode].groups,
|
||||
special_tiles = {
|
||||
{name = "aqua_farming_" .. node_def.nodename .. "_seed.png",},
|
||||
},
|
||||
inventory_image = "aqua_farming_" .. node_def.nodename .. "_seed.png",
|
||||
wield_image = "aqua_farming_" .. node_def.nodename .. "_seed.png",
|
||||
groups = {dig_immediate = 3, attached_node = 1},
|
||||
after_place_node = function(pos, placer, itemstack, pointed_thing)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_int("lightlevel", min_light)
|
||||
end,
|
||||
on_place = function(itemstack, placer, pointed_thing)
|
||||
if(pointed_thing.type == "node") then
|
||||
local node = minetest.get_node(minetest.get_pointed_thing_position(pointed_thing, under))
|
||||
if(node.name == node_def.basenode) then
|
||||
minetest.set_node(pointed_thing.under, {name = "aqua_farming:" .. node_def.nodename .. "_seed"})
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
|
||||
end -- if(node.name
|
||||
|
||||
end -- if(pointed_thing.type
|
||||
|
||||
end, -- function
|
||||
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
minetest.set_node(pos, {name = node_def.basenode})
|
||||
|
||||
end, -- function
|
||||
|
||||
})
|
||||
|
||||
local abm_name, next_abm
|
||||
abm_name = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename
|
||||
next_abm = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_1"
|
||||
abm_name = "aqua_farming:" .. node_def.nodename .. "_seed"
|
||||
next_abm = "aqua_farming:" .. node_def.nodename .. "_1"
|
||||
aqua_farming.register_abm(abm_name, next_abm, node_def.delay, node_def.chance)
|
||||
|
||||
for step = 1, node_def.steps - 1 do
|
||||
|
||||
minetest.register_node("aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. step,{
|
||||
description = basename .. S(" with ") .. node_def.description .. "_" .. step,
|
||||
minetest.register_node("aqua_farming:".. node_def.nodename .. "_" .. step,{
|
||||
description = node_def.description .. "_" .. step,
|
||||
drawtype = "plantlike_rooted",
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
tiles = minetest.registered_nodes[node_def.basenode].tiles,
|
||||
special_tiles = {
|
||||
{name = "aqua_farming_" .. node_def.nodename .. "_" .. step .. ".png",
|
||||
tileable_vertical = false}
|
||||
tileable_vertical = false},
|
||||
},
|
||||
inventory_image = "aqua_farming_" .. node_def.nodename .. "_" .. step .. ".png",
|
||||
groups = {not_in_creative_inventory=1, snappy = 3, growing = 1, attached_node = 1, plant = 1, dig_immediate = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = {},
|
||||
@ -132,21 +147,18 @@ function aqua_farming.register_plant(node_def)
|
||||
},
|
||||
},
|
||||
after_destruct = function(pos, oldnode)
|
||||
local meta
|
||||
minetest.swap_node(pos, {name = "aqua_farming:".. basename .. "_with_" .. node_def.nodename})
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:set_int("lightlevel", min_light)
|
||||
minetest.set_node(pos, {name = node_def.basenode})
|
||||
end,
|
||||
})
|
||||
|
||||
abm_name = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. step
|
||||
next_abm = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. step + 1
|
||||
abm_name = "aqua_farming:" .. node_def.nodename .. "_" .. step
|
||||
next_abm = "aqua_farming:" .. node_def.nodename .. "_" .. step + 1
|
||||
aqua_farming.register_abm(abm_name, next_abm, node_def.delay, node_def.chance)
|
||||
|
||||
end -- for step
|
||||
|
||||
minetest.register_node("aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. node_def.steps,{
|
||||
description = node_def.description,
|
||||
minetest.register_node("aqua_farming:" .. node_def.nodename .. "_" .. node_def.steps,{
|
||||
description = node_def.description .. "_" .. node_def.steps,
|
||||
drawtype = "plantlike_rooted",
|
||||
waving = 1,
|
||||
paramtype = "light",
|
||||
@ -155,7 +167,6 @@ function aqua_farming.register_plant(node_def)
|
||||
{name = "aqua_farming_" .. node_def.nodename .. "_" .. node_def.steps .. ".png",
|
||||
tileable_vertical = false}
|
||||
},
|
||||
inventory_image = "aqua_farming_" .. node_def.nodename .. "_" .. node_def.steps .. ".png",
|
||||
groups = {snappy = 3, growing = 1, attached_node = 1, plant = 1, dig_immediate = 1},
|
||||
sounds = default.node_sound_leaves_defaults(),
|
||||
drop = node_def.drop,
|
||||
@ -166,23 +177,14 @@ function aqua_farming.register_plant(node_def)
|
||||
{-4/16, 0.5, -4/16, 4/16, 1.5, 4/16},
|
||||
},
|
||||
},
|
||||
after_destruct = function(pos, oldnode)
|
||||
local meta
|
||||
minetest.swap_node(pos, {name = "aqua_farming:".. basename .. "_with_" .. node_def.nodename})
|
||||
meta = minetest.get_meta(pos)
|
||||
meta:set_int("lightlevel", min_light)
|
||||
end,
|
||||
after_dig_node = function(pos, oldnode, oldmetadata, digger)
|
||||
minetest.set_node(pos, {name = node_def.basenode})
|
||||
|
||||
end, -- function
|
||||
})
|
||||
|
||||
end -- function register_plant
|
||||
|
||||
function aqua_farming.get_nodename(nodename)
|
||||
local find = string.find(nodename, ":")
|
||||
|
||||
return string.sub(nodename, find + 1)
|
||||
|
||||
end -- get_nodename
|
||||
|
||||
function aqua_farming.report(text)
|
||||
print("[MOD] aqua_farming: " .. text)
|
||||
minetest.log("info", "[MOD] aqua_farming: " .. text)
|
||||
|
@ -27,7 +27,7 @@ minetest.register_decoration({
|
||||
y_max = -5,
|
||||
y_min = -10,
|
||||
flags = "force_placement",
|
||||
decoration = "aqua_farming:sand_with_".. name .. "_" .. step,
|
||||
decoration = "aqua_farming:" .. name .. "_" .. step,
|
||||
param2 = 48,
|
||||
param2_max = 96,
|
||||
})
|
||||
@ -56,7 +56,7 @@ minetest.register_decoration({
|
||||
y_max = -5,
|
||||
y_min = -10,
|
||||
flags = "force_placement",
|
||||
decoration = "aqua_farming:silver_sand_".. name .. "_" .. step,
|
||||
decoration = "aqua_farming:" .. name .. "_" .. step,
|
||||
param2 = 48,
|
||||
param2_max = 96,
|
||||
})
|
||||
@ -85,7 +85,7 @@ minetest.register_decoration({
|
||||
y_max = -5,
|
||||
y_min = -10,
|
||||
flags = "force_placement",
|
||||
decoration = "aqua_farming:gravel_".. name .. "_" .. step,
|
||||
decoration = "aqua_farming:" .. name .. "_" .. step,
|
||||
param2 = 48,
|
||||
param2_max = 96,
|
||||
})
|
||||
@ -114,7 +114,7 @@ minetest.register_decoration({
|
||||
y_max = -5,
|
||||
y_min = -10,
|
||||
flags = "force_placement",
|
||||
decoration = "aqua_farming:desert_sand_".. name .. "_" .. step,
|
||||
decoration = "aqua_farming:" .. name .. "_" .. step,
|
||||
param2 = 48,
|
||||
param2_max = 96,
|
||||
})
|
||||
|
@ -1,87 +1,35 @@
|
||||
local S = aqua_farming.S
|
||||
|
||||
local step = 5
|
||||
local light = 8
|
||||
local del = 8
|
||||
local chan = 5
|
||||
local light = 8 -- minimum Light needed
|
||||
local del = 8 -- all 8 Seconds a
|
||||
local chan = 5 -- Chance of 1 to 5
|
||||
local name = "sea_anemone"
|
||||
local desc = S("Sea Anemone")
|
||||
|
||||
local def
|
||||
def = {
|
||||
sand = {
|
||||
basenode = "default:sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
local def = {
|
||||
basenode = "default:gravel",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
delay = del,
|
||||
chance = chan,
|
||||
drop = {items = {
|
||||
{
|
||||
items = {"aqua_farming:" .. name .. "_item 2"},
|
||||
items = {"aqua_farming:" .. name .. "_seed 2"},
|
||||
items = {"aqua_farming:" .. name .. "_item 3", rarity = 8},
|
||||
items = {"aqua_farming:" .. name .. "_seed 3", rarity = 10},
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- sand
|
||||
|
||||
desert_sand = {
|
||||
basenode = "default:desert_sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- desert_sand
|
||||
}, -- items
|
||||
|
||||
silver_sand = {
|
||||
basenode = "default:silver_sand",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- silver_sand
|
||||
}, -- drop
|
||||
|
||||
gravel = {
|
||||
basenode = "default:gravel",
|
||||
nodename = name,
|
||||
description = desc,
|
||||
steps = step,
|
||||
min_light = light,
|
||||
drop = {items = {
|
||||
{items = {"aqua_farming:" .. name .. "_item"}}
|
||||
},
|
||||
},
|
||||
delay = del,
|
||||
chance = chan,
|
||||
}, -- gravel
|
||||
} -- def
|
||||
|
||||
}
|
||||
|
||||
local basename
|
||||
|
||||
for _,value in pairs(def) do
|
||||
aqua_farming.register_plant(value)
|
||||
|
||||
basename = aqua_farming.get_nodename(value.basenode)
|
||||
|
||||
minetest.register_craft({
|
||||
output = "aqua_farming:" .. basename .. "_with_" .. value.nodename,
|
||||
recipe = {
|
||||
{value.basenode, "aqua_farming:" .. value.nodename .. "_item"},
|
||||
},
|
||||
})
|
||||
|
||||
end
|
||||
aqua_farming.register_plant(def)
|
||||
|
||||
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
|
||||
description = desc,
|
||||
|
BIN
textures/aqua_farming_alga_seed.png
Normal file
BIN
textures/aqua_farming_alga_seed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
BIN
textures/aqua_farming_sea_anemone_seed.png
Normal file
BIN
textures/aqua_farming_sea_anemone_seed.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 118 B |
Loading…
x
Reference in New Issue
Block a user