-
Notifications
You must be signed in to change notification settings - Fork 33
fix(battery): Fix battery holder accepting technic charges #115
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
base: master
Are you sure you want to change the base?
Conversation
51e7359
to
f7426af
Compare
I was just about to make a pr to do just that! Thanks. |
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.
Make sure to also update the digtron.tap_batteries function in https://github.com/minetest-mods/digtron/blob/master/util.lua#L265 so that it also uses technic's new way of storing the item's charge value.
f7426af
to
a38b14d
Compare
Thanks to your comments I realized I did a very partial job :) Now inventory put, tube sending and battery consumption are fixed. I changed battery consumption so only power needed for next step is drained (it seemed better to me but may be it's not Digtron policy). |
a38b14d
to
d99f368
Compare
-- Disregard empty batteries, the player should know better | ||
if md and md.charge > 0 then | ||
meta = minetest.get_meta(pos) | ||
if minetest.global_exists("technic") and technic.get_charge(stack) > 0 then |
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.
Please keep the previous comment about -- Disregard empty batteries, the player should know better
to justify the charge > 0 check.
return 0 | ||
end | ||
else | ||
return 0 | ||
return stack:get_count() |
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.
Do you really intend to allow any player to use this slot for arbitrary storage if technic is not installed?
EDIT: The GitHub web diff view is misleading. Please ignore this comment.
A quick & dirty fix for making battery holder working with current version of Luanti & Tehnic.
Using both master versions, battery holder always reject charged objects (md is nil).
I just updated code to use new get_meta api and "technic:charge" metadata name.