Add optional support for 'mobs' mod:

Adds 'listmobs' chat command.
master
AntumDeluge 2017-08-03 18:09:06 -07:00
parent 9b3607c282
commit 3e0311b61d
5 changed files with 33 additions and 1 deletions

View File

@ -31,7 +31,11 @@
---
### **Requirements:**
- **Depends:** none
- **Dependencies:**
- Required: ***none***
- Optional:
- ***[intllib][]***
- ***[mobs_redo][]*** *(optionally adds "listmobs" chat command)*
- **Privileges:** none
@ -48,3 +52,5 @@
[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

@ -42,6 +42,10 @@ local known_lists = {
'ores',
}
if listitems.enable_mobs then
table.insert(known_lists, 'mobs')
end
--- Checks if a parameter is a switch beginning with "-".
--
@ -95,6 +99,8 @@ local function getRegistered(r_type)
o_temp = core.registered_entities
elseif r_type == 'ores' then
o_temp = core.registered_ores
elseif r_type == 'mobs' then
o_temp = mobs.spawning_mobs
else
o_temp = core.registered_items
end
@ -103,6 +109,8 @@ local function getRegistered(r_type)
-- 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,})

View File

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

View File

@ -18,3 +18,17 @@ listitems.debug = core.settings:get_bool('enable_debug_mods') or false
-- @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

@ -4,3 +4,6 @@ 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