added garlic, onion and pepper thanks to Grizzly Adams

This commit is contained in:
TenPlus1 2018-01-22 15:01:43 +00:00
parent 1b71f29fbe
commit dd697625ab
29 changed files with 305 additions and 1 deletions

View File

@ -13,6 +13,7 @@ This mod works by adding your new plant to the {growing=1} group and numbering t
Changelog:
1.30 - Added Garlic, Pepper and Onions thanks to Grizzly Adam for sharing textures
1.29 - Updating functions so requires Minetest 0.4.16 and above to run
1.28 - Added chili peppers and bowl of chili, optimized code and fixed a few bugs, added porridge
1.27 - Added meshoptions to api and wheat plants, added farming.rarity setting to spawn more/less crops on map, have separate cotton/string items (4x cotton = 1x wool, 2x cotton = 2x string)

View File

@ -25,6 +25,9 @@ farming.grapes = true
farming.barley = true
farming.chili = true
farming.hemp = true
farming.onion = true
farming.garlic = true
farming.pepper = true
farming.donuts = true
-- rarety of crops on map, default is 0.006 (higher number = more crops)

128
garlic.lua Normal file
View File

@ -0,0 +1,128 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:garlic_clove", {
description = S("Garlic clove"),
inventory_image = "crops_garlic_clove.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:garlic_1")
end,
})
-- garlic bulb
minetest.register_craftitem("farming:garlic", {
description = S("Garlic"),
inventory_image = "crops_garlic.png",
on_use = minetest.item_eat(1),
groups = {garlic = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:garlic_clove 9",
recipe = { "farming:garlic" }
})
minetest.register_craft({
output = "farming:garlic",
recipe = {
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"},
{"farming:garlic_clove", "farming:garlic_clove", "farming:garlic_clove"}
}
})
-- garlic braid
minetest.register_node("farming:garlic_braid", {
description = S("Garlic Braid"),
inventory_image = "crops_garlic_braid.png",
wield_image = "crops_garlic_braid.png",
drawtype = "nodebox",
paramtype = "light",
paramtype2 = "facedir",
tiles = {
"crops_garlic_braid_side.png","crops_garlic_braid.png",
"crops_garlic_braid_side.png^[transformFx","crops_garlic_braid_side.png",
"crops_garlic_braid.png","crops_garlic_braid.png"
},
groups = {vessel = 1, dig_immediate = 3},
sounds = default.node_sound_leaves_defaults(),
node_box = {
type = "fixed",
fixed = {
{-0.13, -0.45, 0.5, 0.13, 0.45, 0.24,
},
},
}
})
minetest.register_craft({
output = "farming:garlic_braid",
recipe = {
{"farming:garlic", "farming:garlic", "farming:garlic"},
{"farming:garlic", "farming:garlic", "farming:garlic"},
{"farming:garlic", "farming:garlic", "farming:garlic"}
}
})
minetest.register_craft({
type = "shapeless",
output = "farming:garlic 9",
recipe = { "farming:garlic_braid" }
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
tiles = {"crops_garlic_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:garlic_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_garlic_plant_2.png"}
minetest.register_node("farming:garlic_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_garlic_plant_3.png"}
minetest.register_node("farming:garlic_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_garlic_plant_4.png"}
minetest.register_node("farming:garlic_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_garlic_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 5, items = {
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 1},
{items = {'farming:garlic'}, rarity = 2},
{items = {'farming:garlic'}, rarity = 5},
}
}
minetest.register_node("farming:garlic_5", table.copy(crop_def))

View File

@ -7,7 +7,7 @@
farming = {}
farming.mod = "redo"
farming.version = "1.29"
farming.version = "1.30"
farming.path = minetest.get_modpath("farming")
farming.select = {
type = "fixed",
@ -595,6 +595,9 @@ farming.grapes = true
farming.barley = true
farming.chili = true
farming.hemp = true
farming.garlic = true
farming.onion = true
farming.pepper = true
farming.donuts = true
farming.rarety = 0.006
@ -646,6 +649,9 @@ if farming.barley then dofile(farming.path.."/barley.lua") end
if farming.chili then dofile(farming.path.."/chili.lua") end
if farming.hemp then dofile(farming.path.."/hemp.lua") end
if farming.donuts then dofile(farming.path.."/donut.lua") end
if farming.garlic then dofile(farming.path.."/garlic.lua") end
if farming.onion then dofile(farming.path.."/onion.lua") end
if farming.pepper then dofile(farming.path.."/pepper.lua") end
dofile(farming.path.."/mapgen.lua")
dofile(farming.path.."/compatibility.lua") -- Farming Plus compatibility

67
onion.lua Normal file
View File

@ -0,0 +1,67 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- potato
minetest.register_craftitem("farming:onion", {
description = S("Onion"),
inventory_image = "crops_onion.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:onion_1")
end,
on_use = minetest.item_eat(1),
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
tiles = {"crops_onion_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 3,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:onion_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_onion_plant_2.png"}
minetest.register_node("farming:onion_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_onion_plant_3.png"}
minetest.register_node("farming:onion_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_onion_plant_4.png"}
minetest.register_node("farming:onion_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_onion_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 5, items = {
{items = {'farming:onion'}, rarity = 1},
{items = {'farming:onion'}, rarity = 1},
{items = {'farming:onion'}, rarity = 1},
{items = {'farming:onion'}, rarity = 2},
{items = {'farming:onion'}, rarity = 5},
}
}
minetest.register_node("farming:onion_5", table.copy(crop_def))

99
pepper.lua Normal file
View File

@ -0,0 +1,99 @@
--[[
Original textures from Crops Plus mod
Copyright (C) 2018 Grizzly Adam
https://forum.minetest.net/viewtopic.php?f=9&t=19488
]]
local S = farming.intllib
-- peppercorn (seed)
minetest.register_craftitem("farming:peppercorn", {
description = S("Peppercorn"),
inventory_image = "crops_peppercorn.png",
on_place = function(itemstack, placer, pointed_thing)
return farming.place_seed(itemstack, placer, pointed_thing, "farming:pepper_1")
end,
})
-- green pepper
minetest.register_craftitem("farming:pepper", {
description = S("Pepper"),
inventory_image = "crops_pepper.png",
on_use = minetest.item_eat(2),
groups = {pepper = 1},
})
minetest.register_craft({
type = "shapeless",
output = "farming:peppercorn",
recipe = { "farming:pepper" }
})
-- ground pepper
minetest.register_node("farming:pepper_ground", {
description = ("Ground Pepper"),
inventory_image = "crops_pepper_ground.png",
wield_image = "crops_pepper_ground.png",
drawtype = "plantlike",
paramtype = "light",
tiles = {"crops_pepper_ground.png"},
groups = {vessel = 1, pepper_ground = 1, dig_immediate = 3, attached_node = 1},
sounds = default.node_sound_glass_defaults(),
selection_box = {
type = "fixed",
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
},
})
minetest.register_craft( {
output = "farming:pepper_ground",
type = "shapeless",
recipe = {"farming:peppercorn", "vessels:glass_bottle"}
})
-- crop definition
local crop_def = {
drawtype = "plantlike",
tiles = {"crops_pepper_plant_1.png"},
paramtype = "light",
paramtype2 = "meshoptions",
place_param2 = 1,
sunlight_propagates = true,
waving = 1,
walkable = false,
buildable_to = true,
drop = "",
selection_box = farming.select,
groups = {
snappy = 3, flammable = 3, flora = 1, attached_node = 1,
not_in_creative_inventory = 1, growing = 1
},
sounds = default.node_sound_leaves_defaults()
}
-- stage 1
minetest.register_node("farming:pepper_1", table.copy(crop_def))
-- stage 2
crop_def.tiles = {"crops_pepper_plant_2.png"}
minetest.register_node("farming:pepper_2", table.copy(crop_def))
-- stage 3
crop_def.tiles = {"crops_pepper_plant_3.png"}
minetest.register_node("farming:pepper_3", table.copy(crop_def))
-- stage 4
crop_def.tiles = {"crops_pepper_plant_4.png"}
minetest.register_node("farming:pepper_4", table.copy(crop_def))
-- stage 5
crop_def.tiles = {"crops_pepper_plant_5.png"}
crop_def.groups.growing = 0
crop_def.drop = {
max_items = 2, items = {
{items = {'farming:pepper'}, rarity = 1},
{items = {'farming:pepper'}, rarity = 2},
}
}
minetest.register_node("farming:pepper_5", table.copy(crop_def))

BIN
textures/crops_garlic.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 725 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 462 B

BIN
textures/crops_onion.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 841 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 652 B

BIN
textures/crops_pepper.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 441 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 299 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 220 B