This could simply trigger a mining event of the respective entity instead of giving the player a fixed amount of stone …
This could work, but it's not straight-forward as there is no such vanilla event as script_raised_mined
(we only have on_player_mined*
and on_robot_mined*
). You could work around this by defining a CustomEventPrototype
in data.lua.
In control.lua (function harvest()
), create a script inventory into which enty.mine()
can insert the mined items, then mine the entity, then raise the custom event (passing on inventory
and cause
as event data). This will give other mods a chance to remove items from the inventory. After this, iterate over the inventory and add the item stacks to the player or spill them on the ground. When you're done, the script inventory is empty – destroy it and call script.raise_script_destroy({entity = enty})
.
@schallfalke: The above is just a rough sketch. I'll try to get a working prototype and send it as PM on the forum.