Remove mods 'listitems', 'override', & 'hidename':

Now included in 'antum' modpack.
This commit is contained in:
AntumDeluge 2017-08-04 14:15:59 -07:00
parent ae06fd5533
commit 5a92ed7068
31 changed files with 0 additions and 1309 deletions

View File

@ -13,7 +13,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* admin/
* [clean][] ([WTFPL][lic.wtfpl]) -- version: Unknown *2013-06-08* ([patched][patch.clean])
* [invisible][] ([LGPL][lic.lgpl2.1] / [CC BY-SA][lic.ccbysa3.0])
* [override][] ([MIT][lic.mit]) -- version: [0.1 (35ab53c Git)][ver.override] *2017-08-03*
* [privilegeareas][] ([WTFPL][lic.privilegeareas] / [CC0][lic.cc0]) -- version: [aebaa00 Git][ver.privilegeareas] *2016-05-18*
* [privs][] ([CC0][lic.cc0])
* [spectator_mode][] ([WTFPL][lic.spectator_mode]) -- version: [7d68bec Git][ver.spectator_mode] *2017-03-30*
@ -31,7 +30,6 @@ 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: [0.5 (9356503 Git)][ver.listitems] *2017-08-04*
* 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])
@ -81,7 +79,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
* player/action/
* player/visuals/
* [character_creator][] ([MIT][lic.character_creator]) -- version [1.0 (6a0e6aa Git)][ver.character_creator] *2017-04-01*
* [hidename][] ([MIT][lic.hidename]) -- version [0.2 (a75de87 Git)][ver.hidename] *2017-07-28*
* [invisibility][] ([MIT][lic.invisibility]) -- version: [bf4156b Git][ver.invisibility] *2016-08-19* ([patched][patch.invisibility]) ***UPDATE***
* [playeranim][] ([BSD 2-Clause][lic.playeranim]) - version [59bcd38 Git][ver.playeranim] *2017-06-07* ([patched][patch.playeranim])
* [wardrobe][] ([WTFPL][lic.wtfpl]) -- version: [1.1-2-c48b011 Git][ver.wardrobe] *2015-05-21*
@ -245,7 +242,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[glow]: https://forum.minetest.net/viewtopic.php?t=6300
[hbarmor]: https://forum.minetest.net/viewtopic.php?t=11337
[helicopter]: https://forum.minetest.net/viewtopic.php?t=6183
[hidename]: https://github.com/AntumMT/mod-hidename
[hill_nodebox]: https://cornernote.github.io/minetest-hill_nodebox/
[home_gui]: http://cornernote.github.io/minetest-home_gui/
[homedecor]: https://forum.minetest.net/viewtopic.php?t=2041
@ -260,7 +256,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[jukebox]: https://forum.minetest.net/viewtopic.php?t=13505
[jumping]: https://forum.minetest.net/viewtopic.php?t=2957
[lightning]: https://forum.minetest.net/viewtopic.php?t=13886
[listitems]: https://github.com/AntumMT/mod-listitems
[mesecons]: https://forum.minetest.net/viewtopic.php?t=628
[minetest_game]: https://github.com/minetest/minetest_game
[mob-engine]: https://github.com/minetest-mods/mob-engine
@ -284,7 +279,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[mysheetmetal]: https://forum.minetest.net/viewtopic.php?t=11702
[mywoodslopes]: https://forum.minetest.net/viewtopic.php?t=11433
[nether]: https://forum.minetest.net/viewtopic.php?t=5790
[override]: https://forum.minetest.net/viewtopic.php?t=18229
[painting]: https://github.com/minetest-mods/painting
[peaceful_npc]: https://forum.minetest.net/viewtopic.php?t=4167
[pipeworks]: https://forum.minetest.net/viewtopic.php?t=2155
@ -360,7 +354,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.ethereal]: mods/world/ethereal/license.txt
[lic.farming_plus]: mods/farming/farming_plus/README.txt
[lic.fort_spikes]: mods/buildings/fort_spikes/README.md
[lic.hidename]: mods/player/visuals/hidename/LICENSE.txt
[lic.hill_nodebox]: mods/world/hill_nodebox/LICENSE
[lic.homedecor]: mods/modpacks/homedecor/LICENSE
[lic.hovercraft]: mods/transport/hovercraft/LICENSE.txt
@ -369,7 +362,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[lic.invisible]: mods/admin/invisible/readme.txt
[lic.jukebox]: mods/furniture/jukebox/README.txt
[lic.lightning]: mods/weather/lightning/README.md
[lic.listitems]: mods/chat/listitems/LICENSE.txt
[lic.mesecons]: mods/modpacks/mesecons/COPYING.txt
[lic.mob-engine]: mods/modpacks/mob-engine/LICENSE
[lic.mobf]: mods/modpacks/mobf_core/License.txt
@ -465,7 +457,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.hbarmor]: http://repo.or.cz/minetest_hbarmor.git/tree/ceb313e
[ver.helicopter]: https://github.com/SokolovPavel/helicopter/tree/10f1433
[ver.helicopter_pm]: https://github.com/petermaloney/helicopter/tree/abdf5fa
[ver.hidename]: https://github.com/AntumMT/mod-hidename/tree/a75de87
[ver.hill_nodebox]: https://github.com/cornernote/minetest-hill_nodebox/tree/41bbfa2
[ver.home_gui]: https://github.com/cornernote/minetest-home_gui/tree/f6b5001
[ver.homedecor]: https://github.com/minetest-mods/homedecor_modpack/tree/5c52111
@ -478,7 +469,6 @@ 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/9356503
[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
@ -502,7 +492,6 @@ The game includes the mods from the default [minetest_game](https://github.com/m
[ver.mysheetmetal]: https://github.com/minetest-mods/mysheetmetal/tree/7c5ab71
[ver.mywoodslopes]: https://github.com/minetest-mods/mywoodslopes/tree/3a1b531
[ver.nether]: https://github.com/PilzAdam/nether/tree/bc2ccfb
[ver.override]: https://github.com/AntumMT/mod-override/tree/35ab53c
[ver.peaceful_npc]: https://github.com/jojoa1997/peaceful_npc/tree/2b3a7a5
[ver.pipeworks]: https://github.com/minetest-mods/pipeworks/tree/2eff6e3
[ver.playeranim]: https://github.com/minetest-mods/playeranim/tree/59bcd38

View File

@ -1,21 +0,0 @@
MIT License
Copyright © 2017 Jordan Irwin (AntumDeluge)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,37 +0,0 @@
## Override Mod for [Minetest][]
---
### **Description:**
A mod to simplify overriding craft items. Overriding other types of objects may be supported in the future.
Overrides can be adding using a file named ***overrides.txt*** in the world path directory. The formatting is as follows:
Each new line represents an override:
```
alias1,alias2,...;target
```
In the example above, each existing item (alias1, alias2, etc) will be unregistered & re-added as an alias of ***target***.
---
### **Licensing:**
- [MIT](LICENSE.txt)
---
### **Requirements:**
- Depends: none
---
### **Documentation:**
- [API Documentation](https://antummt.github.io/mod-override/)
[Minetest]: http://www.minetest.net/

View File

@ -1,69 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- Override Mod API
--
-- @script api.lua
--- Unregisters craft items & adds them as aliases.
--
-- Unregisters items & set names as aliases for another existing item.
--
-- @function override.replaceItems
-- @param items List of item names to be overridden (can be string for single item override).
-- @param target Item name of aliases' target.
function override.replaceItems(items, target)
if type(items) == 'string' then
override.logDebug('Overriding item "' .. items .. '" with "' .. target .. '"')
core.unregister_item(items)
core.register_alias(items, target)
else
for i, it in ipairs(items) do
override.logDebug('Overriding item "' .. it .. '" with "' .. target .. '"')
core.unregister_item(it)
core.register_alias(it, target)
end
end
end
--- Unregisters craft items & registers names as aliases for new item.
--
-- Registers a new craft item & adds overridden item names as aliases.
--
-- @function override.overrideItems
-- @tparam string name Name of new item.
-- @tparam table def Item definition.
-- @see override.overrideItems.def
function override.overrideItems(name, def)
local overrides = def.overrides
def.overrides = nil
core.register_craftitem(name, def)
override.replaceItems(overrides, name)
end
--- Item definition table for *override.overrideItems*
--
-- @table override.overrideItems.def
-- @tfield table overrides Old items to be overridden (can be *string* for single item override).
-- @tfield string description Inventory tooltip.
-- @tfield table groups The groups of the craftitem.
-- @tfield imagestring inventory_image Texture displayed in inventory.
-- @tfield imagestring wield_image Texture displayed when wielded.
-- @tfield pos wield_scale Scale of *wield_image*.
-- @tfield int stack_max Maximum amount of items per stack (default: 99).
-- @tfield bool liquids_pointable Whether the player can point at liquids while wielding the item or not (default: false).
-- @field metadata
-- @tfield callback on_place Called on *rightclick*.
-- @tfield callback on_drop Called when dropping the item.
-- @tfield callback on_use Called on *leftclick*.
-- @see override.overrideItems

View File

@ -1,62 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- @script init.lua
override = {}
override.modname = core.get_current_modname()
override.modpath = core.get_modpath(override.modname)
override.debug = core.settings:get_bool('enable_debug_mods') or false
local scripts = {
'logging',
'api',
}
for i, s in ipairs(scripts) do
dofile(override.modpath .. '/' .. s .. '.lua')
end
-- Read overrides file from world path
local o_list = nil
local o_path = core.get_worldpath() .. '/overrides.txt'
local o_file = io.open(o_path, 'r')
if o_file then
o_list = o_file:read()
o_file:close()
else
-- Create empty overrides file
o_file = io.open(o_path, 'w')
if o_file then
o_file:close()
end
end
if o_list then
o_list = string.split(o_list, '\n')
local overrides = {}
for i, o in ipairs(o_list) do
local aliases = string.split(o, ';')
local target = aliases[2]
aliases = string.split(aliases[1], ',')
if aliases and target then
table.insert(overrides, {aliases, target})
end
end
for i, o in ipairs(overrides) do
override.replaceItems(o[1], o[2])
end
end

View File

@ -1,44 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- Logging functions.
--
-- @script logging.lua
--- Custom logging function.
--
-- @function override.log
-- @tparam string level Level at which to output message.
-- @tparam string msg Message to log.
function override.log(level, msg)
local prefix = '[' .. override.modname .. '] '
if level == 'debug' then
if override.debug then
core.log(prefix .. 'DEBUG: ' .. msg)
end
else
if msg == nil then
core.log(prefix .. level)
else
core.log(level, prefix .. msg)
end
end
end
--- Custom debug logging function.
--
-- @function override.logDebug
-- @tparam string msg Message to log.
function override.logDebug(msg)
override.log('debug', msg)
end

View File

@ -1,3 +0,0 @@
name = override
version = 0.1
author = Jordan Irwin (AntumDeluge)

View File

@ -1,21 +0,0 @@
MIT License
Copyright © 2017 Jordan Irwin (AntumDeluge)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,58 +0,0 @@
# List Items (***listitems***) chat command for [Minetest][]
---
### **Description:**
#### Chat Commands:
- ***list:*** Lists registered items or entities available in the game.
- Invocation: ```/list type [options] [string1] [string2] ...```
- ***type:*** List type (e.g. "items", "entities", etc.) (currently, if omitted, defaults to "items").
- ***options:*** Switches to control output behavior.
- ***-v:*** Display description (if available) after object name.
- ***string[1,2] ...:*** String parameter(s) to filter output.
- Without any string parameters, all objects registered in game are listed.
- With string parameters, only objects matching any of the strings will be listed.
- ***listitems:*** Alias for */list items*.
- ***listentities:*** Alias for */list entities*.
- ***listnodes:*** Alias for */list nodes*.
- ***listores:*** Alias for */list ores*.
- ***listtools:*** Alias for */list tools*.
- Invocation: ```/<command> [options] [string1] [string2] ...```
- ***command:*** Name of the command (e.g. *listitems*, *listentities*, etc.)
![Screenshot](screenshot.png)
---
### **Licensing:**
- [MIT](LICENSE.txt)
---
### **Requirements:**
- **Dependencies:**
- Required: ***none***
- Optional:
- ***[intllib][]***
- ***[mobs_redo][]*** *(optionally adds "listmobs" chat command)*
- **Privileges:** none
---
### **Documentation:**
- [API Documentation](https://antummt.github.io/mod-listitems/api.html)
---
### **TODO:**
- Add ***-d*** option to search within descriptions.
[Minetest]: http://www.minetest.net/
[intllib]: https://forum.minetest.net/viewtopic.php?t=4929
[mobs_redo]: https://forum.minetest.net/viewtopic.php?t=9917

View File

@ -1,441 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- List Items API
--
-- @script api.lua
-- Boilerplate to support localized strings if intllib mod is installed.
local S
if core.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
--- Valid option switches.
--
-- @table known_switches
-- @local
-- @field -v Display descriptions.
local known_switches = {'-v',}
--- Valid list types.
--
-- @table known_lists
-- @local
local known_lists = {
'items',
'entities',
'nodes',
'ores',
'tools',
}
if listitems.enable_mobs then
table.insert(known_lists, 'mobs')
end
--- Checks if a parameter is a switch beginning with "-".
--
-- @function isSwitch
-- @local
-- @tparam string param String that is checked for dash prefix.
-- @treturn boolean ***true*** if parameter type is "switch" prefixed with dash.
local function isSwitch(param)
if param then
return #param == 2 and string.find(param, '-') == 1
end
return false
end
--- Checks if value is contained in list.
--
-- @function listContains
-- @local
-- @tparam table tlist List to be iterated.
-- @tparam string v String to search for in list.
-- @treturn boolean ***true*** if string found within list.
local function listContains(tlist, v)
for index, value in ipairs(tlist) do
if v == value then
return true
end
end
return false
end
--- Retrieves a simplified table containing string names of registered items or entities.
--
-- @function getRegistered
-- @local
-- @tparam string r_type Must be either "items" or "entities".
-- @treturn table Either a list of registered item or entity names & descriptions.
-- @note Ore names are located in the "ore" field of the registered tables
local function getRegistered(r_type)
-- Default is "items"
r_type = r_type or 'items'
local o_names = {}
local objects = {}
local o_temp = {}
if r_type == 'entities' then
o_temp = core.registered_entities
elseif r_type == 'nodes' then
o_temp = core.registered_nodes
elseif r_type == 'ores' then
o_temp = core.registered_ores
elseif r_type == 'tools' then
o_temp = core.registered_tools
elseif r_type == 'mobs' then
o_temp = mobs.spawning_mobs
else
o_temp = core.registered_items
end
for name, def in pairs(o_temp) do
-- Ore names are located in the 'ore' field of the table
if r_type == 'ores' then
name = def.ore
elseif r_type == 'mobs' then
def = {}
end
table.insert(objects, {name=name, descr=def.description,})
table.insert(o_names, name)
end
-- FIXME: More efficient method to sort output?
table.sort(o_names)
local o_sorted = {}
for i, name in ipairs(o_names) do
for I, entity in ipairs(objects) do
if entity.name == name then
table.insert(o_sorted, entity)
end
end
end
return o_sorted
end
--- Compares a string from a list of substrings.
--
-- @function compareSubstringList
-- @tparam table ss_list
-- @tparam string s_value
-- @treturn boolean
local function 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
--- Extracts switches prefixed with "-" from parameter list.
--
-- @function extractSwitches
-- @local
-- @tparam table plist
-- @treturn table
local function extractSwitches(plist)
local switches = {}
local params = {}
if plist ~= nil then
for i, p in ipairs(plist) do
-- Check if string starts with "-"
if isSwitch(p) then
table.insert(switches, p)
else
table.insert(params, p)
end
end
end
return {switches, params}
end
--- Replaces duplicates found in a list.
--
-- @function removeListDuplicates
-- @local
-- @tparam table tlist
-- @treturn table
local function removeListDuplicates(tlist)
local cleaned = {}
if tlist ~= nil then
for index, value in ipairs(tlist) do
if not listContains(cleaned, value) then
table.insert(cleaned, value)
end
end
end
return cleaned
end
--- Searches & formats list for matching strings.
--
-- @function formatMatching
-- @local
-- @tparam string player
-- @tparam table nlist
-- @tparam table params
-- @tparam table switches
-- @tparam boolean lower
-- @treturn table
local function formatMatching(player, nlist, params, switches, lower)
-- Defaults to case-insensitive
lower = lower == nil or lower == true
local matching = {}
local show_descr = false
if switches ~= nil then
show_descr = listContains(switches, '-v')
end
core.chat_send_player(player, '\n' .. S('Searching in names ...'))
if params == nil then
params = {}
end
-- Use entire list if no parameters supplied
if next(params) == nil then
for i, item in ipairs(nlist) do
if show_descr and item.descr ~= nil then
table.insert(matching, item.name .. ' (' .. item.descr .. ')')
else
table.insert(matching, item.name)
end
end
else
-- Fill matching list
for i, item in ipairs(nlist) do
local name = item.name
-- Case-insensitive matching
if lower then
name = string.lower(name)
end
if compareSubstringList(params, name) then
if show_descr and item.descr ~= nil then
table.insert(matching, item.name .. ' (' .. item.descr .. ')')
else
table.insert(matching, item.name)
end
end
end
end
return matching
end
--- Setting to display a bulleted list.
--
-- @setting listitems.bullet_list
-- @settype boolean
-- @default true
local bullet_list = core.settings:get_bool('listitems.bullet_list')
if bullet_list == nil then
-- Default is true
bullet_list = true
end
local bullet = ''
if bullet_list then
bullet = S('') .. ' '
end
--- Displays list to player.
--
-- @function displayList
-- @local
-- @tparam string player
-- @tparam table dlist
local function displayList(player, dlist)
if dlist ~= nil then
for i, n in ipairs(dlist) do
core.chat_send_player(player, bullet .. n)
end
end
-- Show player number of items listed
core.chat_send_player(player, S('Objects listed:') .. ' ' .. tostring(#dlist))
end
--- Custom registration function for chat commands.
--
-- @function registerChatCommand
-- @local
-- @tparam string cmd_name
-- @tparam table def
local function registerChatCommand(cmd_name, def)
listitems.logInfo('Registering chat command "' .. cmd_name .. '"')
core.register_chatcommand(cmd_name, def)
end
--- *listitems* base function.
--
-- Lists registered items or entities.
--
-- @function listitems.list
-- @tparam string player Name of player to receive message output.
-- @tparam string l_type Objects to list (either "items", "entities", or "ores").
-- @tparam string switches String list of switch options for manipulating output.
-- @tparam string params String list of parameters.
-- @tparam boolean lower Case-insensitive matching if ***true***.
-- @treturn boolean
function listitems.list(player, l_type, switches, params, lower)
-- Default list type is "items"
l_type = l_type or 'items'
lower = lower == nil or lower == true
if not listContains(known_lists, l_type) then
listitems.logWarn('listitems.list called with unknown list type: ' .. tostring(l_type))
return false
end
if type(params) == 'string' then
if lower then
-- Make parameters case-insensitive
-- FIXME: Switches should not be case-insensitive
params = string.lower(params)
end
-- Split parameters into list & remove duplicates
params = removeListDuplicates(string.split(params, ' '))
elseif lower then
for i in pairs(params) do
params[i] = string.lower(params[i])
end
end
if type(switches) == 'string' then
switches = string.split(switches, ' ')
end
for i, s in ipairs(switches) do
if not listContains(known_switches, s) then
core.chat_send_player(player, S('Error: Unknown option:') .. ' ' .. s)
return false
end
end
all_objects = getRegistered(l_type)
local matched_items = formatMatching(player, all_objects, params, switches, lower)
displayList(player, matched_items)
return true
end
--- Helper function called from within chat commands.
--
-- @function list
-- @local
-- @param player
-- @param params
local function list(player, l_type, params)
local switches = string.split(params, ' ')
local type_ok = true
if not l_type then
core.chat_send_player(player, S('Error: Must specify list type'))
type_ok = false
elseif not listContains(known_lists, l_type) then
core.chat_send_player(player, S('Error: Unknown list type:') .. ' ' .. l_type)
type_ok = false
end
if not type_ok then
core.chat_send_player(player, S('Recognized list types:') .. ' ' .. table.concat(known_lists, ', '))
return false
end
switches = extractSwitches(switches)
params = removeListDuplicates(switches[2])
switches = switches[1]
-- DEBUG:
if listitems.debug then
listitems.log('action', 'List type: ' .. l_type)
listitems.log('action', 'Switches:')
for i, s in ipairs(switches) do
listitems.log('action', ' ' .. s)
end
listitems.log('action', 'Parameters:')
for i, p in ipairs(params) do
listitems.log('action', ' ' .. p)
end
end
return listitems.list(player, l_type, switches, params)
end
if listitems.enable_generic then
--- General *list* chat command
--
-- @chatcmd list
-- @chatparam type
-- @chatparam [-v]
-- @chatparam [string1]
-- @chatparam [string2]
-- @chatparam ...
-- @treturn boolean
registerChatCommand('list', {
params = S('type') .. ' [-v] [' .. S('string1') .. '] [' .. S('string2') .. '] ...',
description = S('List registered items or entities'),
func = function(player, params)
local params = string.split(params, ' ')
local l_type = table.remove(params, 1)
params = table.concat(params, ' ')
return list(player, l_type, params)
end,
})
end
-- Chat commands aliases.
for i, cmd in ipairs(known_lists) do
registerChatCommand('list' .. cmd, {
params = '[-v] [' .. S('string1') .. '] [' .. S('string2') .. '] ...',
description = S('List registered ' .. cmd),
func = function(player, params)
return list(player, cmd, params)
end,
})
end

View File

@ -1,2 +0,0 @@
intllib?
mobs?

View File

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

View File

@ -1,28 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- @script init.lua
listitems = {}
listitems.modname = core.get_current_modname()
listitems.modpath = core.get_modpath(listitems.modname)
local scripts = {
'settings',
'logging',
'api',
}
for index, script in ipairs(scripts) do
dofile(listitems.modpath .. '/' .. script .. '.lua')
end
-- DEBUG:
listitems.logDebug('Loaded')

View File

@ -1,20 +0,0 @@
# Translation by Wuzzy
## Help output description
List registered items = Registrierte Gegenstände anzeigen
List registered entities = Registrierte Entities anzeigen
## Help output parameters
string1 = Text 1
string2 = Text 2
## Player used unrecognized switch
Unknown option: = Unbekannte Option:
## Search description
Searching in names ... = In Namen suchen …
Searching in names and descriptions ... = In Namen und Beschreibungen suchen …
## Number of items listed
Objects listed: = Aufgezählte Objekte:

View File

@ -1,21 +0,0 @@
# Translation by Jordan Irwin (AntumDeluge)
## Help output description
List registered items = Listar los artículos registrados
List registered entities = Listar los entidades registrados
List registered ores = Listar los minerales registrados
## Help output parameters
string1 = cadena1
string2 = cadena2
## Player used unrecognized switch
Unknown option: = Opción desconocida:
## Search description
Searching in names ... = Buscando en los nombres ...
Searching in names and descriptions ... = Buscando en los nombres y descripciones ...
## Number of items listed
Objects listed: = Artículos enumerados:

View File

@ -1,28 +0,0 @@
# Translation by
## Help output description
List registered items =
List registered entities =
List registered ores =
## Help output parameters
type =
string1 =
string2 =
## Error output
Error: Unknown option: =
Error: Must specify list type =
Error: Unknown list type: =
Recognized list types: =
## Search description
Searching in names ... =
Searching in names and descriptions ... =
## Number of items listed
Objects listed: =
## Bullet (change this if there are problems displaying the raw character "•")
• =

View File

@ -1,42 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
-- LOGGING FUNCTIONS
-- Custom logging function
function listitems.log(level, msg)
local prefix = '[' .. listitems.modname .. '] '
if msg == nil then
core.log(prefix .. level)
else
core.log(level, prefix .. msg)
end
end
-- Custom "info" level logging function
function listitems.logInfo(msg)
listitems.log('info', msg)
end
-- Custom "warning" level logging function
function listitems.logWarn(msg)
listitems.log('warning', msg)
end
-- Custom debug logging function
function listitems.logDebug(msg)
if listitems.debug then
core.log('[DEBUG: ' .. listitems.modname .. '] ' .. msg)
end
end

View File

@ -1,5 +0,0 @@
name = listitems
author = AntumDeluge
description = Chat command that lists registered items.
license = MIT
version = 0.4

Binary file not shown.

Before

Width:  |  Height:  |  Size: 246 KiB

View File

@ -1,34 +0,0 @@
--[[ LICENSE HEADER
MIT Licensing
Copyright © 2017 Jordan Irwin
See: LICENSE.txt
--]]
--- @script settings
listitems.debug = core.settings:get_bool('enable_debug_mods') or false
--- Enables/Disables "list" chat command.
--
-- @setting listitems.enable_generic
-- @settype boolean
-- @default false
listitems.enable_generic = core.settings:get_bool('listitems.enable_generic') or false
--- Enables/Disables "listmobs" chat command.
--
-- Requires "mobs".
--
-- @setting listitems.enable_mobs
-- @settype boolean
-- @default true
listitems.enable_mobs = false
if core.global_exists('mobs') then
listitems.enable_mobs = core.settings:get_bool('listitems.enable_mobs')
-- Default: enabled
listitems.enable_mobs = listitems.enable_mobs == nil or listitems.enable_mobs == true
end

View File

@ -1,9 +0,0 @@
# Displays items in a bulleted list.
listitems.bullet_list (Bulleted list) bool true
# Enables/Disables generic "list" chat command.
listitems.enable_generic (Enable generic "list" command) bool false
# Enables/Disables "listmobs" chat command (requires "mobs").
listitems.enable_mobs (Enable "listmobs" command) bool true

View File

@ -1,21 +0,0 @@
MIT License
Copyright © 2017 Jordan Irwin (AntumDeluge)
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -1,44 +0,0 @@
## Hide Name (***hidename***) mod for [Minetest][]
---
### **Description**
A Minetest mod for hiding player nametags from view.
- Chat commands:
- **hidename**
- Invocation: ***/hidename***
- Hides player's nametag
- **showname**
- Invocation: ***/showname***
- Shows player's nametag
- [API documentation](http://antummt.github.io/mod-hidename)
---
### **Licensing**
- MIT (see [LICENSE.txt](LICENSE.txt))
---
### **Requirements**
#### Dependencies
- **Required:** none
- **Optional:**
- [intllib][]
#### Privileges
- **Required:** none
---
### **TODO**
- Use empty nametag instead of transparency
[Minetest]: http://www.minetest.net/
[intllib]: https://forum.minetest.net/viewtopic.php?t=4929

View File

@ -1,137 +0,0 @@
--[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
--- *hidename* mod API
-- 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
-- Default alpha level (FIXME: Should be player attribute)
local stored_alpha = 255
--- Checks if player's nametag is hidden.
--
-- Compares alpha level of player's nametag against 0 (0 being transparent).
--
-- TODO: Check for empty string instead of alpha value
--
-- @param alpha Can be an integer between 0-255 or player's name string
-- @return ***true*** if player's nametag is hidden
function hidename.hidden(alpha)
if type(alpha) == 'string' then
local player = core.get_player_by_name(alpha)
alpha = player:get_nametag_attributes().color.a
end
return alpha == 0
end
--- Messages info to player about nametag text & visibility.
--
-- @param name Name of player to check & message
function hidename.tellStatus(name)
local player = core.get_player_by_name(name)
local nametag = player:get_nametag_attributes()
local status = 'Status: '
if hidename.hidden(nametag.color.a) then
status = status .. 'hidden'
else
status = status .. 'visible'
end
-- Use parameter value if nametag.text is empty
-- FIXME: This may cause issues if text value is used instead of transparency
-- to determine if nametag is hidden
if nametag.text == '' then
nametag.text = name
end
core.chat_send_player(name, S('Nametag:') .. ' ' .. nametag.text)
core.chat_send_player(name, S(status))
end
--- Hides a player's nametag.
--
-- @param name Name of player whose nametag should be made hidden
-- @return ***true*** if player's nametag is hidden
function hidename.hide(name)
local player = core.get_player_by_name(name)
local nametag_color = player:get_nametag_attributes().color
if hidename.hidden(nametag_color.a) then
core.chat_send_player(name, S('Nametag is already hidden'))
return true
end
-- Set nametag alpha level to 0
nametag_color.a = 0
player:set_nametag_attributes({
color = nametag_color,
})
-- Test new alpha level
local hidden = player:get_nametag_attributes().color.a == 0
if hidden then
core.chat_send_player(name, S('Nametag is now hidden'))
else
core.chat_send_player(name, S('ERROR: Could not hide nametag'))
core.log('error', 'Could not set nametag to "hidden" for player ' .. name)
core.log('error', 'Please submit an error report to the "hidename" mod developer')
end
return hidden
end
--- Makes a player's nametag visible.
--
-- @param name Name of player whose nametag should be made visible
-- @return ***true*** if player's nametag is visible
function hidename.show(name)
local player = core.get_player_by_name(name)
local nametag_color = player:get_nametag_attributes().color
local alpha = nametag_color.a
if not hidename.hidden(alpha) then
core.chat_send_player(name, S('Nametag is already visible'))
return true
end
-- Restore nametag alpha level (currently static)
nametag_color.a = stored_alpha
player:set_nametag_attributes({
color = nametag_color,
})
-- Test new alpha level
local shown = player:get_nametag_attributes().color.a ~= 0
if shown then
core.chat_send_player(name, S('Nametag is now visible'))
else
core.chat_send_player(name, S('ERROR: Could not show nametag'))
core.log('error', 'Could not set nametag to "visible" for player ' .. name)
core.log('error', 'Please submit an error report to the "hidename" mod developer')
end
return shown
end

View File

@ -1,94 +0,0 @@
--[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
--- *hidename* chat commands
-- 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
local params = {
S('hide'),
S('show'),
S('status'),
}
local params_string = '[' .. table.concat(params, '|') .. ']'
--- *nametag* chat command.
--
-- Displays nametag info or sets visibility.
--
-- @chatcmd nametag
-- @chatparam mode
-- @option ***hide*** : Sets player nametag hidden
-- @option ***show*** : Sets player nametag visible
-- @option ***status*** : Displays nametag text & visible state (default)
-- @usage
-- /nametag [option]
-- /nametag hide
core.register_chatcommand(S('nametag'), {
params = params_string,
description = S('Get nametag info or set visibility'),
func = function(name, param)
-- Split parameters into case-insensitive list
param = string.split(string.lower(param), ' ')
local mode = param[1]
-- Default to "status"
if mode == nil or mode == 'status' then
hidename.tellStatus(name)
return true
elseif mode == 'hide' then
return hidename.hide(name)
elseif mode == 'show' then
return hidename.show(name)
end
core.chat_send_player(name, S('Unknown parameter:') .. ' ' .. mode)
return false
end
})
--- *hidename* chat command.
--
-- Sets player's nametag hidden from others.
--
-- @chatcmd hidename
-- @usage /hidename
core.register_chatcommand(S('hidename'), {
description = S('Make nametag hidden'),
func = function(name, param)
return hidename.hide(name)
end,
})
--- *showname* chat command.
--
-- Sets player's nametag visible to others.
-- @chatcmd showname
-- @usage /showname
core.register_chatcommand(S('showname'), {
description = S('Make nametag visible'),
func = function(name, param)
return hidename.show(name)
end,
})

View File

@ -1 +0,0 @@
intllib?

View File

@ -1 +0,0 @@
Hides player's nametag from view.

View File

@ -1,21 +0,0 @@
--[[ MIT LICENSE HEADER
Copyright © 2017 Jordan Irwin (AntumDeluge)
See: LICENSE.txt
--]]
hidename = {}
hidename.modname = core.get_current_modname()
hidename.modpath = core.get_modpath(hidename.modname)
local scripts = {
'api',
'command',
}
for i, s in ipairs(scripts) do
dofile(hidename.modpath .. '/' .. s .. '.lua')
end

View File

@ -1,26 +0,0 @@
# Translation by
## Invoking commands (remove these lines to use defaults "nametag", "hidename", & "showname")
nametag =
hidename =
showname =
## "nametag" parameters
hide =
show =
status =
Nametag: =
Status: hidden =
Status: visible =
Unknown parameter: =
Make nametag hidden =
Make nametag visible =
Nametag is now hidden =
Nametag is now visible =
Nametag is already hidden =
Nametag is already visible =
ERROR: Could not hide nametag =
ERROR: Could not show nametag =

View File

@ -1,5 +0,0 @@
name = hidename
author = Jordan Irwin (AntumDeluge)
description = Hides player's nametag from view.
license = MIT
version = 0.2