mirror of
				https://codeberg.org/tenplus1/farming.git
				synced 2025-10-26 12:15:31 +01:00 
			
		
		
		
	separate food /non-food items from crop files, tidy code
This commit is contained in:
		| @@ -1,8 +1,8 @@ | ||||
|  | ||||
| local S = farming.translate | ||||
| local a = farming.recipe_items | ||||
| local S = minetest.get_translator("farming") | ||||
|  | ||||
| -- item/seed | ||||
|  | ||||
| -- raspberries | ||||
| minetest.register_craftitem("farming:raspberries", { | ||||
| 	description = S("Raspberries"), | ||||
| 	inventory_image = "farming_raspberries.png", | ||||
| @@ -10,34 +10,17 @@ minetest.register_craftitem("farming:raspberries", { | ||||
| 		compostability = 48, seed = 2, food_raspberries = 1, food_raspberry = 1, | ||||
| 		food_berry = 1 | ||||
| 	}, | ||||
| 	on_use = minetest.item_eat(1), | ||||
|  | ||||
| 	on_place = function(itemstack, placer, pointed_thing) | ||||
| 		return farming.place_seed(itemstack, placer, pointed_thing, "farming:raspberry_1") | ||||
| 	end, | ||||
| 	on_use = minetest.item_eat(1) | ||||
| 	end | ||||
| }) | ||||
|  | ||||
| farming.add_eatable("farming:raspberries", 1) | ||||
|  | ||||
| -- raspberry smoothie | ||||
| minetest.register_craftitem("farming:smoothie_raspberry", { | ||||
| 	description = S("Raspberry Smoothie"), | ||||
| 	inventory_image = "farming_raspberry_smoothie.png", | ||||
| 	on_use = minetest.item_eat(2, "vessels:drinking_glass"), | ||||
| 	groups = {vessel = 1, drink = 1, compostability = 65} | ||||
| }) | ||||
| -- crop definition | ||||
|  | ||||
| farming.add_eatable("farming:smoothie_raspberry", 2) | ||||
|  | ||||
| minetest.register_craft({ | ||||
| 	output = "farming:smoothie_raspberry", | ||||
| 	recipe = { | ||||
| 		{a.snow}, | ||||
| 		{"group:food_raspberries"}, | ||||
| 		{a.drinking_glass} | ||||
| 	} | ||||
| }) | ||||
|  | ||||
| -- raspberries definition | ||||
| local def = { | ||||
| 	drawtype = "plantlike", | ||||
| 	tiles = {"farming_raspberry_1.png"}, | ||||
| @@ -57,17 +40,21 @@ local def = { | ||||
| } | ||||
|  | ||||
| -- stage 1 | ||||
|  | ||||
| minetest.register_node("farming:raspberry_1", table.copy(def)) | ||||
|  | ||||
| -- stage 2 | ||||
|  | ||||
| def.tiles = {"farming_raspberry_2.png"} | ||||
| minetest.register_node("farming:raspberry_2", table.copy(def)) | ||||
|  | ||||
| -- stage 3 | ||||
|  | ||||
| def.tiles = {"farming_raspberry_3.png"} | ||||
| minetest.register_node("farming:raspberry_3", table.copy(def)) | ||||
|  | ||||
| -- stage 4 (final) | ||||
|  | ||||
| def.tiles = {"farming_raspberry_4.png"} | ||||
| def.groups.growing = nil | ||||
| def.selection_box = farming.select_final | ||||
| @@ -81,6 +68,7 @@ def.drop = { | ||||
| minetest.register_node("farming:raspberry_4", table.copy(def)) | ||||
|  | ||||
| -- add to registered_plants | ||||
|  | ||||
| farming.registered_plants["farming:raspberries"] = { | ||||
| 	crop = "farming:raspberry", | ||||
| 	seed = "farming:raspberries", | ||||
| @@ -90,6 +78,7 @@ farming.registered_plants["farming:raspberries"] = { | ||||
| } | ||||
|  | ||||
| -- mapgen | ||||
|  | ||||
| minetest.register_decoration({ | ||||
| 	deco_type = "simple", | ||||
| 	place_on = {"default:dirt_with_grass", "mcl_core:dirt_with_grass"}, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user