Fix: Sandwich slices

This commit is contained in:
N-Nachtigal 2025-05-30 01:03:33 +02:00
parent 5cfbea5f51
commit ef52910688
3 changed files with 759 additions and 753 deletions

File diff suppressed because it is too large Load diff

View file

@ -9,21 +9,21 @@ minetest.register_node("ma_pops_furniture:toaster", {
"mp_toas_right.png",
"mp_toas_left.png",
"mp_toas_back.png",
"mp_toas_front.png"
"mp_toas_front.png",
},
walkable = false,
groups = { snappy=3 },
groups = { snappy = 3 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
drawtype = "nodebox",
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125},
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25},
},
},
type = "fixed",
fixed = {
{ -0.375, -0.5, 0, 0.375, -0.0625, 0.3125 },
{ -0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25 },
},
},
})
local function breadslice_on_use(itemstack, user, pointed_thing)
@ -38,10 +38,10 @@ local function breadslice_on_use(itemstack, user, pointed_thing)
if node and pos and (node.name == "ma_pops_furniture:toaster") then
if minetest.is_protected(pos, pname) then
minetest.record_protection_violation(pos, pname)
else
if itemstack:get_count() >= 2 then
itemstack:take_item(2)
minetest.set_node(pos, {name = "ma_pops_furniture:toaster_with_breadslice", param2 = node.param2})
else
if itemstack:get_count() >= 2 then
itemstack:take_item(2)
minetest.set_node(pos, { name = "ma_pops_furniture:toaster_with_breadslice", param2 = node.param2 })
return itemstack
end
end
@ -51,13 +51,16 @@ local function breadslice_on_use(itemstack, user, pointed_thing)
end
if minetest.registered_items["farming:bread_slice"] then
minetest.override_item("farming:bread_slice", {on_use = breadslice_on_use })
minetest.override_item("farming:bread_slice", { on_use = breadslice_on_use })
minetest.register_alias("ma_pops_furniture:breadslice", "farming:bread_slice")
elseif minetest.registered_items["sandwiches:bread_slice"] then
minetest.override_item("sandwiches:bread_slice", { on_use = breadslice_on_use })
minetest.register_alias("ma_pops_furniture:breadslice", "sandwiches:bread_slice")
else
minetest.register_craftitem("ma_pops_furniture:breadslice", {
description = S("Slice of Bread"),
inventory_image = "mp_breadslice.png",
groups = {flammable = 2},
groups = { flammable = 2 },
on_use = breadslice_on_use,
})
end
@ -69,7 +72,7 @@ else
description = S("Toast"),
inventory_image = "mp_toast.png",
on_use = minetest.item_eat(3),
groups = {flammable = 2},
groups = { flammable = 2 },
})
end
@ -81,10 +84,10 @@ minetest.register_node("ma_pops_furniture:toaster_with_breadslice", {
"mp_toas_right_bread.png",
"mp_toas_left_bread.png",
"mp_toas_back_bread.png",
"mp_toas_front_bread.png"
"mp_toas_front_bread.png",
},
walkable = false,
groups = {not_in_creative_inventory=1},
groups = { not_in_creative_inventory = 1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
@ -93,10 +96,10 @@ minetest.register_node("ma_pops_furniture:toaster_with_breadslice", {
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
{-0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125}, -- NodeBox2
{-0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25}, -- NodeBox3
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25}, -- NodeBox4
{ -0.375, -0.5, 0, 0.375, -0.0625, 0.3125 }, -- NodeBox1
{ -0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125 }, -- NodeBox2
{ -0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25 }, -- NodeBox3
{ -0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25 }, -- NodeBox4
},
},
on_punch = function(pos, node, clicker, itemstack, pointed_thing)
@ -106,10 +109,10 @@ minetest.register_node("ma_pops_furniture:toaster_with_breadslice", {
minetest.sound_play("toaster", {
pos = pos,
gain = 1.0,
max_hear_distance = 5
max_hear_distance = 5,
})
return itemstack
end
end,
})
minetest.register_node("ma_pops_furniture:toaster_toasting_breadslice", {
@ -120,10 +123,10 @@ minetest.register_node("ma_pops_furniture:toaster_toasting_breadslice", {
"mp_toas_right_bread.png",
"mp_toas_left_toast_side.png",
"mp_toas_back_side.png",
"mp_toas_front_side.png"
"mp_toas_front_side.png",
},
walkable = false,
groups = {not_in_creative_inventory = 1 },
groups = { not_in_creative_inventory = 1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
@ -132,24 +135,24 @@ minetest.register_node("ma_pops_furniture:toaster_toasting_breadslice", {
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
{-0.4375, -0.375, 0.0625, -0.375, -0.3125, 0.25}, -- NodeBox4
{ -0.375, -0.5, 0, 0.375, -0.0625, 0.3125 }, -- NodeBox1
{ -0.4375, -0.375, 0.0625, -0.375, -0.3125, 0.25 }, -- NodeBox4
},
},
})
minetest.register_node("ma_pops_furniture:toaster_with_toast", {
description = S("Toaster with Toast"),
tiles = {
tiles = {
"mp_toas_top_toast.png",
"mp_toas_bottom.png",
"mp_toas_right_toast.png",
"mp_toas_left_toast.png",
"mp_toas_back_toast.png",
"mp_toas_front_toast.png"
"mp_toas_front_toast.png",
},
walkable = false,
groups = { snappy=3, not_in_creative_inventory=1 },
groups = { snappy = 3, not_in_creative_inventory = 1 },
paramtype = "light",
paramtype2 = "facedir",
is_ground_content = false,
@ -157,21 +160,22 @@ minetest.register_node("ma_pops_furniture:toaster_with_toast", {
node_box = {
type = "fixed",
fixed = {
{-0.375, -0.5, 0, 0.375, -0.0625, 0.3125}, -- NodeBox1
{-0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125}, -- NodeBox2
{-0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25}, -- NodeBox3
{-0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25}, -- NodeBox4
{ -0.375, -0.5, 0, 0.375, -0.0625, 0.3125 }, -- NodeBox1
{ -0.25, -0.0625, 0.0625, 0.25, 0.0625, 0.125 }, -- NodeBox2
{ -0.25, -0.0625, 0.1875, 0.25, 0.0625, 0.25 }, -- NodeBox3
{ -0.4375, -0.1875, 0.0625, -0.375, -0.125, 0.25 }, -- NodeBox4
},
},
on_punch = function (pos, node, player, pointed_thing)
on_punch = function(pos, node, player, pointed_thing)
local inv = player:get_inventory()
local left = inv:add_item("main", "ma_pops_furniture:toast 2")
if left:is_empty() then
minetest.set_node(pos, {name = "ma_pops_furniture:toaster", param2 = node.param2})
minetest.set_node(pos, { name = "ma_pops_furniture:toaster", param2 = node.param2 })
end
end
end,
})
--[[
--Slice of Bread (only if not farming one used)
if not minetest.registered_items["farming:bread_slice"] then
minetest.register_craft({
@ -180,4 +184,5 @@ if not minetest.registered_items["farming:bread_slice"] then
recipe = {"farming:bread", "ma_pops_furniture:knife"},
replacements = {{"ma_pops_furniture:knife", "ma_pops_furniture:knife"}},
})
end
end ]]
--

View file

@ -51,8 +51,8 @@ minetest.register_craftitem("sandwiches:bread_slice", {
minetest.register_craft({
output = "sandwiches:bread_slice 4",
type = "shapeless",
recipe = {"group:food_bread", "group:food_cutting_board", ""},
replacements = { {"group:food_cutting_board", board }, }
recipe = {"group:food_bread", board, ""},
replacements = { {board, board }, }
})
minetest.register_craftitem("sandwiches:bread_crumbs", {