refactor mod (#22)

This commit is contained in:
wsor4035 2024-05-26 11:07:43 -04:00 committed by GitHub
parent eb7d9fd4f6
commit 5b4b19a184
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 683 additions and 549 deletions

View File

@ -11,7 +11,7 @@ Thanks to:
## Usage ## Usage
See [DEV.md](DEV.md) for detailed documentation. See the respective sub apis doc file in /doc for detailed documentation.
## Directly supported games and mods ## Directly supported games and mods

12
doc/gameid.md Normal file
View File

@ -0,0 +1,12 @@
# GameId API
## minetest versions >= 5.7
simply returns `minetest.get_game_info().id`
## minetest versions < 5.7
approximates the gameid value via a hardcoded table of gameid=>modname
and then checks via `minetest.get_modpath()`. If it fails, it falls
back to using `xcompat_unknown_gameid` as the id. See the chart in the
readme for which games are supported

3
doc/materials.md Normal file
View File

@ -0,0 +1,3 @@
# Materials API
consult `/src/materials/minetest.lua` at this time

View File

@ -1,8 +1,6 @@
# Xcompat dev docs # Sound API
## Sound API ## Option 1: Agnostically depend
### Option 1: Agnostically depend
You can do this by using a custom field in your node def instead of the `sounds` key. You can do this by using a custom field in your node def instead of the `sounds` key.
@ -22,7 +20,7 @@ where:
* key: string name of the field from the sound api you want to use, for example `node_sound_stone_defaults` * key: string name of the field from the sound api you want to use, for example `node_sound_stone_defaults`
* input: table input of fields you want passed to the key field, used to override specific sounds. * input: table input of fields you want passed to the key field, used to override specific sounds.
### Option 2: Hard depend ## Option 2: Hard depend
add this mod to your mod.confs depends and directly call the sound_api as follows add this mod to your mod.confs depends and directly call the sound_api as follows
@ -34,8 +32,4 @@ minetest.register_node(nodename, {
}) })
``` ```
* input: optional table to override some or all of returned values * input: optional table to override some or all of returned values
## Materials API
consult `/src/materials.lua` at this time

3
doc/textures.md Normal file
View File

@ -0,0 +1,3 @@
# Textures API
consult `/src/texture/minetest.lua` at this time

View File

@ -1,11 +1,16 @@
local modpath = minetest.get_modpath("xcompat") local modpath = minetest.get_modpath("xcompat")
xcompat = { xcompat = {
sounds = dofile(modpath .. "/src/sounds.lua"), modpath = modpath,
materials = dofile(modpath .. "/src/materials.lua"),
textures = dofile(modpath .. "/src/textures.lua"),
} }
xcompat.gameid = dofile(modpath .. "/src/gameid.lua")
xcompat.utilities = dofile(modpath .. "/src/utilities.lua")
xcompat.sounds = dofile(modpath .. "/src/sounds.lua")
xcompat.materials = dofile(modpath .. "/src/materials.lua")
xcompat.textures = dofile(modpath .. "/src/textures.lua")
local function validate_sound(key) local function validate_sound(key)
if key and xcompat.sounds[key] then if key and xcompat.sounds[key] then
return true return true
@ -35,3 +40,5 @@ minetest.register_on_mods_loaded(function()
old_reg_node(name, def) old_reg_node(name, def)
end end
end) end)
dofile(modpath .. "/src/commands.lua")

51
src/commands.lua Normal file
View File

@ -0,0 +1,51 @@
local materials_list = minetest.get_dir_list(xcompat.modpath.."/src/materials", false)
local materials = {}
for _, material in ipairs(materials_list) do
local gameid = material:sub(1, -5)
materials[gameid] = dofile(xcompat.modpath.."/src/materials/"..material)
end
local textures_list = minetest.get_dir_list(xcompat.modpath.."/src/textures", false)
local textures = {}
for _, texture in ipairs(textures_list) do
local gameid = texture:sub(1, -5)
textures[gameid] = dofile(xcompat.modpath.."/src/textures/"..texture)
end
minetest.register_chatcommand("xcompat_test_materials", {
description = "Test materials",
privs = {server=true},
func = function(name, _)
local reference_materials = materials["minetest"]
for gameid, game_materials in pairs(materials) do
for material, _ in pairs(reference_materials) do
if not game_materials[material] then
minetest.chat_send_player(name, "Missing material: "..material.." in game: "..gameid)
end
end
end
minetest.chat_send_player(name, "Materials test complete")
end
})
--WARNING: only handles top level of table currently
--TODO: handle nested tables
minetest.register_chatcommand("xcompat_test_textures", {
description = "Test textures",
privs = {server=true},
func = function(name, _)
local reference_textures = textures["xcompat_agnostic"]
for gameid, game_textures in pairs(textures) do
for texture, _ in pairs(reference_textures) do
if not game_textures[texture] then
minetest.chat_send_player(name, "Missing texture: "..texture.." in game: "..gameid)
end
end
end
minetest.chat_send_player(name, "Textures test complete")
end
})

30
src/gameid.lua Normal file
View File

@ -0,0 +1,30 @@
local game_alias = {
mineclone2 = "mineclonia",
}
local game_modnames = {
mineclonia = "mcl_core",
farlands_reloaded = "fl_core",
minetest = "default",
hades = "hades_core",
exile = "exile_env_sounds",
ksurvive2 = "ks_metals",
}
local gameid = "xcompat_unknown_gameid"
if type(minetest.get_game_info) == "function" then
gameid = minetest.get_game_info().id
else
for game, modname in pairs(game_modnames) do
if minetest.get_modpath(modname) then
gameid = game
break
end
end
end
--for games that are similar/derviatives of other games
if game_alias[gameid] then gameid = game_alias[gameid] end
return gameid

View File

