1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-08 00:39:30 +02:00
ComfyFactorio/maps/crab_defender/crumbly_walls.lua

26 lines
770 B
Lua
Raw Normal View History

2020-07-14 21:50:56 +02:00
local Event = require 'utils.event'
local FDT = require 'maps.crab_defender.table'
local math_random = math.random
local rock_raffle = {'sand-rock-big', 'rock-big', 'rock-big', 'rock-big', 'rock-huge'}
local function on_entity_died(event)
local crumbly_walls_unlocked = FDT.get('crumbly_walls_unlocked')
if not crumbly_walls_unlocked then
return
end
local entity = event.entity
if not entity.valid then
return
end
if entity.name ~= 'stone-wall' then
return
end
if math_random(1, 4) == 1 then
return
end
2021-03-24 17:46:00 +02:00
entity.surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = 'player'})
2020-07-14 21:50:56 +02:00
end
Event.add(defines.events.on_entity_died, on_entity_died)