1
0
mirror of https://github.com/pyrollo/display_modpack.git synced 2025-10-16 00:55:36 +02:00

Add luacheck, update translations, replace ABMs, bug fixes (#1)

* luacheck, mt 5 translation, german translation, maintenance

* fix luacheck warnings

* Fix digital clock nodebox and texture

* Fix luacheck usage

* Add comment why fonts are not split into several lines
This commit is contained in:
Niklp
2023-07-24 09:59:26 +02:00
committed by GitHub
parent e0e0305836
commit 1440f35fa6
91 changed files with 415 additions and 1465 deletions

View File

@@ -18,7 +18,18 @@
along with ontime_clocks. If not, see <http://www.gnu.org/licenses/>.
--]]
local S = ontime_clocks.intllib
local S = ontime_clocks.S
local function clock_on_construct(pos)
local timer = minetest.get_node_timer(pos)
timer:start(5)
display_api.on_construct(pos)
end
local function clock_on_timer(pos)
display_api.update_entities(pos)
return true
end
-- Green digital clock
minetest.register_node("ontime_clocks:green_digital", {
@@ -30,9 +41,9 @@ minetest.register_node("ontime_clocks:green_digital", {
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 7/16 },
wall_top = { -7/16, 0.5, -7/32, 7/16, 13/32, 3/16 },
wall_bottom = { -7/16, -0.5, -3/16, 7/16, -13/32, 7/32 },
wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16},
wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32},
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},
@@ -46,17 +57,12 @@ minetest.register_node("ontime_clocks:green_digital", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:green_digital"},
interval = 5,
chance = 1,
action = display_api.update_entities,
})
-- Red digital clock
minetest.register_node("ontime_clocks:red_digital", {
@@ -68,9 +74,9 @@ minetest.register_node("ontime_clocks:red_digital", {
drawtype = "nodebox",
node_box = {
type = "wallmounted",
wall_side = { -0.5, -3/16, -7/16, -13/32, 7/32, 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 }
wall_side = {-0.5, -3/16, -7/16, -13/32, 7/32, 7/16},
wall_bottom = {-7/16, -0.5, -3/16, 7/16, -13/32, 7/32},
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},
@@ -84,16 +90,10 @@ minetest.register_node("ontime_clocks:red_digital", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
})
minetest.register_abm({
nodenames = {"ontime_clocks:red_digital"},
interval = 5,
chance = 1,
action = display_api.update_entities,
on_timer = clock_on_timer,
})
@@ -122,17 +122,12 @@ minetest.register_node("ontime_clocks:white", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:white"},
interval = 5,
chance = 1,
action = display_api.update_entities,
})
minetest.register_node("ontime_clocks:frameless_black", {
description = S("Frameless clock"),
@@ -159,17 +154,12 @@ minetest.register_node("ontime_clocks:frameless_black", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:frameless_black"},
interval = 5,
chance = 1,
action = display_api.update_entities,
})
minetest.register_node("ontime_clocks:frameless_gold", {
description = S("Frameless gold clock"),
@@ -196,17 +186,12 @@ minetest.register_node("ontime_clocks:frameless_gold", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:frameless_gold"},
interval = 5,
chance = 1,
action = display_api.update_entities,
})
minetest.register_node("ontime_clocks:frameless_white", {
description = S("Frameless white clock"),
@@ -233,14 +218,20 @@ minetest.register_node("ontime_clocks:frameless_white", {
end },
},
on_place = display_api.on_place,
on_construct = display_api.on_construct,
on_construct = clock_on_construct,
on_destruct = display_api.on_destruct,
on_rotate = display_api.on_rotate,
on_timer = clock_on_timer,
})
minetest.register_abm({
nodenames = {"ontime_clocks:frameless_white"},
interval = 5,
chance = 1,
action = display_api.update_entities,
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
})