@ -1,362 +1,8 @@
local materials = { local filename = xcompat.gameid
sand = "default:sand",
sandstone = "default:sandstone",
gravel = "default:gravel",
flint = "default:flint",
copper_ingot = "default:copper_ingot",
steel_ingot = "default:steel_ingot",
gold_ingot = "default:gold_ingot",
tin_ingot = "default:tin_ingot",
copper_block = "default:copperblock",
steel_block = "default:steelblock",
gold_block = "default:goldblock",
tin_block = "default:tinblock",
axe_steel = "default:axe_steel",
axe_diamond = "default:axe_diamond",
axe_bronze = "default:axe_bronze",
axe_stone = "default:axe_stone",
axe_wood = "default:axe_wood",
pick_steel = "default:pick_steel",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese_crystal_fragment = "default:mese_crystal_fragment",
torch = "default:torch",
diamond = "default:diamond",
clay_lump = "default:clay_lump",
water_bucket = "bucket:bucket_water",
empty_bucket = "bucket:bucket_empty",
dye_dark_grey = "dye:dark_grey",
dye_black = "dye:black",
dye_white = "dye:white",
dye_green = "dye:green",
dye_red = "dye:red",
dye_yellow = "dye:yellow",
dye_brown = "dye:brown",
dye_blue = "dye:blue",
dye_violet = "dye:violet",
dye_grey = "dye:grey",
dye_dark_green = "dye:dark_green",
dye_orange = "dye:orange",
dye_pink = "dye:pink",
silicon = "mesecons_materials:silicon",
string = "farming:string",
paper = "default:paper",
book = "default:book",
iron_lump = "default:iron_lump",
wool_grey = "wool:grey",
wool_green = "wool:green",
wool_dark_green = "wool:dark_green",
wool_brown = "wool:brown",
wool_black = "wool:black",
wool_white = "wool:white",
slab_stone = "stairs:slab_stone",
slab_wood = "stairs:slab_wood",
glass = "default:glass",
glass_block = "default:glass",
glass_bottle = "vessels:glass_bottle",
coal_lump = "default:coal_lump",
stone = "default:stone",
desert_stone = "default:desert_stone",
desert_sand = "default:desert_sand",
chest = "default:chest",
cobble = "default:cobble",
brick = "default:brick",
obsidian_glass = "default:obsidian_glass",
water_source = "default:water_source",
water_flowing = "default:water_flowing",
dirt = "default:dirt",
dirt_with_grass = "default:dirt_with_grass",
apple_leaves = "default:leaves",
apple_log = "default:tree",
apple_planks = "default:wood",
birch_leaves = "default:aspen_leaves",
birch_log = "default:aspen_tree",
birch_planks = "default:aspen_wood",
jungle_leaves = "default:jungleleaves",
bowl = "",
}
if minetest.registered_items["farming:bowl"] then --if we dont have a materials file for the game, use minetest
materials.bowl = "farming:bowl" if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/materials/" .. filename .. ".lua") then
elseif minetest.get_modpath("x_farming") then filename = "minetest"
materials.bowl = "x_farming:bowl"
end end
if minetest.get_modpath("moreores") then return dofile(xcompat.modpath .. "/src/materials/" .. filename .. ".lua")
materials.silver_ingot = "moreores:silver_ingot"
end
if minetest.get_modpath("technic") then
materials.lead_ingot = "technic:lead_ingot"
materials.carbon_steel_ingot = "technic:carbon_steel_ingot"
materials.stainless_steel_ingot = "technic:stainless_steel_ingot"
end
if minetest.get_modpath("aloz") then
materials.aluminum_ingot = "aloz:aluminum_ingot"
end
if minetest.get_modpath("techage") then
materials.aluminum_ingot = "techage:aluminum"
end
if minetest.get_modpath("mcl_core") then
materials = {
sand = "mcl_core:sand",
sandstone = "mcl_core:sandstone",
gravel = "mcl_core:gravel",
flint = "mcl_core:flint",
copper_ingot = "mcl_copper:copper_ingot",
steel_ingot = "mcl_core:iron_ingot",
gold_ingot = "mcl_core:gold_ingot",
tin_ingot = "mcl_core:iron_ingot",
copper_block = "mcl_copper:copper_block",
steel_block = "mcl_core:iron_block",
gold_block = "mcl_core:gold_block",
tin_block = "mcl_core:iron_block",
axe_steel = "mcl_core:axe_steel",
axe_diamond = "mcl_core:axe_diamond",
axe_bronze = "mcl_core:axe_bronze",
axe_stone = "mcl_core:axe_stone",
axe_wood = "mcl_core:axe_wood",
pick_steel = "mcl_core:pick_steel",
mese = "mesecons_torch:redstoneblock",
mese_crystal = "mesecons:redstone",
mese_crystal_fragment = "mcl_core:iron_ingot",
torch = "mcl_torches:torch",
diamond = "mcl_core:diamond",
clay_lump = "default:clay_lump",
water_bucket = "mcl_buckets:bucket:bucket_water",
empty_bucket = "mcl_buckets:bucket_empty",
dye_dark_grey = "mcl_dyes:dark_grey",
dye_black = "mcl_dyes:black",
dye_white = "mcl_dyes:white",
dye_green = "mcl_dyes:green",
dye_red = "mcl_dyes:red",
dye_yellow = "mcl_dyes:yellow",
dye_brown = "mcl_dyes:brown",
dye_blue = "mcl_dyes:blue",
dye_violet = "mcl_dyes:violet",
dye_grey = "mcl_dyes:grey",
dye_dark_green = "mcl_dyes:dark_green",
dye_orange = "mcl_dyes:orange",
dye_pink = "mcl_dyes:pink",
silicon = "mcl_core:iron_ingot",
string = "mcl_mobitems:string",
paper = "mcl_core:paper",
book = "mcl_core:book",
iron_lump = "mcl_core:stone_with_iron",
wool_grey = "mcl_wool:grey",
wool_green = "mcl_wool:green",
wool_dark_green = "mcl_wool:dark_green",
wool_brown = "mcl_wool:brown",
wool_black = "mcl_wool:black",
wool_white = "mcl_wool:white",
slab_stone = "mcl_stairs:slab_stone",
slab_wood = "mcl_stairs:slab_wood",
glass = "mcl_core:glass",
glass_block = "mcl_core:glass",
glass_bottle = "mcl_core:glass_bottle",
coal_lump = "mcl_core:coal",
stone = "mcl_core:stone",
desert_stone = "mcl_core:redsandstone",
desert_sand = "mcl_core:sand",
chest = "mcl_chests:chest",
cobble = "mcl_core:cobble",
brick = "mcl_core:brick",
water_source = "mcl_core:water_source",
water_flowing = "mcl_core:water_flowing",
dirt = "mcl_core:dirt",
dirt_with_grass = "mcl_core:dirt_with_grass",
apple_leaves = "mcl_trees:leaves_oak",
apple_log = "mcl_trees:tree_oak",
apple_planks = "mcl_trees:wood_oak",
birch_leaves = "mcl_trees:leaves_birch",
birch_log = "mcl_trees:tree_birch",
birch_planks = "mcl_trees:wood_birch",
jungle_leaves = "mcl_trees:jungle_leaves",
bowl = "mcl_core:bowl",
}
elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
materials = {
sand = "fl_stone:sand",
sandstone = "fl_stone:sandstone",
gravel = "fl_topsoil:gravel",
flint = "fl_topsoil:flint",
copper_ingot = "fl_ores:copper_ingot",
steel_ingot = "fl_ores:iron_ingot",
gold_ingot = "fl_ores:gold_ingot",
tin_ingot = "fl_ores:tin_ingot",
copper_block = "fl_ores:copper_block",
steel_block = "fl_ores:iron_block",
gold_block = "fl_ores:gold_block",
tin_block = "fl_ores:tin_block",
axe_steel = "fl_tools:steel_axe",
axe_diamond = "fl_tools:diamond_axe",
axe_bronze = "fl_tools:bronze_axe",
axe_stone = "fl_tools:stone_axe",
axe_wood = "fl_tools:wood_axe",
pick_steel = "fl_tools:steel_pick",
mese = "fl_ores:iron_ingot",
mese_crystal = "fl_ores:iron_ingot",
mese_crystal_fragment = "fl_ores:iron_ingot",
torch = "fl_light_sources:torch",
diamond = "fl_ores:diamond",
clay_lump = "fl_bricks:clay_lump",
water_bucket = "fl_bucket:bucket_water",
empty_bucket = "fl_bucket:bucket",
dye_dark_grey = "fl_dyes:dark_grey_dye",
dye_black = "fl_dyes:black_dye",
dye_white = "fl_dyes:white_dye",
dye_green = "fl_dyes:green_dye",
dye_red = "fl_dyes:red_dye",
dye_yellow = "fl_dyes:yellow_dye",
dye_brown = "fl_dyes:brown_dye",
dye_blue = "fl_dyes:blue_dye",
dye_violet = "fl_dyes:violet_dye",
dye_grey = "fl_dyes:grey_dye",
dye_dark_green = "fl_dyes:dark_green_dye",
dye_orange = "fl_dyes:orange_dye",
dye_pink = "fl_dyes:pink_dye",
silver_ingot = "fl_ores:iron_ingot",
silicon = "mesecons_materials:silicon",
string = "fl_plantlife:oxeye_daisy",
paper = "basic_materials:plastic_sheet",
iron_lump = "fl_ores:iron_ore",
wool_grey = "",
wool_green = "",
wool_dark_green = "",
wool_brown = "",
wool_black = "",
wool_white = "",
slab_stone = "fl_stone:stone_slab",
slab_wood = "fl_trees:apple_plank_slab",
glass = "fl_glass:framed_glass",
glass_block = "fl_glass:framed_glass",
glass_bottle = "fl_bottles:bottle",
coal_lump = "fl_ores:coal_ore",
stone = "fl_stone:stone",
desert_stone = "fl_stone:desert_stone",
desert_sand = "fl_stone:desert_sand",
chest = "fl_storage:wood_chest",
cobble = "fl_stone:stone_rubble",
brick = "",
water_source = "fl_liquids:water_source",
water_flowing = "fl_liquids:water_flowing",
dirt = "fl_stone:dirt",
dirt_with_grass = "fl_topsoil:dirt_with_grass",
apple_leaves = "fl_trees:apple_leaves",
apple_log = "fl_trees:apple_trunk",
apple_planks = "fl_trees:apple_plank",
birch_leaves = "fl_trees:aspen_leaves",
birch_log = "fl_trees:aspen_trunk",
birch_planks = "fl_trees:aspen_plank",
jungle_leaves = "fl_trees:jungletree_leaves",
bowl = "",
}
elseif minetest.get_modpath("hades_core") then
materials = {
sand = "hades_core:fertile_sand",
sandstone = "hades_core:sandstone",
gravel = "hades_core:gravel",
flint = "",
copper_ingot = "hades_core:copper_ingot",
steel_ingot = "hades_core:steel_ingot",
gold_ingot = "hades_core:gold_ingot",
tin_ingot = "hades_core:tin_ingot",
silver_ingot = "--unknown--",
copper_block = "hades_core:copperblock",
steel_block = "hades_core:steelblock",
gold_block = "hades_core:goldblock",
tin_block = "hades_core:tinblock",
axe_steel = "hades_core:axe_steel",
axe_diamond = "hades_core:axe_diamond",
axe_bronze = "hades_core:axe_bronze",
axe_stone = "hades_core:axe_stone",
axe_wood = "hades_core:axe_wood",
pick_steel = "hades_core:pick_steel",
mese = "hades_core:mese",
mese_crystal = "hades_core:mese_crystal",
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
torch = "hades_torches:torch",
diamond = "hades_core:diamond",
clay_lump = "hades_core:clay_lump",
clay_brick = "hades_core:clay_brick",
--[[
Since hades doesnt have buckets or water for the user,
using dirt from near water to pull the water out
]]
water_bucket = "hades_core:dirt",
empty_bucket = "hades_core:fertile_sand",
dye_dark_grey = "dye:dark_grey",
dye_black = "dye:black",
dye_white = "dye:white",
dye_green = "dye:green",
dye_red = "dye:red",
dye_yellow = "dye:yellow",
dye_brown = "dye:brown",
dye_blue = "dye:blue",
dye_violet = "dye:violet",
dye_grey = "dye:grey",
dye_dark_green = "dye:dark_green",
dye_orange = "dye:orange",
dye_pink = "dye:pink",
silicon = "hades_materials:silicon",
string = "hades_farming:string",
paper = "hades_core:paper",
book = "hades_core:book",
iron_lump = "hades_core:iron_lump",
wool_grey = "wool:grey",
wool_green = "wool:green",
wool_dark_green = "wool:dark_green",
wool_brown = "wool:brown",
wool_black = "wool:black",
wool_white = "wool:white",
slab_stone = "stairs:slab_stone",
slab_wood = "stairs:slab_wood",
glass = "hades_core:glass",
glass_block = "hades_core:glass",
glass_bottle = "vessels:glass_bottle",
obsidian_glass = "hades_core:obsidian_glass",
coal_lump = "hades_core:coal_lump",
stone = "hades_core:stone",
desert_stone = "hades_core:stone_baked",
desert_sand = "hades_core:volcanic_sand",
chest = "hades_chests:chest";
cobble = "hades_core:cobble",
brick = "hades_core:brick",
water_source = "hades_core:water_source",
water_flowing = "hades_core:water_flowing",
dirt = "hades_core:dirt",
dirt_with_grass = "hades_core:dirt_with_grass",
apple_leaves = "hades_trees:leaves",
apple_log = "hades_trees:tree",
apple_planks = "hades_trees:wood",
birch_leaves = "hades_core:birch_leaves",
birch_log = "hades_trees:birch_tree",
birch_planks = "hades_trees:cream_wood",
jungle_leaves = "hades_trees:jungle_leaves",
--hades has no bowl but you get plate on eat so makes most sense?
bowl = "hades_food:plate",
}
if minetest.get_modpath("hades_bucket") then
materials["water_bucket"] = "hades_bucket:bucket_water"
materials["empty_bucket"] = "hades_bucket:bucket_empty"
end
if minetest.get_modpath("hades_extraores") then
materials["silver_ingot"] = "hades_extraores:silver_ingot"
materials["aluminum_ingot"] = "hades_extraores:aluminum_ingot"
end
if minetest.get_modpath("hades_default") then
materials.desert_sand = "hades_default:desert_sand"
end
if minetest.get_modpath("hades_technic") then
materials.lead_ingot = "hades_technic:lead_ingot"
materials.carbon_steel_ingot = "hades_technic:carbon_steel_ingot"
materials.stainless_steel_ingot = "hades_technic:stainless_steel_ingot"
end
end
return materials

View File

@ -0,0 +1,84 @@
local materials = {
sand = "fl_stone:sand",
sandstone = "fl_stone:sandstone",
gravel = "fl_topsoil:gravel",
flint = "fl_topsoil:flint",
copper_ingot = "fl_ores:copper_ingot",
steel_ingot = "fl_ores:iron_ingot",
gold_ingot = "fl_ores:gold_ingot",
tin_ingot = "fl_ores:tin_ingot",
copper_block = "fl_ores:copper_block",
steel_block = "fl_ores:iron_block",
gold_block = "fl_ores:gold_block",
tin_block = "fl_ores:tin_block",
axe_steel = "fl_tools:steel_axe",
axe_diamond = "fl_tools:diamond_axe",
axe_bronze = "fl_tools:bronze_axe",
axe_stone = "fl_tools:stone_axe",
axe_wood = "fl_tools:wood_axe",
pick_steel = "fl_tools:steel_pick",
mese = "fl_ores:iron_ingot",
mese_crystal = "fl_ores:iron_ingot",
mese_crystal_fragment = "fl_ores:iron_ingot",
torch = "fl_light_sources:torch",
diamond = "fl_ores:diamond",
clay_lump = "fl_bricks:clay_lump",
water_bucket = "fl_bucket:bucket_water",
empty_bucket = "fl_bucket:bucket",
dye_dark_grey = "fl_dyes:dark_grey_dye",
dye_black = "fl_dyes:black_dye",
dye_white = "fl_dyes:white_dye",
dye_green = "fl_dyes:green_dye",
dye_red = "fl_dyes:red_dye",
dye_yellow = "fl_dyes:yellow_dye",
dye_brown = "fl_dyes:brown_dye",
dye_blue = "fl_dyes:blue_dye",
dye_violet = "fl_dyes:violet_dye",
dye_grey = "fl_dyes:grey_dye",
dye_dark_green = "fl_dyes:dark_green_dye",
dye_orange = "fl_dyes:orange_dye",
dye_pink = "fl_dyes:pink_dye",
silver_ingot = "fl_ores:iron_ingot",
silicon = "mesecons_materials:silicon",
string = "fl_plantlife:oxeye_daisy",
paper = "",
book = "",
iron_lump = "fl_ores:iron_ore",
wool_grey = "",
wool_green = "",
wool_dark_green = "",
wool_brown = "",
wool_black = "",
wool_white = "",
slab_stone = "fl_stone:stone_slab",
slab_wood = "fl_trees:apple_plank_slab",
glass = "fl_glass:framed_glass",
glass_block = "fl_glass:framed_glass",
glass_bottle = "fl_bottles:bottle",
coal_lump = "fl_ores:coal_ore",
stone = "fl_stone:stone",
desert_stone = "fl_stone:desert_stone",
desert_sand = "fl_stone:desert_sand",
chest = "fl_storage:wood_chest",
cobble = "fl_stone:stone_rubble",
brick = "",
obsidian_glass = "",
water_source = "fl_liquids:water_source",
water_flowing = "fl_liquids:water_flowing",
dirt = "fl_stone:dirt",
dirt_with_grass = "fl_topsoil:dirt_with_grass",
apple_leaves = "fl_trees:apple_leaves",
apple_log = "fl_trees:apple_trunk",
apple_planks = "fl_trees:apple_plank",
birch_leaves = "fl_trees:aspen_leaves",
birch_log = "fl_trees:aspen_trunk",
birch_planks = "fl_trees:aspen_plank",
jungle_leaves = "fl_trees:jungletree_leaves",
bowl = "",
}
if minetest.get_modpath("basic_materials") then
materials.paper = "basic_materials:plastic_sheet"
end
return materials

View File

@ -0,0 +1,104 @@
local materials = {
sand = "hades_core:fertile_sand",
sandstone = "hades_core:sandstone",
gravel = "hades_core:gravel",
flint = "",
copper_ingot = "hades_core:copper_ingot",
steel_ingot = "hades_core:steel_ingot",
gold_ingot = "hades_core:gold_ingot",
tin_ingot = "hades_core:tin_ingot",
silver_ingot = "--unknown--",
copper_block = "hades_core:copperblock",
steel_block = "hades_core:steelblock",
gold_block = "hades_core:goldblock",
tin_block = "hades_core:tinblock",
axe_steel = "hades_core:axe_steel",
axe_diamond = "hades_core:axe_diamond",
axe_bronze = "hades_core:axe_bronze",
axe_stone = "hades_core:axe_stone",
axe_wood = "hades_core:axe_wood",
pick_steel = "hades_core:pick_steel",
mese = "hades_core:mese",
mese_crystal = "hades_core:mese_crystal",
mese_crystal_fragment = "hades_core:mese_crystal_fragment",
torch = "hades_torches:torch",
diamond = "hades_core:diamond",
clay_lump = "hades_core:clay_lump",
clay_brick = "hades_core:clay_brick",
--[[
Since hades doesnt have buckets or water for the user,
using dirt from near water to pull the water out
]]
water_bucket = "hades_core:dirt",
empty_bucket = "hades_core:fertile_sand",
dye_dark_grey = "dye:dark_grey",
dye_black = "dye:black",
dye_white = "dye:white",
dye_green = "dye:green",
dye_red = "dye:red",
dye_yellow = "dye:yellow",
dye_brown = "dye:brown",
dye_blue = "dye:blue",
dye_violet = "dye:violet",
dye_grey = "dye:grey",
dye_dark_green = "dye:dark_green",
dye_orange = "dye:orange",
dye_pink = "dye:pink",
silicon = "hades_materials:silicon",
string = "hades_farming:string",
paper = "hades_core:paper",
book = "hades_core:book",
iron_lump = "hades_core:iron_lump",
wool_grey = "wool:grey",
wool_green = "wool:green",
wool_dark_green = "wool:dark_green",
wool_brown = "wool:brown",
wool_black = "wool:black",
wool_white = "wool:white",
slab_stone = "stairs:slab_stone",
slab_wood = "stairs:slab_wood",
glass = "hades_core:glass",
glass_block = "hades_core:glass",
glass_bottle = "vessels:glass_bottle",
obsidian_glass = "hades_core:obsidian_glass",
coal_lump = "hades_core:coal_lump",
stone = "hades_core:stone",
desert_stone = "hades_core:stone_baked",
desert_sand = "hades_core:volcanic_sand",
chest = "hades_chests:chest";
cobble = "hades_core:cobble",
brick = "hades_core:brick",
water_source = "hades_core:water_source",
water_flowing = "hades_core:water_flowing",
dirt = "hades_core:dirt",
dirt_with_grass = "hades_core:dirt_with_grass",
apple_leaves = "hades_trees:leaves",
apple_log = "hades_trees:tree",
apple_planks = "hades_trees:wood",
birch_leaves = "hades_core:birch_leaves",
birch_log = "hades_trees:birch_tree",
birch_planks = "hades_trees:cream_wood",
jungle_leaves = "hades_trees:jungle_leaves",
--hades has no bowl but you get plate on eat so makes most sense?
bowl = "hades_food:plate",
}
if minetest.get_modpath("hades_bucket") then
materials["water_bucket"] = "hades_bucket:bucket_water"
materials["empty_bucket"] = "hades_bucket:bucket_empty"
end
if minetest.get_modpath("hades_extraores") then
materials["silver_ingot"] = "hades_extraores:silver_ingot"
materials["aluminum_ingot"] = "hades_extraores:aluminum_ingot"
end
if minetest.get_modpath("hades_default") then
materials.desert_sand = "hades_default:desert_sand"
end
if minetest.get_modpath("hades_technic") then
materials.lead_ingot = "hades_technic:lead_ingot"
materials.carbon_steel_ingot = "hades_technic:carbon_steel_ingot"
materials.stainless_steel_ingot = "hades_technic:stainless_steel_ingot"
end
return materials

