Merge pull request 'MineClone2 Signs Rewrite - move from GitHub to MeseHub' (#2822) from Michieal/MineClone2:mcl_signs_rewrite into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/2822
Reviewed-by: cora <cora@noreply.git.minetest.land>
This commit is contained in:
cora 2022-10-23 16:57:09 +00:00
commit 2d1125c04e
201 changed files with 2161 additions and 566 deletions

View File

@ -1,4 +1,21 @@
Mod based on reworked signs mod by PilzAdam:
---
# Mineclone2-Signs
---
A reworking of MineClone 2's mcl_signs to be colorable and made to glow. Rquires Minetest and Mineclone2.
---
Created by Michieal (FaerRaven) @ DateTime: 10/14/22 4:05 PM
Reworked to be an API and to allow players to color, and/or make the lettering for the signs glow (be bright at night).
Reworked by Michieal (FaerRaven), including the sign textures batch changed to be white instead of the original black.
A special thanks to Cora for pointing me in the right direction (as always).
The original Mod, MCL_SIGNS is based on reworked signs mod by PilzAdam:
https://forum.minetest.net/viewtopic.php?t=3289
License of code and font: MIT License
@ -6,8 +23,22 @@ License of code and font: MIT License
Font source: 04.jp.org, some modifications and additions were made (added support for Latin-1 Supplement)
Original font license text states: “YOU MAY USE THEM AS YOU LIKE” (in about.gif file distributed with the font)
License of textures: See README.md in top directory of MineClone 2.
License of textures: See README.md in top directory of MineClone 2, with the exception of the following:
default_sign.png, default_sign_dark.png, default_sign_greyscale.png, mcl_signs_sign_dark.png,
mcl_signs_sign_greyscale.png are licensed as follows:
Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) (https://creativecommons.org/licenses/by-sa/4.0/).
Credit Michieal (Faerraven). The extra sign textures are provided for you to use, modify, etc., with the goal being to
make the game better. (All of these textures were changed / created by me, to make them usable / better.)
License of models: GPLv3 (https://www.gnu.org/licenses/gpl-3.0.html)
Models author: 22i.
Source: https://github.com/22i/amc
Mineclone 2 source code:
https://git.minetest.land/MineClone2/MineClone2
---
NOTE: This MODule requires Glow Squids in order for all features to work 100% correctly. Glow Squids are currently
in review by the MineClone 2 Team, and should be available soon after this initial release of the new signs.

View File

@ -0,0 +1,122 @@
---
--- Generated by EmmyLua.
--- Created by Michieal (FaerRaven).
--- DateTime: 10/22/22 3:44 PM
---
SIGNS API
--- How to Use:
The simplest way to create a new sign is to use mcl_signs.register_sign [mcl_signs.register_sign (modname, color, _name,
ttsign)]. It's an all-in-one sign creator. It makes use of the standard textures for the signs, and colors them based on
the color code that you give it, and names it "mcl_signs:wall_sign" + _name. So, using the spruce sign to illustrate, it
would be named "mcl_signs:wall_sign_sprucewood", as we made _name equal to "_sprucewood" after the name of the
registered wood.
To create a sign with specific textures: use the mcl_signs.register_sign_custom [mcl_signs.register_sign_custom
(modname, _name, tiles, color, inventory_image, wield_image, ttsign)]. Like the register_sign() function, this is also an
all-in-one sign creation function. With this function you can designate what textures to use, and give them a specified
color. This function follows the same naming conventions.
If you wish to override / recreate one of the predefined signs, you may also do that. The reregister_sign() and
reregister_sign_custom() functions will replace an existing sign's definition with a new one. Caution, ONLY use this on
existing signs. If the sign doesn't exist, use the regular register_sign* functions.
--- What the parameters mean, and what they do:
* modname: optional (pass "" or "false" to ignore), for using mcl_signs with other mods to allow the creation of a sign
from the mod's wood (if installed). Use this to prevent failures of the specific mod is not installed that has the needed
information (textures, wood, etc.) Setting this is important, because it prevents items from being registered if the
mod in not installed.
* tiles: the texture file to use for the sign's node.
* color: color the texture file to use with this color. Use white (#FFFFFF) to negate the color, and just use the
texture as is.
* inventory_image: the texture file to use for the sign's display in inventory.
* wield_image: the texture file to use for the sign's weilded (in hand) object.
* _name: the sign's name suffix, such as "_dark" or "_sprucewood", etc., appended to "wall_sign" or "standing_sign"
* ttsign: the tool tip of the sign that gets translated. Shown when the mouse hovers the inventory sign. ttsign stands
for translated tooltip sign.
* wood_item_string: example: "mcl_core:wood", "mcl_core:sprucewood" or "mymod:mywood". This is used when defining the
recipe for the sign.
--- Other Functions of Importance:
* register_dye [mcl_signs.register_dye (modname, item_name, color_code)] -- this registers a new dye that the sign knows
about so that the player can color their signs with the dye.
Parameters:
modname: your mod / module's name. make sure to use this for compatibility.
item_name: the item_string of the dye to register.
color_code: the hex code for the color to make the lettering. Also called HTML color code. Ex. "#FFFFFF" is white.
* register_sign_craft [mcl_signs.register_sign_craft(modname, wood_item_string, _name)] -- this is what creates the
recipes for the sign, and makes the sign "burnable". Typically called right after the register_sign* functions.
Parameters:
_name: MUST be the same name as used for the sign. So, if your sign _name is "_sprucewood" then this should be too.
wood_item_string: the item_string of the wood to use for the sign's recipe. Example: "mcl_core:wood" (default oak).
modname: like with the other functions that has this parameter, used to make sure that nothing breaks.
* make_lbm() [mcl_signs.make_lbm()] -- This innocuous function is very important. This is the function that makes the
signs work after reloading the game. This function is the last to be called in your sign creation work flow. Note, you
do not need to call this function after every definition, just at the end of the last definition.
(See Example WorkFlow below.)
--- Example Workflow for sign creation.
* these are, at the time of writing, a selection of the actual signs' definitions. Note the functions called, and when.
-- ---------------------------- --
-- Register Signs for use. --
-- ---------------------------- --
-- sprucewood Sign
mcl_signs.register_sign_custom("mcl_core", "_sprucewood",
"mcl_signs_sign_dark.png","#ffffff", "default_sign_dark.png",
"default_sign_dark.png", "Spruce Sign"
)
mcl_signs.register_sign_craft("mcl_core", "mcl_core:sprucewood", "_sprucewood")
-- darkwood Sign
mcl_signs.register_sign_custom("mcl_core", "_darkwood",
"mcl_signs_sign_greyscale.png","#856443", "default_sign_greyscale.png",
"default_sign_greyscale.png", "Dark Oak Sign"
)
mcl_signs.register_sign_craft("mcl_core", "mcl_core:darkwood", "_darkwood")
-- acaciawood Sign
mcl_signs.register_sign("mcl_core", "#ea7479", "_acaciawood", "Acacia Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:acaciawood", "_acaciawood")
-- junglewood Sign
mcl_signs.register_sign("mcl_core", "#866249", "_junglewood", "Jungle Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:junglewood", "_junglewood")
-- Register the LBMs for the created signs.
mcl_signs.make_lbm()
--- -----------------------------------------------------------------------------
* If you wish to use a recipe other than the standard sign recipe, you will need to define your own recipe. In doing so,
use this output line:
output = "mcl_signs:wall_sign" .. _name .. " 3",
where _name is the same string that you have used throughout your sign's workflow. That way, when players make the recipe,
they get your sign (x3).
--- Future landmarks on the horizon for the Signs API:
* Once the forthcoming Hanging Signs are in Minecraft, and we implement the code for them in here, hanging signs will
automatically exist as part of the signs' package. You won't have to change any of your code, it'll just be more
functional. :)
* if you have suggestions, comments, etc., please contact me on MineClone 2's Discord server.
And that... is all there is to it!
-- written by Michieal.

View File

@ -1,580 +1,139 @@
---
--- Generated by EmmyLua.
--- Created by Michieal (FaerRaven).
--- DateTime: 10/14/22 4:05 PM
---
local modname = minetest.get_current_modname()
local modpath = minetest.get_modpath(modname)
-- Signs API
dofile(modpath .. "/signs_api.lua")
-- LOCALIZATION
local S = minetest.get_translator(modname)
local F = minetest.formspec_escape
local table = table
-- Load the characters map (characters.txt)
--[[ File format of characters.txt:
It's an UTF-8 encoded text file that contains metadata for all supported characters. It contains a sequence of info blocks, one for each character. Each info block is made out of 3 lines:
Line 1: The literal UTF-8 encoded character
Line 2: Name of the texture file for this character minus the .png suffix; found in the textures/ sub-directory
Line 3: Currently ignored. Previously this was for the character width in pixels
After line 3, another info block may follow. This repeats until the end of the file.
All character files must be 5 or 6 pixels wide (5 pixels are preferred)
]]
local chars_file = io.open(modpath.."/characters.txt", "r")
-- FIXME: Support more characters (many characters are missing). Currently ASCII and Latin-1 Supplement are supported.
local charmap = {}
if not chars_file then
minetest.log("error", "[mcl_signs] : character map file not found")
else
while true do
local char = chars_file:read("*l")
if char == nil then
break
end
local img = chars_file:read("*l")
chars_file:read("*l")
charmap[char] = img
end
end
-- CONSTANTS
local SIGN_WIDTH = 115
local LINE_LENGTH = 15
local NUMBER_OF_LINES = 4
local LINE_HEIGHT = 14
local CHAR_WIDTH = 5
-- Helper functions
local function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end
local function string_to_array(str)
local tab = {}
for i=1,string.len(str) do
table.insert(tab, string.sub(str, i,i))
end
return tab
end
local function string_to_line_array(str)
local tab = {}
local current = 1
local linechar = 1
tab[1] = ""
for _,char in ipairs(string_to_array(str)) do
-- New line
if char == "\n" then
current = current + 1
tab[current] = ""
linechar = 1
else
tab[current] = tab[current]..char
linechar = linechar + 1
end
end
return tab
end
local function create_lines(text)
local line_num = 1
local tab = {}
for _, line in ipairs(string_to_line_array(text)) do
if line_num > NUMBER_OF_LINES then
break
end
table.insert(tab, line)
line_num = line_num + 1
end
return tab
end
local function generate_line(s, ypos)
local i = 1
local parsed = {}
local width = 0
local chars = 0
local printed_char_width = CHAR_WIDTH + 1
while chars < LINE_LENGTH and i <= #s do
local file
-- Get and render character
if charmap[s:sub(i, i)] then
file = charmap[s:sub(i, i)]
i = i + 1
elseif i < #s and charmap[s:sub(i, i + 1)] then
file = charmap[s:sub(i, i + 1)]
i = i + 2
else
-- No character image found.
-- Use replacement character:
file = "_rc"
i = i + 1
minetest.log("verbose", "[mcl_signs] Unknown symbol in '"..s.."' at "..i)
end
if file then
width = width + printed_char_width
table.insert(parsed, file)
chars = chars + 1
end
end
width = width - 1
local texture = ""
local xpos = math.floor((SIGN_WIDTH - width) / 2)
for i = 1, #parsed do
texture = texture..":"..xpos..","..ypos.."="..parsed[i]..".png"
xpos = xpos + printed_char_width
end
return texture
end
local function generate_texture(lines, signnodename)
local texture = "[combine:"..SIGN_WIDTH.."x"..SIGN_WIDTH
local ypos
if signnodename == "mcl_signs:wall_sign" then
ypos = 30
else
ypos = 0
end
for i = 1, #lines do
texture = texture..generate_line(lines[i], ypos)
ypos = ypos + LINE_HEIGHT
end
return texture
end
local n = 23/56 - 1/128
local signtext_info_wall = {
{delta = {x = 0, y = 0, z = n}, yaw = 0},
{delta = {x = n, y = 0, z = 0}, yaw = math.pi / -2},
{delta = {x = 0, y = 0, z = -n}, yaw = math.pi},
{delta = {x = -n, y = 0, z = 0}, yaw = math.pi / 2},
}
local signtext_info_standing = {}
local m = -1/16 + 1/64
for rot=0, 15 do
local yaw = math.pi*2 - (((math.pi*2) / 16) * rot)
local delta = vector.multiply(minetest.yaw_to_dir(yaw), m)
-- Offset because sign is a bit above node boundaries
delta.y = delta.y + 2/28
table.insert(signtext_info_standing, { delta = delta, yaw = yaw })
end
local function get_rotation_level(facedir, nodename)
local rl = facedir * 4
if nodename == "mcl_signs:standing_sign22_5" then
rl = rl + 1
elseif nodename == "mcl_signs:standing_sign45" then
rl = rl + 2
elseif nodename == "mcl_signs:standing_sign67_5" then
rl = rl + 3
end
return rl
end
local function get_wall_signtext_info(param2, nodename)
local dir = minetest.wallmounted_to_dir(param2)
if dir.x > 0 then
return 2
elseif dir.z > 0 then
return 1
elseif dir.x < 0 then
return 4
else
return 3
end
end
local sign_groups = {handy=1,axey=1, deco_block=1, material_wood=1, attached_node=1, dig_by_piston=1, flammable=-1}
local function destruct_sign(pos)
local objects = minetest.get_objects_inside_radius(pos, 0.5)
for _, v in ipairs(objects) do
local ent = v:get_luaentity()
if ent and ent.name == "mcl_signs:text" then
v:remove()
end
end
local players = minetest.get_connected_players()
for p=1, #players do
if vector.distance(players[p]:get_pos(), pos) <= 30 then
minetest.close_formspec(players[p]:get_player_name(), "mcl_signs:set_text_"..pos.x.."_"..pos.y.."_"..pos.z)
end
end
end
local function update_sign(pos, fields, sender, force_remove)
local meta = minetest.get_meta(pos)
if not meta then
return
end
local text = meta:get_string("text")
if fields and (text == "" and fields.text) then
meta:set_string("text", fields.text)
text = fields.text
end
if text == nil then
text = ""
end
local sign_info
local n = minetest.get_node(pos)
local nn = n.name
if nn == "mcl_signs:standing_sign" or nn == "mcl_signs:standing_sign22_5" or nn == "mcl_signs:standing_sign45" or nn == "mcl_signs:standing_sign67_5" then
sign_info = signtext_info_standing[get_rotation_level(n.param2, nn) + 1]
elseif nn == "mcl_signs:wall_sign" then
sign_info = signtext_info_wall[get_wall_signtext_info(n.param2)]
end
if sign_info == nil then
minetest.log("error", "[mcl_signs] Missing sign_info!")
return
end
local objects = minetest.get_objects_inside_radius(pos, 0.5)
local text_entity
for _, v in ipairs(objects) do
local ent = v:get_luaentity()
if ent and ent.name == "mcl_signs:text" then
if force_remove then
v:remove()
else
text_entity = v
break
end
end
end
if not text_entity then
text_entity = minetest.add_entity({
x = pos.x + sign_info.delta.x,
y = pos.y + sign_info.delta.y,
z = pos.z + sign_info.delta.z}, "mcl_signs:text")
end
text_entity:get_luaentity()._signnodename = nn
text_entity:set_properties({textures={generate_texture(create_lines(text), nn)}})
text_entity:set_yaw(sign_info.yaw)
end
local function show_formspec(player, pos)
minetest.show_formspec(
player:get_player_name(),
"mcl_signs:set_text_"..pos.x.."_"..pos.y.."_"..pos.z,
"size[6,3]textarea[0.25,0.25;6,1.5;text;"..F(S("Enter sign text:"))..";]label[0,1.5;"..F(S("Maximum line length: 15")).."\n"..F(S("Maximum lines: 4")).."]button_exit[0,2.5;6,1;submit;"..F(S("Done")).."]"
)
end
-- HANDLE THE FORMSPEC CALLBACK
minetest.register_on_player_receive_fields(function(player, formname, fields)
if formname:find("mcl_signs:set_text_") == 1 then
local x, y, z = formname:match("mcl_signs:set_text_(.-)_(.-)_(.*)")
local pos = {x=tonumber(x), y=tonumber(y), z=tonumber(z)}
if not pos or not pos.x or not pos.y or not pos.z then return end
update_sign(pos, fields, player)
end
if formname:find("mcl_signs:set_text_") == 1 then
local x, y, z = formname:match("mcl_signs:set_text_(.-)_(.-)_(.*)")
local pos = { x = tonumber(x), y = tonumber(y), z = tonumber(z) }
if not pos or not pos.x or not pos.y or not pos.z then
return
end
mcl_signs:update_sign(pos, fields, player)
end
end)
local node_sounds
if minetest.get_modpath("mcl_sounds") then
node_sounds = mcl_sounds.node_sound_wood_defaults()
end
minetest.register_node("mcl_signs:wall_sign", {
description = S("Sign"),
_tt_help = S("Can be written"),
_doc_items_longdesc = S("Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them."),
_doc_items_usagehelp = S("After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again."),
inventory_image = "default_sign.png",
walkable = false,
is_ground_content = false,
wield_image = "default_sign.png",
node_placement_prediction = "",
paramtype = "light",
sunlight_propagates = true,
paramtype2 = "wallmounted",
drawtype = "mesh",
mesh = "mcl_signs_signonwallmount.obj",
selection_box = {type = "wallmounted", wall_side = {-0.5, -7/28, -0.5, -23/56, 7/28, 0.5}},
tiles = {"mcl_signs_sign.png"},
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
groups = sign_groups,
stack_max = 16,
sounds = node_sounds,
on_place = function(itemstack, placer, pointed_thing)
local above = pointed_thing.above
local under = pointed_thing.under
-- Use pointed node's on_rightclick function first, if present
local node_under = minetest.get_node(under)
if placer and not placer:get_player_control().sneak then
if minetest.registered_nodes[node_under.name] and minetest.registered_nodes[node_under.name].on_rightclick then
return minetest.registered_nodes[node_under.name].on_rightclick(under, node_under, placer, itemstack) or itemstack
end
end
local dir = vector.subtract(under, above)
-- Only build when it's legal
local abovenodedef = minetest.registered_nodes[minetest.get_node(above).name]
if not abovenodedef or abovenodedef.buildable_to == false then
return itemstack
end
local wdir = minetest.dir_to_wallmounted(dir)
--local placer_pos = placer:get_pos()
local fdir = minetest.dir_to_facedir(dir)
local sign_info
local nodeitem = ItemStack(itemstack)
-- Ceiling
if wdir == 0 then
--how would you add sign to ceiling?
return itemstack
-- Floor
elseif wdir == 1 then
-- Standing sign
-- Determine the sign rotation based on player's yaw
local yaw = math.pi*2 - placer:get_look_horizontal()
-- Select one of 16 possible rotations (0-15)
local rotation_level = round((yaw / (math.pi*2)) * 16)
if rotation_level > 15 then
rotation_level = 0
elseif rotation_level < 0 then
rotation_level = 15
end
-- The actual rotation is a combination of predefined mesh and facedir (see node definition)
if rotation_level % 4 == 0 then
nodeitem:set_name("mcl_signs:standing_sign")
elseif rotation_level % 4 == 1 then
nodeitem:set_name("mcl_signs:standing_sign22_5")
elseif rotation_level % 4 == 2 then
nodeitem:set_name("mcl_signs:standing_sign45")
elseif rotation_level % 4 == 3 then
nodeitem:set_name("mcl_signs:standing_sign67_5")
end
fdir = math.floor(rotation_level / 4)
-- Place the node!
local _, success = minetest.item_place_node(nodeitem, placer, pointed_thing, fdir)
if not success then
return itemstack
end
if not minetest.is_creative_enabled(placer:get_player_name()) then
itemstack:take_item()
end
sign_info = signtext_info_standing[rotation_level + 1]
-- Side
else
-- Wall sign
local _, success = minetest.item_place_node(itemstack, placer, pointed_thing, wdir)
if not success then
return itemstack
end
sign_info = signtext_info_wall[fdir + 1]
end
-- Determine spawn position of entity
local place_pos
if minetest.registered_nodes[node_under.name].buildable_to then
place_pos = under
else
place_pos = above
end
local text_entity = minetest.add_entity({
x = place_pos.x + sign_info.delta.x,
y = place_pos.y + sign_info.delta.y,
z = place_pos.z + sign_info.delta.z}, "mcl_signs:text")
text_entity:set_yaw(sign_info.yaw)
text_entity:get_luaentity()._signnodename = nodeitem:get_name()
minetest.sound_play({name="default_place_node_hard", gain=1.0}, {pos = place_pos}, true)
show_formspec(placer, place_pos)
return itemstack
end,
on_destruct = destruct_sign,
on_punch = function(pos, node, puncher)
update_sign(pos)
end,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then
local r = screwdriver.rotate.wallmounted(pos, node, mode)
node.param2 = r
minetest.swap_node(pos, node)
update_sign(pos, nil, nil, true)
return true
else
return false
end
end,
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
})
-- Standing sign nodes.
-- 4 rotations at 0°, 22.5°, 45° and 67.5°.
-- These are 4 out of 16 possible rotations.
-- With facedir the remaining 12 rotations are constructed.
-- 0°
local ssign = {
paramtype = "light",
use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "opaque" or false,
sunlight_propagates = true,
walkable = false,
is_ground_content = false,
paramtype2 = "facedir",
drawtype = "mesh",
mesh = "mcl_signs_sign.obj",
selection_box = {type = "fixed", fixed = {-0.2, -0.5, -0.2, 0.2, 0.5, 0.2}},
tiles = {"mcl_signs_sign.png"},
groups = sign_groups,
drop = "mcl_signs:wall_sign",
stack_max = 16,
sounds = node_sounds,
on_destruct = destruct_sign,
on_punch = function(pos, node, puncher)
update_sign(pos)
end,
on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then
node.name = "mcl_signs:standing_sign22_5"
minetest.swap_node(pos, node)
elseif mode == screwdriver.ROTATE_AXIS then
return false
end
update_sign(pos, nil, nil, true)
return true
end,
_mcl_hardness = 1,
_mcl_blast_resistance = 1,
}
minetest.register_node("mcl_signs:standing_sign", ssign)
-- 22.5°
local ssign22_5 = table.copy(ssign)
ssign22_5.mesh = "mcl_signs_sign22.5.obj"
ssign22_5.on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then
node.name = "mcl_signs:standing_sign45"
minetest.swap_node(pos, node)
elseif mode == screwdriver.ROTATE_AXIS then
return false
end
update_sign(pos, nil, nil, true)
return true
end
minetest.register_node("mcl_signs:standing_sign22_5", ssign22_5)
-- 45°
local ssign45 = table.copy(ssign)
ssign45.mesh = "mcl_signs_sign45.obj"
ssign45.on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then
node.name = "mcl_signs:standing_sign67_5"
minetest.swap_node(pos, node)
elseif mode == screwdriver.ROTATE_AXIS then
return false
end
update_sign(pos, nil, nil, true)
return true
end
minetest.register_node("mcl_signs:standing_sign45", ssign45)
-- 67.5°
local ssign67_5 = table.copy(ssign)
ssign67_5.mesh = "mcl_signs_sign67.5.obj"
ssign67_5.on_rotate = function(pos, node, user, mode)
if mode == screwdriver.ROTATE_FACE then
node.name = "mcl_signs:standing_sign"
node.param2 = (node.param2 + 1) % 4
minetest.swap_node(pos, node)
elseif mode == screwdriver.ROTATE_AXIS then
return false
end
update_sign(pos, nil, nil, true)
return true
end
minetest.register_node("mcl_signs:standing_sign67_5", ssign67_5)
-- This defines the text entity for the lettering of the sign.
-- FIXME: Prevent entity destruction by /clearobjects
minetest.register_entity("mcl_signs:text", {
pointable = false,
visual = "upright_sprite",
textures = {},
physical = false,
collide_with_objects = false,
pointable = false,
visual = "upright_sprite",
textures = {},
physical = false,
collide_with_objects = false,
_signnodename = nil, -- node name of sign node to which the text belongs
_signnodename = nil, -- node name of sign node to which the text belongs
on_activate = function(self, staticdata)
if staticdata and staticdata ~= "" then
local des = minetest.deserialize(staticdata)
if des then
self._signnodename = des._signnodename
end
end
local meta = minetest.get_meta(self.object:get_pos())
local text = meta:get_string("text")
self.object:set_properties({
textures={generate_texture(create_lines(text), self._signnodename)},
})
self.object:set_armor_groups({ immortal = 1 })
end,
get_staticdata = function(self)
local out = { _signnodename = self._signnodename }
return minetest.serialize(out)
end,
on_activate = function(self, staticdata)
local meta = minetest.get_meta(self.object:get_pos())
local text = meta:get_string("text")
local text_color = meta:get_string("mcl_signs:text_color")
local glowing_sign = meta:get_string("mcl_signs:glowing_sign")
if staticdata and staticdata ~= "" then
local des = minetest.deserialize(staticdata)
if des then
self._signnodename = des._signnodename
if des._text_color ~= nil and des._text_color ~= "" then
self.text_color = des._text_color
end
if des._glowing_sign ~= nil and des._glowing_sign ~= "" then
self.glowing_sign = des._glowing_sign
end
end
end
if text_color == "" or text_color == nil then
text_color = "#000000" -- default to black text.
meta:set_string("mcl_signs:text_color", text_color)
end
if glowing_sign == "" or glowing_sign == nil then
glowing_sign = "false" -- default to not glowing.
meta:set_string("mcl_signs:glowing_sign", glowing_sign)
end
self.object:set_properties({
textures = { mcl_signs:create_lettering(text, self._signnodename, text_color) },
})
if glowing_sign == "true" then
self.object:set_properties({
glow = 6, --sign_glow,
})
end
self.object:set_armor_groups({ immortal = 1 })
end,
get_staticdata = function(self)
local out = {
_signnodename = self._signnodename,
}
return minetest.serialize(out)
end,
})
minetest.register_craft({
type = "fuel",
recipe = "mcl_signs:wall_sign",
burntime = 10,
})
-- Build the signs x,y,z & rotations so that they work. (IE, do not remove!)
mcl_signs.build_signs_info()
if minetest.get_modpath("mcl_core") then
minetest.register_craft({
output = "mcl_signs:wall_sign 3",
recipe = {
{"group:wood", "group:wood", "group:wood"},
{"group:wood", "group:wood", "group:wood"},
{"", "mcl_core:stick", ""},
}
})
end
-- ---------------------------- --
-- Register Signs for use. --
-- ---------------------------- --
if minetest.get_modpath("doc") then
doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign")
doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign22_5")
doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign45")
doc.add_entry_alias("nodes", "mcl_signs:wall_sign", "nodes", "mcl_signs:standing_sign67_5")
end
-- Standard (original) Sign
mcl_signs.register_sign("mcl_core", "#ffffff", "", "Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:wood", "")
-- birchwood Sign "#d5cb8d" / "#ffdba7"
mcl_signs.register_sign_custom("mcl_core", "_birchwood",
"mcl_signs_sign_greyscale.png","#ffdba7", "default_sign_greyscale.png",
"default_sign_greyscale.png", "Birch Sign"
)
mcl_signs.register_sign_craft("mcl_core", "mcl_core:birchwood", "_birchwood")
-- sprucewood Sign
mcl_signs.register_sign_custom("mcl_core", "_sprucewood",
"mcl_signs_sign_dark.png","#ffffff", "default_sign_dark.png",
"default_sign_dark.png", "Spruce Sign"
)
mcl_signs.register_sign_craft("mcl_core", "mcl_core:sprucewood", "_sprucewood")
-- darkwood Sign "#291f1a" / "#856443"
mcl_signs.register_sign_custom("mcl_core", "_darkwood",
"mcl_signs_sign_greyscale.png","#856443", "default_sign_greyscale.png",
"default_sign_greyscale.png", "Dark Oak Sign"
)
mcl_signs.register_sign_craft("mcl_core", "mcl_core:darkwood", "_darkwood")
-- junglewood Sign
mcl_signs.register_sign("mcl_core", "#866249", "_junglewood", "Jungle Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:junglewood", "_junglewood")
-- acaciawood Sign "b8693d"
mcl_signs.register_sign("mcl_core", "#ea7479", "_acaciawood", "Acacia Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:acaciawood", "_acaciawood")
-- mangrove_wood Sign "#c7545c"
mcl_signs.register_sign("mcl_core", "#b8693d", "_mangrove_wood", "Mangrove Sign")
mcl_signs.register_sign_craft("mcl_core", "mcl_core:mangrove_wood", "_mangrove_wood")
-- Register the LBMs for the created signs.
mcl_signs.make_lbm()
-- really ancient compatibility.
minetest.register_alias("signs:sign_wall", "mcl_signs:wall_sign")
minetest.register_alias("signs:sign_yard", "mcl_signs:standing_sign")
minetest.register_lbm({
name = "mcl_signs:respawn_entities",
label = "Respawn sign text entities",
run_at_every_load = true,
nodenames = { "mcl_signs:wall_sign", "mcl_signs:standing_sign", "mcl_signs:standing_sign22_5", "mcl_signs:standing_sign45", "mcl_signs:standing_sign67_5" },
action = function(pos, node)
update_sign(pos)
end,
})
minetest.register_alias("mcl_signs:wall_sign_dark", "mcl_signs:wall_sign_sprucewood")
minetest.register_alias("mcl_signs:standing_sign_dark", "mcl_signs:standing_sign_sprucewood")

View File

@ -1,7 +1,7 @@
# textdomain: mcl_signs
Sign=
Signs can be written and come in two variants: Wall sign and sign on a sign post. Signs can be placed on the top and the sides of other blocks, but not below them.=
After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again.=
After placing the sign, you can write something on it. You have 4 lines of text with up to 15 characters for each line; anything beyond these limits is lost. Not all characters are supported. The text can not be changed once it has been written; you have to break and place the sign again. Can be colored and made to glow.=
Enter sign text:=
Maximum line length: 15=
Maximum lines: 4=

View File

@ -1,2 +1,4 @@
name = mcl_signs
optional_depends = mcl_sounds, mcl_core, doc
description = New and Improved signs - can be colored and made to glow.
depends = mcl_core, mcl_sounds, mcl_dye, mcl_colors
optional_depends = doc

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 877 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 891 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 889 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 B

After

Width:  |  Height:  |  Size: 292 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 88 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 882 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 865 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 853 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 B

After

Width:  |  Height:  |  Size: 294 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 B

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 857 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 881 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 868 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 B

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 854 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 873 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 883 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 866 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 291 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 876 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 852 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 858 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 886 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 880 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 85 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 870 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 871 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 874 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 867 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 875 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 885 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 B

After

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 884 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 869 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 872 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 856 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 855 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 893 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 283 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 B

After

Width:  |  Height:  |  Size: 288 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 863 B

After

Width:  |  Height:  |  Size: 1.8 KiB

Some files were not shown because too many files have changed in this diff Show More