diff --git a/biofuel.lua b/biofuel.lua index f351a0b..9d9cc43 100644 --- a/biofuel.lua +++ b/biofuel.lua @@ -5,23 +5,6 @@ local S = minetest.get_translator("biofuel") --Biofuel: ---------- ---Empty Vial -minetest.register_craftitem("biofuel:phial", { - description = S("Empty Vial"), - inventory_image = "biofuel_phial.png" -}) - -minetest.register_craft({ - output = "biofuel:phial 6", - recipe = {{"default:glass"}, - {"default:glass"}}, -}) - -minetest.register_craft({ - type = "shapeless", - output = "vessels:glass_fragments", - recipe = {"biofuel:phial","biofuel:phial","biofuel:phial"}, -}) --Vial of Biofuel minetest.register_craftitem("biofuel:phial_fuel", { @@ -33,7 +16,6 @@ minetest.register_craft({ type = "fuel", recipe = "biofuel:phial_fuel", burntime = 10, - replacements = {{"biofuel:phial_fuel", "biofuel:phial"}}, }) @@ -42,13 +24,13 @@ minetest.register_craft({ minetest.register_craftitem("biofuel:bottle_fuel", { description = S("Bottle of Biofuel"), inventory_image = "biofuel_bottle_fuel.png", + groups = {biofuel = 1} }) minetest.register_craft({ type = "shapeless", output = "biofuel:bottle_fuel", - recipe = {"biofuel:phial_fuel", "biofuel:phial_fuel", "biofuel:phial_fuel", "biofuel:phial_fuel","vessels:glass_bottle"}, - replacements = {{"biofuel:phial_fuel", "biofuel:phial"},{"biofuel:phial_fuel", "biofuel:phial"},{"biofuel:phial_fuel", "biofuel:phial"},{"biofuel:phial_fuel", "biofuel:phial"}}, + recipe = {"biofuel:phial_fuel", "biofuel:phial_fuel", "biofuel:phial_fuel", "biofuel:phial_fuel"} }) @@ -56,33 +38,11 @@ minetest.register_craft({ type = "fuel", recipe = "biofuel:bottle_fuel", burntime = 40, - replacements = {{"biofuel:bottle_fuel", "vessels:glass_bottle"}}, }) --Canister of Biofuel -minetest.register_craftitem("biofuel:can", { - description = S("Empty Canister"), - inventory_image = "biofuel_fuel_can.png" -}) - -if minetest.get_modpath("technic") then - minetest.register_craft({ - output = "biofuel:can", - recipe = {{"technic:water_can"}} - }) -else - minetest.register_craft({ - output = "biofuel:can", - recipe = { - {"default:steel_ingot","default:bronze_ingot","default:steel_ingot"}, - {"default:steel_ingot","","default:steel_ingot"}, - {"default:steel_ingot","default:steel_ingot","default:steel_ingot"} - }, - }) -end - minetest.register_craftitem("biofuel:fuel_can", { description = S("Canister of Biofuel"), inventory_image = "biofuel_fuel_can.png" @@ -91,18 +51,7 @@ minetest.register_craftitem("biofuel:fuel_can", { minetest.register_craft({ type = "fuel", recipe = "biofuel:fuel_can", - burntime = 320, - replacements = {{"biofuel:fuel_can", "biofuel:can"}}, -}) - -minetest.register_craft({ - output = "biofuel:fuel_can", - recipe = { - {"biofuel:bottle_fuel", "biofuel:bottle_fuel", "biofuel:bottle_fuel"}, - {"biofuel:bottle_fuel", "biofuel:bottle_fuel", "biofuel:bottle_fuel"}, - {"biofuel:bottle_fuel", "biofuel:can", "biofuel:bottle_fuel"} - }, - replacements = {{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"},{"biofuel:bottle_fuel", "vessels:glass_bottle"}}, + burntime = 370, }) minetest.register_craft({ @@ -110,8 +59,8 @@ minetest.register_craft({ recipe = { {"group:biofuel", "group:biofuel", "group:biofuel"}, {"group:biofuel", "group:biofuel", "group:biofuel"}, - {"group:biofuel", "biofuel:can", "group:biofuel"} - } + {"group:biofuel", "group:biofuel", "group:biofuel"} + } }) diff --git a/changelog.md b/changelog.md index a46185a..fb01cf2 100644 --- a/changelog.md +++ b/changelog.md @@ -68,4 +68,6 @@ Version 0.7 ----------- Translation of the logging function removed due to errors (Lokrates) -Add use_alpha_texture property (Lokrates) \ No newline at end of file +Add use_alpha_texture property (Lokrates) + +Additional trunks support (nixnoxus) \ No newline at end of file diff --git a/fix_furnace.lua b/fix_furnace.lua deleted file mode 100644 index 6eca9ba..0000000 --- a/fix_furnace.lua +++ /dev/null @@ -1,39 +0,0 @@ - --- THIS CODE CAN BE REMOVED WHEN ISSUES https://gitlab.com/VanessaE/pipeworks/-/merge_requests/47 AND https://github.com/minetest/minetest_game/pull/2895 WILL BE MERGED. - -local function biofuel_fix_furance(pos) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local item = inv:get_stack("fuel", 1) - local is_fuel = minetest.get_craft_result({method = "fuel", width = 1, items = {item:to_string()}}) - if is_fuel.time == 0 then - inv:set_stack("fuel", 1, "") - local leftover = inv:add_item("dst", item) - if not leftover:is_empty() then - local above = vector.new(pos.x, pos.y + 1, pos.z) - local drop_pos = minetest.find_node_near(above, 1, {"air"}) or above - minetest.item_drop(replacements[1], nil, drop_pos) - end - end -end - -local furnace_def = minetest.registered_nodes["default:furnace"] -local old_on_timer = furnace_def.on_timer; -minetest.override_item("default:furnace", { - on_timer = function(pos, elapsed) - local ret = old_on_timer(pos, elapsed) - biofuel_fix_furance(pos) - return ret - end -}) - -local furnace_active_def = minetest.registered_nodes["default:furnace_active"] -local old_on_timer_active = furnace_active_def.on_timer; -minetest.override_item("default:furnace_active", { - on_timer = function(pos, elapsed) - local ret = old_on_timer(pos, elapsed) - biofuel_fix_furance(pos) - return ret - end -}) - diff --git a/init.lua b/init.lua index ce967ac..7d9bd08 100644 --- a/init.lua +++ b/init.lua @@ -1,8 +1,2 @@ dofile(minetest.get_modpath('biofuel')..'/biofuel.lua') dofile(minetest.get_modpath('biofuel')..'/refinery.lua') - --- THIS CODE CAN BE REMOVED WHEN ISSUES https://gitlab.com/VanessaE/pipeworks/-/merge_requests/47 AND https://github.com/minetest/minetest_game/pull/2895 WILL BE MERGED. -if minetest.settings:get_bool("biofuel_fix_furnace",true) then - dofile(minetest.get_modpath('biofuel')..'/fix_furnace.lua') -end - diff --git a/mod.conf b/mod.conf index 6220cfa..e244e03 100644 --- a/mod.conf +++ b/mod.conf @@ -1,8 +1,8 @@ name = biofuel author = Lokrates description = A Minetest-Mod to produce biofuel from unused plants. -min_minetest_version = 5.0 +min_minetest_version = 5.4 depends = default optional_depends = pipeworks,farming,pooper,wine,basic_materials,cucina_vegana,moretrees,vines,hopper -version = 0.6 +version = 0.7 title = Biofuel diff --git a/refinery.lua b/refinery.lua index 7c82feb..453e0bc 100644 --- a/refinery.lua +++ b/refinery.lua @@ -7,7 +7,7 @@ --Modified Work Copyright (C) 2018 naturefreshmilk --Modified Work Copyright (C) 2019 OgelGames --Modified Work Copyright (C) 2020 6r1d ---Modified Work Copyright (C) 2021 SFENCE +--Modified Work Copyright (C) 2021 nixnoxus -- Load support for MT game translation. @@ -58,8 +58,8 @@ biomass.convertible_nodes = { 'cucina_vegana:flax', 'cucina_vegana:flax_roasted', 'cucina_vegana:sunflower', -- cucina_vegana 'cucina_vegana:soy', 'cucina_vegana:chives', 'vines:vines', 'vines:rope', 'vines:rope_block', -- Vines - 'trunks:moss_plain_0', 'trunks:moss_with_fungus_0', 'trunks:twig_1', - 'bushes:BushLeaves1', 'bushes:BushLeaves2', + 'trunks:moss_plain_0', 'trunks:moss_with_fungus_0', 'trunks:twig_1', + 'bushes:BushLeaves1', 'bushes:BushLeaves2', 'dryplants:grass', 'dryplants:hay', 'dryplants:reed', 'dryplants:reedmace_sapling', 'dryplants:wetreed', 'poisonivy:climbing', 'poisonivy:seedling', 'poisonivy:sproutling', } @@ -139,18 +139,6 @@ plants_input = tonumber(minetest.settings:get("biomass_input")) or 4 -- The num bottle_output = minetest.settings:get_bool("refinery_output") -- Change of refinery output between vial or bottle (settingtypes.txt) if bottle_output == nil then bottle_output = false end -- default false -local function is_vessel(input) - if bottle_output then - if (input=="vessels:glass_bottle") then - return true - end - else - if (input=="biofuel:phial") then - return true - end - end - return false -end local function formspec(pos) local spos = pos.x..','..pos.y..','..pos.z @@ -187,10 +175,7 @@ local function count_input(pos) local inv = meta:get_inventory() local stacks = inv:get_list('src') for k in pairs(stacks) do - local stack = inv:get_stack('src', k) - if (is_vessel(stack:get_name())==false) then - q = q + stack:get_count() - end + q = q + inv:get_stack('src', k):get_count() end return q end @@ -206,18 +191,6 @@ local function count_output(pos) return q end -local function have_vessel(pos) - local meta = minetest.get_meta(pos) - local inv = meta:get_inventory() - local stacks = inv:get_list('src') - for k in pairs(stacks) do - if is_vessel(inv:get_stack('src', k):get_name()) then - return true - end - end - return false -end - local function is_empty(pos) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() @@ -258,17 +231,16 @@ local function update_timer(pos) return end local count = count_input(pos) - local vessel = have_vessel(pos) local refinery_time = minetest.settings:get("fuel_production_time") or 10 -- Timebase (settingtypes.txt) - if not timer:is_started() and count >= plants_input and vessel then -- Input + if not timer:is_started() and count >= plants_input then -- Input timer:start((refinery_time)/5) -- Timebase meta:set_int('progress', 0) meta:set_string('infotext', S("progress: @1%", "0")) return end - if timer:is_started() and (count < plants_input or not vessel) then -- Input + if timer:is_started() and count < plants_input then -- Input timer:stop() - meta:set_string('infotext', S("To start fuel production add biomass or vessel")) + meta:set_string('infotext', S("To start fuel production add biomass ")) meta:set_int('progress', 0) end end @@ -281,7 +253,7 @@ local function create_biofuel(pos) local stacks = inv:get_list('src') for k in pairs(stacks) do local stack = inv:get_stack('src', k) - if (not stack:is_empty()) and (not is_vessel(stack:get_name())) then + if not stack:is_empty() then local count = stack:get_count() if count <= q then inv:set_stack('src', k, '') @@ -299,10 +271,8 @@ local function create_biofuel(pos) local count = stack:get_count() if 99 > count then if bottle_output then - inv:remove_item('src', ItemStack('vessels:glass_bottle')) inv:set_stack('dst', k, 'biofuel:bottle_fuel ' .. (count + 1)) else - inv:remove_item('src', ItemStack('biofuel:phial')) inv:set_stack('dst', k, 'biofuel:phial_fuel ' .. (count + 1)) end break @@ -326,12 +296,12 @@ local function on_timer(pos) meta:set_int('progress', 0) return false end - if count_input(pos) >= plants_input and have_vessel(pos) then --Input + if count_input(pos) >= plants_input then --Input meta:set_string('infotext', S("progress: @1%", progress)) return true else timer:stop() - meta:set_string('infotext', S("To start fuel production add biomass or vessel ")) + meta:set_string('infotext', S("To start fuel production add biomass ")) meta:set_int('progress', 0) return false end @@ -342,7 +312,7 @@ local function on_construct(pos) local inv = meta:get_inventory() inv:set_size('src', 9) -- Input Fields inv:set_size('dst', 4) -- Output Fields - meta:set_string('infotext', S("To start fuel production add biomass and vessel ")) + meta:set_string('infotext', S("To start fuel production add biomass ")) meta:set_int('progress', 0) end @@ -374,8 +344,8 @@ local tube = { insert_object = function(pos, node, stack, direction) local meta = minetest.get_meta(pos) local inv = meta:get_inventory() - local insertable = is_convertible(stack:get_name()) or is_vessel(stack:get_name()) - if not insertable then + local convertible = is_convertible(stack:get_name()) + if not convertible then return stack end @@ -389,7 +359,7 @@ local tube = { local inv = meta:get_inventory() stack = stack:peek_item(1) - return (is_convertible(stack:get_name()) or is_vessel(stack:get_name())) and inv:room_for_item("src", stack) + return is_convertible(stack:get_name()) and inv:room_for_item("src", stack) end, input_inventory = "dst", connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1} @@ -412,7 +382,7 @@ local function allow_metadata_inventory_put(pos, listname, index, stack, player) return 0 end - if listname == 'src' and (is_convertible(stack:get_name()) or is_vessel(stack:get_name())) then + if listname == 'src' and is_convertible(stack:get_name()) then return stack:get_count() else return 0 diff --git a/textures/biofuel_phial.png b/textures/biofuel_phial.png deleted file mode 100644 index c77b824..0000000 Binary files a/textures/biofuel_phial.png and /dev/null differ