out source some code to farming_crafting
parent
08e88b5172
commit
8c3e69e180
|
@ -21,15 +21,17 @@ farming.plant_infect = function(pos)
|
|||
local meta = minetest.get_meta(pos)
|
||||
local toremove=false
|
||||
if meta:get_int("farming:healthiness") then
|
||||
local healthiness=meta:get_int("farming:healthiness")
|
||||
-- check for nearby plants which can protect against infections
|
||||
for i=1,3 do
|
||||
local protplant=minetest.find_node_near(pos,i,"group:infection_defense")
|
||||
if protplant ~= nil then
|
||||
ppdef=minetest.get_node(protplant)
|
||||
-- the protection plant has to be within their defined radius
|
||||
if ppdef.groups.infection_defense >= i then
|
||||
healthiness=healthiness+i*10
|
||||
local healthiness=tonumber(meta:get_int("farming:healthiness"))
|
||||
if healthiness ~= nil then
|
||||
-- check for nearby plants which can protect against infections
|
||||
for i=1,3 do
|
||||
local protplant=minetest.find_node_near(pos,i,"group:infection_defense")
|
||||
if protplant ~= nil then
|
||||
ppdef=minetest.get_node(protplant)
|
||||
-- the protection plant has to be within their defined radius
|
||||
if ppdef.groups.infection_defense >= i then
|
||||
healthiness=healthiness+i*10
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
46
coffee.lua
46
coffee.lua
|
@ -1,46 +0,0 @@
|
|||
local S = farming.intllib
|
||||
|
||||
-- cold cup of coffee
|
||||
minetest.register_node("farming:grain_coffee_cup", {
|
||||
description = S("Cup of Grain Coffee"),
|
||||
drawtype = "torchlike", --"plantlike",
|
||||
tiles = {"farming_coffee_cup.png"},
|
||||
inventory_image = "farming_coffee_cup.png",
|
||||
wield_image = "farming_coffee_cup.png",
|
||||
paramtype = "light",
|
||||
walkable = false,
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.25, 0.25}
|
||||
},
|
||||
groups = {vessel = 1, dig_immediate = 3, attached_node = 1},
|
||||
on_use = minetest.item_eat(2, "vessels:drinking_glass"),
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
})
|
||||
|
||||
minetest.register_alias("farming:grain_coffee_cup_hot", "farming:grain_coffee_cup")
|
||||
|
||||
minetest.register_craft( {
|
||||
output = "farming:grain_coffee_cup",
|
||||
type = "shapeless",
|
||||
recipe = {"vessels:drinking_glass", "group:food_grain_powder",
|
||||
"bucket:bucket_water", "group:food_saucepan"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
{"group:food_saucepan", "farming:saucepan"},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:grain_coffee", {
|
||||
description = S("Grain Coffee"),
|
||||
inventory_image = "farming_roasted_powder.png",
|
||||
groups = {food_grain_powder = 1, flammable = 2},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:grain_coffee",
|
||||
recipe = {
|
||||
"group:food_grain_roasted", "group:food_grain_roasted", "farming:coffee_grinder"
|
||||
},
|
||||
replacements = {{"group:food_coffee_grinder", "farming:coffee_grinder"}},
|
||||
})
|
102
craft.lua
102
craft.lua
|
@ -33,22 +33,6 @@ minetest.register_craft({
|
|||
},
|
||||
replacements = {{modname..":mortar_pestle_highlevel", modname..":mortar_pestle_highlevel"}},
|
||||
})
|
||||
|
||||
|
||||
minetest.register_craftitem("farming:bread", {
|
||||
description = "Bread",
|
||||
inventory_image = "farming_bread.png",
|
||||
on_use = minetest.item_eat(5),
|
||||
groups = {food_bread = 1, flammable = 2},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:bread",
|
||||
recipe = "farming:flour"
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:flour", {
|
||||
description = "Flour",
|
||||
inventory_image = "farming_flour.png",
|
||||
|
@ -56,15 +40,6 @@ minetest.register_craftitem("farming:flour", {
|
|||
})
|
||||
|
||||
|
||||
-- function to drink item on use with fallback to eat if thirsty mod not available
|
||||
local drink_or_eat = function(hp_change,replace_with_item,itemstack,user,pointed_thing)
|
||||
if minetest.get_modpath("thirsty") ~= nil then
|
||||
thirsty.drink(user,3*hp_change)
|
||||
else
|
||||
minetest.do_item_eat(hp_change,replace_with_item,itemstack,user,pointed_thing)
|
||||
end
|
||||
end
|
||||
|
||||
if basic_functions.has_value(modlist,"vessels") and basic_functions.has_value(modlist,"bucket") then
|
||||
minetest.register_craftitem(modname..":nettle_water",{
|
||||
description = "Nettle Water",
|
||||
|
@ -77,85 +52,8 @@ if basic_functions.has_value(modlist,"vessels") and basic_functions.has_value(mo
|
|||
recipe={"vessels:glass_bottle","bucket:bucket_water",modname..":nettle"},
|
||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
|
||||
})
|
||||
minetest.register_craft( {
|
||||
output = modname..":grain_coffee_cup 3",
|
||||
type = "shapeless",
|
||||
recipe = {"vessels:drinking_glass","vessels:drinking_glass","vessels:drinking_glass", "group:food_grain_powder",
|
||||
"bucket:bucket_water"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
}
|
||||
})
|
||||
minetest.register_craft( {
|
||||
output = modname..":coffee_cup",
|
||||
type = "shapeless",
|
||||
recipe = {"vessels:drinking_glass", "group:food_powder",
|
||||
"bucket:bucket_water"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
}
|
||||
})
|
||||
minetest.register_craftitem("farming:grain_coffee_cup", {
|
||||
description = "Grain Coffee",
|
||||
inventory_image = "farming_coffee_cup.png",
|
||||
on_use = function(itemstack,user,pointed_thing)
|
||||
drink_or_eat(2,"vessels:drinking_glass",itemstack,user,pointed_thing)
|
||||
end,
|
||||
groups = {coffee = 1, flammable = 1, beverage=1},
|
||||
})
|
||||
minetest.register_craftitem("farming:grain_coffee_cup_hot", {
|
||||
description = "Grain Coffee hot",
|
||||
inventory_image = "farming_coffee_cup_hot.png",
|
||||
on_use = function(itemstack,user,pointed_thing)
|
||||
drink_or_eat(4,"vessels:drinking_glass",itemstack,user,pointed_thing)
|
||||
end,
|
||||
groups = {coffee = 2, flammable = 1, beverage=2},
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 2,
|
||||
output = "farming:grain_coffee_cup_hot",
|
||||
recipe = "farming:grain_coffee_cup"
|
||||
})
|
||||
minetest.register_craftitem("farming:grain_milk", {
|
||||
description = "Grain Milk",
|
||||
inventory_image = "farming_grain_milk.png",
|
||||
on_use = function(itemstack,user,pointed_thing)
|
||||
drink_or_eat(5,"vessels:drinking_glass",itemstack,user,pointed_thing)
|
||||
end,
|
||||
groups = {flammable = 1, beverage=1},
|
||||
})
|
||||
minetest.register_craft( {
|
||||
output = modname..":grain_milk 3",
|
||||
type = "shapeless",
|
||||
recipe = {"vessels:drinking_glass","vessels:drinking_glass","vessels:drinking_glass", "farming:flour",
|
||||
"bucket:bucket_water"},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
}
|
||||
})
|
||||
else
|
||||
print("Mod vessels/bucket not available. Seriously? -> no COFFEE!")
|
||||
end
|
||||
|
||||
if basic_functions.has_value(modlist,"wool") then
|
||||
minetest.register_craft({
|
||||
output="wool:white",
|
||||
type="shapeless",
|
||||
recipe={"farming:cotton","farming:cotton","farming:cotton","farming:cotton"},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output="wool:dark_green",
|
||||
type="shapeless",
|
||||
recipe={"farming:nettle_fibre","farming:nettle_fibre","farming:nettle_fibre","farming:nettle_fibre"},
|
||||
})
|
||||
minetest.register_craft({
|
||||
output="wool:dark_green",
|
||||
type="shapeless",
|
||||
recipe={"farming:hemp_fibre","farming:hemp_fibre","farming:hemp_fibre","farming:hemp_fibre"},
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = "fuel",
|
||||
|
|
194
food.lua
194
food.lua
|
@ -1,194 +0,0 @@
|
|||
|
||||
local S = farming.intllib
|
||||
|
||||
--= Sugar
|
||||
|
||||
minetest.register_craftitem("farming:sugar", {
|
||||
description = S("Sugar"),
|
||||
inventory_image = "farming_sugar.png",
|
||||
groups = {food_sugar = 1, flammable = 3},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 3,
|
||||
output = "farming:sugar 2",
|
||||
recipe = "default:papyrus",
|
||||
})
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 2,
|
||||
output = "farming:sugar 3",
|
||||
recipe = "default:sugarbeet_seed",
|
||||
})
|
||||
|
||||
|
||||
--= Salt
|
||||
|
||||
minetest.register_node("farming:salt", {
|
||||
description = ("Salt"),
|
||||
inventory_image = "farming_salt.png",
|
||||
wield_image = "farming_salt.png",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 0.8,
|
||||
paramtype = "light",
|
||||
tiles = {"farming_salt.png"},
|
||||
groups = {food_salt = 1, vessel = 1, dig_immediate = 3,
|
||||
attached_node = 1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "cooking",
|
||||
cooktime = 15,
|
||||
output = "farming:salt",
|
||||
recipe = "bucket:bucket_water",
|
||||
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}}
|
||||
})
|
||||
|
||||
--= Rose Water
|
||||
|
||||
minetest.register_node("farming:rose_water", {
|
||||
description = ("Rose Water"),
|
||||
inventory_image = "farming_rose_water.png",
|
||||
wield_image = "farming_rose_water.png",
|
||||
drawtype = "plantlike",
|
||||
visual_scale = 0.8,
|
||||
paramtype = "light",
|
||||
tiles = {"farming_rose_water.png"},
|
||||
groups = {food_rose_water = 1, vessel = 1, dig_immediate = 3,
|
||||
attached_node = 1},
|
||||
sounds = default.node_sound_defaults(),
|
||||
selection_box = {
|
||||
type = "fixed",
|
||||
fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
|
||||
},
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:rose_water",
|
||||
recipe = {
|
||||
{"flowers:rose", "flowers:rose", "flowers:rose"},
|
||||
{"flowers:rose", "flowers:rose", "flowers:rose"},
|
||||
{"bucket:bucket_water", "group:food_pot", "vessels:glass_bottle"},
|
||||
},
|
||||
replacements = {
|
||||
{"bucket:bucket_water", "bucket:bucket_empty"},
|
||||
{"group:food_pot", "farming:pot"},
|
||||
}
|
||||
})
|
||||
|
||||
--= Turkish Delight
|
||||
|
||||
minetest.register_craftitem("farming:turkish_delight", {
|
||||
description = S("Turkish Delight"),
|
||||
inventory_image = "farming_turkish_delight.png",
|
||||
groups = {flammable = 3},
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:turkish_delight 4",
|
||||
recipe = {
|
||||
{"group:food_gelatin", "group:food_sugar", "group:food_gelatin"},
|
||||
{"group:food_sugar", "group:food_rose_water", "group:food_sugar"},
|
||||
{"group:food_cornstarch", "group:food_sugar", "dye:pink"},
|
||||
},
|
||||
replacements = {
|
||||
{"group:food_cornstarch", "farming:bowl"},
|
||||
{"group:food_rose_water", "vessels:glass_bottle"},
|
||||
},
|
||||
})
|
||||
|
||||
--= Garlic Bread
|
||||
|
||||
minetest.register_craftitem("farming:garlic_bread", {
|
||||
description = S("Garlic Bread"),
|
||||
inventory_image = "farming_garlic_bread.png",
|
||||
groups = {flammable = 3},
|
||||
on_use = minetest.item_eat(2),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:garlic_bread",
|
||||
recipe = {"group:food_toast", "group:food_garlic_clove", "group:food_garlic_clove"},
|
||||
})
|
||||
|
||||
--= Donuts (thanks to Bockwurst for making the donut images)
|
||||
|
||||
minetest.register_craftitem("farming:donut", {
|
||||
description = S("Donut"),
|
||||
inventory_image = "farming_donut.png",
|
||||
on_use = minetest.item_eat(4),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:donut 3",
|
||||
recipe = {
|
||||
{"", "group:food_wheat", ""},
|
||||
{"group:food_wheat", "group:food_sugar", "group:food_wheat"},
|
||||
{"", "group:food_wheat", ""},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:donut_chocolate", {
|
||||
description = S("Chocolate Donut"),
|
||||
inventory_image = "farming_donut_chocolate.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:donut_chocolate",
|
||||
recipe = {
|
||||
{'group:food_cocoa'},
|
||||
{'farming:donut'},
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_craftitem("farming:donut_apple", {
|
||||
description = S("Apple Donut"),
|
||||
inventory_image = "farming_donut_apple.png",
|
||||
on_use = minetest.item_eat(6),
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "farming:donut_apple",
|
||||
recipe = {
|
||||
{'default:apple'},
|
||||
{'farming:donut'},
|
||||
}
|
||||
})
|
||||
|
||||
--= Porridge Oats
|
||||
|
||||
minetest.register_craftitem("farming:porridge", {
|
||||
description = S("Porridge"),
|
||||
inventory_image = "farming_porridge.png",
|
||||
on_use = minetest.item_eat(6, "farming:bowl"),
|
||||
})
|
||||
|
||||
minetest.after(0, function()
|
||||
|
||||
local fluid = "bucket:bucket_water"
|
||||
local fluid_return = "bucket:bucket_water"
|
||||
|
||||
if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then
|
||||
fluid = "group:food_milk"
|
||||
fluid_return = "mobs:bucket_milk"
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = "farming:porridge",
|
||||
recipe = {
|
||||
"group:food_barley", "group:food_barley", "group:food_wheat",
|
||||
"group:food_wheat", "group:food_bowl", fluid
|
||||
},
|
||||
replacements = {{fluid_return, "bucket:bucket_empty"}}
|
||||
})
|
||||
end)
|
1
init.lua
1
init.lua
|
@ -26,7 +26,6 @@ dofile(farming.path .. "/tools.lua") --define tools
|
|||
dofile(farming.path .. "/utensils.lua") -- utensils like grinder
|
||||
dofile(farming.path .. "/craft.lua") -- some craft definitions
|
||||
dofile(farming.path .. "/crops.lua") -- loading definition of crop and register
|
||||
dofile(farming.path .. "/food.lua") -- several foods out of crops
|
||||
dofile(farming.path .. "/abm.lua") -- abm functions
|
||||
|
||||
-- replacement LBM for pre-nodetimer plants
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 252 B |
Binary file not shown.
Before Width: | Height: | Size: 248 B |
Binary file not shown.
Before Width: | Height: | Size: 252 B |
Binary file not shown.
Before Width: | Height: | Size: 192 B |
Binary file not shown.
Before Width: | Height: | Size: 181 B |
Loading…
Reference in New Issue