Open S-S-X opened 3 years ago
The drill code is pretty easy to retrofit i think: https://github.com/mt-mods/technic/blob/7cdb21ae56a3ea74784e4fa3c6fa45a8b73c8772/technic/tools/mining_drill.lua#L49-L63
Not sure about the laser, most "digging" logic seems to be in here: https://github.com/mt-mods/technic/blob/7cdb21ae56a3ea74784e4fa3c6fa45a8b73c8772/technic/tools/mining_lasers.lua#L36-L50
Is there even a helper function in the api to determine/evaluate all those groups?
Is there even a helper function in the api to determine/evaluate all those groups?
There is thing that could be used:
minetest.get_dig_params(groups, tool_capabilities)
: Simulates a tool
that digs a node.
Returns a table with the following fields:
diggable
: true
if node can be dug, false
otherwise.time
: Time it would take to dig the node.wear
: How much wear would be added to the tool.
time
and wear
are meaningless if node's not diggable
Parameters:groups
: Table of the node groups of the node that would be dugtool_capabilities
: Tool capabilities table of the toolThen do some more or less clever math with time and wear to get factor for base energy usage.
https://minetest.gitlab.io/minetest/groups/
Just like other tools speed is affected by node groups make drill and laser use energy based on groups. Harder nodes should use more energy while softer ones use less.