Compare commits
10 Commits
4767519f27
...
efd85fdc6e
Author | SHA1 | Date | |
---|---|---|---|
|
efd85fdc6e | ||
|
e8274a45f0 | ||
|
77269b864d | ||
|
184b290634 | ||
|
02951241de | ||
|
8d0a9bc42a | ||
|
902ed93831 | ||
|
d02b2d8d74 | ||
|
32c8a02f5a | ||
|
36c899364b |
10
.github/workflows/luacheck.yml
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
name: luacheck
|
||||||
|
on: [push, pull_request]
|
||||||
|
jobs:
|
||||||
|
luacheck:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@master
|
||||||
|
- name: Luacheck
|
||||||
|
uses: lunarmodules/luacheck@master
|
41
.gitignore
vendored
@ -1,41 +0,0 @@
|
|||||||
# Compiled Lua sources
|
|
||||||
luac.out
|
|
||||||
|
|
||||||
# luarocks build files
|
|
||||||
*.src.rock
|
|
||||||
*.zip
|
|
||||||
*.tar.gz
|
|
||||||
|
|
||||||
# Object files
|
|
||||||
*.o
|
|
||||||
*.os
|
|
||||||
*.ko
|
|
||||||
*.obj
|
|
||||||
*.elf
|
|
||||||
|
|
||||||
# Precompiled Headers
|
|
||||||
*.gch
|
|
||||||
*.pch
|
|
||||||
|
|
||||||
# Libraries
|
|
||||||
*.lib
|
|
||||||
*.a
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
*.def
|
|
||||||
*.exp
|
|
||||||
|
|
||||||
# Shared objects (inc. Windows DLLs)
|
|
||||||
*.dll
|
|
||||||
*.so
|
|
||||||
*.so.*
|
|
||||||
*.dylib
|
|
||||||
|
|
||||||
# Executables
|
|
||||||
*.exe
|
|
||||||
*.out
|
|
||||||
*.app
|
|
||||||
*.i*86
|
|
||||||
*.x86_64
|
|
||||||
*.hex
|
|
||||||
|
|
6
.luacheckrc
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
unused_args = false
|
||||||
|
|
||||||
|
read_globals = {
|
||||||
|
"minetest",
|
||||||
|
"ItemStack"
|
||||||
|
}
|
49
init.lua
@ -15,7 +15,7 @@ bulletin_boards.player_state = {}
|
|||||||
bulletin_boards.board_def = {}
|
bulletin_boards.board_def = {}
|
||||||
|
|
||||||
local path = minetest.get_worldpath() .. "/bulletin_boards.lua"
|
local path = minetest.get_worldpath() .. "/bulletin_boards.lua"
|
||||||
local f, e = loadfile(path);
|
local f, _ = loadfile(path);
|
||||||
if f then
|
if f then
|
||||||
bulletin_boards.global_boards = f()
|
bulletin_boards.global_boards = f()
|
||||||
else
|
else
|
||||||
@ -151,18 +151,19 @@ local function show_board(player_name, board_name)
|
|||||||
board.last_culled = current_time - math.floor(culling_interval * remaining_cull_time)
|
board.last_culled = current_time - math.floor(culling_interval * remaining_cull_time)
|
||||||
|
|
||||||
local def = bulletin_boards.board_def[board_name]
|
local def = bulletin_boards.board_def[board_name]
|
||||||
local desc = def.desc
|
local desc = minetest.formspec_escape(def.desc)
|
||||||
local tip
|
local tip
|
||||||
if def.cost then
|
if def.cost then
|
||||||
local stack = ItemStack(def.cost)
|
local stack = ItemStack(def.cost)
|
||||||
tip = S("Post your bulletin here for the cost of @1 @2", stack:get_count(), get_item_desc(stack))
|
tip = S("Post your bulletin here for the cost of @1 @2", stack:get_count(), get_item_desc(stack))
|
||||||
|
desc = desc .. S(", Cost: @1 @2", stack:get_count(), get_item_desc(stack))
|
||||||
else
|
else
|
||||||
tip = S("Post your bulletin here")
|
tip = S("Post your bulletin here")
|
||||||
end
|
end
|
||||||
|
|
||||||
formspec[#formspec+1] = "size[8,8.5]"
|
formspec[#formspec+1] = "size[8,8.5]"
|
||||||
.. "container[0,0]"
|
.. "container[0,0]"
|
||||||
.. "label[3.25,-0.25;"..minetest.formspec_escape(desc).."]"
|
.. "label[0.0,-0.25;"..desc.."]"
|
||||||
.. "container_end[]"
|
.. "container_end[]"
|
||||||
.. "container[0,0.5]"
|
.. "container[0,0.5]"
|
||||||
local i = 0
|
local i = 0
|
||||||
@ -258,7 +259,7 @@ end
|
|||||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||||
if formname ~= "bulletin_boards:board" then return end
|
if formname ~= "bulletin_boards:board" then return end
|
||||||
local player_name = player:get_player_name()
|
local player_name = player:get_player_name()
|
||||||
for field, state in pairs(fields) do
|
for field, _ in pairs(fields) do
|
||||||
if field:sub(1, #"button_") == "button_" then
|
if field:sub(1, #"button_") == "button_" then
|
||||||
local i = tonumber(field:sub(#"button_"+1))
|
local i = tonumber(field:sub(#"button_"+1))
|
||||||
local state = bulletin_boards.player_state[player_name]
|
local state = bulletin_boards.player_state[player_name]
|
||||||
@ -363,7 +364,7 @@ local base_icons = {
|
|||||||
local function generate_random_board(rez, count, icons)
|
local function generate_random_board(rez, count, icons)
|
||||||
icons = icons or base_icons
|
icons = icons or base_icons
|
||||||
local tex = {"([combine:"..rez.."x"..rez}
|
local tex = {"([combine:"..rez.."x"..rez}
|
||||||
for i = 1, count do
|
for _ = 1, count do
|
||||||
tex[#tex+1] = ":"..math.random(1,rez-32)..","..math.random(1,rez-32)
|
tex[#tex+1] = ":"..math.random(1,rez-32)..","..math.random(1,rez-32)
|
||||||
.."="..icons[math.random(1,#icons)]
|
.."="..icons[math.random(1,#icons)]
|
||||||
end
|
end
|
||||||
@ -378,7 +379,9 @@ local function register_board(board_name, board_def)
|
|||||||
local tile = background.."^"..generate_random_board(98, 7, board_def.icons).."^"..foreground
|
local tile = background.."^"..generate_random_board(98, 7, board_def.icons).."^"..foreground
|
||||||
local bulletin_board_def = {
|
local bulletin_board_def = {
|
||||||
description = board_def.desc,
|
description = board_def.desc,
|
||||||
groups = {choppy=1},
|
groups = {choppy=1, axey=1, handy=1},
|
||||||
|
_mcl_hardness = 0.8,
|
||||||
|
_mcl_blast_resistance = 1,
|
||||||
tiles = {tile},
|
tiles = {tile},
|
||||||
inventory_image = tile,
|
inventory_image = tile,
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
@ -437,3 +440,37 @@ minetest.register_craft({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
if minetest.get_modpath("mcl_core") then
|
||||||
|
register_board("bulletin_boards:wood", {
|
||||||
|
desc = S("Public Bulletin Board"),
|
||||||
|
cost = "mcl_core:paper",
|
||||||
|
icons = base_icons,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "bulletin_boards:wood",
|
||||||
|
recipe = {
|
||||||
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
|
{'group:wood', 'mcl_core:paper', 'group:wood'},
|
||||||
|
{'group:wood', 'group:wood', 'group:wood'},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
if minetest.get_modpath("mcl_copper") then
|
||||||
|
register_board("bulletin_boards:copper", {
|
||||||
|
desc = S("Copper Board"),
|
||||||
|
cost = "mcl_copper:copper_ingot",
|
||||||
|
foreground = "bulletin_boards_frame_copper.png",
|
||||||
|
icons = base_icons,
|
||||||
|
})
|
||||||
|
minetest.register_craft({
|
||||||
|
output = "bulletin_boards:copper",
|
||||||
|
recipe = {
|
||||||
|
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||||
|
{"mcl_copper:copper_ingot", 'mcl_core:paper', "mcl_copper:copper_ingot"},
|
||||||
|
{"mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot"},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
18
locale/bulletin_boards.de.tr
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bulletin_boards
|
||||||
|
Post your bulletin here for the cost of @1 @2=Schlage deinen Eintrag für @1 @2 an
|
||||||
|
, Cost: @1 @2=, kostet: @1 @2
|
||||||
|
Post your bulletin here=Schlage deinen Eintrag hier an
|
||||||
|
@1@nPosted by @2@n@3 days ago=@1@nGepostet von @2@nvor @3 Tagen
|
||||||
|
Post bulletin with this icon at the cost of @1 @2=Schlägt den Eintrag mit diesem Bild für @1 @2 an
|
||||||
|
Post bulletin with this icon=Eintrag mit diesem Bild anschlagens
|
||||||
|
Prev=Vorher
|
||||||
|
Next=Nächste
|
||||||
|
Title:=Titel:
|
||||||
|
Contents:=Inhalt:
|
||||||
|
Post:=Anschlagen:
|
||||||
|
Delete this bulletin=Lösche diesen Eintrag
|
||||||
|
Delete:=Löschen:
|
||||||
|
Posted by @1=Angeschlagen von @1
|
||||||
|
Back to Board=Zurück zum Brett
|
||||||
|
Public Bulletin Board=Öffentliche Anschlagtafel
|
||||||
|
Copper Board=Kupfernes Brett
|
18
locale/bulletin_boards.es.tr
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bulletin_boards
|
||||||
|
Post your bulletin here for the cost of @1 @2=Publica tu boletín aqui al precio de @1 @2
|
||||||
|
, Cost: @1 @2=, Precio: @1 @2
|
||||||
|
Post your bulletin here=Publica tu boletín aqui
|
||||||
|
@1@nPosted by @2@n@3 days ago=@1@nPublicado por @2 hace @n@3 días
|
||||||
|
Post bulletin with this icon at the cost of @1 @2=Publicar este boletín con este ícono al precio de @1 @2
|
||||||
|
Post bulletin with this icon=Publicar un boletín con este ícono
|
||||||
|
Prev=Prev
|
||||||
|
Next=Sig
|
||||||
|
Title:=Título:
|
||||||
|
Contents:=Contenidos:
|
||||||
|
Post:=Publicar:
|
||||||
|
Delete this bulletin=Borrar este boletín
|
||||||
|
Delete:=Borrar:
|
||||||
|
Posted by @1=Publicado por @1
|
||||||
|
Back to Board=Volver al tablón
|
||||||
|
Public Bulletin Board=Tablón publico de anuncios
|
||||||
|
Copper Board=Tablón de Cobre
|
@ -1,87 +0,0 @@
|
|||||||
# SOME DESCRIPTIVE TITLE.
|
|
||||||
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
|
||||||
# This file is distributed under the same license as the PACKAGE package.
|
|
||||||
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
|
||||||
#
|
|
||||||
#, fuzzy
|
|
||||||
msgid ""
|
|
||||||
msgstr ""
|
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
|
||||||
"Report-Msgid-Bugs-To: \n"
|
|
||||||
"POT-Creation-Date: 2020-01-21 19:38-0700\n"
|
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
||||||
"Language: \n"
|
|
||||||
"MIME-Version: 1.0\n"
|
|
||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
|
||||||
|
|
||||||
#: init.lua:158
|
|
||||||
msgid "Post your bulletin here for the cost of @1 @2"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:160
|
|
||||||
msgid "Post your bulletin here"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:186
|
|
||||||
msgid ""
|
|
||||||
"@1\n"
|
|
||||||
"Posted by @2\n"
|
|
||||||
"@3 days ago"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:212
|
|
||||||
msgid "Post bulletin with this icon at the cost of @1 @2"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:215
|
|
||||||
msgid "Post bulletin with this icon"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:222
|
|
||||||
msgid "Prev"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:223
|
|
||||||
msgid "Next"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:227
|
|
||||||
msgid "Title:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:228
|
|
||||||
msgid "Contents:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:229
|
|
||||||
msgid "Post:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:235
|
|
||||||
#: init.lua:247
|
|
||||||
msgid "Delete this bulletin"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:236
|
|
||||||
#: init.lua:248
|
|
||||||
msgid "Delete:"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:239
|
|
||||||
msgid "Posted by @1"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:244
|
|
||||||
msgid "Back to Board"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:410
|
|
||||||
msgid "Public Bulletin Board"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#: init.lua:416
|
|
||||||
msgid "Copper Board"
|
|
||||||
msgstr ""
|
|
18
locale/template.txt
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# textdomain: bulletin_boards
|
||||||
|
Post your bulletin here for the cost of @1 @2=
|
||||||
|
, Cost: @1 @2=
|
||||||
|
Post your bulletin here=
|
||||||
|
@1@nPosted by @2@n@3 days ago=
|
||||||
|
Post bulletin with this icon at the cost of @1 @2=
|
||||||
|
Post bulletin with this icon=
|
||||||
|
Prev=
|
||||||
|
Next=
|
||||||
|
Title:=
|
||||||
|
Contents:=
|
||||||
|
Post:=
|
||||||
|
Delete this bulletin=
|
||||||
|
Delete:=
|
||||||
|
Posted by @1=
|
||||||
|
Back to Board=
|
||||||
|
Public Bulletin Board=
|
||||||
|
Copper Board=
|
@ -1,6 +0,0 @@
|
|||||||
@echo off
|
|
||||||
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
|
|
||||||
cd ..
|
|
||||||
set LIST=
|
|
||||||
for /r %%X in (*.lua) do set LIST=!LIST! %%X
|
|
||||||
..\intllib\tools\xgettext.bat %LIST%
|
|
4
mod.conf
@ -1,3 +1,3 @@
|
|||||||
name=bulletin_boards
|
name = bulletin_boards
|
||||||
description = Allows creation of global bulletin boards where players can post public messages
|
description = Allows creation of global bulletin boards where players can post public messages
|
||||||
optional_depends = default
|
optional_depends = default, mcl_core, mcl_copper
|
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 878 B After Width: | Height: | Size: 832 B |
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.1 KiB |
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |