Initial commit

master
Wuzzy 2017-06-08 15:34:18 +02:00
commit 89d3f3fa6e
7 changed files with 290 additions and 0 deletions

4
depends.txt Normal file
View File

@ -0,0 +1,4 @@
default?
screwdriver?
doc_items?
intllib?

1
description.txt Normal file
View File

@ -0,0 +1 @@
Adds shifted block variants which have their textures offset from their original.

100
init.lua Normal file
View File

@ -0,0 +1,100 @@
-- Load support for intllib.
local MP = minetest.get_modpath(minetest.get_current_modname())
local S, NS = dofile(MP.."/intllib.lua")
-- doc_items support
local help_default
if minetest.get_modpath("doc_items") then
help_default = S("A shifted block is a variant of a block which has been visually moved by a half block length.")
end
shifted_blocks = {}
local on_rotate
if minetest.get_modpath("screwdriver") then
on_rotate = function(pos, node, user, mode, new_param2)
if mode == screwdriver.ROTATE_FACE then
if node.param2 == 0 then
node.param2 = 3
elseif node.param2 ~= 14 then
node.param2 = 0
end
minetest.set_node(pos, node)
return true
elseif mode == screwdriver.ROTATE_AXIS then
if node.param2 == 0 or node.param2 == 3 then
node.param2 = 14
else
node.param2 = 0
end
minetest.set_node(pos, node)
return true
else
return false
end
end
end
-- Shifted blocks
shifted_blocks.register_shifted_block = function(itemstring, original_block, description, side_texture, help, block_texture, no_craft)
local stone = side_texture or minetest.registered_nodes[original_block].tiles[1]
local normal = block_texture or minetest.registered_nodes[original_block].tiles[1]
-- FIXME/TEST: Does this work with textures other than 16×16?
local combine = "[combine:16x16:-8,0="..normal..":8,0="..normal
if minetest.get_modpath("doc_items") then
if help == nil then
help = help_default
end
else
help = nil
end
minetest.register_node(itemstring, {
description = description,
_doc_items_longdesc = help,
on_rotate = on_rotate,
paramtype2 = "facedir",
-- TODO: Place node according to view direction (restrict param2 to 0 or 3)
place_param2 = 0,
tiles = {combine, combine, stone, stone, combine.."^[transformFX", combine},
is_ground_content = false,
groups = minetest.registered_nodes[original_block].groups,
sounds = minetest.registered_nodes[original_block].sounds,
})
if not no_craft then
-- Recipes to add shifted block
minetest.register_craft({
output = itemstring.." 2",
recipe = { { original_block, original_block } },
})
-- Reverse recipe
minetest.register_craft({
output = original_block.." 2",
recipe = { { itemstring, itemstring} },
})
end
end
-- Register shifted blocks for Minetest Game
if minetest.get_modpath("default") then
-- Stone blocks
shifted_blocks.register_shifted_block("shifted_blocks:stone_block_shifted", "default:stone_block", S("Shifted Stone Block"), "default_stone.png")
shifted_blocks.register_shifted_block("shifted_blocks:desert_stone_block_shifted", "default:desert_stone_block", S("Shifted Desert Stone Block"), "default_desert_stone.png")
shifted_blocks.register_shifted_block("shifted_blocks:sandstone_block_shifted", "default:sandstone_block", S("Shifted Sandstone Block"), "default_sandstone.png")
shifted_blocks.register_shifted_block("shifted_blocks:desert_sandstone_block_shifted", "default:desert_sandstone_block", S("Shifted Desert Sandstone Block"), "default_desert_sandstone.png")
shifted_blocks.register_shifted_block("shifted_blocks:silver_sandstone_block_shifted", "default:silver_sandstone_block", S("Shifted Silver Sandstone Block"), "default_silver_sandstone.png")
shifted_blocks.register_shifted_block("shifted_blocks:obsidian_block_shifted", "default:obsidian_block", S("Shifted Obsidian Block"), "default_obsidian.png")
-- Metal blocks
shifted_blocks.register_shifted_block("shifted_blocks:gold_block_shifted", "default:goldblock", S("Shifted Gold Block"))
shifted_blocks.register_shifted_block("shifted_blocks:bronze_block_shifted", "default:bronzeblock", S("Shifted Bronze Block"))
shifted_blocks.register_shifted_block("shifted_blocks:tin_block_shifted", "default:tinblock", S("Shifted Tin Block"))
shifted_blocks.register_shifted_block("shifted_blocks:copper_block_shifted", "default:copperblock", S("Shifted Copper Block"))
shifted_blocks.register_shifted_block("shifted_blocks:steel_block_shifted", "default:steelblock", S("Shifted Steel Block"))
end

