Added technic_compat mod to keep compatability functions accessable to the whole modpack

This commit is contained in:
James David Clarke
2023-12-28 09:54:09 +00:00
parent 9a231387a3
commit 588d36ba09
57 changed files with 460 additions and 440 deletions

16
technic_compat/init.lua Normal file
View File

@ -0,0 +1,16 @@
local modpath = minetest.get_modpath("technic_compat")
-- Compatibility table
technic_compat = {}
technic_compat.mcl = minetest.get_modpath("mcl_core")
technic_compat.default = minetest.get_modpath("default") and default or {}
local mcl_path = modpath .. "/mcl/"
-- Load files
dofile(mcl_path .. "sounds.lua")
dofile(mcl_path .. "textures.lua")
dofile(mcl_path .. "miscellaneous.lua")
dofile(mcl_path .. "crafting.lua")
dofile(mcl_path .. "craftguide.lua")

View File

@ -0,0 +1,189 @@
-- Register craft types for each machine
if technic_compat.mcl then
mcl_craftguide.register_craft_type("centrifuge", {
description = "Centrifuge",
icon = "technic_mv_centrifuge_front_active.png",
})
mcl_craftguide.register_craft_type("compressor", {
description = "Compressor",
icon = "technic_lv_compressor_front_active.png",
})
mcl_craftguide.register_craft_type("extractor", {
description = "Extractor",
icon = "technic_lv_extractor_front_active.png",
})
mcl_craftguide.register_craft_type("freezer", {
description = "Freezer",
icon = "technic_mv_freezer_front_active.png",
})
mcl_craftguide.register_craft_type("grinder", {
description = "Grinder",
icon = "technic_lv_grinder_front_active.png",
})
mcl_craftguide.register_craft_type("alloy_furnace", {
description = "Alloy Furnace",
icon = "technic_coal_alloy_furnace_front_active.png",
})
centrifuge_recipes = {
{ "technic:bronze_dust 8", "technic:copper_dust 7", "technic:tin_dust" },
{ "technic:stainless_steel_dust 5", "technic:wrought_iron_dust 4", "technic:chromium_dust" },
{ "technic:brass_dust 3", "technic:copper_dust 2", "technic:zinc_dust" },
{ "technic:chernobylite_dust", technic_compat.sand_ingredient, "technic:uranium3_dust" },
{ technic_compat.dirt_ingredient.." 4", technic_compat.sand_ingredient, technic_compat.gravel_ingredient, "default:clay_lump 2" },
}
compressor_recipes = {
{technic_compat.snow_block_ingredient, technic_compat.ice_block_ingredient},
{technic_compat.sand_ingredient.." 2", technic_compat.sandstone_ingredient},
{technic_compat.desert_sand_ingredient.." 2", technic_compat.desert_stone_ingredient},
{technic_compat.desert_sand_ingredient, technic_compat.desert_stone_ingredient},
{"technic:mixed_metal_ingot", "technic:composite_plate"},
{technic_compat.copper_ingredient.." 5", "technic:copper_plate"},
{"technic:coal_dust 4", "technic:graphite"},
{"technic:carbon_cloth", "technic:carbon_plate"},
{"technic:uranium35_ingot 5", "technic:uranium_fuel"},
}
extractor_recipes = {
{"technic:coal_dust", technic_compat.dye_black .. " 2"},
{technic_compat.blueberries_ingredient, technic_compat.dye_violet .. " 2"},
{technic_compat.grass_ingredient, technic_compat.dye_green .. " 1"},
{technic_compat.dry_shrub_ingredient, technic_compat.dye_brown .. " 1"},
{technic_compat.junglegrass_ingredient, technic_compat.dye_green .. " 2"},
{technic_compat.cactus_ingredient, technic_compat.dye_green .. " 4"},
{technic_compat.geranium_ingredient, technic_compat.dye_blue .. " 4"},
{technic_compat.dandelion_white_ingredient, technic_compat.dye_white .. " 4"},
{technic_compat.dandelion_yellow_ingredient, technic_compat.dye_yellow .. " 4"},
{technic_compat.tulip_ingredient, technic_compat.dye_orange .. " 4"},
{technic_compat.rose_ingredient, technic_compat.dye_red .. " 4"},
{technic_compat.viola_ingredient, technic_compat.dye_violet .. " 4"},
{technic_compat.blackberry_ingredient, unifieddyes and "unifieddyes:magenta_s50 4" or technic_compat.dye_violet .. " 4"},
{technic_compat.blueberry_ingredient, unifieddyes and "unifieddyes:magenta_s50 4" or ""},
}
freezer_recipes = {
{technic_compat.water_bucket_ingredient, { technic_compat.ice_block_ingredient, technic_compat.emtpy_bucket_ingredient } },
{technic_compat.bucket_river_water_ingredient, { technic_compat.ice_block_ingredient, technic_compat.emtpy_bucket_ingredient } },
{technic_compat.dirt_ingredient , technic_compat.dirt_with_snow_ingredient },
{technic_compat.bucket_lava_ingredient, { technic_compat.obsidian_ingredient, technic_compat.emtpy_bucket_ingredient } }
}
grinder_recipes = {
-- Dusts
{technic_compat.coal_ingredient, "technic:coal_dust 2"},
{technic_compat.copper_lump_ingredient, "technic:copper_dust 2"},
{technic_compat.desert_stone_ingredient, technic_compat.desert_sand_ingredient},
{technic_compat.gold_lump_ingredient, "technic:gold_dust 2"},
{technic_compat.iron_lump_ingredient, "technic:wrought_iron_dust 2"},
{"moreores:tin_lump", "technic:tin_dust 2"},
{"technic:chromium_lump", "technic:chromium_dust 2"},
{"technic:uranium_lump", "technic:uranium_dust 2"},
{"technic:zinc_lump", "technic:zinc_dust 2"},
{"technic:lead_lump", "technic:lead_dust 2"},
{"technic:sulfur_lump", "technic:sulfur_dust 2"},
{technic_compat.stone_ingredient, "technic:stone_dust"},
{technic_compat.sand_ingredient, "technic:stone_dust"},
{technic_compat.desert_sand_ingredient, "technic:stone_dust"},
-- Other
{technic_compat.cobble_ingredient, technic_compat.gravel_ingredient},
{technic_compat.gravel_ingredient, technic_compat.sand_ingredient},
{technic_compat.sandstone_ingredient, technic_compat.sand_ingredient.." 2"}, -- reverse recipe can be found in the compressor
{technic_compat.desert_stone_ingredient, technic_compat.desert_sand_ingredient.." 2"}, -- reverse recipe can be found in the compressor
{technic_compat.ice_block_ingredient, technic_compat.snow_block_ingredient},
}
alloy_recipes = {
{"technic:copper_dust 7", "technic:tin_dust", "technic:bronze_dust 8", 12},
{technic_compat.copper_ingredient.." 7", technic_compat.tin_ingredient, technic_compat.bronze_ingredient.." 8", 12},
{"technic:wrought_iron_dust 2", "technic:coal_dust", "technic:carbon_steel_dust 2", 6},
{"technic:wrought_iron_ingot 2", "technic:coal_dust", "technic:carbon_steel_ingot 2", 6},
{"technic:carbon_steel_dust 2", "technic:coal_dust", "technic:cast_iron_dust 2", 6},
{"technic:carbon_steel_ingot 2", "technic:coal_dust", "technic:cast_iron_ingot 2", 6},
{"technic:carbon_steel_dust 4", "technic:chromium_dust", "technic:stainless_steel_dust 5", 7.5},
{"technic:carbon_steel_ingot 4", "technic:chromium_ingot", "technic:stainless_steel_ingot 5", 7.5},
{"technic:copper_dust 2", "technic:zinc_dust", "technic:brass_dust 3"},
{technic_compat.copper_ingredient.." 2", "technic:zinc_ingot", "basic_materials:brass_ingot 3"},
{technic_compat.sand_ingredient.." 2", "technic:coal_dust 2", "technic:silicon_wafer"},
{"technic:silicon_wafer", "technic:gold_dust", "technic:doped_silicon_wafer"},
-- from https://en.wikipedia.org/wiki/Carbon_black
-- The highest volume use of carbon black is as a reinforcing filler in rubber products, especially tires.
-- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black improves its tensile strength and wear resistance …"
{"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2},
{technic_compat.ice_block_ingredient, technic_compat.emtpy_bucket_ingredient, technic_compat.water_bucket_ingredient, 1 },
}
for _, data in pairs(alloy_recipes) do
mcl_craftguide.register_craft({
type = "alloy_furnace",
width = 1,
output = data[3],
items = {data[1], data[2]},
})
end
-- Register Centrifuge Recipes
for _, data in pairs(centrifuge_recipes) do
mcl_craftguide.register_craft({
type = "centrifuge",
width = 1,
output = table.concat({data[2], data[3], data[4]}, " "),
items = {data[1]},
})
end
-- Register Compressor Recipes
for _, data in pairs(compressor_recipes) do
mcl_craftguide.register_craft({
type = "compressor",
width = 1,
output = data[2],
items = {data[1]},
})
end
-- Register Extractor Recipes
for _, data in ipairs(extractor_recipes) do
mcl_craftguide.register_craft({
type = "extractor",
width = 1,
output = data[2],
items = {data[1]},
})
end
-- Register Freezer Recipes
for _, data in pairs(freezer_recipes) do
local output_string
if type(data[2]) == "table" then
output_string = table.concat(data[2], ", ")
else
output_string = data[2]
end
mcl_craftguide.register_craft({
type = "freezer",
width = 1,
output = output_string,
items = {data[1]},
})
end
-- Register Grinder Recipes
for _, data in pairs(grinder_recipes) do
mcl_craftguide.register_craft({
type = "grinder",
width = 1,
output = data[2],
items = {data[1]},
})
end
end

View File

@ -0,0 +1,102 @@
-- Helper function to set compatibility variables
local function set_compat(mcl_value, default_value)
return technic_compat.mcl and mcl_value or default_value
end
-- Mineclone2 Support
technic_compat.copper_ingredient = technic_compat.mcl and "mcl_copper:copper_ingot" or 'default:copper_ingot'
technic_compat.iron_ingredient = technic_compat.mcl and "mcl_core:iron_ingot" or 'default:steel_ingot'
technic_compat.iron_lump_ingredient = technic_compat.mcl and "mcl_raw_ores:raw_iron" or 'default:iron_lump'
technic_compat.gold_lump_ingredient = technic_compat.mcl and "mcl_raw_ores:raw_gold" or 'default:gold_lump'
technic_compat.copper_lump_ingredient = technic_compat.mcl and "mcl_copper:raw_copper" or 'default:copper_lump'
technic_compat.mese_crystal_ingredient = technic_compat.mcl and "mesecons:wire_00000000_off" or 'default:mese_crystal'
technic_compat.diamond_ingredient = technic_compat.mcl and "mcl_core:diamond" or 'default:diamond'
technic_compat.glass_ingredient = technic_compat.mcl and "mcl_core:glass" or 'default:glass'
technic_compat.brick_block_ingredient = technic_compat.mcl and "mcl_core:brick_block" or 'default:brick'
technic_compat.mese_block_ingredient = technic_compat.mcl and "mesecons_torch:redstoneblock" or "default:mese"
technic_compat.paper_ingredient = technic_compat.mcl and "mcl_core:paper" or 'default:paper'
technic_compat.obsidian_glass_ingredient = technic_compat.mcl and "mcl_core:obsidian" or 'default:obsidian_glass'
technic_compat.obsidian_ingredient = technic_compat.mcl and "mcl_core:obsidian" or 'default:obsidian'
technic_compat.green_dye_ingredient = technic_compat.mcl and "mcl_dye:green" or 'dye:green'
technic_compat.blue_dye_ingredient = technic_compat.mcl and "mcl_dye:blue" or 'dye:blue'
technic_compat.red_dye_ingredient = technic_compat.mcl and "mcl_dye:red" or 'dye:red'
technic_compat.white_dye_ingredient = technic_compat.mcl and "mcl_dye:white" or 'dye:white'
technic_compat.gold_ingot_ingredient = technic_compat.mcl and "mcl_core:gold_ingot" or 'default:gold_ingot'
technic_compat.chest_ingredient = technic_compat.mcl and "mcl_chests:chest" or "default:chest"
technic_compat.stone_ingredient = technic_compat.mcl and "mcl_core:stone" or "default:stone"
technic_compat.wood_fence_ingredient = technic_compat.mcl and "group:fence_wood" or "default:fence_wood"
technic_compat.diamond_ingredient = technic_compat.mcl and "mcl_core:diamond" or "default:diamond"
technic_compat.bronze_ingredient = technic_compat.mcl and "mcl_copper:copper_ingot" or 'default:bronze_ingot'
technic_compat.tin_ingredient = technic_compat.mcl and "moreores:tin_ingot" or 'default:tin_ingot'
technic_compat.sandstone_ingredient = technic_compat.mcl and "mcl_core:sandstone" or 'default:desert_stone'
technic_compat.sand_ingredient = technic_compat.mcl and "mcl_core:sand" or 'default:sand'
technic_compat.gravel_ingredient = technic_compat.mcl and "mcl_core:gravel" or 'default:gravel'
technic_compat.desert_stone_ingredient = technic_compat.mcl and "mcl_core:redsandstone" or 'default:desert_stone'
technic_compat.desert_sand_ingredient = technic_compat.mcl and "mcl_core:redsand" or 'default:desert_sand'
technic_compat.furnace_ingredient = technic_compat.mcl and "mcl_furnaces:furnace" or 'default:furnace'
technic_compat.mossy_cobble_ingredient = technic_compat.mcl and "mcl_core:mossycobble" or 'default:mossycobble'
technic_compat.cobble_ingredient = technic_compat.mcl and "mcl_core:cobble" or 'default:cobble'
technic_compat.snow_block_ingredient = technic_compat.mcl and "mcl_core:snowblock" or 'default:snowblock'
technic_compat.ice_block_ingredient = technic_compat.mcl and "mcl_core:ice" or 'default:ice'
technic_compat.granite_ingredient = technic_compat.mcl and "mcl_core:granite" or 'technic:granite'
technic_compat.granite_bricks_ingredient = technic_compat.mcl and "mcl_core:granite_smooth" or 'technic:granite_bricks'
technic_compat.coal_ingredient = technic_compat.mcl and "group:coal" or "default:coal_lump"
technic_compat.dirt_ingredient = technic_compat.mcl and "mcl_core:dirt" or "default:dirt"
technic_compat.mesecons_fiber_ingredient = technic_compat.mcl and "mesecons:wire_00000000_off" or "mesecons_materials:fiber"
technic_compat.stick_ingredient = technic_compat.mcl and "mcl_core:stick" or "default:stick"
technic_compat.emtpy_bucket_ingredient = technic_compat.mcl and "mcl_buckets:bucket_empty" or "bucket:bucket_empty"
technic_compat.water_bucket_ingredient = technic_compat.mcl and "mcl_buckets:bucket_water" or "bucket:bucket_water"
-- Ingredient Variables
if technic_compat.mcl then
technic_compat.blueberries_ingredient = "mcl_farming:blueberries"
technic_compat.grass_ingredient = "mcl_core:grass"
technic_compat.dry_shrub_ingredient = "mcl_core:deadbush"
technic_compat.junglegrass_ingredient = "mcl_core:tallgrass"
technic_compat.cactus_ingredient = "mcl_core:cactus"
technic_compat.geranium_ingredient = "mcl_flowers:blue_orchid"
technic_compat.dandelion_white_ingredient = "mcl_flowers:oxeye_daisy"
technic_compat.dandelion_yellow_ingredient = "mcl_flowers:dandelion"
technic_compat.tulip_ingredient = "mcl_flowers:orange_tulip"
technic_compat.rose_ingredient = "mcl_flowers:poppy"
technic_compat.viola_ingredient = "mcl_flowers:allium"
else
technic_compat.blueberries_ingredient = "default:blueberries"
technic_compat.grass_ingredient = "default:grass_1"
technic_compat.dry_shrub_ingredient = "default:dry_shrub"
technic_compat.junglegrass_ingredient = "default:junglegrass"
technic_compat.cactus_ingredient = "default:cactus"
technic_compat.geranium_ingredient = "flowers:geranium"
technic_compat.dandelion_white_ingredient = "flowers:dandelion_white"
technic_compat.dandelion_yellow_ingredient = "flowers:dandelion_yellow"
technic_compat.tulip_ingredient = "flowers:tulip"
technic_compat.rose_ingredient = "flowers:rose"
technic_compat.viola_ingredient = "flowers:viola"
end
-- Dye Output Variables
if technic_compat.mcl then
technic_compat.dye_black = "mcl_dye:black"
technic_compat.dye_violet = "mcl_dye:violet"
technic_compat.dye_green = "mcl_dye:green"
technic_compat.dye_brown = "mcl_dye:brown"
technic_compat.dye_blue = "mcl_dye:blue"
technic_compat.dye_white = "mcl_dye:white"
technic_compat.dye_yellow = "mcl_dye:yellow"
technic_compat.dye_orange = "mcl_dye:orange"
technic_compat.dye_red = "mcl_dye:red"
else
technic_compat.dye_black = "dye:black"
technic_compat.dye_violet = "dye:violet"
technic_compat.dye_green = "dye:green"
technic_compat.dye_brown = "dye:brown"
technic_compat.dye_blue = "dye:blue"
technic_compat.dye_white = "dye:white"
technic_compat.dye_yellow = "dye:yellow"
technic_compat.dye_orange = "dye:orange"
technic_compat.dye_red = "dye:red"
end
technic_compat.dirt_with_snow_ingredient = technic_compat.mcl and "mcl_core:dirt_with_grass_snow" or "default:dirt_with_snow"
technic_compat.bucket_lava_ingredient = technic_compat.mcl and "mcl_buckets:bucket_lava" or "bucket:bucket_lava"
technic_compat.bucket_river_water_ingredient = technic_compat.mcl and "mcl_buckets:bucket_river_water" or "bucket:bucket_river_water"

View File

@ -0,0 +1 @@
technic_compat.mt_light_max = technic_compat.mcl and mcl_core.LIGHT_MAX or (default and default.LIGHT_MAX)

View File

@ -0,0 +1 @@
technic_compat.stone_sounds = technic_compat.mcl and mcl_sounds.node_sound_stone_defaults() or default.node_sound_stone_defaults()

View File

@ -0,0 +1,10 @@
local dirt_texture = technic_compat.mcl and "default_dirt.png" or "default_dirt.png"
local grass_texture = technic_compat.mcl and "mcl_core_palette_grass.png" or "default_grass.png"
local wood_texture = technic_compat.mcl and "default_wood.png" or "default_wood.png"
local stone_texture = technic_compat.mcl and "default_stone.png" or "default_stone.png"
local cobble_texture = technic_compat.mcl and "default_cobble.png" or "default_cobble.png"
local brick_texture = technic_compat.mcl and "default_brick.png" or "default_brick.png"
local sandstone_texture = technic_compat.mcl and "mcl_core_sandstone_top.png" or "default_sandstone.png"
local leaves_texture = technic_compat.mcl and "default_leaves.png" or "default_leaves.png"
local tree_texture = technic_compat.mcl and "default_tree.png" or "default_tree.png"
local bronzeblock_texture = technic_compat.mcl and "mcl_core_bronze_block.png" or "default_bronze_block.png"

4
technic_compat/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = technic_compat
description = Makes Technic compatible with other games and mods
optional_depends = mcl_core, mcl_sounds, default, mcl_craftguide
supported_games = minetest_game,mineclone2,mineclonia,mineclone5