mirror of
https://git.0x7be.net/dirk/uniham.git
synced 2024-08-20 04:34:08 +02: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
|
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
|
-- Localize & Initialize
|
||||||
local register_hammer = uniham.register_hammer
|
local register_hammer = uniham.register_hammer
|
||||||
local modpath = uniham.modpath
|
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 log_prefix = '['..minetest.get_current_modname()..'] '
|
||||||
|
local registry = modpath..DIR_DELIM..'registry'
|
||||||
|
|
||||||
|
|
||||||
-- Check if a file exists
|
-- Check if a file exists
|
||||||
@ -23,22 +22,15 @@ local file_exists = function (file_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Check if the depends.txt file was read properly
|
-- Load built-in support for supported mods
|
||||||
-- Iterate over all lines
|
local config = Settings(modpath..DIR_DELIM..'mod.conf')
|
||||||
-- Check if the mod exists
|
local depends = config:get('depends')..', '..config:get('optional_depends')
|
||||||
-- Check if a registry file exists
|
|
||||||
-- dofile() the file and print a log message
|
for modname in depends:gmatch('[0-9a-z_-]+') do
|
||||||
if depends ~= nil then
|
local registry_file = registry..DIR_DELIM..modname..'.lua'
|
||||||
local lines = {}
|
if file_exists(registry_file) then
|
||||||
for line in depends:lines() do
|
dofile(registry_file)
|
||||||
local modname = line:gsub('?', '')
|
local message = 'Loaded built-in '..modname..' support'
|
||||||
if minetest.get_modpath(modname) then
|
minetest.log('action', log_prefix..message)
|
||||||
local registry_file = registry..DIR_DELIM..modname..'.lua'
|
|
||||||
if file_exists(registry_file) then
|
|
||||||
dofile(registry_file)
|
|
||||||
local message = 'Loaded built-in '..modname..' support'
|
|
||||||
minetest.log('action', log_prefix..message)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user