mirror of
https://github.com/APercy/airutils.git
synced 2025-03-15 08:01:22 +00:00
Merge pull request #23 from farribeiro/biofuel
Change to core namespace in biofuel code
This commit is contained in:
commit
cceeabe338
1 changed files with 23 additions and 25 deletions
|
@ -4,7 +4,7 @@
|
||||||
local S = airutils.S
|
local S = airutils.S
|
||||||
local module_name = "airutils"
|
local module_name = "airutils"
|
||||||
|
|
||||||
if minetest.get_modpath("technic") then
|
if core.get_modpath("technic") then
|
||||||
if technic then
|
if technic then
|
||||||
technic.register_extractor_recipe({input = {"farming:wheat 33"}, output = "biofuel:biofuel 1"})
|
technic.register_extractor_recipe({input = {"farming:wheat 33"}, output = "biofuel:biofuel 1"})
|
||||||
technic.register_extractor_recipe({input = {"farming:corn 33"}, output = "biofuel:biofuel 1"})
|
technic.register_extractor_recipe({input = {"farming:corn 33"}, output = "biofuel:biofuel 1"})
|
||||||
|
@ -14,7 +14,7 @@ if minetest.get_modpath("technic") then
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if minetest.get_modpath("basic_machines") then
|
if core.get_modpath("basic_machines") then
|
||||||
if basic_machines then
|
if basic_machines then
|
||||||
basic_machines.grinder_recipes["farming:wheat"] = {50,"biofuel:biofuel",1}
|
basic_machines.grinder_recipes["farming:wheat"] = {50,"biofuel:biofuel",1}
|
||||||
basic_machines.grinder_recipes["farming:corn"] = {50,"biofuel:biofuel",1}
|
basic_machines.grinder_recipes["farming:corn"] = {50,"biofuel:biofuel",1}
|
||||||
|
@ -23,8 +23,8 @@ if minetest.get_modpath("basic_machines") then
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if minetest.get_modpath("default") then
|
if core.get_modpath("default") then
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = module_name .. ":biofuel_distiller",
|
output = module_name .. ":biofuel_distiller",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
{"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"},
|
||||||
|
@ -33,8 +33,8 @@ if minetest.get_modpath("default") then
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
if minetest.get_modpath("mcl_core") then
|
if core.get_modpath("mcl_core") then
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
output = module_name .. ":biofuel_distiller",
|
output = module_name .. ":biofuel_distiller",
|
||||||
recipe = {
|
recipe = {
|
||||||
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||||
|
@ -47,18 +47,18 @@ end
|
||||||
|
|
||||||
-- biofuel
|
-- biofuel
|
||||||
local new_gallon_id = "airutils:biofuel"
|
local new_gallon_id = "airutils:biofuel"
|
||||||
minetest.register_craftitem(new_gallon_id,{
|
core.register_craftitem(new_gallon_id,{
|
||||||
description = S("Bio Fuel"),
|
description = S("Bio Fuel"),
|
||||||
inventory_image = "airutils_biofuel_inv.png",
|
inventory_image = "airutils_biofuel_inv.png",
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
core.register_craft({
|
||||||
type = "fuel",
|
type = "fuel",
|
||||||
recipe = new_gallon_id,
|
recipe = new_gallon_id,
|
||||||
burntime = 50,
|
burntime = 50,
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_alias("biofuel:biofuel", new_gallon_id) --for the old biofuel
|
core.register_alias("biofuel:biofuel", new_gallon_id) --for the old biofuel
|
||||||
|
|
||||||
local ferment = {
|
local ferment = {
|
||||||
{"default:papyrus", new_gallon_id},
|
{"default:papyrus", new_gallon_id},
|
||||||
|
@ -82,7 +82,7 @@ local biofueldistiller_formspec = "size[8,9]"
|
||||||
.. "listring[current_player;main]"
|
.. "listring[current_player;main]"
|
||||||
.. "image[3.5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"
|
.. "image[3.5,1;1,1;gui_furnace_arrow_bg.png^[transformR270]"
|
||||||
|
|
||||||
minetest.register_node( module_name .. ":biofuel_distiller", {
|
core.register_node( module_name .. ":biofuel_distiller", {
|
||||||
description = S("Biofuel Distiller"),
|
description = S("Biofuel Distiller"),
|
||||||
tiles = {"airutils_black.png", "airutils_aluminum.png", "airutils_copper.png" },
|
tiles = {"airutils_black.png", "airutils_aluminum.png", "airutils_copper.png" },
|
||||||
drawtype = "mesh",
|
drawtype = "mesh",
|
||||||
|
@ -94,11 +94,11 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
},
|
},
|
||||||
legacy_facedir_simple = true,
|
legacy_facedir_simple = true,
|
||||||
|
|
||||||
on_place = minetest.rotate_node,
|
on_place = core.rotate_node,
|
||||||
|
|
||||||
on_construct = function(pos)
|
on_construct = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
|
|
||||||
meta:set_string("formspec", biofueldistiller_formspec)
|
meta:set_string("formspec", biofueldistiller_formspec)
|
||||||
meta:set_string("infotext", S("Biofuel Distiller"))
|
meta:set_string("infotext", S("Biofuel Distiller"))
|
||||||
|
@ -112,7 +112,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
|
|
||||||
can_dig = function(pos,player)
|
can_dig = function(pos,player)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = core.get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
if not inv:is_empty("dst")
|
if not inv:is_empty("dst")
|
||||||
|
@ -125,7 +125,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
|
|
||||||
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_take = function(pos, listname, index, stack, player)
|
||||||
|
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if core.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
|
|
||||||
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
allow_metadata_inventory_put = function(pos, listname, index, stack, player)
|
||||||
|
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if core.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
|
|
||||||
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||||
|
|
||||||
if minetest.is_protected(pos, player:get_player_name()) then
|
if core.is_protected(pos, player:get_player_name()) then
|
||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -160,14 +160,14 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
|
|
||||||
on_metadata_inventory_put = function(pos)
|
on_metadata_inventory_put = function(pos)
|
||||||
|
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = core.get_node_timer(pos)
|
||||||
|
|
||||||
timer:start(5)
|
timer:start(5)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = function(pos)
|
on_timer = function(pos)
|
||||||
|
|
||||||
local meta = minetest.get_meta(pos) ; if not meta then return end
|
local meta = core.get_meta(pos) ; if not meta then return end
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
|
|
||||||
-- is barrel empty?
|
-- is barrel empty?
|
||||||
|
@ -198,7 +198,7 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
for k, v in pairs(inv_content) do
|
for k, v in pairs(inv_content) do
|
||||||
local item_name = v:get_name()
|
local item_name = v:get_name()
|
||||||
for n = 1, #ferment_groups do
|
for n = 1, #ferment_groups do
|
||||||
if minetest.get_item_group(item_name, ferment_groups[n]) == 1 then
|
if core.get_item_group(item_name, ferment_groups[n]) == 1 then
|
||||||
has_group = n
|
has_group = n
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
@ -252,18 +252,16 @@ minetest.register_node( module_name .. ":biofuel_distiller", {
|
||||||
})
|
})
|
||||||
|
|
||||||
--lets remove the old one
|
--lets remove the old one
|
||||||
minetest.register_node(":".."biofuel:biofuel_distiller", {
|
core.register_node(":".."biofuel:biofuel_distiller", {
|
||||||
groups = {old_biofuel=1},
|
groups = {old_biofuel=1},
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_abm({
|
core.register_abm({
|
||||||
nodenames = {"group:old_biofuel"},
|
nodenames = {"group:old_biofuel"},
|
||||||
interval = 1,
|
interval = 1,
|
||||||
chance = 1,
|
chance = 1,
|
||||||
action = function(pos, node)
|
action = function(pos, node)
|
||||||
--minetest.remove_node(pos)
|
--core.remove_node(pos)
|
||||||
minetest.swap_node(pos,{name = module_name..":biofuel_distiller"})
|
core.swap_node(pos,{name = module_name..":biofuel_distiller"})
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue