Resumable digging
When a node is partially dug but then digging stops, retain the invested
digging effort for a while rather than discard it. Digging of that node
can be resumed from the partially-dug state.
The ultimate vision towards which this works is that the effort required
to dig a node could be shared not just between multiple left clicks but
also between multiple tools and even multiple players, each involved
tool suffering wear pro rata. This would necessarily be mediated by
the server, and would even, through partial tool wear, be semantically
visible to mods. This patch doesn't do that. This patch does the simple
client-side version, under the prevailing paradigm that all the effort of
digging a node is credited to a single tool. This requires that the total
time invested to dig the node must be at least what the dominant tool
would take, regardless of which other tools were involved in the digging.
When a node is partially dug, what is retained is the time that was
spent digging it, regardless of which tool was used. The partially-dug
node shows the crack progression that it had reached with the tool last
used on it, which is based on the time spent digging divided by the time
that would be taken to fully dig using that tool. When resuming digging,
if a different tool is used, the time spent digging is simply added up,
and the crack progression is recomputed for the new tool's total dig time.
This can result in crack progression jumping forward or backward.
A partially-dug state is retained for only one node at a time: starting
digging on a different node throws away the partially-dug state.
The partial digging effort also decays over time: whatever dig time was
accumulated when digging stops will be lost linearly over the next ten
seconds. Resuming digging stops the decay, and new dig time is added
onto the decayed accumulated time. If the resumed digging is stopped
again at a partially-dug state then a fresh ten-second decay process
starts, using the revised accumulated dig time.