Merge pull request #1 from acmgit/dev

Dev
This commit is contained in:
acmgit 2020-03-23 20:31:23 +01:00 committed by GitHub
commit 5e692cc9ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 253 additions and 395 deletions

View File

@ -1,7 +1,7 @@
# Aqua Farming
A mod for minetest to farm under water.
![Screenshot 1](textures/aqua_farming_screenshot.jpg)
![Screenshot 1](textures/aqua_farming_screenshot_1.jpg)
## Description
@ -9,6 +9,9 @@ Under water is sometimes a little boring. Granted, since minetest 5.x at least c
This mod gives you the possibility to plant and harvest even under water. The special thing about it is that these plants also only thrive under water.
![Screenshot 1](textures/aqua_farming_screenshot_2.jpg)
Now you can create your own garden under water. The plants drops now itself as item and seed's. With this seeds you plant new plants under water. But the plants needs a special substrate: water_soil. So for the first you have to craft water_soil.
## Sea alga
@ -51,4 +54,6 @@ GPL 3.0
default
## optional Depends
hunger_ng
hunger
diet

View File

@ -4,91 +4,36 @@ local step = 6
local light = 10
local del = 10
local chan = 10
local name = "alga"
local name = "aqua_farming: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"}}
},
},
delay = del,
chance = chan,
}, -- sand
local def = {
basenode = "default:sand",
nodename = name,
description = desc,
steps = step,
min_light = light,
delay = del,
chance = chan,
drop = {items = {
{items = {name .. "_item 1"}},
{items = {name .. "_seed 2"}},
{items = {name .. "_item 2", rarity = 10}},
},-- items
}, -- drop
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
} -- def
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
aqua_farming.register_plant(def)
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
}
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
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
minetest.register_craftitem(name .. "_item", {
description = desc,
groups = {food = 1, food_vegan = 1},
inventory_image = "aqua_farming_" .. name .. "_item.png",
groups = {food = 1, food_vegan = 1, seafood = 1},
inventory_image = "aqua_farming_" .. name:split(":")[2] .. "_item.png",
on_use = minetest.item_eat(1),
})
dofile(aqua_farming.modpath .. "/mapgen_" .. name .. ".lua")
dofile(aqua_farming.modpath .. "/mapgen_" .. name:split(":")[2] .. ".lua")
aqua_farming.report(" module " .. name .. ".lua loaded.")

View File

@ -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()
@ -32,6 +32,20 @@ end
aqua_farming.S = S
minetest.register_node("aqua_farming:water_soil", {
description = S("Water Soil"),
tiles = {minetest.registered_nodes["default:silver_sand"].tiles[1] .. "^aqua_farming_water_soil.png", minetest.registered_nodes["default:silver_sand"].tiles[1]},
drop = "default:silver_sand",
groups = {crumbly = 3, falling_node = 1, sand = 1},
sounds = default.node_sound_sand_defaults(),
})
minetest.register_craft({
output = "aqua_farming:water_soil 2",
recipe = {
{"default:gravel", "group:seafood", "group:sand"}
},
})
dofile(aqua_farming.modpath .. "/lib.lua")
dofile(aqua_farming.modpath .. "/alga.lua")

142
lib.lua
View File