View File

@ -0,0 +1,81 @@
--note this file handles mineclonia, mineclone2, and its rename voxelibre
local materials = {
sand = "mcl_core:sand",
sandstone = "mcl_core:sandstone",
gravel = "mcl_core:gravel",
flint = "mcl_core:flint",
copper_ingot = "mcl_copper:copper_ingot",
steel_ingot = "mcl_core:iron_ingot",
gold_ingot = "mcl_core:gold_ingot",
tin_ingot = "mcl_core:iron_ingot",
copper_block = "mcl_copper:copper_block",
steel_block = "mcl_core:iron_block",
gold_block = "mcl_core:gold_block",
tin_block = "mcl_core:iron_block",
axe_steel = "mcl_core:axe_steel",
axe_diamond = "mcl_core:axe_diamond",
axe_bronze = "mcl_core:axe_bronze",
axe_stone = "mcl_core:axe_stone",
axe_wood = "mcl_core:axe_wood",
pick_steel = "mcl_core:pick_steel",
mese = "mesecons_torch:redstoneblock",
mese_crystal = "mesecons:redstone",
mese_crystal_fragment = "mcl_core:iron_ingot",
torch = "mcl_torches:torch",
diamond = "mcl_core:diamond",
clay_lump = "default:clay_lump",
water_bucket = "mcl_buckets:bucket:bucket_water",
empty_bucket = "mcl_buckets:bucket_empty",
dye_dark_grey = "mcl_dyes:dark_grey",
dye_black = "mcl_dyes:black",
dye_white = "mcl_dyes:white",
dye_green = "mcl_dyes:green",
dye_red = "mcl_dyes:red",
dye_yellow = "mcl_dyes:yellow",
dye_brown = "mcl_dyes:brown",
dye_blue = "mcl_dyes:blue",
dye_violet = "mcl_dyes:violet",
dye_grey = "mcl_dyes:grey",
dye_dark_green = "mcl_dyes:dark_green",
dye_orange = "mcl_dyes:orange",
dye_pink = "mcl_dyes:pink",
silicon = "mcl_core:iron_ingot",
string = "mcl_mobitems:string",
paper = "mcl_core:paper",
book = "mcl_core:book",
iron_lump = "mcl_core:stone_with_iron",
wool_grey = "mcl_wool:grey",
wool_green = "mcl_wool:green",
wool_dark_green = "mcl_wool:dark_green",
wool_brown = "mcl_wool:brown",
wool_black = "mcl_wool:black",
wool_white = "mcl_wool:white",
slab_stone = "mcl_stairs:slab_stone",
slab_wood = "mcl_stairs:slab_wood",
glass = "mcl_core:glass",
glass_block = "mcl_core:glass",
glass_bottle = "mcl_core:glass_bottle",
coal_lump = "mcl_core:coal",
stone = "mcl_core:stone",
desert_stone = "mcl_core:redsandstone",
desert_sand = "mcl_core:sand",
chest = "mcl_chests:chest",
cobble = "mcl_core:cobble",
brick = "mcl_core:brick",
obsidian_glass = "",
water_source = "mcl_core:water_source",
water_flowing = "mcl_core:water_flowing",
dirt = "mcl_core:dirt",
dirt_with_grass = "mcl_core:dirt_with_grass",
apple_leaves = "mcl_trees:leaves_oak",
apple_log = "mcl_trees:tree_oak",
apple_planks = "mcl_trees:wood_oak",
birch_leaves = "mcl_trees:leaves_birch",
birch_log = "mcl_trees:tree_birch",
birch_planks = "mcl_trees:wood_birch",
jungle_leaves = "mcl_trees:jungle_leaves",
bowl = "mcl_core:bowl",
}
return materials

