Compare commits

..

No commits in common. "229e191706924d42b573301521d23ebf116c712e" and "9ee585f552bd5d1926914792ec7acfffb4807e59" have entirely different histories.

4 changed files with 3 additions and 6 deletions

View File

@ -68,9 +68,6 @@ Dependencies: Minetest Game or MineClone.
## Changelog ## Changelog
<details><summary>Look at this fancy expanding changelog</summary> <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) ### v6.0 (The Compatibility Update)
This update took a while... there was just so much that had to be done. 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 if not (individual_energy_value and individual_energy_value > 0) then return end
local wear = stack:get_wear() local wear = stack:get_wear()
if wear and wear > 0 then if wear and wear > 0 then
individual_energy_value = math.max(math.floor(individual_energy_value * ((65536 - wear)/65536)), 1) individual_energy_value = math.max(math.floor(individual_energy_value * (65536 / wear)), 1)
end end
if stack:get_name() == "exchangeclone:exchange_orb" then if stack:get_name() == "exchangeclone:exchange_orb" then
individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack) 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 if not individual_energy_value or individual_energy_value <= 0 then return end
local wear = stack:get_wear() local wear = stack:get_wear()
if wear and wear > 1 then if wear and wear > 1 then
individual_energy_value = math.max(math.floor(individual_energy_value * ((65536 - wear)/65536)), 1) individual_energy_value = math.max(math.floor(individual_energy_value * (65536 / wear)), 1)
end end
if itemstring == "exchangeclone:exchange_orb" then if itemstring == "exchangeclone:exchange_orb" then
individual_energy_value = individual_energy_value + exchangeclone.get_orb_itemstack_energy(stack) 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 --- 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 --- Handles "group:group_name" syntax (although it goes through every item), returns cheapest item in group
function exchangeclone.get_item_energy(item) function exchangeclone.get_item_energy(item, ignore_wear)
if (item == "") or not item then return end if (item == "") or not item then return end
-- handle groups -- handle groups
if type(item) == "string" and item:sub(1,6) == "group:" and exchangeclone.group_values then if type(item) == "string" and item:sub(1,6) == "group:" and exchangeclone.group_values then