-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemStack:get_tool_capabilities / core.get_dig_params #76
base: master
Are you sure you want to change the base?
Conversation
globals.lua
Outdated
diggable = true | ||
-- Calculate tool wear | ||
local real_uses = math.min(cap.uses * math.pow(3, leveldiff), 65535) | ||
local wear = 65536 / real_uses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
floor it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local wear = 65536 / real_uses | |
local wear = math.floor(65536 / real_uses) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can 'real_uses' ever be zero? if for example cap.uses was wrongly configured? maybe that's ok here as that really shouldn't occur, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes groupcaps.uses can be zero, should probably check better what should happen but a lot of stuff can be skipped as zero means inifinite uses / no tool wear.
This needs tests and almost sure contains bugs, errors and few more bugs. |
Implements ItemStack:get_tool_capabilities and core.get_dig_params
Closes #1