Compare commits
5 Commits
009931be49
...
6915765e59
Author | SHA1 | Date |
---|---|---|
Och Noe | 6915765e59 | |
Och Noe | 277f31d605 | |
Och Noe | ba3b016169 | |
Och Noe | 995c1c455a | |
Och Noe | ef61c847b1 |
96
init.lua
96
init.lua
|
@ -22,6 +22,7 @@ local additional_chars = {
|
|||
}
|
||||
|
||||
local characters = {}
|
||||
local characters_sticker = {}
|
||||
|
||||
ehlphabet = {}
|
||||
ehlphabet.path = minetest.get_modpath(minetest.get_current_modname())
|
||||
|
@ -55,6 +56,9 @@ table_merge(characters, cyrillic_chars)
|
|||
table_merge(characters, greek_chars)
|
||||
table_merge(characters, additional_chars)
|
||||
|
||||
table_merge(characters_sticker, characters)
|
||||
table.insert(characters_sticker, " ")
|
||||
|
||||
local create_alias = true
|
||||
|
||||
-- generate all available blocks
|
||||
|
@ -82,10 +86,10 @@ for _, name in ipairs(characters) do
|
|||
paramtype2 = "facedir", -- neu
|
||||
on_rotate = screwdriver.rotate_simple , -- neu
|
||||
is_ground_content = false, --neu
|
||||
groups = {cracky = 3, not_in_creative_inventory = 1, not_in_crafting_guide = 1}
|
||||
groups = {cracky = 3, not_in_creative_inventory = 1, not_in_crafting_guide = 1, ehlphabet_block = 1}
|
||||
}
|
||||
)
|
||||
minetest.register_craft({type = "shapeless", output = "ehlphabet:block", recipe = {key}})
|
||||
-- minetest.register_craft({type = "shapeless", output = "ehlphabet:block", recipe = {key}})
|
||||
|
||||
if create_alias then
|
||||
minetest.register_alias("abjphabet:" .. name, key)
|
||||
|
@ -95,8 +99,69 @@ for _, name in ipairs(characters) do
|
|||
if name == "Z" then
|
||||
create_alias = false
|
||||
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
|
||||
|
||||
minetest.register_craft({type = "shapeless", output = "ehlphabet:block", recipe = {"group:ehlphabet_block"}})
|
||||
|
||||
|
||||
|
||||
-- empty sticker
|
||||
|
||||
local key = "ehlphabet:32"
|
||||
local file = ("%03d"):format(32)
|
||||
local desc = S("Ehlphabet Block '@1'", name)
|
||||
|
||||
minetest.register_node(
|
||||
key.."_sticker",
|
||||
{
|
||||
description = desc.."Sticker",
|
||||
tiles = {"ehlphabet_000.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 },
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
|
||||
minetest.register_node(
|
||||
"ehlphabet:machine",
|
||||
{
|
||||
|
@ -153,12 +218,26 @@ minetest.register_node(
|
|||
local meta = minetest.env:get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
local inputstack = inv:get_stack("input", 1)
|
||||
local outputstack = inv:get_stack("output", 1)
|
||||
local ch = fields.lettername
|
||||
|
||||
if ch ~= nil and inputstack:get_name() == "ehlphabet:block" then
|
||||
if ch ~= nil and ch ~= "" then
|
||||
if inputstack:get_name() == "ehlphabet:block"
|
||||
or inputstack:get_name() == "default:paper" then
|
||||
local ost = outputstack:get_name()
|
||||
local mb = is_multibyte(ch)
|
||||
local key = mb and (ch:byte(1) .. ch:byte(2)) or ch:byte()
|
||||
for _, v in pairs(characters) do
|
||||
key = key .. (inputstack:get_name() == "default:paper" and "_sticker" or "")
|
||||
if ost ~= "" and
|
||||
ost ~= "ehlphabet:"..key then
|
||||
-- other type in output slot -> abort
|
||||
return
|
||||
end
|
||||
local clist = characters
|
||||
if inputstack:get_name() == "default:paper" then
|
||||
clist = characters_sticker
|
||||
end
|
||||
for _, v in pairs(clist) do
|
||||
if v == ch then
|
||||
local give = {}
|
||||
give[1] = inv:add_item("output", "ehlphabet:" .. key)
|
||||
|
@ -169,6 +248,7 @@ minetest.register_node(
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -267,6 +347,14 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
output = "ehlphabet:231171 7",
|
||||
recipe = {
|
||||
{"ehlphabet:83", "ehlphabet:84", "ehlphabet:65"},
|
||||
{"ehlphabet:84", "ehlphabet:73", "ehlphabet:79"},
|
||||
{"ehlphabet:78", "", ""},
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue