1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-06 00:23:49 +02:00

junkyard > dangerous_nights module

This commit is contained in:
MewMew 2019-03-08 23:47:38 +01:00
parent ff191e94fb
commit 412035e4c1
5 changed files with 59 additions and 7 deletions

View File

@ -55,16 +55,16 @@ local function unearthing_biters(surface, position, amount)
if evolution_index < 1 then evolution_index = 1 end
local ticks = amount * 30
ticks = ticks + 120
ticks = ticks + 90
for t = 1, ticks, 1 do
if not global.on_tick_schedule[game.tick + t] then global.on_tick_schedule[game.tick + t] = {} end
global.on_tick_schedule[game.tick + t][#global.on_tick_schedule[game.tick + t] + 1] = {
func = create_particles,
args = {surface, {x = position.x, y = position.y}, 5}
args = {surface, {x = position.x, y = position.y}, 4}
}
if t > 120 then
if t > 90 then
if t % 30 == 29 then
global.on_tick_schedule[game.tick + t][#global.on_tick_schedule[game.tick + t] + 1] = {
func = spawn_biter,

View File

@ -47,7 +47,7 @@ local function unearthing_worm(surface, position)
global.on_tick_schedule[game.tick + t][#global.on_tick_schedule[game.tick + t] + 1] = {
func = create_particles,
args = {surface, {x = position.x, y = position.y}, math.ceil(t * 0.07)}
args = {surface, {x = position.x, y = position.y}, math.ceil(t * 0.05)}
}
if t == 330 then

View File

@ -7,6 +7,7 @@ require "maps.modules.spawners_contain_biters"
require "maps.modules.biters_yield_coins"
require "maps.modules.fluids_are_explosive"
require "maps.modules.explosives_are_explosive"
require "maps.modules.dangerous_nights"
local unearthing_worm = require "functions.unearthing_worm"
local unearthing_biters = require "functions.unearthing_biters"
@ -406,7 +407,10 @@ local function on_player_joined_game(event)
player.insert({name = "firearm-magazine", count = 16})
end
if global.map_init_done then return end
if global.map_init_done then return end
game.forces["player"].technologies["optics"].researched = true
game.surfaces["nauvis"].ticks_per_day = game.surfaces["nauvis"].ticks_per_day * 2
game.create_force("scrap")

View File

@ -0,0 +1,48 @@
-- nighttime is dangerous, stay near your lamps -- by mewmew
local event = require 'utils.event'
local unearthing_worm = require "functions.unearthing_worm"
local unearthing_biters = require "functions.unearthing_biters"
local function on_player_changed_position(event)
local player = game.players[event.player_index]
if player.character.driving == true then return end
if player.surface.daytime < 0.33 then return end
if player.surface.daytime > 0.66 then return end
if math.random(1,32) ~= 1 then return end
for _, lamp in pairs(player.surface.find_entities_filtered({area={{player.position.x - 18, player.position.y - 18},{player.position.x + 18, player.position.y + 18}}, name="small-lamp"})) do
local circuit = lamp.get_or_create_control_behavior()
if circuit then
if lamp.energy > 40 and circuit.disabled == false then
return
end
else
if lamp.energy > 40 then
return
end
end
end
local positions = {}
local r = 8
for x = r * -1, r, 1 do
for y = r * -1, r, 1 do
local distance_to_center = math.sqrt(x^2 + x^2)
if distance_to_center > 2 and distance_to_center < 7 then
if player.surface.can_place_entity({name = "stone-furnace", position = {x = player.position.x + x, y = player.position.y + y}}) then
positions[#positions + 1] = {x = player.position.x + x, y = player.position.y + y}
end
end
end
end
if math.random(1,3) == 1 then
unearthing_biters(player.surface, positions[math.random(1, #positions)], math.random(3,9))
else
unearthing_worm(player.surface, positions[math.random(1, #positions)])
end
end
event.add(defines.events.on_player_changed_position, on_player_changed_position)

View File

@ -22,9 +22,9 @@ function cheat_mode()
game.forces.player.character_reach_distance_bonus = 1000
game.speed = 1.5
surface.daytime = 1
surface.freeze_daytime = 1
--surface.freeze_daytime = 1
game.player.force.research_all_technologies()
game.forces["enemy"].evolution_factor = 0.9
game.forces["enemy"].evolution_factor = 0.1
local chart = 200
game.forces["player"].chart(surface, {lefttop = {x = chart*-1, y = chart*-1}, rightbottom = {x = chart, y = chart}})
end