Schall Tank Woodcutting


Harvest wood on the way of vehicles driving over trees. Can also harvest stone and coal when driving over rocks. (Locale: English, Deutsch, 正體中文, 简体中文, Português Brasileiro)

Utilities
8 months ago
0.16 - 2.0
3.00K
Transportation Mining

g SA port?

2 months ago

Could this be ported to SA/2.0 and made to work with modded rocks and trees? This could simply trigger a mining event of the respective entity instead of giving the player a fixed amount of stone (which isn't even the amount you'd normally get, nor is it random).

2 months ago
(updated a month ago)

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.

New response