Skip to content

Commit

Permalink
clamp read charge JIC
Browse files Browse the repository at this point in the history
  • Loading branch information
SwissalpS committed Aug 4, 2024
1 parent b79bf14 commit 70025d2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion replacer/replacer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ function replacer.get_charge(stack)
return r.max_charge, r.max_charge
end

return stack:get_meta():get_float('charge'), r.max_charge
local charge = stack:get_meta():get_float('charge')
return max(0, min(charge, r.max_charge)), r.max_charge
end -- get_charge


Expand Down

0 comments on commit 70025d2

Please sign in to comment.