45
intllib.lua Normal file
View File

@ -0,0 +1,45 @@
-- Fallback functions for when `intllib` is not installed.
-- Code released under Unlicense <http://unlicense.org>.
-- Get the latest version of this file at:
-- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua
local function format(str, ...)
local args = { ... }
local function repl(escape, open, num, close)
if escape == "" then
local replacement = tostring(args[tonumber(num)])
if open == "" then
replacement = replacement..close
end
return replacement
else
return "@"..open..num..close
end
end
return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl))
end
local gettext, ngettext
if minetest.get_modpath("intllib") then
if intllib.make_gettext_pair then
-- New method using gettext.
gettext, ngettext = intllib.make_gettext_pair()
else
-- Old method using text files.
gettext = intllib.Getter()
end
end
-- Fill in missing functions.
gettext = gettext or function(msgid, ...)
return format(msgid, ...)
end
ngettext = ngettext or function(msgid, msgid_plural, n, ...)
return format(n==1 and msgid or msgid_plural, ...)
end
return gettext, ngettext

72
locale/de_DE.po Normal file
View File

@ -0,0 +1,72 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-08 15:28+0200\n"
"PO-Revision-Date: 2017-06-08 15:32+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.1\n"
"Last-Translator: Wuzzy <almikes@aol.com>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Language: de_DE\n"
"X-Poedit-SourceCharset: UTF-8\n"
#: init.lua
msgid ""
"A shifted block is a variant of a block which has been visually moved by a "
"half block length."
msgstr ""
"Ein versetzter Block ist eine Blockvariante, welche um eine halbe "
"Blocklänge verschoben wurde."
#: init.lua
msgid "Shifted Stone Block"
msgstr "Versetzter Steinblock"
#: init.lua
msgid "Shifted Desert Stone Block"
msgstr "Versetzter Wüstensteinblock"
#: init.lua
msgid "Shifted Sandstone Block"
msgstr "Versetzter Sandsteinblock"
#: init.lua
msgid "Shifted Desert Sandstone Block"
msgstr "Versetzter Wüstensandsteinblock"
#: init.lua
msgid "Shifted Silver Sandstone Block"
msgstr "Versetzter Silbersandsteinblock"
#: init.lua
msgid "Shifted Obsidian Block"
msgstr "Versetzter Obsidianblock"
#: init.lua
msgid "Shifted Gold Block"
msgstr "Versetzter Goldblock"
#: init.lua
msgid "Shifted Bronze Block"
msgstr "Versetzter Bronzeblock"
#: init.lua
msgid "Shifted Tin Block"
msgstr "Versetzter Zinnblock"
#: init.lua
msgid "Shifted Copper Block"
msgstr "Versetzter Kupferblock"
#: init.lua
msgid "Shifted Steel Block"
msgstr "Versetzter Stahlblock"

68
locale/template.pot Normal file
View File

@ -0,0 +1,68 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-06-08 15:28+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: init.lua
msgid ""
"A shifted block is a variant of a block which has been visually moved by a "
"half block length."
msgstr ""
#: init.lua
msgid "Shifted Stone Block"
msgstr ""
#: init.lua
msgid "Shifted Desert Stone Block"
msgstr ""
#: init.lua
msgid "Shifted Sandstone Block"
msgstr ""
#: init.lua
msgid "Shifted Desert Sandstone Block"
msgstr ""
#: init.lua
msgid "Shifted Silver Sandstone Block"
msgstr ""
#: init.lua
msgid "Shifted Obsidian Block"
msgstr ""
#: init.lua
msgid "Shifted Gold Block"
msgstr ""
#: init.lua
msgid "Shifted Bronze Block"
msgstr ""
#: init.lua
msgid "Shifted Tin Block"
msgstr ""
#: init.lua
msgid "Shifted Copper Block"
msgstr ""
#: init.lua
msgid "Shifted Steel Block"
msgstr ""

BIN
screenshot.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 89 KiB