2018-06-01 23:23:59 +02:00
|
|
|
local Event = require 'utils.event'
|
2018-09-23 00:25:13 +02:00
|
|
|
local Game = require 'utils.game'
|
2017-10-15 01:53:39 +02:00
|
|
|
|
2018-06-01 23:23:59 +02:00
|
|
|
local mines_factor = 1
|
2017-10-15 01:53:39 +02:00
|
|
|
|
|
|
|
--Do not change this:
|
|
|
|
mines_factor = 16384 / mines_factor
|
|
|
|
|
2018-05-10 01:21:12 +02:00
|
|
|
local death_messages = {
|
2018-06-01 23:23:59 +02:00
|
|
|
"went exploring, and didn't bring a minesweeping kit.",
|
|
|
|
'wandered off, and found that it really is dangerous to go alone.',
|
|
|
|
'found that minesweeper in factorio gives no hints.',
|
|
|
|
'died, and they were only one day away from retirement',
|
|
|
|
'is too old for this s$%t',
|
|
|
|
"ponders the question, 'How might I avoid mines in the future'",
|
|
|
|
'exploded with rage',
|
|
|
|
'thought it was clear, found it was not.',
|
|
|
|
'thought it was clear, was wrong.',
|
|
|
|
'paved the way for expansion!',
|
|
|
|
'sacrificed their body to the greater factory expansion',
|
|
|
|
'no longer wonders why nobody else has built here',
|
|
|
|
'just wants to watch the respawn timer window',
|
|
|
|
'like life, mines are unfair, next time bring a helmet',
|
|
|
|
'should’ve thrown a grenade before stepping over there',
|
|
|
|
'is farming the death counter',
|
|
|
|
'fertilized the soil',
|
|
|
|
"found no man's land, also found it applies to them.",
|
|
|
|
'curses the map maker',
|
|
|
|
'does not look forward to the death march back to retreive items',
|
|
|
|
'wont be going for a walk again',
|
|
|
|
'really wants a map.',
|
|
|
|
'forgot their xray goggles',
|
|
|
|
'rather Forgot to bring x-ray goggles',
|
|
|
|
'learned that the biters defend their territory',
|
|
|
|
'mines 1, Ninja skills 0.'
|
2018-05-10 01:21:12 +02:00
|
|
|
}
|
2017-10-15 16:07:11 +02:00
|
|
|
|
2018-06-01 23:23:59 +02:00
|
|
|
local function player_died(event)
|
2018-09-22 22:07:05 +02:00
|
|
|
local player = Game.players[event.player_index]
|
2018-06-01 23:23:59 +02:00
|
|
|
if not player or not player.valid then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
local message = player.name .. ' ' .. death_messages[math.random(1, #death_messages)]
|
|
|
|
game.print(message)
|
2017-10-15 16:07:11 +02:00
|
|
|
end
|
2018-04-06 21:58:50 +02:00
|
|
|
Event.add(defines.events.on_player_died, player_died)
|
2018-05-10 01:21:12 +02:00
|
|
|
|
2018-06-01 23:23:59 +02:00
|
|
|
return function(x, y)
|
|
|
|
local distance = math.sqrt(x * x + y * y)
|
2018-05-10 01:21:12 +02:00
|
|
|
|
2018-06-02 14:28:33 +02:00
|
|
|
if distance <= 210 then
|
2018-06-01 23:23:59 +02:00
|
|
|
return nil
|
|
|
|
end
|
2018-05-10 01:21:12 +02:00
|
|
|
|
2018-06-01 23:23:59 +02:00
|
|
|
local chance = math.floor(mines_factor / distance) + 1
|
2018-05-10 01:21:12 +02:00
|
|
|
|
2018-06-01 23:23:59 +02:00
|
|
|
if math.random(chance) == 1 then
|
|
|
|
return {name = 'land-mine', force = 'enemy'}
|
|
|
|
end
|
2018-05-10 01:21:12 +02:00
|
|
|
end
|