103
src/materials/minetest.lua Normal file
View File

@ -0,0 +1,103 @@
local materials = {
sand = "default:sand",
sandstone = "default:sandstone",
gravel = "default:gravel",
flint = "default:flint",
copper_ingot = "default:copper_ingot",
steel_ingot = "default:steel_ingot",
gold_ingot = "default:gold_ingot",
tin_ingot = "default:tin_ingot",
copper_block = "default:copperblock",
steel_block = "default:steelblock",
gold_block = "default:goldblock",
tin_block = "default:tinblock",
axe_steel = "default:axe_steel",
axe_diamond = "default:axe_diamond",
axe_bronze = "default:axe_bronze",
axe_stone = "default:axe_stone",
axe_wood = "default:axe_wood",
pick_steel = "default:pick_steel",
mese = "default:mese",
mese_crystal = "default:mese_crystal",
mese_crystal_fragment = "default:mese_crystal_fragment",
torch = "default:torch",
diamond = "default:diamond",
clay_lump = "default:clay_lump",
water_bucket = "bucket:bucket_water",
empty_bucket = "bucket:bucket_empty",
dye_dark_grey = "dye:dark_grey",
dye_black = "dye:black",
dye_white = "dye:white",
dye_green = "dye:green",
dye_red = "dye:red",
dye_yellow = "dye:yellow",
dye_brown = "dye:brown",
dye_blue = "dye:blue",
dye_violet = "dye:violet",
dye_grey = "dye:grey",
dye_dark_green = "dye:dark_green",
dye_orange = "dye:orange",
dye_pink = "dye:pink",
silicon = "mesecons_materials:silicon",
string = "farming:string",
paper = "default:paper",
book = "default:book",
iron_lump = "default:iron_lump",
wool_grey = "wool:grey",
wool_green = "wool:green",
wool_dark_green = "wool:dark_green",
wool_brown = "wool:brown",
wool_black = "wool:black",
wool_white = "wool:white",
slab_stone = "stairs:slab_stone",
slab_wood = "stairs:slab_wood",
glass = "default:glass",
glass_block = "default:glass",
glass_bottle = "vessels:glass_bottle",
coal_lump = "default:coal_lump",
stone = "default:stone",
desert_stone = "default:desert_stone",
desert_sand = "default:desert_sand",
chest = "default:chest",
cobble = "default:cobble",
brick = "default:brick",
obsidian_glass = "default:obsidian_glass",
water_source = "default:water_source",
water_flowing = "default:water_flowing",
dirt = "default:dirt",
dirt_with_grass = "default:dirt_with_grass",
apple_leaves = "default:leaves",
apple_log = "default:tree",
apple_planks = "default:wood",
birch_leaves = "default:aspen_leaves",
birch_log = "default:aspen_tree",
birch_planks = "default:aspen_wood",
jungle_leaves = "default:jungleleaves",
bowl = "",
}
if minetest.registered_items["farming:bowl"] then
materials.bowl = "farming:bowl"
elseif minetest.get_modpath("x_farming") then
materials.bowl = "x_farming:bowl"
end
if minetest.get_modpath("moreores") then
materials.silver_ingot = "moreores:silver_ingot"
end
if minetest.get_modpath("technic") then
materials.lead_ingot = "technic:lead_ingot"
materials.carbon_steel_ingot = "technic:carbon_steel_ingot"
materials.stainless_steel_ingot = "technic:stainless_steel_ingot"
end
if minetest.get_modpath("aloz") then
materials.aluminum_ingot = "aloz:aluminum_ingot"
end
if minetest.get_modpath("techage") then
materials.aluminum_ingot = "techage:aluminum"
end
return materials

