mirror of
https://git.0x7be.net/dirk/uniham.git
synced 2024-11-25 00:33:49 +01:00
adapt mod to 5.0.0 changes
This commit is contained in:
parent
74944af904
commit
9186bb8de5
@ -1,2 +0,0 @@
|
||||
default
|
||||
moreores?
|
3
mod.conf
3
mod.conf
@ -1 +1,4 @@
|
||||
name = uniham
|
||||
depends = default
|
||||
optional_depends = moreores
|
||||
descripton = The mod adds various hammers that can be used to crush nodes and an API to register own hammers. See <https://gitlab.com/4w/uniham> for details and documentation
|
||||
|
@ -1,9 +1,8 @@
|
||||
-- Localize & Initialize
|
||||
local register_hammer = uniham.register_hammer
|
||||
local modpath = uniham.modpath
|
||||
local registry = modpath..DIR_DELIM..'registry'
|
||||
local depends = io.open(modpath..DIR_DELIM..'depends.txt', 'rb')
|
||||
local log_prefix = '['..minetest.get_current_modname()..'] '
|
||||
local registry = modpath..DIR_DELIM..'registry'
|
||||
|
||||
|
||||
-- Check if a file exists
|
||||
@ -23,16 +22,11 @@ local file_exists = function (file_name)
|
||||
end
|
||||
|
||||
|
||||
-- Check if the depends.txt file was read properly
|
||||
-- Iterate over all lines
|
||||
-- Check if the mod exists
|
||||
-- Check if a registry file exists
|
||||
-- dofile() the file and print a log message
|
||||
if depends ~= nil then
|
||||
local lines = {}
|
||||
for line in depends:lines() do
|
||||
local modname = line:gsub('?', '')
|
||||
if minetest.get_modpath(modname) then
|
||||
-- Load built-in support for supported mods
|
||||
local config = Settings(modpath..DIR_DELIM..'mod.conf')
|
||||
local depends = config:get('depends')..', '..config:get('optional_depends')
|
||||
|
||||
for modname in depends:gmatch('[0-9a-z_-]+') do
|
||||
local registry_file = registry..DIR_DELIM..modname..'.lua'
|
||||
if file_exists(registry_file) then
|
||||
dofile(registry_file)
|
||||
@ -40,5 +34,3 @@ if depends ~= nil then
|
||||
minetest.log('action', log_prefix..message)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user