1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-11-23 22:22:34 +02:00
Files
ComfyFactorio/modules/rocks_yield_coins.lua

20 lines
560 B
Lua
Raw Normal View History

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