@ -4,7 +4,7 @@ function aqua_farming.check_water(pos)
local checkpos = pos
local above = minetest.get_node_or_nil({x = checkpos.x, y = checkpos.y + 2, z = checkpos.z})
if (above ~= nil and above.name == "default:water_source" or above.name == "default:river_water_source") then
if (above ~= nil and (above.name == "default:water_source" or above.name == "default:river_water_source")) then
return true
end -- if(above
@ -15,12 +15,12 @@ end -- aqua_farming.check_water(
function aqua_farming.check_light(pos)
local checkpos = pos
local above = {x = checkpos.x, y = checkpos.y + 1, z = checkpos.z}
local meta = minetest.get_meta(pos)
local meta = minetest.get_meta(checkpos)
local lightlevel = meta:get_int("lightlevel")
local light
if(minetest.get_node_or_nil(above) ~= nil) then
light = minetest.get_node_light({x = checkpos.x, y = checkpos.y + 1, z = checkpos.z})
light = minetest.get_node_light(above)
if(light >= lightlevel) then return true end
end -- if(minetest.get_node_or_nil(
@ -66,15 +66,26 @@ function aqua_farming.register_abm(nodename, newnodename, delay, percent)
end -- function aqua_farming.register_abm
function aqua_farming.register_plant(node_def)
function aqua_farming.plant_seed(node_def, pointed_thing)
if(pointed_thing.type == "node") then
local node = minetest.get_node(minetest.get_pointed_thing_position(pointed_thing, under))
if(node.name == "aqua_farming:water_soil") then
minetest.set_node(pointed_thing.under, {name = node_def.nodename .. "_seed"})
return true
end -- if(node.name
return false
end -- if(pointed_thing.type
if(minetest.registered_nodes[node_def.basenode] == nil) then
aqua_farming.report("Unknown Basenode: " .. node_def.basenode .. ".")
return
end -- if(not minetest_registered_nodes
end
function aqua_farming.register_plant(node_def)
local modname = node_def.nodename:split(":")[1]
local nodename = node_def.nodename:split(":")[2]
if(node_def.steps <= 0 or node_def.steps == nil) then
aqua_farming.report("Node: aqua_farming:" .. node_def.nodename .. " has no steps.")
aqua_farming.report("Node: " .. modname .. ":" .. node_def.nodename .. " has no steps.")
return
end -- if(steps
@ -90,37 +101,53 @@ 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,
tiles = minetest.registered_nodes[node_def.basenode].tiles,
groups = minetest.registered_nodes[node_def.basenode].groups,
minetest.register_node(":" .. modname .. ":" .. nodename .. "_seed", {
description = node_def.description .. " " .. S("Seeds"),
tiles = minetest.registered_nodes["aqua_farming:water_soil"].tiles,
special_tiles = {
{name = modname .. "_" .. nodename .. "_seed.png",tileable_vertical = true},
},
inventory_image = modname .. "_" .. nodename .. "_seed.png",
wield_image = modname .. "_" .. 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(aqua_farming.plant_seed(node_def, pointed_thing)) then
itemstack:take_item()
return itemstack
end
return itemstack
end,
after_dig_node = function(pos, oldnode, oldmetadata, digger)
minetest.set_node(pos, {name = "aqua_farming:water_soil"})
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 = modname .. ":" .. nodename .. "_seed"
next_abm = modname .. ":" .. 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(":" .. modname .. ":".. nodename .. "_" .. step,{
description = node_def.description .. "_" .. step,
drawtype = "plantlike_rooted",
waving = 1,
paramtype = "light",
tiles = minetest.registered_nodes[node_def.basenode].tiles,
tiles = minetest.registered_nodes["aqua_farming:water_soil"].tiles,
special_tiles = {
{name = "aqua_farming_" .. node_def.nodename .. "_" .. step .. ".png",
tileable_vertical = false}
{name = modname .. "_" .. nodename .. "_" .. step .. ".png",
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,31 +159,28 @@ 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 = "aqua_farming:water_soil"})
end,
})
abm_name = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. step
next_abm = "aqua_farming:" .. basename .. "_with_" .. node_def.nodename .. "_" .. step + 1
abm_name = modname .. ":" .. nodename .. "_" .. step
next_abm = modname .. ":" .. 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,
-- Last Plantnode
minetest.register_node(":" .. modname .. ":" .. nodename .. "_" .. node_def.steps,{
description = node_def.description .. "_" .. node_def.steps,
drawtype = "plantlike_rooted",
waving = 1,
paramtype = "light",
tiles = minetest.registered_nodes[node_def.basenode].tiles,
tiles = minetest.registered_nodes["aqua_farming:water_soil"].tiles,
special_tiles = {
{name = "aqua_farming_" .. node_def.nodename .. "_" .. node_def.steps .. ".png",
{name = modname .. "_" .. 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},
groups = {snappy = 3, attached_node = 1, plant = 1, dig_immediate = 1},
sounds = default.node_sound_leaves_defaults(),
drop = node_def.drop,
selection_box = {
@ -166,23 +190,41 @@ 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 = "aqua_farming:water_soil"})
end, -- function
})
-- Wild Plantnode
minetest.register_node(":" .. modname .. ":" .. nodename .. "_wild",{
description = S("Wild") .. " " .. node_def.description,
drawtype = "plantlike_rooted",
waving = 1,
paramtype = "light",
tiles = minetest.registered_nodes[node_def.basenode].tiles,
special_tiles = {
{name = modname .. "_" .. nodename .. "_" .. node_def.steps .. ".png",
tileable_vertical = false}
},
groups = {snappy = 3, attached_node = 1, plant = 1, dig_immediate = 1},
sounds = default.node_sound_leaves_defaults(),
drop = node_def.drop,
selection_box = {
type = "fixed",
fixed = {
--{-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
{-4/16, 0.5, -4/16, 4/16, 1.5, 4/16},
},
},
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)

View File

@ -1,16 +1,21 @@
# textdomain: aqua_farming
### alga.lua ###
Green Alga=Grüne Alge
### init.lua ###
Water Soil=Wassergartenerde
### lib.lua ###
with = mit
Seeds=Samen
Wild=Wilde
### sea_anemone.lua ###
(raw)=(roh)
Sea Anemone=Seeanemone
### sea_grass.lua ###
@ -19,10 +24,4 @@ Sea Grass=Meergras
### sea_strawberry.lua ###
Stem=Stiel
Sea Strawberry=Meeres Erdbeeren
##### not used anymore #####
Sea Strawberry Stem=Meeres Erdbeerstiel

View File

@ -5,12 +5,18 @@
Green Alga=
### init.lua ###
Water Soil=
### lib.lua ###
with =
Seeds=
Wild=
### sea_anemone.lua ###
(raw)=
Sea Anemone=
### sea_grass.lua ###
@ -19,5 +25,4 @@ Sea Grass=
### sea_strawberry.lua ###
Stem=
Sea Strawberry=

View File

@ -1,7 +1,6 @@
-- Green Alga
local step = 6
local name = "alga"
local name = "aqua_farming:alga"
minetest.register_decoration({
deco_type = "simple",
@ -22,9 +21,9 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -70,
flags = "force_placement",
decoration = {"aqua_farming:sand_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})
minetest.register_decoration({
@ -46,9 +45,9 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -70,
flags = "force_placement",
decoration = {"aqua_farming:dirt_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})
@ -71,9 +70,9 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -70,
flags = "force_placement",
decoration = {"aqua_farming:desert_sand_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})
minetest.register_decoration({
@ -95,7 +94,7 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -70,
flags = "force_placement",
decoration = {"aqua_farming:sivler_sand_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})

View File

@ -1,7 +1,6 @@
-- Sea Anemone
local step = 5
local name = "sea_anemone"
local name = "aqua_farming:sea_anemone"
minetest.register_decoration({
deco_type = "simple",
@ -25,9 +24,9 @@ minetest.register_decoration({
"icesheet_ocean",
},
y_max = -5,
y_min = -10,
y_min = -40,
flags = "force_placement",
decoration = "aqua_farming:sand_with_".. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -54,9 +53,9 @@ minetest.register_decoration({
"icesheet_ocean",
},
y_max = -5,
y_min = -10,
y_min = -40,
flags = "force_placement",
decoration = "aqua_farming:silver_sand_".. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -83,9 +82,9 @@ minetest.register_decoration({
"icesheet_ocean",
},
y_max = -5,
y_min = -10,
y_min = -40,
flags = "force_placement",
decoration = "aqua_farming:gravel_".. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -112,9 +111,9 @@ minetest.register_decoration({
"icesheet_ocean",
},
y_max = -5,
y_min = -10,
y_min = -40,
flags = "force_placement",
decoration = "aqua_farming:desert_sand_".. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})

View File

@ -1,7 +1,6 @@
-- Sea Grass
local step = 5
local name = "sea_grass"
local name = "aqua_farming:sea_grass"
minetest.register_decoration({
deco_type = "simple",
@ -25,9 +24,9 @@ minetest.register_decoration({
"sandstone_desert_ocean",
"cold_desert_ocean"},
y_max = -5,
y_min = -10,
y_min = -50,
flags = "force_placement",
decoration = "aqua_farming:sand_with_" .. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -54,9 +53,9 @@ minetest.register_decoration({
"sandstone_desert_ocean",
"cold_desert_ocean"},
y_max = -5,
y_min = -10,
y_min = -50,
flags = "force_placement",
decoration = "aqua_farming:silver_sand_with_" .. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -83,9 +82,9 @@ minetest.register_decoration({
"sandstone_desert_ocean",
"cold_desert_ocean"},
y_max = -5,
y_min = -10,
y_min = -50,
flags = "force_placement",
decoration = "aqua_farming:desert_sand_with_" .. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})
@ -112,9 +111,9 @@ minetest.register_decoration({
"sandstone_desert_ocean",
"cold_desert_ocean"},
y_max = -5,
y_min = -10,
y_min = -50,
flags = "force_placement",
decoration = "aqua_farming:dirt_with_" .. name .. "_" .. step,
decoration = name .. "_wild",
param2 = 48,
param2_max = 96,
})

View File

@ -1,7 +1,6 @@
-- Sea Strawberry
local step = 8
local name = "sea_strawberry"
local name = "aqua_farming:sea_strawberry"
minetest.register_decoration({
deco_type = "simple",
@ -22,9 +21,9 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -30,
flags = "force_placement",
decoration = {"aqua_farming:dry_dirt_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})
minetest.register_decoration({
@ -46,9 +45,9 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -30,
flags = "force_placement",
decoration = {"aqua_farming:dirt_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})
@ -71,7 +70,7 @@ minetest.register_decoration({
"rainforest_ocean",
},
y_max = -2,
y_min = -8,
y_min = -30,
flags = "force_placement",
decoration = {"aqua_farming:dry_dirt_with_" .. name .. "_" .. step},
decoration = {name .. "_wild"},
})

View File

@ -1,95 +1,41 @@
local S = aqua_farming.S
local step = 5
local light = 8
local del = 8
local chan = 5
local name = "sea_anemone"
local light = 8 -- minimum Light needed
local del = 8 -- all 8 Seconds a
local chan = 5 -- Chance of 1 to 5
local name = "aqua_farming: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"}}
},
},
delay = del,
chance = chan,
}, -- sand
local def = {
basenode = "default:gravel",
nodename = name,
description = desc,
steps = step,
min_light = light,
delay = del,
chance = chan,
drop = {items = {
{items = {name .. "_item 2"}},
{items = {name .. "_seed 2"}},
{items = {name .. "_item 3", rarity = 8}},
{items = {name .. "_seed 3", rarity = 10}},
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
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
description = desc,
groups = {food = 1, food_vegan = 1},
inventory_image = "aqua_farming_" .. name .. "_item.png",
minetest.register_craftitem(name .. "_item", {
description = desc .. " " .. S("(raw)"),
groups = {food = 1, food_vegan = 1, seafood = 1},
inventory_image = "aqua_farming_" .. name:split(":")[2] .. "_item.png",
on_use = minetest.item_eat(5),
})
dofile(aqua_farming.modpath .. "/mapgen_" .. name .. ".lua")
aqua_farming.register_plant(def)
dofile(aqua_farming.modpath .. "/mapgen_" .. name:split(":")[2] .. ".lua")
aqua_farming.report(" module " .. name .. ".lua loaded.")

View File

@ -4,90 +4,35 @@ local step = 5
local light = 4
local del = 6
local chan = 10
local name = "sea_grass"
local name = "aqua_farming:sea_grass"
local desc = S("Sea Grass")
local def
def = {
sand = {
basenode = "default:sand",
nodename = name,
description = desc,
steps = step,
min_light = light,
drop = {items = {
{items = {"aqua_farming:" .. name .. "_item"}}
},
},
delay = del,
chance = chan,
}, -- sand
local def = {
basenode = "default:sand",
nodename = name,
description = desc,
steps = step,
min_light = light,
delay = del,
chance = chan,
drop = {items = {
{items = {name .. "_item 1"}},
{items = {name .. "_seed 2"}},
{items = {name .. "_seed 3", rarity = 10}},
}, -- items
}, -- drop
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
} -- def
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
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
}
aqua_farming.register_plant(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
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
minetest.register_craftitem(name .. "_item", {
description = desc,
groups = {food = 1, food_vegan = 1},
inventory_image = "aqua_farming_" .. name .. "_item.png",
groups = {food = 1, food_vegan = 1, seafood = 1},
inventory_image = "aqua_farming_" .. name:split(":")[2] .. "_item.png",
})
dofile(aqua_farming.modpath .. "/mapgen_" .. name .. ".lua")
dofile(aqua_farming.modpath .. "/mapgen_" .. name:split(":")[2] .. ".lua")
aqua_farming.report(" module " .. name .. ".lua loaded.")

View File

@ -4,73 +4,34 @@ local step = 8
local light = 8
local del = 10
local chan = 15
local name = "sea_strawberry"
local name = "aqua_farming:sea_strawberry"
local desc = S("Sea Strawberry")
local def
def = {
dirt = {
basenode = "default:dirt",
nodename = name,
description = desc,
steps = step,
min_light = light,
drop = {items = {
{items = {"aqua_farming:" .. name .. "_stem"}},
{items = {"aqua_farming:" .. name .. "_item 4"}},
},
},
delay = del,
chance = chan,
}, -- dirt
dry_dirt = {
basenode = "default:dry_dirt",
nodename = name,
description = desc,
steps = step,
min_light = light,
drop = {items = {
{items = {"aqua_farming:" .. name .. "_stem"}},
{items = {"aqua_farming:" .. name .. "_item 4"}},
},
},
delay = del,
chance = chan,
}, -- dry_dirt
local def = {
basenode = "default:dirt",
nodename = name,
description = desc,
steps = step,
min_light = light,
delay = del,
chance = chan,
drop = {items = {
{items = {name .. "_seed 2"}},
{items = {name .. "_item 4"}},
{items = {name .. "_seed 3", rarity = 15}},
},
},
} -- def
}
aqua_farming.register_plant(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:" .. name .. "_stem"},
},
})
end
minetest.register_craftitem("aqua_farming:" .. name .. "_item", {
minetest.register_craftitem(name .. "_item", {
description = desc,
groups = {food = 1, food_vegan = 1},
inventory_image = "aqua_farming_" .. name .. "_item.png",
groups = {food = 1, food_vegan = 1, seafood = 1},
inventory_image = "aqua_farming_" .. name:split(":")[2] .. "_item.png",
on_use = minetest.item_eat(3),
})
minetest.register_craftitem("aqua_farming:" .. name .. "_stem", {
description = desc .. S(" Stem"),
groups = {food = 1, food_vegan = 1},
inventory_image = "aqua_farming_" .. name .. "_stem.png",
})
dofile(aqua_farming.modpath .. "/mapgen_" .. name .. ".lua")
dofile(aqua_farming.modpath .. "/mapgen_" .. name:split(":")[2] .. ".lua")
aqua_farming.report(" module " .. name .. ".lua loaded.")

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B