This commit is contained in:
ThePython 2024-01-04 07:48:04 -08:00
parent d6c2fdc768
commit 53d6973e10
4 changed files with 6 additions and 3 deletions

View File

@ -66,6 +66,9 @@ Dependencies: Minetest Game or MineClone.
## Changelog
<details><summary>Look at this fancy expanding changelog</summary>
### 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.

View File

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

View File

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

View File

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