mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-02-09 13:37:02 +02:00
many things
This commit is contained in:
parent
9884e0f75d
commit
2bd1d3ee42
@ -1,5 +1,7 @@
|
||||
require "functions.noise_vector_path"
|
||||
require "modules.shopping_chests"
|
||||
require "modules.no_turrets"
|
||||
require "modules.dangerous_goods"
|
||||
require "maps.island_troopers.enemies"
|
||||
require "maps.island_troopers.terrain"
|
||||
|
||||
@ -29,12 +31,29 @@ local function update_gui()
|
||||
end
|
||||
end
|
||||
|
||||
local function bring_players()
|
||||
local surface = game.surfaces[1]
|
||||
for _, player in pairs(game.connected_players) do
|
||||
if player.position.y < -1 then
|
||||
if player.character then
|
||||
if player.character.valid then
|
||||
local p = surface.find_non_colliding_position("character", {0, 2}, 8, 0.5)
|
||||
if not p then player.teleport({0, 2}, surface) end
|
||||
player.teleport(p, surface)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function set_next_level()
|
||||
global.alive_enemies = 0
|
||||
global.alive_boss_enemy_count = 0
|
||||
global.current_stage = 1
|
||||
global.current_level = global.current_level + 1
|
||||
|
||||
if global.current_level > 1 then bring_players() end
|
||||
|
||||
global.path_tiles = nil
|
||||
|
||||
local island_size = 16 + math.random(global.current_level * 2, global.current_level * 5)
|
||||
@ -55,7 +74,7 @@ local function set_next_level()
|
||||
}
|
||||
end
|
||||
global.stages[#global.stages + 1] = {
|
||||
path_length = 128 + global.current_level * 5,
|
||||
path_length = 64 + island_size * 5,
|
||||
size = false,
|
||||
}
|
||||
|
||||
@ -66,7 +85,7 @@ local function set_next_level()
|
||||
end
|
||||
|
||||
local function earn_credits(amount)
|
||||
game.print(amount .. " credits have been transfered to the factory!", {r = 255, g = 215, b = 0})
|
||||
game.print(amount .. " credits recieved!", {r = 255, g = 215, b = 0})
|
||||
global.credits = global.credits + amount
|
||||
end
|
||||
|
||||
@ -102,7 +121,6 @@ local function on_player_joined_game(event)
|
||||
create_stage_gui(player)
|
||||
if player.gui.left["slowmo_cam"] then player.gui.left["slowmo_cam"].destroy() end
|
||||
player.insert({name = "pistol", count = 1})
|
||||
player.insert({name = "uranium-rounds-magazine", count = 128})
|
||||
player.insert({name = "firearm-magazine", count = 32})
|
||||
end
|
||||
|
||||
@ -111,7 +129,6 @@ local function on_init()
|
||||
surface.request_to_generate_chunks({x = 0, y = 0}, 8)
|
||||
surface.force_generate_chunk_requests()
|
||||
|
||||
--global.level_tiles = {}
|
||||
global.level_vectors = {}
|
||||
global.alive_boss_enemy_entities = {}
|
||||
global.current_level = 0
|
||||
|
@ -11,13 +11,13 @@ local function island_noise(p, seed_1, seed_2, seed_3)
|
||||
end
|
||||
|
||||
local function process_island_position(position, radius, noise, distance)
|
||||
if distance + noise * radius * 1.5 <= radius then
|
||||
if distance + noise * radius * 1.7 <= radius then
|
||||
return {name = "grass-1", position = position}
|
||||
end
|
||||
if distance + noise * radius * 1 <= radius then
|
||||
if distance + noise * radius * 0.8 <= radius then
|
||||
return {name = "sand-1", position = position}
|
||||
end
|
||||
if distance + noise * radius * 0.7 <= radius then
|
||||
if distance + noise * radius * 0.6 <= radius then
|
||||
return {name = "water", position = position}
|
||||
end
|
||||
end
|
||||
@ -120,8 +120,7 @@ local draw_path_tile_whitelist = {
|
||||
["deepwater"] = true,
|
||||
}
|
||||
|
||||
local path_tile_names = {"grass-1", "grass-2", "grass-3", "grass-4", "water-shallow"}
|
||||
|
||||
local path_tile_names = {"grass-2", "grass-3", "grass-4", "water-shallow"}
|
||||
function draw_path_to_next_stage()
|
||||
local surface = game.surfaces[1]
|
||||
|
||||
@ -140,7 +139,7 @@ function draw_path_to_next_stage()
|
||||
|
||||
if global.current_stage ~= #global.stages and global.current_stage > 2 then
|
||||
if math_random(1, 3) == 1 then
|
||||
noise_vector_tile_path(surface, path_tile_names[math_random(1, #path_tile_names)], position, {0, 1}, global.stages[#global.stages].path_length * 10, math.random(2, 3), draw_path_tile_whitelist)
|
||||
noise_vector_tile_path(surface, path_tile_names[math_random(1, 3)], position, {0, 1}, global.stages[#global.stages].path_length, math.random(2, 3), draw_path_tile_whitelist)
|
||||
end
|
||||
end
|
||||
|
||||
@ -190,8 +189,9 @@ end
|
||||
function kill_the_level()
|
||||
local surface = game.surfaces[1]
|
||||
if not global.level_tiles then get_level_tiles(surface) end
|
||||
|
||||
local amount = 2 + global.current_level
|
||||
if not global.kill_the_level_speed then global.kill_the_level_speed = 0 end
|
||||
global.kill_the_level_speed = global.kill_the_level_speed + 0.0025
|
||||
local amount = global.kill_the_level_speed
|
||||
for i = #global.level_tiles, 1, -1 do
|
||||
if global.level_tiles[i] then
|
||||
for k, tile in pairs(global.level_tiles[i]) do
|
||||
@ -207,6 +207,7 @@ function kill_the_level()
|
||||
|
||||
if #global.level_tiles == 0 then
|
||||
wipe_vision(surface)
|
||||
global.kill_the_level_speed = nil
|
||||
global.level_tiles = nil
|
||||
global.gamestate = 1
|
||||
end
|
||||
@ -215,10 +216,13 @@ end
|
||||
local function process_tile(surface, position)
|
||||
if position.x < -64 then surface.set_tiles({{name = "out-of-map", position = position}}, true) return end
|
||||
if position.y < 0 then surface.set_tiles({{name = "deepwater", position = position}}, true) return end
|
||||
if position.y > 8 then surface.set_tiles({{name = "water-green", position = position}}, true) return end
|
||||
if position.y > 32 then surface.set_tiles({{name = "water-green", position = position}}, true) return end
|
||||
|
||||
if position.y > 12 + simplex_noise(position.x * 0.010, 0, game.surfaces[1].map_gen_settings.seed) * 6 then surface.set_tiles({{name = "water-green", position = position}}, true) return end
|
||||
|
||||
surface.set_tiles({{name = "sand-1", position = position}}, true)
|
||||
|
||||
if position.y == 7 then
|
||||
if position.y == 6 + math.floor(simplex_noise(position.x * 0.010, 0, game.surfaces[1].map_gen_settings.seed) * 4) then
|
||||
if position.x % 64 == 32 then create_shopping_chest(surface, position, false) end
|
||||
if position.x % 128 == 0 then create_dump_chest(surface, position, false) end
|
||||
end
|
||||
|
24
modules/no_turrets.lua
Normal file
24
modules/no_turrets.lua
Normal file
@ -0,0 +1,24 @@
|
||||
local turret_types = {
|
||||
["ammo-turret"] = true,
|
||||
["artillery-turret"] = true,
|
||||
["electric-turret"] = true,
|
||||
["fluid-turret"] = true,
|
||||
}
|
||||
|
||||
local function destroy_turret(entity)
|
||||
if not entity.valid then return end
|
||||
if not turret_types[entity.type] then return end
|
||||
entity.die()
|
||||
end
|
||||
|
||||
local function on_built_entity(event)
|
||||
destroy_turret(event.created_entity)
|
||||
end
|
||||
|
||||
local function on_robot_built_entity(event)
|
||||
destroy_turret(event.created_entity)
|
||||
end
|
||||
|
||||
local event = require 'utils.event'
|
||||
event.add(defines.events.on_built_entity, on_built_entity)
|
||||
event.add(defines.events.on_robot_built_entity, on_robot_built_entity)
|
Loading…
x
Reference in New Issue
Block a user