Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 5 commits into from
Jul 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/luacheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: luacheck
on: [push, pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: ""
19 changes: 19 additions & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
unused_args = false

read_globals = {
"minetest",
"table",
"vector",
"default"
}

globals = {
"boards",
"display_api",
"font_api",
"ontime_clocks",
"signs",
"signs_api",
"signs_road",
"steles"
}
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Display Modpack
Version 1.3.1

This modpack provides mods with dynamic display. Mods are :
Requires Minetest 5.0+

This modpack provides mods with dynamic display. Mods are:

- **[display_api](https://github.com/pyrollo/display_modpack/tree/master/display_api)**: A library for adding display entities to nodes;
- **[font_api](https://github.com/pyrollo/display_modpack/tree/master/font_api)**: A library for displaying fonts on entities;
Expand Down
6 changes: 4 additions & 2 deletions boards/font_tinycurs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,21 @@
released under CC-BY-SA license

https://fontstruct.com/fontstructions/show/63155/tiny_cursive

Derivative texture are under CC-BY-SA license
Code is under LGPL v3 license
--]]

-- widths is not split into several lines, because the font is generated by 'make_font_lua.sh'
-- luacheck: ignore
font_api.register_font('tinycurs',
{
default = false, -- Don't register this font as a possible default font
margintop = -2,
marginbottom = -2,
linespacing = -4,
height = 19,
widths = {
widths = {
[0]=9, [32]=9, [33]=6, [34]=7, [35]=10, [36]=14, [37]=14, [38]=12, [39]=3, [40]=6, [41]=6, [42]=9, [43]=8, [44]=3, [45]=7, [46]=3, [47]=9, [48]=9, [49]=7, [50]=10, [51]=9, [52]=9, [53]=10, [54]=10, [55]=9, [56]=10, [57]=8, [58]=5, [59]=5, [60]=8, [61]=8, [62]=8, [63]=8, [64]=12, [65]=9, [66]=7, [67]=9, [68]=10, [69]=8, [70]=8, [71]=8, [72]=10, [73]=7, [74]=8, [75]=9, [76]=9, [77]=12, [78]=10, [79]=9, [80]=9, [81]=9, [82]=11, [83]=11, [84]=8, [85]=11, [86]=11, [87]=12, [88]=12, [89]=11, [90]=11, [91]=8, [92]=5, [93]=8, [94]=8, [95]=8, [96]=5, [97]=6, [98]=6, [99]=6, [100]=7, [101]=6, [102]=5, [103]=6, [104]=6, [105]=4, [106]=5, [107]=7, [108]=5, [109]=9, [110]=8, [111]=6, [112]=9, [113]=8, [114]=7, [115]=7, [116]=6, [117]=8, [118]=8, [119]=11, [120]=10, [121]=8, [122]=8, [123]=8, [124]=6, [125]=9, [126]=10, [8216]=4, [8217]=4, [8220]=6, [8221]=6
},
}
Expand Down
29 changes: 19 additions & 10 deletions boards/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ boards = {}
boards.name = minetest.get_current_modname()
boards.path = minetest.get_modpath(boards.name)

-- Load support for intllib.
local S, NS = dofile(boards.path.."/intllib.lua")
boards.intllib = S
local F = function(...) return minetest.formspec_escape(S(...)) end
-- Translation support
local S = minetest.get_translator(boards.name)
local FS = function(...) return minetest.formspec_escape(S(...)) end

-- Load font
dofile(boards.path.."/font_tinycurs.lua")
Expand All @@ -34,9 +33,9 @@ local function set_formspec(pos)
local meta = minetest.get_meta(pos)
meta:set_string("formspec",
"size[6,4]"..default.gui_bg..default.gui_bg_img..default.gui_slots..
"textarea[0.5,0.7;5.5,3;display_text;"..F("Text")..";${display_text}]"..
"button_exit[3,3.5;2,1;ok;"..F("Write").."]"..
"button_exit[1,3.5;2,1;wipe;"..F("Wipe").."]")
"textarea[0.5,0.7;5.5,3;display_text;"..FS("Text")..";${display_text}]"..
"button_exit[3,3.5;2,1;ok;"..FS("Write").."]"..
"button_exit[1,3.5;2,1;wipe;"..FS("Wipe").."]")
end

-- On boards, everyone is allowed to write and wipe
Expand All @@ -51,7 +50,7 @@ local function on_receive_fields(pos, formname, fields, player)
end
end

models = {
local models = {
black_board = {
depth = 1/16, width = 1, height = 1,
entity_fields = {
Expand All @@ -67,6 +66,7 @@ models = {
tiles = { "default_wood.png", "default_wood.png",
"default_wood.png", "default_wood.png",
"default_wood.png", "board_black_front.png" },
_itemframe_texture = "board_black_front.png",
drawtype = "nodebox",
node_box = {
type = "fixed",
Expand All @@ -79,6 +79,10 @@ models = {
set_formspec(pos)
display_api.on_construct(pos)
end,
on_punch = function(pos)
set_formspec(pos)
display_api.update_entities(pos)
end,
on_receive_fields = on_receive_fields,
},
},
Expand All @@ -98,6 +102,7 @@ models = {
"default_wood.png", "default_wood.png",
"default_wood.png", "board_green_front.png" },
drawtype = "nodebox",
_itemframe_texture = "board_green_front.png",
node_box = {
type = "fixed",
fixed = {
Expand All @@ -109,6 +114,10 @@ models = {
set_formspec(pos)
display_api.on_construct(pos)
end,
on_punch = function(pos)
set_formspec(pos)
display_api.update_entities(pos)
end,
on_receive_fields = on_receive_fields,
},
},
Expand All @@ -126,14 +135,14 @@ minetest.register_craft(
output = "boards:black_board",
recipe = {
{"group:wood", "group:stone", "dye:black"},
}
}
})

minetest.register_craft(
{
output = "boards:green_board",
recipe = {
{"group:wood", "group:stone", "dye:dark_green"},
}
}
})

45 changes: 0 additions & 45 deletions boards/intllib.lua

This file was deleted.

6 changes: 6 additions & 0 deletions boards/locale/boards.de.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Schwarze Tafel
Green board=Grüne Tafel
Text=Text
Write=Schreiben
Wipe=Abwischen
6 changes: 6 additions & 0 deletions boards/locale/boards.fr.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Tableau noir
Green board=Tableau vert
Text=
Write=
Wipe=
6 changes: 6 additions & 0 deletions boards/locale/boards.ms.tr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# textdomain: boards
Black board=Papan hitam
Green board=
Text=
Write=
Wipe=
40 changes: 0 additions & 40 deletions boards/locale/fr.po

This file was deleted.

35 changes: 0 additions & 35 deletions boards/locale/ms.po

This file was deleted.

34 changes: 0 additions & 34 deletions boards/locale/template.pot

This file was deleted.

6 changes: 6 additions & 0 deletions boards/locale/template.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# textdomain: boards
Black board=
Green board=
Text=
Write=
Wipe=
25 changes: 0 additions & 25 deletions boards/tools/updatepo.sh

This file was deleted.

8 changes: 4 additions & 4 deletions display_api/deprecation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@

-- Deprecation

function deprecated_group(deprecated_group, replacement_group)
local function deprecated_group(old_group, replacement_group)
for name, ndef in pairs(minetest.registered_nodes) do
if ndef.groups and ndef.groups[deprecated_group] then
if ndef.groups and ndef.groups[old_group] then
minetest.log("warning", string.format(
'Node %s belongs to deprecated "%s" group which should be replaced with new "%s" group.',
name, deprecated_group, replacement_group))
name, old_group, replacement_group))
end
end
end

function deprecated_global_table(deprecated_global_name, replacement_global_name)
local function deprecated_global_table(deprecated_global_name, replacement_global_name)
assert(type(deprecated_global_name) == 'string', "deprecated_global_name should be a string.")
assert(type(replacement_global_name) == 'string', "replacement_global_name should be a string.")
assert(deprecated_global_name ~= '', "deprecated_global_name should not be empty.")
Expand Down
Loading