diff --git a/.github/workflows/age_of_mending.yml b/.github/workflows/age_of_mending.yml new file mode 100644 index 0000000..97a8074 --- /dev/null +++ b/.github/workflows/age_of_mending.yml @@ -0,0 +1,23 @@ +name: age_of_mending +on: [push, pull_request] +jobs: + test: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - name: Checkout + uses: actions/checkout@main + - uses: buckaroobanzay/mtt@main + with: + modname: xcompat + git_game_repo: https://codeberg.org/Age_of_Mending/Age_of_Mending + git_dependencies: | + https://github.com/mt-mods/unifieddyes + https://github.com/mt-mods/basic_materials + https://github.com/OgelGames/fakelib + https://github.com/mt-mods/pipeworks + https://github.com/mt-mods/steel + https://github.com/mt-mods/display_modpack + https://github.com/mt-mods/homedecor_modpack + additional_config: | + mtt_nodelist = age_of_mending.txt diff --git a/.luacheckrc b/.luacheckrc index ad507bf..06c141c 100644 --- a/.luacheckrc +++ b/.luacheckrc @@ -23,4 +23,5 @@ read_globals = { "mcl_player", "fl_player", "stairs", + "aom_cooking", } diff --git a/README.md b/README.md index ffdf4e4..58c2d07 100644 --- a/README.md +++ b/README.md @@ -15,17 +15,18 @@ See the respective sub apis doc file in /doc for detailed documentation. ## Directly supported games and mods -| Games | Sounds | Materials | Textures | Player | Stairs | -| ----------------- | --------- | --------- | --------- | ------ | ------ | -| Minetest Game | x | x | x | x | x | -| MineClone2 | x | x | | x | | -| Mineclonia | x | x | | x | | -| Hades Revisited | x | x | | | | -| Farlands Reloaded | x | x | x | x | x | -| Exile | x | | | | | -| KSurvive 2 | x | | | | | -| Forgotten Lands | x | | | | | -| Development Test | | x | x | | | +| Games | Sounds | Materials | Textures | Player | Stairs | Crafting | +| ----------------- | --------- | --------- | --------- | ------ | ------ | -------- | +| Minetest Game | x | x | x | x | x | x | +| MineClone2 | x | x | | x | | x | +| Mineclonia | x | x | | x | | x | +| Hades Revisited | x | x | | | | x | +| Farlands Reloaded | x | x | x | x | x | x | +| Exile | x | | | | | | +| KSurvive 2 | x | | | | | x | +| Forgotten Lands | x | | | | | | +| Development Test | | x | x | | | x | +| Age of Mending | | x | | | | x | For functions see /doc/functions.md for the specifics relating to the function diff --git a/init.lua b/init.lua index 0da4185..679b3b7 100644 --- a/init.lua +++ b/init.lua @@ -13,6 +13,7 @@ xcompat.textures = dofile(modpath .. "/src/textures.lua") xcompat.functions = dofile(modpath .. "/src/functions.lua") xcompat.player = dofile(modpath .. "/src/player.lua") xcompat.stairs = dofile(modpath .. "/src/stairs.lua") +xcompat.register_craft = dofile(modpath .. "/src/crafting.lua") local function validate_sound(key) if key and xcompat.sounds[key] then diff --git a/mod.conf b/mod.conf index c0661c1..36602cd 100644 --- a/mod.conf +++ b/mod.conf @@ -1,3 +1,3 @@ name = xcompat description = Provides cross compatibility between mods and games for sounds and crafting materials. -optional_depends = default, fl_stone, fl_trees, mcl_sounds, hades_sounds, ks_sounds, nodes_nature, fl_topsoil, fl_trees, mcl_core, farming, x_farming, sounds, mtt, player_api, mcl_player, fl_player, stairs, basenodes, unittests, basetools, testpathfinder, testnodes, chest, tiled +optional_depends = default, fl_stone, fl_trees, mcl_sounds, hades_sounds, ks_sounds, nodes_nature, fl_topsoil, fl_trees, mcl_core, farming, x_farming, sounds, mtt, player_api, mcl_player, fl_player, stairs, basenodes, unittests, basetools, testpathfinder, testnodes, chest, tiled, age_of_mending, aom_cooking, aom_mapgen diff --git a/src/crafting.lua b/src/crafting.lua new file mode 100644 index 0000000..f7709c2 --- /dev/null +++ b/src/crafting.lua @@ -0,0 +1,8 @@ +local filename = xcompat.gameid + +--if we dont have a crafting file for the game, use minetest +if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/crafting/" .. filename .. ".lua") then + filename = "minetest" +end + +return dofile(xcompat.modpath .. "/src/crafting/" .. filename .. ".lua") diff --git a/src/crafting/age_of_mending.lua b/src/crafting/age_of_mending.lua new file mode 100644 index 0000000..ac6686d --- /dev/null +++ b/src/crafting/age_of_mending.lua @@ -0,0 +1,25 @@ + +-- assumes mtg-style crafting definition +return function(def) + local t = def.type + if t == "fuel" then + local item = def.recipe + local igroups = core.registered_items[item].groups + igroups.fuel = def.burntime + core.override_item(item, {groups = igroups}) + return + elseif t == "cooking" then + local result = def.output + local is_output_edible = + (core.get_item_group(result, "edible") > 0) or + (core.get_item_group(result, "food") > 0) + return aom_cooking.register_cooking({ + raw = def.recipe, + cooked = result, + cook_time = def.cooktime, + groups = {is_output_edible and "cooker_boil" or "cooker_crucible"} + }) + else + core.register_craft(def) -- age of mending automatically converts recipes + end +end diff --git a/src/crafting/devtest.lua b/src/crafting/devtest.lua new file mode 100644 index 0000000..2119f9e --- /dev/null +++ b/src/crafting/devtest.lua @@ -0,0 +1,3 @@ + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/crafting/farlands_reloaded.lua b/src/crafting/farlands_reloaded.lua new file mode 100644 index 0000000..2119f9e --- /dev/null +++ b/src/crafting/farlands_reloaded.lua @@ -0,0 +1,3 @@ + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/crafting/hades_revisited.lua b/src/crafting/hades_revisited.lua new file mode 100644 index 0000000..2119f9e --- /dev/null +++ b/src/crafting/hades_revisited.lua @@ -0,0 +1,3 @@ + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/crafting/ksurvive2.lua b/src/crafting/ksurvive2.lua new file mode 100644 index 0000000..2119f9e --- /dev/null +++ b/src/crafting/ksurvive2.lua @@ -0,0 +1,3 @@ + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/crafting/mineclonia.lua b/src/crafting/mineclonia.lua new file mode 100644 index 0000000..e4c8106 --- /dev/null +++ b/src/crafting/mineclonia.lua @@ -0,0 +1,4 @@ +--note this file handles mineclonia, mineclone2, and its rename voxelibre + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/crafting/minetest.lua b/src/crafting/minetest.lua new file mode 100644 index 0000000..2119f9e --- /dev/null +++ b/src/crafting/minetest.lua @@ -0,0 +1,3 @@ + +-- function wrapped in case of override +return function(...) return core.register_craft(...) end diff --git a/src/gameid.lua b/src/gameid.lua index 88ef0a1..fc5c7d5 100644 --- a/src/gameid.lua +++ b/src/gameid.lua @@ -1,5 +1,6 @@ local game_alias = { mineclone2 = "mineclonia", + pmb_core = "age_of_mending", } local game_modnames = { @@ -10,6 +11,7 @@ local game_modnames = { exile = "exile_env_sounds", ksurvive2 = "ks_metals", devtest = "basenodes", + age_of_mending = "age_of_mending", } local gameid = "xcompat_unknown_gameid" diff --git a/src/materials/age_of_mending.lua b/src/materials/age_of_mending.lua new file mode 100644 index 0000000..61aa251 --- /dev/null +++ b/src/materials/age_of_mending.lua @@ -0,0 +1,69 @@ +local materials = { + sand = "aom_soil:sand", + sandstone = "aom_stone:sandstone", + gravel = "aom_soil:gravel", + flint = "aom_stone:cobble", + copper_ingot = "aom_items:copper_bar", + steel_ingot = "aom_items:iron_bar", + gold_ingot = "aom_items:gold_bar", + tin_ingot = "aom_items:tin_bar", + bronze_ingot = "aom_items:bronze_bar", + axe_steel = "aom_tools:iron_axe", + axe_diamond = "aom_tools:diamond_axe", + axe_bronze = "aom_tools:bronze_axe", + axe_stone = "aom_tools:stone_axe", + pick_steel = "aom_tools:iron_pickaxe", + mese = "aom_underworld:mythril", + mese_crystal = "aom_underworld:mythril_strand", + mese_crystal_fragment = "aom_items:ignis", + torch = "aom_lights:torch", + diamond = "aom_items:diamond", + clay_lump = "aom_items:clay_ball", + water_bucket = "aom_items:wooden_bucket_water", + empty_bucket = "aom_items:wooden_bucket", + dye_dark_grey = "aom_dyes:grey", + dye_black = "aom_dyes:black", + dye_white = "aom_dyes:white", + dye_green = "aom_dyes:green", + dye_red = "aom_dyes:red", + dye_yellow = "aom_dyes:yellow", + dye_brown = "aom_dyes:brown", + dye_blue = "aom_dyes:blue", + dye_violet = "aom_dyes:purple", + dye_grey = "aom_dyes:grey", + dye_dark_green = "aom_dyes:dark_green", + dye_orange = "aom_dyes:orange", + dye_pink = "aom_dyes:pink", + dye_cyan = "aom_dyes:light_blue", + dye_magenta = "aom_dyes:magenta", + string = "aom_rope:rope", + iron_lump = "aom_items:iron_nugget", + slab_stone = "aom_stone:stone_slab", + slab_wood = "aom_wood:oak_planks_slab", + glass = "aom_glass:glass", + glass_block = "aom_glass:glass", + glass_bottle = "aom_glass:glass", + coal_lump = "aom_items:coal", + stone = "aom_stone:ironstone", + desert_stone = "aom_stone:ironstone", + desert_sand = "aom_soil:sand", + chest = "aom_storage:chest", + cobble = "aom_stone:cobble", + obsidian_glass = "aom_glass:glass", + water_source = "aom_liquids:water_source", + water_flowing = "aom_liquids:water_flowing", + dirt = "aom_soil:dirt", + dirt_with_grass = "aom_soil:dirt_with_grass", + apple_leaves = "aom_wood:oak_leaves", + apple_log = "aom_wood:oak_log", + apple_planks = "aom_wood:oak_planks", + birch_leaves = "aom_wood:ash_leaves", + birch_log = "aom_wood:ash_log", + birch_planks = "aom_wood:ash_planks", + jungle_leaves = "aom_wood:spruce_leaves", + bowl = "aom_items:wooden_bowl", + stick = "aom_items:stick", + obsidian = "aom_stone:obsidian", +} + +return materials \ No newline at end of file diff --git a/test/nodelist/age_of_mending.txt b/test/nodelist/age_of_mending.txt new file mode 100644 index 0000000..7ebd827 --- /dev/null +++ b/test/nodelist/age_of_mending.txt @@ -0,0 +1,23 @@ +aom_soil:sand +aom_stone:sandstone +aom_soil:gravel +aom_stone:cobble +aom_stone:stone_slab +aom_wood:oak_planks_slab +aom_stone:ironstone +aom_soil:sand +aom_storage:chest +aom_stone:cobble +aom_glass:glass +aom_liquids:water_source +aom_liquids:water_flowing +aom_soil:dirt +aom_soil:dirt_with_grass +aom_wood:oak_leaves +aom_wood:oak_log +aom_wood:oak_planks +aom_wood:ash_leaves +aom_wood:ash_log +aom_wood:ash_planks +aom_wood:spruce_leaves +aom_stone:obsidian \ No newline at end of file