1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00
ComfyFactorio/modules/rocks_yield_coins.lua
2021-03-24 20:14:55 +01:00

20 lines
558 B
Lua

local Event = require 'utils.event'
local coin_yield = {
['rock-big'] = 3,
['rock-huge'] = 6,
['sand-rock-big'] = 3
}
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
end
Event.add(defines.events.on_player_mined_entity, on_player_mined_entity)