diff --git a/exchangeclone/alchemical_books.lua b/exchangeclone/alchemical_books.lua index 8e02fd9..d99c9d5 100644 --- a/exchangeclone/alchemical_books.lua +++ b/exchangeclone/alchemical_books.lua @@ -1,7 +1,9 @@ -- There's a lot of duplicated code in this file, but removing it means adding more duplicated code... so I'm just going to leave it. local function extract_dimension(pos) - if exchangeclone.mtg then + if exchangeclone.exile then + return nil, pos + elseif exchangeclone.mtg then if minetest.get_modpath("nether") then if pos.y >= nether.DEPTH_FLOOR and pos.y <= nether.DEPTH_CEILING then return "Nether", pos @@ -11,6 +13,7 @@ local function extract_dimension(pos) end return nil, pos end + assert(exchangeclone.mcl) -- overworld if (pos.y >= mcl_vars.mg_overworld_min) and (pos.y <= mcl_vars.mg_overworld_max) then @@ -35,9 +38,10 @@ end local function add_dimension(dimension, pos) dimension = dimension:lower() - if exchangeclone.mtg then + if exchangeclone.mtg or exchangeclone.exile then return pos end + assert(exchangeclone.mcl) if dimension == "nether" then local report_y = pos.y + mcl_vars.mg_nether_min @@ -332,13 +336,11 @@ minetest.register_tool("exchangeclone:arcane_alchemical_book", { on_place = alchemical_book_function }) -local craftitem = exchangeclone.mcl and "mcl_throwing:ender_pearl" or "default:mese_crystal" - minetest.register_craft({ output = "exchangeclone:basic_alchemical_book", recipe = { {"exchangeclone:low_covalence_dust","exchangeclone:red_matter", "exchangeclone:low_covalence_dust"}, - {craftitem, exchangeclone.itemstrings.book, "exchangeclone:philosophers_stone"}, + { exchangeclone.itemstrings.ender_pearl, exchangeclone.itemstrings.book, "exchangeclone:philosophers_stone" }, {"exchangeclone:low_covalence_dust","exchangeclone:red_matter", "exchangeclone:low_covalence_dust"}, } }) @@ -347,7 +349,7 @@ minetest.register_craft({ output = "exchangeclone:advanced_alchemical_book", recipe = { {"exchangeclone:medium_covalence_dust","exchangeclone:pink_matter", "exchangeclone:medium_covalence_dust"}, - {craftitem, "exchangeclone:basic_alchemical_book", "exchangeclone:pink_matter"}, + { exchangeclone.itemstrings.ender_pearl, "exchangeclone:basic_alchemical_book", "exchangeclone:pink_matter" }, {"exchangeclone:medium_covalence_dust","exchangeclone:pink_matter", "exchangeclone:medium_covalence_dust"}, } }) diff --git a/exchangeclone/alchemical_chests.lua b/exchangeclone/alchemical_chests.lua index f53c44e..c7ea4c5 100644 --- a/exchangeclone/alchemical_chests.lua +++ b/exchangeclone/alchemical_chests.lua @@ -75,8 +75,8 @@ minetest.register_node("exchangeclone:alchemical_chest", { can_dig = exchangeclone.can_dig, }) -local stone_itemstring = exchangeclone.mcl and "mcl_core:stone" or "default:stone" -local chest_itemstring = exchangeclone.mcl and "mcl_chests:chest" or "default:chest" +local stone_itemstring = exchangeclone.itemstrings.stone +local chest_itemstring = exchangeclone.itemstrings.chest minetest.register_craft({ output = "exchangeclone:alchemical_chest", @@ -98,8 +98,8 @@ end) for color, color_data in pairs(exchangeclone.colors) do local bag_itemstring = "exchangeclone:alchemical_bag_"..color local advanced_itemstring = "exchangeclone:advanced_alchemical_chest_"..color - local wool_itemstring = (exchangeclone.mcl and "mcl_wool:" or "wool:")..color - local dye_itemstring = (exchangeclone.mcl and "mcl_dye:" or "dye:")..color + local wool_itemstring = exchangeclone.itemstrings.wool_prefix .. color + local dye_itemstring = exchangeclone.itemstrings.dye_prefix .. color local bag_modifier = "^[multiply:"..color_data.hex if color == "white" then bag_modifier = "" end diff --git a/exchangeclone/amulets.lua b/exchangeclone/amulets.lua index 3b7cd6f..fd91b5b 100644 --- a/exchangeclone/amulets.lua +++ b/exchangeclone/amulets.lua @@ -11,6 +11,21 @@ local fire_nodes = { ["default:torch"] = true, ["default:torch_ceiling"] = true, ["default:torch_wall"] = true, + ["tech:small_wood_fire"] = true, + ["tech:large_wood_fire"] = true, + ["tech:small_wood_fire_smoldering"] = true, + ["tech:large_wood_fire_smoldering"] = true, + ["tech:small_charcoal_fire"] = true, + ["tech:large_charcoal_fire"] = true, + ["tech:small_charcoal_fire_smoldering"] = true, + ["tech:large_charcoal_fire_smoldering"] = true, + ["tech:torch"] = true, + ["tech:torch_wall"] = true, + ["tech:torch_ceiling"] = true, + ["nodes_nature:lava_source"] = true, + ["nodes_nature:lava_flowing"] = true, + ["climate:air_temp"] = true, + ["climate:air_temp_visible"] = true, } local function place_liquid(itemstack, player, pointed_thing) diff --git a/exchangeclone/armor.lua b/exchangeclone/armor.lua index 0498674..9135353 100644 --- a/exchangeclone/armor.lua +++ b/exchangeclone/armor.lua @@ -199,7 +199,10 @@ if exchangeclone.mcl then return math.max(0, damage - blocked) end end, -100) +elseif exchangeclone.exile then + -- FIXME: add armor else + assert(exchangeclone.mtg) for _, matter in pairs({"Dark", "Red"}) do for piece, place in pairs({Helmet = "head", Chestplate = "torso", Leggings = "legs", Boots = "feet"}) do local matter_lower = matter:lower() diff --git a/exchangeclone/axes.lua b/exchangeclone/axes.lua index 0033ab7..dfa2269 100644 --- a/exchangeclone/axes.lua +++ b/exchangeclone/axes.lua @@ -18,7 +18,8 @@ function exchangeclone.axe_action(itemstack, player, center, force_strip) if strip and not (exchangeclone.mcla or stripped_variant) then return end end local nodes - local groups_to_search = strip and {start_node.name} or {"group:tree", "group:leaves", "group:bamboo_block"} + local groups_to_search = strip and { start_node.name } or + { "group:tree", "group:leaves", "group:leafdecay", "group:bamboo_block" } local range_type = strip and "basic_radius" or "large_radius" if charge > 1 then local vector1, vector2 = exchangeclone.process_range(player, range_type, charge) @@ -71,7 +72,7 @@ local function axe_on_place(itemstack, player, pointed_thing) if pointed_thing.type == "node" then local name = minetest.get_node(pointed_thing.under).name if (minetest.get_item_group(name, "tree") > 0) - or (minetest.get_item_group(name, "bamboo_block") > 0) then + or (minetest.get_item_group(name, "bamboo_block") > 0) then exchangeclone.axe_action(itemstack, player, pointed_thing.under) elseif exchangeclone.mcl then if minetest.registered_items[name]._mcl_stripped_variant then diff --git a/exchangeclone/base_emc_values.lua b/exchangeclone/base_emc_values.lua new file mode 100644 index 0000000..dce4137 --- /dev/null +++ b/exchangeclone/base_emc_values.lua @@ -0,0 +1,182 @@ +if exchangeclone.exile then + table.insert_all(exchangeclone.group_values, { + {"log", 32}, + {"leafdecay", 1}, + {"_ncrafting_bundle", 64}, + {"_ncrafting_dye_color", 32}, + {"air", 0}, + }) + for itemstring, emc_value in pairs({ + ["tech:soup"] = 16, + + ["bones:bones"] = 32, + ["lore:exile_letter"] = 32, + + ["animals:impethu"] = 32, + ["animals:impethu_eggs"] = 8, + + ["nodes_nature:vansano"] = 32, + ["nodes_nature:anperla"] = 32, + ["nodes_nature:reshedaar"] = 64, + ["nodes_nature:mahal"] = 64, + ["nodes_nature:tikusati"] = 32, + ["nodes_nature:nebiyi"] = 32, + ["nodes_nature:marbhan"] = 32, + ["nodes_nature:hakimi"] = 32, + ["nodes_nature:merki"] = 32, + ["nodes_nature:wiha"] = 32, + ["nodes_nature:zufani"] = 32, + ["nodes_nature:galanta"] = 32, + ["nodes_nature:momo"] = 32, + ["nodes_nature:glow_worm"] = 32, + ["nodes_nature:lambakap"] = 64, + + ["nodes_nature:gemedi"] = 16, + ["nodes_nature:cana"] = 16, + ["nodes_nature:tiken"] = 16, + ["nodes_nature:chalin"] = 16, + + ["nodes_nature:salt_water_source"] = 0.05, -- basically free + ["nodes_nature:freshwater_source"] = 64, -- hard to get and doesn't duplicate + ['nodes_nature:lava_source'] = 8192, -- because it's so hard to get + ['tech:molten_slag_source'] = 8192, -- because it's so hard to get + + ['nodes_nature:ironstone_boulder'] = 64, + ['nodes_nature:volcanic_ash'] = 1, + ['tech:wood_ash'] = 8, + ['tech:potash_source'] = 32, + ['tech:broken_pottery'] = 8, + ['nodes_nature:gneiss_boulder'] = 4, + ['tech:clay_water_pot'] = 16, + ['tech:cooking_pot'] = 16, + ['tech:clay_storage_pot'] = 16, + ['tech:clay_oil_lamp_empty'] = 16, + ['tech:charcoal'] = 128, + + ['nodes_nature:jade_boulder'] = 64, + + --costly processed materials, expensive tools, crap artifacts (rarity 4) + --['artifacts:moon_glass'] = 64, + ['artifacts:antiquorium_ladder'] = 4096 * 7 / 16, + ['artifacts:antiquorium_chest'] = 4096 * 4, + --['artifacts:antiquorium'] = 64, + ['doors:door_antiquorium'] = 4096 * 4, + ['artifacts:trapdoor_antiquorium'] = 4096 * 2, + + --['nodes_nature:zufani_seed'] = 64, + + + --low level artifacts (rarity 5), non-durables + --['artifacts:conveyor'] = 256, + --['artifacts:trampoline'] = 256, + + --['nodes_nature:merki_seed'] = 256, + + ['artifacts:light_meter'] = 4000, + ['artifacts:thermometer'] = 4000, + ['artifacts:temp_probe'] = 4000, + ['artifacts:fuel_probe'] = 4000, + ['artifacts:smelter_probe'] = 4000, + ['artifacts:potters_probe'] = 4000, + ['artifacts:chefs_probe'] = 4000, + ['artifacts:farmers_probe'] = 4000, + ['artifacts:animal_probe'] = 4000, + + ['artifacts:spyglass'] = 256, + ['artifacts:bell'] = 256, + ['artifacts:waystone'] = 256, + ['artifacts:wayfinder_0'] = 256, + + --['tech:stick'] = 256, + + --['tech:fine_fibre'] = 256, + --['tech:coarse_fibre'] = 256, + --['tech:paint_lime_white'] = 256, + --['tech:paint_glow_paint'] = 256, + + ['artifacts:sculpture_mg_dancers'] = 256, + ['artifacts:sculpture_mg_bonsai'] = 256, + ['artifacts:sculpture_mg_bloom'] = 256, + ['artifacts:sculpture_j_axeman'] = 256, + ['artifacts:sculpture_j_dragon_head'] = 256, + ['artifacts:sculpture_j_skull_head'] = 256, + + --['artifacts:star_stone'] = 256, + ['artifacts:singing_stone'] = 256, + ['artifacts:drumming_stone'] = 256, + + ['artifacts:gamepiece_a_black'] = 256, + ['artifacts:gamepiece_a_white'] = 256, + ['artifacts:gamepiece_b_black'] = 256, + ['artifacts:gamepiece_b_white'] = 256, + ['artifacts:gamepiece_c_black'] = 256, + ['artifacts:gamepiece_c_white'] = 256, + + --high level artifacts, and intact non-durables (rarity 6) + --['artifacts:moon_stone'] = 1024, + --['artifacts:sun_stone'] = 1024, + + --['tech:fine_fabric'] = 1024, + --['tech:torch'] = 1024, + --['tech:vegetable_oil'] = 1024, + --['tech:coarse_fabric'] = 1024, + --['tech:mattress'] = 32768, + + --["backpacks:backpack_fabric_bag"] = 1024, + + ['artifacts:airboat'] = 8192, + ['artifacts:mapping_kit'] = 1024, + ['artifacts:antiquorium_chisel'] = 8192, + + ['artifacts:transporter_key'] = 1024, + ['artifacts:transporter_regulator'] = 1024, + ['artifacts:transporter_stabilizer'] = 1024, + ['artifacts:transporter_focalizer'] = 1024, + ['artifacts:transporter_power_dep'] = 1024, + ['artifacts:transporter_power'] = 1024, + ['artifacts:transporter_pad'] = 1024, + ['artifacts:transporter_pad_charging'] = 1024, + + --['nodes_nature:lambakap_seed'] = 1024, + --['nodes_nature:reshedaar_seed'] = 1024, + --['nodes_nature:mahal_seed'] = 1024, + + ['artifacts:sculpture_g_arch_judge'] = 1024, + ['artifacts:sculpture_g_arch_beast'] = 1024, + ['artifacts:sculpture_g_arch_trickster'] = 1024, + ['artifacts:sculpture_g_arch_mother'] = 1024, + + ['artifacts:metastim'] = 100000, + + }) do + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or emc_value + end + for _, v in ipairs(plantlist) do + local itemstring = "nodes_nature:"..v[1] + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 16 + local itemstring = "nodes_nature:"..v[1].."_seedling" + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 8 + end + for _, v in ipairs(searooted_list) do + local itemstring = "nodes_nature:"..v[1] + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 16 + end + for _, v in ipairs(rock_list) do + local itemstring = "nodes_nature:"..v[1] + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 4 + local itemstring = "nodes_nature:"..v[1].."_boulder" + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 4 + exchangeclone.register_alias("nodes_nature:"..v[1].."_cobble2", "nodes_nature:"..v[1].."_cobble1") + exchangeclone.register_alias("nodes_nature:"..v[1].."_cobble2", "nodes_nature:"..v[1].."_cobble3") + end + for _, v in ipairs(sed_list) do + local itemstring = "nodes_nature:"..v[1] + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 1 + end + for _, v in ipairs(stone_list) do + local itemstring = "nodes_nature:"..v[1] + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 1 + local itemstring = "nodes_nature:"..v[1].."_block" + exchangeclone.base_emc_values[itemstring] = exchangeclone.base_emc_values[itemstring] or 1 + end +end \ No newline at end of file diff --git a/exchangeclone/init.lua b/exchangeclone/init.lua index b9758f5..5339730 100644 --- a/exchangeclone/init.lua +++ b/exchangeclone/init.lua @@ -6,7 +6,18 @@ local start_time = minetest.get_us_time() minetest.log("action", "[ExchangeClone] Registering own stuff") -- Decides what mod to use for sounds -exchangeclone.sound_mod = exchangeclone.mcl and mcl_sounds or default +if exchangeclone.mcl then + exchangeclone.sound_mod = mcl_sounds +elseif exchangeclone.exile then + exchangeclone.sound_mod = { + node_sound_stone_defaults = nodes_nature.node_sound_stone_defaults, + node_sound_metal_defaults = nodes_nature.node_sound_glass_defaults, + node_sound_glass_defaults = nodes_nature.node_sound_glass_defaults, + } +else + assert(exchangeclone.mtg, "unhandled game type") + exchangeclone.sound_mod = default +end local modpath = minetest.get_modpath("exchangeclone") @@ -23,7 +34,19 @@ if exchangeclone.mcl then } end end +elseif exchangeclone.exile then + exchangeclone.colors = {} -- FIXME: extract from ncrafting + for name, palette in pairs(bundlelist) do + if name ~= "none" then + exchangeclone.colors[name] = { + name = name, + hex = dye_to_colorstring(palette), + dye = "ncrafting:dye_"..name, + } + end + end else + assert(exchangeclone.mtg) -- color hex values taken from MCLA exchangeclone.colors = { white = { @@ -108,6 +131,10 @@ if exchangeclone.mcl2 then mcl_item_id.set_mod_namespace("exchangeclone") end +if exchangeclone.exile then + crafting.register_type("exchangeclone_crafting") +end + -- The order is usually unimportant local files = { "craftitems", @@ -139,6 +166,7 @@ local files = { "dark_matter_pedestal", "black_hole_band", "rings", + "base_emc_values", } if exchangeclone.mcl or minetest.get_modpath("3d_armor") then diff --git a/exchangeclone/matter.lua b/exchangeclone/matter.lua index f17ff80..e30fbd6 100644 --- a/exchangeclone/matter.lua +++ b/exchangeclone/matter.lua @@ -43,7 +43,7 @@ minetest.register_craft({ output = "exchangeclone:dark_matter", recipe = { {"exchangeclone:aeternalis_fuel", "exchangeclone:aeternalis_fuel", "exchangeclone:aeternalis_fuel"}, - {"exchangeclone:aeternalis_fuel", exchangeclone.mcl and "mcl_core:diamondblock" or 'default:diamondblock', "exchangeclone:aeternalis_fuel"}, + {"exchangeclone:aeternalis_fuel", exchangeclone.itemstrings.diamondblock, "exchangeclone:aeternalis_fuel"}, {"exchangeclone:aeternalis_fuel", "exchangeclone:aeternalis_fuel", "exchangeclone:aeternalis_fuel"} } }) diff --git a/exchangeclone/mod.conf b/exchangeclone/mod.conf index c9203a5..0b5ecc8 100644 --- a/exchangeclone/mod.conf +++ b/exchangeclone/mod.conf @@ -2,5 +2,5 @@ name = exchangeclone title = ExchangeClone description = The main part of the modpack (depends on both the other mods) depends = zzzz_exchangeclone_init -optional_depends = mcl_core, default, mcl_armor, 3d_armor, mcl_item_id, mobs_mc, hopper, pipeworks, mcl_dispensers, awards +optional_depends = mcl_core, default, mcl_armor, 3d_armor, mcl_item_id, mobs_mc, hopper, pipeworks, mcl_dispensers, awards, exile_env_sounds, nodes_nature, ncrafting, crafting, megamorph author = ThePython10110 \ No newline at end of file diff --git a/exchangeclone/philosophers_stone.lua b/exchangeclone/philosophers_stone.lua index b833956..9f178e9 100644 --- a/exchangeclone/philosophers_stone.lua +++ b/exchangeclone/philosophers_stone.lua @@ -84,6 +84,15 @@ if exchangeclone.mcl then end end end +elseif exchangeclone.exile then + local crafting_on_click = crafting.make_on_rightclick("exchangeclone_crafting", 2, { x = 8, y = 3 }) + on_left_click = function(itemstack, player, pointed_thing) + if player:get_player_control().sneak then + minetest.show_formspec(player:get_player_name(), "exchangeclone_repairing", repairing_formspec) + else + crafting_on_click(nil, nil, player) + end + end else on_left_click = function(itemstack, player, pointed_thing) minetest.show_formspec(player:get_player_name(), "exchangeclone_repairing", repairing_formspec) @@ -349,4 +358,38 @@ minetest.register_craft({ "mcl_core:lapis", }, replacements = {{phil, phil}} -}) \ No newline at end of file +}) + +if exchangeclone.exile then + minetest.register_craft({ + output = exchangeclone.itemstrings.diamondblock, + type = "shapeless", + recipe = { + phil, + exchangeclone.itemstrings.diamond, + exchangeclone.itemstrings.diamond, + exchangeclone.itemstrings.diamond, + }, + replacements = {{phil, phil}} + }) + + minetest.register_craft({ + output = exchangeclone.itemstrings.diamond.." 3", + type = "shapeless", + recipe = { + phil, + exchangeclone.itemstrings.diamondblock, + }, + replacements = {{phil, phil}} + }) + + megamorph.register_loot({ + level = 1, + rarity = 6, + name = "exchangeclone:philosophers_stone", + number = { + min = 1, + max = 1, + }, + }) +end \ No newline at end of file diff --git a/exchangeclone/register_emc.lua b/exchangeclone/register_emc.lua index 8b2e597..4cb8349 100644 --- a/exchangeclone/register_emc.lua +++ b/exchangeclone/register_emc.lua @@ -146,6 +146,331 @@ end local auto = {} +if exchangeclone.exile then + local seen_unknown_crafting_types = {} + local did_cooking_warning = false + local replacements_actions = {} + -- Exile doesn't have lava buckets and uses an alternative, + -- so just eat the input item + replacements_actions[dump({{ + exchangeclone.itemstrings.lava_bucket, + exchangeclone.itemstrings.empty_bucket, + }})] = {just_eat_input = true} + -- we're already using a philosopher's stone to do the crafting, + -- don't add to recipe so we don't need two + replacements_actions[dump({{ + "exchangeclone:philosophers_stone", + "exchangeclone:philosophers_stone", + }})] = {remove_from_input = "exchangeclone:philosophers_stone"} + -- used for recipe for iron band -- crafting mod doesn't support + -- replacements, there is another recipe for the iron band, + -- so just ignore the recipe + replacements_actions[dump({{ + "exchangeclone:volcanite_amulet", + "exchangeclone:volcanite_amulet", + }})] = {ignore_recipe = true} + local replacement_itemstrings = { + ["group:tree"] = "group:log", + } + for _, recipes in pairs(exchangeclone.recipes) do + for _, recipe in ipairs(recipes) do + local mt_craft_type = recipe.type and exchangeclone.craft_types[recipe.type].type + if not mt_craft_type or mt_craft_type == "shaped" or mt_craft_type == "shapeless" then + ---@type table + local item_counts = {} + local remove_from_input = nil + local ignore_recipe = false + if recipe.replacements then + local replacements_value = dump(recipe.replacements) + local replacements_action = replacements_actions[replacements_value] + assert(replacements_action, "[ExchangeClone] unimplemented replacements style: "..replacements_value) + if replacements_action.remove_from_input then + remove_from_input = replacements_action.remove_from_input + elseif replacements_action.ignore_recipe then + ignore_recipe = true + else + assert(replacements_action.just_eat_input, "unhandled replacements_action"..dump(replacements_action)) + end + end + local worklist = table.copy(recipe.recipe) + while #worklist > 0 do + local item = table.remove(worklist) + if type(item) == "table" then + for _, v in ipairs(item) do + table.insert(worklist, v) + end + elseif item and item ~= remove_from_input and item ~= "" then + local count = item_counts[item] or 0 + item_counts[item] = count + 1 + end + end + local items_array = {} + for itemstring, count in pairs(item_counts) do + itemstring = replacement_itemstrings[itemstring] or itemstring + local item = ItemStack(itemstring) + item:set_count(count) + if not itemstring:find("^group:") and not item:is_known() then + ignore_recipe = true + break + end + assert(item:to_string() ~= "", dump({itemstring=itemstring,count=count,recipe=recipe})) + table.insert(items_array, item:to_string()) + end + if not ignore_recipe then + local final_recipe = { + type = "exchangeclone_crafting", + output = recipe.output, + items = items_array, + always_known = true, + } + minetest.log("[ExchangeClone]: registered Exile crafting recipe: \n"..dump(final_recipe)) + crafting.register_recipe(final_recipe) + end + elseif mt_craft_type == "cooking" then + if not did_cooking_warning then + minetest.log("warning", "[ExchangeClone] cooking crafts aren't implemented for Exile, ignoring") + end + did_cooking_warning = true + else + local unknown_craft_type = dump(mt_craft_type) + if not seen_unknown_crafting_types[unknown_craft_type] then + minetest.log("warning", "[ExchangeClone] unknown minetest crafting type: "..unknown_craft_type) + end + seen_unknown_crafting_types[unknown_craft_type] = true + end + end + end + for craft_type, recipes in pairs(crafting.recipes) do + if craft_type ~= "exchangeclone_crafting" then + exchangeclone.register_craft_type(craft_type, "shapeless") + for _, orig_recipe in ipairs(recipes) do + local recipe = {} + for _, item in ipairs(orig_recipe.items) do + item = ItemStack(item) + for _ = 1, item:get_count() do + table.insert(recipe, item:get_name()) + end + end + exchangeclone.register_craft({ + type = orig_recipe.type, + output = orig_recipe.output, + recipe = recipe, + }) + end + end + end + exchangeclone.register_craft_type("thawing", "cooking", true) + exchangeclone.register_craft({ + type = "thawing", + output = "nodes_nature:freshwater_source", + recipe = "nodes_nature:ice", + }) + exchangeclone.register_craft({ + type = "thawing", + output = "nodes_nature:salt_water_source", + recipe = "nodes_nature:sea_ice", + }) + exchangeclone.register_craft_type("roasting", "cooking") + exchangeclone.register_craft({ + type = "roasting", + output = "tech:iron_bloom", + recipe = "tech:iron_and_slag", + }) + exchangeclone.register_craft({ + type = "roasting", + output = "tech:iron_and_slag", + recipe = "tech:iron_smelting_mix", + }) + exchangeclone.register_craft({ + type = "roasting", + output = "tech:green_glass_ingot", + recipe = "tech:green_glass_mix", + }) + exchangeclone.register_craft({ + type = "roasting", + output = "tech:clear_glass_ingot", + recipe = "tech:clear_glass_mix", + }) + exchangeclone.register_craft({ + type = "roasting", + output = "tech:quicklime", + recipe = "tech:crushed_lime", + }) + exchangeclone.register_craft_type("melting", "shapeless") + exchangeclone.register_craft({ + type = "melting", + output = "tech:pane_tray_clear", + recipe = {"tech:clear_glass_ingot", "tech:pane_tray"}, + }) + exchangeclone.register_craft({ + type = "melting", + output = "tech:pane_tray_green", + recipe = {"tech:green_glass_ingot", "tech:pane_tray"}, + }) + exchangeclone.register_craft_type("start_fire", "cooking") + exchangeclone.register_craft({ + type = "start_fire", + output = "tech:small_wood_fire", + recipe = "tech:small_wood_fire_unlit", + }) + exchangeclone.register_craft({ + type = "start_fire", + output = "tech:large_wood_fire", + recipe = "tech:large_wood_fire_unlit", + }) + exchangeclone.register_craft({ + type = "start_fire", + output = "tech:small_charcoal_fire", + recipe = "tech:charcoal", + }) + exchangeclone.register_craft({ + type = "start_fire", + output = "tech:large_charcoal_fire", + recipe = "tech:charcoal_block", + }) + exchangeclone.register_craft_type("extinguish_fire", "cooking", true) + exchangeclone.register_craft({ + type = "extinguish_fire", + output = "tech:small_wood_fire_ext", + recipe = "tech:small_wood_fire", + }) + exchangeclone.register_craft({ + type = "extinguish_fire", + output = "tech:large_wood_fire_ext", + recipe = "tech:large_wood_fire", + }) + exchangeclone.register_craft({ + type = "extinguish_fire", + output = "tech:small_charcoal_fire_ext", + recipe = "tech:small_charcoal_fire", + }) + exchangeclone.register_craft({ + type = "extinguish_fire", + output = "tech:large_charcoal_fire_ext", + recipe = "tech:large_charcoal_fire", + }) + exchangeclone.register_craft_type("to_smoldering", "cooking", true) + exchangeclone.register_craft({ + type = "to_smoldering", + output = "tech:small_wood_fire_smoldering", + recipe = "tech:small_wood_fire", + }) + exchangeclone.register_craft({ + type = "to_smoldering", + output = "tech:large_wood_fire_smoldering", + recipe = "tech:large_wood_fire", + }) + exchangeclone.register_craft({ + type = "to_smoldering", + output = "tech:small_charcoal_fire_smoldering", + recipe = "tech:small_charcoal_fire", + }) + exchangeclone.register_craft({ + type = "to_smoldering", + output = "tech:large_charcoal_fire_smoldering", + recipe = "tech:large_charcoal_fire", + }) + + exchangeclone.register_craft_type("hammer_place", "cooking") + exchangeclone.register_craft({ + type = "hammer_place", + output = "tech:hammer_basalt_placed", + recipe = "tech:hammer_basalt", + }) + exchangeclone.register_craft({ + type = "hammer_place", + output = "tech:hammer_granite_placed", + recipe = "tech:hammer_granite", + }) + exchangeclone.register_craft_type("retting", "cooking") + exchangeclone.register_craft({ + type = "retting", + output = "tech:retted_cana_bundle", + recipe = "tech:unretted_cana_bundle", + }) + local extended_sed_list = table.copy(sed_list) + local artificial_seds = {broken_pottery_block = {mod_name = 'tech'}} + for name, _ in pairs(artificial_seds) do + table.insert(extended_sed_list, {name}) + end + local water_pots = { + "tech:clay_water_pot", + "tech:wooden_water_pot", + "tech:glass_bottle_green", + "tech:glass_bottle_clear", + } + local wetnesses = { + [""] = {water_pot_suffix = "", source = ""}, + ["_wet"] = {water_pot_suffix = "_freshwater", source = "nodes_nature:freshwater_source"}, + ["_wet_salty"] = {water_pot_suffix = "_salt_water", source = "nodes_nature:salt_water_source"}, + } + local ag_soils = { + {ag = "", depleted = ""}, + {ag = "_agricultural_soil", depleted = ""}, + {ag = "_agricultural_soil", depleted = "_depleted"}, + } + exchangeclone.register_craft_type("make_ag_depleted", "cooking") + exchangeclone.register_craft_type("ag_soil_to_soil", "cooking") + exchangeclone.register_craft_type("wetten", "shapeless") + for _, v in ipairs(extended_sed_list) do + local name = v[1] + local mod_name = "nodes_nature" + if artificial_seds[name] then + mod_name = artificial_seds[name].mod_name + end + for wetness, wetness_data in pairs(wetnesses) do + for _, ag_soil in ipairs(ag_soils) do + if wetness == "_wet" or (wetness == "_wet_salty" and ag_soil.ag == "") then + exchangeclone.register_craft({ + type = "wetten", + output = mod_name..":"..name..ag_soil.ag..wetness..ag_soil.depleted, + recipe = { + mod_name..":"..name..ag_soil.ag..ag_soil.depleted, + water_pots[1]..wetness_data.water_pot_suffix, + }, + replacements = {{water_pots[1]..wetness_data.water_pot_suffix, water_pots[1]}}, + }) + end + end + if wetness ~= "_wet_salty" then + exchangeclone.register_craft({ + type = "make_ag_depleted", + output = mod_name..":"..name.."_agricultural_soil"..wetness.."_depleted", + recipe = mod_name..":"..name..wetness, + }) + end + end + end + exchangeclone.register_craft_type("fill_water_pot", "shapeless") + for wetness, wetness_data in pairs(wetnesses) do + if wetness ~= "" then + for _, water_pot in ipairs(water_pots) do + exchangeclone.register_craft({ + type = "fill_water_pot", + output = water_pot..wetness_data.water_pot_suffix, + recipe = { + water_pot, + wetness_data.source, + }, + }) + end + end + end + for _, v in ipairs(soil_list) do + local name = v[1] + local sed_name = v[4] + for wetness, wetness_data in pairs(wetnesses) do + if wetness ~= "_wet_salty" then + exchangeclone.register_craft({ + type = "ag_soil_to_soil", + output = "nodes_nature:"..name..wetness, + recipe = "nodes_nature:"..sed_name.."_agricultural_soil"..wetness, + }) + end + end + end +end + -- Handle stonecutter recipes and decaychains in Mineclonia if exchangeclone.mcla then exchangeclone.register_craft_type("stonecutting", "cooking") @@ -355,6 +680,7 @@ for itemstring, emc_value in pairs(exchangeclone.base_emc_values) do register_emc(itemstring, emc_value) end +--minetest.log('[ExchangeClone] recipes:\n' .. dump(exchangeclone.recipes)) -- Register `exchangeclone_custom_emc` values and decide whether to automatically register EMC values for itemstring, def in pairs(minetest.registered_items) do if def.exchangeclone_custom_emc then @@ -363,17 +689,19 @@ for itemstring, def in pairs(minetest.registered_items) do itemstring = exchangeclone.handle_alias(itemstring) or itemstring def = minetest.registered_items[itemstring] -- in case itemstring changed local _, _, mod_name, item_name = itemstring:find("([%d_%l]+):([%d_%l]+)") - if ( - def - and item_name - and mod_name - and def.description - and def.description ~= "" - and ((minetest.get_item_group(itemstring, "not_in_creative_inventory") < 1) or mod_name == "mcl_compass") - and (not exchangeclone.get_item_emc(itemstring)) - and exchangeclone.recipes[itemstring] - ) then + local add_to_auto = def and item_name and mod_name + add_to_auto = add_to_auto and def.description and def.description ~= "" + if minetest.get_item_group(itemstring, "not_in_creative_inventory") ~= 0 and mod_name ~= "mcl_compass" then + add_to_auto = false + elseif exchangeclone.exile and minetest.get_item_group(itemstring, "natural_slope") ~= 0 then + add_to_auto = false + elseif exchangeclone.get_item_emc(itemstring) then + add_to_auto = false + end + if add_to_auto and exchangeclone.recipes[itemstring] then auto[itemstring] = true + elseif add_to_auto then + minetest.log("[ExchangeClone] skipping " .. itemstring .. "\n" .. dump(def)) end end end @@ -461,6 +789,7 @@ for alias, itemstring in pairs(exchangeclone.emc_aliases) do register_emc(itemstring, exchangeclone.get_item_emc(alias)) end +minetest.log("items without EMC" .. dump(auto)) -- Delete unnecessary data (waste of memory) if not exchangeclone.keep_data then exchangeclone.recipes = nil diff --git a/exchangeclone/shears.lua b/exchangeclone/shears.lua index e118532..19744a6 100644 --- a/exchangeclone/shears.lua +++ b/exchangeclone/shears.lua @@ -3,13 +3,14 @@ function exchangeclone.shear_action(itemstack, player, center) if exchangeclone.check_cooldown(player, "shears") then return end local start_node = minetest.get_node(center) local leaves = minetest.get_item_group(start_node.name, "leaves") > 0 + leaves = leaves or minetest.get_item_group(start_node.name, "leafdecay") > 0 local charge = math.max(itemstack:get_meta():get_int("exchangeclone_tool_charge"), 1) local vector1, vector2 = exchangeclone.process_range(player, leaves and "large_radius" or "basic_radius", charge) if not (vector1 and vector2) then return end local pos1, pos2 = vector.add(center, vector1), vector.add(center, vector2) exchangeclone.play_sound(player, "exchangeclone_destruct") - local grouped = leaves and {"group:leaves"} or {"group:shearsy", "group:shearsy_cobweb"} + local grouped = leaves and { "group:leaves", "group:leafdecay" } or { "group:shearsy", "group:shearsy_cobweb" } local nodes = minetest.find_nodes_in_area(pos1, pos2, grouped) for i, pos in pairs(nodes) do local node = minetest.get_node(pos) diff --git a/zzzz_exchangeclone_init/base_emc_values.lua b/zzzz_exchangeclone_init/base_emc_values.lua index 4922ebe..32507be 100644 --- a/zzzz_exchangeclone_init/base_emc_values.lua +++ b/zzzz_exchangeclone_init/base_emc_values.lua @@ -233,7 +233,10 @@ if exchangeclone.mcl then {name = "invisibility", bases = {"mcl_potions:night_vision"}, ingredient = "mcl_potions:fermented_spider_eye", custom_base_cost = 623, plus = true}, {name = "withering", ingredient = "mcl_flowers:wither_rose", plus = true, two = true} } +elseif exchangeclone.exile then + -- handled in exchangeclone/base_emc_values.lua else + assert(exchangeclone.mtg) -- MTG stuff table.insert_all(exchangeclone.group_values, { {"flower", 32}, diff --git a/zzzz_exchangeclone_init/init.lua b/zzzz_exchangeclone_init/init.lua index a9b217e..8269c9b 100644 --- a/zzzz_exchangeclone_init/init.lua +++ b/zzzz_exchangeclone_init/init.lua @@ -3,15 +3,32 @@ exchangeclone = {recipes = {}} -if (not minetest.get_modpath("mcl_core")) and (not minetest.get_modpath("default")) then - error("ExchangeClone requires Minetest Game, MineClone2, or MineClonia (and possibly variant subgames).\nPlease use one of those games.") -end +-- detect games: +-- don't use minetest.get_game_info().id because that returns the name of +-- the folder the game is stored in, which users can name whatever they like. --- Ensure that value is either true or nil -if minetest.get_game_info().id == "mineclonia" then exchangeclone.mcla = true end -if minetest.get_game_info().id == "mineclone2" then exchangeclone.mcl2 = true end -if exchangeclone.mcl2 or exchangeclone.mcla then exchangeclone.mcl = true end -if not exchangeclone.mcl then exchangeclone.mtg = true end +-- Ensure that game identifier values are either true or nil +if minetest.get_modpath("mcl_core") then + -- mineclonia makes a big deal about excluding hamburgers, but you could add mineclone2's copy + local has_mcl_hamburger = minetest.get_modpath("mcl_hamburger") + local has_mcl_base_textures = minetest.get_modpath("mcl_base_textures") + local has_mcl_playerplus = minetest.get_modpath("mcl_playerplus") + if has_mcl_hamburger and has_mcl_playerplus then + exchangeclone.mcl2 = true + elseif has_mcl_base_textures then + exchangeclone.mcla = true + else + minetest.log("warning", "[ExchangeClone] unable to determine if you're running MineClonia or MineClone2") + end + exchangeclone.mcl = true +elseif minetest.get_modpath("exile_env_sounds") then + exchangeclone.exile = true +elseif minetest.get_modpath("default") then + exchangeclone.mtg = true +else + error("ExchangeClone requires Minetest Game, Exile, MineClone2, or MineClonia (and possibly variant subgames).\n" .. + "Please use one of those games.") +end exchangeclone.pipeworks = minetest.get_modpath("pipeworks") exchangeclone.keep_data = minetest.settings:get_bool("exchangeclone.keep_data", false) diff --git a/zzzz_exchangeclone_init/lib.lua b/zzzz_exchangeclone_init/lib.lua index 2b20483..b31cc62 100644 --- a/zzzz_exchangeclone_init/lib.lua +++ b/zzzz_exchangeclone_init/lib.lua @@ -365,35 +365,112 @@ exchangeclone.int_limit = 2147483647 exchangeclone.fuel_limit = 2147483583 -- no idea why... -- Itemstrings for various items used in crafting recipes. -exchangeclone.itemstrings = { - cobble = exchangeclone.mcl and "mcl_core:cobble" or "default:cobble", - stone = exchangeclone.mcl and "mcl_core:stone" or "default:stone", - redstoneworth = exchangeclone.mcl and "mesecons:redstone" or "default:obsidian", - obsidian = exchangeclone.mcl and "mcl_core:obsidian" or "default:obsidian", - glowstoneworth = exchangeclone.mcl and "mcl_nether:glowstone_dust" or "default:tin_ingot", - lapisworth = exchangeclone.mcl and "mcl_core:lapis" or "bucket:bucket_lava", - coal = exchangeclone.mcl and "mcl_core:coal_lump" or "default:coal_lump", - iron = exchangeclone.mcl and "mcl_core:iron_ingot" or "default:steel_ingot", - copper = exchangeclone.mcl and "mcl_copper:copper_ingot" or "default:copper_ingot", - gold = exchangeclone.mcl and "mcl_core:gold_ingot" or "default:gold_ingot", - emeraldworth = exchangeclone.mcl and "mcl_core:emerald" or "default:mese_crystal", - diamond = exchangeclone.mcl and "mcl_core:diamond" or "default:diamond", - gravel = exchangeclone.mcl and "mcl_core:gravel" or "default:gravel", - dirt = exchangeclone.mcl and "mcl_core:dirt" or "default:dirt", - clay = exchangeclone.mcl and "mcl_core:clay" or "default:clay", - sand = exchangeclone.mcl and "mcl_core:sand" or "default:sand", - torch = exchangeclone.mcl and "mcl_torches:torch" or "default:torch", - book = exchangeclone.mcl and "mcl_books:book" or "default:book", - glass = exchangeclone.mcl and "mcl_core:glass" or "default:glass", - water = exchangeclone.mcl and "mcl_core:water_source" or "default:water_source", - lava = exchangeclone.mcl and "mcl_core:lava_source" or "default:lava_source", - water_bucket = exchangeclone.mcl and "mcl_buckets:bucket_water" or "bucket:bucket_water", - lava_bucket = exchangeclone.mcl and "mcl_buckets:bucket_lava" or "bucket:bucket_lava", - empty_bucket = exchangeclone.mcl and "mcl_buckets:bucket_empty" or "bucket:bucket_empty", - snow = exchangeclone.mcl and "mcl_core:snow" or "default:snow", - fire = exchangeclone.mcl and "mcl_fire:fire" or "fire:fire", - ice = exchangeclone.mcl and "mcl_core:ice" or "default:ice" -} +if exchangeclone.mcl then + exchangeclone.itemstrings = { + cobble = "mcl_core:cobble", + stone = "mcl_core:stone", + redstoneworth = "mesecons:redstone", + obsidian = "mcl_core:obsidian", + glowstoneworth = "mcl_nether:glowstone_dust", + lapisworth = "mcl_core:lapis", + coal = "mcl_core:coal_lump", + iron = "mcl_core:iron_ingot", + copper = "mcl_copper:copper_ingot", + gold = "mcl_core:gold_ingot", + emeraldworth = "mcl_core:emerald", + diamond = "mcl_core:diamond", + diamondblock = "mcl_core:diamondblock", + gravel = "mcl_core:gravel", + dirt = "mcl_core:dirt", + clay = "mcl_core:clay", + sand = "mcl_core:sand", + torch = "mcl_torches:torch", + book = "mcl_books:book", + glass = "mcl_core:glass", + water = "mcl_core:water_source", + lava = "mcl_core:lava_source", + water_bucket = "mcl_buckets:bucket_water", + lava_bucket = "mcl_buckets:bucket_lava", + empty_bucket = "mcl_buckets:bucket_empty", + snow = "mcl_core:snow", + fire = "mcl_fire:fire", + ice = "mcl_core:ice", + ender_pearl = "mcl_throwing:ender_pearl", + chest = "mcl_chests:chest", + dye_prefix = "mcl_dye:", + wool_prefix = "mcl_wool:", + } +elseif exchangeclone.exile then + exchangeclone.itemstrings = { + cobble = "nodes_nature:limestone_boulder", + stone = "nodes_nature:limestone_block", + redstoneworth = "nodes_nature:jade_boulder", + obsidian = "nodes_nature:basalt_boulder", + glowstoneworth = "tech:iron_ingot", + lapisworth = "tech:green_glass_ingot", + coal = "tech:charcoal", + iron = "tech:iron_ingot", + copper = "tech:clear_glass_ingot", + gold = "artifacts:moon_glass", + emeraldworth = "artifacts:antiquorium", + diamond = "artifacts:moon_stone", + diamondblock = "artifacts:sun_stone", + gravel = "nodes_nature:gravel", + dirt = "nodes_nature:loam", + clay = "nodes_nature:clay", + sand = "nodes_nature:sand", + torch = "tech:torch", + book = "nodes_nature:reshedaar", + glass = "tech:green_glass_ingot", + water = "nodes_nature:freshwater_source", + lava = "nodes_nature:lava_source", + water_bucket = "tech:clay_water_pot_freshwater", + lava_bucket = "artifacts:sun_stone", + empty_bucket = "tech:clay_water_pot", + snow = "nodes_nature:snow", + fire = "inferno:basic_flame", + ice = "nodes_nature:ice", + ender_pearl = "nodes_nature:mahal", + chest = "tech:primitive_wooden_chest", + dye_prefix = "ncrafting:dye_", + wool_prefix = "ncrafting:dye_", -- there isn't really dyable blocks + } +else + assert(exchangeclone.mtg) + exchangeclone.itemstrings = { + cobble = "default:cobble", + stone = "default:stone", + redstoneworth = "default:obsidian", + obsidian = "default:obsidian", + glowstoneworth = "default:tin_ingot", + lapisworth = "bucket:bucket_lava", + coal = "default:coal_lump", + iron = "default:steel_ingot", + copper = "default:copper_ingot", + gold = "default:gold_ingot", + emeraldworth = "default:mese_crystal", + diamond = "default:diamond", + gravel = "default:gravel", + dirt = "default:dirt", + clay = "default:clay", + sand = "default:sand", + torch = "default:torch", + book = "default:book", + glass = "default:glass", + water = "default:water_source", + lava = "default:lava_source", + water_bucket = "bucket:bucket_water", + lava_bucket = "bucket:bucket_lava", + empty_bucket = "bucket:bucket_empty", + snow = "default:snow", + fire = "fire:fire", + ice = "default:ice", + ender_pearl = "default:mese_crystal", + chest = "default:chest", + dye_prefix = "dye:", + wool_prefix = "wool:", + } +end exchangeclone.emc_aliases = {}