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

16 lines
594 B
Lua

local event = require 'utils.event'
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)
if not global.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
entity.surface.create_entity({name = rock_raffle[math_random(1, #rock_raffle)], position = entity.position, force = "player"})
end
event.add(defines.events.on_entity_died, on_entity_died)