forked from mtcontrib/signs_lib
allow custom nodes to define the text entity's size
in your node def, add: text_size = {x=foo, y=bar}, Size defaults to x=0.8 and y=0.5, respectively.
This commit is contained in:
parent
707f28c309
commit
a6caa51a85
8
init.lua
8
init.lua
@ -31,6 +31,8 @@ end
|
|||||||
|
|
||||||
signs_lib.modpath = minetest.get_modpath("signs_lib")
|
signs_lib.modpath = minetest.get_modpath("signs_lib")
|
||||||
|
|
||||||
|
local DEFAULT_TEXT_SCALE = {x=0.8, y=0.5}
|
||||||
|
|
||||||
signs_lib.regular_wall_sign_model = {
|
signs_lib.regular_wall_sign_model = {
|
||||||
nodebox = {
|
nodebox = {
|
||||||
type = "wallmounted",
|
type = "wallmounted",
|
||||||
@ -179,8 +181,6 @@ local FONT_FMT_SIMPLE = "hdf_%02x.png"
|
|||||||
-- Path to the textures.
|
-- Path to the textures.
|
||||||
local TP = MP.."/textures"
|
local TP = MP.."/textures"
|
||||||
|
|
||||||
local TEXT_SCALE = {x=0.8, y=0.5}
|
|
||||||
|
|
||||||
-- Lots of overkill here. KISS advocates, go away, shoo! ;) -- kaeza
|
-- Lots of overkill here. KISS advocates, go away, shoo! ;) -- kaeza
|
||||||
|
|
||||||
local PNG_HDR = string.char(0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A)
|
local PNG_HDR = string.char(0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A)
|
||||||
@ -409,9 +409,11 @@ end
|
|||||||
|
|
||||||
local function set_obj_text(obj, text, new, pos)
|
local function set_obj_text(obj, text, new, pos)
|
||||||
local split = new and split_lines_and_words or split_lines_and_words_old
|
local split = new and split_lines_and_words or split_lines_and_words_old
|
||||||
|
local n = minetest.registered_nodes[minetest.get_node(pos).name]
|
||||||
|
local text_scale = n.text_scale or DEFAULT_TEXT_SCALE
|
||||||
obj:set_properties({
|
obj:set_properties({
|
||||||
textures={make_sign_texture(split(text), pos)},
|
textures={make_sign_texture(split(text), pos)},
|
||||||
visual_size = TEXT_SCALE,
|
visual_size = text_scale,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user