Fix greaser to return empty glass.

This commit is contained in:
SFENCE 2022-04-30 21:03:43 +02:00
parent e6231c0403
commit 9160bc7edc
2 changed files with 12 additions and 5 deletions

View File

@ -4,17 +4,13 @@ if minetest.get_modpath("basic_materials") then
groups = {shaft_gear = 1},
})
end
if minetest.get_modpath("hades_extramaterials") then
minetest.override_item("hades_extramaterials:gear_steel", {
groups = {shaft_gear = 1},
})
end
if minetest.get_modpath("farming") then
if minetest.registered_items["farming:hemp_oil"] then
minetest.override_item("farming:hemp_oil", {
_agrease = 1,
_qgrease = 0.5,
_grease_empty = "vessels:glass_bottle",
_inspect_msg_func = power_generators.grease_inspect_msg,
on_use = power_generators.apply_grease,
})
@ -26,6 +22,8 @@ if minetest.get_modpath("hades_extrafarming") then
minetest.override_item("hades_extrafarming:hemp_oil", {
_agrease = 1,
_qgrease = 0.5,
_grease_empty = "vessels:glass_bottle",
_inspect_msg_func = power_generators.grease_inspect_msg,
on_use = power_generators.apply_grease,
})
appliances.add_item_help("hades_extrafarming:hemp_oil", "Can be used as grease.")

View File

@ -324,6 +324,15 @@ function power_generators.apply_grease(itemstack, user, pointed_thing)
end
itemstack:take_item()
if idef._grease_empty then
local inv = user:get_inventory()
local notadd = inv:add_item("main", ItemStack(idef._grease_empty))
if notadd:get_count()>0 then
minetest.add_item(user:get_pos(), notadd)
end
end
return itemstack
end