[antum (mp)] Update to Git commit 09821b7:
https://github.com/AntumMT/mp-antum/tree/09821b7
This commit is contained in:
parent
727caa4a27
commit
ae06fd5533
@ -18,7 +18,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* ([patched][patch.awards]) ***UPDATE***
|
||||
* [antum][] ([MIT][lic.antum]) -- version: [f643879 Git][ver.antum] *2017-07-09*
|
||||
* [antum][] ([MIT][lic.antum]) -- version: [09821b7 Git][ver.antum] *2017-08-04*
|
||||
* buildings/
|
||||
* [bridges][] ([GPL][lic.gpl3.0]) -- version: [5b5f475 Git][ver.bridges] *2015-08-23* ([patched][patch.bridges])
|
||||
* [christmas][] ([MIT][lic.christmas]) -- version [d3bd872 Git][ver.christmas] *2013-01-11* ([patched][patch.christmas])
|
||||
@ -424,7 +424,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
||||
[ver.animalmaterials]: https://github.com/sapier/animalmaterials/tree/aa4697c
|
||||
[ver.animals]: https://github.com/sapier/animals_modpack/tree/b9d0172
|
||||
[ver.animals_aggressive]: https://github.com/AntumMT/mp-animals_aggressive/tree/2c913bb
|
||||
[ver.antum]: https://github.com/AntumMT/mp-antum/tree/f643879
|
||||
[ver.antum]: https://github.com/AntumMT/mp-antum/tree/09821b7
|
||||
[ver.areas]: https://github.com/ShadowNinja/areas/tree/289d0e6
|
||||
[ver.awards]: https://github.com/minetest-mods/awards/tree/096fe16
|
||||
[ver.away]: https://github.com/kahrl/minetest-mod-away/tree/4c1e5a9
|
||||
|
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright © 2017 Jordan Irwin
|
||||
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
|
||||
|
@ -0,0 +1,18 @@
|
||||
## Antum modpack for [Minetest][]
|
||||
|
||||
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Modpack for the Minetest sub-game [Antum][antum_game].
|
||||
|
||||
|
||||
---
|
||||
### **Licensing**
|
||||
|
||||
License: [MIT](LICENSE.txt)
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[antum_game]: https://github.com/AntumMT/game-antum
|
@ -1,9 +0,0 @@
|
||||
## Antum API
|
||||
|
||||
|
||||
--
|
||||
|
||||
### Available functions
|
||||
|
||||
- antum.log(level, message)
|
||||
-
|
10
mods/antum/core/README.md
Normal file
10
mods/antum/core/README.md
Normal file
@ -0,0 +1,10 @@
|
||||
## Antum Core (***antum***) mod for [Minetest][]
|
||||
|
||||
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Core mod for the Antum Minetest sub-game.
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
@ -26,20 +26,25 @@
|
||||
|
||||
|
||||
-- Displays a message in the log
|
||||
function antum.log(level, message)
|
||||
minetest.log(level, '[' .. minetest.get_current_modname() .. '] ' .. message)
|
||||
function antum.log(level, msg)
|
||||
local prefix = '[' .. core.get_current_modname() .. '] '
|
||||
if msg == nil then
|
||||
core.log(prefix .. level)
|
||||
else
|
||||
core.log(level, prefix .. msg)
|
||||
end
|
||||
end
|
||||
|
||||
function antum.logAction(message)
|
||||
antum.log('action', message)
|
||||
function antum.logAction(msg)
|
||||
antum.log('action', msg)
|
||||
end
|
||||
|
||||
function antum.logWarn(message)
|
||||
antum.log('warning', message)
|
||||
function antum.logWarn(msg)
|
||||
antum.log('warning', msg)
|
||||
end
|
||||
|
||||
function antum.logError(message)
|
||||
antum.log('error', message)
|
||||
function antum.logError(msg)
|
||||
antum.log('error', msg)
|
||||
end
|
||||
|
||||
|
||||
@ -57,20 +62,19 @@ end
|
||||
|
||||
-- Retrieves path for currently loaded mod
|
||||
function antum.getCurrentModPath()
|
||||
return minetest.get_modpath(minetest.get_current_modname())
|
||||
return core.get_modpath(core.get_current_modname())
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Loads a mod sub-script.
|
||||
|
||||
--[[ Loads a mod sub-script.
|
||||
|
||||
@param script_name
|
||||
Name or base name of the script file
|
||||
@param lua_ext
|
||||
type: bool
|
||||
default: true
|
||||
description: If 'true', appends '.lua' extension to script filename
|
||||
]]--
|
||||
]]
|
||||
function antum.loadScript(script_name, lua_ext)
|
||||
-- Default 'true'
|
||||
if lua_ext == nil then
|
||||
@ -104,7 +108,7 @@ function antum.registerCraft(def)
|
||||
antum.logAction('Registering craft recipe for "' .. def.output .. '"')
|
||||
end
|
||||
|
||||
minetest.register_craft(def)
|
||||
core.register_craft(def)
|
||||
end
|
||||
|
||||
|
||||
@ -114,7 +118,7 @@ function antum.clearCraftOutput(output)
|
||||
antum.logAction('Clearing craft by output: ' .. output)
|
||||
end
|
||||
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
output = output
|
||||
})
|
||||
end
|
||||
@ -142,7 +146,7 @@ function antum.clearCraftRecipe(recipe)
|
||||
antum.logAction(' Clearing craft by recipe: ' .. recipe_string)
|
||||
end
|
||||
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
recipe = {recipe}
|
||||
})
|
||||
end
|
||||
@ -165,7 +169,7 @@ end
|
||||
-- Checks if dependencies are satisfied
|
||||
function antum.dependsSatisfied(depends)
|
||||
for index, dep in ipairs(depends) do
|
||||
if not minetest.get_modpath(dep) then
|
||||
if not core.get_modpath(dep) then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@ -183,24 +187,23 @@ end
|
||||
Item object with name matching 'item_name' parameter
|
||||
]]
|
||||
function antum.getItem(item_name)
|
||||
for index in pairs(minetest.registered_items) do
|
||||
if minetest.registered_items[index].name == item_name then
|
||||
return minetest.registered_items[index]
|
||||
for index in pairs(core.registered_items) do
|
||||
if core.registered_items[index].name == item_name then
|
||||
return core.registered_items[index]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Retrieves a list of items containing a string.
|
||||
|
||||
--[[ Retrieves a list of items containing a string.
|
||||
|
||||
@param substring
|
||||
String to match within item names
|
||||
@param case_sensitive
|
||||
If 'true', 'substring' case must match that of item name
|
||||
@return
|
||||
List of item names matching 'substring'
|
||||
]]--
|
||||
]]
|
||||
function antum.getItemNames(substring, case_sensitive)
|
||||
antum.logAction('Checking registered items for "' .. substring .. '" in item name ...')
|
||||
|
||||
@ -211,8 +214,8 @@ function antum.getItemNames(substring, case_sensitive)
|
||||
|
||||
local item_names = {}
|
||||
|
||||
for index in pairs(minetest.registered_items) do
|
||||
local item_name = minetest.registered_items[index].name
|
||||
for index in pairs(core.registered_items) do
|
||||
local item_name = core.registered_items[index].name
|
||||
if not case_sensitive then
|
||||
item_name = string.lower(item_name)
|
||||
end
|
||||
@ -227,9 +230,8 @@ function antum.getItemNames(substring, case_sensitive)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Un-registers an item & converts its name to an alias.
|
||||
|
||||
--[[ Un-registers an item & converts its name to an alias.
|
||||
|
||||
@param item_name
|
||||
Name of the item to override
|
||||
@param alias_of
|
||||
@ -237,14 +239,13 @@ end
|
||||
]]
|
||||
function antum.convertItemToAlias(item_name, alias_of)
|
||||
antum.logAction('Overridding "' .. item_name .. '" with "' .. alias_of .. '"')
|
||||
minetest.unregister_item(item_name)
|
||||
minetest.register_alias(item_name, alias_of)
|
||||
core.unregister_item(item_name)
|
||||
core.register_alias(item_name, alias_of)
|
||||
end
|
||||
|
||||
|
||||
--[[
|
||||
Changes object description.
|
||||
|
||||
--[[ Changes object description.
|
||||
|
||||
@param item_name
|
||||
Name of item to be altered
|
||||
@param description
|
||||
@ -257,7 +258,20 @@ function antum.overrideItemDescription(item_name, description)
|
||||
item.description = description
|
||||
|
||||
-- Unregister original item
|
||||
minetest.unregister_item(item.name)
|
||||
core.unregister_item(item.name)
|
||||
|
||||
minetest.register_craftitem(':' .. item.name, item)
|
||||
core.register_craftitem(':' .. item.name, item)
|
||||
end
|
||||
|
||||
|
||||
--[[ Registers a new item under "antum" namespace
|
||||
|
||||
@param name
|
||||
Base name of new item
|
||||
@param def
|
||||
Item definition
|
||||
]]
|
||||
function antum.registerItem(name, def)
|
||||
name = ':' .. antum.namespace .. ':' .. name
|
||||
core.register_craftitem(name, def)
|
||||
end
|
@ -26,11 +26,12 @@
|
||||
|
||||
|
||||
antum = {}
|
||||
antum.modname = minetest.get_current_modname()
|
||||
antum.modpath = minetest.get_modpath(antum.modname)
|
||||
antum.modname = core.get_current_modname()
|
||||
antum.modpath = core.get_modpath(antum.modname)
|
||||
antum.namespace = 'antum'
|
||||
|
||||
antum.verbose = false
|
||||
if minetest.settings:get_bool('log_mods') then
|
||||
if core.settings:get_bool('log_mods') then
|
||||
antum.verbose = true
|
||||
end
|
||||
|
@ -38,11 +38,11 @@ for index, feather in ipairs(feathers) do
|
||||
antum.convertItemToAlias(feather, 'antum:feather')
|
||||
end
|
||||
|
||||
minetest.register_craftitem(':antum:feather', {
|
||||
core.register_craftitem(':antum:feather', {
|
||||
description = 'Feather',
|
||||
inventory_image = 'antum_feather_white.png',
|
||||
})
|
||||
minetest.register_alias('antum:feather_white', 'antum:feather')
|
||||
core.register_alias('antum:feather_white', 'antum:feather')
|
||||
|
||||
|
||||
local depends_satisfied = true
|
||||
@ -53,15 +53,15 @@ local depends = {
|
||||
}
|
||||
|
||||
for I in pairs(depends) do
|
||||
if not minetest.get_modpath(depends[I]) then
|
||||
if not core.get_modpath(depends[I]) then
|
||||
depends_satisfied = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
minetest.register_craftitem(':antum:bottled_water', {
|
||||
core.register_craftitem(':antum:bottled_water', {
|
||||
description = 'A bottle of water',
|
||||
inventory_image = 'bottled_water.png',
|
||||
inventory_image = 'antum_bottled_water.png',
|
||||
})
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
name = antum_core
|
||||
name = antum
|
||||
author = AntumDeluge
|
||||
description = Customizations related to the Antum game.
|
||||
license = MIT
|
||||
version = 0.1
|
||||
version = 0.1
|
Before Width: | Height: | Size: 265 B After Width: | Height: | Size: 265 B |
Before Width: | Height: | Size: 490 B After Width: | Height: | Size: 490 B |
25
mods/antum/craft/README.md
Normal file
25
mods/antum/craft/README.md
Normal file
@ -0,0 +1,25 @@
|
||||
## Antum Craft (***antum_craft***) mod for [Minetest][]
|
||||
|
||||
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Craft mod for the Antum Minetest sub-game.
|
||||
|
||||
|
||||
---
|
||||
### **Dependencies**
|
||||
|
||||
#### Required:
|
||||
- 3d_armor (part of [3d_armor modpack][3d_armor])
|
||||
- [antum_core][]
|
||||
- default (part of [minetest_game][])
|
||||
- [unifieddyes][]
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[3d_armor]: https://forum.minetest.net/viewtopic.php?t=4654
|
||||
[antum_core]: https://github.com/AntumMT/mod-antum_core
|
||||
[minetest_game]: https://github.com/minetest/minetest_game
|
||||
[unifieddyes]: https://forum.minetest.net/viewtopic.php?t=2178
|
@ -1,4 +1,4 @@
|
||||
3d_armor
|
||||
antum_core
|
||||
antum
|
||||
default
|
||||
unifieddyes
|
@ -27,8 +27,8 @@
|
||||
|
||||
antum.craft = {}
|
||||
|
||||
antum.craft.modname = minetest.get_current_modname()
|
||||
antum.craft.modpath = minetest.get_modpath(antum.craft.modname)
|
||||
antum.craft.modname = core.get_current_modname()
|
||||
antum.craft.modpath = core.get_modpath(antum.craft.modname)
|
||||
|
||||
|
||||
-- Load sub-scripts
|
||||
|
@ -25,7 +25,7 @@
|
||||
--]]
|
||||
|
||||
|
||||
minetest.register_tool(':walking_light:helmet_gold', {
|
||||
core.register_tool(':walking_light:helmet_gold', {
|
||||
description = 'Gold Helmet with light',
|
||||
inventory_image = 'walking_light_inv_helmet_gold.png',
|
||||
wield_image = "3d_armor_inv_helmet_gold.png",
|
||||
|
19
mods/antum/entities/README.md
Normal file
19
mods/antum/entities/README.md
Normal file
@ -0,0 +1,19 @@
|
||||
## Antum Entities (***antum_entities***) mod for [Minetest][]
|
||||
|
||||
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Entities mod for the Antum Minetest sub-game (this mod is a work-in-progress).
|
||||
|
||||
|
||||
---
|
||||
### **Dependencies**
|
||||
|
||||
#### Required:
|
||||
- [antum_core][]
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[antum_core]: https://github.com/AntumMT/mod-antum_core
|
@ -1 +1 @@
|
||||
antum_core
|
||||
antum
|
||||
|
@ -26,8 +26,8 @@
|
||||
|
||||
|
||||
antum.entities = {}
|
||||
antum.entities.modname = minetest.get_current_modname()
|
||||
antum.entities.modpath = minetest.get_modpath(antum.entities.modname)
|
||||
antum.entities.modname = core.get_current_modname()
|
||||
antum.entities.modpath = core.get_modpath(antum.entities.modname)
|
||||
|
||||
|
||||
-- Loading entity definitions
|
||||
|
@ -52,7 +52,7 @@ function antum.createHostileEntity(def)
|
||||
knockback_level = ba.knockback,
|
||||
}
|
||||
|
||||
minetest.register_entity(name, def)
|
||||
core.register_entity(name, def)
|
||||
end
|
||||
|
||||
-- TESTING
|
||||
|
29
mods/antum/glass/README.md
Normal file
29
mods/antum/glass/README.md
Normal file
@ -0,0 +1,29 @@
|
||||
## Antum Glass (***antum_glass***) mod for [Minetest][]
|
||||
|
||||
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Glass mod for the Antum Minetest sub-game (this mod will eventually be replaced with [colored_glass][]).
|
||||
|
||||
|
||||
---
|
||||
### **Dependencies**
|
||||
|
||||
#### Required:
|
||||
- [antum_core][]
|
||||
- default (part of [minetest_game][])
|
||||
- dye (part of [minetest_game][])
|
||||
|
||||
#### Optional:
|
||||
- [craft_guide][]
|
||||
- [moreblocks][]
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[antum_core]: https://github.com/AntumMT/mod-antum_core
|
||||
[colored_glass]: https://github.com/AntumMT/mod-colored_glass
|
||||
[craft_guide]: https://forum.minetest.net/viewtopic.php?t=2334
|
||||
[minetest_game]: https://github.com/minetest/minetest_game
|
||||
[moreblocks]: https://forum.minetest.net/viewtopic.php?t=509
|
@ -1,4 +1,4 @@
|
||||
antum_core
|
||||
antum
|
||||
default
|
||||
dye
|
||||
craft_guide?
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
antum.glass = {}
|
||||
|
||||
antum.glass.modname = minetest.get_current_modname()
|
||||
antum.glass.modpath = minetest.get_modpath(antum.glass.modname)
|
||||
antum.glass.modname = core.get_current_modname()
|
||||
antum.glass.modpath = core.get_modpath(antum.glass.modname)
|
||||
|
||||
antum.glass.colors = {'blue', 'green', 'red', 'violet'}
|
||||
|
||||
|
@ -31,7 +31,7 @@ local function registerGroupAliases(group)
|
||||
local alias = group[I][2]
|
||||
-- DEBUG
|
||||
antum.logAction('Registering alias: ' .. alias .. ' -> ' .. source)
|
||||
minetest.register_alias(alias, source)
|
||||
core.register_alias(alias, source)
|
||||
end
|
||||
end
|
||||
|
||||
@ -53,7 +53,7 @@ end
|
||||
for I in pairs(antum.glass.colors) do
|
||||
local color = antum.glass.colors[I]
|
||||
|
||||
minetest.register_node(':glass:' .. color, {
|
||||
core.register_node(':glass:' .. color, {
|
||||
description = color:gsub('^%l', string.upper) .. ' Glass',
|
||||
drawtype = 'glasslike_framed_optional',
|
||||
tiles = {'glass_' .. color .. '.png', 'glass_' .. color .. '_detail.png'},
|
||||
@ -73,14 +73,14 @@ for I in pairs(antum.glass.colors) do
|
||||
appendGroupPanes(source, suffix)
|
||||
end
|
||||
|
||||
if minetest.get_modpath('default') then
|
||||
if core.get_modpath('default') then
|
||||
local source = 'default:glass'
|
||||
local suffix = 'glass'
|
||||
appendGroupGlass(source, suffix)
|
||||
appendGroupPanes(source, suffix)
|
||||
end
|
||||
|
||||
if minetest.get_modpath('moreblocks') then
|
||||
if core.get_modpath('moreblocks') then
|
||||
local panes = {
|
||||
'clean', 'coal', 'glow', 'iron', 'super_glow',
|
||||
'trap', 'trap_glow', 'trap_super_glow',
|
||||
|
44
mods/antum/hidename/README.md
Normal file
44
mods/antum/hidename/README.md
Normal file
@ -0,0 +1,44 @@
|
||||
## 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
|
137
mods/antum/hidename/api.lua
Normal file
137
mods/antum/hidename/api.lua
Normal file
@ -0,0 +1,137 @@
|
||||
--[[ 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
|
94
mods/antum/hidename/command.lua
Normal file
94
mods/antum/hidename/command.lua
Normal file
@ -0,0 +1,94 @@
|
||||
--[[ 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,
|
||||
})
|
1
mods/antum/hidename/depends.txt
Normal file
1
mods/antum/hidename/depends.txt
Normal file
@ -0,0 +1 @@
|
||||
intllib?
|
1
mods/antum/hidename/description.txt
Normal file
1
mods/antum/hidename/description.txt
Normal file
@ -0,0 +1 @@
|
||||
Hides player's nametag from view.
|
21
mods/antum/hidename/init.lua
Normal file
21
mods/antum/hidename/init.lua
Normal file
@ -0,0 +1,21 @@
|
||||
--[[ 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
|
26
mods/antum/hidename/locale/template.txt
Normal file
26
mods/antum/hidename/locale/template.txt
Normal file
@ -0,0 +1,26 @@
|
||||
# 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 =
|
5
mods/antum/hidename/mod.conf
Normal file
5
mods/antum/hidename/mod.conf
Normal file
@ -0,0 +1,5 @@
|
||||
name = hidename
|
||||
author = Jordan Irwin (AntumDeluge)
|
||||
description = Hides player's nametag from view.
|
||||
license = MIT
|
||||
version = 0.2
|
58
mods/antum/listitems/README.md
Normal file
58
mods/antum/listitems/README.md
Normal file
@ -0,0 +1,58 @@
|
||||
# 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.)
|
||||
|
||||

|
||||
|
||||
|
||||
---
|
||||
### **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
|
441
mods/antum/listitems/api.lua
Normal file
441
mods/antum/listitems/api.lua
Normal file
@ -0,0 +1,441 @@
|
||||
--[[ 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
|
2
mods/antum/listitems/depends.txt
Normal file
2
mods/antum/listitems/depends.txt
Normal file
@ -0,0 +1,2 @@
|
||||
intllib?
|
||||
mobs?
|
3
mods/antum/listitems/description.txt
Normal file
3
mods/antum/listitems/description.txt
Normal file
@ -0,0 +1,3 @@
|
||||
A very basic chat command to list all registered craft items available in the game.
|
||||
|
||||
Use the command "/listitems [string1] [string2] ..." (no privileges required).
|
28
mods/antum/listitems/init.lua
Normal file
28
mods/antum/listitems/init.lua
Normal file
@ -0,0 +1,28 @@
|
||||
--[[ 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')
|
20
mods/antum/listitems/locale/de.txt
Normal file
20
mods/antum/listitems/locale/de.txt
Normal file
@ -0,0 +1,20 @@
|
||||
# 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:
|
21
mods/antum/listitems/locale/es.txt
Normal file
21
mods/antum/listitems/locale/es.txt
Normal file
@ -0,0 +1,21 @@
|
||||
# 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:
|
28
mods/antum/listitems/locale/template.txt
Normal file
28
mods/antum/listitems/locale/template.txt
Normal file
@ -0,0 +1,28 @@
|
||||
# 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 "•")
|
||||
• =
|
42
mods/antum/listitems/logging.lua
Normal file
42
mods/antum/listitems/logging.lua
Normal file
@ -0,0 +1,42 @@
|
||||
--[[ 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
|
5
mods/antum/listitems/mod.conf
Normal file
5
mods/antum/listitems/mod.conf
Normal file
@ -0,0 +1,5 @@
|
||||
name = listitems
|
||||
author = AntumDeluge
|
||||
description = Chat command that lists registered items.
|
||||
license = MIT
|
||||
version = 0.4
|
BIN
mods/antum/listitems/screenshot.png
Normal file
BIN
mods/antum/listitems/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 246 KiB |
34
mods/antum/listitems/settings.lua
Normal file
34
mods/antum/listitems/settings.lua
Normal file
@ -0,0 +1,34 @@
|
||||
--[[ 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
|
9
mods/antum/listitems/settingtypes.txt
Normal file
9
mods/antum/listitems/settingtypes.txt
Normal file
@ -0,0 +1,9 @@
|
||||
|
||||
# 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
|
37
mods/antum/override/README.md
Normal file
37
mods/antum/override/README.md
Normal file
@ -0,0 +1,37 @@
|
||||
## 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/
|
69
mods/antum/override/api.lua
Normal file
69
mods/antum/override/api.lua
Normal file
@ -0,0 +1,69 @@
|
||||
--[[ 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
|
0
mods/antum/override/description.txt
Normal file
0
mods/antum/override/description.txt
Normal file
62
mods/antum/override/init.lua
Normal file
62
mods/antum/override/init.lua
Normal file
@ -0,0 +1,62 @@
|
||||
--[[ 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
|
44
mods/antum/override/logging.lua
Normal file
44
mods/antum/override/logging.lua
Normal file
@ -0,0 +1,44 @@
|
||||
--[[ 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
|
3
mods/antum/override/mod.conf
Normal file
3
mods/antum/override/mod.conf
Normal file
@ -0,0 +1,3 @@
|
||||
name = override
|
||||
version = 0.1
|
||||
author = Jordan Irwin (AntumDeluge)
|
@ -1,12 +1,20 @@
|
||||
*Antum Overrides*
|
||||
## Antum Overrides (***antum_overrides***) mod for [Minetest][]
|
||||
|
||||
***Overrides for the [Antum game][antum_game] for [Minetest][minetest]***
|
||||
|
||||
License: [MIT][lic.mit]
|
||||
---
|
||||
### **Description**
|
||||
|
||||
Overrides mod for the Minetest sub-game [Antum][antum_game].
|
||||
|
||||
|
||||
---
|
||||
### **Licensing**
|
||||
|
||||
License: [MIT](LICENSE.txt)
|
||||
|
||||
Texture Information:
|
||||
|
||||
[antum_fish_cooked.png] & [antum_fish_raw.png][]:
|
||||
[antum_fish_cooked.png][] & [antum_fish_raw.png][]:
|
||||
* License: CC0
|
||||
* Author: gnokii
|
||||
* Source: [OpenClipart Library][OCL fish]
|
||||
@ -17,6 +25,58 @@ Texture Information:
|
||||
* Source: [OpenClipart Library][OCL meat]
|
||||
|
||||
|
||||
---
|
||||
### **Dependencies**
|
||||
|
||||
**Required:**
|
||||
- [antum_core][]
|
||||
- default (part of [minetest_game][])
|
||||
|
||||
**Optional:**
|
||||
*(**NOTE:** These mods are only used for overriding, they will not affect gameplay)*
|
||||
- animalmaterials (part of [animals_modpack][])
|
||||
- [bags][]
|
||||
- [carts][]
|
||||
- [castle_weapons][]
|
||||
- dye (part of [minetest_game][])
|
||||
- [ethereal][]
|
||||
- farming (part of [minetest_game][])
|
||||
- flowers (part of [minetest_game][])
|
||||
- helicopter (recommends [petermaloney's fork][helicopter])
|
||||
- [invisibility][]
|
||||
- mobs ([mobs_redo][])
|
||||
- [moreblocks][]
|
||||
- [simple_protection][]
|
||||
- [throwing][]
|
||||
- [unifieddyes][]
|
||||
- vessels (part of [minetest_game][])
|
||||
- walking_light (recommends [petermaloney's fork][walking_light])
|
||||
- wool (part of [minetest_game][])
|
||||
- [craft_guide][]
|
||||
- [craftguide][]
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[animals_modpack]: https://forum.minetest.net/viewtopic.php?t=629
|
||||
[antum_core]: https://github.com/AntumMT/mod-antum_core
|
||||
[antum_game]: https://github.com/AntumMT/game-antum
|
||||
[bags]: https://forum.minetest.net/viewtopic.php?t=3081
|
||||
[carts]: https://forum.minetest.net/viewtopic.php?t=2451
|
||||
[castle_weapons]: https://github.com/minetest-mods/castle_weapons
|
||||
[ethereal]: https://forum.minetest.net/viewtopic.php?t=14638
|
||||
[helicopter]: https://github.com/petermaloney/helicopter
|
||||
[invisibility]: https://forum.minetest.net/viewtopic.php?t=14846
|
||||
[minetest_game]: https://github.com/minetest/minetest_game
|
||||
[mobs_redo]: https://forum.minetest.net/viewtopic.php?t=9917
|
||||
[moreblocks]: https://forum.minetest.net/viewtopic.php?t=509
|
||||
[simple_protection]: https://forum.minetest.net/viewtopic.php?t=9035
|
||||
[throwing]: https://forum.minetest.net/viewtopic.php?t=687
|
||||
[unifieddyes]: https://forum.minetest.net/viewtopic.php?t=2178
|
||||
[walking_light]: https://github.com/petermaloney/walking_light
|
||||
[craft_guide]: https://forum.minetest.net/viewtopic.php?t=2334
|
||||
[craftguide]: https://forum.minetest.net/viewtopic.php?t=14088
|
||||
|
||||
[OCL fish]: https://openclipart.org/detail/133141/sashimi
|
||||
[OCL meat]: https://openclipart.org/detail/211419/fleischkeule
|
||||
|
||||
@ -24,8 +84,3 @@ Texture Information:
|
||||
[antum_fish_raw.png]: textures/antum_fish_raw.png
|
||||
[antum_meat_cooked.png]: textures/antum_meat_cooked.png
|
||||
[antum_meat_raw.png]: textures/antum_meat_raw.png
|
||||
|
||||
[lic.mit]: ../LICENSE.txt
|
||||
|
||||
[antum_game]: https://github.com/AntumDeluge/minetest-game-antum
|
||||
[minetest]: http://minetest.net/
|
||||
|
@ -37,7 +37,7 @@ local modoverrides = {
|
||||
}
|
||||
|
||||
for index, modname in ipairs(modoverrides) do
|
||||
if minetest.get_modpath(modname) then
|
||||
if core.get_modpath(modname) then
|
||||
if antum.verbose then
|
||||
antum.logAction('DEBUG: found mod \"' .. modname .. '\"')
|
||||
end
|
||||
|
@ -33,27 +33,27 @@ bags.depends = {
|
||||
bags.satisfied = true
|
||||
|
||||
for I in pairs(bags.depends) do
|
||||
if not minetest.get_modpath(bags.depends[I]) then
|
||||
if not core.get_modpath(bags.depends[I]) then
|
||||
bags.satisfied = false
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if bags.satisfied then
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
recipe = {
|
||||
{"", "default:stick", ""},
|
||||
{"default:wood", "default:wood", "default:wood"},
|
||||
{"default:wood", "default:wood", "default:wood"},
|
||||
},
|
||||
})
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
recipe = {
|
||||
{"bags:small", "bags:small"},
|
||||
{"bags:small", "bags:small"},
|
||||
},
|
||||
})
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
recipe = {
|
||||
{"bags:medium", "bags:medium"},
|
||||
{"bags:medium", "bags:medium"},
|
||||
|
@ -31,7 +31,7 @@ local depends = {
|
||||
}
|
||||
|
||||
for I in pairs(depends) do
|
||||
if not minetest.get_modpath(depends[I]) then
|
||||
if not core.get_modpath(depends[I]) then
|
||||
depends_satisfied = false
|
||||
end
|
||||
end
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
-- Recipe for 'throwing:arrow' conflicts with 'castle_weapons:crossbow_bolt'
|
||||
-- TODO: 'antum:feather' item should be moved to 'antum_items' mod
|
||||
if antum.dependsSatisfied({'throwing', 'antum_core'}) then
|
||||
if antum.dependsSatisfied({'throwing', 'antum'}) then
|
||||
-- TODO: Possible alternate solutions:
|
||||
-- * Allow 'throwing:arrow' to be used as ammo for 'castle_weapons:crossbow'
|
||||
|
||||
-- FIXME: Cannot use 'antum.overrideCraftOutput' because 'minetest.clear_craft' does not allow
|
||||
-- FIXME: Cannot use 'antum.overrideCraftOutput' because 'core.clear_craft' does not allow
|
||||
-- clearing craft by output with quantity. E.g., 'castle_weapons:crossbow_bolt 6'.
|
||||
-- - Solution 1: Parse whitespace in 'output'
|
||||
antum.clearCraftOutput('castle_weapons:crossbow_bolt')
|
||||
|
@ -30,12 +30,12 @@ local function registerDyeRecipes(def)
|
||||
local dye = 'dye:' .. T[1]
|
||||
local ingredients = T[2]
|
||||
-- DEBUG
|
||||
minetest.log('action', '[antum_overrides] Registering new recipe for dye:' .. T[1] .. ' with the following ingredients:')
|
||||
core.log('action', '[antum_overrides] Registering new recipe for dye:' .. T[1] .. ' with the following ingredients:')
|
||||
for i in pairs(ingredients) do
|
||||
minetest.log('action', '[antum_overrides]\t' .. ingredients[i])
|
||||
core.log('action', '[antum_overrides]\t' .. ingredients[i])
|
||||
end
|
||||
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = dye,
|
||||
type = 'shapeless',
|
||||
recipe = ingredients,
|
||||
@ -45,7 +45,7 @@ end
|
||||
|
||||
local dye_defs = {}
|
||||
|
||||
if minetest.get_modpath('flowers') then
|
||||
if core.get_modpath('flowers') then
|
||||
table.insert(dye_defs, -1, {'brown 4', {'flowers:mushroom_brown'}})
|
||||
end
|
||||
|
||||
|
@ -31,7 +31,7 @@ cotton.aliases = {"thread", "string"}
|
||||
|
||||
cotton.dependencies.satisfied = false
|
||||
for dep in pairs(cotton.dependencies) do
|
||||
if minetest.get_modpath(dep) then
|
||||
if core.get_modpath(dep) then
|
||||
cotton.dependencies.satisfied = true
|
||||
end
|
||||
end
|
||||
@ -46,6 +46,6 @@ if cotton.dependencies.satisfied then
|
||||
|
||||
-- Add aliases for cotton
|
||||
for alias in pairs(cotton.aliases) do
|
||||
minetest.register_alias("farming:" .. alias, "farming:cotton")
|
||||
core.register_alias("farming:" .. alias, "farming:cotton")
|
||||
end
|
||||
end
|
||||
|
@ -35,7 +35,7 @@ local depends = {
|
||||
}
|
||||
|
||||
for I in pairs(depends) do
|
||||
if not minetest.get_modpath(depends[I]) then
|
||||
if not core.get_modpath(depends[I]) then
|
||||
depends_satisfied = false
|
||||
end
|
||||
end
|
||||
@ -43,7 +43,7 @@ end
|
||||
if depends_satisfied then
|
||||
-- Override vessels:glass_bottle
|
||||
--[[
|
||||
minetest.override_item('vessels:glass_bottle', {
|
||||
core.override_item('vessels:glass_bottle', {
|
||||
description = 'Glass Bottle (empty)',
|
||||
drawtype = 'plantlike',
|
||||
tiles = {'vessels_glass_bottle.png'},
|
||||
@ -64,7 +64,7 @@ if depends_satisfied then
|
||||
return
|
||||
end
|
||||
-- Check if pointing to a liquid source
|
||||
local node = minetest.get_node(pointed_thing.under)
|
||||
local node = core.get_node(pointed_thing.under)
|
||||
local liquiddef = bucket.liquids[node.name]
|
||||
local item_count = user:get_wielded_item():get_count()
|
||||
|
||||
@ -98,7 +98,7 @@ if depends_satisfied then
|
||||
|
||||
end
|
||||
|
||||
minetest.add_node(pointed_thing.under, {name='air'})
|
||||
core.add_node(pointed_thing.under, {name='air'})
|
||||
|
||||
return ItemStack(giving_back)
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
antum_core
|
||||
antum
|
||||
default
|
||||
override
|
||||
animalmaterials?
|
||||
|
@ -25,12 +25,12 @@
|
||||
--]]
|
||||
|
||||
|
||||
-- NOTE: This mod depends on the method 'minetest.unregister_item()' by paly2.
|
||||
-- NOTE: This mod depends on the method 'core.unregister_item()' by paly2.
|
||||
-- As of writing, the Mineteset main branch does not include it.
|
||||
|
||||
antum.overrides = {}
|
||||
antum.overrides.modname = minetest.get_current_modname()
|
||||
antum.overrides.modpath = minetest.get_modpath(antum.overrides.modname)
|
||||
antum.overrides.modname = core.get_current_modname()
|
||||
antum.overrides.modpath = core.get_modpath(antum.overrides.modname)
|
||||
|
||||
--local scripts = {
|
||||
antum.loadScripts({
|
||||
|
@ -35,7 +35,7 @@ local modoverrides = {
|
||||
|
||||
for I in pairs(modoverrides) do
|
||||
local modname = modoverrides[I]
|
||||
if minetest.get_modpath(modname) then
|
||||
if core.get_modpath(modname) then
|
||||
antum.loadScript('items/' .. modname)
|
||||
end
|
||||
end
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if minetest.global_exists("intllib") then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if core.global_exists("intllib") then
|
||||
dofile(core.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib.make_gettext_pair then
|
||||
S = intllib.make_gettext_pair("animalmaterials")
|
||||
else
|
||||
@ -46,7 +46,7 @@ local delete_items = {
|
||||
}
|
||||
|
||||
for I in pairs(delete_items) do
|
||||
minetest.unregister_item('animalmaterials:' .. delete_items[I])
|
||||
core.unregister_item('animalmaterials:' .. delete_items[I])
|
||||
end
|
||||
|
||||
|
||||
@ -55,42 +55,42 @@ end
|
||||
|
||||
-- Fish
|
||||
|
||||
minetest.register_craftitem(':animalmaterials:fish_bluewhite', {
|
||||
core.register_craftitem(':animalmaterials:fish_bluewhite', {
|
||||
description = 'Raw Bluewhite Fish',
|
||||
image = 'fish_raw.png',
|
||||
on_use = minetest.item_eat(1),
|
||||
on_use = core.item_eat(1),
|
||||
groups = { meat=1, eatable=1 },
|
||||
stack_max = 25
|
||||
})
|
||||
minetest.register_alias('fish_bluewhite_raw', 'animalmaterials:fish_bluewhite')
|
||||
core.register_alias('fish_bluewhite_raw', 'animalmaterials:fish_bluewhite')
|
||||
|
||||
minetest.register_craftitem(':animalmaterials:fish_clownfish', {
|
||||
core.register_craftitem(':animalmaterials:fish_clownfish', {
|
||||
description = 'Raw Clownfish',
|
||||
image = 'fish_raw.png',
|
||||
on_use = minetest.item_eat(1),
|
||||
on_use = core.item_eat(1),
|
||||
groups = { meat=1, eatable=1 },
|
||||
stack_max = 25
|
||||
})
|
||||
minetest.register_alias('clownfish_raw', 'animalmaterials:fish_clownfish')
|
||||
core.register_alias('clownfish_raw', 'animalmaterials:fish_clownfish')
|
||||
|
||||
|
||||
-- Fur group
|
||||
|
||||
minetest.register_craftitem(":animalmaterials:fur", {
|
||||
core.register_craftitem(":animalmaterials:fur", {
|
||||
description = S("Fur"),
|
||||
image = "animalmaterials_fur.png",
|
||||
stack_max=25,
|
||||
groups = {fur = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":animalmaterials:fur_deer", {
|
||||
core.register_craftitem(":animalmaterials:fur_deer", {
|
||||
description = S("Deer fur"),
|
||||
image = "animalmaterials_deer_fur.png",
|
||||
stack_max=10,
|
||||
groups = {fur = 1},
|
||||
})
|
||||
|
||||
minetest.register_craftitem(":animalmaterials:coat_cattle", {
|
||||
core.register_craftitem(":animalmaterials:coat_cattle", {
|
||||
description = S("Cattle coat"),
|
||||
image = "animalmaterials_cattle_coat.png",
|
||||
stack_max=10,
|
||||
|
@ -25,7 +25,7 @@
|
||||
--]]
|
||||
|
||||
|
||||
minetest.register_craftitem(':cooking:fish_bluewhite_cooked', {
|
||||
core.register_craftitem(':cooking:fish_bluewhite_cooked', {
|
||||
description = 'Cooked Bluewhite Fish',
|
||||
image = 'fish_cooked.png',
|
||||
on_use = core.item_eat(6),
|
||||
@ -33,9 +33,9 @@ minetest.register_craftitem(':cooking:fish_bluewhite_cooked', {
|
||||
stack_max = 25
|
||||
})
|
||||
|
||||
minetest.register_alias('fish_bluewhite_cooked', 'cooking:fish_bluewhite_cooked')
|
||||
core.register_alias('fish_bluewhite_cooked', 'cooking:fish_bluewhite_cooked')
|
||||
|
||||
minetest.register_craftitem(':cooking:fish_clownfish_cooked', {
|
||||
core.register_craftitem(':cooking:fish_clownfish_cooked', {
|
||||
description = 'Cooked Clownfish',
|
||||
image = 'fish_cooked.png',
|
||||
on_use = core.item_eat(6),
|
||||
@ -43,4 +43,4 @@ minetest.register_craftitem(':cooking:fish_clownfish_cooked', {
|
||||
stack_max = 25
|
||||
})
|
||||
|
||||
minetest.register_alias('clownfish_cooked', 'cooking:fish_clownfish_cooked')
|
||||
core.register_alias('clownfish_cooked', 'cooking:fish_clownfish_cooked')
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
-- Boilerplate to support localized strings if intllib mod is installed.
|
||||
local S
|
||||
if minetest.global_exists("intllib") then
|
||||
dofile(minetest.get_modpath("intllib").."/intllib.lua")
|
||||
if core.global_exists("intllib") then
|
||||
dofile(core.get_modpath("intllib").."/intllib.lua")
|
||||
if intllib.make_gettext_pair then
|
||||
S = intllib.make_gettext_pair("mobs")
|
||||
else
|
||||
@ -44,7 +44,7 @@ end
|
||||
|
||||
-- Fur group
|
||||
|
||||
minetest.register_craftitem(":mobs:leather", {
|
||||
core.register_craftitem(":mobs:leather", {
|
||||
description = S("Leather"),
|
||||
inventory_image = "mobs_leather.png",
|
||||
groups = {fur = 1},
|
||||
|
@ -28,5 +28,5 @@
|
||||
local sp = 'simple_protection'
|
||||
local sp_claim = sp .. ':claim'
|
||||
|
||||
minetest.register_alias(sp .. ':claim_stick', sp_claim)
|
||||
minetest.register_alias('claim_stick', sp_claim)
|
||||
core.register_alias(sp .. ':claim_stick', sp_claim)
|
||||
core.register_alias('claim_stick', sp_claim)
|
||||
|
@ -31,7 +31,7 @@ local modoverrides = {
|
||||
|
||||
for I in pairs(modoverrides) do
|
||||
local modname = modoverrides[I]
|
||||
if minetest.get_modpath(modname) then
|
||||
if core.get_modpath(modname) then
|
||||
antum.loadScript('misc/' .. modname)
|
||||
end
|
||||
end
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
local addLightItems = function(mod, itemlist)
|
||||
if minetest.get_modpath(mod) then
|
||||
if core.get_modpath(mod) then
|
||||
for I in pairs(itemlist) do
|
||||
walking_light.addLightItem(mod .. ':' .. itemlist[I])
|
||||
end
|
||||
@ -55,6 +55,6 @@ addLightItems('ethereal', {
|
||||
--[[ DEBUG
|
||||
local light_items = walking_light.getLightItems()
|
||||
for I in pairs(light_items) do
|
||||
minetest.log('action', '[walking_light] Light item: \"' .. light_items[I] .. '\"')
|
||||
core.log('action', '[walking_light] Light item: \"' .. light_items[I] .. '\"')
|
||||
end
|
||||
--]]
|
||||
|
@ -31,7 +31,7 @@ local modoverrides = {
|
||||
|
||||
for I in pairs(modoverrides) do
|
||||
local modname = modoverrides[I]
|
||||
if minetest.get_modpath(modname) then
|
||||
if core.get_modpath(modname) then
|
||||
antum.loadScript('nodes/' .. modname)
|
||||
end
|
||||
end
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
-- Return default tree leaves back to original except make walkable (collides)
|
||||
|
||||
minetest.override_item('default:leaves', {
|
||||
core.override_item('default:leaves', {
|
||||
description = "Leaves",
|
||||
drawtype = 'allfaces_optional',
|
||||
waving = 1,
|
||||
@ -58,7 +58,7 @@ minetest.override_item('default:leaves', {
|
||||
walkable = true,
|
||||
})
|
||||
|
||||
minetest.override_item('default:jungleleaves', {
|
||||
core.override_item('default:jungleleaves', {
|
||||
description = "Jungle Leaves",
|
||||
drawtype = 'allfaces_optional',
|
||||
waving = 1,
|
||||
|
@ -1,10 +1,18 @@
|
||||
# Antum Spawneggs
|
||||
## Antum Spawneggs (***antum_spawneggs***) mod for [Minetest][]
|
||||
|
||||
***Spawneggs for the [Antum game][antum_game] for [Minetest][minetest]***
|
||||
|
||||
License: [MIT][lic.mit]
|
||||
---
|
||||
### **Description**
|
||||
|
||||
The code for the spawneggs is based on [Rui's creeper mod][mod.creeper] ([WTFPL][lic.creeper]). Anything else is licensed under the [MIT License
|
||||
Spawneggs mod for the Minetest sub-game [Antum][antum_game].
|
||||
|
||||
|
||||
---
|
||||
### **Licensing**
|
||||
|
||||
License: [MIT](LICENSE.txt)
|
||||
|
||||
The code for the spawneggs is based on [Rui's creeper mod][creeper] ([WTFPL][lic.creeper]). Anything else is licensed under the MIT License
|
||||
|
||||
#### Texture licensing
|
||||
* egg.png, spawneggs_chicken.png, & spawneggs_mese.png
|
||||
@ -14,13 +22,39 @@ The code for the spawneggs is based on [Rui's creeper mod][mod.creeper] ([WTFPL]
|
||||
* [CC0][lic.cc0]
|
||||
* Based on ["Huevo negro. Black egg" by mediobit][img.egg_black]
|
||||
|
||||
[antum_game]: https://github.com/AntumDeluge/minetest-game-antum
|
||||
[minetest]: http://minetest.net/
|
||||
|
||||
---
|
||||
### **Dependencies**
|
||||
|
||||
**Required:**
|
||||
- **[antum_core][]**
|
||||
- **[spawneggs][]**
|
||||
|
||||
**Optional:**
|
||||
- **animal_chicken** (part of [animals_modpack][])
|
||||
- **chicken** (part of [mob-engine][])
|
||||
- **default** (part of [minetest_game][])
|
||||
- **mobs** ([mobs_redo][])
|
||||
- **[mobs_monster][]**
|
||||
- **oerrki** (part of [mob-engine][])
|
||||
- **sheep** (part of [mob-engine][])
|
||||
- **wool** (part of [minetest_game][])
|
||||
|
||||
|
||||
[Minetest]: http://www.minetest.net/
|
||||
|
||||
[animals_modpack]: https://github.com/sapier/animals_modpack
|
||||
[antum_core]: https://github.com/AntumMT/mod-antum_core
|
||||
[antum_game]: https://github.com/AntumMT/game-antum
|
||||
[creeper]: https://forum.minetest.net/viewtopic.php?t=11891
|
||||
[minetest_game]: https://github.com/minetest/minetest_game
|
||||
[mob-engine]: https://github.com/minetest-mods/mob-engine
|
||||
[mobs_monster]: https://github.com/tenplus1/mobs_monster
|
||||
[mobs_redo]: https://forum.minetest.net/viewtopic.php?t=9917
|
||||
[spawneggs]: https://forum.minetest.net/viewtopic.php?t=6214
|
||||
|
||||
[img.egg_white]: https://openclipart.org/detail/6695/white-egg
|
||||
[img.egg_black]: https://openclipart.org/detail/170074/huevo-negro-black-egg
|
||||
|
||||
[mod.creeper]: https://forum.minetest.net/viewtopic.php?t=11891
|
||||
|
||||
[lic.cc0]: https://creativecommons.org/publicdomain/zero/1.0/legalcode
|
||||
[lic.creeper]: https://github.com/Rui-Minetest/creeper/blob/master/LICENSE.md
|
||||
[lic.mit]: ../LICENSE.txt
|
||||
|
@ -1,4 +1,4 @@
|
||||
antum_core
|
||||
antum
|
||||
spawneggs
|
||||
animal_chicken?
|
||||
chicken?
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
antum.spawneggs.addEggRecipe = function(name, spawn, ingredients)
|
||||
table.insert(ingredients, 1, 'spawneggs:egg')
|
||||
minetest.register_craft({
|
||||
core.register_craft({
|
||||
output = 'spawneggs:' .. name,
|
||||
type = 'shapeless',
|
||||
recipe = ingredients,
|
||||
@ -36,7 +36,7 @@ antum.spawneggs.addEggRecipe = function(name, spawn, ingredients)
|
||||
end
|
||||
|
||||
antum.spawneggs.addEgg = function(name, spawn, ingredients)
|
||||
minetest.register_craftitem(':spawneggs:' .. name, {
|
||||
core.register_craftitem(':spawneggs:' .. name, {
|
||||
description = name:gsub("^%l", string.upper) .. ' Spawn Egg',
|
||||
inventory_image = 'spawneggs_' .. name ..'.png',
|
||||
|
||||
@ -44,8 +44,8 @@ antum.spawneggs.addEgg = function(name, spawn, ingredients)
|
||||
if target.type == 'node' then
|
||||
local pos = target.above
|
||||
pos.y = pos.y + 1
|
||||
minetest.add_entity(pos, spawn)
|
||||
if not minetest.settings:get_bool('creative_mode') then
|
||||
core.add_entity(pos, spawn)
|
||||
if not core.settings:get_bool('creative_mode') then
|
||||
itemstack:take_item()
|
||||
end
|
||||
|
||||
@ -62,7 +62,7 @@ end
|
||||
|
||||
|
||||
|
||||
if minetest.get_modpath('spawneggs') then
|
||||
if core.get_modpath('spawneggs') then
|
||||
-- Clear all spawneggs
|
||||
local spawneggs_default = {
|
||||
'dirt_monster', 'dungeon_master', 'oerkki', 'rat',
|
||||
@ -70,7 +70,7 @@ if minetest.get_modpath('spawneggs') then
|
||||
}
|
||||
|
||||
for I in pairs(spawneggs_default) do
|
||||
minetest.clear_craft({
|
||||
core.clear_craft({
|
||||
output = 'spawneggs:' .. spawneggs_default[I],
|
||||
})
|
||||
end
|
||||
@ -78,22 +78,22 @@ end
|
||||
|
||||
|
||||
-- Sheep spawnegg
|
||||
if minetest.get_modpath('sheep') and minetest.get_modpath('wool') then
|
||||
if core.get_modpath('sheep') and core.get_modpath('wool') then
|
||||
antum.spawneggs.addEgg('sheep', 'creatures:sheep', {'group:wool'})
|
||||
end
|
||||
|
||||
-- Oerrki spawnegg
|
||||
if minetest.get_modpath('oerrki') and minetest.get_modpath('default') then
|
||||
if core.get_modpath('oerrki') and core.get_modpath('default') then
|
||||
antum.spawneggs.addEgg('oerrki', 'creatures:oerrki', {'default:obsidian'})
|
||||
end
|
||||
|
||||
-- Chicken spawnegg
|
||||
if minetest.get_modpath('chicken') then
|
||||
if core.get_modpath('chicken') then
|
||||
antum.spawneggs.addEgg('chicken', 'creatures:chicken', {'creatures:feather'})
|
||||
end
|
||||
|
||||
-- mobs_redo monsters
|
||||
if minetest.get_modpath('mobs_monster') and minetest.get_modpath('default') then
|
||||
if core.get_modpath('mobs_monster') and core.get_modpath('default') then
|
||||
|
||||
-- Dirt monster
|
||||
antum.spawneggs.addEgg('dirt_monster', 'mobs_monster:dirt_monster', {'default:dirt'})
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
antum.spawneggs = {}
|
||||
|
||||
antum.spawneggs.modname = minetest.get_current_modname()
|
||||
antum.spawneggs.modpath = minetest.get_modpath(antum.spawneggs.modname)
|
||||
antum.spawneggs.modname = core.get_current_modname()
|
||||
antum.spawneggs.modpath = core.get_modpath(antum.spawneggs.modname)
|
||||
|
||||
antum.loadScript('eggs')
|
||||
|
Loading…
x
Reference in New Issue
Block a user