bug removed and stickers added
1. bug There was a bug that the letter machine had "eaten" from the input slot when there was a different letter type already in the output slot. 2. stickers With "default:paper" as input the letter machine makes as now stickers. They are wallmounted and are destroyed when removed.
This commit is contained in:
parent
995c1c455a
commit
ba3b016169
57
init.lua
57
init.lua
@ -95,6 +95,32 @@ for _, name in ipairs(characters) do
|
|||||||
if name == "Z" then
|
if name == "Z" then
|
||||||
create_alias = false
|
create_alias = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
minetest.register_node(
|
||||||
|
key.."_sticker",
|
||||||
|
{
|
||||||
|
description = desc.."Sticker",
|
||||||
|
tiles = {"ehlphabet_" .. file .. ".png"},
|
||||||
|
paramtype = "light",
|
||||||
|
paramtype2 = "wallmounted", -- "colorwallmounted",
|
||||||
|
on_rotate = screwdriver.rotate_simple ,
|
||||||
|
drawtype = "nodebox",
|
||||||
|
is_ground_content = false,
|
||||||
|
drop = "", -- new
|
||||||
|
node_box = {
|
||||||
|
type = "wallmounted",
|
||||||
|
wall_bottom = {-0.5, -0.5, -0.5, 0.5, -0.49, 0.5},
|
||||||
|
wall_top = {-0.5, 0.49, -0.5, 0.5, 0.5, 0.5},
|
||||||
|
wall_side = {-0.5, -0.5, -0.5, -0.49, 0.5, 0.5},
|
||||||
|
},
|
||||||
|
groups = {attached_node = 1, dig_immediate = 2,
|
||||||
|
not_in_creative_inventory = 1,
|
||||||
|
not_blocking_trains = 1 },
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_node(
|
minetest.register_node(
|
||||||
@ -153,18 +179,29 @@ minetest.register_node(
|
|||||||
local meta = minetest.env:get_meta(pos)
|
local meta = minetest.env:get_meta(pos)
|
||||||
local inv = meta:get_inventory()
|
local inv = meta:get_inventory()
|
||||||
local inputstack = inv:get_stack("input", 1)
|
local inputstack = inv:get_stack("input", 1)
|
||||||
|
local outputstack = inv:get_stack("output", 1)
|
||||||
local ch = fields.lettername
|
local ch = fields.lettername
|
||||||
|
|
||||||
if ch ~= nil and inputstack:get_name() == "ehlphabet:block" then
|
if ch ~= nil and ch ~= "" then
|
||||||
local mb = is_multibyte(ch)
|
if inputstack:get_name() == "ehlphabet:block"
|
||||||
local key = mb and (ch:byte(1) .. ch:byte(2)) or ch:byte()
|
or inputstack:get_name() == "default:paper" then
|
||||||
for _, v in pairs(characters) do
|
local ost = outputstack:get_name()
|
||||||
if v == ch then
|
local mb = is_multibyte(ch)
|
||||||
local give = {}
|
local key = mb and (ch:byte(1) .. ch:byte(2)) or ch:byte()
|
||||||
give[1] = inv:add_item("output", "ehlphabet:" .. key)
|
key = key .. (inputstack:get_name() == "default:paper" and "_sticker" or "")
|
||||||
inputstack:take_item()
|
if ost ~= "" and
|
||||||
inv:set_stack("input", 1, inputstack)
|
ost ~= "ehlphabet:"..key then
|
||||||
break
|
-- other type in output slot -> abort
|
||||||
|
return
|
||||||
|
end
|
||||||
|
for _, v in pairs(characters) do
|
||||||
|
if v == ch then
|
||||||
|
local give = {}
|
||||||
|
give[1] = inv:add_item("output", "ehlphabet:" .. key)
|
||||||
|
inputstack:take_item()
|
||||||
|
inv:set_stack("input", 1, inputstack)
|
||||||
|
break
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user