Initial commit
							
								
								
									
										34
									
								
								README.md
									
									
									
									
									
								
							
							
						
						@ -1,2 +1,32 @@
 | 
			
		||||
# canned_food
 | 
			
		||||
Canned fruits/vegetables, and jams for Minetest game
 | 
			
		||||
# Canned Food
 | 
			
		||||
 | 
			
		||||
This mod introduces a variety of canned foods to add some pleasant variety into the available
 | 
			
		||||
assrtment of foods and item uses. It relies on the glass bottle from the default vessels mod,
 | 
			
		||||
giving this otherwise little used item a considerable purpose.
 | 
			
		||||
 | 
			
		||||
All products are defined by shapless recipes, and yield items which can be placed in the
 | 
			
		||||
real world. Although the cans with non-symmetrical items on labels look good only from
 | 
			
		||||
half of the angles.
 | 
			
		||||
 | 
			
		||||
The recipes follow the scheme of "glass bottle" + "produce" [ + "sugar" ]
 | 
			
		||||
 | 
			
		||||
The default 4 items do not require sugar, even though 3 of those are jams and probably 
 | 
			
		||||
would taste horribly IRL without sugar:
 | 
			
		||||
* Apple jam
 | 
			
		||||
* Canned brown mushrooms
 | 
			
		||||
* Rose petal jam
 | 
			
		||||
* Dandelion jam
 | 
			
		||||
 | 
			
		||||
This is to guarantee that they will always be available in vanilla game. As you can notice,
 | 
			
		||||
canning also turns two othwerise inedible objects into food.
 | 
			
		||||
 | 
			
		||||
Ethereal and farming (redo) mods introduce items that can be canned, too. 
 | 
			
		||||
Some of them (jams) require sugar as the third ingredient. So some of them require both mods.
 | 
			
		||||
 | 
			
		||||
The mason jars with canned food can be put into vessel storage shelves. Or put on display 
 | 
			
		||||
just like the glass vessels can, and destroyed by hand (retreiving the item).
 | 
			
		||||
 | 
			
		||||
The benefit of canning the food is higher nutritional value (since shelf life is irrelevant
 | 
			
		||||
in minetest game, where food never goes bad), this is a "reward" for going through effort
 | 
			
		||||
to obtain the glass vessels. When the contents of the jasr are consumed, 
 | 
			
		||||
the player is left with an empty glass bottle which can be reused.
 | 
			
		||||
							
								
								
									
										5
									
								
								depends.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,5 @@
 | 
			
		||||
default
 | 
			
		||||
vessels
 | 
			
		||||
flowers
 | 
			
		||||
ethereal?
 | 
			
		||||
farming?
 | 
			
		||||
							
								
								
									
										248
									
								
								init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						@ -0,0 +1,248 @@
 | 
			
		||||
-- CANNED FOOD
 | 
			
		||||
-- Introduces new food types to add some variety. All of them rely on glass bottles
 | 
			
		||||
-- from the default vessels mod, which otherwise sees very little use. In vanilla game,
 | 
			
		||||
-- at least 4 new types will be available, two of which will also turn inedible items
 | 
			
		||||
-- into edible food. With farming (redo) and ethereal, pretty much anything that can
 | 
			
		||||
-- be harvested can also be canned.
 | 
			
		||||
 | 
			
		||||
--[[
 | 
			
		||||
    Definition scheme
 | 
			
		||||
	internal_name_of_the_product = {
 | 
			
		||||
		proper_name = Human-readable name,
 | 
			
		||||
		found_in = mod name where the source object is introduced
 | 
			
		||||
		obj_name = name of source object (internal, without "modname:")
 | 
			
		||||
		orig_nutritional_value = self-explanatory
 | 
			
		||||
		amount = how many objects are needed to fill a bottle /not implemented/
 | 
			
		||||
		sugar = boolean, set if needs sugar (jams) or not
 | 
			
		||||
	}
 | 
			
		||||
	image files for items must follow the scheme "internal_name_of_the_product.png"
 | 
			
		||||
]]
 | 
			
		||||
 | 
			
		||||
