add more fuels

This commit is contained in:
ademant 2023-07-02 07:46:47 +00:00
parent 85176eb3cd
commit e8cacf03ff
4 changed files with 36 additions and 13 deletions

12
config.lua Normal file
View File

@ -0,0 +1,12 @@
oillamps.burn_resource = {"basic_materials:oil_extract","ethereal:palm_wax","basic_materials:paraffin"}
oillamps.bexist = false
oillamps.existing_ressource = {}
-- check that at least one burning ressource exist
for _,resource in pairs(oillamps.burn_resource) do
oillamps.bexist = oillamps.bexist or (minetest.registered_items[resource] ~= nil)
if (minetest.registered_items[resource]) then
table.insert(oillamps.existing_ressource,resource)
end
end

View File

@ -14,14 +14,19 @@ minetest.register_craft({
cooktime = 3
})
minetest.register_craft({
output = "basic_materials:oil_extract 2",
recipe = {{"group:seed","group:seed"},{"group:seed","group:seed"}},
})
if minetest.registered_items["basic_materials:oil_extract"] then
minetest.register_craft({
output = "basic_materials:oil_extract 2",
recipe = {{"group:seed","group:seed"},{"group:seed","group:seed"}},
})
end
-- fill an empty oil lamp with oil extract
minetest.register_craft({
recipe = {{"basic_materials:oil_extract"},{"oillamps:oillampempty"}},
output = "oillamps:oillamp 1",
})
for _,resource in pairs(oillamps.existing_ressource) do
if minetest.registered_items[resource] then
minetest.register_craft({
recipe = {{resource},{"oillamps:oillampempty"}},
output = "oillamps:oillamp 1",
})
end
end

View File

@ -7,9 +7,14 @@ modname = minetest.get_current_modname(),
minetest.log("action", "[MOD]"..oillamps.modname.." -- start loading ")
dofile(oillamps.modpath .. "/nodes.lua")
dofile(oillamps.modpath .. "/craftitems.lua")
dofile(oillamps.modpath .. "/crafts.lua")
dofile(oillamps.modpath .. "/config.lua")
if(oillamps.bexist) then
dofile(oillamps.modpath .. "/nodes.lua")
dofile(oillamps.modpath .. "/craftitems.lua")
dofile(oillamps.modpath .. "/crafts.lua")
else
minetest.log("action", "[MOD]"..oillamps.modname.." -- no ressources found -> not defining oil lamps ")
end
minetest.log("action", "[MOD]"..oillamps.modname.." -- end loading ")

View File

@ -1,3 +1,4 @@
name = oillamps
depends = default,basic_materials
depends = default
optional_depends = basic_materials,ethereal
description = Create oillamps with oil from leaves (basic_materials) or create oil with seeds.