This commit is contained in:
Jacob Lifshay 2024-03-24 23:19:59 -07:00 committed by GitHub
commit 2a9b80f3e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 1276 additions and 114 deletions

View File

@ -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"},
}
})

View File

@ -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

View File

@ -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)

View File

@ -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()

View File

@ -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

View File

@ -0,0 +1,210 @@
if exchangeclone.exile then
table.insert_all(exchangeclone.group_values, {
{"log", 32},
{"leafdecay", 1},
{"_ncrafting_bundle", 64},
{"_ncrafting_dye_color", 32},
{"wet_sediment", 1},
})
for itemstring, emc_value in pairs({
["tech:soup"] = 16,
["bones:bones"] = 32,
["lore:exile_letter"] = 32,
["animals:gundu"] = 128,
["animals:pegasun_male"] = 128,
["animals:pegasun"] = 144, -- higher because they lay eggs
["animals:kubwakubwa"] = 144,
["animals:darkasthaan"] = 192,
["animals:sarkamos"] = 256,
["animals:impethu"] = 32,
["animals:sneachan"] = 32,
["animals:gundu_eggs"] = 64,
["animals:pegasun_eggs"] = 32,
["animals:kubwakubwa_eggs"] = 24,
["animals:darkasthaan_eggs"] = 32,
["animals:sarkamos_eggs"] = 64,
["animals:impethu_eggs"] = 16,
["animals:sneachan_eggs"] = 16,
["animals:carcass_invert_small"] = 3,
["animals:carcass_invert_large"] = 10,
["animals:carcass_bird_small"] = 20,
["animals:carcass_fish_small"] = 15,
["animals:carcass_fish_large"] = 45,
["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,
['tech:slag'] = 16,
['nodes_nature:volcanic_ash'] = 1,
['tech:wood_ash'] = 8,
['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,
['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,
['player_api:cloth_female_upper_default'] = 1024,
['player_api:cloth_female_lower_default'] = 1024,
['player_api:cloth_unisex_footwear_default'] = 1024,
['player_api:cloth_female_head_default'] = 1024,
['player_api:cloth_male_upper_default'] = 1024,
['player_api:cloth_male_lower_default'] = 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
exchangeclone.register_alias("artifacts:antiquorium", "rings:antiquorium")
exchangeclone.register_alias("artifacts:moon_glass", "rings:moon_glass")
end

View File

@ -222,7 +222,7 @@ minetest.register_tool("exchangeclone:void_ring", {
_exchangeclone_pedestal = black_hole_pedestal,
})
local ingredient = exchangeclone.mcl and "mcl_mobitems:string" or "farming:cotton"
local ingredient = exchangeclone.itemstrings.cotton
minetest.register_craft({
output = "exchangeclone:black_hole_band",
recipe = {

View File

@ -20,7 +20,7 @@ for group, amount in pairs({
exchangeclone.tool_types[group] = exchangeclone.tool_types[group] or amount
end
local charcoal_itemstring = exchangeclone.mcl and "mcl_core:charcoal_lump" or "group:tree"
local charcoal_itemstring = exchangeclone.itemstrings.charcoal
minetest.register_craftitem("exchangeclone:low_covalence_dust", {
description = S("Low Covalence Dust"),

View File

@ -215,7 +215,7 @@ local collectors = {
"White",
}
local ingredient = exchangeclone.mcl and "mcl_nether:glowstone" or "default:gold_ingot"
local ingredient = exchangeclone.itemstrings.collector_ingredient
exchangeclone.register_energy_collector(
"exchangeclone:basic_collector",
@ -225,7 +225,7 @@ exchangeclone.register_energy_collector(
{{
{ingredient, exchangeclone.itemstrings.glass, ingredient},
{ingredient, "exchangeclone:aeternalis_fuel_block", ingredient},
{ingredient, (exchangeclone.mcl and "mcl_furnaces:furnace" or "default:furnace"), ingredient},
{ingredient, exchangeclone.itemstrings.furnace, ingredient},
}},
5

View File

@ -0,0 +1,690 @@
-- Exile always registers the legacy/unused items, register the recipes so we can assign EMC
local extra_exile_crafting_recipes = {
{
type = "crafting_spot",
output = "tech:grinding_stone",
items = {'nodes_nature:granite_boulder', 'nodes_nature:sand 8'},
level = 1,
always_known = true,
},
{
type = "crafting_spot",
output = "tech:weaving_frame",
items = {'tech:stick 12', 'group:fibrous_plant 8'},
level = 1,
always_known = true,
},
{
type = "crafting_spot",
output = "tech:chopping_block",
items = {'group:log'},
level = 1,
always_known = true,
},
{
type = "chopping_block",
output = "tech:chopping_block",
items = {'group:log'},
level = 1,
always_known = true,
},
{
type = "chopping_block",
output = "tech:hammering_block",
items = {'group:log'},
level = 1,
always_known = true,
},
{
type = "mixing_spot",
output = "tech:potash_block",
items = {'tech:potash 2'},
level = 1,
always_known = true,
},
}
local function register_translated_recipes()
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<string, integer>
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("verbose", "[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
local crafting_recipes = table.copy(crafting.recipes)
for _, recipe in ipairs(extra_exile_crafting_recipes) do
assert(crafting_recipes[recipe.type], "unknown exile crafting recipe type"..recipe.type)
crafting_recipes[recipe.type] = table.copy(crafting_recipes[recipe.type])
table.insert(crafting_recipes[recipe.type], recipe)
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
end
register_translated_recipes()
-- Exile always registers the legacy items, register the recipes so we can assign EMC
local function register_exile_legacy_recipes()
crafting.register_recipe({
type = "crafting_spot",
output = "tech:grinding_stone",
items = {'nodes_nature:granite_boulder', 'nodes_nature:sand 8'},
level = 1,
always_known = true,
})
crafting.register_recipe({ --weaving_frame
type = "crafting_spot",
output = "tech:weaving_frame",
items = {'tech:stick 12', 'group:fibrous_plant 8'},
level = 1,
always_known = true,
})
crafting.register_recipe({ --chopping_block
type = "crafting_spot",
output = "tech:chopping_block",
items = {'group:log'},
level = 1,
always_known = true,
})
crafting.register_recipe({
type = "chopping_block",
output = "tech:chopping_block",
items = {'group:log'},
level = 1,
always_known = true,
})
crafting.register_recipe({ --hammering block
type = "chopping_block",
output = "tech:hammering_block",
items = {'group:log'},
level = 1,
always_known = true,
})
end
register_exile_legacy_recipes()
local sorted_dump_action
---@param v any
---@param indent? nil|string
---@return string
local function sorted_dump(v, indent)
if not indent then
indent = ""
end
local action = sorted_dump_action[type(v)] or sorted_dump_action.default
return action(v, indent)
end
sorted_dump_action = {
["nil"] = function(v, indent)
return "nil"
end,
number = function(v, indent)
return tostring(v)
end,
string = function(v, indent)
return string.format("%q", v)
end,
boolean = function(v, indent)
return string.format("%q", v)
end,
table = function(v, indent)
local inner_indent = indent.." "
---@type any[]
local keys = {}
for key, _ in pairs(v) do
table.insert(keys, key)
end
table.sort(keys)
local is_array = true
for index, key in ipairs(keys) do
if index ~= key then
is_array = false
break
end
end
---@type string[]
local lines = {}
if is_array then
for _, key in ipairs(keys) do
table.insert(lines, sorted_dump(v[key], inner_indent))
end
else
for _, key in ipairs(keys) do
local value = sorted_dump(v[key], inner_indent)
if type(key) == "string" and key:match("^[a-zA-Z_][a-zA-Z0-9_]*$") then
table.insert(lines, key.." = "..value)
else
table.insert(lines, "["..sorted_dump(key, inner_indent).."] = "..value)
end
end
end
local lines_len_total = 0
for _, line in ipairs(lines) do
if line:match("\n") then
lines_len_total = math.huge
break
end
lines_len_total = lines_len_total + #line
end
if #lines == 0 then
return "{}"
end
if #lines == 1 then
return "{"..lines[1].."}"
end
if lines_len_total + 2 * #lines + 2 < 80 then
return "{"..table.concat(lines, ", ").."}"
end
return "{\n"..inner_indent..table.concat(lines, ",\n"..inner_indent).."\n"..indent.."}"
end,
default = function(v, indent)
return "<" .. type(v) .. ">"
end
}
---@class SedimentSoil
---@field soil string
---@field soil_wet string
---@class Sediment
---@field wet string
---@field wet_salty string
---@field ag string
---@field ag_wet string
---@field ag_depleted string
---@field ag_wet_depleted string
---@field soils? SedimentSoil[]
---@type table<string, Sediment>
local sediments = {}
for name, def in pairs(minetest.registered_items) do
if name:match("^artifacts:wayfinder_[1-9][0-9]*$") then
exchangeclone.register_alias("artifacts:wayfinder_0", name)
end
if def.groups.natural_slope or def.groups.not_in_creative_inventory then
goto continue
end
minetest.log("verbose", "[ExchangeClone] exile_on_mods_loaded examining: "..name.." = "..sorted_dump(def))
if def.groups.sediment then
if def.groups.natural_slope then
elseif def.groups.wet_sediment then
elseif def.groups.bare_sediment then
local dry = name
sediments[dry] = sediments[dry] or {}
sediments[dry].wet = def._wet_name
sediments[dry].wet_salty = def._wet_salty_name
elseif def.groups.agricultural_soil then
local dry = def.drop
sediments[dry] = sediments[dry] or {}
sediments[dry].ag = name
sediments[dry].ag_wet = def._wet_name
elseif def.groups.depleted_agricultural_soil then
local dry = def.drop
sediments[dry] = sediments[dry] or {}
sediments[dry].ag_depleted = name
sediments[dry].ag_wet_depleted = def._wet_name
else
local dry = def.drop
sediments[dry] = sediments[dry] or {}
sediments[dry].soils = sediments[dry].soils or {}
table.insert(sediments[dry].soils, {soil = name, soil_wet = def._wet_name})
end
end
::continue::
end
minetest.log("sediments = "..sorted_dump(sediments))
exchangeclone.register_craft_type("roasting", "cooking")
for recipe, output in pairs({
["tech:iron_and_slag"] = "tech:iron_bloom",
["tech:iron_smelting_mix"] = "tech:iron_and_slag",
["tech:crushed_iron_ore"] = "tech:roasted_iron_ore",
["tech:green_glass_mix"] = "tech:green_glass_ingot",
["tech:clear_glass_mix"] = "tech:clear_glass_ingot",
["tech:crushed_lime"] = "tech:quicklime",
}) do
exchangeclone.register_craft({
type = "roasting",
output = output,
recipe = recipe,
})
end
exchangeclone.register_craft_type("fire_pottery", "cooking")
for recipe, output in pairs({
["tech:loose_brick_unfired"] = "tech:loose_brick",
["tech:roof_tile_loose_unfired"] = "tech:roof_tile_loose",
["tech:tile_block_unfired"] = "tech:tile_block",
["tech:cooking_pot_unfired"] = "tech:cooking_pot",
["tech:clay_water_pot_unfired"] = "tech:clay_water_pot",
["tech:clay_storage_pot_unfired"] = "tech:clay_storage_pot",
["tech:clay_oil_lamp_unfired"] = "tech:clay_oil_lamp_empty",
["tech:clay_watering_can_unfired"] = "tech:clay_watering_can",
}) do
exchangeclone.register_craft({
type = "fire_pottery",
output = output,
recipe = recipe,
})
end
exchangeclone.register_craft_type("baking", "cooking")
local baking_map = {}
for name, _ in pairs(bake_table) do
baking_map[name] = name.."_cooked"
baking_map[name.."_cooked"] = name.."_burned"
end
for name, _ in pairs(exchangeclone.colors) do
baking_map["ncrafting:bundle_treated_"..name] = "ncrafting:bundle_treated_blue" -- burning
baking_map["ncrafting:bundle_"..name] = "ncrafting:bundle_treated_"..name
end
for recipe, output in pairs(baking_map) do
if minetest.registered_items[recipe] and minetest.registered_items[output] then
exchangeclone.register_craft({
type = "baking",
output = output,
recipe = recipe,
})
end
end
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 = "melting",
output = "tech:pane_clear",
recipe = {"tech:clear_glass_ingot"},
})
exchangeclone.register_craft({
type = "melting",
output = "tech:pane_green",
recipe = {"tech:green_glass_ingot"},
})
local fire_kinds = {
["tech:small_wood_fire"] = {
unlit = "tech:small_wood_fire_unlit",
extinguished = "tech:small_wood_fire_ext",
smoldering = "tech:small_wood_fire_smoldering",
charcoal_fire = "tech:small_charcoal_fire",
},
["tech:large_wood_fire"] = {
unlit = "tech:large_wood_fire_unlit",
extinguished = "tech:large_wood_fire_ext",
smoldering = "tech:large_wood_fire_smoldering",
charcoal_fire = "tech:large_charcoal_fire",
},
["tech:small_charcoal_fire"] = {
unlit = "tech:charcoal",
extinguished = "tech:small_charcoal_fire_ext",
smoldering = "tech:small_charcoal_fire_smoldering",
},
["tech:large_charcoal_fire"] = {
unlit = "tech:charcoal_block",
extinguished = "tech:large_charcoal_fire_ext",
smoldering = "tech:large_charcoal_fire_smoldering",
},
["tech:lantern_lit"] = {
unlit = "tech:lantern_unlit",
extinguished = "tech:lantern_unlit",
},
["tech:clay_oil_lamp"] = {
unlit = "tech:clay_oil_lamp_unlit",
},
}
exchangeclone.register_craft_type("start_fire", "cooking")
exchangeclone.register_craft_type("extinguish_fire", "cooking", true)
exchangeclone.register_craft_type("to_smoldering", "cooking", true)
exchangeclone.register_craft_type("to_charcoal", "cooking")
for name, fire_kind in pairs(fire_kinds) do
exchangeclone.register_craft({
type = "start_fire",
output = name,
recipe = fire_kind.unlit,
})
if fire_kind.extinguished then
exchangeclone.register_craft({
type = "extinguish_fire",
output = fire_kind.extinguished,
recipe = name,
})
end
if fire_kind.smoldering then
exchangeclone.register_craft({
type = "to_smoldering",
output = fire_kind.smoldering,
recipe = name,
})
end
if fire_kind.charcoal_fire then
exchangeclone.register_craft({
type = "to_charcoal",
output = fire_kinds[fire_kind.charcoal_fire].unlit,
recipe = fire_kind.smoldering,
})
end
end
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("soaking", "cooking")
exchangeclone.register_craft({
type = "soaking",
output = "tech:retted_cana_bundle",
recipe = "tech:unretted_cana_bundle",
})
exchangeclone.register_craft({
type = "soaking",
output = "tech:maraka_flour",
recipe = "tech:maraka_flour_bitter",
})
--@type string[]
local liquid_containers = {
"tech:clay_water_pot",
"tech:wooden_water_pot",
"tech:glass_bottle_green",
"tech:glass_bottle_clear",
"tech:clay_watering_can",
}
---@class LiquidKind
---@field container_suffixes string[]
---@field source string
---@field ice? string
---@field water? true
---@type table<string, LiquidKind>
local liquid_kinds = {
freshwater = {
container_suffixes = {"_freshwater"},
source = "nodes_nature:freshwater_source",
ice = "nodes_nature:ice",
water = true,
},
salt_water = {
container_suffixes = {"_salt_water", "_saltwater"},
source = "nodes_nature:salt_water_source",
ice = "nodes_nature:sea_ice",
water = true,
},
potash = {
container_suffixes = {"_potash"},
source = "tech:potash_source",
}
}
exchangeclone.register_craft_type("make_ag_depleted", "cooking")
exchangeclone.register_craft_type("ag_soil_to_soil", "cooking")
exchangeclone.register_craft_type("wetten", "shapeless")
---@param name string|nil
---@param wet_name string|nil
---@param liquid_kind LiquidKind
local function register_wetten(name, wet_name, liquid_kind)
if not name or not wet_name then
return
end
for _, container_suffix in ipairs(liquid_kind.container_suffixes) do
local filled = liquid_containers[1]..container_suffix
if minetest.registered_craftitems[filled] then
exchangeclone.register_craft({
type = "wetten",
output = wet_name,
recipe = {name, filled},
replacements = {{filled, liquid_containers[1]}},
})
end
end
end
---@param name string|nil
---@param ag_depleted string|nil
local function register_make_ag_depleted(name, ag_depleted)
if not name or not ag_depleted then
return
end
exchangeclone.register_craft({
type = "make_ag_depleted",
output = ag_depleted,
recipe = name,
})
end
---@param ag string|nil
---@param soil string|nil
local function register_ag_soil_to_soil(ag, soil)
if not ag or not soil then
return
end
exchangeclone.register_craft({
type = "ag_soil_to_soil",
output = soil,
recipe = ag,
})
end
for name, sediment in pairs(sediments) do
register_wetten(name, sediment.wet, liquid_kinds.freshwater)
register_wetten(name, sediment.wet_salty, liquid_kinds.salt_water)
register_wetten(sediment.ag, sediment.ag_wet, liquid_kinds.freshwater)
register_wetten(sediment.ag_depleted, sediment.ag_wet_depleted, liquid_kinds.freshwater)
for _, soil in ipairs(sediment.soils or {}) do
register_wetten(soil.soil, soil.soil_wet, liquid_kinds.freshwater)
register_ag_soil_to_soil(sediment.ag, soil.soil)
end
register_make_ag_depleted(name, sediment.ag_depleted)
end
exchangeclone.register_craft_type("thawing", "cooking", true)
exchangeclone.register_craft_type("fill_water_pot", "shapeless")
for _, liquid_kind in pairs(liquid_kinds) do
if liquid_kind.ice then
exchangeclone.register_craft({
type = "thawing",
output = liquid_kind.source,
recipe = liquid_kind.ice,
})
end
for _, container in ipairs(liquid_containers) do
for _, container_suffix in ipairs(liquid_kind.container_suffixes) do
local filled = container..container_suffix
if minetest.registered_items[filled] then
exchangeclone.register_craft({
type = "fill_water_pot",
output = filled,
recipe = {container, liquid_kind.source},
})
end
end
end
end
exchangeclone.register_craft_type("make_potash_source", "shapeless")
exchangeclone.register_craft({
type = "make_potash_source",
output = liquid_kinds.potash.source,
recipe = {"tech:wood_ash_block", liquid_kinds.freshwater.source},
})
exchangeclone.register_craft_type("make_potash", "shapeless")
exchangeclone.register_craft({
type = "make_potash",
output = "tech:dry_potash_pot",
recipe = {"tech:clay_water_pot_potash"},
})
exchangeclone.register_craft({
type = "make_potash",
output = "tech:potash",
recipe = {"tech:clay_water_pot_potash"},
replacements = {{"tech:clay_water_pot_potash", "tech:clay_water_pot"}},
})
exchangeclone.register_craft_type("transporter_activate", "cooking")
exchangeclone.register_craft({
type = "transporter_activate",
output = "artifacts:transporter_pad_active",
recipe = "artifacts:transporter_pad_charging",
})
exchangeclone.register_craft({
type = "transporter_activate",
output = "artifacts:transporter_pad_charging",
recipe = "artifacts:transporter_pad",
})
exchangeclone.register_craft_type("make_latern", "shapeless")
exchangeclone.register_craft({
type = "make_latern",
output = "tech:lantern_case_wick",
recipe = {"tech:lantern_case", "tech:coarse_fibre"},
})
exchangeclone.register_craft({
type = "make_latern",
output = "tech:lantern_case_glass",
recipe = {"tech:lantern_case", "tech:pane_clear"},
})
exchangeclone.register_craft({
type = "make_latern",
output = "tech:lantern_unlit",
recipe = {"tech:lantern_case_wick", "tech:pane_clear"},
})
exchangeclone.register_craft_type("dye_crafting", "shapeless")
for name, color_data in pairs(exchangeclone.colors) do
exchangeclone.register_craft({
type = "make_latern",
output = color_data.dye.." 2",
recipe = {"ncrafting:bundle_treated_"..name},
})
end
exchangeclone.register_craft_type("lime_slaking", "shapeless")
exchangeclone.register_craft({
type = "lime_slaking",
output = "tech:slaked_lime",
recipe = {"tech:quicklime", liquid_kinds.freshwater.source},
})
exchangeclone.register_craft({
type = "lime_slaking",
output = "tech:slaked_lime_ruined",
recipe = {"tech:quicklime", liquid_kinds.salt_water.source},
})
exchangeclone.register_craft_type("fermenting", "cooking")
exchangeclone.register_craft({
type = "fermenting",
output = "tech:tang",
recipe = "tech:tang_unfermented",
})
exchangeclone.register_craft({
type = "fermenting",
output = "tech:wooden_tang",
recipe = "tech:wooden_tang_unfermented",
})

View File

@ -25,11 +25,6 @@ local ores = {
["technic:zinc_lump"] = true,
}
local furnace_itemstring = "default:furnace"
if exchangeclone.mcl then
furnace_itemstring = "mcl_furnaces:furnace"
end
local function is_ore(itemstring)
if ores[itemstring] then return true end
local exchangeclone_ore = minetest.get_item_group(itemstring, "exchangeclone_ore")
@ -730,7 +725,7 @@ minetest.register_craft({
output = "exchangeclone:dark_matter_furnace",
recipe = {
{ "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", furnace_itemstring, "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", exchangeclone.itemstrings.furnace, "exchangeclone:dark_matter_block" },
{ "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block", "exchangeclone:dark_matter_block" },
}
})

View File

@ -27,7 +27,10 @@ local hoe_function
if exchangeclone.mcl then
hoe_function = create_soil
elseif exchangeclone.exile then
hoe_function = function(...) end -- FIXME: implement
else
assert(exchangeclone.mtg)
if farming then
hoe_function = farming.hoe_on_use
else

View File

@ -32,7 +32,7 @@ minetest.register_tool("exchangeclone:infinite_food", {
groups = { food = 2, eatable = 8, disable_repair = 1, fire_immune = 1},
on_place = exchangeclone.mcl and infinite_food_function,
on_secondary_use = exchangeclone.mcl and infinite_food_function,
on_use = exchangeclone.mtg and infinite_food_function,
on_use = (not exchangeclone.mcl) and infinite_food_function,
_mcl_saturation = 12.8,
})
@ -42,7 +42,7 @@ minetest.register_on_item_eat(function(hp_change, replace_with_item, itemstack,
end
end)
local bread_itemstring = exchangeclone.mcl and "mcl_farming:bread" or "farming:bread"
local bread_itemstring = exchangeclone.itemstrings.bread
minetest.register_craft({
output = "exchangeclone:infinite_food",

View File

@ -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 = {}
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
@ -163,6 +191,9 @@ for _, file in ipairs(files) do
end
minetest.register_on_mods_loaded(function()
if exchangeclone.exile then
dofile(modpath.."/exile_on_mods_loaded.lua")
end
local emc_start_time = minetest.get_us_time()
minetest.log("action", "[ExchangeClone] Registering EMC values")
dofile(modpath.."/register_emc.lua")

View File

@ -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"}
}
})

View File

@ -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, health
author = ThePython10110

View File

@ -7,24 +7,31 @@ local function heal(player, amount)
end
end
local function satiate() end
local satiate = nil
if exchangeclone.mcl and mcl_hunger.active then
satiate = function(player, amount)
local hunger = mcl_hunger.get_hunger(player)
if hunger < 20 then
mcl_hunger.set_hunger(player, hunger + amount)
mcl_hunger.set_saturation(player, hunger + amount)
return true
if exchangeclone.mcl then
if mcl_hunger.active then
satiate = function(player, amount)
local hunger = mcl_hunger.get_hunger(player)
if hunger < 20 then
mcl_hunger.set_hunger(player, hunger + amount)
mcl_hunger.set_saturation(player, hunger + amount)
return true
end
end
end
elseif exchangeclone.mtg and minetest.get_modpath("stamina") then
satiate = function(player, amount)
if stamina.get_saturation(player) < stamina.settings.visual_max then
stamina.change_saturation(player, amount)
return true
elseif exchangeclone.mtg then
if minetest.get_modpath("stamina") then
satiate = function(player, amount)
if stamina.get_saturation(player) < stamina.settings.visual_max then
stamina.change_saturation(player, amount)
return true
end
end
end
else
assert(exchangeclone.exile)
-- FIXME: implement satiate()
end
minetest.register_tool("exchangeclone:soul_stone", {
@ -62,7 +69,7 @@ minetest.register_craft({
}
})
if (exchangeclone.mcl and mcl_hunger.active) or (exchangeclone.mtg and minetest.get_modpath("stamina")) then
if satiate then
minetest.register_tool("exchangeclone:body_stone", {
description = "Body Stone",
inventory_image = "exchangeclone_body_stone.png",
@ -90,7 +97,7 @@ if (exchangeclone.mcl and mcl_hunger.active) or (exchangeclone.mtg and minetest.
groups = {exchangeclone_passive = 1, disable_repair = 1}
})
local sugar_ingredient = exchangeclone.mcl and "mcl_core:sugar" or "default:papyrus"
local sugar_ingredient = exchangeclone.itemstrings.sugar
minetest.register_craft({
output = "exchangeclone:body_stone",
recipe = {

View File

@ -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)
@ -153,26 +162,56 @@ minetest.register_craft({
replacements = {{phil, phil}}
})
minetest.register_craft({
output = exchangeclone.itemstrings.iron,
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
},
replacements = {{phil, phil}}
})
if exchangeclone.exile then
-- in Exile, iron is really hard to make, increase cost to compensate
minetest.register_craft({
output = exchangeclone.itemstrings.iron,
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
},
replacements = {{phil, phil}}
})
minetest.register_craft({
output = exchangeclone.itemstrings.coal.." 2",
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.iron
},
replacements = {{phil, phil}}
})
minetest.register_craft({
output = exchangeclone.itemstrings.coal.." 8",
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.iron
},
replacements = {{phil, phil}}
})
else
minetest.register_craft({
output = exchangeclone.itemstrings.iron,
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.coal,
exchangeclone.itemstrings.coal,
},
replacements = {{phil, phil}}
})
minetest.register_craft({
output = exchangeclone.itemstrings.coal.." 2",
type = "shapeless",
recipe = {
phil,
exchangeclone.itemstrings.iron
},
replacements = {{phil, phil}}
})
end
minetest.register_craft({
output = exchangeclone.itemstrings.copper.." 2",
@ -349,4 +388,38 @@ minetest.register_craft({
"mcl_core:lapis",
},
replacements = {{phil, phil}}
})
})
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

View File

@ -284,6 +284,7 @@ end
if minetest.global_exists("logistica") then
assert(exchangeclone.mcl or exchangeclone.mtg, "logistica integration not implemented for Exile")
exchangeclone.register_craft_type("lava_furnace", "shapeless") -- weird that it's not cooking but I can't see any way around that
exchangeclone.register_craft({
output = "logistica:silverin",
@ -355,6 +356,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 +365,21 @@ 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(item_name, "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.exile and minetest.get_item_group(itemstring, "air") ~= 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
@ -437,7 +443,7 @@ end
local cheapest_color = {""}
for color, color_data in pairs(exchangeclone.colors) do
local dye_itemstring = (exchangeclone.mcl and "mcl_dye:" or "dye:")..color
local dye_itemstring = exchangeclone.itemstrings.dye_prefix..color
local dye_emc = exchangeclone.get_item_emc(dye_itemstring)
if dye_emc then
if (not cheapest_color[2]) or (dye_emc < cheapest_color[2]) then
@ -461,6 +467,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

View File

@ -28,7 +28,10 @@ if exchangeclone.mcl then
mcl_fire.set_fire(pointed_thing, player, false)
end
end
elseif exchangeclone.exile then
--FIXME: implement set_fire
else
assert(exchangeclone.mtg)
set_fire = function(player, pos)
local protname = player:get_player_name()
if minetest.is_protected(pos, protname) then

View File

@ -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)

View File

@ -71,13 +71,13 @@ minetest.register_tool("exchangeclone:talisman_of_repair", {
groups = {exchangeclone_passive = 1, disable_repair = 1}
})
local string = exchangeclone.mcl and "mcl_mobitems:string" or "farming:string"
local string = exchangeclone.itemstrings.string
minetest.register_craft({
output = "exchangeclone:talisman_of_repair",
recipe = {
{"exchangeclone:low_covalence_dust", "exchangeclone:medium_covalence_dust", "exchangeclone:high_covalence_dust"},
{string, exchangeclone.mcl and "mcl_core:paper" or "default:paper", string},
{string, exchangeclone.itemstrings.paper, string},
{"exchangeclone:high_covalence_dust", "exchangeclone:medium_covalence_dust", "exchangeclone:low_covalence_dust"}
}
})

View File

@ -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},

View File

@ -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)

View File

@ -365,35 +365,136 @@ 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",
charcoal = "mcl_core:charcoal_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:",
furnace = "mcl_furnaces:furnace",
collector_ingredient = "mcl_nether:glowstone",
cotton = "mcl_mobitems:string",
string = "mcl_mobitems:string",
bread = "mcl_farming:bread",
sugar = "mcl_core:sugar",
paper = "mcl_core:paper",
}
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_block",
charcoal = "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
furnace = "tech:torch", -- there aren't really furnaces
collector_ingredient = "tech:iron_ingot",
cotton = "tech:coarse_fibre",
string = "tech:coarse_fibre",
bread = "tech:maraka_bread_cooked",
sugar = "nodes_nature:tangkal_fruit",
paper = "tech:coarse_fabric",
}
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",
charcoal = "group:tree",
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:",
furnace = "default:furnace",
collector_ingredient = "default:gold_ingot",
cotton = "farming:cotton",
string = "farming:string",
bread = "farming:bread",
sugar = "default:papyrus",
paper = "default:paper",
}
end
exchangeclone.emc_aliases = {}
@ -478,7 +579,7 @@ end
-- This function gets the drops from a node and drops them at the player's position
function exchangeclone.drop_items_on_player(pos, drops, player) -- modified from MineClone's code
if exchangeclone.mtg then
if not exchangeclone.mcl then
return minetest.handle_node_drops(pos, drops, player)
end
-- NOTE: This function override allows player to be nil.