made compatibility alias for my old biofuel mod

This commit is contained in:
Alexsandro Percy 2023-08-12 11:44:10 -03:00
parent ff14be2bbe
commit 51402809a5
3 changed files with 18 additions and 13 deletions

View file

@ -46,23 +46,26 @@ end
-- biofuel
minetest.register_craftitem(":biofuel:biofuel",{
local new_gallon_id = "airutils:biofuel"
minetest.register_craftitem(new_gallon_id,{
description = "Bio Fuel",
inventory_image = "airutils_biofuel_inv.png",
})
minetest.register_craft({
type = "fuel",
recipe = "biofuel:biofuel",
recipe = new_gallon_id,
burntime = 50,
})
minetest.register_alias("biofuel:biofuel", new_gallon_id) --for the old biofuel
local ferment = {
{"default:papyrus", "biofuel:biofuel"},
{"farming:wheat", "biofuel:biofuel"},
{"farming:corn", "biofuel:biofuel"},
{"farming:baked_potato", "biofuel:biofuel"},
{"farming:potato", "biofuel:biofuel"}
{"default:papyrus", new_gallon_id},
{"farming:wheat", new_gallon_id},
{"farming:corn", new_gallon_id},
{"farming:baked_potato", new_gallon_id},
{"farming:potato", new_gallon_id}
}
local ferment_groups = {'flora', 'leaves', 'flower', 'sapling', 'tree', 'wood', 'stick', 'plant', 'seed',
@ -221,7 +224,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
return true
end
if has_group and not inv:room_for_item("dst", "biofuel:biofuel") then
if has_group and not inv:room_for_item("dst", new_gallon_id) then
meta:set_string("infotext", "Fuel Distiller (FULL)")
return true
end
@ -240,7 +243,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
for i,itemstack in pairs(inv:get_list("src")) do
inv:remove_item("src", ItemStack(itemstack:get_name().." 1"))
end
inv:add_item("dst", "biofuel:biofuel")
inv:add_item("dst", new_gallon_id)
end
meta:set_float("status", 0,0)

View file

@ -24,7 +24,8 @@ airutils.is_minetest = minetest.get_modpath("player_api")
airutils.is_mcl = minetest.get_modpath("mcl_player")
airutils.fuel = {['biofuel:biofuel'] = 1,['biofuel:bottle_fuel'] = 1,
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10}
['biofuel:phial_fuel'] = 0.25, ['biofuel:fuel_can'] = 10,
['airutils:biofuel'] = 1,}
if not minetest.settings:get_bool('airutils.disable_papi') then
dofile(minetest.get_modpath("airutils") .. DIR_DELIM .. "airutils_papi.lua")

View file

@ -10,17 +10,18 @@ end
function airutils.loadFuel(self, player_name)
local player = minetest.get_player_by_name(player_name)
local inv = player:get_inventory()
local itmstck=player:get_wielded_item()
local item_name = ""
if itmstck then item_name = itmstck:get_name() end
local fuel = airutils.contains(airutils.fuel, item_name)
if fuel then
local stack = ItemStack(item_name .. " 1")
--local stack = ItemStack(item_name .. " 1")
if self._energy < self._max_fuel then
inv:remove_item("main", stack)
itmstck:set_count(1)
inv:remove_item("main", itmstck)
self._energy = self._energy + fuel
if self._energy > self._max_fuel then self._energy = self._max_fuel end