[antum] modpack: Update to Git commit f8c0a34:

https://github.com/AntumDeluge/mtmp-antum/tree/f8c0a34
master
AntumDeluge 2017-05-29 17:25:34 -07:00
parent e96e654cd4
commit 3fabb1b40e
2 changed files with 71 additions and 7 deletions

View File

@ -19,7 +19,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* [privs][] ([CC0][lic.cc0])
* [spectator_mode][] ([WTFPL][lic.spectator_mode]) -- version: [7d68bec Git][ver.spectator_mode] *2017-03-30*
* [awards][] ([LGPL][lic.lgpl2.1]) -- version: [096fe16 Git][ver.awards] *2017-02-25*
* [antum][] ([MIT][lic.antum]) -- version: [e539f08 Git][ver.antum] *2017-05-03*
* [antum][] ([MIT][lic.antum]) -- version: [f8c0a34 Git][ver.antum] *2017-05-29*
* buildings/
* [bridges][] ([GPL][lic.gpl3.0]) -- version: [5b5f475 Git][ver.bridges] *2015-08-23*
* [christmas][] ([MIT][lic.christmas]) -- version [d3bd872 Git][ver.christmas] *2013-01-11* ([patched][patch.christmas])
@ -392,7 +392,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.airtanks]: https://github.com/minetest-mods/airtanks/tree/fc01ffb
[ver.animalmaterials]: https://github.com/sapier/animalmaterials/tree/d952d27
[ver.animals]: https://github.com/sapier/animals_modpack/tree/b9d0172
[ver.antum]: https://github.com/AntumDeluge/mtmp-antum/tree/e539f08
[ver.antum]: https://github.com/AntumDeluge/mtmp-antum/tree/f8c0a34
[ver.areas]: https://github.com/ShadowNinja/areas/tree/6080ff0
[ver.awards]: https://github.com/minetest-mods/awards/tree/096fe16
[ver.away]: https://github.com/kahrl/minetest-mod-away/tree/4c1e5a9

View File

@ -38,16 +38,80 @@ function antum.getRegisteredItemNames()
end
-- Compares a string from a list of substrings
-- FIXME: Move to Antum functions
function antum.compareSubstringList(ss_list, s_value)
for index, substring in ipairs(ss_list) do
-- Tests for substring (does not need to match full string)
if string.find(s_value, substring) then
return true
end
end
return false
end
-- Checks if value is contained in list
-- FIXME: Move to Antum functions
function antum.listContains(tlist, v)
for index, value in ipairs(tlist) do
if v == value then
return true
end
end
return false
end
-- Replaces duplicates found in a list
-- FIXME: Move to Antum functions
function antum.removeListDuplicates(tlist)
local cleaned = {}
for index, value in ipairs(tlist) do
if not antum.listContains(cleaned, value) then
table.insert(cleaned, value)
end
end
return cleaned
end
antum.logAction('Registering chat command "listitems"')
minetest.register_chatcommand('listitems', {
params = '',
params = '[string1] [string2] ...',
description = 'List registered items',
func = function(player, param)
local item_names = antum.getRegisteredItemNames()
if item_names ~= nil then
for INDEX in pairs(item_names) do
minetest.chat_send_player(player, item_names[INDEX])
-- Make all parameters lowercase for case-insensitive matching
param = antum.removeListDuplicates(string.split(string.lower(param), ' '))
-- Debug
minetest.log('action', '[list_items] Parameters:')
for I in pairs(param) do
minetest.log('action', ' ' .. param[I])
end
local all_item_names = antum.getRegisteredItemNames()
local found_names = {}
-- Check if table is empty
if next(param) == nil then
found_names = all_item_names
else
-- Need to fill item list
for I in pairs(all_item_names) do
if antum.compareSubstringList(param, string.lower(all_item_names[I])) then
table.insert(found_names, all_item_names[I])
end
end
end
if found_names ~= nil then
for I in pairs(found_names) do
minetest.chat_send_player(player, found_names[I])
end
else
minetest.chat_send_player(player, 'No registered items found!')