Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

S-S-X
Copy link
Owner

@S-S-X S-S-X commented Mar 20, 2022

Implements ItemStack:get_tool_capabilities and core.get_dig_params

Closes #1

@S-S-X S-S-X added the enhancement New feature or request label Mar 20, 2022
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
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

floor it

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local wear = 65536 / real_uses
local wear = math.floor(65536 / real_uses)

Copy link
Contributor

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?

Copy link
Owner Author

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.

@S-S-X
Copy link
Owner Author

S-S-X commented Mar 20, 2022

This needs tests and almost sure contains bugs, errors and few more bugs.

@S-S-X S-S-X added the WIP Work in progress label Apr 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ItemStack not fully functional
2 participants