From ce43be5a707bddd3b3544583fd7cfea2b4c8e9e8 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Wed, 3 May 2017 20:07:21 -0700 Subject: [PATCH] [antum] Modpack: Update to Git commit 4477d40: https://github.com/AntumDeluge/mtmp-antum/tree/4477d40 --- README.md | 4 +- mods/mp_antum/antum/functions.lua | 45 +++++++++++++------ mods/mp_antum/antum/items.lua | 4 +- mods/mp_antum/craft/crafting.lua | 4 +- mods/mp_antum/craft/init.lua | 2 +- mods/mp_antum/entities/init.lua | 13 ++---- mods/mp_antum/glass/crafting.lua | 2 +- mods/mp_antum/glass/init.lua | 6 ++- mods/mp_antum/glass/nodes.lua | 4 +- mods/mp_antum/overrides/crafting.lua | 10 ++--- mods/mp_antum/overrides/crafting/bags.lua | 6 +-- mods/mp_antum/overrides/crafting/carts.lua | 2 +- .../overrides/crafting/coloredwood.lua | 2 +- .../overrides/crafting/craftguide.lua | 2 +- mods/mp_antum/overrides/crafting/farming.lua | 2 +- .../overrides/crafting/helicopter.lua | 2 +- .../overrides/crafting/invisibility.lua | 2 +- mods/mp_antum/overrides/init.lua | 15 ++++--- mods/mp_antum/overrides/items.lua | 4 +- mods/mp_antum/overrides/misc.lua | 4 +- mods/mp_antum/overrides/nodes.lua | 4 +- mods/mp_antum/spawneggs/eggs.lua | 2 +- mods/mp_antum/spawneggs/init.lua | 2 +- 23 files changed, 75 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index 6e6c9714..f6fe37f6 100644 --- a/README.md +++ b/README.md @@ -144,7 +144,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m * mob_shark ([CC BY-SA][lic.amp_shark]) * mob_slime ([CC0 / CC BY / CC BY-SA / CC0][lic.amp_slime]) * mob_warthog ([CC BY / CC BY-SA][lic.amp_warthog]) -* [antum][] ([MIT][lic.antum]) -- version: [2f1e895 Git][ver.antum] +* [antum][] ([MIT][lic.antum]) -- version: [4477d40 Git][ver.antum] * mp_antum/ * antum * craft @@ -343,7 +343,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m [ver.3d_armor]: https://github.com/stujones11/minetest-3d_armor/tree/456c84e [ver.adv_spawning]: https://github.com/sapier/adv_spawning/tree/ec41aa9 -[ver.antum]: https://github.com/AntumDeluge/mtmp-antum/tree/2f1e895 +[ver.antum]: https://github.com/AntumDeluge/mtmp-antum/tree/4477d40 [ver.areas]: https://github.com/ShadowNinja/areas/tree/67507c7 [ver.awards]: https://github.com/minetest-mods/awards/tree/92c43d1 [ver.bedrock2]: http://repo.or.cz/minetest_bedrock2.git/tree/0378b61 diff --git a/mods/mp_antum/antum/functions.lua b/mods/mp_antum/antum/functions.lua index 658b3149..2db77177 100644 --- a/mods/mp_antum/antum/functions.lua +++ b/mods/mp_antum/antum/functions.lua @@ -26,25 +26,28 @@ -- Displays a message in the log -function antum.log(level, mod, message) - minetest.log(level, '[' .. mod .. '] ' .. message) +function antum.log(level, message) + minetest.log(level, '[' .. minetest.get_current_modname() .. '] ' .. message) end -function antum.log_action(mod, message) - antum.log('action', mod, message) +function antum.logAction(message) + antum.log('action', message) end -function antum.log_warn(mod, message) - antum.log('warning', mod, message) +function antum.logWarn(message) + antum.log('warning', message) +end + +function antum.logError(message) + antum.log('error', message) end -- Checks if a file exists -function antum.file_exists(file_path) +function antum.fileExists(file_path) local fexists = io.open(file_path, 'r') if fexists == nil then - minetest.log('error', '[' .. antum.modname .. '] Could not load script: ' .. file_path) return false end @@ -52,18 +55,34 @@ function antum.file_exists(file_path) end +-- Retrieves path for currently loaded mod +function antum.getCurrentModPath() + return minetest.get_modpath(minetest.get_current_modname()) +end + + -- Loads a mod sub-script -function antum.load_script(mod_path, script_name) - local script = mod_path .. '/' .. script_name .. '.lua' +function antum.loadScript(script_name) + local script = antum.getCurrentModPath() .. '/' .. script_name .. '.lua' - if antum.file_exists(script) then + if antum.fileExists(script) then dofile(script) + else + antum.logError('Could not load, script does not exists: ' .. script) + end +end + + +-- Loads multiple mod sub-scripts +function antum.loadScripts(script_list) + for I in pairs(script_list) do + antum.loadScript(script_list[I]) end end -- Registers a craft & displays a log message -function antum.register_craft(craft) - antum.log_action(minetest.get_current_modname(), 'Registering craft recipe for "' .. craft.output .. '"') +function antum.registerCraft(craft) + antum.logAction('Registering craft recipe for "' .. craft.output .. '"') minetest.register_craft(craft) end diff --git a/mods/mp_antum/antum/items.lua b/mods/mp_antum/antum/items.lua index 66f8c8cb..73182b42 100644 --- a/mods/mp_antum/antum/items.lua +++ b/mods/mp_antum/antum/items.lua @@ -46,7 +46,7 @@ minetest.register_craftitem('antum:bottled_water', { if depends_satisfied then - antum.register_craft({ + antum.registerCraft({ output = 'antum:bottled_water', type = 'shapeless', recipe = { @@ -57,5 +57,5 @@ if depends_satisfied then }, }) else - antum.log_warn(antum.modname, 'Not registering craft for "' .. antum.modname .. ':bottled_water", dependency not satisfied') + antum.logWarn(antum.modname, 'Not registering craft for "' .. antum.modname .. ':bottled_water", dependency not satisfied') end diff --git a/mods/mp_antum/craft/crafting.lua b/mods/mp_antum/craft/crafting.lua index 207096f3..cea5a05b 100644 --- a/mods/mp_antum/craft/crafting.lua +++ b/mods/mp_antum/craft/crafting.lua @@ -26,7 +26,7 @@ -- Nyan cat blocks -antum.register_craft({ +antum.registerCraft({ output = "default:nyancat_rainbow", recipe = { {'', 'dye:red', '',}, @@ -37,7 +37,7 @@ antum.register_craft({ -- Walking light items -antum.register_craft({ +antum.registerCraft({ output = 'walking_light:helmet_gold', recipe = { {'default:torch'}, diff --git a/mods/mp_antum/craft/init.lua b/mods/mp_antum/craft/init.lua index 742bb345..d4bccd01 100644 --- a/mods/mp_antum/craft/init.lua +++ b/mods/mp_antum/craft/init.lua @@ -38,5 +38,5 @@ local scripts = { } for I in pairs(scripts) do - antum.load_script(antum.craft.modpath, scripts[I]) + antum.loadScript(scripts[I]) end diff --git a/mods/mp_antum/entities/init.lua b/mods/mp_antum/entities/init.lua index a89b2b1f..dee8e478 100644 --- a/mods/mp_antum/entities/init.lua +++ b/mods/mp_antum/entities/init.lua @@ -30,13 +30,8 @@ antum.entities.modname = minetest.get_current_modname() antum.entities.modpath = minetest.get_modpath(antum.entities.modname) -local function logAction(message) - minetest.log('action', '[' .. antum.entities.modname .. '] ' .. message) -end - - -- Loading entity definitions -logAction('Loading entity definitions ...') +antum.logAction('Loading entity definitions ...') antum.def = {} local defs = { @@ -44,16 +39,16 @@ local defs = { } for I in pairs(defs) do - dofile(antum.entities.modpath .. '/definitions/' .. defs[I] .. '.lua') + antum.loadScript('definitions/' .. defs[I]) end -- Loading entity types -logAction('Loading entity types ...') +antum.logAction('Loading entity types ...') local types = { 'hostile', 'peaceful', 'npc', } for I in pairs(types) do - dofile(antum.entities.modpath .. '/types/' .. types[I] .. '.lua') + antum.loadScript('types/' .. types[I]) end diff --git a/mods/mp_antum/glass/crafting.lua b/mods/mp_antum/glass/crafting.lua index 53882ae8..7985ec35 100644 --- a/mods/mp_antum/glass/crafting.lua +++ b/mods/mp_antum/glass/crafting.lua @@ -28,7 +28,7 @@ for I in pairs(antum.glass.colors) do local color = antum.glass.colors[I] - antum.register_craft({ + antum.registerCraft({ output = 'glass:' .. color, type = 'shapeless', recipe = {'default:glass', 'dye:' .. color}, diff --git a/mods/mp_antum/glass/init.lua b/mods/mp_antum/glass/init.lua index d21587aa..6d1a4544 100644 --- a/mods/mp_antum/glass/init.lua +++ b/mods/mp_antum/glass/init.lua @@ -32,5 +32,7 @@ antum.glass.modpath = minetest.get_modpath(antum.glass.modname) antum.glass.colors = {'blue', 'green', 'red', 'violet'} -dofile(antum.glass.modpath .. '/nodes.lua') -dofile(antum.glass.modpath .. '/crafting.lua') +antum.loadScripts({ + 'nodes', + 'crafting', +}) diff --git a/mods/mp_antum/glass/nodes.lua b/mods/mp_antum/glass/nodes.lua index c6d6e663..83a21649 100644 --- a/mods/mp_antum/glass/nodes.lua +++ b/mods/mp_antum/glass/nodes.lua @@ -30,9 +30,7 @@ local function registerGroupAliases(group) local source = group[I][1] local alias = group[I][2] -- DEBUG - antum.log_action(antum.glass.modname, - 'Registering alias: ' .. alias .. ' -> ' .. source - ) + antum.logAction('Registering alias: ' .. alias .. ' -> ' .. source) minetest.register_alias(alias, source) end end diff --git a/mods/mp_antum/overrides/crafting.lua b/mods/mp_antum/overrides/crafting.lua index 58c2d10c..03efc073 100644 --- a/mods/mp_antum/overrides/crafting.lua +++ b/mods/mp_antum/overrides/crafting.lua @@ -26,7 +26,7 @@ antum.clearCraftOutput = function(o) - antum.log_action(antum.overrides.modname, 'Clearing craft by output: ' .. o) + antum.logAction('Clearing craft by output: ' .. o) minetest.clear_craft({ output = o }) @@ -50,14 +50,12 @@ antum.clearCraftRecipe = function(r) end - antum.log_action(antum.overrides.modname, ' Clearing craft by recipe: ' .. recipe_string) + antum.logAction(' Clearing craft by recipe: ' .. recipe_string) minetest.clear_craft({ recipe = {r} }) end -local craftdir = antum.overrides.modpath .. '/crafting' - local modoverrides = { 'bags', 'carts', @@ -73,7 +71,7 @@ local modoverrides = { for I in pairs(modoverrides) do local modname = modoverrides[I] if minetest.get_modpath(modname) then - antum.log_action(antum.overrides.modname, 'DEBUG: found mod \"' .. modname .. '\"') - dofile(craftdir .. '/' .. modname .. '.lua') + antum.logAction('DEBUG: found mod \"' .. modname .. '\"') + antum.loadScript('crafting/' .. modname) end end diff --git a/mods/mp_antum/overrides/crafting/bags.lua b/mods/mp_antum/overrides/crafting/bags.lua index 407e8230..ad5d312d 100644 --- a/mods/mp_antum/overrides/crafting/bags.lua +++ b/mods/mp_antum/overrides/crafting/bags.lua @@ -59,7 +59,7 @@ if bags.satisfied then }, }) - antum.register_craft({ + antum.registerCraft({ output = 'bags:small', recipe = { {'', 'group:stick', '',}, @@ -67,7 +67,7 @@ if bags.satisfied then {'group:fur', 'group:fur', 'group:fur',}, } }) - antum.register_craft({ + antum.registerCraft({ output = 'bags:medium', recipe = { {'bags:small', 'bags:small',}, @@ -75,7 +75,7 @@ if bags.satisfied then {'bags:small', 'bags:small',}, } }) - antum.register_craft({ + antum.registerCraft({ output = 'bags:large', recipe = { {'bags:medium', 'bags:medium',}, diff --git a/mods/mp_antum/overrides/crafting/carts.lua b/mods/mp_antum/overrides/crafting/carts.lua index 8218b0bc..8a15c3d3 100644 --- a/mods/mp_antum/overrides/crafting/carts.lua +++ b/mods/mp_antum/overrides/crafting/carts.lua @@ -37,7 +37,7 @@ for I in pairs(depends) do end if depends_satisfied then - antum.register_craft({ + antum.registerCraft({ output = 'carts:powerrail', type = 'shapeless', recipe = { diff --git a/mods/mp_antum/overrides/crafting/coloredwood.lua b/mods/mp_antum/overrides/crafting/coloredwood.lua index ab66d4d5..56f81b4a 100644 --- a/mods/mp_antum/overrides/crafting/coloredwood.lua +++ b/mods/mp_antum/overrides/crafting/coloredwood.lua @@ -32,7 +32,7 @@ local registerCWoodCraft = function(color) return end - antum.register_craft({ + antum.registerCraft({ type = 'shapeless', output = 'coloredwood:wood_' .. color, recipe = { diff --git a/mods/mp_antum/overrides/crafting/craftguide.lua b/mods/mp_antum/overrides/crafting/craftguide.lua index 2e9b5720..0eaf474a 100644 --- a/mods/mp_antum/overrides/crafting/craftguide.lua +++ b/mods/mp_antum/overrides/crafting/craftguide.lua @@ -44,7 +44,7 @@ if depends.satisfied then --minetest.register_alias("craftguide", "xdecor:crafting_guide") -- Alias already taken by "craft_guide:sign_wall" if minetest.get_modpath(depends.craft_guide) then - antum.register_craft({ + antum.registerCraft({ type = "shapeless", output = "craftguide:craftguide", recipe = { diff --git a/mods/mp_antum/overrides/crafting/farming.lua b/mods/mp_antum/overrides/crafting/farming.lua index 63beff25..7a5312a8 100644 --- a/mods/mp_antum/overrides/crafting/farming.lua +++ b/mods/mp_antum/overrides/crafting/farming.lua @@ -38,7 +38,7 @@ end if cotton.dependencies.satisfied then -- Craft cotton from white wool - antum.register_craft({ + antum.registerCraft({ output = "farming:cotton 4", type = "shapeless", recipe = {"wool:white"}, diff --git a/mods/mp_antum/overrides/crafting/helicopter.lua b/mods/mp_antum/overrides/crafting/helicopter.lua index 61ede9ca..cd37ba8e 100644 --- a/mods/mp_antum/overrides/crafting/helicopter.lua +++ b/mods/mp_antum/overrides/crafting/helicopter.lua @@ -27,7 +27,7 @@ antum.clearCraftOutput("helicopter:cabin") -antum.register_craft({ +antum.registerCraft({ output = 'helicopter:cabin', recipe = { {'', 'group:wood', ''}, diff --git a/mods/mp_antum/overrides/crafting/invisibility.lua b/mods/mp_antum/overrides/crafting/invisibility.lua index 90237b38..d38fdf5a 100644 --- a/mods/mp_antum/overrides/crafting/invisibility.lua +++ b/mods/mp_antum/overrides/crafting/invisibility.lua @@ -106,7 +106,7 @@ if depends_satisfied then })--]] - antum.register_craft({ + antum.registerCraft({ output = 'invisibility:potion', type = 'shapeless', recipe = { diff --git a/mods/mp_antum/overrides/init.lua b/mods/mp_antum/overrides/init.lua index 12aab995..04c3dd77 100644 --- a/mods/mp_antum/overrides/init.lua +++ b/mods/mp_antum/overrides/init.lua @@ -32,10 +32,11 @@ antum.overrides = {} antum.overrides.modname = minetest.get_current_modname() antum.overrides.modpath = minetest.get_modpath(antum.overrides.modname) -local scripts = { - 'items', 'entities', 'misc', 'nodes', 'crafting', -} - -for I in pairs(scripts) do - dofile(antum.overrides.modpath .. '/' .. scripts[I] .. '.lua') -end +--local scripts = { +antum.loadScripts({ + 'items', + 'entities', + 'misc', + 'nodes', + 'crafting', +}) diff --git a/mods/mp_antum/overrides/items.lua b/mods/mp_antum/overrides/items.lua index 87f86960..72751142 100644 --- a/mods/mp_antum/overrides/items.lua +++ b/mods/mp_antum/overrides/items.lua @@ -25,8 +25,6 @@ --]] -local itemsdir = antum.overrides.modpath .. '/items' - local modoverrides = { 'animalmaterials', 'cooking', @@ -38,6 +36,6 @@ local modoverrides = { for I in pairs(modoverrides) do local modname = modoverrides[I] if minetest.get_modpath(modname) then - dofile(itemsdir .. '/' .. modname .. '.lua') + antum.loadScript('items/' .. modname) end end diff --git a/mods/mp_antum/overrides/misc.lua b/mods/mp_antum/overrides/misc.lua index 066ba591..cc687d04 100644 --- a/mods/mp_antum/overrides/misc.lua +++ b/mods/mp_antum/overrides/misc.lua @@ -25,8 +25,6 @@ --]] -local miscdir = antum.overrides.modpath .. "/misc" - local modoverrides = { "walking_light", } @@ -34,6 +32,6 @@ local modoverrides = { for I in pairs(modoverrides) do local modname = modoverrides[I] if minetest.get_modpath(modname) then - dofile(miscdir .. "/" .. modname .. ".lua") + antum.loadScript('misc/' .. modname) end end diff --git a/mods/mp_antum/overrides/nodes.lua b/mods/mp_antum/overrides/nodes.lua index 4f7efbc2..c56ce538 100644 --- a/mods/mp_antum/overrides/nodes.lua +++ b/mods/mp_antum/overrides/nodes.lua @@ -25,8 +25,6 @@ --]] -local nodedir = antum.overrides.modpath .. '/nodes' - local modoverrides = { 'ethereal', } @@ -34,6 +32,6 @@ local modoverrides = { for I in pairs(modoverrides) do local modname = modoverrides[I] if minetest.get_modpath(modname) then - dofile(nodedir .. '/' .. modname .. '.lua') + antum.loadScript('nodes/' .. modname) end end diff --git a/mods/mp_antum/spawneggs/eggs.lua b/mods/mp_antum/spawneggs/eggs.lua index d733902e..32ce2431 100644 --- a/mods/mp_antum/spawneggs/eggs.lua +++ b/mods/mp_antum/spawneggs/eggs.lua @@ -57,7 +57,7 @@ antum.spawneggs.addEgg = function(name, spawn, ingredients) antum.spawneggs.addEggRecipe(name, spawn, ingredients) -- DEBUG - antum.log_action(antum.spawneggs.modname, 'Registered spawnegg for ' .. spawn) + antum.logAction('Registered spawnegg for ' .. spawn) end diff --git a/mods/mp_antum/spawneggs/init.lua b/mods/mp_antum/spawneggs/init.lua index 3dde0dd6..38579183 100644 --- a/mods/mp_antum/spawneggs/init.lua +++ b/mods/mp_antum/spawneggs/init.lua @@ -30,4 +30,4 @@ antum.spawneggs = {} antum.spawneggs.modname = minetest.get_current_modname() antum.spawneggs.modpath = minetest.get_modpath(antum.spawneggs.modname) -dofile(antum.spawneggs.modpath .. '/eggs.lua') +antum.loadScript('eggs')