Skip to content

ItemStack:get_tool_capabilities / core.get_dig_params#76

Open
S-S-X wants to merge 2 commits intomasterfrom
dig-params
Open

ItemStack:get_tool_capabilities / core.get_dig_params#76
S-S-X wants to merge 2 commits intomasterfrom
dig-params

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