local canned_food_definitions = {
 | 
			
		||||
	apple_jam = {
 | 
			
		||||
		proper_name = "Apple jam",
 | 
			
		||||
		found_in = "default",
 | 
			
		||||
		obj_name = "apple",
 | 
			
		||||
		orig_nutritional_value = 2,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false -- must not use sugar to be available in vanilla
 | 
			
		||||
	},
 | 
			
		||||
	dandelion_jam = {
 | 
			
		||||
		proper_name = "Dandelion jam",
 | 
			
		||||
		found_in = "flowers",
 | 
			
		||||
		obj_name = "dandelion_yellow",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = false -- must not use sugar to be available in vanilla
 | 
			
		||||
	},
 | 
			
		||||
	rose_jam = {
 | 
			
		||||
		proper_name = "Rose petal jam",
 | 
			
		||||
		found_in = "flowers",
 | 
			
		||||
		obj_name = "rose",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = false -- must not use sugar to be available in vanilla
 | 
			
		||||
	},
 | 
			
		||||
	canned_mushrooms = {
 | 
			
		||||
		proper_name = "Canned mushrooms",
 | 
			
		||||
		found_in = "flowers",
 | 
			
		||||
		obj_name = "mushroom_brown",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	orange_jam = {
 | 
			
		||||
		proper_name = "Orange jam",
 | 
			
		||||
		found_in = "ethereal",
 | 
			
		||||
		obj_name = "orange",
 | 
			
		||||
		orig_nutritional_value = 2,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	banana_jam = {
 | 
			
		||||
		proper_name = "Banana jam",
 | 
			
		||||
		found_in = "ethereal",
 | 
			
		||||
		obj_name = "banana",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	strawberry_jam = {
 | 
			
		||||
		proper_name = "Strawberry jam",
 | 
			
		||||
		found_in = "ethereal",
 | 
			
		||||
		obj_name = "strawberry",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	blueberry_jam = {
 | 
			
		||||
		proper_name = "Blueberry jam",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "blueberries",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 6,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	raspberry_jam = {
 | 
			
		||||
		proper_name = "Raspberry jam",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "raspberries",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 6,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	grape_jam = {
 | 
			
		||||
		proper_name = "Grape jam",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "grapes",
 | 
			
		||||
		orig_nutritional_value = 2,
 | 
			
		||||
		amount = 4,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	rhubarb_jam = {
 | 
			
		||||
		proper_name = "Rhubarb jam",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "rhubarb",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 6,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	melon_jam = {
 | 
			
		||||
		proper_name = "Melon jam",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "melon_slice",
 | 
			
		||||
		orig_nutritional_value = 2,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = true
 | 
			
		||||
	},
 | 
			
		||||
	canned_carrot = {
 | 
			
		||||
		proper_name = "Canned carrots",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "carrot",
 | 
			
		||||
		orig_nutritional_value = 4,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
-- 	canned_potato = {
 | 
			
		||||
-- 		proper_name = "Canned potatoes",
 | 
			
		||||
-- 		found_in = "farming",
 | 
			
		||||
-- 		obj_name = "potato",
 | 
			
		||||
-- 		orig_nutritional_value = 1,
 | 
			
		||||
-- 		amount = 5,
 | 
			
		||||
-- 		sugar = false
 | 
			
		||||
-- 	},
 | 
			
		||||
	canned_cucumber = {
 | 
			
		||||
		-- aka pickles
 | 
			
		||||
		proper_name = "Pickles",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "cucumber",
 | 
			
		||||
		orig_nutritional_value = 4,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	canned_tomato = {
 | 
			
		||||
		proper_name = "Canned tomatoes",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "tomato",
 | 
			
		||||
		orig_nutritional_value = 4,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	canned_corn = {
 | 
			
		||||
		proper_name = "Canned corn",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "corn",
 | 
			
		||||
		orig_nutritional_value = 3,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	canned_beans = {
 | 
			
		||||
		proper_name = "Canned beans",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "beans",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 6,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	canned_coconut = {
 | 
			
		||||
		proper_name = "Canned coconut",
 | 
			
		||||
		found_in = "ethereal",
 | 
			
		||||
		obj_name = "coconut_slice",
 | 
			
		||||
		orig_nutritional_value = 1,
 | 
			
		||||
		amount = 5,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
	canned_pumpkin = {
 | 
			
		||||
		proper_name = "Canned pumpkin puree",
 | 
			
		||||
		found_in = "farming",
 | 
			
		||||
		obj_name = "pumpkin_slice",
 | 
			
		||||
		orig_nutritional_value = 2,
 | 
			
		||||
		amount = 3,
 | 
			
		||||
		sugar = false
 | 
			
		||||
	},
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- creating all objects with one universal scheme
 | 
			
		||||
for product, def in pairs(canned_food_definitions) do
 | 
			
		||||
	if minetest.get_modpath(def.found_in) then
 | 
			
		||||
		if def.sugar and minetest.get_modpath("farming") or not def.sugar then
 | 
			
		||||
			
 | 
			
		||||
			-- introducing a new item, a bit more nutricious than the source 
 | 
			
		||||
			-- material when sugar is used.
 | 
			
		||||
			minetest.register_node("canned_food:" .. product, {
 | 
			
		||||
				description = def.proper_name,
 | 
			
		||||
				drawtype = "plantlike",
 | 
			
		||||
				tiles = {product .. ".png"},
 | 
			
		||||
				inventory_image = product .. ".png",
 | 
			
		||||
				wield_image = product .. ".png",
 | 
			
		||||
				paramtype = "light",
 | 
			
		||||
				is_ground_content = false,
 | 
			
		||||
				walkable = false,
 | 
			
		||||
				selection_box = {
 | 
			
		||||
					type = "fixed",
 | 
			
		||||
					fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
 | 
			
		||||
				},
 | 
			
		||||
				groups = { canned_food = 1, 
 | 
			
		||||
			                 vessel = 1, 
 | 
			
		||||
			                 dig_immediate = 3, 
 | 
			
		||||
			                 attached_node = 1 },
 | 
			
		||||
				-- canned food prolongs shelf life IRL, but in minetest food never
 | 
			
		||||
				-- goes bad. Instead, we will reward the effort with 2x higher
 | 
			
		||||
				-- nutritional value, even if that's not realistic.
 | 
			
		||||
				-- when (and if) the 'amount' could be taken into account, the 
 | 
			
		||||
				-- rate could also be adjusted
 | 
			
		||||
				on_use = minetest.item_eat(
 | 
			
		||||
						math.floor (def.orig_nutritional_value * 2)
 | 
			
		||||
						+ (def.sugar and 1 or 0), "vessels:glass_bottle"),
 | 
			
		||||
				-- the empty bottle stays, of course
 | 
			
		||||
				sounds = default.node_sound_glass_defaults(),
 | 
			
		||||
			})
 | 
			
		||||
			
 | 
			
		||||
			-- a family of shapeless recipes, with sugar for jams
 | 
			
		||||
			-- except for apple: there should be at least 1 jam guaranteed
 | 
			
		||||
			-- to be available in vanilla game (and mushrooms are the guaranteed
 | 
			
		||||
			-- regular - not sweet - canned food)
 | 
			
		||||
			if def.sugar then
 | 
			
		||||
				minetest.register_craft({
 | 
			
		||||
					type = "shapeless",
 | 
			
		||||
					output = "canned_food:" .. product,
 | 
			
		||||
					recipe = {"vessels:glass_bottle", "farming:sugar",
 | 
			
		||||
						def.found_in .. ":" .. def.obj_name},
 | 
			
		||||
				})
 | 
			
		||||
			else 
 | 
			
		||||
				minetest.register_craft({
 | 
			
		||||
					type = "shapeless",
 | 
			
		||||
					output = "canned_food:" .. product,
 | 
			
		||||
					recipe = {"vessels:glass_bottle", 
 | 
			
		||||
						def.found_in .. ":" .. def.obj_name},
 | 
			
		||||
				})
 | 
			
		||||
			end
 | 
			
		||||
		end
 | 
			
		||||
	end
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
-- The Moor has done his duty, the Moor can go
 | 
			
		||||
canned_food_definitions = nil
 | 
			
		||||
							
								
								
									
										
											BIN
										
									
								
								textures/#example_apple.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								textures/apple_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 695 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/banana_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 809 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/blueberry_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 630 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_beans.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 675 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_carrot.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 755 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_coconut.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 700 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_corn.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 760 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_cucumber.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 681 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_mushrooms.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 606 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_pumpkin.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 786 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/canned_tomato.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 852 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/dandelion_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 547 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/grape_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 737 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/melon_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 783 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/orange_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 792 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/raspberry_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 772 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/rhubarb_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 674 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/rose_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 573 B  | 
							
								
								
									
										
											BIN
										
									
								
								textures/strawberry_jam.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| 
		 After Width: | Height: | Size: 1002 B  |