1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-11-05 08:25:32 +01:00

3 Commits

Author SHA1 Message Date
acmgit
47abe2b2ef Update ontime_clocks.de.tr 2025-10-25 09:03:39 +02:00
Pierre-Yves Rollo
44264d6c8b feat: Add 3x3 and 5x5 frameless clocks 2025-10-25 09:03:39 +02:00
Pierre-Yves Rollo
d9d4ea32f7 feat(orientation): Make display_api able to handle dynamic entity orientation 2025-10-25 09:03:39 +02:00
38 changed files with 708 additions and 3566 deletions

View File

@@ -95,7 +95,7 @@ local function get_orientation_values(node)
local paramtype2 = ndef.paramtype2
if paramtype2 == "wallmounted" or paramtype2 == "colorwallmounted" then
return wallmounted_values[node.param2 % 8]
elseif paramtype2 == "facedir" or paramtype2 == "colorfacedir" then
elseif paramtype2 == "facedir" or paramtype2 == "colorfacedir" then
return facedir_values[node.param2 % 32]
else
-- No orientation or unknown orientation type
@@ -147,7 +147,8 @@ function display_api.update_entities(pos)
end
for _, objref in pairs(get_display_objrefs(pos, true)) do
local edef = ndef.display_entities[objref:get_luaentity().name]
local entity = objref:get_luaentity()
local edef = ndef.display_entities[entity.name]
local depth = clip_pos_prop(edef.depth)
local right = clip_pos_prop(edef.right)
local top = clip_pos_prop(edef.top)
@@ -160,14 +161,19 @@ function display_api.update_entities(pos)
if objref.set_rotation then
objref:set_rotation({
x = ov.rotation.x*math.pi/2,
y = ov.rotation.y*math.pi/2 + (edef.yaw or 0),
z = ov.rotation.z*math.pi/2,
x = ov.rotation.x * math.pi / 2 +
(entity.rotation and entity.rotation.x or 0),
y = ov.rotation.y * math.pi / 2 +
(entity.rotation and entity.rotation.y or 0) +
(edef.yaw or 0),
z = ov.rotation.z * math.pi / 2 +
(entity.rotation and entity.rotation.z or 0),
})
else
if ov.rotation.x ~=0 or ov.rotation.y ~= 0 then
minetest.log("warning", string.format(
"[display_api] unable to rotate correctly entity for node at %s without set_rotation method.",
"[display_api] unable to rotate correctly entity for " ..
"node at %s without set_rotation method.",
minetest.pos_to_string(pos)))
end
objref:set_yaw(ov.rotation.y*math.pi/2 + (edef.yaw or 0))
@@ -229,7 +235,7 @@ function display_api.on_place(itemstack, placer, pointed_thing, override_param2)
param2 = minetest.dir_to_wallmounted(dir)
elseif ndef.paramtype2 == "facedir" or
ndef.paramtype2 == "colorfacedir" then
ndef.paramtype2 == "colorfacedir" then
param2 = minetest.dir_to_facedir(dir, true)
end
end
@@ -276,24 +282,27 @@ end
--- Creates display entity with some fields and the on_activate callback
function display_api.register_display_entity(entity_name)
if not minetest.registered_entities[entity_name] then
minetest.register_entity(':'..entity_name, {
initial_properties = {
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "upright_sprite",
textures = {},
collide_with_objects = false,
pointable = false
},
on_activate = display_api.on_activate,
get_staticdata = function(self)
return minetest.serialize({ nodepos = self.nodepos })
end,
on_blast = function(self, damage)
return false, false, {}
end,
})
if minetest.registered_entities[entity_name] then
return
end
minetest.register_entity(':'..entity_name, {
initial_properties = {
collisionbox = {0, 0, 0, 0, 0, 0},
visual = "upright_sprite",
textures = {},
collide_with_objects = false,
pointable = false,
},
on_activate = display_api.on_activate,
get_staticdata = function(self)
return minetest.serialize({ nodepos = self.nodepos })
end,
on_blast = function(self, damage)
return false, false, {}
end,
})
end
minetest.register_lbm({
@@ -301,6 +310,7 @@ minetest.register_lbm({
name = "display_api:update_entities",
run_at_every_load = true,
nodenames = {"group:display_api",
"group:display_modpack_node", "group:display_lib_node"}, -- See deprecated(1)
"group:display_modpack_node",
"group:display_lib_node"}, -- See deprecated(1)
action = function(pos, node) display_api.update_entities(pos) end,
})

View File

@@ -1,188 +0,0 @@
--
-- fonts_extra: A font mod for font_api
--
-- This file was generated by `../font_api/tools/make_font.lua` on 2025-10-12 at 10:26.
--
-- Font generated from file sources/pixeldroidBoticRegular.otf with pointsize 16
font_api.register_font(
'botic',
{
version = 2,
default = true,
margintop = 0,
linespacing = 0,
charspacing = 2,
texture_height = 39,
glyphs_height = 13,
glyphs = {
[0] = { 8, 45, 25, 0 }, [162] = { 6, 45, 32, 1 },
[8364] = { 7, 45, 38, 1 }, [248] = { 8, 40, 2, 2 },
[247] = { 6, 45, 37, 1 }, [216] = { 8, 40, 1, 2 },
[215] = { 6, 45, 36, 1 }, [187] = { 8, 40, 0, 2 },
[183] = { 5, 60, 32, 0 }, [176] = { 5, 60, 31, 0 },
[174] = { 9, 36, 13, 2 }, [171] = { 8, 40, 39, 1 },
[169] = { 9, 36, 12, 2 }, [168] = { 6, 45, 35, 1 },
[167] = { 5, 60, 30, 0 }, [166] = { 3, 90, 8, 0 },
[165] = { 7, 45, 34, 1 }, [164] = { 6, 45, 33, 1 },
[163] = { 9, 36, 11, 2 }, [32] = { 7 }, [33] = { 4, 72, 8, 0 },
[34] = { 5, 60, 13, 0 }, [35] = { 7, 45, 26, 0 },
[36] = { 7, 45, 27, 0 }, [37] = { 9, 36, 3, 2 },
[38] = { 9, 36, 4, 2 }, [39] = { 2, 120, 0, 0 },
[40] = { 4, 72, 9, 0 }, [41] = { 4, 72, 10, 0 },
[42] = { 5, 60, 14, 0 }, [43] = { 6, 45, 28, 0 },
[44] = { 3, 90, 2, 0 }, [45] = { 5, 60, 15, 0 },
[46] = { 3, 90, 3, 0 }, [47] = { 7, 45, 29, 0 },
[48] = { 7, 45, 30, 0 }, [49] = { 5, 60, 16, 0 },
[50] = { 7, 45, 31, 0 }, [51] = { 7, 45, 32, 0 },
[52] = { 7, 45, 33, 0 }, [53] = { 7, 45, 34, 0 },
[54] = { 7, 45, 35, 0 }, [55] = { 7, 45, 36, 0 },
[56] = { 7, 45, 37, 0 }, [57] = { 7, 45, 38, 0 },
[58] = { 5, 60, 17, 0 }, [59] = { 3, 90, 4, 0 },
[60] = { 5, 60, 18, 0 }, [61] = { 5, 60, 19, 0 },
[62] = { 5, 60, 20, 0 }, [63] = { 7, 45, 39, 0 },
[64] = { 9, 36, 5, 2 }, [65] = { 7, 45, 40, 0 },
[66] = { 7, 45, 41, 0 }, [67] = { 7, 45, 42, 0 },
[68] = { 7, 45, 43, 0 }, [69] = { 7, 45, 44, 0 },
[70] = { 6, 45, 0, 1 }, [71] = { 7, 45, 1, 1 },
[72] = { 7, 45, 2, 1 }, [73] = { 3, 90, 5, 0 },
[74] = { 5, 60, 21, 0 }, [75] = { 7, 45, 3, 1 },
[76] = { 6, 45, 4, 1 }, [77] = { 9, 36, 6, 2 },
[78] = { 7, 45, 5, 1 }, [79] = { 7, 45, 6, 1 },
[80] = { 7, 45, 7, 1 }, [81] = { 8, 40, 35, 1 },
[82] = { 7, 45, 8, 1 }, [83] = { 7, 45, 9, 1 },
[84] = { 8, 40, 36, 1 }, [85] = { 7, 45, 10, 1 },
[86] = { 6, 45, 11, 1 }, [87] = { 9, 36, 7, 2 },
[88] = { 8, 40, 37, 1 }, [89] = { 7, 45, 12, 1 },
[90] = { 8, 40, 38, 1 }, [91] = { 4, 72, 11, 0 },
[92] = { 6, 45, 13, 1 }, [93] = { 4, 72, 12, 0 },
[94] = { 7, 45, 14, 1 }, [95] = { 9, 36, 8, 2 },
[96] = { 3, 90, 6, 0 }, [97] = { 7, 45, 15, 1 },
[98] = { 7, 45, 16, 1 }, [99] = { 6, 45, 17, 1 },
[100] = { 7, 45, 18, 1 }, [101] = { 7, 45, 19, 1 },
[102] = { 5, 60, 22, 0 }, [103] = { 7, 45, 20, 1 },
[104] = { 6, 45, 21, 1 }, [105] = { 3, 90, 7, 0 },
[106] = { 4, 72, 13, 0 }, [107] = { 6, 45, 22, 1 },
[108] = { 4, 72, 14, 0 }, [109] = { 9, 36, 9, 2 },
[110] = { 6, 45, 23, 1 }, [111] = { 7, 45, 24, 1 },
[112] = { 7, 45, 25, 1 }, [113] = { 7, 45, 26, 1 },
[114] = { 5, 60, 23, 0 }, [115] = { 7, 45, 27, 1 },
[116] = { 5, 60, 24, 0 }, [117] = { 7, 45, 28, 1 },
[118] = { 5, 60, 25, 0 }, [119] = { 9, 36, 10, 2 },
[120] = { 7, 45, 29, 1 }, [121] = { 7, 45, 30, 1 },
[122] = { 6, 45, 31, 1 }, [123] = { 5, 60, 26, 0 },
[124] = { 2, 120, 1, 0 }, [125] = { 5, 60, 27, 0 },
[126] = { 5, 60, 28, 0 }, [161] = { 5, 60, 29, 0 },
},
}
)
-- Font generated from file sources/OldWizard.ttf with pointsize 16
font_api.register_font(
'oldwizard',
{
version = 2,
default = true,
margintop = 0,
linespacing = 0,
charspacing = 2,
texture_height = 25674,
glyphs_height = 389,
glyphs = {
[32] = { 18 }, [33] = { 3, 90, 0, 0 }, [34] = { 5, 60, 2, 0 },
[35] = { 8, 40, 6, 0 }, [36] = { 10, 30, 8, 0 },
[37] = { 14, 24, 8, 0 }, [38] = { 12, 24, 9, 0 },
[39] = { 3, 90, 1, 0 }, [40] = { 8, 40, 7, 0 },
[41] = { 9, 36, 8, 0 }, [42] = { 10, 30, 9, 0 },
[43] = { 16, 20, 11, 0 }, [44] = { 7, 45, 4, 0 },
[45] = { 14, 24, 10, 0 }, [46] = { 7, 45, 5, 0 },
[47] = { 15, 20, 12, 0 }, [48] = { 18, 18, 13, 0 },
[49] = { 17, 20, 13, 0 }, [50] = { 26, 12, 0, 1 },
[51] = { 18, 18, 14, 0 }, [52] = { 22, 15, 13, 0 },
[53] = { 23, 15, 14, 0 }, [54] = { 24, 12, 1, 1 },
[55] = { 25, 12, 2, 1 }, [56] = { 25, 12, 3, 1 },
[57] = { 26, 12, 4, 1 }, [58] = { 12, 24, 11, 0 },
[59] = { 12, 24, 12, 0 }, [60] = { 33, 10, 8, 1 },
[61] = { 30, 10, 9, 1 }, [62] = { 35, 10, 0, 2 },
[63] = { 27, 12, 5, 1 }, [64] = { 60, 5, 0, 7 },
[65] = { 43, 8, 4, 2 }, [66] = { 39, 9, 2, 2 },
[67] = { 45, 6, 1, 3 }, [68] = { 52, 6, 2, 3 },
[69] = { 42, 8, 5, 2 }, [70] = { 54, 6, 3, 3 },
[71] = { 49, 6, 4, 3 }, [72] = { 51, 6, 5, 3 },
[73] = { 52, 6, 0, 4 }, [74] = { 65, 5, 1, 7 },
[75] = { 60, 5, 2, 7 }, [76] = { 62, 5, 3, 7 },
[77] = { 88, 4, 0, 10 }, [78] = { 77, 4, 1, 10 },
[79] = { 58, 6, 1, 4 }, [80] = { 67, 5, 4, 7 },
[81] = { 67, 5, 0, 8 }, [82] = { 76, 4, 2, 10 },
[83] = { 70, 5, 1, 8 }, [84] = { 72, 4, 3, 10 },
[85] = { 73, 4, 0, 11 }, [86] = { 74, 4, 1, 11 },
[87] = { 113, 3, 0, 16 }, [88] = { 84, 4, 2, 11 },
[89] = { 85, 4, 3, 11 }, [90] = { 87, 4, 0, 12 },
[91] = { 48, 6, 2, 4 }, [92] = { 49, 6, 3, 4 },
[93] = { 50, 6, 4, 4 }, [94] = { 50, 6, 5, 4 },
[95] = { 76, 4, 1, 12 }, [96] = { 26, 12, 6, 1 },
[97] = { 61, 5, 2, 8 }, [98] = { 62, 5, 3, 8 },
[99] = { 54, 6, 0, 5 }, [100] = { 55, 6, 1, 5 },
[101] = { 56, 6, 2, 5 }, [102] = { 56, 6, 3, 5 },
[103] = { 67, 5, 4, 8 }, [104] = { 77, 4, 2, 12 },
[105] = { 40, 8, 6, 2 }, [106] = { 40, 8, 7, 2 },
[107] = { 90, 3, 1, 16 }, [108] = { 42, 8, 0, 3 },
[109] = { 124, 2, 1, 22 }, [110] = { 84, 4, 3, 12 },
[111] = { 63, 5, 0, 9 }, [112] = { 74, 4, 0, 13 },
[113] = { 75, 4, 1, 13 }, [114] = { 76, 4, 2, 13 },
[115] = { 66, 5, 1, 9 }, [116] = { 46, 6, 4, 5 },
[117] = { 102, 3, 2, 16 }, [118] = { 92, 3, 0, 17 },
[119] = { 127, 2, 0, 23 }, [120] = { 105, 3, 1, 17 },
[121] = { 83, 4, 3, 13 }, [122] = { 95, 3, 2, 17 },
[123] = { 72, 4, 0, 14 }, [124] = { 25, 12, 7, 1 },
[125] = { 74, 4, 1, 14 }, [126] = { 99, 3, 0, 18 },
[161] = { 38, 9, 3, 2 }, [162] = { 88, 4, 2, 14 },
[163] = { 128, 2, 1, 23 }, [164] = { 90, 3, 1, 18 },
[165] = { 117, 3, 2, 18 }, [166] = { 27, 12, 8, 1 },
[167] = { 93, 3, 0, 19 }, [168] = { 54, 6, 5, 5 },
[169] = { 135, 2, 0, 24 }, [170] = { 55, 6, 0, 6 },
[171] = { 110, 3, 1, 19 }, [172] = { 97, 3, 2, 19 },
[174] = { 140, 2, 1, 24 }, [175] = { 113, 3, 0, 20 },
[176] = { 71, 5, 2, 9 }, [177] = { 115, 3, 1, 20 },
[178] = { 58, 6, 1, 6 }, [179] = { 59, 6, 2, 6 },
[180] = { 45, 6, 3, 6 }, [181] = { 105, 3, 2, 20 },
[182] = { 105, 3, 0, 21 }, [183] = { 46, 6, 4, 6 },
[184] = { 61, 5, 3, 9 }, [185] = { 31, 10, 1, 2 },
[186] = { 78, 4, 3, 14 }, [187] = { 125, 2, 0, 25 },
[188] = { 142, 2, 1, 25 }, [189] = { 159, 2, 0, 26 },
[190] = { 160, 2, 1, 26 }, [191] = { 113, 3, 1, 21 },
[192] = { 146, 2, 0, 27 }, [193] = { 147, 2, 1, 27 },
[194] = { 148, 2, 0, 28 }, [195] = { 150, 2, 1, 28 },
[196] = { 151, 2, 0, 29 }, [197] = { 152, 2, 1, 29 },
[198] = { 221, 1, 0, 49 }, [199] = { 154, 2, 0, 30 },
[200] = { 138, 2, 1, 30 }, [201] = { 139, 2, 0, 31 },
[202] = { 140, 2, 1, 31 }, [203] = { 141, 2, 0, 32 },
[204] = { 160, 2, 1, 32 }, [205] = { 161, 2, 0, 33 },
[206] = { 162, 2, 1, 33 }, [207] = { 164, 2, 0, 34 },
[208] = { 183, 1, 0, 50 }, [209] = { 221, 1, 0, 51 },
[210] = { 166, 2, 1, 34 }, [211] = { 168, 2, 0, 35 },
[212] = { 169, 2, 1, 35 }, [213] = { 170, 2, 0, 36 },
[214] = { 171, 2, 1, 36 }, [215] = { 115, 3, 2, 21 },
[216] = { 192, 1, 0, 52 }, [217] = { 194, 1, 0, 53 },
[218] = { 195, 1, 0, 54 }, [219] = { 197, 1, 0, 55 },
[220] = { 198, 1, 0, 56 }, [221] = { 219, 1, 0, 57 },
[222] = { 160, 2, 0, 37 }, [223] = { 161, 2, 1, 37 },
[224] = { 142, 2, 0, 38 }, [225] = { 143, 2, 1, 38 },
[226] = { 144, 2, 0, 39 }, [227] = { 144, 2, 1, 39 },
[228] = { 145, 2, 0, 40 }, [229] = { 146, 2, 1, 40 },
[230] = { 210, 1, 0, 58 }, [231] = { 127, 2, 0, 41 },
[232] = { 128, 2, 1, 41 }, [233] = { 128, 2, 0, 42 },
[234] = { 129, 2, 1, 42 }, [235] = { 130, 2, 0, 43 },
[236] = { 88, 4, 0, 15 }, [237] = { 88, 4, 1, 15 },
[238] = { 88, 4, 2, 15 }, [239] = { 90, 3, 0, 22 },
[240] = { 156, 2, 1, 43 }, [241] = { 180, 1, 0, 59 },
[242] = { 135, 2, 0, 44 }, [243] = { 136, 2, 1, 44 },
[244] = { 137, 2, 0, 45 }, [245] = { 137, 2, 1, 45 },
[246] = { 138, 2, 0, 46 }, [247] = { 185, 1, 0, 60 },
[248] = { 163, 2, 1, 46 }, [249] = { 211, 1, 0, 61 },
[250] = { 212, 1, 0, 62 }, [251] = { 213, 1, 0, 63 },
[252] = { 214, 1, 0, 64 }, [253] = { 167, 2, 0, 47 },
[254] = { 144, 2, 1, 47 }, [255] = { 170, 2, 0, 48 },
[0] = { 8, 45, 3, 0 }, [8364] = { 243, 1, 0, 65 },
},
}
)

View File

@@ -1,4 +0,0 @@
name = fonts_extra
title = Extra fonts
description = Extra fonts for font_api: botic
depends = font_api

View File

@@ -1,132 +0,0 @@
-- This is an example parameter file for make_font.lua
-- Copy this file as params.lua.
-- Replace values between brakets <> to your choices.
-- Launch make_font.lua params.lua
params = {
-- Resulting mod name (required)
-- As this name will be use as texture prefix and so repeated many times,
-- please avoid long names but keep explicit anyway.
mod_name = "fonts_extra",
-- If only one font, have font in title, like "xxx font"
mod_title = "Extra fonts",
-- A good description would be "... fonts for font_api"
mod_description = "Extra fonts for font_api: botic",
-- List of fons to include to the mod.
fonts = {
{
-- Registered font name (required)
-- As this name will be use as texture prefix and so repeated many times,
-- avoid long names. A good name would be a single world all lowercase.
name = "botic",
-- Registered font label (optional, default capitalized name)
-- This is the display name for this font. No need to be concise.
label = "Botic",
-- True type font file to get glyphs from (required)
file = "sources/pixeldroidBoticRegular.otf",
-- Author(s) of the original font (required)
author = "pixeldroid",
-- License of the original font (required)
-- Join license text, as a text file, to your mod.
license = "Open Font License",
-- Render pointsize (integer, required)
-- Try to find a proper value for a good rendering
pointsize = 16,
-- Shoud chars be trimmed? (boolean, required)
-- Set it to true to reduce texture size
-- and increase `char_spacing` accordingly.
-- If results are weird, you may try to set it to false.
trim = true,
-- Margin added on top of text textures with this font (integer, optional, default 0)
margin_top = 0,
-- Space between consecutive lines (integer, optional, default 0)
-- Space may be negative to make lines closer.
line_spacing = 0,
-- Space between consecutive chars (integer, optional, default 0)
char_spacing = 2,
-- Extra codepoints to include to font mod (optional, default none)
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
-- Codepoint 0x0020 is always considered as a space.
-- Codepoints not existing in font file will be ignored.
-- Refer to https://en.wikipedia.org/wiki/Unicode
codepoints = {
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
{ from = 0x00a1, to = 0x00ff },
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
{ from = 0x20ac, to = 0x20ac },
},
}, {
-- Registered font name (required)
-- As this name will be use as texture prefix and so repeated many times,
-- avoid long names. A good name would be a single world all lowercase.
name = "oldwizard",
-- Registered font label (optional, default capitalized name)
-- This is the display name for this font. No need to be concise.
label = "Old Wizard",
-- True type font file to get glyphs from (required)
file = "sources/OldWizard.ttf",
-- Author(s) of the original font (required)
author = "Angel",
-- License of the original font (required)
-- Join license text, as a text file, to your mod.
license = "Public Domain",
-- URL of the original font (optional)
-- This is an optional field but it is recommended to put an URL
-- if it exists.
url = "http://www.pentacom.jp/pentacom/bitfontmaker2/gallery/?id=168",
-- Render pointsize (integer, required)
-- Try to find a proper value for a good rendering
pointsize = 16,
-- Shoud chars be trimmed? (boolean, required)
-- Set it to true to reduce texture size
-- and increase `char_spacing` accordingly.
-- If results are weird, you may try to set it to false.
trim = true,
-- Margin added on top of text textures with this font (integer, optional, default 0)
margin_top = 0,
-- Space between consecutive lines (integer, optional, default 0)
-- Space may be negative to make lines closer.
line_spacing = 0,
-- Space between consecutive chars (integer, optional, default 0)
char_spacing = 2,
-- Extra codepoints to include to font mod (optional, default none)
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
-- Codepoint 0x0020 is always considered as a space.
-- Codepoints not existing in font file will be ignored.
-- Refer to https://en.wikipedia.org/wiki/Unicode
codepoints = {
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
{ from = 0x00a1, to = 0x00ff },
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
{ from = 0x20ac, to = 0x20ac },
},
},
}
}

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1,7 +1,3 @@
## TODO:
* Update documentation with new format
* add information about texture having to be escaped in formspecs with `:gsub("[\\^]", "\\%0")`
# Font API
This document describes Font API. Font API creates textures for font display on entities.

View File

@@ -58,7 +58,6 @@ end
--- Font class
local Font = {}
Font.__index = Font
font_api.Font = Font
function Font:new(def)
@@ -69,68 +68,36 @@ function Font:new(def)
return nil
end
local font = table.copy(def)
-- Version 1 is with one texture per glyph
if font.version == nil or font.version == 1 then
if font.height == nil or font.height <= 0 then
minetest.log("error",
"[font_api] Font definition must have a positive height.")
return nil
end
if type(font.widths) ~= "table" then
minetest.log("error",
"[font_api] Font definition must have a `widths` array.")
return nil
end
-- Kind of convert to version 2
font.glyphs = {}
for codepoint, width in pairs(font.widths) do
font.glyphs[codepoint] = { width, codepoint }
end
font.widths = nil
font.glyphs_height = font.height
font.height = nil
if def.height == nil or def.height <= 0 then
minetest.log("error",
"[font_api] Font definition must have a positive height.")
return nil
end
-- Version 2 is with one only texture for all glyphs, using `[sheet` textures
if font.version == 2 then
if type(font.glyphs) ~= "table" then
minetest.log("error",
"[font_api] Font definition must have a `glyphs` array.")
return nil
end
if font.texture_height == nil or font.texture_height <= 0 then
minetest.log("error",
"[font_api] Font definition must have a positive `texture_height`.")
return nil
end
if font.glyphs_height == nil or font.glyphs_height <= 0 then
minetest.log("error",
"[font_api] Font definition must have a positive `glyphs_height`.")
return nil
end
font.vertical_number_of_tiles = math.floor(font.texture_height / font.glyphs_height)
if type(def.widths) ~= "table" then
minetest.log("error",
"[font_api] Font definition must have a widths array.")
return nil
end
if font.glyphs[0] == nil then
if def.widths[0] == nil then
minetest.log("error",
"[font_api] Font must have a char with codepoint 0 (=unknown char).")
return nil
end
if self.charspacing == nil then
self.charspacing = 0
end
local font = table.copy(def)
setmetatable(font, self)
self.__index = self
setmetatable(font, self)
-- Check if fixedwidth
for codepoint, width in pairs(font.widths) do
font.fixedwidth = font.fixedwidth or width
if width ~= font.fixedwidth then
font.fixedwidth = nil
break
end
end
return font
end
@@ -157,7 +124,7 @@ function Font:get_next_char(text)
end
-- Fallback mechanism
if self.glyphs[codepoint] == nil then
if self.widths[codepoint] == nil then
local char = text:sub(1, bytes)
if fallbacks[char] then
@@ -173,29 +140,14 @@ end
--- Returns the width of a given char
-- @param char : codepoint of the char
-- @return Char width
function Font:get_char_width(codepoint)
-- [1] is char width
return (self.glyphs[codepoint] or self.glyphs[0])[1] + self.charspacing
end
--- Returns texture for a given glyph
-- @param glyph: table representing the glyph
-- @return Texture
function Font:get_glyph_texture(glyph)
if #glyph == 4 then
-- Actual version with one texture for all glyphs
return string.format("font_%s.png^[sheet:%dx%d:%d,%d",
self.name, glyph[2], self.vertical_number_of_tiles, glyph[3], glyph[4])
if self.fixedwidth then
return self.fixedwidth
elseif self.widths[codepoint] then
return self.widths[codepoint]
else
return self.widths[0]
end
if #glyph == 2 then
-- Former version with one texture per glyph
return string.format("font_%s_%04x.png",
self.name, glyph[2])
end
-- Case of invisible chars like space (no need to add any texture)
return ""
end
--- Text height for multiline text including margins and line spacing
@@ -208,7 +160,7 @@ function Font:get_height(nb_of_lines)
if nb_of_lines > 0 then
return
(
self.glyphs_height +
(self.height or 0) +
(self.margintop or 0) +
(self.marginbottom or 0)
) * nb_of_lines +
@@ -250,8 +202,8 @@ end
--- Render text with the font in a view
-- @param text Text to be rendered
-- @param width Width (in pixels) of the texture (extra text will be truncated)
-- @param height Height (in pixels) of the texture (extra text will be truncated)
-- @param texturew Width (in pixels) of the texture (extra text will be truncated)
-- @param textureh Height (in pixels) of the texture (extra text will be truncated)
-- @param style Style of the rendering:
-- - lines: maximum number of text lines (if text is limited)
-- - halign: horizontal align ("left"/"center"/"right")
@@ -259,7 +211,7 @@ end
-- - color: color of the text ("#rrggbb")
-- @return Texture string
function Font:render(text, width, height, style)
function Font:render(text, texturew, textureh, style)
style = style or {}
-- Split text into lines (and limit to style.lines # of lines)
@@ -279,14 +231,14 @@ function Font:render(text, width, height, style)
local x, y, codepoint
local texture = ""
local text_height = self:get_height(#lines)
local textheight = self:get_height(#lines)
if style.valign == "top" then
y = 0
elseif style.valign == "bottom" then
y = height - text_height
y = textureh - textheight
else
y = (height - text_height) / 2
y = (textureh - textheight) / 2
end
y = y + (self.margintop or 0)
@@ -295,34 +247,28 @@ function Font:render(text, width, height, style)
if style.halign == "left" then
x = 0
elseif style.halign == "right" then
x = width - l.width
x = texturew - l.width
else
x = (width - l.width) / 2
x = (texturew - l.width) / 2
end
while l.text ~= '' do
codepoint, l.text = self:get_next_char(l.text)
if codepoint == nil then return '' end -- UTF Error
local glyph = self.glyphs[codepoint]
-- Add image only if it is visible (at least partly)
if x + glyph[1] + self.charspacing >= 0 and x <= width then
local glyph_texture = self:get_glyph_texture(glyph):gsub("[\\^:]", "\\%0")
if glyph_texture ~= '' then
texture = string.format("%s:%d,%d=%s", texture, x, y, glyph_texture)
end
if x + self.widths[codepoint] >= 0 and x <= texturew then
texture = texture..
string.format(":%d,%d=font_%s_%04x.png", x, y, self.name, codepoint)
end
x = x + glyph[1] + self.charspacing
x = x + self.widths[codepoint]
end
y = y + self:get_height() + (self.linespacing or 0)
end
texture = string.format("[combine:%dx%d%s", width, height, texture)
texture = string.format("[combine:%dx%d", texturew, textureh)..texture
if style.color then
texture = texture.."^[colorize:"..style.color
end
print(texture)
return texture
end

View File

@@ -103,17 +103,11 @@ local function show_font_formspec(playername)
for line = 1, #fonts do
local font = font_api.get_font(fonts[line])
local texture = font:render(font.name,
font:get_height()*5, font:get_height()*1.2, {
lines = 1,
valign = "middle",
halign = "center",
color = "#fff"
}
)
local texture = font:make_text_texture(font.name, font:get_height()*5,
font:get_height()*1.2, 1, "center", "top", "#fff")
fs = string.format(
"%simage[0.1,%s;4.5,0.8;%s]button_exit[0,%s;4,1;font_%s;]",
fs, line - 0.9, texture:gsub("[\\^]", "\\%0"), line - 1, font.name)
fs, line-0.9, texture, line-1, font.name)
end
minetest.show_formspec(context.playername, modname..':font_list', fs)
end

View File

@@ -1,20 +0,0 @@
# Mod maker for FontAPI
This tool makes font mods out of a true type font file.
```
lua <params.lua> <font_file>
```
## Installation
This tool needs some aditional programs:
* `lua` to be able to launch it from command line
* `imagemagick` to process images and build texture
* `fonttools` and `xmlstarlet` to analyse true type font
On Debian like distros, these could be installing issuing:
```shell
apt install lua5.4 imagemagick fonttools xmlstarlet
```

View File

@@ -1,459 +0,0 @@
--
-- A font mod generator for font_api
--
-- This is an utility script for code and texture generator,
-- not intended to be tranlslated.
-- TODO : detect and manage fixed width fonts
--
-- Dependancies check
--
local function check(cmd, msg)
if os.execute(cmd .. " > /dev/null 2>&1") then
return true
else
print(msg)
end
end
if
not check("convert --version", "Error: This program requires convert from ImageMagick!") or
not check("identify --version", "Error: This program requires identify from ImageMagick!") or
not check("ttx --version", "Error: This program requires ttx from FontTools!") or
not check("xmlstarlet --version", "Error: This program requires xmlstarlet!")
then
print("Please fix above problem and retry.")
os.exit(1)
end
--
-- Argument & parameters management
--
local function usage()
print (arg[0] .. " takes two arguments:")
print (" - parameter file")
print (" - destination path")
end
if #arg ~= 2 then
usage()
os.exit(1)
end
print("Reading paramaters.")
dofile(arg[1])
local mod_dir = arg[2]
if os.execute("[ -d " .. mod_dir .. " ]") then
print ("Directory " .. mod_dir .. " already exists!")
-- os.exit(1)
end
os.execute("mkdir -p " .. mod_dir .. "/textures")
--
-- Available tile sizes management
--
local function compute_tile_sizes(texture_size)
results = {}
for size = 1, texture_size do
if texture_size % size == 0 then
table.insert(results, size)
end
end
return results
end
-- This will give enough tile width combinations (360 is 2 * 2 * 2 * 3 * 3 * 5)
local tile_widths = compute_tile_sizes(360)
-- Table width has to be sorted
table.sort(tile_widths)
local texture_width = tile_widths[#tile_widths]
-- Rounds glyph width up to available tile width (first width larger than given one)
local function tile_width(width)
for _, w in ipairs(tile_widths) do
if width < w then
return w
end
end
return texture_width
end
--
-- Helper functions
--
-- Issue an OS command and get its result
local function command(cmd)
local f = assert(io.popen(cmd, 'r'))
local s = assert(f:read('*a'))
f:close()
return s
end
-- Escape chars that could harm commands
local function escape(char)
if char == "\\" then return "\\\\\\\\" end
if char == "\"" then return "\\\"" end
if char == "`" then return "\\`" end
return char
end
--
-- Things start here
--
-- Measures a glyph, returs its height and width in pixels
local function measure(font, codepoint)
local char = utf8.char(codepoint)
local cmd = string.format(
"convert -font \"%s\" -pointsize %d label:\"%s\" -define trim:edges=east,west -trim info:",
font.file, font.glyphs_height, escape(char)
)
local _, _, w, h = string.find(command(cmd), "([0-9]+)x([0-9]+)" )
return tonumber(w), tonumber(h)
end
-- Read all available codepoints from ttf file
local function read_available_codepoints(file)
-- Takes only first cmap table found.
-- TODO: Should choose table according to platformID (3 else 0 else 2)
-- (see https://stackoverflow.com/a/29424838)
local cmd, errmsg, status = io.popen(string.format(
"ttx -o - \"%s\" 2>/dev/null | " ..
"xmlstarlet sel -t -v \"//*[starts-with(name(), 'cmap_format_')][1]/map/@code\" | " ..
"sort -u",
file), 'r')
if cmd == nil then
print(string.format(
"Could not open font file %s:\n%s", file, errmsg))
os.exit(status)
end
local codepoints = {}
local codepoint = cmd:read("*line")
while codepoint do
codepoints[tonumber(codepoint)] = true
codepoint = cmd:read("*line")
end
cmd:close()
return codepoints
end
-- Add codepoints to a font
local function add_codepoints(font, from, to)
for codepoint = from, to do
if font.cp[codepoint] then
-- Glyph size
local w, h = measure(font, codepoint)
if h > font.glyphs_height then font.glyphs_height = h end
-- Detect and discard eventual buggy glyphs (may be spaces)
if h > 1 then
font.glyph_widths[codepoint] = w
-- Tile width
local tile_w = tile_width(w)
if font.by_width[tile_w] == nil then
font.by_width[tile_w] = {}
table.insert(font.tile_widths, tile_w)
end
table.insert(font.by_width[tile_w], codepoint)
end
end
end
end
-- Make font texture
-- Font must have all its codepoints added
local function make_final_texture(font)
local texture_file = string.format("%s/textures/font_%s.png",
mod_dir, font.name)
-- We start with a single line
font.texture_height = font.glyphs_height
-- Characteristics of [sheet:NxM:x,y
-- M is always the same and depends on font and texture height.
font.glyph_xs = {} -- x for each glyph
font.glyph_ys = {} -- y for each glyph
font.glyph_ns = {} -- n of tiles in sheet for each glyph (=texturewidth / tilewidth)
local x = 0 -- cursor x
local glyph_y = 0
table.sort(font.tile_widths)
print(" Computing positions")
-- Compute positions
for _, tile_width in ipairs(font.tile_widths) do
for _, codepoint in ipairs(font.by_width[tile_width]) do
local glyph_x = math.ceil(x / tile_width)
x = glyph_x * tile_width
if x + tile_width > texture_width then -- no space left on current line
x = 0
glyph_x = 0
glyph_y = glyph_y + 1
font.texture_height = font.texture_height + font.glyphs_height
end
font.glyph_xs[codepoint] = glyph_x
font.glyph_ys[codepoint] = glyph_y
font.glyph_ns[codepoint] = math.floor(texture_width / tile_width)
x = x + tile_width
end
end
print(" Composing texture")
-- Compose texture
command(string.format(
"convert -size %dx%d xc:transparent %s",
texture_width, font.texture_height, texture_file
))
for codepoint, n in pairs(font.glyph_ns) do
print(codepoint)
local w = math.floor(texture_width / n)
local x = w * font.glyph_xs[codepoint]
local y = font.glyphs_height * font.glyph_ys[codepoint]
local cmd
-- Subtexture subcommand
if codepoint == 0 then
-- The "unknown" char
cmd = string.format(
"convert %s" ..
" -stroke black -fill transparent -strokewidth 1 " ..
" -draw \"rectangle %d,%d %d,%d\" %s",
texture_file, x, y, x + w, y + font.glyphs_height, texture_file
)
else
-- Other glyhp chars
cmd = string.format(
"convert %s \\(" ..
" -background none -font \"%s\" -pointsize %d label:\"%s\"" ..
" -define trim:edges=east,west -trim" ..
" -repage +%d+%d \\) -flatten %s",
texture_file, font.file, font.pointsize, escape(utf8.char(codepoint)),
x, y, texture_file
)
end
command(cmd)
end
command(string.format("convert %s -channel alpha -threshold 50%% %s", texture_file, texture_file))
end
local function process_font(font)
-- Defaults
font.label = font.label or font.name:gsub("^%l", string.upper)
font.margin_top = font.margin_top or 0
font.line_spacing = font.line_spacing or 0
font.char_spacing = font.char_spacing or 0
print(string.format("Processing font \"%s\" (%s)", font.label, font.name))
-- Computed values
font.by_width = {} -- Codepoints by tile width
font.tile_widths = {} -- Used tile widths
font.glyph_widths = {} -- Exact width of reach glyph
font.glyphs_height = 0 -- Max height of all glyphs
print(" Reading available glyphs")
-- Available codepoints from file
font.cp = read_available_codepoints(font.file)
print(" Computing glyphs properties")
-- Special char: unknown char
-- We use size of glyph "0" (rounded) but it would be better to get size from ttx
-- TODO: We could get information from ttx:
-- <mtx> gives a width always divisible by 125 for metro font (check if its somehow proportional to what magick gives)
local w = tile_width(measure(font, 0x0030))
font.glyph_widths[0] = w
font.by_width[w] = { 0 }
font.tile_widths = { w }
-- Mandatory codepoints (ASCII)
add_codepoints(font, 0x0021, 0x007f)
-- Extra codepoints
if font.codepoints then
for _, range in ipairs(font.codepoints) do
add_codepoints(font, range.from, range.to)
end
end
print(" Creating final texture")
make_final_texture(font)
-- Add invisible chars : Spaces
-- TODO: Should be computed from ttx
-- TODO: manage half/quater spaces
font.glyph_widths[0x0020] = font.glyph_widths[0x0030]
end
local function get_font_registration_lua(font)
local glyphs = "{"
local curlinesize = 1000
for codepoint, w in pairs(font.glyph_widths) do
local glyph
local x = font.glyph_xs[codepoint]
local y = font.glyph_ys[codepoint]
local n = font.glyph_ns[codepoint]
if x ~= nil and y ~=nil and n ~= nil then
glyph = string.format("[%d] = { %d, %d, %d, %d },", codepoint, w, n, x, y)
else
glyph = string.format("[%d] = { %d },", codepoint, w)
end
curlinesize = curlinesize + glyph:len() + 1
if curlinesize > 80 then
glyphs = glyphs .. "\n\t\t\t" .. glyph
curlinesize = 12 + glyph:len()
else
glyphs = glyphs .. " " .. glyph
end
end
glyphs = glyphs .. "\n\t\t}"
return string.format([[
-- Font generated from file %s with pointsize %d
font_api.register_font(
'%s',
{
version = 2,
default = true,
margintop = %d,
linespacing = %d,
charspacing = %d,
texture_height = %d,
glyphs_height = %d,
glyphs = %s,
}
)
]], font.file, font.pointsize, font.name,
font.margin_top, font.line_spacing, font.char_spacing,
font.texture_height, font.glyphs_height, glyphs)
end
--
-- Main code
--
for _, font in ipairs(params.fonts) do
process_font(font)
end
print("All fonts processed, writing mod files")
--
-- Write init.lua
--
print(" Writing init.lua")
local file = io.open(mod_dir .. "/init.lua", "w")
file:write(string.format([[
--
-- %s: A font mod for font_api
--
-- This file was generated by `%s` on %s.
--
]], params.mod_name, arg[0], os.date("%Y-%m-%d at %H:%M")
))
for _, font in ipairs(params.fonts) do
file:write(get_font_registration_lua(font))
end
file:close()
--
-- Write mod.conf
--
print(" Writing mod.conf")
local file = io.open(mod_dir .. "/mod.conf", "w")
file:write(string.format([[
name = %s
title = %s
description = %s
depends = font_api
]], params.mod_name, params.mod_title, params.mod_description))
--
-- Write README.md
--
print(" Writing README.md")
local function list(t)
return #t == 1 and t[1] or
table.concat(t, ", ", 1, #t - 1) .. " and " .. t[#t]
end
local font_labels = {}
for _, font in ipairs(params.fonts) do
table.insert(font_name, font.label)
end
local function font_description(font)
local orignal = string.format("%s by %s", font.label, font.author)
if font.url and font.url ~= "" then
original = string.format("[%s](%s)", original, font.url)
end
return string.format([[
![%s font preview](screenshot_%s.png)
**Original font**: %s
**License**: %s
]], font.label, font.name, orignal, font.license)
end
local file = io.open(mod_dir .. "/README.md", "w")
file:write(string.format([[
# %s minetest mod for font API
This mod adds %s to Font API mod (from [display_modpack](https://github.com/pyrollo/display_modpack)).
For more information, see the [forum topic](https://forum.minetest.net/viewtopic.php?t=13563) at the Minetest forums.
]], params.mod_title, list(font_labels)))
file:write([[
**Dependancies**: font_api
**License**: code under LGPL v2.1
]])
if #params.fonts > 1 then
for _, font in ipairs(params.fonts) do
file:write("## %s font\n", font.label)
file:write(font_description(font))
end
else
file:write(font_description(params.font[1]))
end
-- This font includes uppercase, lowercase and many accentuated latin letters, greek and cyrillic letters.

View File

@@ -1,97 +0,0 @@
-- This is an example parameter file for make_font.lua
-- Copy this file as params.lua.
-- Replace values between brakets <> to your choices.
-- Launch make_font.lua params.lua
params = {
-- Resulting mod name (required)
-- As this name will be use as texture prefix and so repeated many times,
-- please avoid long names but keep explicit anyway.
mod_name = "<your mod name>",
-- If only one font, have font in title, like "xxx font"
mod_title = "<your mod title>",
-- A good description would be "... fonts for font_api"
mod_description = "<your mod description>",
-- List of fons to include to the mod.
fonts = {
{
-- Registered font name (required)
-- As this name will be use as texture prefix and so repeated many times,
-- avoid long names. A good name would be a single world all lowercase.
name = "<your font technical name>",
-- Registered font label (optional, default capitalized name)
-- This is the display name for this font. No need to be concise.
label = "<your font display label>",
-- True type font file to get glyphs from (required)
file = "<your font true type font>",
-- Author(s) of the original font (required)
author = "<author or list of authors>",
-- License of the original font (required)
-- Join license text, as a text file, to your mod.
license = "<name of the license>",
-- URL of the original font (optional)
-- If there is an URL about this font, it is recommended to have it
-- here. It should be URL of font project if it exists or at least
-- an URL where to download the font with details about author and
-- license.
url = "<URL>",
-- Render pointsize (integer, required)
-- Try to find a proper value for a good rendering
pointsize = <proper rendering height>,
-- Shoud chars be trimmed? (boolean, required)
-- Set it to true to reduce texture size
-- and increase `char_spacing` accordingly.
-- If results are weird, you may try to set it to false.
trim = true,
-- Margin added on top of text textures with this font (integer, optional, default 0)
margin_top = 3,
-- Space between consecutive lines (integer, optional, default 0)
-- Space may be negative to make lines closer.
line_spacing = -2,
-- Space between consecutive chars (integer, optional, default 0)
char_spacing = 2,
-- Extra codepoints to include to font mod (optional, default none)
-- Codepoints from 0x0020 to 0x007f (ASCII) are always included.
-- Codepoint 0x0020 is always considered as a space.
-- Codepoints not existing in font file will be ignored.
-- Refer to https://en.wikipedia.org/wiki/Unicode
codepoints = {
-- 00a0-00ff Latin-1 Supplement (full except nbsp)
{ from = 0x00a1, to = 0x00ff },
-- 0100-017f Latin Extended-A (full)
{ from = 0x0100, to = 0x017f },
-- 0370-03ff Greek (full)
{ from = 0x0370, to = 0x03ff },
-- 0400-04ff Cyrilic (full)
{ from = 0x0400, to = 0x04ff },
-- 2000-206f General Punctuation (Limited to Dashes)
{ from = 0x2010, to = 0x2015 },
-- 2000-206f General Punctuation (Limited to Quotes)
{ from = 0x2018, to = 0x201F },
-- 20a0-20cf Currency Symbols (Limited to Euro symbol)
{ from = 0x20ac, to = 0x20ac },
},
},
}
}

View File

@@ -31,20 +31,14 @@ fi
# check imagemagick
hash convert &>/dev/null
if [ $? -eq 1 ]; then
echo -e "Error: This program requires convert from ImageMagick!"
abort=1
fi
hash montage &>/dev/null
if [ $? -eq 1 ]; then
echo -e "Error: This program requires montage from ImageMagick!"
echo -e "Error: This program requires convert from ImageMagick! Please install it by typing 'sudo apt-get install imagemagick' in terminal."
abort=1
fi
# check ttx
hash ttx &>/dev/null
if [ $? -eq 1 ]; then
echo -e "Error: This program requires ttx from FontTools!"
echo -e "Error: This program requires ttx from FontTools! Please install it by typing 'sudo apt-get install fonttools' in terminal."
abort=1
fi

View File

@@ -1,5 +0,0 @@
The FontStruction “Metro Sans”
(https://fontstruct.com/fontstructions/show/723864) by Christian Munk is
licensed under a Creative Commons Attribution Share Alike license
(http://creativecommons.org/licenses/by-sa/3.0/).
[ancestry]

View File

@@ -1,16 +0,0 @@
The font file in this archive was created using Fontstruct the free, online
font-building tool.
This font was created by Christian Munk.
This font has a homepage where this archive and other versions may be found:
https://fontstruct.com/fontstructions/show/723864
[ancestry]
Try Fontstruct at https://fontstruct.com
Its easy and its fun.
Fontstruct is copyright ©2012-2025 Rob Meek
LEGAL NOTICE:
In using this font you must comply with the licensing terms described in the
file “license.txt” included with this archive.
If you redistribute the font file in this archive, it must be accompanied by all
the other files from this archive, including this one.

View File

@@ -18,9 +18,13 @@
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
--]]
-- Entity for time display
-- Entity for time display of most of clocks
display_api.register_display_entity("ontime_clocks:display")
-- Entities for two needles of large clocks
display_api.register_display_entity("ontime_clocks:hours_needle")
display_api.register_display_entity("ontime_clocks:minutes_needle")
function ontime_clocks.get_h24()
return math.floor(minetest.get_timeofday()*24)%24
end
@@ -58,4 +62,3 @@ function ontime_clocks.get_needles_properties(color, size, hour, minute)
visual_size = {x=size/64, y=size/64}
}
end

View File

@@ -56,6 +56,24 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'ontime_clocks:3x3_clock_black',
recipe = {
{mat.steel_ingot, mat.dye_black, mat.steel_ingot},
{'', 'ontime_clocks:frameless_black', ''},
{'', '', ''},
}
})
minetest.register_craft({
output = 'ontime_clocks:5x5_clock_black',
recipe = {
{mat.steel_ingot, mat.dye_black, mat.steel_ingot},
{'', 'ontime_clocks:3x3_clock_black', ''},
{'', '', ''},
}
})
minetest.register_craft({
output = 'ontime_clocks:frameless_gold',
recipe = {
@@ -65,6 +83,24 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'ontime_clocks:3x3_clock_gold',
recipe = {
{mat.gold_ingot, '', mat.gold_ingot},
{'', 'ontime_clocks:frameless_gold', ''},
{'', '', ''},
}
})
minetest.register_craft({
output = 'ontime_clocks:5x5_clock_gold',
recipe = {
{mat.gold_ingot, '', mat.gold_ingot},
{'', 'ontime_clocks:3x3_clock_gold', ''},
{'', '', ''},
}
})
minetest.register_craft({
output = 'ontime_clocks:frameless_white',
recipe = {
@@ -74,4 +110,21 @@ minetest.register_craft({
}
})
minetest.register_craft({
output = 'ontime_clocks:3x3_clock_white',
recipe = {
{mat.steel_ingot, mat.dye_white, mat.steel_ingot},
{'', 'ontime_clocks:frameless_white', ''},
{'', '', ''},
}
})
minetest.register_craft({
output = 'ontime_clocks:5x5_clock_white',
recipe = {
{mat.steel_ingot, mat.dye_white, mat.steel_ingot},
{'', 'ontime_clocks:3x3_clock_white', ''},
{'', '', ''},
}
})

View File

@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="32"
height="32"
viewBox="0 0 8.4666665 8.4666666"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="ontime_clocks_large_clock_inventory.svg"
inkscape:export-filename="../textures/ontime_clocks_5x5_clock_inventory.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:cc="http://creativecommons.org/ns#">
<sodipodi:namedview
id="namedview7"
pagecolor="#cccccc"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="true"
inkscape:zoom="7.6898428"
inkscape:cx="66.061168"
inkscape:cy="-37.321959"
inkscape:window-width="2514"
inkscape:window-height="1371"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
shape-rendering="crispEdges">
<inkscape:grid
type="xygrid"
id="grid132"
empspacing="8"
empcolor="#9f00e5"
empopacity="0.30196078"
originx="0"
originy="0" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="clock"
style="display:inline">
<path
id="rect2410-3-1-2-3-9-4-7-8-6"
style="display:inline;opacity:1;fill:#ffffff;fill-rule:evenodd;stroke-width:0.0273861;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.5;stop-color:#000000"
d="M 3.96875,1.5875 H 4.2333333 V 1.8520833 H 3.96875 Z M 3.7041667,1.8520833 H 4.2333333 V 2.1166666 H 3.7041667 Z M 3.4395833,2.1166666 H 3.9687499 V 2.3812499 H 3.4395833 Z M 3.175,2.3812499 H 3.7041666 V 2.6458332 H 3.175 Z M 2.9104166,2.6458333 H 3.4395832 V 2.9104166 H 2.9104166 Z M 2.6458333,2.9104166 H 3.1749999 V 3.1749999 H 2.6458333 Z M 2.2489583,3.7041667 H 2.5135417 V 3.96875 H 2.2489583 Z M 1.984375,3.4395833 H 2.6458334 V 3.7041666 H 1.984375 Z M 1.7197917,3.175 H 2.9104166 V 3.4395833 H 1.7197917 Z M 1.4552083,2.9104166 H 2.38125 V 3.1749999 H 1.4552083 Z M 1.190625,2.6458333 H 2.1166667 V 2.9104166 H 1.190625 Z M 0.9260416,2.3812499 H 1.8520833 V 2.6458332 H 0.9260416 Z M 0.79374999,2.1166666 H 1.5875 V 2.3812499 H 0.79374999 Z M 0.92604166,1.5875 H 1.0583333 V 1.8520833 H 0.92604166 Z M 0.79374999,1.8520833 H 1.3229166 V 2.1166666 H 0.79374999 Z"
inkscape:label="clock"
transform="matrix(2,0,0,1,-0.52916664,0.52916667)" />
</g>
<g
inkscape:groupmode="layer"
id="layer1"
inkscape:label="5x5"
style="display:none;fill:#ffffff">
<path
id="rect1383"
style="display:inline;fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke-width:0.0499999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.5;stop-color:#000000"
d="m 1.0583333,6.0854167 v 0.79375 h 0.2645834 0.79375 V 6.6145833 h -0.79375 V 6.35 h 0.79375 V 6.0854167 h -0.79375 z m 1.0583334,0.79375 V 7.14375 H 2.38125 V 6.8791667 Z m 0,0.2645833 H 1.0583333 v 0.2645833 h 1.0583334 z m 1.5875,-1.0583333 v 0.79375 H 3.96875 4.7625 V 6.6145833 H 3.96875 V 6.35 H 4.7625 V 6.0854167 H 3.96875 Z M 4.7625,6.8791667 V 7.14375 H 5.0270833 V 6.8791667 Z m 0,0.2645833 H 3.7041667 V 7.4083333 H 4.7625 Z M 2.6458333,6.6145833 V 6.8791667 H 2.9104167 V 6.6145833 Z M 2.9104167,6.8791667 V 7.14375 H 3.175 V 6.8791667 Z m 0.2645833,0 H 3.4395833 V 6.6145833 H 3.175 Z m 0,0.2645833 V 7.4083333 H 3.4395833 V 7.14375 Z m -0.2645833,0 H 2.6458333 v 0.2645833 h 0.2645834 z"
inkscape:label="5x5" />
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="3x3"
style="display:none">
<path
id="rect1383-3"
style="display:inline;fill:#808080;fill-opacity:1;fill-rule:evenodd;stroke-width:0.0499999;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:0.5;stop-color:#000000"
d="M 1.0583333,6.0854167 V 6.35 H 2.1166667 V 6.0854167 Z M 2.1166667,6.35 V 6.6145833 H 2.38125 V 6.35 Z m 0,0.2645833 H 1.3229166 v 0.2645834 h 0.7937501 z m 0,0.2645834 V 7.14375 H 2.38125 V 6.8791667 Z m 0,0.2645833 H 1.0583333 v 0.2645833 h 1.0583334 z m 1.5875,-1.0583333 V 6.35 H 4.7624999 V 6.0854167 Z M 4.7624999,6.35 V 6.6145833 H 5.0270833 V 6.35 Z m 0,0.2645833 H 3.96875 v 0.2645834 h 0.7937499 z m 0,0.2645834 V 7.14375 H 5.0270833 V 6.8791667 Z m 0,0.2645833 H 3.7041667 V 7.4083333 H 4.7624999 Z M 2.6458334,6.6145833 V 6.8791667 H 2.9104167 V 6.6145833 Z M 2.9104167,6.8791667 V 7.14375 H 3.175 V 6.8791667 Z m 0.2645833,0 H 3.4395834 V 6.6145833 H 3.175 Z m 0,0.2645833 V 7.4083333 H 3.4395834 V 7.14375 Z m -0.2645833,0 H 2.6458334 v 0.2645833 h 0.2645833 z"
inkscape:label="3x3" />
</g>
<metadata
id="metadata209">
<rdf:RDF>
<cc:Work
rdf:about="">
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
</svg>

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@@ -0,0 +1,304 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="35.98333mm"
height="21.166664mm"
viewBox="0 0 35.98333 21.166664"
version="1.1"
id="svg5"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="ontime_clocks_large_clock_parts.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="mm"
showgrid="true"
inkscape:zoom="2.71877"
inkscape:cx="51.309968"
inkscape:cy="44.321513"
inkscape:window-width="1720"
inkscape:window-height="1282"
inkscape:window-x="26"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="layer4">
<inkscape:grid
type="xygrid"
id="grid132"
empspacing="8"
empcolor="#9f00e5"
empopacity="0.30196078"
originx="-23.283334"
originy="-12.699997" />
</sodipodi:namedview>
<defs
id="defs2" />
<g
inkscape:label="Guides"
inkscape:groupmode="layer"
id="layer1"
style="display:none"
transform="translate(-23.283334,-12.699999)">
<g
id="g5227"
style="display:inline"
inkscape:label="center 3x3"
inkscape:export-filename="../textures/ontime_clocks_3x3_center.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="display:inline;fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.433012;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect236-23"
width="2.1166666"
height="6.3500009"
x="31.75"
y="16.933332"
inkscape:label="Size"
transform="matrix(2.0000002,0,0,0.66666676,-40.216672,9.8777758)" />
<path
style="display:inline;fill:#ff0000;stroke:#ff0000;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 23.283334,23.283333 h 4.233333"
id="path1869-2" />
<path
style="display:inline;fill:#ff0000;stroke:#ff0000;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 25.4,21.166667 V 25.4"
id="path1869-2-2" />
</g>
<g
id="g792"
style="display:inline"
inkscape:label="center 5x5"
transform="translate(6.3500021)"
inkscape:export-filename="../textures/ontime_clocks_5x5_center.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="display:inline;fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.433012;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect786"
width="2.1166666"
height="6.3500009"
x="31.75"
y="16.933332"
inkscape:label="Size"
transform="matrix(2.0000002,0,0,0.66666676,-40.216672,9.8777758)" />
<path
style="display:inline;fill:#ff0000;stroke:#ff0000;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 23.283334,23.283333 h 4.233333"
id="path788" />
<path
style="display:inline;fill:#ff0000;stroke:#ff0000;stroke-width:0.05;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 25.4,21.166667 V 25.4"
id="path790" />
</g>
<g
id="g1880"
inkscape:label="minutes 3x3"
transform="matrix(2.0000002,0,0,2.333333,-27.516673,-23.636104)"
style="stroke-width:0.46291"
inkscape:export-filename="../textures/ontime_clocks_3x3_needle_minutes.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.231455;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect236"
width="2.1166666"
height="6.3500009"
x="31.75"
y="16.933332"
inkscape:label="Size" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.0231455;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 31.75,20.108333 h 2.116666"
id="path1869" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.0231455;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 32.808333,16.933333 v 6.35"
id="path1871" />
</g>
<g
id="g1885"
inkscape:label="minutes 5x5"
transform="matrix(1.9999998,0,0,1.9999995,-29.633327,-16.933326)"
style="stroke-width:0.5"
inkscape:export-filename="../textures/ontime_clocks_5x5_needle_minutes.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.250001;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect236-3"
width="2.1166663"
height="10.583334"
x="35.983334"
y="14.816667"
inkscape:label="Size" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.025;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 37.041666,25.4 V 14.816666"
id="path1873" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.025;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 35.983333,20.108333 H 38.1"
id="path1875" />
</g>
<g
id="g1880-6"
inkscape:label="hours 3x3"
transform="matrix(2.0000002,0,0,2.333333,-14.816673,-23.636104)"
style="display:inline;stroke-width:0.46291"
inkscape:export-filename="../textures/ontime_clocks_3x3_needle_hours.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.231455;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect236-2"
width="2.1166666"
height="6.3500009"
x="31.75"
y="16.933332"
inkscape:label="Size" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.0231455;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 31.75,20.108333 h 2.116666"
id="path1869-6" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.0231455;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="m 32.808333,16.933333 v 6.35"
id="path1871-1" />
</g>
<g
id="g1885-8"
inkscape:label="hours 5x5"
transform="matrix(1.9999998,0,0,1.9999995,-16.933327,-16.933326)"
style="display:inline;stroke-width:0.5"
inkscape:export-filename="../textures/ontime_clocks_5x5_needle_hours.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<rect
style="fill:#ff0000;fill-opacity:0.2;fill-rule:evenodd;stroke:none;stroke-width:0.250001;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stop-color:#000000"
id="rect236-3-7"
width="2.1166663"
height="10.583334"
x="35.983334"
y="14.816667"
inkscape:label="Size" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.025;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 37.041666,25.4 V 14.816666"
id="path1873-9" />
<path
style="fill:#ff0000;stroke:#ff0000;stroke-width:0.025;stroke-linecap:butt;stroke-linejoin:miter;stroke-dasharray:none;stroke-opacity:0.5"
d="M 35.983333,20.108333 H 38.1"
id="path1875-2" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer4"
inkscape:label="Centers"
style="display:inline"
transform="translate(-23.283334,-12.699999)">
<g
id="g4762-3-3-8"
transform="matrix(1.4999983,0,0,0.17647065,-31.749933,19.874876)"
style="display:inline;stroke-width:1.94365">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.0971825;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943-5-6-9"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
<g
id="g4762-3-3-8-3"
transform="matrix(1.9999979,0,0,0.23529412,-44.449917,18.738726)"
style="display:inline;stroke-width:1.45774">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.0728869;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943-5-6-9-6"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer2"
inkscape:label="Minutes"
style="display:inline"
transform="translate(-23.283334,-12.699999)">
<g
id="g4762-7"
transform="matrix(0.9999994,0,0,1.2352942,6.350025,-5.6029436)"
style="stroke-width:0.899737">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.0449866;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943-0"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
<g
id="g4762-3-3"
transform="matrix(0.50000006,0,0,0.85294118,19.049999,3.2372533)"
style="stroke-width:1.53128">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.076564;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943-5-6"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
</g>
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="Hours"
style="display:inline"
transform="translate(-23.283334,-12.699999)">
<g
id="g4762"
transform="matrix(1.4999979,0,0,1,8.3634505e-5,3.2499997e-8)"
style="stroke-width:0.816497">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.0408248;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
<g
id="g4762-3"
transform="matrix(1,0,0,0.76470588,12.700002,5.6029412)"
style="stroke-width:1.14354">
<rect
style="fill:#333333;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:0.0571771;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:none;stroke-opacity:0.5;stop-color:#000000"
id="rect1943-5"
width="1.0583333"
height="8.9958334"
x="37.570831"
y="14.816667"
ry="0" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -2,6 +2,15 @@
Green digital clock=Grüne Digitaluhr
Red digital clock=Rote Digitaluhr
White clock=Weiße Uhr
@1 frameless @2 clock=@1 rahmenlose @2 Uhr
gold=goldene
black=schwarze
white=weiße
Frameless @1 clock=Rahmenlosse @1 Uhr
##### not used anymore #####
Frameless clock=Rahmenlose Uhr
Frameless gold clock=Rahmenlose goldene Uhr
Frameless white clock=Rahmenlose weiße Uhr

View File

@@ -2,6 +2,8 @@
Green digital clock=Horloge numérique verte
Red digital clock=Horloge numérique rouge
White clock=Horloge blanche
Frameless clock=Horloge sans cadre
Frameless gold clock=Horloge dorée sans cadre
Frameless white clock=Horloge blanche sans cadre
@1 frameless @2 clock=Horloge @2 sans cadre @1
gold=dorée
black=noire
white=blanche
Frameless @1 clock=Horloge @1 sans cadre

View File

@@ -2,6 +2,15 @@
Green digital clock=Jam digital hijau
Red digital clock=Jam digital merah
White clock=Jam putih
@1 frameless @2 clock=
gold=
black=
white=
Frameless @1 clock=
##### not used anymore #####
Frameless clock=Jam tanpa bingkai
Frameless gold clock=Jam emas tanpa bingkai
Frameless white clock=Jam putih tanpa bingkai

View File

@@ -2,6 +2,8 @@
Green digital clock=
Red digital clock=
White clock=
Frameless clock=
Frameless gold clock=
Frameless white clock=
@1 frameless @2 clock=
gold=
black=
white=
Frameless @1 clock=

View File

@@ -31,8 +31,31 @@ local function clock_on_timer(pos)
return true
end
minetest.register_lbm({
name = "ontime_clocks:nodetimer_init",
nodenames = {"group:ontime_clocks_tick"},
run_at_every_load = false,
action = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(5)
end
})
local function register_clock(name, def)
def.on_place = display_api.on_place
def.on_construct = clock_on_construct
def.on_destruct = display_api.on_destruct
def.on_blast = display_api.on_blast
def.on_rotate = display_api.on_rotate
def.on_timer = clock_on_timer
def.groups.ontime_clocks_tick = 1
def.groups.display_api = 1
minetest.register_node(name, def)
end
-- Green digital clock
minetest.register_node("ontime_clocks:green_digital", {
register_clock("ontime_clocks:green_digital", {
description = S("Green digital clock"),
inventory_image = "ontime_clocks_green_digital_inventory.png",
wield_image = "ontime_clocks_green_digital_inventory.png",
@@ -46,7 +69,7 @@ minetest.register_node("ontime_clocks:green_digital", {
wall_top = {-7/16, 0.5, -7/32, 7/16, 13/32, 3/16}
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
@@ -59,17 +82,11 @@ minetest.register_node("ontime_clocks:green_digital", {
"#040", "#0F0", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
-- Red digital clock
minetest.register_node("ontime_clocks:red_digital", {
register_clock("ontime_clocks:red_digital", {
description = S("Red digital clock"),
inventory_image = "ontime_clocks_red_digital_inventory.png",
wield_image = "ontime_clocks_red_digital_inventory.png",
@@ -83,7 +100,7 @@ minetest.register_node("ontime_clocks:red_digital", {
wall_top = {-7/16, 0.5, -7/32, 7/16, 13/32, 3/16}
},
tiles = {"ontime_clocks_digital.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
@@ -96,16 +113,10 @@ minetest.register_node("ontime_clocks:red_digital", {
"#400", "#F00", ontime_clocks.get_h24(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_node("ontime_clocks:white", {
register_clock("ontime_clocks:white", {
description = S("White clock"),
inventory_image = "ontime_clocks_white_inventory.png",
wield_image = "ontime_clocks_white_inventory.png",
@@ -119,7 +130,7 @@ minetest.register_node("ontime_clocks:white", {
wall_top = { -7/16, 0.5, -7/16, 7/16, 7/16, 7/16},
},
tiles = {"ontime_clocks_white.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
@@ -132,133 +143,105 @@ minetest.register_node("ontime_clocks:white", {
"#000", 36, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
local function register_large_clock(name, label, color, size)
local sstr = size .. "x" .. size -- Size string
register_clock("ontime_clocks:" .. sstr .. "_clock_" .. name, {
description = S("@1 frameless @2 clock", sstr, label),
inventory_image = "ontime_clocks_large_clock_inventory.png^[colorize:" ..
color .. "^ontime_clocks_" .. sstr .. "_clock_inventory.png",
wield_image = "ontime_clocks_large_clock_inventory.png^[colorize:" .. color,
paramtype = "light",
paramtype2 = "wallmounted",
drawtype = "nodebox",
use_texture_alpha = "clip",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -7/16, -7/16, -15/32, 7/16, 7/16 },
wall_bottom = { -7/16, -0.5, -7/16, 7/16, -15/32, 7/16 },
wall_top = { -7/16, 0.5, -7/16, 7/16, 15/32, 7/16 }
},
tiles = {"ontime_clocks_" .. sstr .. "_center.png^[colorize:" .. color},
groups = {oddly_breakable_by_hand = 1, not_blocking_trains = 1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
display_entities = {
["ontime_clocks:hours_needle"] = {
depth = 14/32,
on_display_update = function(pos, objref)
objref:set_properties({
textures={"ontime_clocks_" .. sstr .. "_needle_hours.png^[colorize:" .. color},
visual_size = {x=1, y=size},
})
objref:get_luaentity()["rotation"] = {
z = math.floor(minetest.get_timeofday() * 24) / 6 * math.pi
}
end
},
["ontime_clocks:minutes_needle"] = {
depth = 13/32,
on_display_update = function(pos, objref)
objref:set_properties({
textures={"ontime_clocks_" .. sstr .. "_needle_minutes.png^[colorize:" .. color},
visual_size = {x=1, y=size},
})
objref:get_luaentity()["rotation"] = {
z = math.floor(minetest.get_timeofday() * 288) / 6 * math.pi
}
end
},
},
})
end
minetest.register_node("ontime_clocks:frameless_black", {
description = S("Frameless clock"),
inventory_image = "ontime_clocks_frameless_inventory.png",
wield_image = "ontime_clocks_frameless_inventory.png",
paramtype = "light",
paramtype2 = "wallmounted",
drawtype = "nodebox",
use_texture_alpha = "clip",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
on_display_update = function(pos, objref)
objref:set_properties(
ontime_clocks.get_needles_properties(
"#000", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
local models = {
{ name = "gold", label = S("gold"), color = "#FF0" },
{ name = "black", label = S("black"), color = "#000" },
{ name = "white", label = S("white"), color = "#FFF" },
}
for _, model in ipairs(models) do
-- Frameless clock
register_clock("ontime_clocks:frameless_" .. model.name, {
description = S("Frameless @1 clock", model.label),
inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:" .. model.color,
wield_image = "ontime_clocks_frameless_inventory.png^[colorize:" .. model.color,
paramtype = "light",
paramtype2 = "wallmounted",
drawtype = "nodebox",
use_texture_alpha = "clip",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png^[colorize:" .. model.color},
groups = { oddly_breakable_by_hand=1, not_blocking_trains=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
on_display_update = function(pos, objref)
objref:set_properties(
ontime_clocks.get_needles_properties(
model.color, 48,
ontime_clocks.get_h12(),
ontime_clocks.get_m12()
)
)
end },
},
})
minetest.register_node("ontime_clocks:frameless_gold", {
description = S("Frameless gold clock"),
inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FF0",
paramtype = "light",
paramtype2 = "wallmounted",
drawtype = "nodebox",
use_texture_alpha = "clip",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FF0"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
on_display_update = function(pos, objref)
objref:set_properties(
ontime_clocks.get_needles_properties(
"#FF0", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
-- 3x3 large clock
register_large_clock(model.name, model.label, model.color, 3)
-- 5x5 large clock
register_large_clock(model.name, model.label, model.color, 5)
end
minetest.register_node("ontime_clocks:frameless_white", {
description = S("Frameless white clock"),
inventory_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
wield_image = "ontime_clocks_frameless_inventory.png^[colorize:#FFF",
paramtype = "light",
paramtype2 = "wallmounted",
drawtype = "nodebox",
use_texture_alpha = "clip",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -7/16, -7/16, -0.45, 7/16, 7/16 },
wall_bottom = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 },
wall_top = { -0.5, -0.5, -0.5, 0.5, 0.5, 0.5 }
},
tiles = {"ontime_clocks_frameless.png^[colorize:#FFF"},
groups = {oddly_breakable_by_hand=1, not_blocking_trains=1, display_api=1, handy = 1},
_mcl_hardness = 0.8,
_mcl_blast_resistance = 1,
is_ground_content = false,
display_entities = {
["ontime_clocks:display"] = {
depth = 7/16,
on_display_update = function(pos, objref)
objref:set_properties(
ontime_clocks.get_needles_properties(
"#FFF", 48, ontime_clocks.get_h12(), ontime_clocks.get_m12()))
end },
},
on_place = display_api.on_place,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_blast = display_api.on_blast,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_lbm({
name = "ontime_clocks:nodetimer_init",
nodenames = {"ontime_clocks:green_digital", "ontime_clocks:red_digital", "ontime_clocks:white",
"ontime_clocks:frameless_black", "ontime_clocks:frameless_gold", "ontime_clocks:frameless_white"},
run_at_every_load = false,
action = function(pos)
local timer = minetest.get_node_timer(pos)
timer:start(5)
end
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

View File

@@ -42,7 +42,7 @@ local function display_poster(pos, node, player)
image[0,-0.2;8.4,2;%s]
style_type[textarea;textcolor=#111]
textarea[0.3,1.5;7,8;;%s;]]=],
titletexture:gsub("[\\^]", "\\%0"),
titletexture,
minetest.formspec_escape(meta:get_string("text")))
if minetest.is_protected(pos, player:get_player_name()) then