View File

@ -1,179 +1,8 @@
local textures = { local filename = xcompat.gameid
gravel = "[combine:16x16^[noalpha^[colorize:#3a3b3c",
brick = "[combine:16x16^[noalpha^[colorize:#AA4A44",
metal = { --if we dont have a materials file for the game, use minetest
steel = { if not xcompat.utilities.file_exists(xcompat.modpath .. "/src/textures/" .. filename .. ".lua") then
ore = "[combine:16x16^[noalpha^[colorize:#D3D3D3", filename = "xcompat_agnostic"
ingot = "[combine:16x16^[noalpha^[colorize:#D3D3D3",
block = "[combine:16x16^[noalpha^[colorize:#D3D3D3",
},
gold = {
ore = "[combine:16x16^[noalpha^[colorize:#FFD700",
ingot = "[combine:16x16^[noalpha^[colorize:#FFD700",
block = "[combine:16x16^[noalpha^[colorize:#FFD700",
},
},
glass = {
pane = "[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff",
detail = "[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff",
},
wood = {
apple = {
sapling = "[combine:16x16^[noalpha^[colorize:#654321",
planks = "[combine:16x16^[noalpha^[colorize:#654321",
trunk_side = "[combine:16x16^[noalpha^[colorize:#654321",
trunk_top = "[combine:16x16^[noalpha^[colorize:#654321",
leaves = "[combine:16x16^[noalpha^[colorize:#654321",
},
jungle = {
sapling = "[combine:16x16^[noalpha^[colorize:#563d2d",
planks = "[combine:16x16^[noalpha^[colorize:#563d2d",
trunk_side = "[combine:16x16^[noalpha^[colorize:#563d2d",
trunk_top = "[combine:16x16^[noalpha^[colorize:#563d2d",
leaves = "[combine:16x16^[noalpha^[colorize:#563d2d",
},
},
water = {
tile = "[combine:16x16^[noalpha^[colorize:#00008b",
animated = {
source = "[combine:16x16^[noalpha^[colorize:#00008b",
flowing = "[combine:16x16^[noalpha^[colorize:#00008b",
},
},
wool = {
white = "[combine:16x16^[noalpha^[colorize:#ffffff",
black = "[combine:16x16^[noalpha^[colorize:#000000",
grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
dark_grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
},
grass = {
top = "[combine:16x16^[noalpha^[colorize:#006400",
side = "[combine:16x16^[noalpha^[colorize:#006400",
dirt = "[combine:16x16^[noalpha^[colorize:#563d2d",
},
}
if minetest.get_modpath("default") then
textures = {
gravel = "default_gravel.png",
brick = "default_brick.png",
metal = {
steel = {
ore = "default_iron_lump.png",
ingot = "default_steel_ingot.png",
block = "default_steel_block.png",
},
gold = {
ore = "default_gold_lump.png",
ingot = "default_gold_ingot.png",
block = "default_gold_block.png",
},
},
glass = {
pane = "default_glass.png",
detail = "default_glass_detail.png",
},
wood = {
apple = {
sapling = "default_sapling.png",
planks = "default_wood.png",
trunk_side = "default_tree.png",
trunk_top = "default_tree_top.png",
leaves = "default_leaves.png",
},
jungle = {
sapling = "default_junglesapling.png",
planks = "default_junglewood.png",
trunk_side = "default_jungletree.png",
trunk_top = "default_jungletree_top.png",
leaves = "default_jungleleaves.png",
},
},
water = {
tile = "default_water.png",
animated = {
source = "default_water_source_animated.png",
flowing = "default_water_flowing_animated.png",
},
},
wool = {
white = "wool_white.png",
black = "wool_black.png",
grey = "wool_grey.png",
dark_grey = "wool_dark_grey.png",
},
grass = {
top = "default_grass.png",
side = "default_dirt.png^default_grass_side.png",
dirt = "default_dirt.png",
},
}
elseif minetest.get_modpath("fl_ores") and minetest.get_modpath("fl_stone") then
textures = {
gravel = "farlands_gravel.png",
brick = "farlands_brick.png",
metal = {
steel = {
ore = "farlands_iron_ingot.png",
ingot = "farlands_iron_ingot.png",
block = "farlands_iron_block.png",
},
gold = {
ore = "farlands_gold_ore.png",
ingot = "farlands_gold_ingot.png",
block = "farlands_gold_block.png",
},
},
glass = {
pane = "farlands_glass.png",
detail = "farlands_glass_detail.png",
},
wood = {
apple = {
sapling = "farlands_apple_sapling.png",
planks = "farlands_apple_planks.png",
trunk_side = "farlands_apple_trunk.png",
trunk_top = "farlands_apple_trunk_top.png",
leaves = "farlands_apple_leaves.png",
},
jungle = {
sapling = "farlands_jungletree_sapling.png",
planks = "farlands_jungletree_planks.png",
trunk_side = "farlands_jungletree_trunk.png",
trunk_top = "farlands_jungletree_trunk_top.png",
leaves = "farlands_jungletree_leaves.png",
},
},
water = {
tile = "farlands_water.png",
animated = {
source = "farlands_water_source_animated.png",
flowing = "farlands_water_flowing_animated.png",
},
},
wool = {
white = "farlands_wool.png",
black = "farlands_wool.png",
grey = "farlands_wool.png",
dark_grey = "farlands_wool.png",
},
grass = {
top = "farlands_grass.png",
side = "farlands_dirt.png^farlands_grass_side.png",
dirt = "farlands_dirt.png",
},
}
end end
return textures return dofile(xcompat.modpath .. "/src/textures/" .. filename .. ".lua")

