From 53d6973e105e1d71dd5916b69022faaa571d0e44 Mon Sep 17 00:00:00 2001 From: ThePython <87204246+ThePython10110@users.noreply.github.com> Date: Thu, 4 Jan 2024 07:48:04 -0800 Subject: [PATCH] v6.1 --- README.md | 3 +++ exchangeclone/deconstructor.lua | 2 +- exchangeclone/transmutation_table.lua | 2 +- zzzz_exchangeclone_init/lib.lua | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index ce02a3f..d6d5ad8 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,9 @@ Dependencies: Minetest Game or MineClone. ## Changelog
Look at this fancy expanding changelog +### v6.1 +* Damaged tools now give the correct amount of energy (thanks @programmerjake!). + ### v6.0 (The Compatibility Update) This update took a while... there was just so much that had to be done. diff --git a/exchangeclone/deconstructor.lua b/exchangeclone/deconstructor.lua index e0cf388..313f8c1 100644 --- a/exchangeclone/deconstructor.lua +++ b/exchangeclone/deconstructor.lua @@ -40,7 +40,7 @@ local function deconstructor_action(pos, elapsed) 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) + individual_energy_value = math.max(math.floor(individual_energy_value * ((65536 - wear)/65536)), 1) end if stack:get_name() == "exchangeclone:exchange_orb" then individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack) diff --git a/exchangeclone/transmutation_table.lua b/exchangeclone/transmutation_table.lua index 5f888c4..01db5a4 100644 --- a/exchangeclone/transmutation_table.lua +++ b/exchangeclone/transmutation_table.lua @@ -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.max(math.floor(individual_energy_value * ((65536 - wear)/65536)), 1) end if itemstring == "exchangeclone:exchange_orb" then individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack) diff --git a/zzzz_exchangeclone_init/lib.lua b/zzzz_exchangeclone_init/lib.lua index d043fe3..05a20c5 100644 --- a/zzzz_exchangeclone_init/lib.lua +++ b/zzzz_exchangeclone_init/lib.lua @@ -44,7 +44,7 @@ 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) +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