mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-03-11 14:49:24 +02:00
food module update, labyrinth update
This commit is contained in:
parent
205199dfda
commit
a33f9f960d
@ -13,7 +13,7 @@ require "score"
|
||||
--require "maps.tools.cheat_mode"
|
||||
|
||||
---- enable maps here ----
|
||||
require "maps.biter_battles"
|
||||
--require "maps.biter_battles"
|
||||
--require "maps.cave_miner"
|
||||
--require "maps.deep_jungle"
|
||||
--require "maps.lost_desert"
|
||||
@ -22,7 +22,7 @@ require "maps.biter_battles"
|
||||
--require "maps.spiral_troopers"
|
||||
--require "maps.fish_defender"
|
||||
--require "maps.crossing"
|
||||
--require "maps.spooky_forest"
|
||||
require "maps.spooky_forest"
|
||||
--require "maps.atoll"
|
||||
--require "maps.empty_map"
|
||||
-----------------------------
|
||||
|
@ -74,7 +74,7 @@ local function on_chunk_generated(event)
|
||||
local entities = {}
|
||||
|
||||
if not global.spawn_generated and left_top.x <= -160 then
|
||||
map_functions.draw_noise_tile_circle({x = 0, y = 0}, "grass-1", surface, 80)
|
||||
map_functions.draw_noise_tile_circle({x = 0, y = 0}, "grass-1", surface, 20)
|
||||
map_functions.draw_smoothed_out_ore_circle({x = -32, y = -32}, "copper-ore", surface, 15, 2500)
|
||||
map_functions.draw_smoothed_out_ore_circle({x = -32, y = 32}, "iron-ore", surface, 15, 2500)
|
||||
map_functions.draw_smoothed_out_ore_circle({x = 32, y = 32}, "coal", surface, 15, 2500)
|
||||
@ -95,26 +95,6 @@ local function on_chunk_generated(event)
|
||||
surface.set_tiles(tiles, true)
|
||||
|
||||
end
|
||||
|
||||
function cheat_mode()
|
||||
local cheat_mode_enabed = true
|
||||
if cheat_mode_enabed == true then
|
||||
local surface = game.surfaces["atoll"]
|
||||
game.player.cheat_mode=true
|
||||
game.players[1].insert({name="power-armor-mk2"})
|
||||
game.players[1].insert({name="fusion-reactor-equipment", count=4})
|
||||
game.players[1].insert({name="personal-laser-defense-equipment", count=8})
|
||||
game.players[1].insert({name="rocket-launcher"})
|
||||
game.players[1].insert({name="explosive-rocket", count=200})
|
||||
game.speed = 2
|
||||
surface.daytime = 1
|
||||
game.player.force.research_all_technologies()
|
||||
game.forces["enemy"].evolution_factor = 0.2
|
||||
local chart = 300
|
||||
local surface = game.surfaces["atoll"]
|
||||
game.forces["player"].chart(surface, {lefttop = {x = chart*-1, y = chart*-1}, rightbottom = {x = chart, y = chart}})
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
|
@ -1308,12 +1308,12 @@ local function on_tick()
|
||||
|
||||
if global.market_age then
|
||||
if not global.game_restart_timer then
|
||||
global.game_restart_timer = 7200
|
||||
global.game_restart_timer = 18000
|
||||
else
|
||||
if global.game_restart_timer < 0 then return end
|
||||
global.game_restart_timer = global.game_restart_timer - 30
|
||||
end
|
||||
if global.game_restart_timer % 900 == 0 then
|
||||
if global.game_restart_timer % 1800 == 0 then
|
||||
if global.game_restart_timer > 0 then game.print("Map will restart in " .. global.game_restart_timer / 60 .. " seconds!", { r=0.22, g=0.88, b=0.22}) end
|
||||
if global.game_restart_timer == 0 then
|
||||
game.print("Map is restarting!", { r=0.22, g=0.88, b=0.22})
|
||||
|
@ -659,13 +659,14 @@ end
|
||||
local function spawn_infinity_chest(pos, surface)
|
||||
local math_random = math.random
|
||||
local infinity_chests = {
|
||||
{"raw-wood", math_random(1,3)},
|
||||
--{"raw-wood", math_random(1,3)},
|
||||
{"coal", 1},
|
||||
{"stone", math_random(2,4)},
|
||||
{"stone", math_random(2,4)},
|
||||
{"stone", math_random(2,4)},
|
||||
{"stone", math_random(2,4)},
|
||||
{"stone", math_random(2,4)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"stone", math_random(3,5)},
|
||||
{"iron-ore", 1},
|
||||
{"copper-ore", 1},
|
||||
}
|
||||
@ -808,6 +809,25 @@ local function on_chunk_generated(event)
|
||||
local tile_to_insert = false
|
||||
local chunk_position_x = event.area.left_top.x / 32
|
||||
local chunk_position_y = event.area.left_top.y / 32
|
||||
|
||||
|
||||
if not global.spawn_ores_generated then
|
||||
if event.area.left_top.x > 96 then
|
||||
map_functions.draw_entity_circle({x = 16, y = 16}, "coal", surface, 9, false, 750)
|
||||
map_functions.draw_entity_circle({x = 16, y = 16}, "iron-ore", surface, 9, false, 750)
|
||||
map_functions.draw_entity_circle({x = 16, y = 16}, "copper-ore", surface, 9, false, 750)
|
||||
map_functions.draw_entity_circle({x = 16, y = 16}, "tree-05", surface, 9, true)
|
||||
--map_functions.draw_smoothed_out_ore_circle({x = 16, y = 8}, "coal", surface, 7, 750)
|
||||
--map_functions.draw_smoothed_out_ore_circle({x = 16, y = 8}, "coal", surface, 7, 750)
|
||||
--map_functions.draw_smoothed_out_ore_circle({x = 8, y = 24}, "iron-ore", surface, 7, 750)
|
||||
--map_functions.draw_smoothed_out_ore_circle({x = 24, y = 24}, "copper-ore", surface, 7, 750)
|
||||
--surface.create_entity({name = "tree-05", position = {16, 24}})
|
||||
--surface.create_entity({name = "tree-05", position = {24, 12}})
|
||||
--surface.create_entity({name = "tree-05", position = {8, 12}})
|
||||
global.spawn_ores_generated = true
|
||||
end
|
||||
end
|
||||
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
tile_to_insert = false
|
||||
@ -845,7 +865,7 @@ local function on_chunk_generated(event)
|
||||
end
|
||||
end
|
||||
if chunk_position_x == 0 and chunk_position_y == 0 then
|
||||
tile_to_insert = "grass-1"
|
||||
tile_to_insert = "grass-1"
|
||||
end
|
||||
if chunk_position_x == 0 and chunk_position_y == -1 then
|
||||
tile_to_insert = "dirt-5"
|
||||
@ -887,7 +907,7 @@ local function on_player_joined_game(event)
|
||||
}
|
||||
game.map_settings.pollution.pollution_restored_per_tree_damage = 0
|
||||
game.create_surface("labyrinth", map_gen_settings)
|
||||
game.forces["player"].set_spawn_position({16,16},game.surfaces["labyrinth"])
|
||||
game.forces["player"].set_spawn_position({16, 0},game.surfaces["labyrinth"])
|
||||
local surface = game.surfaces["labyrinth"]
|
||||
surface.create_entity {name="rock-big",position={16,-16}}
|
||||
|
||||
@ -913,10 +933,10 @@ local function on_player_joined_game(event)
|
||||
end
|
||||
local surface = game.surfaces["labyrinth"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {16,16}, 2, 1), "labyrinth")
|
||||
player.teleport(surface.find_non_colliding_position("player", {16, 0}, 2, 1), "labyrinth")
|
||||
else
|
||||
if player.online_time < 5 then
|
||||
player.teleport({16,16}, "labyrinth")
|
||||
player.teleport({16, 0}, "labyrinth")
|
||||
end
|
||||
end
|
||||
if player.online_time < 10 then
|
||||
|
@ -4,6 +4,7 @@ local event = require 'utils.event'
|
||||
local math_random = math.random
|
||||
|
||||
local respawn_fish = true
|
||||
|
||||
local player_hunger_fish_food_value = 10
|
||||
local player_hunger_spawn_value = 80
|
||||
local player_hunger_stages = {}
|
||||
@ -97,27 +98,20 @@ local function hunger_update(player, food_value)
|
||||
create_hunger_gui(player)
|
||||
end
|
||||
|
||||
local function respawn_fishes()
|
||||
if not global.respawn_fish_cake_piece then global.respawn_fish_cake_piece = 1 end
|
||||
if global.respawn_fish_cake_piece > 4 then global.respawn_fish_cake_piece = 1 end
|
||||
|
||||
local r = 1000000
|
||||
local area = {{0, r * -1}, {r, 0}}
|
||||
if global.respawn_fish_cake_piece == 2 then area = {{0, 0}, {r, r}} end
|
||||
if global.respawn_fish_cake_piece == 3 then area = {{r * -1, 0}, {0, r}} end
|
||||
if global.respawn_fish_cake_piece == 4 then area = {{r * -1, r * -1}, {0, 0}} end
|
||||
|
||||
global.respawn_fish_cake_piece = global.respawn_fish_cake_piece + 1
|
||||
|
||||
for _, surface in pairs(game.surfaces) do
|
||||
local water_tiles = surface.find_tiles_filtered({name = {"water", "deepwater", "water-green"}, area = area})
|
||||
for _, tile in pairs(water_tiles) do
|
||||
if math_random(1, 64) == 1 then
|
||||
local area_entities = {{tile.position.x - 2, tile.position.y - 2},{tile.position.x + 2, tile.position.y + 2}}
|
||||
local area_tiles = {{tile.position.x - 1, tile.position.y - 1},{tile.position.x + 1, tile.position.y + 1}}
|
||||
if surface.count_entities_filtered({area = area_entities, name = "fish"}) == 0 and surface.count_tiles_filtered({area = area_tiles, name = {"water", "deepwater", "water-green"}}) > 3 then
|
||||
surface.create_entity({name = "water-splash", position = tile.position})
|
||||
surface.create_entity({name = "fish", position = tile.position})
|
||||
local function respawn_fishes()
|
||||
local surface = game.players[1].surface
|
||||
for chunk in surface.get_chunks() do
|
||||
if math_random(1, 4) == 1 then
|
||||
local area = {{chunk.x * 32, chunk.y * 32}, {chunk.x * 32 + 32, chunk.y * 32 + 32}}
|
||||
local water_tiles = surface.find_tiles_filtered({name = {"water", "deepwater", "water-green"}, area = area})
|
||||
for _, tile in pairs(water_tiles) do
|
||||
if math_random(1, 32) == 1 then
|
||||
local area_entities = {{tile.position.x - 2, tile.position.y - 2},{tile.position.x + 2, tile.position.y + 2}}
|
||||
local area_tiles = {{tile.position.x - 1, tile.position.y - 1},{tile.position.x + 1, tile.position.y + 1}}
|
||||
if surface.count_entities_filtered({area = area_entities, name = "fish"}) == 0 and surface.count_tiles_filtered({area = area_tiles, name = {"water", "deepwater", "water-green"}}) > 3 then
|
||||
surface.create_entity({name = "water-splash", position = tile.position})
|
||||
surface.create_entity({name = "fish", position = tile.position})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,38 @@
|
||||
local simplex_noise = require 'utils.simplex_noise'
|
||||
simplex_noise = simplex_noise.d2
|
||||
local f = {}
|
||||
local math_random = math.random
|
||||
local insert = table.insert
|
||||
|
||||
f.draw_entity_circle = function(position, name, surface, radius, check_collision, amount)
|
||||
if not position then return end
|
||||
if not name then return end
|
||||
if not surface then return end
|
||||
if not radius then return end
|
||||
for y = radius * -1, radius, 1 do
|
||||
for x = radius * -1, radius, 1 do
|
||||
local pos = {x = x + position.x, y = y + position.y}
|
||||
local distance_to_center = math.sqrt(x^2 + y^2)
|
||||
if distance_to_center <= radius then
|
||||
if check_collision then
|
||||
if surface.can_place_entity({name = name, position = pos}) then
|
||||
if amount then
|
||||
surface.create_entity({name = name, position = pos, amount = amount})
|
||||
else
|
||||
surface.create_entity({name = name, position = pos})
|
||||
end
|
||||
end
|
||||
else
|
||||
if amount then
|
||||
surface.create_entity({name = name, position = pos, amount = amount})
|
||||
else
|
||||
surface.create_entity({name = name, position = pos})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
f.draw_noise_tile_circle = function(position, name, surface, radius)
|
||||
if not position then return end
|
||||
|
Loading…
x
Reference in New Issue
Block a user