From c822f947856aa0f2fe6168018ea2e14f346151a1 Mon Sep 17 00:00:00 2001 From: Desour Date: Tue, 24 Mar 2020 18:22:19 +0100 Subject: [PATCH] Add Rapeseed --- game_api.txt | 24 +- mods/dye/init.lua | 64 ++- mods/farming/api.lua | 42 +- mods/farming/init.lua | 16 + mods/farming/license.txt | 3 +- mods/farming/mod.conf | 4 +- mods/farming/nodes.lua | 13 +- mods/farming/rapeseed_oil.lua | 419 ++++++++++++++++++ mods/farming/textures/farming_mortar_mask.png | Bin 0 -> 182 bytes mods/farming/textures/farming_pestle.png | Bin 0 -> 303 bytes mods/farming/textures/farming_rapeseed.png | Bin 0 -> 590 bytes mods/farming/textures/farming_rapeseed_1.png | Bin 0 -> 192 bytes mods/farming/textures/farming_rapeseed_2.png | Bin 0 -> 219 bytes mods/farming/textures/farming_rapeseed_3.png | Bin 0 -> 222 bytes mods/farming/textures/farming_rapeseed_4.png | Bin 0 -> 266 bytes mods/farming/textures/farming_rapeseed_5.png | Bin 0 -> 340 bytes mods/farming/textures/farming_rapeseed_6.png | Bin 0 -> 379 bytes mods/farming/textures/farming_rapeseed_7.png | Bin 0 -> 409 bytes mods/farming/textures/farming_rapeseed_8.png | Bin 0 -> 356 bytes .../textures/farming_rapeseed_in_mortar.png | Bin 0 -> 565 bytes .../farming/textures/farming_rapeseed_oil.png | Bin 0 -> 770 bytes mods/farming/textures/farming_raw_mortar.png | Bin 0 -> 284 bytes mods/farming/textures/farming_raw_pestle.png | Bin 0 -> 306 bytes .../vessels_glass_bottle_liquidmask.png | Bin 0 -> 174 bytes 24 files changed, 541 insertions(+), 44 deletions(-) create mode 100644 mods/farming/rapeseed_oil.lua create mode 100644 mods/farming/textures/farming_mortar_mask.png create mode 100644 mods/farming/textures/farming_pestle.png create mode 100644 mods/farming/textures/farming_rapeseed.png create mode 100644 mods/farming/textures/farming_rapeseed_1.png create mode 100644 mods/farming/textures/farming_rapeseed_2.png create mode 100644 mods/farming/textures/farming_rapeseed_3.png create mode 100644 mods/farming/textures/farming_rapeseed_4.png create mode 100644 mods/farming/textures/farming_rapeseed_5.png create mode 100644 mods/farming/textures/farming_rapeseed_6.png create mode 100644 mods/farming/textures/farming_rapeseed_7.png create mode 100644 mods/farming/textures/farming_rapeseed_8.png create mode 100644 mods/farming/textures/farming_rapeseed_in_mortar.png create mode 100644 mods/farming/textures/farming_rapeseed_oil.png create mode 100644 mods/farming/textures/farming_raw_mortar.png create mode 100644 mods/farming/textures/farming_raw_pestle.png create mode 100644 mods/vessels/textures/vessels_glass_bottle_liquidmask.png diff --git a/game_api.txt b/game_api.txt index 3f311336..e95f8125 100644 --- a/game_api.txt +++ b/game_api.txt @@ -165,11 +165,11 @@ Doors API The doors mod allows modders to register custom doors and trapdoors. -`doors.registered_doors[name] = Door definition` - * Table of registered doors, indexed by door name +`doors.registered_doors[name] = Door definition` + * Table of registered doors, indexed by door name -`doors.registered_trapdoors[name] = Trapdoor definition` - * Table of registered trap doors, indexed by trap door name +`doors.registered_trapdoors[name] = Trapdoor definition` + * Table of registered trap doors, indexed by trap door name `doors.register_door(name, def)` @@ -212,7 +212,7 @@ The doors mod allows modders to register custom doors and trapdoors. * `pos` Position of the door * `node` Node definition * `clicker` Player definition for the player that clicked on the door - + ### Door definition description = "Door description", @@ -226,7 +226,7 @@ The doors mod allows modders to register custom doors and trapdoors. sound_open = sound play for open door, -- optional sound_close = sound play for close door, -- optional protected = false, -- If true, only placer can open the door (locked for others) - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) -- optional function containing the on_rightclick callback, defaults to a doors.door_toggle-wrapper ### Trapdoor definition @@ -245,9 +245,9 @@ The doors mod allows modders to register custom doors and trapdoors. sound_open = sound play for open door, -- optional sound_close = sound play for close door, -- optional protected = false, -- If true, only placer can open the door (locked for others) - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) -- function containing the on_rightclick callback - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) -- function containing the on_rightclick callback ### Fence gate definition @@ -258,7 +258,7 @@ The doors mod allows modders to register custom doors and trapdoors. material = "default:wood", groups = {choppy = 2, oddly_breakable_by_hand = 2, flammable = 2}, sounds = default.node_sound_wood_defaults(), -- optional - on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) + on_rightclick = function(pos, node, clicker, itemstack, pointed_thing) -- function containing the on_rightclick callback @@ -370,7 +370,11 @@ The farming API allows you to easily register plants and hoes. steps = 8, -- How many steps the plant has to grow, until it can be harvested -- ^ Always provide a plant texture for each step, format: modname_plantname_i.png (i = stepnumber) minlight = 13, -- Minimum light to grow - maxlight = default.LIGHT_MAX -- Maximum light to grow + maxlight = default.LIGHT_MAX, -- Maximum light to grow + only_seed = false, -- If true, plant will only drop + -- seeds. plant name is used as + -- name for seed + -- plus some other fields that someone was to lazy to document } diff --git a/mods/dye/init.lua b/mods/dye/init.lua index f0affe8b..8358fe6f 100644 --- a/mods/dye/init.lua +++ b/mods/dye/init.lua @@ -45,25 +45,61 @@ for _, row in ipairs(dye.dyes) do {"group:flower,color_" .. name} }, }) + + minetest.register_craft({ + type = "shapeless", + output = "dye:" .. name .. " 8", + recipe = { + "group:flower,color_" .. name, + "farming:glass_bottle_with_rapeseed_oil" + }, + replacements = {{"farming:glass_bottle_with_rapeseed_oil", + "vessels:glass_bottle"}}, + }) end --- Manually add coal -> black dye +if minetest.get_modpath("default") then + -- Manually add coal -> black dye -minetest.register_craft({ - output = "dye:black 4", - recipe = { - {"group:coal"} - }, -}) + minetest.register_craft({ + output = "dye:black 4", + recipe = { + {"group:coal"} + }, + }) --- Manually add blueberries->violet dye + minetest.register_craft({ + type = "shapeless", + output = "dye:black 8", + recipe = { + "group:coal", + "farming:glass_bottle_with_rapeseed_oil" + }, + replacements = {{"farming:glass_bottle_with_rapeseed_oil", + "vessels:glass_bottle"}}, + }) -minetest.register_craft({ - output = "dye:violet 2", - recipe = { - {"default:blueberries"} - }, -}) + -- Manually add blueberries->violet dye + + minetest.register_craft({ + output = "dye:violet 2", + recipe = { + {"default:blueberries"} + }, + }) + + minetest.register_craft({ + type = "shapeless", + output = "dye:violet 8", + recipe = { + "default:blueberries", + "default:blueberries", + "farming:glass_bottle_with_rapeseed_oil" + }, + replacements = {{"farming:glass_bottle_with_rapeseed_oil", + "vessels:glass_bottle"}}, + }) +end -- Mix recipes diff --git a/mods/farming/api.lua b/mods/farming/api.lua index 91d557c7..869230da 100644 --- a/mods/farming/api.lua +++ b/mods/farming/api.lua @@ -253,8 +253,7 @@ end -- Register plants farming.register_plant = function(name, def) - local mname = name:split(":")[1] - local pname = name:split(":")[2] + local mname, pname = unpack(name:split(":")) -- Check def table if not def.description then @@ -278,16 +277,22 @@ farming.register_plant = function(name, def) if not def.fertility then def.fertility = {} end + if not def.only_seed then + def.only_seed = false + end farming.registered_plants[pname] = def + local seed_name = def.only_seed and mname .. ":" .. pname + or mname .. ":seed_" .. pname + -- Register seed - local lbm_nodes = {mname .. ":seed_" .. pname} + local lbm_nodes = {seed_name} local g = {seed = 1, snappy = 3, attached_node = 1, flammable = 2} for k, v in pairs(def.fertility) do g[v] = 1 end - minetest.register_node(":" .. mname .. ":seed_" .. pname, { + minetest.register_node(":" .. seed_name, { description = def.description, tiles = {def.inventory_image}, inventory_image = def.inventory_image, @@ -321,7 +326,7 @@ farming.register_plant = function(name, def) pointed_thing) or itemstack end - return farming.place_seed(itemstack, placer, pointed_thing, mname .. ":seed_" .. pname) + return farming.place_seed(itemstack, placer, pointed_thing, seed_name) end, next_plant = mname .. ":" .. pname .. "_1", on_timer = farming.grow_plant, @@ -330,11 +335,13 @@ farming.register_plant = function(name, def) }) -- Register harvest - minetest.register_craftitem(":" .. mname .. ":" .. pname, { - description = def.harvest_description, - inventory_image = mname .. "_" .. pname .. ".png", - groups = def.groups or {flammable = 2}, - }) + if not def.only_seed then + minetest.register_craftitem(":" .. mname .. ":" .. pname, { + description = def.harvest_description, + inventory_image = mname .. "_" .. pname .. ".png", + groups = def.groups or {flammable = 2}, + }) + end -- Register growing steps for i = 1, def.steps do @@ -343,11 +350,15 @@ farming.register_plant = function(name, def) base_rarity = 8 - (i - 1) * 7 / (def.steps - 1) end local drop = { - items = { + items = def.only_seed and { + {items = {seed_name}, rarity = base_rarity}, + {items = {seed_name}, rarity = base_rarity * 2}, + {items = {seed_name}, rarity = base_rarity * 2}, + } or { {items = {mname .. ":" .. pname}, rarity = base_rarity}, {items = {mname .. ":" .. pname}, rarity = base_rarity * 2}, - {items = {mname .. ":seed_" .. pname}, rarity = base_rarity}, - {items = {mname .. ":seed_" .. pname}, rarity = base_rarity * 2}, + {items = {seed_name}, rarity = base_rarity}, + {items = {seed_name}, rarity = base_rarity * 2}, } } local nodegroups = {snappy = 3, flammable = 2, plant = 1, not_in_creative_inventory = 1, attached_node = 1} @@ -393,9 +404,8 @@ farming.register_plant = function(name, def) }) -- Return - local r = { - seed = mname .. ":seed_" .. pname, + return { + seed = seed_name, harvest = mname .. ":" .. pname } - return r end diff --git a/mods/farming/init.lua b/mods/farming/init.lua index d328cb4a..c49647d8 100644 --- a/mods/farming/init.lua +++ b/mods/farming/init.lua @@ -113,6 +113,22 @@ minetest.register_craft({ }) +-- Rapeseed + +farming.register_plant("farming:rapeseed", { + description = S("Rapeseed"), + inventory_image = "farming_rapeseed.png", + steps = 8, + minlight = 13, + maxlight = default.LIGHT_MAX, + only_seed = true, + fertility = {"grassland", "desert"}, + groups = {flammable = 4}, +}) + +dofile(farming.path .. "/rapeseed_oil.lua") + + -- Straw minetest.register_craft({ diff --git a/mods/farming/license.txt b/mods/farming/license.txt index b9708de3..df886e7f 100644 --- a/mods/farming/license.txt +++ b/mods/farming/license.txt @@ -4,7 +4,7 @@ License of source code The MIT License (MIT) Copyright (C) 2012-2016 PilzAdam Copyright (C) 2014-2016 webdesigner97 -Copyright (C) 2012-2016 Various Minetest developers and contributors +Copyright (C) 2012-2020 Various Minetest developers and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software @@ -34,6 +34,7 @@ Copyright (C) 2012-2016 PilzAdam Copyright (C) 2014-2016 BlockMen Copyright (C) 2015-2016 MasterGollum Copyright (C) 2015-2016 Gambit +Copyright (C) 2020 DS You are free to: Share — copy and redistribute the material in any medium or format. diff --git a/mods/farming/mod.conf b/mods/farming/mod.conf index 9a76a6a7..366d0052 100644 --- a/mods/farming/mod.conf +++ b/mods/farming/mod.conf @@ -1,4 +1,4 @@ name = farming description = Minetest Game mod: farming -depends = default, wool, stairs -optional_depends = dungeon_loot +depends = default, wool, stairs, vessels +optional_depends = dungeon_loot, creative diff --git a/mods/farming/nodes.lua b/mods/farming/nodes.lua index b5f90f96..8e61d3a5 100644 --- a/mods/farming/nodes.lua +++ b/mods/farming/nodes.lua @@ -233,7 +233,7 @@ minetest.register_abm({ -- Make default:grass_* occasionally drop wheat seed for i = 1, 5 do - minetest.override_item("default:grass_"..i, {drop = { + minetest.override_item("default:grass_" .. i, {drop = { max_items = 1, items = { {items = {"farming:seed_wheat"}, rarity = 5}, @@ -280,3 +280,14 @@ minetest.register_node("farming:cotton_wild", { fixed = {-6 / 16, -8 / 16, -6 / 16, 6 / 16, 5 / 16, 6 / 16}, }, }) + + +-- Make default:dry_shrub occasionally drop rapeseed. + +minetest.override_item("default:dry_shrub", {drop = { + max_items = 1, + items = { + {items = {"farming:rapeseed"}, rarity = 10}, + {items = {"default:dry_shrub"}}, + } +}}) diff --git a/mods/farming/rapeseed_oil.lua b/mods/farming/rapeseed_oil.lua new file mode 100644 index 00000000..c10a3559 --- /dev/null +++ b/mods/farming/rapeseed_oil.lua @@ -0,0 +1,419 @@ + +---------------- +-- Lookup tables +---------------- + +-- Contains which mortar you get when you put a rapeseed into a mortar +local put_seed_into_mortar = { + ["farming:mortar"] = "farming:mortar_with_1_rapeseed", + ["farming:mortar_with_1_rapeseed"] = "farming:mortar_with_2_rapeseed", + ["farming:mortar_with_2_rapeseed"] = "farming:mortar_with_3_rapeseed", +} +-- Contains which mortar you get when you take oil from a mortar with a bottle +local take_oil_from_mortar = { + ["farming:mortar_with_1_rapeseed_oil"] = "farming:mortar", + ["farming:mortar_with_2_rapeseed_oil"] = "farming:mortar_with_1_rapeseed_oil", + ["farming:mortar_with_3_rapeseed_oil"] = "farming:mortar_with_2_rapeseed_oil", +} + +-- Conatins what will be in the mortar after the player used the pestle often enough +-- How often the pestle has to be used is calculated in get_num_poundings +local pound_with_pestle = { + ["farming:mortar_with_1_rapeseed"] = { + after = "farming:mortar_with_1_rapeseed_oil", + base_min = 1, + base_max = 2, + prob = 0.5, + }, + ["farming:mortar_with_2_rapeseed"] = { + after = "farming:mortar_with_2_rapeseed_oil", + base_min = 2, + base_max = 3, + prob = 0.3, + }, + ["farming:mortar_with_3_rapeseed"] = { + after = "farming:mortar_with_3_rapeseed_oil", + base_min = 3, + base_max = 4, + prob = 0.2, + }, +} + +-- Returns for an entry in pound_with_pestle, how often the player has to use the +-- pestle +local function get_num_poundings(entry) + local ret = math.random(entry.base_min, entry.base_max) + -- todo: make this more efficient + while math.random() > entry.prob do + ret = ret + 1 + end + return ret +end + + +---------------------------------- +-- Tables that are used at runtime +---------------------------------- + +-- Contains for hashed node positions how many step pounding uses are still needed +local pending_poundings = {} + + +--------------------------------- +-- Basic helpers for registration +--------------------------------- + +local function get_mortar_nodebox(fill_num) + -- the mortar's sides are 2/16 high + -- we do not want the mortar to be filled completely => 1.8 / 16 + -- there can be up to 3 seeds or layers oil in the mortar => / 3 + local fill_offset = fill_num * (1.8 / 16 / 3) + return { + type = "fixed", + fixed = { + {-3/16, -0.5, -3/16, 3/16, -7/16 + fill_offset, 3/16}, -- ground plate + filling + {-1/4, -7/16, -3/16, -3/16, -5/16, 3/16}, -- 4 sides + {-3/16, -7/16, -1/4, 3/16, -5/16, -3/16}, + {3/16, -7/16, -3/16, 1/4, -5/16, 3/16}, + {-3/16, -7/16, 3/16, 3/16, -5/16, 1/4} + }, + } +end + +local mortar_box_simple = { + type = "fixed", + fixed = {-1/4, -0.5, -1/4, 1/4, -5/16, 1/4}, +} + +local function mortar_on_flood(pos) + -- drop the mortar as item + pos = vector.new(pos) + pos.y = pos.y - 0.3 + minetest.add_item(pos, "farming:mortar") +end + +local function poundable_mortar_on_destruct(pos) + -- remove the entry in pending_poundings + local pos_hash = minetest.hash_node_position(pos) + pending_poundings[pos_hash] = nil +end + + +---------------------------------------------- +-- Function for using the pestle on the mortar +---------------------------------------------- + +local function pestle_on_use(itemstack, user, pointed_thing) + if pointed_thing.type ~= "node" then + return + end + + local pos = pointed_thing.under + local node = minetest.get_node(pos) + -- find out if the node is a mortar and get its pounding target + local target = pound_with_pestle[node.name] + if not target then + return + end + + -- check for protection + local user_name = user and minetest.is_player(user) and + user:get_player_name() or "" + if minetest.is_protected(pos, user_name) then + return + end + + -- get how often the player still has to use the pestle + local pos_hash = minetest.hash_node_position(pos) + local remaining_hits = pending_poundings[pos_hash] + -- if not found, generate new amount from specs + remaining_hits = remaining_hits or get_num_poundings(target) + remaining_hits = remaining_hits - 1 + if remaining_hits == 0 then + -- replace with target node + node.name = target.after + minetest.swap_node(pos, node) + -- clean up + pending_poundings[pos_hash] = nil + else + -- write back + pending_poundings[pos_hash] = remaining_hits + end + + minetest.sound_play({name = "default_hard_footstep", gain = 1.0}, + {pos = pos}, true) + -- add tool wear + if not minetest.global_exists("creative") or + not creative.is_enabled_for(user_name) then + itemstack:add_wear(1024) + if itemstack:is_empty() then + -- item broke + minetest.sound_play("default_tool_breaks", {pos = pos, gain = 0.5}, + true) + end + end + return itemstack +end + + +-------------------------- +-- Mortar and Pestle Items +-------------------------- + +-- the empty mortar +minetest.register_node("farming:mortar", { + description = "Mortar", + groups = {cracky = 3}, + stack_max = 16, + drawtype = "nodebox", + tiles = {"default_clay.png"}, + paramtype = "light", + paramtype2 = "none", + is_ground_content = false, + floodable = true, + node_box = get_mortar_nodebox(0), + selection_box = mortar_box_simple, + collision_box = mortar_box_simple, + sounds = default.node_sound_stone_defaults(), + on_flood = mortar_on_flood, +}) + +-- filled mortars +for _, item in ipairs({"rapeseed", "rapeseed_oil"}) do + local top_tile, on_destruct + + if item == "rapeseed" then + top_tile = "farming_rapeseed_in_mortar.png" + on_destruct = poundable_mortar_on_destruct + else + top_tile = "(farming_rapeseed_oil.png^[mask:farming_mortar_mask.png)" + end + top_tile = "default_clay.png^" .. top_tile + + for fillstate = 1, 3 do + minetest.register_node(string.format("farming:mortar_with_%i_%s", fillstate, + item), { + groups = {cracky = 3, not_in_creative_inventory = 1}, + drawtype = "nodebox", + tiles = {top_tile, "default_clay.png"}, + paramtype = "light", + paramtype2 = "none", + is_ground_content = false, + floodable = true, + node_box = get_mortar_nodebox(fillstate), + selection_box = mortar_box_simple, + collision_box = mortar_box_simple, + sounds = default.node_sound_stone_defaults(), + drop = "farming:mortar", + on_flood = mortar_on_flood, + on_destruct = on_destruct, + }) + end +end + +minetest.register_tool("farming:pestle", { + description = "Pestle", + groups = {}, + inventory_image = "farming_pestle.png", + wield_image = "farming_pestle.png^[transformR270", + stack_max = 1, + range = 2.0, + sound = {breaks = "default_tool_breaks"}, + tool_capabilities = { + full_punch_interval = 1.0, + max_drop_level = 0, + groupcaps = {}, + damage_groups = {}, + }, + on_use = pestle_on_use, +}) + + +------------------------------------------ +-- Overrides for seed and glass bottle +-- (for putting into / taking from mortar) +------------------------------------------ + +-- implement putting seeds into the mortar +local old_rapeseed_on_place = minetest.registered_items["farming:rapeseed"].on_place +minetest.override_item("farming:rapeseed", { + node_placement_prediction = "", -- deactivate prediction (it looks bad) + + on_place = function(itemstack, placer, pointed_thing) + if pointed_thing.type ~= "node" then + return old_rapeseed_on_place(itemstack, placer, pointed_thing) + end + + -- do protection checks and check if mortar is clicked + local pos = pointed_thing.under + local node = minetest.get_node(pos) + local new_node_name = put_seed_into_mortar[node.name] + + local placer_name = placer and minetest.is_player(placer) and + placer:get_player_name() or "" + + if minetest.is_protected(pos, placer_name) or not new_node_name then + return old_rapeseed_on_place(itemstack, placer, pointed_thing) + end + + -- replace the node + node.name = new_node_name + minetest.swap_node(pos, node) + + -- clear pending_poundings (the player has to start over) + pending_poundings[minetest.hash_node_position(pos)] = nil + + -- remove the seed from inventory + if not minetest.global_exists("creative") or + not creative.is_enabled_for(placer_name) then + itemstack:take_item() + end + return itemstack + end, +}) + +-- implement taking oil from the mortar with glass bottle +local old_glass_bottle_on_use = minetest.registered_items["vessels:glass_bottle"].on_use + or function(itemstack, user, pointed_thing) + -- default behaviour when leftclicking with item + if pointed_thing.type == "object" then + pointed_thing.ref:punch(user, 1.0, {full_punch_interval = 1.0}, nil) + return user:get_wielded_item() + elseif pointed_thing.type == "node" then + local node = minetest.get_node(pointed_thing.under) + local node_def = minetest.registered_nodes[node.name] + if node_def then + node_def.on_punch(pointed_thing.under, node, user, pointed_thing) + end + return user:get_wielded_item() + end + end +minetest.override_item("vessels:glass_bottle", { + on_use = function(itemstack, user, pointed_thing) + if pointed_thing.type ~= "node" then + return old_glass_bottle_on_use(itemstack, user, pointed_thing) + end + + -- do protection checks and check if mortar is clicked + local pos = pointed_thing.under + local node = minetest.get_node(pos) + local new_node_name = take_oil_from_mortar[node.name] + + local user_is_player = user and minetest.is_player(user) + local user_name = user_is_player and user:get_player_name() or "" + + if minetest.is_protected(pos, user_name) or not new_node_name then + return old_glass_bottle_on_use(itemstack, user, pointed_thing) + end + + -- replace the node + node.name = new_node_name + minetest.swap_node(pos, node) + + -- fill the bottle + local creative_enabled = minetest.global_exists("creative") and + creative.is_enabled_for(user_name) + local item_count = itemstack:get_count() + -- try to replace + if item_count == 1 and not creative_enabled then + itemstack:set_name("farming:glass_bottle_with_rapeseed_oil") + return itemstack + end + -- do not take in creative + if not creative_enabled then + itemstack:take_item() + end + -- add full bottle to inventory or drop it + local full_bottle = ItemStack("farming:glass_bottle_with_rapeseed_oil") + if user_is_player then + local inv = user:get_inventory() + if inv then + full_bottle = inv:add_item("main", full_bottle) + end + end + if not full_bottle:is_empty() then + -- no space => drop full bottle + minetest.add_item(pos, full_bottle) + end + return itemstack + end, +}) + + +------------- +-- Craftitems +------------- + +minetest.register_craftitem("farming:raw_mortar", { + description = "Raw Mortar", + groups = {}, + inventory_image = "farming_raw_mortar.png", + stack_max = 16, +}) + +minetest.register_craftitem("farming:raw_pestle", { + description = "Raw Pestle", + groups = {}, + inventory_image = "farming_raw_pestle.png", + stack_max = 1, +}) + +minetest.register_craftitem("farming:glass_bottle_with_rapeseed_oil", { + description = "Bottle with Rapeseed Oil", + groups = {}, + inventory_image = "farming_rapeseed_oil.png^[mask:vessels_glass_bottle_liquidmask.png" + .. "^vessels_glass_bottle.png", + on_use = minetest.item_eat(3, "vessels:glass_bottle"), +}) + + +----------- +-- Crafting +----------- + +minetest.register_craft({ + output = "farming:raw_mortar", + recipe = { + {"default:clay_lump", "", "default:clay_lump"}, + {"", "default:clay_lump", ""}, + }, +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:mortar", + recipe = "farming:raw_mortar", + cooktime = 3, +}) + +minetest.register_craft({ + output = "farming:raw_pestle", + recipe = { + {"default:clay_lump"}, + {"default:clay_lump"}, + }, +}) + +minetest.register_craft({ + type = "cooking", + output = "farming:pestle", + recipe = "farming:raw_pestle", + cooktime = 3, +}) + +minetest.register_craft({ + type = "fuel", + recipe = "farming:glass_bottle_with_rapeseed_oil", + burntime = 13, + replacements = {{"farming:glass_bottle_with_rapeseed_oil", "vessels:glass_bottle"}}, +}) + +minetest.register_craft({ + output = "default:torch 4", + recipe = { + {"farming:glass_bottle_with_rapeseed_oil"}, + {"farming:cotton"}, + {"group:stick"}, + }, + replacements = {{"farming:glass_bottle_with_rapeseed_oil", "vessels:glass_bottle"}}, +}) diff --git a/mods/farming/textures/farming_mortar_mask.png b/mods/farming/textures/farming_mortar_mask.png new file mode 100644 index 0000000000000000000000000000000000000000..f44e3d2ab344b00aeefdcd1b1ff1cac4e5032572 GIT binary patch literal 182 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPGa4)6(aWnyCd|NlRb_y5lyAmbkp z{Q;7H{@2xQxc71wP=c`}$S;_|;n|He5GTpo-G!lpRn`N@;VkfoEM{Qf76xHPhFNnY zfP(BLp1!W^PnabbSkzQ=x8(wbL_A#_LpZJ{Cn)e5aB*=>IHw@Tzz`4nJ za0`PlBg3pY5H=O_9x83{2J=p*>p33LI*ru978nDPrYF1cQ}Ek?cwusrIrUG z7t&rFxayGlSU}^|*NpBeu3L(ok{*{!R((jhx!(S^{Qqv>yidD=*4^gab}#Mfj-{2t zGdi~>#e59@VZp3x(bz6o;P%R;!sJZK`-963Iu;#tN;YKFY?&&)QtzFK*4!+nFe}r( ztb-R7mgfHR{XBJ{yWk=V4XgVnH!JCGJk7N*IAdv7Op?U^d(~Ppd$_I@+2jhG`r*Iv w`uw>(mU(+->^}VKQHu77#G-xr?~}iATL##g$t_-30rU%lr>mdKI;Vst02a-6Y5)KL literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed.png b/mods/farming/textures/farming_rapeseed.png new file mode 100644 index 0000000000000000000000000000000000000000..35a4b42d32ccbafe910dab35bdb235bb9512e342 GIT binary patch literal 590 zcmV-U0*oax;RPb;7}Y&LS8BXu?h}C^OPKin2=}$!NqU6_gud3obSMQ;lD-{8JVt| zwPhOBWQOC+6NaHL0LRDgm9?<|SQ|^x7(yG;tSwKt?)VbNq4auv6^1_fe4Z#W0FtIX zWvvkys&C&jDjO~FJQqOCOf8jSndc@53Svx=x36zeC@f&D5o?W%UAVsr78fl5olZ)l znsDyIn)=Xx$LEtifB-ys;HxXQ-|(A_QYpr9lyo|&isKO1^(4zO06foAgFz-Q_b#jK z^efjl4`{c$BL`6wN-pP;Wf`vPP_I8@YwNybS;o_cmsC-E09?J>;^^>@%I3jjsQTG} zy`6;0MhnML;(2En3{I8fI1GnF@jO=nBBIFUa;m;_k+j|A-lG$ltk9??Ecjwu0tpnNJUY!uM4j6?O>_ z%)r1c48n{Iv*t(u1=&kHeO=j~FpGq=^9YT*VDx@#Nu>vf&}a01d$7DA@5hF zt+*HbSKjxHz1~-!7qcWKB>o8}p8UVXHj{(dieJ*u00{P^Rh&Hl1Rfrrv)iusoXSa; b009Q}k78FeyVc$T4QB9k^>bP0l+XkKLtr>V literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_2.png b/mods/farming/textures/farming_rapeseed_2.png new file mode 100644 index 0000000000000000000000000000000000000000..1f04fc217aea5897e7e23a9852c86ece54575936 GIT binary patch literal 219 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)23jDAloEQ4}b`S>O>_ z%)r1c48n{Iv*t(u1=&kHeO=j~FpG<^TkH0@Jq8M8c)B=-Se$;_zfrV7frnLJY>M7P zt(>V=#y1U`W*fNV)Y!SWcyq7guKfS0@!*5O>_ z%)r1c48n{Iv*t(u1=&kHeO=j~FpG1;7onO*p(t5}OKVoHuZy2!+FO>_ z%)r1c48n{Iv*t(u1=&kHeO=j~FpG)W!6o*82`i7Lb;qZs_E$T zIf+($TbwT~Y(A;I>W44qf&)SOcUHfMjCD-7$X74so8^A+xhca+^EXYqUo3D*Wr;A? zyIrYMw5sv`887MObIa literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_5.png b/mods/farming/textures/farming_rapeseed_5.png new file mode 100644 index 0000000000000000000000000000000000000000..b50fb2f0bf80e29170e02f07be6405e3c7a93412 GIT binary patch literal 340 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)3NSdl-C<djDJ+-afruEIc4W7py>JU&HLjYY`(_Y&3^k< zC-r4o^yIh|cQ(}eO;2ci{zY^TyOP7xV`tpixAas!TiMHC8QY}wA?>zz)ZNj!;&$h_k#(bNxyDf+Ey;Tmlw@DnnXf3j{$SVkgr#{3 zCp7KPg%tT&?vR|pebDGt^VIO`L04Kg^=&o0CcF9Hxs=BL^U~d{lh^KPIoBkTn7TK* jg5`xl{_pRH^%?3*94me{Sbtsz^els?tDnm{r-UW|wquEN literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_6.png b/mods/farming/textures/farming_rapeseed_6.png new file mode 100644 index 0000000000000000000000000000000000000000..c902cc01621c2c29efaf5379f8e18faa5dede15a GIT binary patch literal 379 zcmV->0fhdEP)O!R<`VL}dz+c?!0u<@Y~V8Ni)g+Rk~? zvt5zOmJ-1U>uq(R+}SCZ(}@`SB?3H1VDcbBFMxI8g@anPV7+BwDL+^?bg%p!e|mfe Z;0xJ9nqEB)r6&LY002ovPDHLkV1nb>ndtxk literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_7.png b/mods/farming/textures/farming_rapeseed_7.png new file mode 100644 index 0000000000000000000000000000000000000000..aad89e51721be2ef0ca514bdc6eb03e7a0306771 GIT binary patch literal 409 zcmV;K0cQS*P)KS3aP@a zFb^c>*omdlofO&k-OqR5$pQYg9k0^A*y6(LWXItH^D3yi=0F9E;;UAPx7 zC*g~hKVm9?B4tNRyI4cDZ7UMXcaZqbR3Mmf)~sxYR}a}P8*Clx(zMh9=%&+eda`Z@ zoTx}))LaDYvBo`KL?A(tLXY14A5*gk^N4@E-2ec;K}w-ZiSU=500000NkvXXu0mjf D_iv^E literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_8.png b/mods/farming/textures/farming_rapeseed_8.png new file mode 100644 index 0000000000000000000000000000000000000000..86783b0acc7229caa48da6cf07f61d2683bf733b GIT binary patch literal 356 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)0_y_Ar!59XCA$6yYrJ zh%9Dc;1&j9Muu5)B!GhKC7!;n>`$1*#YDKXc9`D<3Vrl+aSX9IeKu$zU$cS8o=ItG zGad9Cbt0SQ&pP1uk(uMr^pMYr+>RfZHFTO%vV=?hk5` zuCG4fw6}et*@ox4U)(zAC8D}?hG4+u&#^4uW3Kq}FwDxjw^^%WQqUD&8{ZeV5|x&` zj5)h%s}i?qenC+2`RtRDC*$uPvD)$c&>WX64_O9|bAL`dFwdx5Cb$0Nv@JhXK3p@N z6tz?I#_t;8hc6eO{ct8=`GkiXObl>??a_1A4$pv8JS#cID?97BV?^WJ4^kInnS4)i>Or>mdKI;Vst0PJLp AlK=n! literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_in_mortar.png b/mods/farming/textures/farming_rapeseed_in_mortar.png new file mode 100644 index 0000000000000000000000000000000000000000..7d01dbca2ff2bbb1c521d9a7337d2c7a440e8c19 GIT binary patch literal 565 zcmV-50?Pe~P)umOorCF%03=X$nz!;D4nJE^b={S zE)z((R2IdY^YcaY-bE>io0~UdS(Y(LlK9~9hst?Hq5j0*-p+|J5<&nXT5GJeI9FCS zhx-}#o_t&<7>y>h+sk^r4*(>I!nqPD1>OggN*TV{CGWK9blL!jg9YCj(|Jz*D>sb}#_Y(d}uA=w}041(^OjDz#00000NkvXXu0mjf D4=?Y< literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_rapeseed_oil.png b/mods/farming/textures/farming_rapeseed_oil.png new file mode 100644 index 0000000000000000000000000000000000000000..878ec28734d998350b09deb7459310f386b17f7b GIT binary patch literal 770 zcmV+d1O5DoP) z5V-t%MJ@l}{2DionHW7G%(zdDrGj+|L|#T={dHuubhLMlG{NOxN-ha!1NEk1PT8on zk#JB>*UIWKb9&=Qsj_|wj8~4Xvkb$)`pE%+R?2O_n2hs>9w&)u zP^OHC;rvSvCehkLy$j5f;kz##=9GJlhY1nk<#oguh`&$dZN!*{s_^O$Koe;jDCG?A zN8%y#{G-M7$BFsI0FB-`+#bq1X!C-#k$5yO z3-z`GKtx#HC;FI~HW66pkCl2C$+;n7$k`y?gZCD{&&(Tx$b@r>+0Dctq^-gGh5j)z zT&#^m|Y|MTrsD7 zuHA9wbPd*ex}$ojx#=mTVakW7>8+y_Vf{1%hSPN> z91P#S?|=#KBi<*hjmU#iZxs4nJ za0`PlBg3pY5H=O_9x83{Hi?bL{_B$h1PnyIEHAPzk0#Zi#brB<>C6@ypcOU z@M$e-7oIeC`iYpcsRB%vO}jhJRKHET@`U5sst5WStA4O|*<1hK!?51IQF7gdQk8G6 zUd)LaE(cba_&mIKQMT=w^RAC^y!~ePd=ei!ZqC>ddT8>|md&0;W>bu=z5AqE+A`&# zijGjM#*$@mdKI;Vst06#HnlK=n! literal 0 HcmV?d00001 diff --git a/mods/farming/textures/farming_raw_pestle.png b/mods/farming/textures/farming_raw_pestle.png new file mode 100644 index 0000000000000000000000000000000000000000..e2359f3dac1daede0f1dbc5a777d1c86d8af09cd GIT binary patch literal 306 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6n3BBRT^Rni_n+Ah4nJ za0`PlBg3pY5H=O_9x83{OUT(eO~ARg${eVIEHAPpL)U3kExL7=)?80j}9d> zY)*K1)u-gS>YM^=J-M yk?r$bcBriDE3bcCLAhVigpk=2oD1x0zi>8kI_4&uzd8!^4uhwwpUXO@geCw6%X2UQ literal 0 HcmV?d00001 diff --git a/mods/vessels/textures/vessels_glass_bottle_liquidmask.png b/mods/vessels/textures/vessels_glass_bottle_liquidmask.png new file mode 100644 index 0000000000000000000000000000000000000000..f94f8010dfea36c9b1a099a86ad1ec43e8939e92 GIT binary patch literal 174 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!D3?x-;bCrM;TYyi9E0F&G|NqjP^X~##j3q&S z!3+-1Zlr-YN#5=*3>~bp9zYIffk$L90|U1(2s1Lwnj--eWH0gbb!C6TEH17fw8feY zWP+lni(?4K_2h&Dj1tlkGx!Y*WD^o<4;