2021-03-24 21:14:55 +02:00
|
|
|
local Event = require 'utils.event'
|
2019-02-05 09:42:45 +02:00
|
|
|
|
|
|
|
local coin_yield = {
|
2021-03-24 17:46:00 +02:00
|
|
|
['rock-big'] = 3,
|
|
|
|
['rock-huge'] = 6,
|
|
|
|
['sand-rock-big'] = 3
|
2019-02-05 09:42:45 +02:00
|
|
|
}
|
|
|
|
|
2021-03-24 17:46:00 +02:00
|
|
|
local function on_player_mined_entity(event)
|
|
|
|
if coin_yield[event.entity.name] then
|
|
|
|
event.entity.surface.spill_item_stack(
|
|
|
|
event.entity.position,
|
|
|
|
{name = 'coin', count = math.random(math.ceil(coin_yield[event.entity.name] * 0.5), math.ceil(coin_yield[event.entity.name] * 2))},
|
|
|
|
true
|
|
|
|
)
|
|
|
|
end
|
2019-02-05 09:42:45 +02:00
|
|
|
end
|
2021-03-24 17:46:00 +02:00
|
|
|
|
2021-03-24 21:14:55 +02:00
|
|
|
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)
|