Still working on furnaces/collectors

This commit is contained in:
ThePython 2023-10-03 17:07:36 -07:00
commit 5e9ca823af
26 changed files with 161 additions and 71 deletions

23
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help improve ExchangeClone
title: "[Bug] Title"
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**Expected behavior**
A clear and concise description of what you expected to happen.
**Game (e.g. Minetest Game)**
Which game were you playing?
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Additional context**
Add any other context about the problem here.

View File

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature Request] Title"
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

10
.github/ISSUE_TEMPLATE/other.md vendored Normal file
View File

@ -0,0 +1,10 @@
---
name: Other
about: Anything besides feature requests and bugs
title: ''
labels: ''
assignees: ''
---

8
CODE_OF_CONDUCT.md Normal file
View File

@ -0,0 +1,8 @@
# Code of Conduct
Don't be evil.
That's it.
If you don't follow this simple rule, you ~will~ might be blocked.
Pretty simple.

6
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,6 @@
# Contributing Guidelines
If you want to contribute, please do so, either through issues or pull requests.
Feel free to report any problems or suggestions (including things as small as typos). If you know how to fix it, a PR would be even more useful.
Please follow the [Code of Conduct](CODE_OF_CONDUCT.md) when contributing.

View File

@ -171,6 +171,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
### 5.0 (another *huge* release)
* New features:
* Transmutation Table(t)

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

@ -1,5 +1,5 @@
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]",
@ -45,7 +45,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")
@ -63,7 +63,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
@ -87,7 +87,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))
@ -181,7 +181,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)
@ -215,7 +215,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

@ -1,5 +1,5 @@
local function get_level(level)
if exchangeclone.mineclone then
if exchangeclone.mcl then
return nil
else
return level
@ -79,7 +79,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

@ -1,7 +1,7 @@
--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]",
@ -38,7 +38,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")
@ -151,7 +151,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)
@ -185,7 +185,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

@ -1577,7 +1577,7 @@ exchangeclone.whitelisted_mods = {
--only allow Mesecons in MineClone
if exchangeclone.mineclone then
if exchangeclone.mcl then
for _, mod in ipairs({
"mesecons",
"mesecons_button",
@ -1606,7 +1606,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
@ -1641,7 +1641,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},
@ -1703,7 +1703,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

@ -1,6 +1,6 @@
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]",
@ -27,7 +27,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")
@ -123,7 +123,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)
@ -216,7 +216,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,39 +1,44 @@
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_table.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_table.lua")
dofile(default_path.."/furnaces.lua")
dofile(default_path.."/energy.lua")
dofile(modpath.."/energy.lua")

View File

@ -198,14 +198,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
@ -265,7 +265,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)]",
@ -70,7 +70,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

@ -252,7 +252,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)
@ -341,7 +341,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
@ -361,7 +361,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)."
@ -495,7 +495,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"
@ -886,7 +886,7 @@ minetest.register_craft({
replacements = {{"exchangeclone:philosophers_stone", "exchangeclone:philosophers_stone"}}
})
if exchangeclone.mineclone then
if exchangeclone.mcl then
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
if minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}).name == "air" then
minetest.sound_play({name="default_grass_footstep", gain=1}, {pos = pos}, true)
data.energy_cost = data.energy_cost + 4

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)