diff options
| author | h-v-smacker <hans-von-smacker+github@gmail.com> | 2017-12-04 15:16:06 +0300 | 
|---|---|---|
| committer | h-v-smacker <hans-von-smacker+github@gmail.com> | 2017-12-04 15:16:06 +0300 | 
| commit | a3a8c00172ea975b887d5f5dbee51168fbf8790e (patch) | |
| tree | 3ffc048168826a53cc77defee0d4490315bab3d2 | |
| parent | f7bb9aafe9c88901acb38de1d6c7854348e9ea29 (diff) | |
New cooking mechanism
| -rw-r--r-- | init.lua | 103 | ||||
| -rw-r--r-- | textures/canned_chili_pepper.png | bin | 0 -> 579 bytes | |||
| -rw-r--r-- | textures/canned_onion.png | bin | 0 -> 677 bytes | |||
| -rw-r--r-- | textures/canned_potato.png | bin | 0 -> 789 bytes | |||
| -rw-r--r-- | textures/paper_lid_cover.png | bin | 0 -> 254 bytes | 
5 files changed, 89 insertions, 14 deletions
| @@ -14,6 +14,7 @@  		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 +		transforms = name of the product it turns into if left on a shelf  	}  	image files for items must follow the scheme "internal_name_of_the_product.png"  ]] @@ -49,7 +50,8 @@ local canned_food_definitions = {  		obj_name = "flowers:mushroom_brown",  		orig_nutritional_value = 1,  		amount = 5, -		sugar = false +		sugar = false, +		transforms = "Salted mushrooms"  	},  	orange_jam = {  		proper_name = "Orange jam", @@ -75,6 +77,15 @@ local canned_food_definitions = {  		amount = 5,  		sugar = true  	}, +	canned_onion = { +		proper_name = "Canned onions", +		found_in = "ethereal", +		obj_name = "ethereal:wild_onion_plant", +		orig_nutritional_value = 2, +		amount = 4, +		sugar = false, +		transforms = "Pickled onions" +	},  	blueberry_jam = {  		proper_name = "Blueberry jam",  		found_in = "farming", @@ -121,24 +132,28 @@ local canned_food_definitions = {  		obj_name = "farming:carrot",  		orig_nutritional_value = 4,  		amount = 3, -		sugar = false +		sugar = false, +		transforms = "Pickled carrot sticks" +	}, +	canned_potato = { +		proper_name = "Canned potatoes", +		found_in = "farming", +		obj_name = "farming:potato", +		orig_nutritional_value = 1, +		amount = 5, +		sugar = false, +		-- a rare thing, apparently +		transforms = "Mexican pickled potatoes"  	}, --- 	canned_potato = { --- 		proper_name = "Canned potatoes", --- 		found_in = "farming", --- 		obj_name = "farming:potato", --- 		orig_nutritional_value = 1, --- 		amount = 5, --- 		sugar = false --- 	},  	canned_cucumber = { -		-- aka pickles -		proper_name = "Pickles", +		proper_name = "Canned cucumbers",  		found_in = "farming",  		obj_name = "farming:cucumber",  		orig_nutritional_value = 4,  		amount = 3, -		sugar = false +		sugar = false, +		-- one just cannot simply make the pickles +		transforms = "Pickles"  	},  	canned_tomato = {  		proper_name = "Canned tomatoes", @@ -146,7 +161,8 @@ local canned_food_definitions = {  		obj_name = "farming:tomato",  		orig_nutritional_value = 4,  		amount = 3, -		sugar = false +		sugar = false, +		transforms = "Marinated tomatoes"  	},  	canned_corn = {  		proper_name = "Canned corn", @@ -164,6 +180,15 @@ local canned_food_definitions = {  		amount = 6,  		sugar = false  	}, +	canned_chili_pepper = { +		proper_name = "Canned chili pepper", +		found_in = "farming", +		obj_name = "farming:chili_pepper", +		orig_nutritional_value = 1, +		amount = 6, +		sugar = false, +		transforms = "Pickled chili pepper" +	},  	canned_coconut = {  		proper_name = "Canned coconut",  		found_in = "ethereal", @@ -195,6 +220,7 @@ local canned_food_definitions = {  -- 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 minetest.global_exists(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  @@ -225,6 +251,55 @@ for product, def in pairs(canned_food_definitions) do  				sounds = default.node_sound_glass_defaults(),  			}) +			-- Some products involve marinating or salting, however there is no salt +			-- or vingerar in minetest; instead we imitate this more complex process +			-- by putting the jar on a wooden shelf in a dark room for a long while. +			-- The effort is rewarded accordingly. +			if (def.transforms) then +				 +				minetest.register_node("canned_food:" .. product .."_plus", { +					description = def.transforms, +					drawtype = "plantlike", +					tiles = {product .. ".png^paper_lid_cover.png"}, +					inventory_image = product .. ".png^paper_lid_cover.png", +					wield_image = product .. ".png^paper_lid_cover.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, +						not_in_creative_inventory = 1 }, +					-- the reward for putting the food in a cellar is even greater  +					-- than for merely canning it. +					on_use = minetest.item_eat( +							(math.floor(def.orig_nutritional_value * def.amount * 0.33) +							+ (def.sugar and 1 or 0))*2, "vessels:glass_bottle"), +					-- the empty bottle stays, of course +					sounds = default.node_sound_glass_defaults(), +				}) +				 +				minetest.register_abm ({ +					label = def.proper_name .. " transformation", +					nodenames = {"canned_food:" .. product}, +					neighbors = {"group:wood"}, +					-- chances might need tweaking though +					interval = 180, +					chance = 10, +					action = function(pos) +						if minetest.get_node_light(pos) < 11 then +							minetest.set_node(pos, {name = "canned_food:" .. product .."_plus"}) +						end +					end, +				}) +				 +			end +			  			-- 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 diff --git a/textures/canned_chili_pepper.png b/textures/canned_chili_pepper.pngBinary files differ new file mode 100644 index 0000000..497a3d2 --- /dev/null +++ b/textures/canned_chili_pepper.png diff --git a/textures/canned_onion.png b/textures/canned_onion.pngBinary files differ new file mode 100644 index 0000000..d1c7ba4 --- /dev/null +++ b/textures/canned_onion.png diff --git a/textures/canned_potato.png b/textures/canned_potato.pngBinary files differ new file mode 100644 index 0000000..901a7b6 --- /dev/null +++ b/textures/canned_potato.png diff --git a/textures/paper_lid_cover.png b/textures/paper_lid_cover.pngBinary files differ new file mode 100644 index 0000000..f68a5ec --- /dev/null +++ b/textures/paper_lid_cover.png | 
