[listitems] Update to Git commit 48e0a64:

https://github.com/AntumMT/mod-listitems/tree/48e0a64
This commit is contained in:
AntumDeluge 2017-07-23 15:42:38 -07:00
parent 7256db77e6
commit 23755c1959
10 changed files with 86 additions and 13 deletions

View File

@ -30,7 +30,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* chat/
* [away][] ([GPL][lic.gpl2.0]) -- version: [4c1e5a9 Git][ver.away] *2012-03-09* ([patched][patch.away])
* [chatlog][] ([CC0][lic.cc0]) -- version: (no version info) *2013-06-09* ([patched][patch.chatlog])
* [listitems][] ([MIT][lic.listitems]) -- version: [6aec9d7 Git][ver.listitems] *2017-06-15*
* [listitems][] ([MIT][lic.listitems]) -- version: [0.3 (48e0a64 Git)][ver.listitems] *2017-07-23*
* crafting/
* [craftguide][] ([GPL / WTFPL](mods/crafting/craftguide/LICENSE)) -- version: [86a96c3 Git][ver.craftguide] *2017-03-21* ([patched][patch.craftguide])
* [currency][] ([WTFPL][lic.currency]) -- version: [3ee673d Git][ver.currency] *2017-05-18* ([patched][patch.currency])
@ -465,7 +465,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.invisibility]: https://github.com/tenplus1/invisibility/tree/bf4156b
[ver.jukebox]: https://github.com/minetest-mods/jukebox/tree/e6a507f
[ver.lightning]: https://github.com/minetest-mods/lightning/tree/39bd36c
[ver.listitems]: https://github.com/AntumMT/mod-listitems/tree/6aec9d7
[ver.listitems]: https://github.com/AntumMT/mod-listitems/tree/48e0a64
[ver.mesecons]: https://github.com/minetest-mods/mesecons/tree/564bdc2
[ver.minetest_game]: https://github.com/minetest/minetest_game/tree/f855bee
[ver.mob-engine]: https://github.com/minetest-mods/mob-engine/tree/138f655

View File

@ -0,0 +1,22 @@
# ***listitems*** chat command for Minetest
### Description
- A very basic chat command to list all registered craft items available in the game.
- Invocation: */listitems [string1] [string2] ...*
- Without any parameters, all items registered in game are listed.
- With parameters, only items matching any of the strings will be listed.
![Screenshot](screenshot.png)
### Licensing
- MIT (see [LICENSE.txt](LICENSE.txt))
### Requirements
- Depends: none
- Privileges: none

View File

@ -8,6 +8,23 @@
--]]
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if minetest.global_exists('intllib') then
if intllib.make_gettext_pair then
S = intllib.make_gettext_pair()
else
S = intllib.Getter()
end
else
S = function(s) return s end
end
-- Invoking command string
local list_command = S('listitems')
-- Retrieves a simplified table containing string names of registered items
local function getRegisteredItemNames()
local item_names = {}
@ -59,11 +76,11 @@ local function removeListDuplicates(tlist)
end
minetest.log('action', '[listitems] Registering chat command "listitems"')
minetest.log('action', '[listitems] Registering chat command "' .. list_command .. '"')
minetest.register_chatcommand('listitems', {
params = '[string1] [string2] ...',
description = 'List registered items',
minetest.register_chatcommand(list_command, {
params = '[' .. S('string1') .. '] [' .. S('string2') .. '] ...',
description = S('List registered items'),
func = function(player, param)
-- Make all parameters lowercase for case-insensitive matching
param = removeListDuplicates(string.split(string.lower(param), ' '))
@ -85,11 +102,11 @@ minetest.register_chatcommand('listitems', {
if found_names ~= nil then
for I in pairs(found_names) do
minetest.chat_send_player(player, found_names[I])
minetest.chat_send_player(player, S('') .. ' ' .. found_names[I])
end
else
minetest.chat_send_player(player, 'No registered items found!')
end
-- Show player number of items listed
minetest.chat_send_player(player, S('Items listed:') .. ' ' .. tostring(#found_names))
return true
end,

View File

@ -0,0 +1 @@
intllib?

View File

@ -1,3 +1,3 @@
A very basic chat command to list all registered craft items availabe in the game.
A very basic chat command to list all registered craft items available in the game.
Use the command "/listitems [string1] [string2] ..." (no privileges required).
Use the command "/listitems [string1] [string2] ..." (no privileges required).

View File

@ -12,4 +12,4 @@ listitems = {}
listitems.modname = minetest.get_current_modname()
listitems.modpath = minetest.get_modpath(listitems.modname)
dofile(listitems.modpath .. '/register.lua')
dofile(listitems.modpath .. '/api.lua')

View File

@ -0,0 +1,15 @@
# Translation by Jordan Irwin (AntumDeluge)
## Invoking command (remove this line to use default "listitems")
listitems = listararticulos
## Help output description
List registered items = Listar los artículos registrados
## Help output parameters
string1 = cadena1
string2 = cadena2
## Number of items listed
Items listed: = Artículos enumerados:

View File

@ -0,0 +1,18 @@
# Translation by
## Invoking command (remove this line to use default "listitems")
listitems =
## Help output description
List registered items =
## Help output parameters
string1 =
string2 =
## Number of items listed
Items listed: =
## Bullet (change this if there are problems displaying the raw character "•")
• =

View File

@ -2,4 +2,4 @@ name = listitems
author = AntumDeluge
description = Chat command that lists registered items.
license = MIT
version = 0.1
version = 0.3

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB