Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions cooking.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
--[[

Copyright (C) 2015 - Auke Kok <sofar@foo-projects.org>
2018 - Marius Spix <marius.spix@web.de>

"crops" is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
Expand All @@ -27,7 +28,6 @@ minetest.register_craftitem("crops:unbaked_clay_bowl", {
minetest.register_craft({
output = "crops:unbaked_clay_bowl",
recipe = {
{ "", "", "" },
{ "default:clay_lump", "", "default:clay_lump" },
{ "", "default:clay_lump", "" }
}
Expand Down Expand Up @@ -68,8 +68,36 @@ minetest.register_craftitem("crops:uncooked_vegetable_stew", {
minetest.register_craft({
output = "crops:uncooked_vegetable_stew",
recipe = {
{ "", "", "" },
{ "crops:green_bean", "crops:potato", "crops:tomato" },
{ "", "group:food_bowl", "" }
}
})

minetest.register_craftitem("crops:ratatouille", {
description = S("Bowl of ratatouille"),
inventory_image = "crops_bowl_ratatouille.png",
groups = { eatable=1 },
on_use = minetest.item_eat(10, "crops:clay_bowl"),
})

minetest.register_craft({
type = "cooking",
output = "crops:ratatouille",
recipe = "crops:uncooked_ratatouille",
cooktime = 15
})

minetest.register_craftitem("crops:uncooked_ratatouille", {
description = S("Bowl of uncooked ratatouille"),
inventory_image = "crops_bowl_uncooked_ratatouille.png",
groups = { eatable=1 },
on_use = minetest.item_eat(2, "crops:clay_bowl")
})

minetest.register_craft({
output = "crops:uncooked_ratatouille",
recipe = {
{ "crops:pumpkin", "crops:eggfruit", "crops:tomato" },
{ "", "group:food_bowl", "" }
}
})
2 changes: 1 addition & 1 deletion description.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This mod expands the basic set of farming-related crops that minetest_game offers. It adds melons, potatoes, tomatoes, green beans and corn. The mod also implements plant humidity - you will have to water plants to make sure they're not dried out, or make sure they don't get over-watered.
This mod expands the basic set of farming-related crops that minetest_game offers. It adds melons, potatoes, tomatoes, eggfruit, green beans and corn. The mod also implements plant humidity - you will have to water plants to make sure they're not dried out, or make sure they don't get over-watered.

Mod specific settings can be changed in the "crops_settings.txt" file in the world folder.

Expand Down
171 changes: 171 additions & 0 deletions eggfruit.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@

--[[

Copyright (C) 2015 - Auke Kok <sofar@foo-projects.org>
Comment thread
SmallJoker marked this conversation as resolved.
2018 - Marius Spix <marius.spix@web.de>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine, but, you didn't claim or license the PNG files in the LICENSE file. This is required - make sure to document the origin of all the textures and choose an appropriate license (if it's the same license as the other images, perfect. If it's not, we can discuss)


"crops" is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
published by the Free Software Foundation; either version 2.1
of the license, or (at your option) any later version.

--]]

-- Intllib
local S = crops.intllib

minetest.register_node("crops:eggfruit_seed", {
description = S("Eggfruit seed"),
inventory_image = "crops_eggfruit_seed.png",
wield_image = "crops_eggfruit_seed.png",
tiles = { "crops_eggfruit_plant_1.png" },
drawtype = "plantlike",
paramtype2 = "meshoptions",
waving = 1,
sunlight_propagates = true,
use_texture_alpha = true,
walkable = false,
paramtype = "light",
node_placement_prediction = "crops:eggfruit_plant_1",
groups = { snappy=3,flammable=3,flora=1,attached_node=1 },
drop = {},
sounds = default.node_sound_leaves_defaults(),

on_place = function(itemstack, placer, pointed_thing)
local under = minetest.get_node(pointed_thing.under)
if minetest.get_item_group(under.name, "soil") <= 1 then
return
end
crops.plant(pointed_thing.above, {name="crops:eggfruit_plant_1", param2 = 1})
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()
end
return itemstack
end
})

for stage = 1, 7 do
local node_def =
{
description = S("Eggfruit plant"),
tiles = { "crops_eggfruit_plant_" .. stage .. ".png" },
drawtype = "plantlike",
paramtype2 = "meshoptions",
waving = 1,
sunlight_propagates = true,
use_texture_alpha = true,
walkable = false,
paramtype = "light",
groups = { snappy=3, flammable=3, flora=1, attached_node=1, not_in_creative_inventory=1 },
drop = {},
sounds = default.node_sound_leaves_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.45, -0.5, -0.45, 0.45, -0.6 + (((math.min(stage, 5)) + 1) / 6), 0.45}
}
}

if stage == 6 then
node_def.on_dig = function(pos, node, digger)
local drops = {}
for i = 1, math.random(1, 2) do
table.insert(drops, "crops:eggfruit")
end
core.handle_node_drops(pos, drops, digger)

local meta = minetest.get_meta(pos)
local ttl = meta:get_int("crops_eggfruit_ttl")
if ttl > 1 then
minetest.swap_node(pos, { name = "crops:eggfruit_plant_4", param2 = 1})
meta:set_int("crops_eggfruit_ttl", ttl - 1)
else
crops.die(pos)
end
end
end

minetest.register_node("crops:eggfruit_plant_" .. stage , node_def)
end

minetest.register_craftitem("crops:eggfruit", {
description = S("Eggfruit"),
inventory_image = "crops_eggfruit.png",
on_use = minetest.item_eat(1)
})

minetest.register_craft({
type = "shapeless",
output = "crops:eggfruit_seed",
recipe = { "crops:eggfruit" }
})

--
-- grows a plant to mature size
--
minetest.register_abm({
nodenames = { "crops:eggfruit_plant_1", "crops:eggfruit_plant_2", "crops:eggfruit_plant_3",
"crops:eggfruit_plant_4" },
neighbors = { "group:soil" },
interval = crops.settings.interval,
chance = crops.settings.chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if not crops.can_grow(pos) then
return
end
local n = string.gsub(node.name, "5", "6")
n = string.gsub(n, "4", "5")
n = string.gsub(n, "3", "4")
n = string.gsub(n, "2", "3")
n = string.gsub(n, "1", "2")
minetest.swap_node(pos, { name = n, param2 = 1 })
end
})

--
-- grows an eggfruit
--
minetest.register_abm({
nodenames = { "crops:eggfruit_plant_5" },
neighbors = { "group:soil" },
interval = crops.settings.interval,
chance = crops.settings.chance,
action = function(pos, node, active_object_count, active_object_count_wider)
if not crops.can_grow(pos) then
return
end
local meta = minetest.get_meta(pos)
local ttl = meta:get_int("crops_eggfruit_ttl")
local damage = meta:get_int("crops_damage")
if ttl == 0 then
-- damage 0 - drops 4-5
-- damage 50 - drops 2-3
-- damage 100 - drops 0-1
ttl = math.random(4 - (4 * (damage / 100)), 5 - (4 * (damage / 100)))
end
if ttl > 1 then
minetest.swap_node(pos, { name = "crops:eggfruit_plant_6", param2 = 1 })
meta:set_int("crops_eggfruit_ttl", ttl)
else
crops.die(pos)
end
end
})

crops.eggfruit_die = function(pos)
minetest.swap_node(pos, { name = "crops:eggfruit_plant_7", param2 = 1 })
end

local properties = {
die = crops.eggfruit_die,
waterstart = 20,
wateruse = 1,
night = 5,
soak = 84,
soak_damage = 70,
wither = 15,
wither_damage = 10,
}

for stage = 1, 6 do
crops.register({ name = "crops:eggfruit_plant_" .. stage, properties = properties })
end
7 changes: 5 additions & 2 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ crops.plant = function(pos, node)
minetest.set_node(pos, node)
local meta = minetest.get_meta(pos)
local plant = find_plant(node)
meta:set_int("crops_water", math.max(plant.properties.waterstart, 1))
meta:set_int("crops_damage", 0)
if plant ~= nil then
meta:set_int("crops_water", math.max(plant.properties.waterstart, 1))
meta:set_int("crops_damage", 0)
end
end

crops.can_grow = function(pos)
Expand Down Expand Up @@ -304,6 +306,7 @@ dofile(modpath .. "/corn.lua")
dofile(modpath .. "/tomato.lua")
dofile(modpath .. "/potato.lua")
dofile(modpath .. "/polebean.lua")
dofile(modpath .. "/eggfruit.lua")

local nodenames = {}
for i = 1,table.getn(crops.plants) do
Expand Down
55 changes: 37 additions & 18 deletions locale/de.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-04-30 08:37+0200\n"
"PO-Revision-Date: 2017-02-20 16:54-0300\n"
"Last-Translator: LNJ2\n"
"PO-Revision-Date: 2018-12-0901 20:16+0100\n"
"Last-Translator: Marius Spix <marius.spix@web.de>\n"
"Language-Team: German\n"
"Language: de\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 2.1.1\n"

#: cooking.lua
msgid "Unbaked clay bowl"
Expand All @@ -28,11 +28,19 @@ msgstr "Lehmschale"

#: cooking.lua
msgid "Bowl of vegetable stew"
msgstr "Schale voll Gemseeintopf"
msgstr "Schale voll Gemüseeintopf"

#: cooking.lua
msgid "Bowl of uncooked vegetable stew"
msgstr "Schale voll mit roher Gemseeintopf"
msgstr "Schale voll mit rohem Gemüseeintopf"

#: cooking.lua
msgid "Bowl of ratatouille"
msgstr "Schale voll Ratatouille"

#: cooking.lua
msgid "Bowl of uncooked ratatouille"
msgstr "Schale voll mit roher Ratatouille"

#: corn.lua
msgid "Corn"
Expand All @@ -52,20 +60,19 @@ msgstr "Maispflanze"

#: init.lua
msgid "Defaulting to \"normal\" difficulty settings"
msgstr "Benutze standard Schwierigkeitsgrad \"normal\""
msgstr "Benutze Standard-Schwierigkeitsgrad \"normal\""

#: init.lua
msgid "Hydration and dehydration mechanics are enabled."
msgstr "Hydrierungs- und Dehydrierungsmechaniken sind aktiviert."

#: init.lua
#, fuzzy
msgid "Unable to find plant \"@1\" in crops table"
msgstr "Konnte Pflanze \"@1\" nicht in der Tabelle finden"
msgstr "Konnte Pflanze \"@1\" nicht in der Saatguttabelle finden"

#: init.lua
msgid "Loaded!"
msgstr ""
msgstr "Geladen!"

#: melon.lua
msgid "Melon seed"
Expand All @@ -85,19 +92,19 @@ msgstr "Melone"

#: polebean.lua
msgid "Green Bean"
msgstr "Grne Bohne"
msgstr "Grüne Bohne"

#: polebean.lua
msgid "Beanpoles"
msgstr "Bohnenstangen"

#: polebean.lua
msgid "Green bean seed"
msgstr "Samen einer Grnen Bohne"
msgstr "Samen einer Grünen Bohne"

#: polebean.lua
msgid "Green Bean plant"
msgstr "Grne Bohnenpflanze"
msgstr "Grüne Bohnenpflanze"

#: potato.lua
msgid "Potato eyes"
Expand All @@ -117,19 +124,19 @@ msgstr "Acker mit Kartoffeln"

#: pumpkin.lua
msgid "Pumpkin seed"
msgstr "Krbissamen"
msgstr "Kürbissamen"

#: pumpkin.lua
msgid "Pumpkin plant"
msgstr "Krbispflanze"
msgstr "Kürbispflanze"

#: pumpkin.lua
msgid "Roasted pumpkin"
msgstr "Gersteter Krbis"
msgstr "Gerösteter Kürbis"

#: pumpkin.lua
msgid "Pumpkin"
msgstr "Krbis"
msgstr "Kürbis"

#: tomato.lua
msgid "Tomato seed"
Expand All @@ -139,13 +146,25 @@ msgstr "Tomatensamen"
msgid "Tomato plant"
msgstr "Tomatenpflanze"

#: eggfruit.lua
msgid "Eggfruit"
msgstr "Aubergine"

#: eggfruit.lua
msgid "Eggfruit seed"
msgstr "Auberginensamen"

#: eggfruit.lua
msgid "Eggfruit plant"
msgstr "Auberginenpflanze"

#: tomato.lua
msgid "Tomato"
msgstr "Tomate"

#: tools.lua
msgid "Watering Can"
msgstr "Giekanne"
msgstr "Gießkanne"

#: tools.lua
msgid "Hydrometer"
Expand Down
Binary file added locale/es.mo
Binary file not shown.
Loading