1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-01-30 04:30:58 +02:00

implemented mines

This commit is contained in:
Valansch 2017-10-15 01:53:39 +02:00
parent 348096bb87
commit 0d840b6e14
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,26 @@
local Thread = require "locale.utils.Thread"
local mines_factor = 4
--Do not change this:
mines_factor = 16384 / mines_factor
function spawn_row(params)
local x = params.x
local y = params.y
local magic_number = math.floor(mines_factor / params.distance) + 1
for i = 0, 31 do
if math.random(1, magic_number) == 1 then
game.surfaces[1].create_entity{name = "land-mine", position = {x + i,y}, force = "enemy"}
end
end
end
function run_terrain_module(event)
local distance = math.sqrt(event.area.left_top.x*event.area.left_top.x+event.area.left_top.y*event.area.left_top.y)
if distance > 100 then
for i = 0, 31 do
Thread.queue_action("spawn_row", {x = event.area.left_top.x, y = event.area.left_top.y + i, distance = distance})
end
end
end

View File

@ -36,6 +36,7 @@ in this file and your run_*type*_module(event) function will be called.
--require "locale.gen_terrain.neko_bridged_rivers"
--require "locale.gen_terrain.neko_river_overlay"
--require "locale.gen_terrain.worms"
--require "locale.gen_terrain.mines"
--ores--
--require "locale.gen_ores.neko_crazy_ores"