From b7d6d15b432bb0f00bdbaf1a427a0d16c165fe7b Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Sun, 19 Nov 2017 00:30:41 +0300 Subject: Juices and popsicles --- README.md | 41 +++++++++++ depends.txt | 3 +- init.lua | 35 ++++++++- juices.lua | 129 +++++++++++++++++++++++++++++++++ textures/#drinking_glass.png | Bin 0 -> 371 bytes textures/#drinking_glass_inv.png | Bin 0 -> 313 bytes textures/#popsicle.png | Bin 0 -> 281 bytes textures/add_img.sh | 13 ++++ textures/banana_juice.png | Bin 0 -> 328 bytes textures/banana_juice_inv.png | Bin 0 -> 325 bytes textures/banana_juice_popsicle.png | Bin 0 -> 295 bytes textures/blueberry_juice.png | Bin 0 -> 326 bytes textures/blueberry_juice_inv.png | Bin 0 -> 321 bytes textures/blueberry_juice_popsicle.png | Bin 0 -> 294 bytes textures/cactus_popsicle.png | Bin 269 -> 295 bytes textures/carrot_juice.png | Bin 0 -> 325 bytes textures/carrot_juice_inv.png | Bin 0 -> 322 bytes textures/carrot_juice_popsicle.png | Bin 0 -> 295 bytes textures/coconut_milk.png | Bin 0 -> 317 bytes textures/coconut_milk_inv.png | Bin 0 -> 322 bytes textures/coconut_milk_popsicle.png | Bin 0 -> 294 bytes textures/cucumber_juice.png | Bin 0 -> 323 bytes textures/cucumber_juice_inv.png | Bin 0 -> 320 bytes textures/cucumber_juice_popsicle.png | Bin 0 -> 287 bytes textures/grape_juice.png | Bin 0 -> 328 bytes textures/grape_juice_inv.png | Bin 0 -> 323 bytes textures/grape_juice_popsicle.png | Bin 0 -> 295 bytes textures/melon_juice.png | Bin 0 -> 326 bytes textures/melon_juice_inv.png | Bin 0 -> 322 bytes textures/melon_juice_popsicle.png | Bin 0 -> 293 bytes textures/orange_juice.png | Bin 0 -> 323 bytes textures/orange_juice_inv.png | Bin 0 -> 323 bytes textures/orange_juice_popsicle.png | Bin 0 -> 291 bytes textures/pumpkin_juice.png | Bin 0 -> 318 bytes textures/pumpkin_juice_inv.png | Bin 0 -> 321 bytes textures/pumpkin_juice_popsicle.png | Bin 0 -> 295 bytes textures/raspberry_juice.png | Bin 0 -> 325 bytes textures/raspberry_juice_inv.png | Bin 0 -> 321 bytes textures/raspberry_juice_popsicle.png | Bin 0 -> 293 bytes textures/strawberry_juice.png | Bin 0 -> 319 bytes textures/strawberry_juice_inv.png | Bin 0 -> 319 bytes textures/strawberry_juice_popsicle.png | Bin 0 -> 289 bytes textures/tomato_juice.png | Bin 0 -> 319 bytes textures/tomato_juice_inv.png | Bin 0 -> 324 bytes textures/tomato_juice_popsicle.png | Bin 0 -> 290 bytes 45 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 README.md create mode 100644 juices.lua create mode 100644 textures/#drinking_glass.png create mode 100644 textures/#drinking_glass_inv.png create mode 100644 textures/#popsicle.png create mode 100755 textures/add_img.sh create mode 100644 textures/banana_juice.png create mode 100644 textures/banana_juice_inv.png create mode 100644 textures/banana_juice_popsicle.png create mode 100644 textures/blueberry_juice.png create mode 100644 textures/blueberry_juice_inv.png create mode 100644 textures/blueberry_juice_popsicle.png create mode 100644 textures/carrot_juice.png create mode 100644 textures/carrot_juice_inv.png create mode 100644 textures/carrot_juice_popsicle.png create mode 100644 textures/coconut_milk.png create mode 100644 textures/coconut_milk_inv.png create mode 100644 textures/coconut_milk_popsicle.png create mode 100644 textures/cucumber_juice.png create mode 100644 textures/cucumber_juice_inv.png create mode 100644 textures/cucumber_juice_popsicle.png create mode 100644 textures/grape_juice.png create mode 100644 textures/grape_juice_inv.png create mode 100644 textures/grape_juice_popsicle.png create mode 100644 textures/melon_juice.png create mode 100644 textures/melon_juice_inv.png create mode 100644 textures/melon_juice_popsicle.png create mode 100644 textures/orange_juice.png create mode 100644 textures/orange_juice_inv.png create mode 100644 textures/orange_juice_popsicle.png create mode 100644 textures/pumpkin_juice.png create mode 100644 textures/pumpkin_juice_inv.png create mode 100644 textures/pumpkin_juice_popsicle.png create mode 100644 textures/raspberry_juice.png create mode 100644 textures/raspberry_juice_inv.png create mode 100644 textures/raspberry_juice_popsicle.png create mode 100644 textures/strawberry_juice.png create mode 100644 textures/strawberry_juice_inv.png create mode 100644 textures/strawberry_juice_popsicle.png create mode 100644 textures/tomato_juice.png create mode 100644 textures/tomato_juice_inv.png create mode 100644 textures/tomato_juice_popsicle.png diff --git a/README.md b/README.md new file mode 100644 index 0000000..00edd9f --- /dev/null +++ b/README.md @@ -0,0 +1,41 @@ +#Freezer mod for Minetest + +This mod introduces a common household item, a ~~plumbus~~ freezer. Aka fridge. Its purpose +is to cool things down, chiefly turning water into ice. But it has been expanded to cover +other liquids that can be seen in buckets (milk, cactus pulp), and later to cover juices +(also introduced in this mod) which can be frozen into popsicles. + +[ steel ingot, mese crystal, steel ingot ] +[ steel ingot, , steel ingot ] +[ steel ingot, mese crystal, steel ingot ] + +##Ice + +1 bucket of water (regular or river) gets turned into 1 block of ice. This allows to craft +smoothies after a chain of simple transformations. + +##Milk and cactus pulp + +Buckets of said liquids can be turned into eskimo icecream (an icecream on a wooden stick, +a canonic kind of icecream in the USSR) and a cactus popsicle respectively. Since a whole +bucket is used, the yield is 3 items. + +##Juices and popsicles + +Fruits, berries, and some vegetables can be squeezed into a glass (from vessels mod) using +a shapeless recipe. The resulting product can be consumed as it is, or can be frozen into +colorful popsicles (1 glass yields 1 popsicle). + +The buckets and glasses are returned empty after use (or consumption of beverages). +The popsicles leave a fancy stick behind after being eaten. + +##Pipeworks + +The freezer is pipeworks compatible. All incoming items are places into the source +inventory, and attempts to take items return the contents of the destination inventory. +The direction of pipe connections is irrelevant. + +##The founder + +The mod was founded by gpcf, and can be seen at git://gpcf.eu/freezer.git. +This is a fork thereof. \ No newline at end of file diff --git a/depends.txt b/depends.txt index e2c3e12..62c1b68 100644 --- a/depends.txt +++ b/depends.txt @@ -2,4 +2,5 @@ default pipeworks? ethereal? mobs? -farming? \ No newline at end of file +farming? +vessels? \ No newline at end of file diff --git a/init.lua b/init.lua index e2eb184..64a66d0 100644 --- a/init.lua +++ b/init.lua @@ -4,6 +4,13 @@ -- surprise for the player. -- +-- enable extra popsicle types provided there are both vessels and fruits/veggies available +-- fruit + glass -> juice; juice @ freezer -> popsicle + empty glass + +if minetest.get_modpath("vessels") then + dofile(minetest.get_modpath("freezer") .. "/juices.lua") +end + -- -- Formspecs -- @@ -161,6 +168,26 @@ local function freezer_node_timer(pos, elapsed) end end end + + -- juices -> popsicles + -- since we're dealing with 1 glass and not 1 bucket, the output is 1 item + if minetest.get_modpath("vessels") then + local input_stack = inv:get_stack("src", 1); + local input_name = input_stack:get_name(); + if minetest.get_item_group(input_name, "juice") then + local output_name = input_name .. "_popsicle" + while inv:room_for_item("dst", output_name) do + local removed = inv:remove_item("src", input_name) + if removed:get_count() > 0 then + inv:add_item("dst", output_name) + inv:add_item("dst", "vessels:drinking_glass") + else + break + end + end + end + end + -- Check if we have cookable content return @@ -255,7 +282,7 @@ end if minetest.get_modpath("mobs") and mobs and mobs.mod == "redo" then minetest.register_craftitem("freezer:milk_popsicle", { - description = "Ice Cream Popsicle", + description = "Eskimo icecream", inventory_image = "milk_popsicle.png", wield_image = "milk_popsicle.png", stack_max = 99, @@ -282,3 +309,9 @@ minetest.register_craft({ "default:ice" } }) + +-- -- enable extra popsicle types provided there are both vessels and fruits/veggies available +-- -- fruit + glass -> juice; juice @ freezer -> popsicle + empty glass +-- if minetest.get_modpath("vessels") and minetest.get_modpath("farming") then +-- dofile("juices.lua") +-- end \ No newline at end of file diff --git a/juices.lua b/juices.lua new file mode 100644 index 0000000..63e34a3 --- /dev/null +++ b/juices.lua @@ -0,0 +1,129 @@ +-- Definition for juices, an intermediate stage for making popsicles +-- however, they can be consumed raw as well, but the benefit would be less + +--[[ + Definition scheme + internal_name_of_the_juice = { + 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 + } + -- image files for items must follow the scheme: + -- internal_name_of_the_juice.png and + -- internal_name_of_the_juice_inv.png (for inventory) + -- internal_name_of_the_juice_popsicle.png for the popsicle form +]] + +local juice_table = { + orange_juice = { + proper_name = "Orange juice", + found_in = "ethereal", + obj_name = "orange", + orig_nutritional_value = 2 + }, + banana_juice = { + proper_name = "Banana juice", + found_in = "ethereal", + obj_name = "banana", + orig_nutritional_value = 1 + }, + strawberry_juice = { + proper_name = "Strawberry juice", + found_in = "ethereal", + obj_name = "strawberry", + orig_nutritional_value = 1 + }, + coconut_milk = { + proper_name = "Coconut milk", + found_in = "ethereal", + obj_name = "coconut_slice", + orig_nutritional_value = 1 + }, + blueberry_juice = { + proper_name = "Blueberry juice", + found_in = "farming", + obj_name = "blueberries", + orig_nutritional_value = 1 + }, + raspberry_juice = { + proper_name = "Raspberry juice", + found_in = "farming", + obj_name = "raspberries", + orig_nutritional_value = 1 + }, + carrot_juice = { + proper_name = "Carrot juice", + found_in = "farming", + obj_name = "carrot", + orig_nutritional_value = 4 + }, + cucumber_juice = { + proper_name = "Cucumber juice", + found_in = "farming", + obj_name = "cucumber", + orig_nutritional_value = 4 + }, + grape_juice = { + proper_name = "Grape juice", + found_in = "farming", + obj_name = "grapes", + orig_nutritional_value = 2 + }, + melon_juice = { + proper_name = "Melon juice", + found_in = "farming", + obj_name = "melon_slice", + orig_nutritional_value = 2 + }, + pumpkin_juice = { + proper_name = "Pumpkin juice", + found_in = "farming", + obj_name = "pumpkin_slice", + orig_nutritional_value = 2 + }, + tomato_juice = { + proper_name = "Tomato juice", + found_in = "farming", + obj_name = "tomato", + orig_nutritional_value = 4 + }, + +} + + +-- all juices are created accoriding to a single universal scheme +for juice_name, def in pairs(juice_table) do + if minetest.get_modpath(def.found_in) then + + -- introducing a new item, a bit more nutricious than the source material + -- that's because one needs a glass, so effort should be rewarded + minetest.register_craftitem("freezer:" .. juice_name, { + description = def.proper_name, + inventory_image = juice_name .. "_inv.png", + wield_image = juice_name .. ".png", + groups = { juice = 1 }, + on_use = minetest.item_eat(def.orig_nutritional_value+1, "vessels:drinking_glass"), + }) + + -- register corresponding popsicles + -- lower nutritional value is compensated by leaving a fancy stick behind + minetest.register_craftitem("freezer:" .. juice_name .. "_popsicle", { + description = def.proper_name .. " popsicle", + inventory_image = juice_name .. "_popsicle.png", + wield_image = juice_name .. "_popsicle.png", + groups = { popsicle = 1, not_in_creative_inventory = 1 } + on_use = minetest.item_eat(def.orig_nutritional_value, "default:stick"), + }) + + minetest.register_craft({ + type = "shapeless", + output = "freezer:" .. juice_name, + recipe = {"vessels:drinking_glass", def.found_in .. ":" .. def.obj_name}, + }) + + end +end + +-- The Moor has done his duty, the Moor can go +juice_table = nil diff --git a/textures/#drinking_glass.png b/textures/#drinking_glass.png new file mode 100644 index 0000000..1cf5383 Binary files /dev/null and b/textures/#drinking_glass.png differ diff --git a/textures/#drinking_glass_inv.png b/textures/#drinking_glass_inv.png new file mode 100644 index 0000000..c47908b Binary files /dev/null and b/textures/#drinking_glass_inv.png differ diff --git a/textures/#popsicle.png b/textures/#popsicle.png new file mode 100644 index 0000000..4930f83 Binary files /dev/null and b/textures/#popsicle.png differ diff --git a/textures/add_img.sh b/textures/add_img.sh new file mode 100755 index 0000000..192b387 --- /dev/null +++ b/textures/add_img.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# copy the source images as proper filenames +# then color them with GIMP + +if [ -z "$1" ]; then + echo "(!) usage: ./add_img.sh new_juice_name" +else + echo "(i) adding new juice type ${1}..." + cp "#drinking_glass.png" "${1}.png" + cp "#drinking_glass_inv.png" "${1}_inv.png" + cp "#popsicle.png" "${1}_popsicle.png" +fi \ No newline at end of file diff --git a/textures/banana_juice.png b/textures/banana_juice.png new file mode 100644 index 0000000..ccdb644 Binary files /dev/null and b/textures/banana_juice.png differ diff --git a/textures/banana_juice_inv.png b/textures/banana_juice_inv.png new file mode 100644 index 0000000..dda4281 Binary files /dev/null and b/textures/banana_juice_inv.png differ diff --git a/textures/banana_juice_popsicle.png b/textures/banana_juice_popsicle.png new file mode 100644 index 0000000..9ac321a Binary files /dev/null and b/textures/banana_juice_popsicle.png differ diff --git a/textures/blueberry_juice.png b/textures/blueberry_juice.png new file mode 100644 index 0000000..bcf0c13 Binary files /dev/null and b/textures/blueberry_juice.png differ diff --git a/textures/blueberry_juice_inv.png b/textures/blueberry_juice_inv.png new file mode 100644 index 0000000..580f921 Binary files /dev/null and b/textures/blueberry_juice_inv.png differ diff --git a/textures/blueberry_juice_popsicle.png b/textures/blueberry_juice_popsicle.png new file mode 100644 index 0000000..230e17c Binary files /dev/null and b/textures/blueberry_juice_popsicle.png differ diff --git a/textures/cactus_popsicle.png b/textures/cactus_popsicle.png index 6243f8c..08e7c02 100644 Binary files a/textures/cactus_popsicle.png and b/textures/cactus_popsicle.png differ diff --git a/textures/carrot_juice.png b/textures/carrot_juice.png new file mode 100644 index 0000000..3d2618c Binary files /dev/null and b/textures/carrot_juice.png differ diff --git a/textures/carrot_juice_inv.png b/textures/carrot_juice_inv.png new file mode 100644 index 0000000..db64a28 Binary files /dev/null and b/textures/carrot_juice_inv.png differ diff --git a/textures/carrot_juice_popsicle.png b/textures/carrot_juice_popsicle.png new file mode 100644 index 0000000..8ad756e Binary files /dev/null and b/textures/carrot_juice_popsicle.png differ diff --git a/textures/coconut_milk.png b/textures/coconut_milk.png new file mode 100644 index 0000000..9007004 Binary files /dev/null and b/textures/coconut_milk.png differ diff --git a/textures/coconut_milk_inv.png b/textures/coconut_milk_inv.png new file mode 100644 index 0000000..84e0df6 Binary files /dev/null and b/textures/coconut_milk_inv.png differ diff --git a/textures/coconut_milk_popsicle.png b/textures/coconut_milk_popsicle.png new file mode 100644 index 0000000..0be3eba Binary files /dev/null and b/textures/coconut_milk_popsicle.png differ diff --git a/textures/cucumber_juice.png b/textures/cucumber_juice.png new file mode 100644 index 0000000..387e579 Binary files /dev/null and b/textures/cucumber_juice.png differ diff --git a/textures/cucumber_juice_inv.png b/textures/cucumber_juice_inv.png new file mode 100644 index 0000000..8d0080a Binary files /dev/null and b/textures/cucumber_juice_inv.png differ diff --git a/textures/cucumber_juice_popsicle.png b/textures/cucumber_juice_popsicle.png new file mode 100644 index 0000000..14ba4f1 Binary files /dev/null and b/textures/cucumber_juice_popsicle.png differ diff --git a/textures/grape_juice.png b/textures/grape_juice.png new file mode 100644 index 0000000..a100957 Binary files /dev/null and b/textures/grape_juice.png differ diff --git a/textures/grape_juice_inv.png b/textures/grape_juice_inv.png new file mode 100644 index 0000000..7cbd28e Binary files /dev/null and b/textures/grape_juice_inv.png differ diff --git a/textures/grape_juice_popsicle.png b/textures/grape_juice_popsicle.png new file mode 100644 index 0000000..230ad1e Binary files /dev/null and b/textures/grape_juice_popsicle.png differ diff --git a/textures/melon_juice.png b/textures/melon_juice.png new file mode 100644 index 0000000..50ad3ae Binary files /dev/null and b/textures/melon_juice.png differ diff --git a/textures/melon_juice_inv.png b/textures/melon_juice_inv.png new file mode 100644 index 0000000..fd37846 Binary files /dev/null and b/textures/melon_juice_inv.png differ diff --git a/textures/melon_juice_popsicle.png b/textures/melon_juice_popsicle.png new file mode 100644 index 0000000..d08b554 Binary files /dev/null and b/textures/melon_juice_popsicle.png differ diff --git a/textures/orange_juice.png b/textures/orange_juice.png new file mode 100644 index 0000000..07202ad Binary files /dev/null and b/textures/orange_juice.png differ diff --git a/textures/orange_juice_inv.png b/textures/orange_juice_inv.png new file mode 100644 index 0000000..ce1c8b1 Binary files /dev/null and b/textures/orange_juice_inv.png differ diff --git a/textures/orange_juice_popsicle.png b/textures/orange_juice_popsicle.png new file mode 100644 index 0000000..11c0c49 Binary files /dev/null and b/textures/orange_juice_popsicle.png differ diff --git a/textures/pumpkin_juice.png b/textures/pumpkin_juice.png new file mode 100644 index 0000000..9a1a9c3 Binary files /dev/null and b/textures/pumpkin_juice.png differ diff --git a/textures/pumpkin_juice_inv.png b/textures/pumpkin_juice_inv.png new file mode 100644 index 0000000..f2ae36b Binary files /dev/null and b/textures/pumpkin_juice_inv.png differ diff --git a/textures/pumpkin_juice_popsicle.png b/textures/pumpkin_juice_popsicle.png new file mode 100644 index 0000000..4e20dab Binary files /dev/null and b/textures/pumpkin_juice_popsicle.png differ diff --git a/textures/raspberry_juice.png b/textures/raspberry_juice.png new file mode 100644 index 0000000..68649a4 Binary files /dev/null and b/textures/raspberry_juice.png differ diff --git a/textures/raspberry_juice_inv.png b/textures/raspberry_juice_inv.png new file mode 100644 index 0000000..a8d45f3 Binary files /dev/null and b/textures/raspberry_juice_inv.png differ diff --git a/textures/raspberry_juice_popsicle.png b/textures/raspberry_juice_popsicle.png new file mode 100644 index 0000000..1cdb6ac Binary files /dev/null and b/textures/raspberry_juice_popsicle.png differ diff --git a/textures/strawberry_juice.png b/textures/strawberry_juice.png new file mode 100644 index 0000000..887baa0 Binary files /dev/null and b/textures/strawberry_juice.png differ diff --git a/textures/strawberry_juice_inv.png b/textures/strawberry_juice_inv.png new file mode 100644 index 0000000..165a4aa Binary files /dev/null and b/textures/strawberry_juice_inv.png differ diff --git a/textures/strawberry_juice_popsicle.png b/textures/strawberry_juice_popsicle.png new file mode 100644 index 0000000..41e9301 Binary files /dev/null and b/textures/strawberry_juice_popsicle.png differ diff --git a/textures/tomato_juice.png b/textures/tomato_juice.png new file mode 100644 index 0000000..5a8ae1b Binary files /dev/null and b/textures/tomato_juice.png differ diff --git a/textures/tomato_juice_inv.png b/textures/tomato_juice_inv.png new file mode 100644 index 0000000..317e939 Binary files /dev/null and b/textures/tomato_juice_inv.png differ diff --git a/textures/tomato_juice_popsicle.png b/textures/tomato_juice_popsicle.png new file mode 100644 index 0000000..f0a2627 Binary files /dev/null and b/textures/tomato_juice_popsicle.png differ -- cgit v1.2.3 From 5aff11f8f74c20a38ab0684d4724407d579424ba Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Sun, 19 Nov 2017 00:35:25 +0300 Subject: damn markdown --- README.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 00edd9f..39c194a 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,28 @@ -#Freezer mod for Minetest +# Freezer mod for Minetest This mod introduces a common household item, a ~~plumbus~~ freezer. Aka fridge. Its purpose is to cool things down, chiefly turning water into ice. But it has been expanded to cover other liquids that can be seen in buckets (milk, cactus pulp), and later to cover juices (also introduced in this mod) which can be frozen into popsicles. +``` [ steel ingot, mese crystal, steel ingot ] [ steel ingot, , steel ingot ] [ steel ingot, mese crystal, steel ingot ] +``` -##Ice +## Ice 1 bucket of water (regular or river) gets turned into 1 block of ice. This allows to craft smoothies after a chain of simple transformations. -##Milk and cactus pulp +## Milk and cactus pulp Buckets of said liquids can be turned into eskimo icecream (an icecream on a wooden stick, a canonic kind of icecream in the USSR) and a cactus popsicle respectively. Since a whole bucket is used, the yield is 3 items. -##Juices and popsicles +## Juices and popsicles Fruits, berries, and some vegetables can be squeezed into a glass (from vessels mod) using a shapeless recipe. The resulting product can be consumed as it is, or can be frozen into @@ -29,13 +31,13 @@ colorful popsicles (1 glass yields 1 popsicle). The buckets and glasses are returned empty after use (or consumption of beverages). The popsicles leave a fancy stick behind after being eaten. -##Pipeworks +## Pipeworks The freezer is pipeworks compatible. All incoming items are places into the source inventory, and attempts to take items return the contents of the destination inventory. The direction of pipe connections is irrelevant. -##The founder +## The founder The mod was founded by gpcf, and can be seen at git://gpcf.eu/freezer.git. This is a fork thereof. \ No newline at end of file -- cgit v1.2.3