View File

@ -0,0 +1,57 @@
local textures = {
gravel = "farlands_gravel.png",
brick = "farlands_brick.png",
metal = {
steel = {
ore = "farlands_iron_ingot.png",
ingot = "farlands_iron_ingot.png",
block = "farlands_iron_block.png",
},
gold = {
ore = "farlands_gold_ore.png",
ingot = "farlands_gold_ingot.png",
block = "farlands_gold_block.png",
},
},
glass = {
pane = "farlands_glass.png",
detail = "farlands_glass_detail.png",
},
wood = {
apple = {
sapling = "farlands_apple_sapling.png",
planks = "farlands_apple_planks.png",
trunk_side = "farlands_apple_trunk.png",
trunk_top = "farlands_apple_trunk_top.png",
leaves = "farlands_apple_leaves.png",
},
jungle = {
sapling = "farlands_jungletree_sapling.png",
planks = "farlands_jungletree_planks.png",
trunk_side = "farlands_jungletree_trunk.png",
trunk_top = "farlands_jungletree_trunk_top.png",
leaves = "farlands_jungletree_leaves.png",
},
},
water = {
tile = "farlands_water.png",
animated = {
source = "farlands_water_source_animated.png",
flowing = "farlands_water_flowing_animated.png",
},
},
wool = {
white = "farlands_wool.png",
black = "farlands_wool.png",
grey = "farlands_wool.png",
dark_grey = "farlands_wool.png",
},
grass = {
top = "farlands_grass.png",
side = "farlands_dirt.png^farlands_grass_side.png",
dirt = "farlands_dirt.png",
},
}
return textures

57
src/textures/minetest.lua Normal file
View File

@ -0,0 +1,57 @@
local textures = {
gravel = "default_gravel.png",
brick = "default_brick.png",
metal = {
steel = {
ore = "default_iron_lump.png",
ingot = "default_steel_ingot.png",
block = "default_steel_block.png",
},
gold = {
ore = "default_gold_lump.png",
ingot = "default_gold_ingot.png",
block = "default_gold_block.png",
},
},
glass = {
pane = "default_glass.png",
detail = "default_glass_detail.png",
},
wood = {
apple = {
sapling = "default_sapling.png",
planks = "default_wood.png",
trunk_side = "default_tree.png",
trunk_top = "default_tree_top.png",
leaves = "default_leaves.png",
},
jungle = {
sapling = "default_junglesapling.png",
planks = "default_junglewood.png",
trunk_side = "default_jungletree.png",
trunk_top = "default_jungletree_top.png",
leaves = "default_jungleleaves.png",
},
},
water = {
tile = "default_water.png",
animated = {
source = "default_water_source_animated.png",
flowing = "default_water_flowing_animated.png",
},
},
wool = {
white = "wool_white.png",
black = "wool_black.png",
grey = "wool_grey.png",
dark_grey = "wool_dark_grey.png",
},
grass = {
top = "default_grass.png",
side = "default_dirt.png^default_grass_side.png",
dirt = "default_dirt.png",
},
}
return textures

View File

@ -0,0 +1,65 @@
local textures = {
gravel = "[combine:16x16^[noalpha^[colorize:#3a3b3c",
brick = "[combine:16x16^[noalpha^[colorize:#AA4A44",
metal = {
steel = {
ore = "[combine:16x16^[noalpha^[colorize:#D3D3D3",
ingot = "[combine:16x16^[noalpha^[colorize:#D3D3D3",
block = "[combine:16x16^[noalpha^[colorize:#D3D3D3",
},
gold = {
ore = "[combine:16x16^[noalpha^[colorize:#FFD700",
ingot = "[combine:16x16^[noalpha^[colorize:#FFD700",
block = "[combine:16x16^[noalpha^[colorize:#FFD700",
},
},
glass = {
pane = "[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff",
detail = "[combine:16x16:" ..
"0,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,0=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"0,15=\\[combine\\:16x1\\^[noalpha\\^[colorize\\:#ffffff:" ..
"15,0=\\[combine\\:1x16\\^[noalpha\\^[colorize\\:#ffffff",
},
wood = {
apple = {
sapling = "[combine:16x16^[noalpha^[colorize:#654321",
planks = "[combine:16x16^[noalpha^[colorize:#654321",
trunk_side = "[combine:16x16^[noalpha^[colorize:#654321",
trunk_top = "[combine:16x16^[noalpha^[colorize:#654321",
leaves = "[combine:16x16^[noalpha^[colorize:#654321",
},
jungle = {
sapling = "[combine:16x16^[noalpha^[colorize:#563d2d",
planks = "[combine:16x16^[noalpha^[colorize:#563d2d",
trunk_side = "[combine:16x16^[noalpha^[colorize:#563d2d",
trunk_top = "[combine:16x16^[noalpha^[colorize:#563d2d",
leaves = "[combine:16x16^[noalpha^[colorize:#563d2d",
},
},
water = {
tile = "[combine:16x16^[noalpha^[colorize:#00008b",
animated = {
source = "[combine:16x16^[noalpha^[colorize:#00008b",
flowing = "[combine:16x16^[noalpha^[colorize:#00008b",
},
},
wool = {
white = "[combine:16x16^[noalpha^[colorize:#ffffff",
black = "[combine:16x16^[noalpha^[colorize:#000000",
grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
dark_grey = "[combine:16x16^[noalpha^[colorize:#313b3c",
},
grass = {
top = "[combine:16x16^[noalpha^[colorize:#006400",
side = "[combine:16x16^[noalpha^[colorize:#006400",
dirt = "[combine:16x16^[noalpha^[colorize:#563d2d",
},
}
return textures

8
src/utilities.lua Normal file
View File

@ -0,0 +1,8 @@
local utilities = {}
function utilities.file_exists(name)
local f=io.open(name,"r")
if f~=nil then io.close(f) return true else return false end
end
return utilities