Compare commits
No commits in common. "c39ff263d9a02bb89934e0ff0dd21b27345da6e8" and "b8ed0fa57fced0ce05269459b881674279dba27e" have entirely different histories.
c39ff263d9
...
b8ed0fa57f
57
README.md
57
README.md
|
@ -38,10 +38,8 @@ Dependencies: Minetest Game or MineClone.
|
|||
|
||||
|
||||
## Known issues:
|
||||
* Dark/Red Matter armor don't work they way they should, especially in MTG. I would greatly appreciate a PR that makes them work more like ProjectE.
|
||||
* The sword/katar AOE ability does not take upgrades into account. This will probably not be fixed (MCL)
|
||||
* It is impossible to die from most things when wearing DM/RM armor in MineClon(e/ia)... There's some rounding thing that happens when the player has 1 health or something. I can't figur it out.
|
||||
* When machines are exploded, they (and the items inside) do not drop. I can't figure out why.
|
||||
* For technical reasons (making them work with MCL hoppers), Exchange Orbs and Upgrades can be used as fuel. This isn't really a problem, but it will be removed once I decide the new hopper API is new enough that most people are using it.
|
||||
* Dark/Red matter shears will sometimes (randomly) be treated as normal shears when used by MCL dispensers. This will not be fixed.
|
||||
|
||||
**If you have a suggestion or notice a bug, visit the [GitHub issues page](https://github.com/thepython10110/exchangeclone/issues).**
|
||||
|
@ -66,20 +64,23 @@ Dependencies: Minetest Game or MineClone.
|
|||
|
||||
### TODO:
|
||||
* Figure out what's going to happen with Technic (the PR probably won't be merged)
|
||||
* Test everything in MTG, MCL2, and MCLA (and 5.7)
|
||||
* Finish changelog
|
||||
* Finish wiki
|
||||
* Fix tools updating surrounding nodes
|
||||
* Code for covalence dust
|
||||
* Improve multidig
|
||||
* Add more Energy Collectors
|
||||
* Fix MCL2 hoppers
|
||||
|
||||
\* Not actually added yet
|
||||
|
||||
### v6.0 (The Compatibility Update)
|
||||
|
||||
**The biggest changes:**
|
||||
* I'm naming updates now for some reason.
|
||||
* Automatic energy values! This means I don't have to manually add energy values for every single item. If it's craftable (and even if it's not in many cases), ExchangeClone will automatically figure out an energy value for it.
|
||||
* The minimum Minetest version has been changed to 5.7.0, because I'm never going to test on any older versions. Of course, it will probably still work (at least mostly) on other versions, but I can't promise anything.
|
||||
* Players can now have up to 1 trillion personal energy!
|
||||
* Energy values now better match ProjectE's.
|
||||
* Changed A LOT of things internally. Any mods depending on ExchangeClone (probably not very many, which is good) will probably need to update stuff.
|
||||
* **The PESA will be removed in version 7.0.**
|
||||
* I'm naming updates now for some reason.
|
||||
* Automatic energy values! This means I don't have to manually add energy values for every single item. If it's craftable (and even if it's not in many cases), ExchangeClone will automatically figure out an energy value for it.
|
||||
* The minimum Minetest version has been changed to 5.7.0, because I'm never going to test on any older versions. Of course, it will probably still work (at least mostly) on other versions, but I can't promise anything.
|
||||
* Players can now have up to 1 trillion personal energy!
|
||||
* Energy values now better match ProjectE's.
|
||||
* **The PESA will be removed in version 7.0.**
|
||||
|
||||
**Full Changelog**
|
||||
* New Features:
|
||||
|
@ -88,43 +89,45 @@ Dependencies: Minetest Game or MineClone.
|
|||
* Technic recipe types (grinding, alloying, etc.) will also work, as long as their `output_size` is 1 (meaning they only output one item at a time, so not the centrifuge or separator).
|
||||
* Also supports Mineclonia's stonecutter recipes, Netherite upgrades, and more.
|
||||
* Added various ways of adding custom energy values or energy recipes (`exchangeclone.register_alias`, `exchangeclone.register_craft_type`, and `exchangeclone.register_craft`)
|
||||
* Support for Pipeworks and Hopper mods! (MCL hoppers already worked)
|
||||
* Added energy values for More Ores and Technic.
|
||||
* Infinite food (costs 64 energy to use, but isn't consumed, equal to MCL steak)
|
||||
* Alchemical Chests, Alchemical Bags, and Advanced Alchemical Chests
|
||||
* Labels on items in the Transmutation GUI showing how many items can be created.
|
||||
* Added comma separators when energy is shown (to make it easier to identify large numbers)
|
||||
* Covalence Dust
|
||||
* Left-click (or aux1-left-click in MCL) with Philosopher's Stone to open repairing menu; only tools with an energy value can be repaired)
|
||||
* Support for Pipeworks and Hopper mods! (MCL hoppers already worked)
|
||||
* Covalence Dust (left-click with Philosopher's Stone to open repairing menu; only tools with an energy value can be repaired)\*
|
||||
* Mind, Life, Body, and Soul Stones (although MTG only has the soul stone).\*
|
||||
* 5 more Energy Collectors (to go with the increased energy limit)
|
||||
* Chat commands to set/add/remove energy from a player (requires `privs` privilege):
|
||||
* `/add_player_energy [player] value` (player defaults to self, value can be negative)
|
||||
* `/set_player_energy [player] value` (player defaults to self, value can be "limit" to set to the limit)
|
||||
* `/set_player_energy [player] value` (player defaults to self)
|
||||
* Changes:
|
||||
* Energy values are now in `zzzz_exchangeclone_init/base_energy_values.lua`, and are laid out differently, and aliases now work.
|
||||
* ExchangeClone is now a modpack for [annoying reasons](https://forum.minetest.net/viewtopic.php?f=47&p=429775s).
|
||||
* Energy values are now in `zzzz_exchangeclone_init/base_energy_values.lua`, and are laid out differently, and aliases now work.
|
||||
* The default energy value is no longer 1 but none.
|
||||
* The 2.14-billion-ish personal energy limit is has been increased to 1,000,000,000,000 (1 trillion). Any higher (literally ANY higher) and there are precision-based exploits like being able to create an unlimited amount of anything with an energy value less than 1. I considered finding some library for arbitrary precision in Lua, but decided it was too much work (and nobody really needs more than a trillion energy anyway).
|
||||
* Energy values are now multiples of 0.05 instead of 0.25, for no real reason.
|
||||
* MineClon(e2/ia) energy values now (mostly) match ProjectE's, with a few minor differences, including these:
|
||||
* MineClon(e2/ia) energy values now (mostly) match ProjectE's, with a few minor differences.
|
||||
* Emeralds are still worth less than diamonds because of villager trades (in my opinion, this should be changed in ProjectE as well)
|
||||
* Bamboo is worth less so things make more sense.
|
||||
* Dyes are worth different amounts based on their crafting recipes, so different colors of things are worth different amounts.
|
||||
* Since fractional energy values are allowed, some energy values may be slightly different.
|
||||
* Energy values are now multiples of 0.05 instead of 0.25, for no real reason.
|
||||
* Tools that break multiple nodes at once (hammers, hoes, katar, and morningstar) use a better method that may (?) slightly decrease lag.\*
|
||||
* A couple changes involving the Philosopher's Stone:
|
||||
* Ender pearls can now be crafted with 4 iron and the Philosopher's Stone (MCL).
|
||||
* Copper's energy value has been changed (128 instead of 85), and the recipe has been changed accordingly.
|
||||
* Ice and obsidian can now be transmuted into water and lava, respectively.
|
||||
* It is now impossible to transmute between bedrock and barriers (MCL). I thought it was funny originally, but now I'm realizing that I don't want this to be annoying to people who run servers (are there any servers with this mod?)
|
||||
* It now costs 4 dark/red matter to make a block, which is great news if you already have some (because they're now worth more), but not so great if you don't. Sorry or you're welcome.
|
||||
* It now costs 4 dark/red matter to make a block, which is great news if you already have some (because they're now worth more), but not so great if you don't. Sorry and you're welcome.
|
||||
* Tool abilities now have no energy cost (to match ProjectE).
|
||||
* Tool abilities now take upgrades into account (silk touch, fortune, etc.) except for the sword AOE ability (which would require irritating hacky workarounds).
|
||||
* Several neutral mobs (endermen, spiders, piglins) are now affected by the dark/red matter sword in "slay hostile" mode, to match ProjectE.
|
||||
* Tool abilities now take upgrades into account (silk touch, fortune, etc.) except for the sword AOE ability (which would require more irritating hacky workarounds).
|
||||
* Several neutral mobs (endermen, spiders, piglins) are now affected by the dark/red matter sword in "slay all" mode, to match ProjectE.
|
||||
* Bugfixes:
|
||||
* Fixed potion energy values (MCL)
|
||||
* Fixed Red Matter Shield recipe (MTG)
|
||||
* Fixed potion energy values
|
||||
* Fixed Red Matter Shield recipe
|
||||
* Fixed other modes of DM/RM tools not having energy values
|
||||
* Deconstructors and Constructors will now continue trying to work instead of just stopping when there is too much or too little energy.
|
||||
* Tool abilities now update nodes that require support (torches, sand, etc.).
|
||||
* Deconstructors and Constructors now use node timers again (but better than before), meaning they won't ever stop. (Previously, they would stop if there was too much energy to deconstruct or too little energy to construct.)
|
||||
* Tool abilities now update nodes that require support (torches, sand, etc.)\*.
|
||||
* MCL raw copper, iron, and gold blocks now correctly double in DM/RM furnaces.
|
||||
|
||||
### v5.4
|
||||
|
|
|
@ -29,7 +29,7 @@ local function alchemical_on_construct(color)
|
|||
return function(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string("formspec", alchemical_formspec(color))
|
||||
meta:set_string("infotext", color.." Advanced Alchemical Chest")
|
||||
meta:set_string("infotext", color.." Alchemical Chest")
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -2,14 +2,13 @@ local S = minetest.get_translator()
|
|||
|
||||
-- true = blocks all damage
|
||||
-- {base_block, block_per_rm}: Amount blocked by full dark matter, extra amount per red matter armor piece
|
||||
-- only applies in MCL
|
||||
local blocked_damage_types = {
|
||||
drown = true,
|
||||
lava = true,
|
||||
in_fire = true,
|
||||
on_fire = true,
|
||||
hot_floor = true,
|
||||
fall = {0.8, exchangeclone.mcl and 0.025 or 0.02},
|
||||
fall = {0.9, 0.0125},
|
||||
}
|
||||
|
||||
local function get_armor_texture(type, matter, preview)
|
||||
|
@ -50,7 +49,7 @@ if exchangeclone.mcl then
|
|||
mcl_armor.register_set({
|
||||
name = "dark_matter",
|
||||
description = "Dark Matter",
|
||||
descriptions = exchangeclone.mcla and {
|
||||
descriptions = exchangeclone.mineclonia and {
|
||||
head = S("Dark Matter Helmet"),
|
||||
torso = S("Dark Matter Chestplate"),
|
||||
legs = S("Dark Matter Leggings"),
|
||||
|
@ -78,7 +77,7 @@ if exchangeclone.mcl then
|
|||
mcl_armor.register_set({
|
||||
name = "red_matter",
|
||||
description = "Red Matter",
|
||||
descriptions = exchangeclone.mcla and {
|
||||
descriptions = exchangeclone.mineclonia and {
|
||||
head = S("Red Matter Helmet"),
|
||||
torso = S("Red Matter Chestplate"),
|
||||
legs = S("Red Matter Leggings"),
|
||||
|
@ -104,8 +103,8 @@ if exchangeclone.mcl then
|
|||
cook_material = "exchangeclone:dark_matter",
|
||||
})
|
||||
|
||||
for _, matter in pairs({"dark", "red"}) do
|
||||
for _, type in pairs({"helmet", "chestplate", "leggings", "boots"}) do
|
||||
for _, matter in ipairs({"dark", "red"}) do
|
||||
for _, type in ipairs({"helmet", "chestplate", "leggings", "boots"}) do
|
||||
minetest.override_item("exchangeclone:"..type.."_"..matter.."_matter", {
|
||||
inventory_image = get_armor_texture("inv_"..type, matter),
|
||||
wield_image = get_armor_texture("inv_"..type, matter),
|
||||
|
|
|
@ -155,7 +155,7 @@ minetest.register_node("exchangeclone:constructor", {
|
|||
"exchangeclone_constructor_right.png",
|
||||
"exchangeclone_constructor_right.png"
|
||||
},
|
||||
groups = {cracky = 2, container = exchangeclone.mcl2 and 2 or 4, pickaxey = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {cracky = 2, container = 4, pickaxey = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
_mcl_hardness = 3,
|
||||
_mcl_blast_resistance = 6,
|
||||
sounds = exchangeclone.sound_mod.node_sound_metal_defaults(),
|
||||
|
@ -167,7 +167,7 @@ minetest.register_node("exchangeclone:constructor", {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "dst", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "dst", "fuel"}) do
|
||||
local stack = inv:get_stack(listname, 1)
|
||||
if not stack:is_empty() then
|
||||
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
|
||||
|
@ -195,11 +195,6 @@ minetest.register_node("exchangeclone:constructor", {
|
|||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
on_timer = constructor_action,
|
||||
_mcl_hoppers_on_try_pull = exchangeclone.hoppers_on_try_pull,
|
||||
_mcl_hoppers_on_try_push = exchangeclone.hoppers_on_try_push,
|
||||
_mcl_hoppers_on_after_push = function(pos)
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
end,
|
||||
})
|
||||
|
||||
if exchangeclone.pipeworks then
|
||||
|
|
|
@ -1,43 +1,20 @@
|
|||
local S = minetest.get_translator()
|
||||
|
||||
exchangeclone.tool_types = exchangeclone.tool_types or {}
|
||||
|
||||
for group, amount in pairs({
|
||||
pickaxe = 3,
|
||||
pick = 3,
|
||||
sword = 2,
|
||||
axe = 3,
|
||||
shovel = 1,
|
||||
hoe = 2,
|
||||
hammer = 2,
|
||||
shears = 2,
|
||||
helmet = 5,
|
||||
chestplate = 8,
|
||||
leggings = 7,
|
||||
boots = 4,
|
||||
shield = exchangeclone.mcl and 1 or 7,
|
||||
}) do
|
||||
exchangeclone.tool_types[group] = exchangeclone.tool_types[group] or amount
|
||||
end
|
||||
|
||||
local charcoal_itemstring = exchangeclone.mcl and "mcl_core:charcoal_lump" or "group:tree"
|
||||
|
||||
minetest.register_craftitem("exchangeclone:low_covalence_dust", {
|
||||
description = S("Low Covalence Dust"),
|
||||
groups = {covalence_dust = 1},
|
||||
inventory_image = "exchangeclone_dust.png^[colorize:#00ff00:128",
|
||||
wield_image = "exchangeclone_dust.png^[colorize:#00ff00:128",
|
||||
})
|
||||
minetest.register_craftitem("exchangeclone:medium_covalence_dust", {
|
||||
description = S("Medium Covalence Dust"),
|
||||
groups = {covalence_dust = 2},
|
||||
inventory_image = "exchangeclone_dust.png^[colorize:#00ffff:128",
|
||||
wield_image = "exchangeclone_dust.png^[colorize:#00ffff:128",
|
||||
})
|
||||
|
||||
minetest.register_craftitem("exchangeclone:high_covalence_dust", {
|
||||
description = S("High Covalence Dust"),
|
||||
groups = {covalence_dust = 3},
|
||||
inventory_image = "exchangeclone_dust.png^[colorize:#0000ff:128",
|
||||
wield_image = "exchangeclone_dust.png^[colorize:#0000ff:128",
|
||||
})
|
||||
|
@ -72,78 +49,4 @@ minetest.register_craft({
|
|||
recipe = {
|
||||
exchangeclone.itemstrings.diamond, exchangeclone.itemstrings.coal
|
||||
}
|
||||
})
|
||||
|
||||
local listnames = {exchangeclone_covalence_dust = true, exchangeclone_covalence_gear = true, exchangeclone_covalence_output = true}
|
||||
|
||||
local function is_repairable_gear(item)
|
||||
item = ItemStack(item)
|
||||
if item:get_wear() <= 0 then return end
|
||||
if (exchangeclone.get_item_energy(item) or 0) <= 0 then return end
|
||||
|
||||
local result = 0
|
||||
for group, amount in pairs(exchangeclone.tool_types) do
|
||||
if minetest.get_item_group(item:get_name(), group) > 0 then
|
||||
result = result + amount
|
||||
end
|
||||
end
|
||||
return (result > 0) and result
|
||||
end
|
||||
|
||||
-- Doesn't even get to repairable_gear function
|
||||
minetest.register_allow_player_inventory_action(function(player, action, inventory, info)
|
||||
if action == "take" and listnames[info.listname] then
|
||||
return info.stack:get_count()
|
||||
elseif action == "move" and listnames[info.to_list] then
|
||||
if info.to_list == "exchangeclone_covalence_output" then
|
||||
return 0
|
||||
elseif info.to_list == "exchangeclone_covalence_gear" then
|
||||
local stack = inventory:get_stack(info.from_list, info.from_index)
|
||||
return is_repairable_gear(stack) and info.count or 0
|
||||
elseif info.to_list == "exchangeclone_covalence_dust" then
|
||||
local stack = inventory:get_stack(info.from_list, info.from_index)
|
||||
return (minetest.get_item_group(stack:get_name(), "covalence_dust") > 0) and info.count or 0
|
||||
end
|
||||
elseif action == "put" and listnames[info.listname] then
|
||||
if info.listname == "exchangeclone_covalence_output" then
|
||||
return 0
|
||||
elseif info.listname == "exchangeclone_covalence_gear" then
|
||||
return is_repairable_gear(info.stack) and info.stack:get_count() or 0
|
||||
elseif info.listname == "exchangeclone_covalence_dust" then
|
||||
return (minetest.get_item_group(info.stack:get_name(), "covalence_dust") > 0) and info.stack:get_count() or 0
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
-- I'm aware that this does not account for tools that can stack, but that's just because I don't think that's even possible.
|
||||
minetest.register_on_player_inventory_action(function(player, action, inventory, info)
|
||||
if ((action == "take" or action == "put") and listnames[info.listname])
|
||||
or (action == "move" and (listnames[info.to_list] or listnames[info.from_list])) then
|
||||
local gear_stack = inventory:get_stack("exchangeclone_covalence_gear", 1)
|
||||
local dust_stack = inventory:get_stack("exchangeclone_covalence_dust", 1)
|
||||
if gear_stack:is_empty() or dust_stack:is_empty() then return end
|
||||
if not inventory:room_for_item("exchangeclone_covalence_output", gear_stack) then return end
|
||||
local amount = is_repairable_gear(gear_stack)
|
||||
local energy_value = exchangeclone.get_item_energy(gear_stack)
|
||||
local tier = 3
|
||||
if energy_value/amount < 50 then
|
||||
tier = 1
|
||||
elseif energy_value/amount < 6000 then
|
||||
tier = 2
|
||||
end
|
||||
if minetest.get_item_group(dust_stack:get_name(), "covalence_dust") >= tier and dust_stack:get_count() >= amount then
|
||||
local new_stack = ItemStack(gear_stack)
|
||||
new_stack:set_wear(0)
|
||||
inventory:add_item("exchangeclone_covalence_output", new_stack)
|
||||
inventory:set_stack("exchangeclone_covalence_gear", 1, ItemStack(""))
|
||||
dust_stack:set_count(dust_stack:get_count() - amount)
|
||||
inventory:set_stack("exchangeclone_covalence_dust", 1, dust_stack)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_joinplayer(function(player, time_since_whatever)
|
||||
for listname, _ in pairs(listnames) do
|
||||
player:get_inventory():set_size(listname, 1)
|
||||
end
|
||||
end)
|
||||
})
|
|
@ -57,8 +57,8 @@ local function deconstructor_action(pos, elapsed)
|
|||
local individual_energy_value = exchangeclone.get_item_energy(stack:get_name())
|
||||
if not (individual_energy_value and individual_energy_value > 0) then return end
|
||||
local wear = stack:get_wear()
|
||||
if wear and wear > 0 then
|
||||
individual_energy_value = math.max(math.floor(individual_energy_value * (65536 / wear)), 1)
|
||||
if wear and wear > 1 then
|
||||
individual_energy_value = math.floor(individual_energy_value * (65536 / wear))
|
||||
end
|
||||
if stack:get_name() == "exchangeclone:exchange_orb" then
|
||||
individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack)
|
||||
|
@ -167,7 +167,7 @@ minetest.register_node("exchangeclone:deconstructor", {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "fuel"}) do
|
||||
local stack = inv:get_stack(listname, 1)
|
||||
if not stack:is_empty() then
|
||||
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
|
||||
|
@ -198,11 +198,6 @@ minetest.register_node("exchangeclone:deconstructor", {
|
|||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
_mcl_hoppers_on_try_pull = exchangeclone.hoppers_on_try_pull,
|
||||
_mcl_hoppers_on_try_push = exchangeclone.hoppers_on_try_push,
|
||||
_mcl_hoppers_on_after_push = function(pos)
|
||||
minetest.get_node_timer(pos):start(1.0)
|
||||
end,
|
||||
})
|
||||
|
||||
if exchangeclone.pipeworks then
|
||||
|
|
|
@ -24,7 +24,7 @@ minetest.register_lbm({
|
|||
|
||||
local function check_for_furnaces(pos, set_furnace, start)
|
||||
local found = false
|
||||
for _, check_pos in pairs(exchangeclone.neighbors) do
|
||||
for _, check_pos in ipairs(exchangeclone.neighbors) do
|
||||
local new_pos = vector.add(pos, check_pos)
|
||||
local node = minetest.get_node(new_pos)
|
||||
local furnace = minetest.get_item_group(node.name, "exchangeclone_furnace")
|
||||
|
@ -221,6 +221,7 @@ function exchangeclone.register_energy_collector(itemstring, name, amount, modif
|
|||
input_inventory = "main",
|
||||
connect_sides = {left = 1, right = 1, back = 1, front = 1, bottom = 1, top = 1},
|
||||
insert_object = function(pos, node, stack, direction)
|
||||
minetest.log(dump(direction))
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
return inv:add_item("main", stack)
|
||||
|
@ -269,7 +270,7 @@ exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk3", S(
|
|||
}
|
||||
)
|
||||
|
||||
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk4", S("Energy Collector MK4"), 160, "^[multiply:#aa7700", {
|
||||
exchangeclone.register_energy_collector("exchangeclone:energy_collector_mk4", S("Energy Collector MK4"), 160, "^[multiply:#777700", {
|
||||
{iron_block, iron_block, iron_block},
|
||||
{"exchangeclone:energy_collector_mk3", "exchangeclone:energy_collector_mk3", "exchangeclone:energy_collector_mk3"},
|
||||
{iron_block, iron_block, iron_block}
|
||||
|
|
|
@ -514,7 +514,7 @@ local inactive_def = {
|
|||
"exchangeclone_dark_matter_furnace.png",
|
||||
},
|
||||
paramtype2 = "4dir",
|
||||
groups = {pickaxey=5, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, cracky = 3, container=4, material_stone=1, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
|
||||
|
@ -524,7 +524,7 @@ local inactive_def = {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "dst", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "dst", "fuel"}) do
|
||||
if listname == "src" or listname == "dst" then
|
||||
for i = 1,7 do
|
||||
local stack = inv:get_stack(listname, i)
|
||||
|
@ -591,12 +591,7 @@ local inactive_def = {
|
|||
_mcl_blast_resistance = 1500,
|
||||
_mcl_hardness = 75,
|
||||
on_rotate = on_rotate,
|
||||
after_place_node = exchangeclone.pipeworks and pipeworks.after_place,
|
||||
_mcl_hoppers_on_try_pull = exchangeclone.hoppers_on_try_pull,
|
||||
_mcl_hoppers_on_try_push = exchangeclone.hoppers_on_try_push,
|
||||
_mcl_hoppers_on_after_push = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.45)
|
||||
end,
|
||||
after_place_node = exchangeclone.pipeworks and pipeworks.after_place
|
||||
}
|
||||
|
||||
local active_def = {
|
||||
|
@ -613,7 +608,7 @@ local active_def = {
|
|||
parammatter_type = "light",
|
||||
light_source = LIGHT_ACTIVE_FURNACE,
|
||||
drop = "exchangeclone:dark_matter_furnace",
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, container = exchangeclone.mcl2 and 2 or 4, material_stone=1, cracky = 3, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, container = 4, material_stone=1, cracky = 3, level = get_level(4), exchangeclone_furnace = 1, tubedevice = 1, tubedevice_receiver = 1},
|
||||
is_ground_content = false,
|
||||
sounds = exchangeclone.sound_mod.node_sound_stone_defaults(),
|
||||
on_timer = furnace_node_timer,
|
||||
|
@ -623,7 +618,7 @@ local active_def = {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "dst", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "dst", "fuel"}) do
|
||||
if listname == "src" or listname == "dst" then
|
||||
for i = 1,7 do
|
||||
local stack = inv:get_stack(listname, i)
|
||||
|
@ -666,9 +661,7 @@ local active_def = {
|
|||
_mcl_hardness = 75,
|
||||
on_rotate = on_rotate,
|
||||
after_rotate = after_rotate_active,
|
||||
after_place_node = exchangeclone.pipeworks and pipeworks.after_place,
|
||||
_mcl_hoppers_on_try_pull = exchangeclone.hoppers_on_try_pull,
|
||||
_mcl_hoppers_on_try_push = exchangeclone.hoppers_on_try_push,
|
||||
after_place_node = exchangeclone.pipeworks and pipeworks.after_place
|
||||
}
|
||||
|
||||
if exchangeclone.pipeworks then
|
||||
|
@ -713,7 +706,7 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
|
|||
"exchangeclone_red_matter_block.png",
|
||||
"exchangeclone_red_matter_furnace.png",
|
||||
},
|
||||
groups = {pickaxey=5, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, cracky = 3, container=4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
_mcl_hardness = 100,
|
||||
|
||||
on_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player)
|
||||
|
@ -753,7 +746,7 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "dst", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "dst", "fuel"}) do
|
||||
if listname == "src" or listname == "dst" then
|
||||
for i = 1,10 do
|
||||
local stack = inv:get_stack(listname, i)
|
||||
|
@ -775,11 +768,6 @@ minetest.override_item("exchangeclone:red_matter_furnace", {
|
|||
pipeworks.after_dig(pos)
|
||||
end
|
||||
end,
|
||||
_mcl_hoppers_on_try_pull = exchangeclone.hoppers_on_try_pull,
|
||||
_mcl_hoppers_on_try_push = exchangeclone.hoppers_on_try_push,
|
||||
_mcl_hoppers_on_after_push = function(pos)
|
||||
minetest.get_node_timer(pos):start(0.16)
|
||||
end,
|
||||
|
||||
})
|
||||
|
||||
|
@ -794,7 +782,7 @@ minetest.override_item("exchangeclone:red_matter_furnace_active", {
|
|||
"exchangeclone_red_matter_furnace.png",
|
||||
},
|
||||
drop = "exchangeclone:red_matter_furnace",
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, not_in_creative_inventory = 1, cracky = 3, container=4, deco_block=1, material_stone=1, level = get_level(5), exchangeclone_furnace = 2, tubedevice = 1, tubedevice_receiver = 1},
|
||||
_mcl_hardness = 100,
|
||||
|
||||
on_construct = function(pos)
|
||||
|
@ -811,7 +799,7 @@ minetest.override_item("exchangeclone:red_matter_furnace_active", {
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"src", "dst", "fuel"}) do
|
||||
for _, listname in ipairs({"src", "dst", "fuel"}) do
|
||||
if listname == "src" or listname == "dst" then
|
||||
for i = 1,10 do
|
||||
local stack = inv:get_stack(listname, i)
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
local S = minetest.get_translator()
|
||||
|
||||
local stamina_exists = minetest.get_modpath("stamina")
|
||||
local stamina_max = minetest.settings:get("stamina.visual_max") or 20
|
||||
|
||||
local function infinite_food_function(itemstack, player, pointed_thing)
|
||||
local click_test = exchangeclone.check_on_rightclick(itemstack, player, pointed_thing)
|
||||
local original = ItemStack(itemstack)
|
||||
|
@ -11,13 +8,7 @@ local function infinite_food_function(itemstack, player, pointed_thing)
|
|||
end
|
||||
local player_energy = exchangeclone.get_player_energy(player)
|
||||
if player_energy >= 64 then
|
||||
if stamina_exists and stamina.get_saturation(player) >= stamina_max then
|
||||
return nil
|
||||
elseif not exchangeclone.mcl and player:get_hp() >= player:get_properties().hp_max then
|
||||
return nil
|
||||
end
|
||||
-- no idea why this is different between games but it works
|
||||
local hunger_restore = minetest.item_eat(8, exchangeclone.mcl and ItemStack("") or original)
|
||||
local hunger_restore = minetest.item_eat(8, original)
|
||||
hunger_restore(itemstack, player, pointed_thing)
|
||||
end
|
||||
return nil
|
||||
|
|
|
@ -2,8 +2,7 @@ if not exchangeclone then
|
|||
error("Disable and re-enable the ExchangeClone modpack.")
|
||||
end
|
||||
|
||||
local start_time = minetest.get_us_time()
|
||||
minetest.log("action", "[ExchangeClone] Registering own stuff")
|
||||
minetest.log("action", "ExchangeClone: Registering own stuff")
|
||||
|
||||
-- Decides what mod to use for sounds
|
||||
exchangeclone.sound_mod = exchangeclone.mcl and mcl_sounds or default
|
||||
|
@ -136,11 +135,12 @@ dofile(modpath.."/alchemical_chests.lua")
|
|||
dofile(modpath.."/transmutation_table.lua")
|
||||
dofile(modpath.."/furnaces.lua")
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
local energy_start_time = minetest.get_us_time()
|
||||
minetest.log("action", "[ExchangeClone] Registering energy values")
|
||||
dofile(modpath.."/register_energy.lua")
|
||||
minetest.log("action", "[ExchangeClone] Done registering energy values ("..((minetest.get_us_time() - energy_start_time)/1000000).." seconds)")
|
||||
end)
|
||||
minetest.log("action", "ExchangeClone: Done.")
|
||||
|
||||
minetest.log("action", "[ExchangeClone] Done ("..((minetest.get_us_time() - start_time)/1000).." milliseconds)")
|
||||
minetest.register_on_mods_loaded(function()
|
||||
local start_time = minetest.get_us_time()
|
||||
minetest.log("action", "ExchangeClone: Registering energy values")
|
||||
dofile(modpath.."/register_energy.lua")
|
||||
local total_time = minetest.get_us_time() - start_time
|
||||
minetest.log("action", "ExchangeClone: Done registering energy values ("..(total_time/1000000).." seconds)")
|
||||
end)
|
|
@ -6,7 +6,7 @@ local dirt_group = exchangeclone.mcl and "shovely" or "crumbly"
|
|||
|
||||
local function dig_if_group(pos, player, groups)
|
||||
local node = minetest.get_node(pos)
|
||||
for _, group in pairs(groups) do
|
||||
for _, group in ipairs(groups) do
|
||||
if minetest.get_item_group(node.name, group) > 0 then
|
||||
minetest.node_dig(pos, minetest.get_node(pos), player)
|
||||
end
|
||||
|
|
|
@ -9,33 +9,6 @@ local function show_enchanting(player)
|
|||
mcl_enchanting.show_enchanting_formspec(player)
|
||||
end
|
||||
|
||||
local width = (exchangeclone.mcl and 9) or 8
|
||||
|
||||
local repairing_formspec =
|
||||
"size["..tostring(width)..", 7]"..
|
||||
"label[0.5,0.5;Repairing]"..
|
||||
"label["..tostring(width/3-0.5)..",0.5;Covalence Dust]"..
|
||||
"list[current_player;exchangeclone_covalence_dust;"..tostring(width/3-0.5)..",1;1,1]"..
|
||||
"label["..tostring(width/2-0.5)..",0.5;Gear]"..
|
||||
"list[current_player;exchangeclone_covalence_gear;"..tostring(width/2-0.5)..",1;1,1]"..
|
||||
"label["..tostring(2*width/3-0.5)..",0.5;Output]"..
|
||||
"list[current_player;exchangeclone_covalence_output;"..tostring(2*width/3-0.5)..",1;1,1]"..
|
||||
exchangeclone.inventory_formspec(0,2.75)..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;src]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;fuel]"..
|
||||
"listring[current_player;main]"..
|
||||
"listring[context;dst]"..
|
||||
"listring[current_player;main]"
|
||||
|
||||
if exchangeclone.mcl then
|
||||
repairing_formspec = repairing_formspec..
|
||||
mcl_formspec.get_itemslot_bg(width/3-0.5,1,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(width/2-0.5,1,1,1)..
|
||||
mcl_formspec.get_itemslot_bg(2*width/3-0.5,1,1,1)
|
||||
end
|
||||
|
||||
exchangeclone.node_transmutations = {
|
||||
{ --use
|
||||
["mcl_core:stone"] = "mcl_core:cobble",
|
||||
|
@ -45,8 +18,10 @@ exchangeclone.node_transmutations = {
|
|||
["mcl_core:sand"] = "mcl_core:dirt_with_grass",
|
||||
["mcl_core:podzol"] = "mcl_core:redsand",
|
||||
["mcl_core:redsand"] = "mcl_core:podzol",
|
||||
["mcl_flowers:tallgrass"] = "mcl_flowers:fern",
|
||||
["mcl_flowers:fern"] = "mcl_flowers:tallgrass",
|
||||
["mcl_flowers:tallgrass"] = "mcl_core:deadbush",
|
||||
["mcl_nether:netherrack"] = "mcl_core:cobble",
|
||||
["mcl_core:gravel"] = "mcl_core:sandstone",
|
||||
["mcl_core:sandstone"] = "mcl_core:gravel",
|
||||
["mcl_core:redsandstone"] = "mcl_core:gravel",
|
||||
["mcl_farming:pumpkin"] = "mcl_farming:melon",
|
||||
["mcl_farming:melon"] = "mcl_farming:pumpkin",
|
||||
|
@ -86,7 +61,7 @@ exchangeclone.node_transmutations = {
|
|||
["mcl_core:glass"] = "mcl_core:sand",
|
||||
["mcl_blackstone:blackstone"] = "mcl_blackstone:basalt",
|
||||
["mcl_blackstone:basalt"] = "mcl_blackstone:blackstone",
|
||||
["mcl_flowers:double_grass"] = "mcl_flowers:fern",
|
||||
["mcl_flowers:double_grass"] = "mcl_core:deadbush",
|
||||
--["mcl_flowers:double_grass_top"] = "air",
|
||||
["mcl_core:andesite"] = "mcl_core:diorite",
|
||||
["mcl_core:diorite"] = "mcl_core:granite",
|
||||
|
@ -263,17 +238,13 @@ if exchangeclone.mcl then
|
|||
if player:get_player_control().sneak then
|
||||
show_enchanting(player)
|
||||
else
|
||||
if player:get_player_control().aux1 then
|
||||
minetest.show_formspec(player:get_player_name(), "exchangeclone_repairing", repairing_formspec)
|
||||
else
|
||||
--[[if player:get_player_control().aux1 then
|
||||
minetest.show_formspec(player:get_player_name(), "exchangeclone_smelting", smelting_formspec)
|
||||
else --]]
|
||||
mcl_crafting_table.show_crafting_form(player)
|
||||
end
|
||||
--end
|
||||
end
|
||||
end
|
||||
else
|
||||
on_left_click = function(itemstack, player, pointed_thing)
|
||||
minetest.show_formspec(player:get_player_name(), "exchangeclone_repairing", repairing_formspec)
|
||||
end
|
||||
end
|
||||
|
||||
local function on_right_click(itemstack, player, pointed_thing)
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
local S = minetest.get_translator()
|
||||
|
||||
function exchangeclone.mine_vein(player, start_pos, node_name, pos, depth)
|
||||
-- Not the most efficient, but it works.
|
||||
-- Not very efficient, but it works.
|
||||
if not player then return end
|
||||
if not start_pos then return end
|
||||
pos = pos or start_pos
|
||||
if not pos then pos = start_pos end
|
||||
depth = depth or 0
|
||||
--minetest.log(dump(pos))
|
||||
local node = minetest.get_node(pos)
|
||||
if not node_name then node_name = node.name end
|
||||
local distance = vector.distance(pos, start_pos)
|
||||
if node_name == node.name then
|
||||
exchangeclone.drop_items_on_player(pos, minetest.get_node_drops(node.name, "exchangeclone:red_matter_pickaxe"), player)
|
||||
exchangeclone.check_nearby_falling(pos)
|
||||
minetest.set_node(pos, {name = "air"})
|
||||
for x = pos.x-1,pos.x+1 do for y = pos.y-1,pos.y+1 do for z = pos.z-1,pos.z+1 do
|
||||
if depth <= 10 then
|
||||
|
@ -74,6 +75,23 @@ local function pickaxe_on_use(itemstack, player, pointed_thing)
|
|||
end
|
||||
end
|
||||
|
||||
for name, def in pairs(minetest.registered_nodes) do
|
||||
if name:find("_ore")
|
||||
or name:find("stone_with")
|
||||
or name:find("deepslate_with")
|
||||
or name:find("diorite_with")
|
||||
or name:find("andesite_with")
|
||||
or name:find("granite_with")
|
||||
or name:find("tuff_with")
|
||||
or name:find("mineral_")
|
||||
or (name == "mcl_blackstone:nether_gold")
|
||||
or (name == "mcl_nether:ancient_debris") then
|
||||
local groups = table.copy(def.groups)
|
||||
groups.exchangeclone_ore = 1
|
||||
minetest.override_item(name, {groups = groups})
|
||||
end
|
||||
end
|
||||
|
||||
local pick_def = {
|
||||
description = S("Dark Matter Pickaxe").."\n"..S("Single node mode"),
|
||||
wield_image = "exchangeclone_dark_matter_pickaxe.png",
|
||||
|
@ -159,23 +177,4 @@ minetest.register_craft({
|
|||
{"", "group:dark_matter_pickaxe", ""},
|
||||
{"", "exchangeclone:dark_matter", ""}
|
||||
}
|
||||
})
|
||||
|
||||
minetest.register_on_mods_loaded(function()
|
||||
for name, def in pairs(minetest.registered_nodes) do
|
||||
if name:find("_ore")
|
||||
or name:find("stone_with")
|
||||
or name:find("deepslate_with")
|
||||
or name:find("diorite_with")
|
||||
or name:find("andesite_with")
|
||||
or name:find("granite_with")
|
||||
or name:find("tuff_with")
|
||||
or name:find("mineral_")
|
||||
or (name == "mcl_blackstone:nether_gold")
|
||||
or (name == "mcl_nether:ancient_debris") then
|
||||
local groups = table.copy(def.groups)
|
||||
groups.exchangeclone_ore = 1
|
||||
minetest.override_item(name, {groups = groups})
|
||||
end
|
||||
end
|
||||
end)
|
||||
})
|
|
@ -6,21 +6,21 @@ local function get_cheapest_recipe(itemstring, log)
|
|||
local recipes = exchangeclone.recipes[itemstring]
|
||||
if not recipes then return end
|
||||
local cheapest
|
||||
for _, recipe in pairs(recipes) do
|
||||
for _, recipe in ipairs(recipes) do
|
||||
local ingredient_cost = 0
|
||||
local output_count = ItemStack(recipe.output):get_count()
|
||||
local skip = false
|
||||
local identical_replacements = {}
|
||||
if recipe.replacements then
|
||||
for _, replacement in pairs(recipe.replacements) do
|
||||
for _, replacement in ipairs(recipe.replacements) do
|
||||
if replacement[1] == replacement[2] then
|
||||
identical_replacements[replacement[1]] = (identical_replacements[replacement[1]] or 0) + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
if not recipe.type or exchangeclone.craft_types[recipe.type].type == "shaped" then
|
||||
for _, row in pairs(recipe.recipe) do
|
||||
for _, item in pairs(row) do
|
||||
for _, row in ipairs(recipe.recipe) do
|
||||
for _, item in ipairs(row) do
|
||||
if item ~= "" then
|
||||
if item == itemstring then
|
||||
output_count = math.max(0, output_count - 1)
|
||||
|
@ -41,7 +41,7 @@ local function get_cheapest_recipe(itemstring, log)
|
|||
end
|
||||
end
|
||||
elseif exchangeclone.craft_types[recipe.type].type == "shapeless" then
|
||||
for _, item in pairs(recipe.recipe) do
|
||||
for _, item in ipairs(recipe.recipe) do
|
||||
if item ~= "" then
|
||||
if item == itemstring then
|
||||
output_count = math.max(0, output_count - 1)
|
||||
|
@ -83,7 +83,7 @@ local function get_cheapest_recipe(itemstring, log)
|
|||
ingredient_cost = recipe.recipe
|
||||
end
|
||||
if recipe.replacements and not skip then
|
||||
for _, item in pairs(recipe.replacements) do
|
||||
for _, item in ipairs(recipe.replacements) do
|
||||
if item[1] ~= item[2] then
|
||||
local cost = exchangeclone.get_item_energy(item[2])
|
||||
if (not cost) or cost == 0 then
|
||||
|
@ -157,7 +157,7 @@ for index, group in ipairs(exchangeclone.group_values) do
|
|||
end
|
||||
|
||||
-- Handle stonecutter recipes and decaychains in Mineclonia
|
||||
if exchangeclone.mcla then
|
||||
if exchangeclone.mineclonia then
|
||||
exchangeclone.register_craft_type("stonecutting", "cooking")
|
||||
-- TODO: Check recipe_yield for every Mineclonia update
|
||||
local recipe_yield = { --maps itemgroup to the respective recipe yield, default is 1
|
||||
|
@ -206,7 +206,7 @@ if exchangeclone.mcl then
|
|||
exchangeclone.register_alias("doc_identifier:identifier_solid", "doc_identifier:identifier_liquid")
|
||||
exchangeclone.register_alias("mcl_books:writable_book", "mcl_books:written_book")
|
||||
|
||||
for _, coral_type in pairs({"brain", "bubble", "fire", "horn", "tube"}) do
|
||||
for _, coral_type in ipairs({"brain", "bubble", "fire", "horn", "tube"}) do
|
||||
for thing, value in pairs({[coral_type.."_coral"] = 16, [coral_type.."_coral_block"] = 64, [coral_type.."_coral_fan"] = 16}) do
|
||||
set_item_energy("mcl_ocean:"..thing, value)
|
||||
set_item_energy("mcl_ocean:dead_"..thing, value/16)
|
||||
|
@ -217,7 +217,7 @@ if exchangeclone.mcl then
|
|||
exchangeclone.register_craft_type("brewing", "shapeless")
|
||||
local function add_potion_recipe(info)
|
||||
if not info.bases then info.bases = {"mcl_potions:awkward"} end
|
||||
for _, base in pairs(info.bases) do
|
||||
for _, base in ipairs(info.bases) do
|
||||
local ingredient = info.ingredient
|
||||
local normal = "mcl_potions:"..info.name
|
||||
local splash = normal.."_splash"
|
||||
|
@ -237,7 +237,7 @@ if exchangeclone.mcl then
|
|||
end
|
||||
end
|
||||
end
|
||||
for _, info in pairs(exchangeclone.mcl_potion_data) do
|
||||
for _, info in ipairs(exchangeclone.mcl_potion_data) do
|
||||
add_potion_recipe(info)
|
||||
end
|
||||
|
||||
|
@ -256,7 +256,7 @@ if exchangeclone.mcl then
|
|||
|
||||
exchangeclone.register_craft_type("hardening", "cooking")
|
||||
-- Concrete and banners/shields (don't remember why the shields don't work)
|
||||
for color, color_data in pairs(exchangeclone.colors) do
|
||||
for _, color in ipairs({"red", "orange", "yellow", "lime", "dark_green", "cyan", "light_blue", "blue", "purple", "magenta", "pink", "black", "white", "silver", "grey", "brown"}) do
|
||||
exchangeclone.register_craft({output = "mcl_colorblocks:concrete_"..color, type = "hardening", recipe = "mcl_colorblocks:concrete_powder_"..color})
|
||||
exchangeclone.register_craft({output = "mcl_shields:shield_"..color, type = "shapeless", recipe = {"mcl_banners:banner_item_"..color, "mcl_shields:shield"}})
|
||||
end
|
||||
|
@ -280,7 +280,7 @@ if exchangeclone.mcl then
|
|||
end
|
||||
|
||||
-- Register copper block/stonecutting energy recipes in MineClone2
|
||||
if exchangeclone.mcl2 then
|
||||
if exchangeclone.mcl and not exchangeclone.mineclonia then
|
||||
exchangeclone.register_craft_type("oxidation", "cooking")
|
||||
local cheapest = get_cheapest_recipe("mcl_copper:block")
|
||||
if cheapest then
|
||||
|
@ -347,7 +347,7 @@ local same = false
|
|||
local i = 1
|
||||
-- Automatically register energy values
|
||||
while not same do
|
||||
minetest.log("action", "[ExchangeClone] \tIteration #"..i)
|
||||
minetest.log("action", "ExchangeClone: \tIteration #"..i)
|
||||
if auto == {} then break end
|
||||
if old_auto then
|
||||
same = true
|
||||
|
@ -359,7 +359,7 @@ while not same do
|
|||
end
|
||||
end
|
||||
if same then
|
||||
minetest.log("action", "[ExchangeClone]\tNo change, stopping.")
|
||||
minetest.log("action", "ExchangeClone:\tNo change, stopping.")
|
||||
break
|
||||
end
|
||||
old_auto = table.copy(auto)
|
||||
|
@ -373,6 +373,8 @@ while not same do
|
|||
i = i + 1
|
||||
end
|
||||
|
||||
--minetest.log(dump(auto))
|
||||
|
||||
if exchangeclone.mcl then
|
||||
set_item_energy("mcl_campfires:campfire", exchangeclone.get_item_energy("mcl_campfires:campfire_lit"))
|
||||
set_item_energy("mcl_campfires:soul_campfire", exchangeclone.get_item_energy("mcl_campfires:soul_campfire_lit"))
|
||||
|
|
|
@ -238,7 +238,7 @@ minetest.registered_entities["mobs_mc:mooshroom"].on_rightclick = function(self,
|
|||
end
|
||||
|
||||
local old_honey_harvest = minetest.registered_items["mcl_beehives:bee_nest_5"].on_rightclick
|
||||
for _, itemstring in pairs({"mcl_beehives:bee_nest_5", "mcl_beehives:beehive_5"}) do
|
||||
for _, itemstring in ipairs({"mcl_beehives:bee_nest_5", "mcl_beehives:beehive_5"}) do
|
||||
minetest.registered_items[itemstring].on_rightclick = function(pos, node, player, itemstack, pointed_thing)
|
||||
local held_name = player:get_wielded_item():get_name()
|
||||
local shears = special_shears[held_name]
|
||||
|
@ -384,7 +384,7 @@ local new_dispenser_function = function(pos, node)
|
|||
old_dispenser_function(pos, node)
|
||||
end
|
||||
|
||||
for _, itemstring in pairs({"mcl_dispensers:dispenser", "mcl_dispensers:dispenser_up", "mcl_dispensers:dispenser_down"}) do
|
||||
for _, itemstring in ipairs({"mcl_dispensers:dispenser", "mcl_dispensers:dispenser_up", "mcl_dispensers:dispenser_down"}) do
|
||||
minetest.registered_items[itemstring].mesecons.effector.action_on = new_dispenser_function
|
||||
end
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ local upgrader_formspec =
|
|||
"label[0.5,0.5;Upgrader]"..
|
||||
"label["..tostring(width/3-0.5)..",0.5;Upgrade]"..
|
||||
"list[context;fuel;"..tostring(width/3-0.5)..",1;1,1]"..
|
||||
"label["..tostring(width/2-0.5)..",0.5;Gear]"..
|
||||
"label["..tostring(width/2-0.5)..",0.5;Tool/Armor]"..
|
||||
"list[context;src;"..tostring(width/2-0.5)..",1;1,1]"..
|
||||
"label["..tostring(2*width/3-0.5)..",0.5;Output]"..
|
||||
"list[context;dst;"..tostring(2*width/3-0.5)..",1;1,1]"..
|
||||
|
@ -134,7 +134,7 @@ local after_dig_node = function(pos, oldnode, oldmetadata, player)
|
|||
local meta2 = meta:to_table()
|
||||
meta:from_table(oldmetadata)
|
||||
local inv = meta:get_inventory()
|
||||
for _, listname in pairs({"fuel", "dst", "src"}) do
|
||||
for _, listname in ipairs({"fuel", "dst", "src"}) do
|
||||
local stack = inv:get_stack(listname, 1)
|
||||
if not stack:is_empty() then
|
||||
local p = {x=pos.x+math.random(0, 10)/10-0.5, y=pos.y, z=pos.z+math.random(0, 10)/10-0.5}
|
||||
|
@ -185,7 +185,7 @@ minetest.register_node("exchangeclone:upgrader", {
|
|||
meta:set_string("infotext", "Upgrader")
|
||||
meta:set_string("formspec", upgrader_formspec)
|
||||
end,
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, container = exchangeclone.mcl2 and 2 or 4, level = get_level(4), tubedevice = 1, tubedevice_receiver = 1},
|
||||
groups = {pickaxey=5, material_stone=1, cracky = 3, container = 4, level = get_level(4), tubedevice = 1, tubedevice_receiver = 1},
|
||||
allow_metadata_inventory_move = allow_metadata_inventory_move,
|
||||
allow_metadata_inventory_take = allow_metadata_inventory_take,
|
||||
allow_metadata_inventory_put = allow_metadata_inventory_put,
|
||||
|
|
|
@ -137,7 +137,7 @@ local function handle_inventory(player, inventory, to_list)
|
|||
if not individual_energy_value or individual_energy_value <= 0 then return end
|
||||
local wear = stack:get_wear()
|
||||
if wear and wear > 1 then
|
||||
individual_energy_value = math.max(math.floor(individual_energy_value * (65536 / wear)), 1)
|
||||
individual_energy_value = math.floor(individual_energy_value * (65536 / wear))
|
||||
end
|
||||
if itemstring == "exchangeclone:exchange_orb" then
|
||||
individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack)
|
||||
|
|
|
@ -62,7 +62,8 @@ if exchangeclone.mcl then
|
|||
["mcl_core:cobble"] = 1,
|
||||
["mcl_core:cobweb"] = 12,
|
||||
["mcl_core:crying_obsidian"] = 768,
|
||||
["mcl_core:deadbush"] = 8,
|
||||
["mcl_core:dead_bush"] = 1, -- don't know which one of these is right; maybe both?
|
||||
["mcl_core:deadbush"] = 1, --MCLA
|
||||
["mcl_core:diamond"] = 8192,
|
||||
["mcl_core:diorite"] = 16,
|
||||
["mcl_core:dirt"] = 1,
|
||||
|
|
|
@ -6,8 +6,7 @@ else
|
|||
exchangeclone.mcl = minetest.get_modpath("mcl_core")
|
||||
end
|
||||
|
||||
exchangeclone.mcla = minetest.get_game_info().id == "mineclonia" -- if exchangeclone.mcla, exchangeclone.mcl is also defined.
|
||||
exchangeclone.mcl2 = minetest.get_game_info().id == "mineclone2"
|
||||
exchangeclone.mineclonia = minetest.get_game_info().id == "mineclonia" -- if exchangeclone.mineclonia, exchangeclone.mcl is also defined.
|
||||
exchangeclone.pipeworks = minetest.get_modpath("pipeworks")
|
||||
exchangeclone.orb_max = minetest.settings:get("exchangeclone.orb_max") or 51200000 -- Max capacity of Klein Star Omega in ProjectE
|
||||
exchangeclone.keep_data = minetest.settings:get_bool("exchangeclone.keep_data", false)
|
||||
|
@ -23,12 +22,12 @@ function minetest.register_craft(data, ...)
|
|||
-- Skip thousands of banner recipes in MCL2
|
||||
-- This does mean that if other banner recipes exist that don't use wool (or carpet),
|
||||
-- they will be ignored in MCL2... but I can't think of a better way to do this.
|
||||
if exchangeclone.mcl then
|
||||
if exchangeclone.mcl and not exchangeclone.mineclonia then
|
||||
if itemstring:sub(1, #"mcl_banners:") == "mcl_banners:" then
|
||||
allowed = false
|
||||
if data.type and data.type == "shaped" then
|
||||
for _, row in pairs(data.recipe) do
|
||||
for _, item in pairs(row) do
|
||||
for _, row in ipairs(data.recipe) do
|
||||
for _, item in ipairs(row) do
|
||||
if item:sub(1, #"mcl_wool:") == "mcl_wool:" then
|
||||
allowed = true
|
||||
break
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
local S = minetest.get_translator()
|
||||
|
||||
--- Rounds to the nearest integer
|
||||
-- Rounds to the nearest integer
|
||||
function exchangeclone.round(num)
|
||||
if num % 1 < 0.5 then
|
||||
return math.floor(num)
|
||||
|
@ -11,12 +11,12 @@ function exchangeclone.round(num)
|
|||
end
|
||||
end
|
||||
|
||||
--- Adds all items in a certain list to a table.
|
||||
function exchangeclone.get_inventory_drops(pos, listname, drops)
|
||||
-- Don't think this even works correctly.
|
||||
function exchangeclone.get_inventory_drops(pos, inventory, drops)
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local n = #drops
|
||||
for i = 1, inv:get_size(listname) do
|
||||
local stack = inv:get_stack(listname, i)
|
||||
for i = 1, inv:get_size(inventory) do
|
||||
local stack = inv:get_stack(inventory, i)
|
||||
if stack:get_count() > 0 then
|
||||
drops[n+1] = stack:to_table()
|
||||
n = n + 1
|
||||
|
@ -24,19 +24,19 @@ function exchangeclone.get_inventory_drops(pos, listname, drops)
|
|||
end
|
||||
end
|
||||
|
||||
--- Gets the energy value of an itemstring or ItemStack
|
||||
--- Handles "group:group_name" syntax (although it goes through every item), returns cheapest item in group
|
||||
function exchangeclone.get_item_energy(item, ignore_wear)
|
||||
-- Gets the energy value of an itemstring or ItemStack
|
||||
-- Handles "group:foo" syntax (although it goes through every item)
|
||||
function exchangeclone.get_item_energy(item)
|
||||
if (item == "") or not item then return end
|
||||
-- handle groups
|
||||
if type(item) == "string" and item:sub(1,6) == "group:" and exchangeclone.group_values then
|
||||
local item_group = item:sub(7,-1)
|
||||
for _, group in pairs(exchangeclone.group_values) do
|
||||
for _, group in ipairs(exchangeclone.group_values) do
|
||||
if item_group == group[1] then return group[2] end
|
||||
end
|
||||
local group_items = exchangeclone.get_group_items(item_group)
|
||||
local cheapest
|
||||
for _, group_item in pairs(group_items[item_group]) do
|
||||
for _, group_item in ipairs(group_items[item_group]) do
|
||||
if group_item then
|
||||
local energy_value = exchangeclone.get_item_energy(group_item)
|
||||
if energy_value then
|
||||
|
@ -245,7 +245,7 @@ function exchangeclone.get_group_items(groups, allow_duplicates, include_no_grou
|
|||
local grp = groups[i]
|
||||
local subgroups = exchangeclone.split(grp, ",")
|
||||
local success = true
|
||||
for _, subgroup in pairs(subgroups) do
|
||||
for _, subgroup in ipairs(subgroups) do
|
||||
if not def.groups[subgroup] then
|
||||
success = false
|
||||
break
|
||||
|
@ -415,7 +415,7 @@ function exchangeclone.drop_items_on_player(pos, drops, player) -- modified from
|
|||
if player and player:is_player() and minetest.is_creative_enabled(player:get_player_name()) then
|
||||
local inv = player:get_inventory()
|
||||
if inv then
|
||||
for _, item in pairs(drops) do
|
||||
for _, item in ipairs(drops) do
|
||||
if not inv:contains_item("main", item, true) then
|
||||
inv:add_item("main", item)
|
||||
end
|
||||
|
@ -495,7 +495,7 @@ local enchantments = tool and mcl_enchanting.get_enchantments(tool)
|
|||
end
|
||||
end
|
||||
|
||||
for _, item in pairs(drops) do
|
||||
for _, item in ipairs(drops) do
|
||||
local count
|
||||
if type(item) == "string" then
|
||||
count = ItemStack(item):get_count()
|
||||
|
@ -669,7 +669,7 @@ exchangeclone.neighbors = {
|
|||
}
|
||||
|
||||
function exchangeclone.check_nearby_falling(pos)
|
||||
for i = 1, 6 do
|
||||
for i=1, #exchangeclone.neighbors do
|
||||
local new_pos = vector.add(pos, exchangeclone.neighbors[i])
|
||||
if exchangeclone.mcl then
|
||||
local node = minetest.get_node(new_pos)
|
||||
|
@ -677,15 +677,15 @@ function exchangeclone.check_nearby_falling(pos)
|
|||
mcl_core.check_vines_supported(new_pos, node)
|
||||
end
|
||||
end
|
||||
minetest.check_single_for_falling(new_pos)
|
||||
end
|
||||
minetest.check_for_falling(pos)
|
||||
end
|
||||
|
||||
function exchangeclone.remove_nodes(positions)
|
||||
minetest.bulk_set_node(positions, {name = "air"})
|
||||
for _, pos in pairs(positions) do
|
||||
for _, pos in ipairs(positions) do
|
||||
exchangeclone.check_nearby_falling(pos)
|
||||
end
|
||||
minetest.bulk_set_node(positions, {name = "air"})
|
||||
end
|
||||
|
||||
--[[
|
||||
|
@ -731,55 +731,4 @@ function exchangeclone.register_craft(data)
|
|||
table.insert(exchangeclone.recipes[itemstring], table.copy(flipped_data))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Returns true if item (itemstring or ItemStack) can be used as a furnace fuel.
|
||||
-- Returns false otherwise
|
||||
function exchangeclone.is_fuel(item)
|
||||
return minetest.get_craft_result({method = "fuel", width = 1, items = {item}}).time ~= 0
|
||||
end
|
||||
|
||||
-- Returns true if item (itemstring or ItemStack) can't be used as a furnace fuel.
|
||||
-- Returns false otherwise
|
||||
function exchangeclone.isnt_fuel(item)
|
||||
return not (minetest.get_craft_result({method = "fuel", width = 1, items = {item}}).time ~= 0)
|
||||
end
|
||||
|
||||
--- Selects item stack to transfer from
|
||||
--- @param src_inventory InvRef Source innentory to pull from
|
||||
--- @param src_list string Name of source inventory list to pull from
|
||||
--- @param dst_inventory InvRef Destination inventory to push to
|
||||
--- @param dst_list string Name of destination inventory list to push to
|
||||
--- @param condition? fun(stack: ItemStack) Condition which items are allowed to be transfered.
|
||||
--- @return integer Item stack number to be transfered
|
||||
function exchangeclone.select_stack(src_inventory, src_list, dst_inventory, dst_list, condition)
|
||||
local src_size = src_inventory:get_size(src_list)
|
||||
local stack
|
||||
for i = 1, src_size do
|
||||
stack = src_inventory:get_stack(src_list, i)
|
||||
if not stack:is_empty() and dst_inventory:room_for_item(dst_list, stack) and ((condition == nil or condition(stack))) then
|
||||
return i
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
function exchangeclone.hoppers_on_try_pull(pos, hop_pos, hop_inv, hop_list)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if exchangeclone.select_stack(inv, "dst", hop_inv, hop_list) then
|
||||
return inv, "dst", exchangeclone.select_stack(inv, "dst", hop_inv, hop_list)
|
||||
else
|
||||
return inv, "fuel", exchangeclone.select_stack(inv, "fuel", hop_inv, hop_list, exchangeclone.isnt_fuel)
|
||||
end
|
||||
end
|
||||
|
||||
function exchangeclone.hoppers_on_try_push(pos, hop_pos, hop_inv, hop_list)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory()
|
||||
if math.abs(pos.y - hop_pos.y) > math.abs(pos.x - hop_pos.x) and math.abs(pos.y - hop_pos.y) > math.abs(pos.z - hop_pos.z) then
|
||||
return inv, "src", exchangeclone.select_stack(hop_inv, hop_list, inv, "src")
|
||||
else
|
||||
return inv, "fuel", exchangeclone.select_stack(hop_inv, hop_list, inv, "fuel", exchangeclone.is_fuel)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue