mirror of
https://github.com/Refactorio/RedMew.git
synced 2025-01-30 04:30:58 +02:00
implemented mines
This commit is contained in:
parent
348096bb87
commit
0d840b6e14
26
locale/gen_terrain/mines.lua
Normal file
26
locale/gen_terrain/mines.lua
Normal 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
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user