Added MineClonia Support

This commit is contained in:
ThePython 2023-09-28 16:23:49 -07:00
parent 915e4cadbe
commit 9c5870dd1f
22 changed files with 95 additions and 71 deletions

1
ExchangeClone.wiki Submodule

@ -0,0 +1 @@
Subproject commit 31462be25fec966ebe8f4ec778cb9ffa2bdc79cb

View File

@ -195,6 +195,10 @@ If you have a suggestion or notice a bug, visit the [GitHub issues page](https:/
* Bugfixes:
* Exchange Orbs will now correctly display their energy value (I typed `orb` instead of `exchange_orb` in the energy value list)
### 4.3
* New Features
* Mineclonia Support
### Plans for 5.0
* New features:
* Dark/Red Matter Furnaces

View File

@ -17,7 +17,7 @@ local function get_armor_texture(type, matter, preview)
--modifier = "^[hsl:-180:100:-100"
end
local result
if exchangeclone.mineclone then
if exchangeclone.mcl then
result = "exchangeclone_mcl_"..type.."_base.png"..modifier
else
result = "exchangeclone_mtg_"..type.."_base"
@ -31,7 +31,7 @@ end
function exchangeclone.check_armor_health(obj)
local max_armor = 5
local armor_pieces = 0
if exchangeclone.mineclone then
if exchangeclone.mcl then
max_armor = 4
local inv = mcl_util.get_inventory(obj)
if inv then
@ -87,10 +87,16 @@ minetest.register_on_respawnplayer(function(ObjectRef)
exchangeclone.check_armor_health(ObjectRef)
end)
if exchangeclone.mineclone then
if exchangeclone.mcl then
mcl_armor.register_set({
name = "dark_matter",
description = "Dark Matter",
descriptions = {
head = "Dark Matter Helmet",
torso = "Dark Matter Chestplate",
legs = "Dark Matter Leggings",
feet = "Dark Matter Boots"
},
durability = -1,
enchantability = 0,
points = {
@ -113,6 +119,12 @@ if exchangeclone.mineclone then
mcl_armor.register_set({
name = "red_matter",
description = "Red Matter",
descriptions = {
head = "Red Matter Helmet",
torso = "Red Matter Chestplate",
legs = "Red Matter Leggings",
feet = "Red Matter Boots"
},
durability = -1,
enchantability = 0,
points = {

View File

@ -4,7 +4,7 @@ exchangeclone.axe_action = {
local data = {}
data.player_energy = exchangeclone.get_player_energy(player)
data.energy_cost = 0
if exchangeclone.mineclone then
if exchangeclone.mcl then
data.strip = not player:get_player_control().sneak
end
if range > 0 or not data.strip then

View File

@ -6,7 +6,7 @@ else
end
local function get_element_constructor_formspec()
if not exchangeclone.mineclone then
if not exchangeclone.mcl then
local formspec = {
"size[8,9]",
"label[2,1;Orb]",
@ -52,7 +52,7 @@ local function get_element_constructor_formspec()
end
local function can_dig(pos, player)
if exchangeclone.mineclone then return true end
if exchangeclone.mcl then return true end
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("fuel") and inv:is_empty("src") and inv:is_empty("dst")
@ -70,7 +70,7 @@ local function on_timer(pos, elapsed)
-- make sure the stack at dst is same as the src
if not inv:is_empty("dst") then
if not(src_stack:get_name() == dst_stack:get_name()) then
if exchangeclone.mineclone then
if exchangeclone.mcl then
if not(string.sub(src_stack:get_name(), -10, -1) == "_enchanted"
and string.sub(src_stack:get_name(), 1, -11) == dst_stack:get_name()
and src_stack:get_name() ~= "mcl_core:apple_gold_enchanted") then
@ -94,7 +94,7 @@ local function on_timer(pos, elapsed)
-- "convert" charge into a node at dst
if dst_stack:is_empty() then
-- create a new stack
if exchangeclone.mineclone
if exchangeclone.mcl
and string.sub(src_stack:get_name(), -10, -1) == "_enchanted"
and src_stack:get_name() ~= "mcl_core:apple_gold_enchanted" then
dst_stack = ItemStack(string.sub(src_stack:get_name(), 1, -11))
@ -188,7 +188,7 @@ minetest.register_node("exchangeclone:element_constructor", {
is_ground_content = false,
can_dig = can_dig,
after_dig_node = function(pos, oldnode, oldmetadata, player)
if exchangeclone.mineclone then
if exchangeclone.mcl then
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
@ -222,7 +222,7 @@ minetest.register_node("exchangeclone:element_constructor", {
local recipe_ingredient = "default:pick_diamond"
if exchangeclone.mineclone then
if exchangeclone.mcl then
recipe_ingredient = "mcl_tools:pick_diamond"
end
minetest.register_craft({

View File

@ -6,7 +6,7 @@ else
end
local function get_level(level)
if exchangeclone.mineclone then
if exchangeclone.mcl then
return nil
else
return level
@ -88,7 +88,7 @@ minetest.register_node("exchangeclone:red_matter_block", {
_mcl_blast_resistance = 1500,
_mcl_hardness = 100,
})
if exchangeclone.mineclone then
if exchangeclone.mcl then
minetest.register_craft({
output = "exchangeclone:dark_matter",
recipe = {

View File

@ -8,7 +8,7 @@ end
--Renamed "fuel" inventory to "main" to (almost) work with hoppers
local function get_element_deconstructor_formspec()
if not exchangeclone.mineclone then
if not exchangeclone.mcl then
local formspec = {
"size[8,9]",
"label[2,1;Fuel]",
@ -45,7 +45,7 @@ local function get_element_deconstructor_formspec()
end
local function can_dig(pos, player)
if exchangeclone.mineclone then return true end
if exchangeclone.mcl then return true end
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main") and inv:is_empty("dst")
@ -158,7 +158,7 @@ minetest.register_node("exchangeclone:element_deconstructor", {
is_ground_content = false,
can_dig = can_dig,
after_dig_node = function(pos, oldnode, oldmetadata, player)
if exchangeclone.mineclone then
if exchangeclone.mcl then
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
@ -192,7 +192,7 @@ minetest.register_node("exchangeclone:element_deconstructor", {
local recipe_ingredient = "default:furnace"
if exchangeclone.mineclone then
if exchangeclone.mcl then
recipe_ingredient = "mcl_furnaces:furnace"
end

View File

@ -1543,7 +1543,7 @@ exchangeclone.whitelisted_mods = {
--only allow Mesecons in MineClone
if exchangeclone.mineclone then
if exchangeclone.mcl then
for _, mod in ipairs({
"mesecons",
"mesecons_button",
@ -1572,7 +1572,7 @@ local function set_item_energy(itemstring, energy_value)
if mod_name == "ghost_blocks" then
energy_value = 0
end
if exchangeclone.mineclone then
if exchangeclone.mcl then
if exchangeclone.mcl_energy_values[mod_name] then
energy_value = exchangeclone.mcl_energy_values[mod_name][item_name] or energy_value --override if possible
end
@ -1604,7 +1604,7 @@ local function set_item_energy(itemstring, energy_value)
--minetest.log(itemstring.." "..energy_value.." "..reason)
if mod_name ~= "ghost_blocks" and mod_name ~= "mcl_stairs" and mod_name ~= "stairs" then
local other_itemstrings = {}
if exchangeclone.mineclone then
if exchangeclone.mcl then
other_itemstrings = {
{"mcl_stairs:slab_"..item_name, energy_value/2},
{"mcl_stairs:stair_"..item_name, energy_value*1.5},
@ -1666,7 +1666,7 @@ end
--Wait until all mods are loaded (to make sure all nodes have been registered)
--This is much easier than making it depend on every single MineClone mod.
minetest.register_on_mods_loaded(function()
if exchangeclone.mineclone then --Set all items to MineClone values
if exchangeclone.mcl then --Set all items to MineClone values
local groupnames = {}
for index, group in ipairs(exchangeclone.mcl_group_values) do
groupnames[#groupnames + 1] = group[1] --Get list of group names

View File

@ -7,7 +7,7 @@ end
local function get_energy_collector_formspec()
local formspec
if not exchangeclone.mineclone then
if not exchangeclone.mcl then
formspec = {
"size[8,9]",
"label[3,2;Orb]",
@ -34,7 +34,7 @@ local function get_energy_collector_formspec()
end
local function can_dig(pos, player)
if exchangeclone.mineclone then return true end
if exchangeclone.mcl then return true end
local meta = minetest.get_meta(pos);
local inv = meta:get_inventory()
return inv:is_empty("main")
@ -110,7 +110,7 @@ local function on_blast(pos)
end
local function on_dig_node(pos, oldnode, oldmetadata, player)
if exchangeclone.mineclone then
if exchangeclone.mcl then
local meta = minetest.get_meta(pos)
local meta2 = meta:to_table()
meta:from_table(oldmetadata)
@ -193,7 +193,7 @@ local recipe_item_1 = "default:steelblock"
local recipe_item_2 = "default:obsidian_glass"
local recipe_item_3 = "default:chest"
if exchangeclone.mineclone then
if exchangeclone.mcl then
recipe_item_1 = "mcl_core:ironblock"
recipe_item_2 = "mcl_core:glass"
recipe_item_3 = "mcl_chests:chest"

View File

@ -1,5 +1,5 @@
local stone_group = "cracky"
if exchangeclone.mineclone then
if exchangeclone.mcl then
stone_group = "pickaxey"
end

View File

@ -27,7 +27,7 @@ end
local hoe_function
if exchangeclone.mineclone then
if exchangeclone.mcl then
hoe_function = create_soil
else
hoe_function = farming.hoe_on_use -- assuming farming exists
@ -94,7 +94,7 @@ local hoe_on_place = function(itemstack, player, pointed_thing)
exchangeclone.node_radius_action(player, center, range, exchangeclone.hoe_action, itemstack)
end
if exchangeclone.mineclone then
if exchangeclone.mcl then
mcl_autogroup.register_diggroup("exchangeclone_dirt")
end
for name, def in pairs(minetest.registered_nodes) do

View File

@ -1,38 +1,43 @@
exchangeclone = {}
if (not minetest.get_modpath("mcl_core")) and (not minetest.get_modpath("default")) then
error("ExchangeClone requires 'default' or 'mcl_core,' but Minetest doesn't let me mark one or the other as a dependency.")
else
exchangeclone.mineclone = minetest.get_modpath("mcl_core")
exchangeclone.mcl = minetest.get_modpath("mcl_core")
end
exchangeclone.mineclonia = minetest.get_game_info().id == "mineclonia" -- if exchangeclone.mineclonia, exchangeclone.mcl will also be defined.
exchangeclone.energy_max = 51200000 -- Max capacity of Klein Star Omega
local default_path = minetest.get_modpath("exchangeclone")
local modpath = minetest.get_modpath("exchangeclone")
exchangeclone.collector_speed = minetest.settings:get("exchangeclone.energy_collector_speed") or 5
dofile(default_path.."/lib.lua")
dofile(default_path.."/constructor.lua")
dofile(default_path.."/deconstructor.lua")
dofile(default_path.."/energy_collector.lua")
dofile(default_path.."/orb.lua")
dofile(default_path.."/craftitems.lua")
if exchangeclone.mineclone or minetest.get_modpath("3d_armor") then
dofile(default_path.."/armor.lua")
dofile(modpath.."/lib.lua")
dofile(modpath.."/constructor.lua")
dofile(modpath.."/deconstructor.lua")
dofile(modpath.."/energy_collector.lua")
dofile(modpath.."/orb.lua")
dofile(modpath.."/craftitems.lua")
if exchangeclone.mcl or minetest.get_modpath("3d_armor") then
dofile(modpath.."/armor.lua")
end
dofile(default_path.."/multidig.lua")
if exchangeclone.mineclone then
dofile(modpath.."/multidig.lua")
if exchangeclone.mcl then
mcl_item_id.set_mod_namespace("exchangeclone")
dofile(default_path.."/shears.lua")
dofile(modpath.."/shears.lua")
end
dofile(default_path.."/swords.lua")
dofile(default_path.."/axes.lua")
dofile(default_path.."/hoes.lua")
dofile(default_path.."/pickaxes.lua")
dofile(default_path.."/hammers.lua")
dofile(default_path.."/shovels.lua")
dofile(default_path.."/red_matter_multitools.lua")
dofile(default_path.."/philosophers_stone.lua")
dofile(default_path.."/pesa.lua")
dofile(default_path.."/transmutation_tablet.lua")
dofile(default_path.."/energy.lua")
dofile(modpath.."/swords.lua")
dofile(modpath.."/axes.lua")
dofile(modpath.."/hoes.lua")
dofile(modpath.."/pickaxes.lua")
dofile(modpath.."/hammers.lua")
dofile(modpath.."/shovels.lua")
dofile(modpath.."/red_matter_multitools.lua")
dofile(modpath.."/philosophers_stone.lua")
dofile(modpath.."/pesa.lua")
dofile(modpath.."/transmutation_tablet.lua")
dofile(modpath.."/energy.lua")

View File

@ -165,14 +165,14 @@ end
exchangeclone.wield_scale = {x=1,y=1,z=1}
if exchangeclone.mineclone then
if exchangeclone.mcl then
exchangeclone.wield_scale = mcl_vars.tool_wield_scale
end
exchangeclone.wield_scale = vector.multiply(exchangeclone.wield_scale, 1.5)
exchangeclone.diamond_itemstring = "default:diamond"
if exchangeclone.mineclone then
if exchangeclone.mcl then
exchangeclone.diamond_itemstring = "mcl_core:diamond"
end
@ -218,7 +218,7 @@ local function get_drops(drop, toolname, param2, paramtype2)
end
function exchangeclone.drop_items_on_player(pos, drops, player) --copied from MineClone's code
if not exchangeclone.mineclone then
if not exchangeclone.mcl then
return minetest.handle_node_drops(pos, drops, player)
end
-- NOTE: This function override allows player to be nil.

View File

@ -2,5 +2,5 @@ name = exchangeclone
title = ExchangeClone
description = Equivalent Exchange for Minetest Game and MineClone! Turn items into energy and energy into items, transmute nodes into other nodes, and craft Dark and Red Matter tools!
min_minetest_version = 5.5
optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, ghost_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mcl_blackstone
optional_depends = 3d_armor, mcl_item_id, mcl_core, default, moreswords, mcl_stairs, meat_blocks, ghost_blocks, sticky_things, fake_liquids, sound_machine, stairs, mcl_dispensers, farming, mobs_mc
author = ThePython10110

View File

@ -1,12 +1,12 @@
exchangeclone.multidig = {}
local stone_group = "cracky"
if exchangeclone.mineclone then
if exchangeclone.mcl then
stone_group = "pickaxey"
end
local dirt_group = "crumbly"
if exchangeclone.mineclone then
if exchangeclone.mcl then
dirt_group = "shovely"
end

View File

@ -22,7 +22,7 @@ minetest.register_tool("exchangeclone:exchange_orb", {
local recipe_item_1 = "default:steel_ingot"
local recipe_item_2 = "default:diamond"
if exchangeclone.mineclone then
if exchangeclone.mcl then
recipe_item_1 = "mcl_core:iron_ingot"
recipe_item_2 = "mcl_core:diamond"
end

View File

@ -1,7 +1,7 @@
--Personal Energy Storage Accessor (PESA)
local formspec
if not exchangeclone.mineclone then
if not exchangeclone.mcl then
formspec = {
"size[8,9]",
"label[0.5,0.5;Personal Energy Storage Accessor (PESA)]",
@ -69,7 +69,7 @@ minetest.register_allow_player_inventory_action(function(player, action, inv, in
end)
local chest_itemstring = "default:chest"
if exchangeclone.mineclone then
if exchangeclone.mcl then
chest_itemstring = "mcl_chests:chest"
end

View File

@ -219,7 +219,7 @@ exchangeclone.stone_action = {
}
local on_left_click = nil
if exchangeclone.mineclone then
if exchangeclone.mcl then
on_left_click = function(itemstack, player, pointed_thing)
if player:get_player_control().sneak then
show_enchanting(player)
@ -253,7 +253,7 @@ end
local tt_help = "(Shift)-right-click: transmute nodes. (Shift)-Aux1-right-click: Change range"
local item1 = "mese crystals"
if exchangeclone.mineclone then
if exchangeclone.mcl then
item1 = "emeralds"
end
@ -273,7 +273,7 @@ local usagehelp = "The range can be increased or decreased from 0 to 4 by (shift
"See the crafting guide for recipes. The Philosopher's Stone is NEVER used up in crafting recipes (if it is, it's a bug). The transmutation "..
"range is reset when used in a crafting recipe."
if exchangeclone.mineclone then
if exchangeclone.mcl then
tt_help = tt_help.."\nClick: crafting table. Shift-click: enchanting table."
local extra_stuff = "\n\nIn MineClone, clicking opens a 3x3 crafting table and shift+clicking opens an enchanting table (the equivalent of a real "..
"enchanting table with eight bookshelves around it)."
@ -299,7 +299,7 @@ local diamond = "default:diamond"
local corner = "default:tin_ingot"
local side = "default:obsidian"
if exchangeclone.mineclone then
if exchangeclone.mcl then
diamond = "mcl_core:diamond"
corner = "mcl_nether:glowstone_dust"
side = "mesecons:redstone"
@ -675,7 +675,7 @@ minetest.register_craft({
replacements = {{"exchangeclone:philosophers_stone", "exchangeclone:philosophers_stone"}}
})
if exchangeclone.mineclone then -- no idea why both recipes show up in the craft guide, so added if/else
if exchangeclone.mcl then -- no idea why both recipes show up in the craft guide, so added if/else
minetest.register_craft({
output = "exchangeclone:alchemical_coal",
type = "shapeless",

View File

@ -26,7 +26,7 @@ function exchangeclone.mine_vein(player, player_energy, start_pos, node_name, po
end
local torch_itemstring = "default:torch"
if exchangeclone.mineclone then
if exchangeclone.mcl then
torch_itemstring = "mcl_torches:torch"
end

View File

@ -151,7 +151,7 @@ exchangeclone.morningstar_action = {
}
local torch_itemstring = "default:torch"
if exchangeclone.mineclone then
if exchangeclone.mcl then
torch_itemstring = "mcl_torches:torch"
end

View File

@ -4,7 +4,7 @@ exchangeclone.shovel_action = {
local data = {}
data.player_energy = exchangeclone.get_player_energy(player)
data.energy_cost = 0
if exchangeclone.mineclone then
if exchangeclone.mcl then
data.path = not player:get_player_control().sneak
end
if range > 0 or not data.path then
@ -19,7 +19,9 @@ exchangeclone.shovel_action = {
minetest.record_protection_violation(pos, player:get_player_name())
else
if data.path then
if (minetest.get_item_group(node.name, "path_creation_possible") == 1) then
-- TODO: Fix potential "shovel_on_place" functions that aren't paths in Mineclonia
if minetest.registered_items[node.name]._on_shovel_place or
minetest.get_item_group(node.name, "path_creation_possible") == 1 then
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pos}, true)
data.energy_cost = data.energy_cost + 4
minetest.swap_node(pos, {name="mcl_core:grass_path"})

View File

@ -128,7 +128,7 @@ exchangeclone.aoe_attack = function(info)
if not obj:is_player() then
return
end
if exchangeclone.mineclone then
if exchangeclone.mcl then
mcl_util.deal_damage(obj, damage, { type = "generic", direct = player})
else
obj:set_hp(obj:get_hp() - damage)
@ -136,7 +136,7 @@ exchangeclone.aoe_attack = function(info)
obj:add_velocity(vector.multiply(punch_dir, knockback/distance))
end)
else
if exchangeclone.mineclone then
if exchangeclone.mcl then
mcl_util.deal_damage(obj, damage, { type = "generic", direct = player})
else
obj:set_hp(obj:get_hp() - damage)