mirror of
https://github.com/ComfyFactory/ComfyFactorio.git
synced 2025-04-11 11:21:54 +02:00
chunk loader update, deep jungle map update
This commit is contained in:
parent
a54ed8ecf4
commit
c1238fc951
36
antigrief.lua
Normal file
36
antigrief.lua
Normal file
@ -0,0 +1,36 @@
|
||||
require "utils.utils"
|
||||
|
||||
local event = require 'utils.event'
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
local player = game.players[event.player_index]
|
||||
local playtime = player.online_time
|
||||
if global.player_totals then
|
||||
if global.player_totals[player.name] then
|
||||
playtime = player.online_time + global.player_totals[player.name][1]
|
||||
end
|
||||
end
|
||||
if playtime < 1296000 then
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
player.print("You have not grown accustomed to this technology yet.")
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
local function on_entity_died(event)
|
||||
local player = game.players[event.player_index]
|
||||
local playtime = player.online_time
|
||||
if global.player_totals then
|
||||
if global.player_totals[player.name] then
|
||||
playtime = player.online_time + global.player_totals[player.name][1]
|
||||
end
|
||||
end
|
||||
if playtime < 1296000 then
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
player.print("You have not grown accustomed to this technology yet.")
|
||||
end
|
||||
end
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
]]--
|
||||
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
10
control.lua
10
control.lua
@ -1,17 +1,19 @@
|
||||
require "utils.utils"
|
||||
require "session_tracker"
|
||||
require "antigrief"
|
||||
require "utils.corpse_util"
|
||||
require "group"
|
||||
require "player_list"
|
||||
require "poll"
|
||||
--require "score"
|
||||
require "score"
|
||||
|
||||
---- enable maps here ----
|
||||
|
||||
require "maps.biter_battles"
|
||||
--require "maps.biter_battles"
|
||||
--require "maps.cave_miner"
|
||||
--require "maps.deep_jungle"
|
||||
--require "maps.endless_desert"
|
||||
require "maps.deep_jungle"
|
||||
--require "maps.deep_jungle_oldgen"
|
||||
--require "maps.lost_desert"
|
||||
|
||||
-----------------------------
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ local function on_tick(event)
|
||||
if e.type == "simple-entity" or e.type == "resource" or e.type == "tree" then e.destroy() end
|
||||
end
|
||||
surface.destroy_decoratives({{-10,-10},{10,10}})
|
||||
game.print("Spawn generation done.")
|
||||
game.print("Spawn generation done!", { r=0.22, g=0.99, b=0.99})
|
||||
end
|
||||
end
|
||||
if global.game_lobby_active then
|
||||
|
@ -1,137 +1,170 @@
|
||||
|
||||
require "maps.tools.lazy_chunk_loader"
|
||||
local simplex_noise = require 'utils.simplex_noise'
|
||||
local Event = require 'utils.event'
|
||||
local event = require 'utils.event'
|
||||
|
||||
biter_battles_terrain = {}
|
||||
|
||||
local function on_chunk_generated(event)
|
||||
if not global.noise_seed then global.noise_seed = math.random(1,5000000) end
|
||||
|
||||
if not game.surfaces["surface"] then return end
|
||||
|
||||
local surface = game.surfaces["surface"]
|
||||
local ore_amount = 2500
|
||||
local ores = {"copper-ore", "iron-ore", "stone", "coal"}
|
||||
local noise = {}
|
||||
local tiles = {}
|
||||
|
||||
local aa = 0.0113
|
||||
local bb = 21
|
||||
local xx = 1.1
|
||||
local cc = xx - (aa * bb)
|
||||
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
tiles = {}
|
||||
local pos_x = event.area.left_top.x + x
|
||||
local pos_y = event.area.left_top.y + y
|
||||
local tile_to_insert = false
|
||||
local entity_has_been_placed = false
|
||||
global.generate_chunk_tiles_functions["surface"] = function(chunk_piece)
|
||||
local area = chunk_piece.area
|
||||
if not game.surfaces["surface"] then return end
|
||||
local surface = game.surfaces["surface"]
|
||||
if chunk_piece.surface ~= surface then return end
|
||||
if not global.noise_seed then global.noise_seed = game.surfaces[1].map_gen_settings.seed end
|
||||
|
||||
noise[1] = simplex_noise.d2(pos_x/250, pos_y/250,global.noise_seed)
|
||||
noise[2] = simplex_noise.d2(pos_x/75, pos_y/75,global.noise_seed+10000)
|
||||
noise[8] = simplex_noise.d2(pos_x/15, pos_y/15,global.noise_seed+40000)
|
||||
noise[3] = noise[1] + noise[2] * 0.2 + noise[8]*0.02
|
||||
|
||||
noise[4] = simplex_noise.d2(pos_x/200, pos_y/200,global.noise_seed+15000)
|
||||
noise[5] = simplex_noise.d2(pos_x/20, pos_y/20,global.noise_seed+20000)
|
||||
noise[6] = simplex_noise.d2(pos_x/8, pos_y/8,global.noise_seed+25000)
|
||||
noise[7] = simplex_noise.d2(pos_x/400, pos_y/400,global.noise_seed+35000)
|
||||
local water_noise = noise[4] + (noise[6] * 0.006) + (noise[5] * 0.04)
|
||||
|
||||
local a = ore_amount * (1+(noise[2]*0.3))
|
||||
xx = 1.1
|
||||
if noise[3] >= cc then
|
||||
for yy = 1, bb, 1 do
|
||||
local z = (yy % 4) + 1
|
||||
xx = xx - aa
|
||||
if noise[3] > xx then
|
||||
if surface.can_place_entity {name=ores[z], position={pos_x,pos_y}, amount=a} then
|
||||
surface.create_entity {name=ores[z], position={pos_x,pos_y}, amount=a}
|
||||
end
|
||||
entity_has_been_placed = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if entity_has_been_placed == false then
|
||||
if water_noise < -0.92 and water_noise < noise[7] then
|
||||
tile_to_insert = "water"
|
||||
end
|
||||
if water_noise < -0.97 and water_noise < noise[7] then
|
||||
tile_to_insert = "deepwater"
|
||||
end
|
||||
end
|
||||
if tile_to_insert then table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}}) end
|
||||
surface.set_tiles(tiles,true)
|
||||
|
||||
if tile_to_insert == "water" or tile_to_insert == "deepwater" then
|
||||
if surface.can_place_entity{name="fish", position={pos_x,pos_y}} and math.random(1,12) == 1 then
|
||||
surface.create_entity {name="fish", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
local noise = {}
|
||||
local tiles = {}
|
||||
|
||||
if event.area.left_top.y < 160 or event.area.left_top.y > -192 then
|
||||
local tiles = {}
|
||||
local spawn_tile = surface.get_tile(game.forces.south.get_spawn_position(surface))
|
||||
local radius = 24 --starting pond radius
|
||||
local radsquare = radius*radius
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
tiles = {}
|
||||
local pos_x = event.area.left_top.x + x
|
||||
local pos_y = event.area.left_top.y + y
|
||||
local tile_to_insert = false
|
||||
local tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
noise[4] = simplex_noise.d2(pos_x/85, pos_y/85,global.noise_seed+20000)
|
||||
noise[5] = simplex_noise.d2(pos_x/7, pos_y/7,global.noise_seed+30000)
|
||||
noise[7] = 1 + (noise[4]+(noise[5]*0.75))*0.11
|
||||
if pos_y >= ((global.horizontal_border_width/2)*-1)*noise[7] and pos_y <= (global.horizontal_border_width/2)*noise[7] then
|
||||
if pos_x < 20 and pos_x > -20 then
|
||||
local entities = surface.find_entities({{pos_x, pos_y}, {pos_x+1, pos_y+1}})
|
||||
for _, e in pairs(entities) do
|
||||
if e.type == "simple-entity" or e.type == "resource" or e.type == "tree" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
tile_to_insert = "deepwater"
|
||||
else
|
||||
local t = surface.get_tile(pos_x,pos_y)
|
||||
if t.name == "deepwater" or t.name =="water" then
|
||||
if tile_distance_to_center < 20000 then
|
||||
if spawn_tile.name == "water" or spawn_tile.name == "deepwater" then
|
||||
tile_to_insert = "sand-1"
|
||||
else
|
||||
tile_to_insert = spawn_tile.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_distance_to_center <= radsquare then
|
||||
if tile_distance_to_center >= radsquare/10 then
|
||||
tile_to_insert = "deepwater"
|
||||
else
|
||||
tile_to_insert = "sand-1"
|
||||
if tile_distance_to_center >= radsquare/18 then
|
||||
tile_to_insert = "refined-concrete"
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_to_insert then table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}}) end
|
||||
surface.set_tiles(tiles,true)
|
||||
local aa = 0.0113
|
||||
local bb = 21
|
||||
local xx = 1.1
|
||||
local cc = xx - (aa * bb)
|
||||
|
||||
for x = 0, 7, 1 do
|
||||
for y = 0, 7, 1 do
|
||||
tiles = {}
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
local tile_to_insert = false
|
||||
local entity_has_been_placed = false
|
||||
|
||||
if tile_to_insert == "deepwater" then
|
||||
if surface.can_place_entity{name="fish", position={pos_x,pos_y}} and math.random(1,35) == 1 then
|
||||
surface.create_entity {name="fish", position={pos_x,pos_y}}
|
||||
end
|
||||
noise[1] = simplex_noise.d2(pos_x/250, pos_y/250,global.noise_seed)
|
||||
noise[2] = simplex_noise.d2(pos_x/75, pos_y/75,global.noise_seed+10000)
|
||||
noise[8] = simplex_noise.d2(pos_x/15, pos_y/15,global.noise_seed+40000)
|
||||
noise[3] = noise[1] + noise[2] * 0.2 + noise[8]*0.02
|
||||
|
||||
noise[4] = simplex_noise.d2(pos_x/200, pos_y/200,global.noise_seed+15000)
|
||||
noise[5] = simplex_noise.d2(pos_x/20, pos_y/20,global.noise_seed+20000)
|
||||
noise[6] = simplex_noise.d2(pos_x/8, pos_y/8,global.noise_seed+25000)
|
||||
noise[7] = simplex_noise.d2(pos_x/400, pos_y/400,global.noise_seed+35000)
|
||||
local water_noise = noise[4] + (noise[6] * 0.006) + (noise[5] * 0.04)
|
||||
|
||||
if noise[3] >= cc then
|
||||
entity_has_been_placed = true
|
||||
end
|
||||
|
||||
if entity_has_been_placed == false then
|
||||
if water_noise < -0.92 and water_noise < noise[7] then
|
||||
tile_to_insert = "water"
|
||||
end
|
||||
if water_noise < -0.97 and water_noise < noise[7] then
|
||||
tile_to_insert = "deepwater"
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert then table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}}) end
|
||||
surface.set_tiles(tiles,true)
|
||||
end
|
||||
end
|
||||
|
||||
if area.left_top.y < 160 or area.left_top.y > -192 then
|
||||
local tiles = {}
|
||||
local spawn_tile = surface.get_tile(game.forces.south.get_spawn_position(surface))
|
||||
local radius = 24 --starting pond radius
|
||||
local radsquare = radius*radius
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
tiles = {}
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
local tile_to_insert = false
|
||||
local tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
noise[4] = simplex_noise.d2(pos_x/85, pos_y/85,global.noise_seed+20000)
|
||||
noise[5] = simplex_noise.d2(pos_x/7, pos_y/7,global.noise_seed+30000)
|
||||
noise[7] = 1 + (noise[4]+(noise[5]*0.75))*0.11
|
||||
if pos_y >= ((global.horizontal_border_width/2)*-1)*noise[7] and pos_y <= (global.horizontal_border_width/2)*noise[7] then
|
||||
if pos_x < 20 and pos_x > -20 then
|
||||
local entities = surface.find_entities({{pos_x, pos_y}, {pos_x+1, pos_y+1}})
|
||||
for _, e in pairs(entities) do
|
||||
if e.type == "simple-entity" or e.type == "resource" or e.type == "tree" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
tile_to_insert = "deepwater"
|
||||
else
|
||||
local t = surface.get_tile(pos_x,pos_y)
|
||||
if t.name == "deepwater" or t.name =="water" then
|
||||
if tile_distance_to_center < 20000 then
|
||||
if spawn_tile.name == "water" or spawn_tile.name == "deepwater" then
|
||||
tile_to_insert = "sand-1"
|
||||
else
|
||||
tile_to_insert = spawn_tile.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_distance_to_center <= radsquare then
|
||||
if tile_distance_to_center >= radsquare/10 then
|
||||
tile_to_insert = "deepwater"
|
||||
else
|
||||
tile_to_insert = "sand-1"
|
||||
if tile_distance_to_center >= radsquare/18 then
|
||||
tile_to_insert = "refined-concrete"
|
||||
end
|
||||
end
|
||||
end
|
||||
if tile_to_insert then table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}}) end
|
||||
surface.set_tiles(tiles,true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
global.generate_chunk_entities_functions["surface"] = function(chunk_piece)
|
||||
local area = chunk_piece.area
|
||||
if not game.surfaces["surface"] then return end
|
||||
local surface = game.surfaces["surface"]
|
||||
if chunk_piece.surface ~= surface then return end
|
||||
if not global.noise_seed then global.noise_seed = game.surfaces[1].map_gen_settings.seed end
|
||||
|
||||
local ore_amount = 2500
|
||||
local ores = {"copper-ore", "iron-ore", "stone", "coal"}
|
||||
local noise = {}
|
||||
|
||||
local aa = 0.0113
|
||||
local bb = 21
|
||||
local xx = 1.1
|
||||
local cc = xx - (aa * bb)
|
||||
|
||||
for x = 0, 7, 1 do
|
||||
for y = 0, 7, 1 do
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
|
||||
noise[1] = simplex_noise.d2(pos_x/250, pos_y/250,global.noise_seed)
|
||||
noise[2] = simplex_noise.d2(pos_x/75, pos_y/75,global.noise_seed+10000)
|
||||
noise[8] = simplex_noise.d2(pos_x/15, pos_y/15,global.noise_seed+40000)
|
||||
noise[3] = noise[1] + noise[2] * 0.2 + noise[8]*0.02
|
||||
|
||||
local a = ore_amount * (1+(noise[2]*0.3))
|
||||
xx = 1.1
|
||||
if noise[3] >= cc then
|
||||
for yy = 1, bb, 1 do
|
||||
local z = (yy % 4) + 1
|
||||
xx = xx - aa
|
||||
if noise[3] > xx then
|
||||
if surface.can_place_entity {name=ores[z], position={pos_x,pos_y}, amount=a} then
|
||||
surface.create_entity {name=ores[z], position={pos_x,pos_y}, amount=a}
|
||||
end
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local tile = surface.get_tile({pos_x,pos_y})
|
||||
if tile.name == "deepwater" or tile.name == "water" or tile.name == "water-green" then
|
||||
if math.random(1,20) == 1 then
|
||||
if surface.can_place_entity{name="fish", position={pos_x,pos_y}} then
|
||||
surface.create_entity {name="fish", position={pos_x,pos_y}}
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function find_tile_placement_spot_around_target_position(tilename, position, mode, density)
|
||||
local x = position.x
|
||||
local y = position.y
|
||||
@ -647,4 +680,4 @@ function biter_battles_terrain.generate_spawn_ores(ore_layout)
|
||||
end
|
||||
end
|
||||
|
||||
Event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
|
@ -1,10 +1,9 @@
|
||||
--deep jungle-- mewmew made this --
|
||||
--You can use /c map_pregen() command to pre-generate the world before playing to avoid any possible microstutter while playing.--
|
||||
--Use /c spaghetti() to play without bots.
|
||||
|
||||
local chunk_loader = require "maps.tools.lazy_chunk_loader"
|
||||
local simplex_noise = require 'utils.simplex_noise'
|
||||
simplex_noise = simplex_noise.d2
|
||||
local event = require 'utils.event'
|
||||
require "maps.tools.lazy_chunk_loader"
|
||||
|
||||
local function treasure_chest(position)
|
||||
local p = game.surfaces["deep_jungle"].find_non_colliding_position("wooden-chest",position, 2,0.5)
|
||||
@ -64,7 +63,7 @@ local function treasure_chest(position)
|
||||
end
|
||||
end
|
||||
|
||||
function rare_treasure_chest(position)
|
||||
local function rare_treasure_chest(position)
|
||||
local p = game.surfaces["deep_jungle"].find_non_colliding_position("steel-chest",position, 2,0.5)
|
||||
if not p then return end
|
||||
|
||||
@ -107,9 +106,9 @@ local function get_noise(name, pos)
|
||||
seed = seed + noise_seed_add
|
||||
if name == 1 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
noise[1] = simplex_noise(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
noise[2] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
@ -117,9 +116,9 @@ local function get_noise(name, pos)
|
||||
seed = seed + noise_seed_add
|
||||
if name == 2 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
noise[1] = simplex_noise(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
noise[2] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
@ -127,9 +126,9 @@ local function get_noise(name, pos)
|
||||
seed = seed + noise_seed_add
|
||||
if name == 3 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.001, pos.y * 0.001, seed)
|
||||
noise[1] = simplex_noise(pos.x * 0.001, pos.y * 0.001, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
noise[2] = simplex_noise(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
@ -137,198 +136,189 @@ local function get_noise(name, pos)
|
||||
seed = seed + noise_seed_add
|
||||
if name == 4 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
noise[1] = simplex_noise(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
noise[2] = simplex_noise(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.2
|
||||
return noise
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
seed = seed + noise_seed_add
|
||||
if name == 5 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise(pos.x * 0.05, pos.y * 0.05, seed)
|
||||
local noise = noise[1]
|
||||
return noise
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
seed = seed + noise_seed_add
|
||||
if name == 6 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise(pos.x * 0.05, pos.y * 0.05, seed)
|
||||
local noise = noise[1]
|
||||
return noise
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(global.generate_chunk_tiles_functions, function(chunk_piece)
|
||||
local area = chunk_piece.area
|
||||
local worm_raffle = {"small-worm-turret", "small-worm-turret", "small-worm-turret", "medium-worm-turret", "medium-worm-turret", "big-worm-turret"}
|
||||
local rock_raffle = {"sand-rock-big","sand-rock-big","rock-big","rock-big","rock-big","rock-big","rock-huge"}
|
||||
chunk_loader.add(function(chunk_piece)
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
if chunk_piece.surface ~= surface then return end
|
||||
local tiles = {}
|
||||
if chunk_piece[2] ~= surface.index then return end
|
||||
local chunk_piece_position = chunk_piece[1]
|
||||
local chunk_pos_x = chunk_piece_position.x
|
||||
local chunk_pos_y = chunk_piece_position.y
|
||||
local area = {
|
||||
left_top = {x = chunk_piece_position.x, y = chunk_piece_position.y},
|
||||
right_bottom = {x = chunk_piece_position.x + 8, y = chunk_piece_position.y + 8}
|
||||
}
|
||||
local tiles = {}
|
||||
local entities_to_place = {
|
||||
rocks = {},
|
||||
worms = {},
|
||||
enemy_buildings = {},
|
||||
trees = {},
|
||||
fish = {},
|
||||
treasure_chests = {},
|
||||
rare_treasure_chests = {}
|
||||
}
|
||||
local decoratives = {}
|
||||
local math_random = math.random
|
||||
local entities = surface.find_entities(area)
|
||||
for _, e in pairs(entities) do
|
||||
if e.type == "tree" or e.force.name == "enemy" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local tile_to_insert = false
|
||||
for x = 0, 7, 1 do
|
||||
for y = 0, 7, 1 do
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
local pos_x = chunk_pos_x + x
|
||||
local pos_y = chunk_pos_y + y
|
||||
local pos = {x = pos_x, y = pos_y}
|
||||
tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
local tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
tile_to_insert = false
|
||||
|
||||
local noise_3 = get_noise(3, pos)
|
||||
if noise_3 > -0.1 and noise_3 < 0.1 then
|
||||
if noise_3 > -0.05 and noise_3 < 0.05 then
|
||||
tile_to_insert = "water"
|
||||
tile_to_insert = "water"
|
||||
if math_random(1,40) == 1 then table.insert(entities_to_place.fish, pos) end
|
||||
end
|
||||
if noise_3 > -0.03 and noise_3 < 0.03 then
|
||||
tile_to_insert = "deepwater"
|
||||
tile_to_insert = "deepwater"
|
||||
if math_random(1,40) == 1 then table.insert(entities_to_place.fish, pos) end
|
||||
end
|
||||
else
|
||||
|
||||
local noise_1 = get_noise(1, pos)
|
||||
local noise_2 = get_noise(2, pos)
|
||||
local noise_4 = get_noise(4, pos)
|
||||
local noise_4 = get_noise(4, pos)
|
||||
if tile_distance_to_center > 10000 then
|
||||
if math_random(1,500) == 1 then table.insert(entities_to_place.worms, pos) end
|
||||
if noise_4 > -0.1 and noise_4 < 0.1 and noise_1 > 0.3 and noise_2 > 0.3 then
|
||||
if math_random(1,8) == 1 then table.insert(entities_to_place.rocks, pos) end
|
||||
end
|
||||
end
|
||||
|
||||
if noise_4 < -0.8 or noise_4 > 0.8 then tile_to_insert = "dirt-6" end
|
||||
if noise_3 < -0.1 then
|
||||
if noise_1 > 0.2 then
|
||||
if noise_1 > 0.2 then
|
||||
if math_random(1,4) == 1 then table.insert(entities_to_place.trees, {"tree-02", pos}) end
|
||||
if math_random(1,7500) == 1 then table.insert(entities_to_place.rare_treasure_chests, pos) end
|
||||
if math_random(1,1250) == 1 then table.insert(entities_to_place.treasure_chests, pos) end
|
||||
if noise_1 > 0.8 and tile_distance_to_center > 8000 then
|
||||
tile_to_insert = "water-green"
|
||||
if math_random(1,24) == 1 then table.insert(entities_to_place.fish, pos) end
|
||||
end
|
||||
end
|
||||
else
|
||||
if noise_2 < -0.2 then
|
||||
end
|
||||
if noise_1 < -0.2 then
|
||||
if math_random(1,4) == 1 then table.insert(entities_to_place.trees, {"tree-04", pos}) end
|
||||
if math_random(1,7500) == 1 then table.insert(entities_to_place.rare_treasure_chests, pos) end
|
||||
if math_random(1,1250) == 1 then table.insert(entities_to_place.treasure_chests, pos) end
|
||||
if noise_1 < -0.75 and tile_distance_to_center > 8000 then
|
||||
if math_random(1,36) == 1 then table.insert(entities_to_place.enemy_buildings, pos) end
|
||||
end
|
||||
end
|
||||
else
|
||||
if noise_2 > 0.2 then
|
||||
if math_random(1,4) == 1 then table.insert(entities_to_place.trees, {"tree-07", pos}) end
|
||||
if math_random(1,7500) == 1 then table.insert(entities_to_place.rare_treasure_chests, pos) end
|
||||
if math_random(1,1250) == 1 then table.insert(entities_to_place.treasure_chests, pos) end
|
||||
if noise_2 > 0.75 and tile_distance_to_center > 8000 then
|
||||
if math_random(1,36) == 1 then table.insert(entities_to_place.enemy_buildings, pos) end
|
||||
end
|
||||
end
|
||||
if noise_2 < -0.2 then
|
||||
if math_random(1,4) == 1 then table.insert(entities_to_place.trees, {"tree-09", pos}) end
|
||||
if math_random(1,7500) == 1 then table.insert(entities_to_place.rare_treasure_chests, pos) end
|
||||
if math_random(1,1250) == 1 then table.insert(entities_to_place.treasure_chests, pos) end
|
||||
if noise_2 < -0.8 and tile_distance_to_center > 8000 then
|
||||
tile_to_insert = "water-green"
|
||||
if math_random(1,24) == 1 then table.insert(entities_to_place.fish, pos) end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert ~= "deepwater" and tile_to_insert ~= "water" and tile_to_insert ~= "water-green" then
|
||||
if math_random(1,3) == 1 then
|
||||
local noise = get_noise(5, pos)
|
||||
if noise > 0.2 then
|
||||
table.insert(decoratives, {name = "green-hairy-grass", position = pos, amount = 2})
|
||||
end
|
||||
if noise < -0.7 then
|
||||
table.insert(decoratives, {name = "green-pita", position = pos, amount = 2})
|
||||
end
|
||||
local noise = get_noise(6, pos)
|
||||
if noise > 0.7 then
|
||||
table.insert(decoratives, {name = "green-croton", position = pos, amount = 3})
|
||||
end
|
||||
if noise < -0.2 then
|
||||
table.insert(decoratives, {name = "green-asterisk", position = pos, amount = 2})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if tile_to_insert == false then
|
||||
table.insert(tiles, {name = "grass-1", position = {pos_x,pos_y}})
|
||||
else
|
||||
table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles,true)
|
||||
end
|
||||
)
|
||||
|
||||
table.insert(global.generate_chunk_entities_functions, function(chunk_piece)
|
||||
local area = chunk_piece.area
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
if chunk_piece.surface ~= surface then return end
|
||||
local enemy_building_positions = {}
|
||||
local enemy_worm_positions = {}
|
||||
local worm_raffle = {"small-worm-turret", "small-worm-turret", "small-worm-turret", "medium-worm-turret", "medium-worm-turret", "big-worm-turret"}
|
||||
local rock_raffle = {"sand-rock-big","sand-rock-big","rock-big","rock-big","rock-big","rock-big","rock-huge"}
|
||||
local rock_positions = {}
|
||||
local fish_positions = {}
|
||||
local rare_treasure_chest_positions = {}
|
||||
local treasure_chest_positions = {}
|
||||
local tree_positions = {}
|
||||
end
|
||||
surface.set_tiles(tiles,true)
|
||||
surface.create_decoratives{check_collision=false, decoratives=decoratives}
|
||||
|
||||
for x = 0, 7, 1 do
|
||||
for y = 0, 7, 1 do
|
||||
local pos_x = area.left_top.x + x
|
||||
local pos_y = area.left_top.y + y
|
||||
local pos = {x = pos_x, y = pos_y}
|
||||
tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
|
||||
local noise_3 = get_noise(3, pos)
|
||||
if noise_3 > -0.1 and noise_3 < 0.1 then
|
||||
if noise_3 > -0.05 and noise_3 < 0.05 then
|
||||
table.insert(fish_positions, pos)
|
||||
end
|
||||
if noise_3 > -0.03 and noise_3 < 0.03 then
|
||||
table.insert(fish_positions, pos)
|
||||
end
|
||||
else
|
||||
local noise_1 = get_noise(1, pos)
|
||||
local noise_2 = get_noise(2, pos)
|
||||
local noise_4 = get_noise(4, pos)
|
||||
if tile_distance_to_center > 10000 then
|
||||
table.insert(enemy_worm_positions, pos)
|
||||
if noise_4 > -0.1 and noise_4 < 0.1 and noise_1 > 0.3 and noise_2 > 0.3 then
|
||||
table.insert(rock_positions, pos)
|
||||
end
|
||||
end
|
||||
if noise_4 < -0.8 or noise_4 > 0.8 then tile_to_insert = "dirt-6" end
|
||||
if noise_3 < -0.1 then
|
||||
if noise_1 > 0.2 then
|
||||
table.insert(tree_positions, {"tree-02", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
end
|
||||
if noise_1 < -0.2 then
|
||||
table.insert(tree_positions, {"tree-04", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_1 < -0.8 and tile_distance_to_center > 8000 then
|
||||
table.insert(enemy_building_positions, pos)
|
||||
end
|
||||
end
|
||||
else
|
||||
if noise_2 > 0.2 then
|
||||
table.insert(tree_positions, {"tree-07", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_2 > 0.8 and tile_distance_to_center > 8000 then
|
||||
table.insert(enemy_building_positions, pos)
|
||||
end
|
||||
end
|
||||
if noise_2 < -0.2 then
|
||||
table.insert(tree_positions, {"tree-09", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, p in pairs(entities_to_place.enemy_buildings) do
|
||||
if math_random(1,3) == 1 then
|
||||
if surface.can_place_entity({name="spitter-spawner", position=p}) then surface.create_entity {name="spitter-spawner", position=p} end
|
||||
else
|
||||
if surface.can_place_entity({name="biter-spawner", position=p}) then surface.create_entity {name="biter-spawner", position=p} end
|
||||
end
|
||||
end
|
||||
|
||||
for _, p in pairs(enemy_building_positions) do
|
||||
if math.random(1,40)==1 then
|
||||
if math.random(1,3) == 1 then
|
||||
if surface.can_place_entity({name="spitter-spawner", position=p}) then surface.create_entity {name="spitter-spawner", position=p} end
|
||||
else
|
||||
if surface.can_place_entity({name="biter-spawner", position=p}) then surface.create_entity {name="biter-spawner", position=p} end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, p in pairs(enemy_worm_positions) do
|
||||
if math.random(1,500)==1 then
|
||||
local e = worm_raffle[math.random(1,#worm_raffle)]
|
||||
if surface.can_place_entity({name=e, position=p}) then surface.create_entity {name=e, position=p} end
|
||||
end
|
||||
for _, p in pairs(entities_to_place.worms) do
|
||||
local e = worm_raffle[math.random(1,#worm_raffle)]
|
||||
if surface.can_place_entity({name=e, position=p}) then surface.create_entity {name=e, position=p} end
|
||||
end
|
||||
for _, p in pairs(rock_positions) do
|
||||
if math.random(1,8)==1 then
|
||||
local e = rock_raffle[math.random(1,#rock_raffle)]
|
||||
surface.create_entity {name=e, position=p}
|
||||
end
|
||||
for _, p in pairs(entities_to_place.rocks) do
|
||||
local e = rock_raffle[math.random(1,#rock_raffle)]
|
||||
surface.create_entity {name=e, position=p}
|
||||
end
|
||||
for _, p in pairs(tree_positions) do
|
||||
if math.random(1,4)==1 then
|
||||
if surface.can_place_entity({name=p[1], position=p[2]}) then surface.create_entity {name=p[1], position=p[2]} end
|
||||
end
|
||||
for _, p in pairs(entities_to_place.trees) do
|
||||
if surface.can_place_entity({name=p[1], position=p[2]}) then surface.create_entity {name=p[1], position=p[2]} end
|
||||
end
|
||||
for _, p in pairs(treasure_chest_positions) do
|
||||
if math.random(1,1250)==1 then
|
||||
treasure_chest(p)
|
||||
end
|
||||
for _, p in pairs(entities_to_place.treasure_chests) do
|
||||
treasure_chest(p)
|
||||
end
|
||||
for _, p in pairs(rare_treasure_chest_positions) do
|
||||
if math.random(1,7500)==1 then
|
||||
rare_treasure_chest(p)
|
||||
end
|
||||
end
|
||||
|
||||
for _, p in pairs(fish_positions) do
|
||||
if math.random(1,50)==1 then
|
||||
if surface.can_place_entity({name="fish",position=p}) then
|
||||
surface.create_entity {name="fish",position=p}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local decorative_names = {}
|
||||
for k,v in pairs(game.decorative_prototypes) do
|
||||
if v.autoplace_specification then
|
||||
decorative_names[#decorative_names+1] = k
|
||||
end
|
||||
end
|
||||
surface.regenerate_decorative(decorative_names, {{x=math.floor(area.left_top.x/8),y=math.floor(area.left_top.y/8)}})
|
||||
for _, p in pairs(entities_to_place.rare_treasure_chests) do
|
||||
rare_treasure_chest(p)
|
||||
end
|
||||
for _, p in pairs(entities_to_place.fish) do
|
||||
surface.create_entity {name="fish",position=p}
|
||||
end
|
||||
return true
|
||||
end
|
||||
)
|
||||
|
||||
@ -346,7 +336,11 @@ local function on_player_joined_game(event)
|
||||
["iron-ore"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["crude-oil"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["trees"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["enemy-base"] = {frequency = "none", size = "none", richness = "none"}
|
||||
["enemy-base"] = {frequency = "none", size = "none", richness = "none"},
|
||||
--["grass"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["sand"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["desert"] = {frequency = "none", size = "none", richness = "none"},
|
||||
["dirt"] = {frequency = "none", size = "none", richness = "none"}
|
||||
}
|
||||
game.map_settings.pollution.pollution_restored_per_tree_damage = 0
|
||||
game.create_surface("deep_jungle", map_gen_settings)
|
||||
@ -357,7 +351,9 @@ local function on_player_joined_game(event)
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "deep_jungle")
|
||||
else
|
||||
player.teleport({0,0}, "deep_jungle")
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "deep_jungle")
|
||||
end
|
||||
end
|
||||
|
||||
if player.online_time < 10 then
|
||||
@ -366,7 +362,7 @@ local function on_player_joined_game(event)
|
||||
player.insert {name = 'firearm-magazine', count = 32}
|
||||
player.insert {name = 'steel-axe', count = 1}
|
||||
player.insert {name = 'light-armor', count = 1}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
@ -377,7 +373,7 @@ end
|
||||
|
||||
local function on_entity_died(event)
|
||||
if event.entity.type == "tree" then
|
||||
if math.random(1,8) == 1 then
|
||||
if math.random(1,6) == 1 then
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
local p = surface.find_non_colliding_position("small-biter" , event.entity.position, 2, 0.5)
|
||||
if p then surface.create_entity {name="small-biter", position=event.entity.position} end
|
||||
@ -399,7 +395,7 @@ function cheat_mode()
|
||||
surface.daytime = 1
|
||||
game.player.force.research_all_technologies()
|
||||
game.forces["enemy"].evolution_factor = 0.2
|
||||
local chart = 200
|
||||
local chart = 300
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
game.forces["player"].chart(surface, {lefttop = {x = chart*-1, y = chart*-1}, rightbottom = {x = chart, y = chart}})
|
||||
end
|
||||
@ -407,4 +403,4 @@ end
|
||||
|
||||
event.add(defines.events.on_entity_died, on_entity_died)
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
||||
|
436
maps/deep_jungle_oldgen.lua
Normal file
436
maps/deep_jungle_oldgen.lua
Normal file
@ -0,0 +1,436 @@
|
||||
--deep jungle-- mewmew made this --
|
||||
|
||||
local simplex_noise = require 'utils.simplex_noise'
|
||||
local event = require 'utils.event'
|
||||
|
||||
local function treasure_chest(position)
|
||||
local p = game.surfaces["deep_jungle"].find_non_colliding_position("wooden-chest",position, 2,0.5)
|
||||
if not p then return end
|
||||
|
||||
treasure_chest_raffle_table = {}
|
||||
treasure_chest_loot_weights = {}
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'iron-gear-wheel', count = math.random(16,48)},10})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'coal', count = math.random(16,48)},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'copper-cable', count = math.random(64,128)},10})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'inserter', count = math.random(8,16)},4})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'fast-inserter', count = math.random(4,8)},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'stack-filter-inserter', count = math.random(2,4)},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'stack-inserter', count = math.random(2,4)},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'burner-inserter', count = math.random(16,32)},6})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'electric-engine-unit', count = math.random(1,16)},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'rocket-fuel', count = math.random(1,5)},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'empty-barrel', count = math.random(1,10)},7})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'lubricant-barrel', count = math.random(1,10)},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'crude-oil-barrel', count = math.random(1,10)},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'iron-stick', count = math.random(1,100)},8})
|
||||
table.insert(treasure_chest_loot_weights, {{name = "small-electric-pole", count = math.random(8,32)},9})
|
||||
table.insert(treasure_chest_loot_weights, {{name = "firearm-magazine", count = math.random(16,48)},8})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'grenade', count = math.random(16,32)},5})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'land-mine', count = math.random(24,48)},5})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'light-armor', count = 1},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'heavy-armor', count = 1},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'pipe', count = math.random(10,100)},6})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'wooden-chest', count = 1},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'burner-mining-drill', count = 1},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'iron-axe', count = 1},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'steel-axe', count = 1},3})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'raw-wood', count = math.random(5,50)},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'sulfur', count = math.random(20,50)},7})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'explosives', count = math.random(20,50)},6})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'shotgun', count = 1},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'stone-brick', count = math.random(80,100)},4})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'small-lamp', count = math.random(3,10)},4})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'rail', count = math.random(32,100)},4})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'coin', count = math.random(32,100)},1})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'assembling-machine-1', count = math.random(1,4)},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'assembling-machine-2', count = math.random(1,3)},2})
|
||||
table.insert(treasure_chest_loot_weights, {{name = 'assembling-machine-3', count = math.random(1,2)},1})
|
||||
for _, t in pairs (treasure_chest_loot_weights) do
|
||||
for x = 1, t[2], 1 do
|
||||
table.insert(treasure_chest_raffle_table, t[1])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local e = game.surfaces["deep_jungle"].create_entity {name="wooden-chest",position=p, force="player"}
|
||||
e.minable = false
|
||||
local i = e.get_inventory(defines.inventory.chest)
|
||||
for x = 1, math.random(3,7), 1 do
|
||||
local loot = treasure_chest_raffle_table[math.random(1,#treasure_chest_raffle_table)]
|
||||
i.insert(loot)
|
||||
end
|
||||
end
|
||||
|
||||
function rare_treasure_chest(position)
|
||||
local p = game.surfaces["deep_jungle"].find_non_colliding_position("steel-chest",position, 2,0.5)
|
||||
if not p then return end
|
||||
|
||||
local rare_treasure_chest_raffle_table = {}
|
||||
local rare_treasure_chest_loot_weights = {}
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'combat-shotgun', count = 1},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'piercing-shotgun-shell', count = math.random(16,48)},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'rocket-launcher', count = 1},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'rocket', count = math.random(16,48)},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'explosive-rocket', count = math.random(16,48)},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'modular-armor', count = 1},3})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'power-armor', count = 1},1})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'uranium-rounds-magazine', count = math.random(16,48)},3})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'piercing-rounds-magazine', count = math.random(64,128)},3})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'railgun', count = 1},4})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'railgun-dart', count = math.random(16,48)},4})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'exoskeleton-equipment', count = 1},2})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'defender-capsule', count = math.random(8,16)},5})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'distractor-capsule', count = math.random(4,8)},4})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'destroyer-capsule', count = math.random(4,8)},3})
|
||||
table.insert(rare_treasure_chest_loot_weights, {{name = 'atomic-bomb', count = 1},1})
|
||||
for _, t in pairs (rare_treasure_chest_loot_weights) do
|
||||
for x = 1, t[2], 1 do
|
||||
table.insert(rare_treasure_chest_raffle_table, t[1])
|
||||
end
|
||||
end
|
||||
|
||||
local e = game.surfaces["deep_jungle"].create_entity {name="steel-chest",position=p, force="player"}
|
||||
e.minable = false
|
||||
local i = e.get_inventory(defines.inventory.chest)
|
||||
for x = 1, math.random(2,3), 1 do
|
||||
local loot = rare_treasure_chest_raffle_table[math.random(1,#rare_treasure_chest_raffle_table)]
|
||||
i.insert(loot)
|
||||
end
|
||||
end
|
||||
|
||||
local function secret_shop(pos)
|
||||
local secret_market_items = {
|
||||
{price = {{"raw-fish", math.random(250,450)}}, offer = {type = 'give-item', item = 'combat-shotgun'}},
|
||||
{price = {{"raw-fish", math.random(75,125)}}, offer = {type = 'give-item', item = 'rocket-launcher'}},
|
||||
{price = {{"raw-fish", math.random(2,4)}}, offer = {type = 'give-item', item = 'piercing-rounds-magazine'}},
|
||||
{price = {{"raw-fish", math.random(8,16)}}, offer = {type = 'give-item', item = 'uranium-rounds-magazine'}},
|
||||
{price = {{"raw-fish", math.random(8,16)}}, offer = {type = 'give-item', item = 'piercing-shotgun-shell'}},
|
||||
{price = {{"raw-fish", math.random(8,16)}}, offer = {type = 'give-item', item = 'rocket'}},
|
||||
{price = {{"raw-fish", math.random(10,20)}}, offer = {type = 'give-item', item = 'explosive-rocket'}},
|
||||
{price = {{"raw-fish", math.random(15,30)}}, offer = {type = 'give-item', item = 'explosive-cannon-shell'}},
|
||||
{price = {{"raw-fish", math.random(25,35)}}, offer = {type = 'give-item', item = 'explosive-uranium-cannon-shell'}},
|
||||
{price = {{"raw-fish", math.random(20,40)}}, offer = {type = 'give-item', item = 'cluster-grenade'}},
|
||||
{price = {{"raw-fish", math.random(1,3)}}, offer = {type = 'give-item', item = 'land-mine'}},
|
||||
{price = {{"raw-fish", math.random(250,500)}}, offer = {type = 'give-item', item = 'modular-armor'}},
|
||||
{price = {{"raw-fish", math.random(1500,3000)}}, offer = {type = 'give-item', item = 'power-armor'}},
|
||||
{price = {{"raw-fish", math.random(18000,23000)}}, offer = {type = 'give-item', item = 'power-armor-mk2'}},
|
||||
{price = {{"raw-fish", math.random(4000,7000)}}, offer = {type = 'give-item', item = 'fusion-reactor-equipment'}},
|
||||
{price = {{"raw-fish", math.random(50,100)}}, offer = {type = 'give-item', item = 'battery-equipment'}},
|
||||
{price = {{"raw-fish", math.random(700,1100)}}, offer = {type = 'give-item', item = 'battery-mk2-equipment'}},
|
||||
{price = {{"raw-fish", math.random(400,700)}}, offer = {type = 'give-item', item = 'belt-immunity-equipment'}},
|
||||
{price = {{"raw-fish", math.random(12000,16000)}}, offer = {type = 'give-item', item = 'night-vision-equipment'}},
|
||||
{price = {{"raw-fish", math.random(300,500)}}, offer = {type = 'give-item', item = 'exoskeleton-equipment'}},
|
||||
{price = {{"raw-fish", math.random(350,500)}}, offer = {type = 'give-item', item = 'personal-roboport-equipment'}},
|
||||
{price = {{"raw-fish", math.random(25,50)}}, offer = {type = 'give-item', item = 'construction-robot'}},
|
||||
{price = {{"raw-fish", math.random(250,450)}}, offer = {type = 'give-item', item = 'energy-shield-equipment'}},
|
||||
{price = {{"raw-fish", math.random(350,550)}}, offer = {type = 'give-item', item = 'personal-laser-defense-equipment'}},
|
||||
{price = {{"raw-fish", math.random(125,250)}}, offer = {type = 'give-item', item = 'railgun'}},
|
||||
{price = {{"raw-fish", math.random(2,4)}}, offer = {type = 'give-item', item = 'railgun-dart'}},
|
||||
{price = {{"raw-fish", math.random(100,175)}}, offer = {type = 'give-item', item = 'loader'}},
|
||||
{price = {{"raw-fish", math.random(200,350)}}, offer = {type = 'give-item', item = 'fast-loader'}},
|
||||
{price = {{"raw-fish", math.random(400,600)}}, offer = {type = 'give-item', item = 'express-loader'}}
|
||||
}
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
local market = surface.create_entity {name = "market", position = pos}
|
||||
market.destructible = false
|
||||
local market_items_to_add = math.random(8,12)
|
||||
while market_items_to_add >= 0 do
|
||||
local i = math.random(1,#secret_market_items)
|
||||
if secret_market_items[i] then
|
||||
market.add_market_item(secret_market_items[i])
|
||||
market_items_to_add = market_items_to_add - 1
|
||||
secret_market_items[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function get_noise(name, pos)
|
||||
local seed = game.surfaces[1].map_gen_settings.seed
|
||||
local noise_seed_add = 25000
|
||||
seed = seed + noise_seed_add
|
||||
if name == 1 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
seed = seed + noise_seed_add
|
||||
if name == 2 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
seed = seed + noise_seed_add
|
||||
if name == 3 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.001, pos.y * 0.001, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
local noise = noise[1] + noise[2] * 0.1
|
||||
return noise
|
||||
end
|
||||
seed = seed + noise_seed_add
|
||||
seed = seed + noise_seed_add
|
||||
if name == 4 then
|
||||
local noise = {}
|
||||
noise[1] = simplex_noise.d2(pos.x * 0.01, pos.y * 0.01, seed)
|
||||
seed = seed + noise_seed_add
|
||||
noise[2] = simplex_noise.d2(pos.x * 0.1, pos.y * 0.1, seed)
|
||||
local noise = noise[1] + noise[2] * 0.2
|
||||
return noise
|
||||
end
|
||||
end
|
||||
|
||||
local function on_chunk_generated(event)
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
local tiles = {}
|
||||
local enemy_building_positions = {}
|
||||
local enemy_worm_positions = {}
|
||||
local worm_raffle = {"small-worm-turret", "small-worm-turret", "small-worm-turret", "medium-worm-turret", "medium-worm-turret", "big-worm-turret"}
|
||||
local rock_raffle = {"sand-rock-big","sand-rock-big","rock-big","rock-big","rock-big","rock-big","rock-huge"}
|
||||
local rock_positions = {}
|
||||
local fish_positions = {}
|
||||
local rare_treasure_chest_positions = {}
|
||||
local treasure_chest_positions = {}
|
||||
local secret_shop_locations = {}
|
||||
local tree_positions = {}
|
||||
|
||||
local entities = surface.find_entities(event.area)
|
||||
for _, e in pairs(entities) do
|
||||
if e.type == "tree" or e.force.name == "enemy" then
|
||||
e.destroy()
|
||||
end
|
||||
end
|
||||
|
||||
local tile_to_insert = false
|
||||
for x = 0, 31, 1 do
|
||||
for y = 0, 31, 1 do
|
||||
local pos_x = event.area.left_top.x + x
|
||||
local pos_y = event.area.left_top.y + y
|
||||
local pos = {x = pos_x, y = pos_y}
|
||||
tile_distance_to_center = pos_x^2 + pos_y^2
|
||||
tile_to_insert = false
|
||||
--game.print(#tree_pool)
|
||||
local noise_3 = get_noise(3, pos)
|
||||
if noise_3 > -0.1 and noise_3 < 0.1 then
|
||||
if noise_3 > -0.05 and noise_3 < 0.05 then
|
||||
tile_to_insert = "water"
|
||||
table.insert(fish_positions, pos)
|
||||
end
|
||||
if noise_3 > -0.03 and noise_3 < 0.03 then
|
||||
tile_to_insert = "deepwater"
|
||||
table.insert(fish_positions, pos)
|
||||
end
|
||||
else
|
||||
local noise_1 = get_noise(1, pos)
|
||||
local noise_2 = get_noise(2, pos)
|
||||
local noise_4 = get_noise(4, pos)
|
||||
if tile_distance_to_center > 8000 then
|
||||
table.insert(enemy_worm_positions, pos)
|
||||
if noise_4 > -0.1 and noise_4 < 0.1 and noise_1 > 0.3 and noise_2 > 0.3 then
|
||||
table.insert(rock_positions, pos)
|
||||
end
|
||||
end
|
||||
if noise_4 < -0.8 or noise_4 > 0.8 then tile_to_insert = "dirt-6" end
|
||||
if noise_3 < -0.1 then
|
||||
if noise_1 > 0.2 then
|
||||
table.insert(tree_positions, {"tree-02", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_1 > 0.8 and tile_distance_to_center > 8000 then
|
||||
tile_to_insert = "water-green"
|
||||
end
|
||||
end
|
||||
if noise_1 < -0.2 then
|
||||
table.insert(tree_positions, {"tree-04", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_1 < -0.8 and tile_distance_to_center > 8000 then
|
||||
table.insert(enemy_building_positions, pos)
|
||||
end
|
||||
end
|
||||
else
|
||||
if noise_2 > 0.2 then
|
||||
table.insert(tree_positions, {"tree-07", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_2 > 0.8 and tile_distance_to_center > 8000 then
|
||||
table.insert(enemy_building_positions, pos)
|
||||
end
|
||||
end
|
||||
if noise_2 < -0.2 then
|
||||
table.insert(tree_positions, {"tree-09", pos})
|
||||
table.insert(rare_treasure_chest_positions, pos)
|
||||
table.insert(treasure_chest_positions, pos)
|
||||
if noise_2 < -0.8 and tile_distance_to_center > 8000 then
|
||||
tile_to_insert = "water-green"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if tile_to_insert == false then
|
||||
table.insert(tiles, {name = "grass-1", position = {pos_x,pos_y}})
|
||||
else
|
||||
table.insert(tiles, {name = tile_to_insert, position = {pos_x,pos_y}})
|
||||
end
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles,true)
|
||||
|
||||
|
||||
for _, p in pairs(enemy_building_positions) do
|
||||
if math.random(1,40)==1 then
|
||||
if math.random(1,3) == 1 then
|
||||
if surface.can_place_entity({name="spitter-spawner", position=p}) then surface.create_entity {name="spitter-spawner", position=p} end
|
||||
else
|
||||
if surface.can_place_entity({name="biter-spawner", position=p}) then surface.create_entity {name="biter-spawner", position=p} end
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, p in pairs(enemy_worm_positions) do
|
||||
if math.random(1,500)==1 then
|
||||
local e = worm_raffle[math.random(1,#worm_raffle)]
|
||||
if surface.can_place_entity({name=e, position=p}) then surface.create_entity {name=e, position=p} end
|
||||
end
|
||||
end
|
||||
for _, p in pairs(rock_positions) do
|
||||
if math.random(1,8)==1 then
|
||||
local e = rock_raffle[math.random(1,#rock_raffle)]
|
||||
surface.create_entity {name=e, position=p}
|
||||
end
|
||||
end
|
||||
for _, p in pairs(tree_positions) do
|
||||
if math.random(1,4)==1 then
|
||||
if surface.can_place_entity({name=p[1], position=p[2]}) then surface.create_entity {name=p[1], position=p[2]} end
|
||||
end
|
||||
end
|
||||
for _, p in pairs(treasure_chest_positions) do
|
||||
if math.random(1,1000)==1 then
|
||||
treasure_chest(p)
|
||||
end
|
||||
end
|
||||
for _, p in pairs(rare_treasure_chest_positions) do
|
||||
if math.random(1,10000)==1 then
|
||||
rare_treasure_chest(p)
|
||||
end
|
||||
end
|
||||
|
||||
for _, p in pairs(fish_positions) do
|
||||
if math.random(1,50)==1 then
|
||||
if surface.can_place_entity({name="fish",position=p}) then
|
||||
surface.create_entity {name="fish",position=p}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local decorative_names = {}
|
||||
for k,v in pairs(game.decorative_prototypes) do
|
||||
if v.autoplace_specification then
|
||||
decorative_names[#decorative_names+1] = k
|
||||
end
|
||||
end
|
||||
surface.regenerate_decorative(decorative_names, {{x=math.floor(event.area.left_top.x/32),y=math.floor(event.area.left_top.y/32)}})
|
||||
end
|
||||
|
||||
local function on_player_joined_game(event)
|
||||
local player = game.players[event.player_index]
|
||||
if not global.map_init_done then
|
||||
game.forces["player"].technologies["flamethrower"].enabled = false
|
||||
local map_gen_settings = {}
|
||||
map_gen_settings.water = "none"
|
||||
map_gen_settings.cliff_settings = {cliff_elevation_interval = 4, cliff_elevation_0 = 0.1}
|
||||
map_gen_settings.autoplace_controls = {
|
||||
["coal"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["stone"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["copper-ore"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["iron-ore"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["crude-oil"] = {frequency = "normal", size = "normal", richness = "good"},
|
||||
["trees"] = {frequency = "normal", size = "normal", richness = "normal"},
|
||||
["enemy-base"] = {frequency = "normal", size = "normal", richness = "good"}
|
||||
}
|
||||
game.map_settings.pollution.pollution_restored_per_tree_damage = 0
|
||||
game.create_surface("deep_jungle", map_gen_settings)
|
||||
game.forces["player"].set_spawn_position({0,0},game.surfaces["deep_jungle"])
|
||||
global.map_init_done = true
|
||||
end
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "deep_jungle")
|
||||
else
|
||||
player.teleport({0,0}, "deep_jungle")
|
||||
end
|
||||
|
||||
if player.online_time < 10 then
|
||||
player.insert {name = 'submachine-gun', count = 1}
|
||||
player.insert {name = 'raw-fish', count = 12}
|
||||
player.insert {name = 'firearm-magazine', count = 32}
|
||||
player.insert {name = 'steel-axe', count = 1}
|
||||
player.insert {name = 'light-armor', count = 1}
|
||||
end
|
||||
end
|
||||
|
||||
local function on_tick(event)
|
||||
if global.map_pregeneration_is_active then
|
||||
if game.tick % 600 == 0 then
|
||||
local r = 1
|
||||
for x = 1,32,1 do
|
||||
if game.forces.map_pregen.is_chunk_charted(game.surfaces["deep_jungle"], {x,x}) then r = x end
|
||||
end
|
||||
game.print("Map chunks are generating... current radius " .. r, { r=0.22, g=0.99, b=0.99})
|
||||
if game.forces.map_pregen.is_chunk_charted(game.surfaces["deep_jungle"], {32,32}) then
|
||||
game.print("Map generation done!", { r=0.22, g=0.99, b=0.99})
|
||||
|
||||
game.players[1].force = game.forces["player"]
|
||||
global.map_pregeneration_is_active = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function on_marked_for_deconstruction(event)
|
||||
if event.entity.name == "rock-huge" or event.entity.name == "rock-big" or event.entity.name == "sand-rock-big" or event.entity.name == "fish" or event.entity.type == "tree" then
|
||||
event.entity.cancel_deconstruction(game.players[event.player_index].force.name)
|
||||
end
|
||||
end
|
||||
|
||||
function map_pregen()
|
||||
local radius = 1024
|
||||
if not game.forces.map_pregen then game.create_force("map_pregen") end
|
||||
game.players[1].force = game.forces["map_pregen"]
|
||||
game.forces.map_pregen.chart(game.surfaces["deep_jungle"],{{x = -1 * radius, y = -1 * radius}, {x = radius, y = radius}})
|
||||
global.map_pregeneration_is_active = true
|
||||
end
|
||||
|
||||
function cheat_mode()
|
||||
local cheat_mode_enabed = false
|
||||
if cheat_mode_enabed == true then
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
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 = 200
|
||||
local surface = game.surfaces["deep_jungle"]
|
||||
game.forces["player"].chart(surface, {lefttop = {x = chart*-1, y = chart*-1}, rightbottom = {x = chart, y = chart}})
|
||||
end
|
||||
end
|
||||
|
||||
event.add(defines.events.on_marked_for_deconstruction, on_marked_for_deconstruction)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
event.add(defines.events.on_tick, on_tick)
|
||||
event.add(defines.events.on_player_joined_game, on_player_joined_game)
|
@ -139,7 +139,9 @@ local function on_player_joined_game(event)
|
||||
if player.online_time < 5 and surface.is_chunk_generated({0,0}) then
|
||||
player.teleport(surface.find_non_colliding_position("player", {0,0}, 2, 1), "endless_desert")
|
||||
else
|
||||
player.teleport({0,0}, "endless_desert")
|
||||
if player.online_time < 5 then
|
||||
player.teleport({0,0}, "endless_desert")
|
||||
end
|
||||
end
|
||||
|
||||
if player.online_time < 10 then
|
@ -3,75 +3,64 @@
|
||||
--by mewmew
|
||||
|
||||
local event = require 'utils.event'
|
||||
if not global.generate_chunk_tiles_functions then global.generate_chunk_tiles_functions = {} end
|
||||
if not global.generate_chunk_entities_functions then global.generate_chunk_entities_functions = {} end
|
||||
local lazy_chunk_loader = {}
|
||||
local chunk_functions = {}
|
||||
|
||||
--cut chunks into 8x8 pieces and fill them into global.chunk_pieces
|
||||
--cut chunks into pieces and fill them into chunk_pieces tables
|
||||
local function on_chunk_generated(event)
|
||||
if not global.generate_chunk_tiles_functions[1] then game.print("No functions found in table: global.generate_chunk_tiles_functions") return end
|
||||
if not global.generate_chunk_entities_functions[1] then game.print("No functions found in table: global.generate_chunk_entities_functions") return end
|
||||
if not global.chunk_pieces then global.chunk_pieces = {} end
|
||||
if not global.chunk_pieces_tile_index then global.chunk_pieces_tile_index = 1 end
|
||||
if not global.chunk_pieces_entity_index then global.chunk_pieces_entity_index = 1 end
|
||||
if not global.chunk_pieces_load_speed then global.chunk_pieces_load_speed = 1 end -- max chunk loading speed in 8x8 tile pieces / tick
|
||||
if not global.chunk_pieces_entities then global.chunk_pieces_entities = {} end
|
||||
if not global.chunk_pieces_load_amount then global.chunk_pieces_load_amount = 128 end
|
||||
if not global.chunk_pieces_load_speed then global.chunk_pieces_load_speed = 3 end -- how many ticks until one operation happens
|
||||
if game.tick > 300 then global.chunk_pieces_load_amount = 1 end -- how many pieces are processed per one operation
|
||||
local index = event.surface.index
|
||||
for pos_y = 0, 24, 8 do
|
||||
for pos_x = 0, 24, 8 do
|
||||
local a = {
|
||||
left_top = {x = event.area.left_top.x + pos_x, y = event.area.left_top.y + pos_y},
|
||||
right_bottom = {x = event.area.left_top.x + pos_x + 8, y = event.area.left_top.y + pos_y + 8}
|
||||
}
|
||||
table.insert(global.chunk_pieces, {area = a, surface = event.surface})
|
||||
table.insert(global.chunk_pieces, {{x = event.area.left_top.x + pos_x, y = event.area.left_top.y + pos_y}, index})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--process the pieces lazy, calling generate_chunk_tiles_functions() and generate_chunk_entities_functions()
|
||||
local function on_tick()
|
||||
if global.chunk_pieces[global.chunk_pieces_tile_index] then
|
||||
if global.chunk_pieces_tile_index < 4096 then --4096 for a fast spawn generation
|
||||
for x = 1, 128, 1 do
|
||||
if global.chunk_pieces[global.chunk_pieces_tile_index] then
|
||||
for _, f in pairs(global.generate_chunk_tiles_functions) do
|
||||
f(global.chunk_pieces[global.chunk_pieces_tile_index])
|
||||
end
|
||||
global.chunk_pieces_tile_index = global.chunk_pieces_tile_index + 1
|
||||
end
|
||||
--process the pieces lazy, calling chunk_functions()
|
||||
local function on_tick()
|
||||
if global.chunk_pieces[1] then
|
||||
if game.tick % global.chunk_pieces_load_speed ~= 0 then return end
|
||||
local z = global.chunk_pieces_load_amount
|
||||
for x = #global.chunk_pieces, 1, -1 do
|
||||
if not global.chunk_pieces[x] then return end
|
||||
for _, f in pairs(chunk_functions) do
|
||||
f(global.chunk_pieces[x])
|
||||
end
|
||||
else
|
||||
for x = 1, global.chunk_pieces_load_speed, 1 do
|
||||
if global.chunk_pieces[global.chunk_pieces_tile_index] then
|
||||
for _, f in pairs(global.generate_chunk_tiles_functions) do
|
||||
f(global.chunk_pieces[global.chunk_pieces_tile_index])
|
||||
end
|
||||
global.chunk_pieces_tile_index = global.chunk_pieces_tile_index + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
if global.chunk_pieces[global.chunk_pieces_entity_index] then
|
||||
if global.chunk_pieces_entity_index < 4096 then --4096 for a fast spawn generation
|
||||
for x = 1, 128, 1 do
|
||||
if global.chunk_pieces[global.chunk_pieces_entity_index] then
|
||||
for _, f in pairs(global.generate_chunk_entities_functions) do
|
||||
f(global.chunk_pieces[global.chunk_pieces_entity_index])
|
||||
end
|
||||
global.chunk_pieces_entity_index = global.chunk_pieces_entity_index + 1
|
||||
end
|
||||
end
|
||||
else
|
||||
if not global.chunk_fast_spawn_generation_done then global.chunk_fast_spawn_generation_done = true game.print("Spawn generation done!", { r=0.22, g=0.99, b=0.99}) end
|
||||
for x = 1, global.chunk_pieces_load_speed, 1 do
|
||||
if global.chunk_pieces[global.chunk_pieces_entity_index] then
|
||||
for _, f in pairs(global.generate_chunk_entities_functions) do
|
||||
f(global.chunk_pieces[global.chunk_pieces_entity_index])
|
||||
end
|
||||
global.chunk_pieces_entity_index = global.chunk_pieces_entity_index + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
global.chunk_pieces[x] = nil
|
||||
z = z - 1
|
||||
if z == 0 then break end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
--process the pieces lazy, calling chunk_functions()
|
||||
local function on_tick()
|
||||
if #global.chunk_pieces > 0 then
|
||||
if game.tick % global.chunk_pieces_load_speed ~= 0 then return end
|
||||
for x = 1, global.chunk_pieces_load_amount, 1 do
|
||||
local i, z = next(global.chunk_pieces, nil)
|
||||
if not i then return end
|
||||
for _, f in pairs(chunk_functions) do
|
||||
f(global.chunk_pieces[i])
|
||||
end
|
||||
global.chunk_pieces[i] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
]]--
|
||||
|
||||
--add custom terrain functions here
|
||||
lazy_chunk_loader.add = function(f)
|
||||
table.insert(chunk_functions, f)
|
||||
end
|
||||
|
||||
event.add(defines.events.on_tick, on_tick)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
event.add(defines.events.on_chunk_generated, on_chunk_generated)
|
||||
|
||||
return lazy_chunk_loader
|
@ -1,10 +1,10 @@
|
||||
local playsession = {
|
||||
{"mewmew", {614207}},
|
||||
{"Drezik99", {113672}},
|
||||
{"mewmew", {1143298}},
|
||||
{"Drezik99", {116940}},
|
||||
{"Akitae", {65389}},
|
||||
{"ANV1L", {407333}},
|
||||
{"ANV1L", {930379}},
|
||||
{"anonieme_beer", {367781}},
|
||||
{"vvictor", {142462}},
|
||||
{"vvictor", {542340}},
|
||||
{"opasuke", {6222}},
|
||||
{"cinzhal", {101026}},
|
||||
{"Itai795", {362520}},
|
||||
@ -16,8 +16,24 @@ local playsession = {
|
||||
{"Pentbot", {42522}},
|
||||
{"Fobas", {19821}},
|
||||
{"Serikai", {18416}},
|
||||
{"SpwnX", {1357}},
|
||||
{"swake", {93382}},
|
||||
{"Xonic6", {3594}}
|
||||
{"SpwnX", {321116}},
|
||||
{"swake", {183186}},
|
||||
{"Xonic6", {3594}},
|
||||
{"niko8", {26720}},
|
||||
{"Dominoscraft", {2993}},
|
||||
{"pfg", {7781}},
|
||||
{"MFerrari", {3349}},
|
||||
{"esquerdo21", {7707}},
|
||||
{"Skanderbeg", {1815}},
|
||||
{"vimp", {8087}},
|
||||
{"pickles28", {18277}},
|
||||
{"MrWill", {42884}},
|
||||
{"Alordex", {126145}},
|
||||
{"willzcn", {56986}},
|
||||
{"cocoilove", {22271}},
|
||||
{"ChaosVanguard", {156788}},
|
||||
{"soni", {175545}},
|
||||
{"Kissthisangel", {144622}},
|
||||
{"Leahcim", {27749}}
|
||||
}
|
||||
return playsession
|
@ -1,18 +1,18 @@
|
||||
local playsession = {
|
||||
{"mewmew", {928470}},
|
||||
{"redlabel", {1458920}},
|
||||
{"ANV1L", {236969}},
|
||||
{"mewmew", {1149229}},
|
||||
{"redlabel", {1684312}},
|
||||
{"ANV1L", {300588}},
|
||||
{"opasuke", {1204692}},
|
||||
{"Itai795", {303518}},
|
||||
{"anonieme_beer", {3068}},
|
||||
{"abrown4521", {339098}},
|
||||
{"maate", {1073034}},
|
||||
{"Jhumekes", {195435}},
|
||||
{"Drezik99", {87380}},
|
||||
{"Drezik99", {88901}},
|
||||
{"legendary_banana", {10341}},
|
||||
{"Dreamon5410", {2923}},
|
||||
{"Waldlaeufer17", {38039}},
|
||||
{"Catbert", {24303}},
|
||||
{"Catbert", {31295}},
|
||||
{"Pentbot", {206417}},
|
||||
{"magge026", {489958}},
|
||||
{"Birdz", {1525355}},
|
||||
@ -20,8 +20,8 @@ local playsession = {
|
||||
{"MetonymicalInsanity", {343281}},
|
||||
{"sloeman", {242913}},
|
||||
{"ajicurry", {150737}},
|
||||
{"vvictor", {334080}},
|
||||
{"TheFlameWillFade", {161797}},
|
||||
{"vvictor", {351122}},
|
||||
{"TheFlameWillFade", {181369}},
|
||||
{"Chmizuno", {2033}},
|
||||
{"wubwub69_", {179387}},
|
||||
{"Wernast", {94475}},
|
||||
@ -34,7 +34,7 @@ local playsession = {
|
||||
{"Eject-Master", {432002}},
|
||||
{"vedolv", {628576}},
|
||||
{"kendoctor", {2509758}},
|
||||
{"StandaardStefan", {2515991}},
|
||||
{"StandaardStefan", {3385934}},
|
||||
{"hobbitmax", {148090}},
|
||||
{"Biobuur", {127770}},
|
||||
{"fou_shad", {321273}},
|
||||
@ -46,16 +46,16 @@ local playsession = {
|
||||
{"SzubiX", {2011}},
|
||||
{"grahamm", {143356}},
|
||||
{"Irx99", {177795}},
|
||||
{"sexyflanders", {373678}},
|
||||
{"sexyflanders", {1873731}},
|
||||
{"Didalus", {821118}},
|
||||
{"thaurond", {77079}},
|
||||
{"Wadiyatalkinbeet", {5741}},
|
||||
{"StarLite", {719812}},
|
||||
{"GuidoCram", {191243}},
|
||||
{"fce2", {526742}},
|
||||
{"fce2", {1185588}},
|
||||
{"liuqiang", {20754}},
|
||||
{"HighInFiberOptics", {3267}},
|
||||
{"kagami3287", {113183}},
|
||||
{"kagami3287", {126668}},
|
||||
{"MtheB", {27421}},
|
||||
{"Aoti", {13068}},
|
||||
{"Methir", {34537}},
|
||||
@ -77,7 +77,7 @@ local playsession = {
|
||||
{"Serikai", {27711}},
|
||||
{"Fobas", {30006}},
|
||||
{"Bawz", {5081}},
|
||||
{"blesmrt", {1215923}},
|
||||
{"blesmrt", {1512661}},
|
||||
{"dangomushi", {6898}},
|
||||
{"MrTea", {113679}},
|
||||
{"Sprayl", {9618}},
|
||||
@ -94,7 +94,7 @@ local playsession = {
|
||||
{"coreyellow1", {80619}},
|
||||
{"Lagger289", {145721}},
|
||||
{"pigwithtach", {58458}},
|
||||
{"Raijin-Kizuku", {871452}},
|
||||
{"Raijin-Kizuku", {1112389}},
|
||||
{"Nikolaus3943", {41712}},
|
||||
{"Dmitry8266", {56145}},
|
||||
{"anmac1", {25061}},
|
||||
@ -119,30 +119,30 @@ local playsession = {
|
||||
{"Hr.Jemine", {58640}},
|
||||
{"petr4popelka", {34685}},
|
||||
{"Tordhen", {46844}},
|
||||
{"Wizard7187", {368970}},
|
||||
{"Wizard7187", {790400}},
|
||||
{"rubafix", {4249}},
|
||||
{"ZaRRiTE", {126994}},
|
||||
{"Voltar_2000", {53650}},
|
||||
{"Schallfalke", {196918}},
|
||||
{"Schallfalke", {1833024}},
|
||||
{"SpaceLordBE", {43504}},
|
||||
{"Sinders", {7923}},
|
||||
{"swake", {201141}},
|
||||
{"swake", {1277912}},
|
||||
{"Uhhhhh55", {61393}},
|
||||
{"Guitoune", {1219}},
|
||||
{"satanpekelnik", {25901}},
|
||||
{"Bargu", {1042197}},
|
||||
{"Bargu", {2443800}},
|
||||
{"nameless_imp", {34586}},
|
||||
{"SandmanNL", {6078}},
|
||||
{"Eylrid", {8100}},
|
||||
{"DoxxMulder", {57316}},
|
||||
{"Sholvo", {120850}},
|
||||
{"legogo29", {153159}},
|
||||
{"legogo29", {2172049}},
|
||||
{"luziferius", {574093}},
|
||||
{"SuperDerpWizard", {119223}},
|
||||
{"Dominoscraft", {35988}},
|
||||
{"llamaben54", {5427}},
|
||||
{"amferes", {20625}},
|
||||
{"Terarink", {1772031}},
|
||||
{"Terarink", {4501500}},
|
||||
{"zhyko", {5891}},
|
||||
{"ZombieMooose", {11994}},
|
||||
{"mobieh22", {10010}},
|
||||
@ -162,12 +162,12 @@ local playsession = {
|
||||
{"dragon12129", {4528}},
|
||||
{"Alordex", {75781}},
|
||||
{"alnmike", {1304}},
|
||||
{"GordonGiraffe", {79754}},
|
||||
{"GordonGiraffe", {91903}},
|
||||
{"pfg", {5688}},
|
||||
{"TmgNukem", {32524}},
|
||||
{"PlumpCat", {29186}},
|
||||
{"kmarcusm", {146131}},
|
||||
{"dpoba", {857902}},
|
||||
{"dpoba", {1790800}},
|
||||
{"LycostA", {11503}},
|
||||
{"lazerandy", {109856}},
|
||||
{"Furancebob", {371010}},
|
||||
@ -178,7 +178,7 @@ local playsession = {
|
||||
{"wengPC", {1965}},
|
||||
{"Ravengyre", {463}},
|
||||
{"Cheeseftw", {4829}},
|
||||
{"arondir", {3844}},
|
||||
{"arondir", {10290}},
|
||||
{"XaLpHa1989", {19673}},
|
||||
{"Schematix", {294}},
|
||||
{"dac9", {2596}},
|
||||
@ -189,6 +189,47 @@ local playsession = {
|
||||
{"SmotPokin42000", {533564}},
|
||||
{"mix89nur", {5455}},
|
||||
{"fishpig117", {112961}},
|
||||
{"Yumiyumi2", {1341}}
|
||||
{"Yumiyumi2", {1341}},
|
||||
{"soni", {19967}},
|
||||
{"MrMlee", {1147199}},
|
||||
{"ScarpaK", {1173024}},
|
||||
{"Asteroz", {23406}},
|
||||
{"Avelix", {27477}},
|
||||
{"fusionross", {3079}},
|
||||
{"JACEK_K", {81190}},
|
||||
{"stingerboy", {5737}},
|
||||
{"DDTcz", {4197}},
|
||||
{"CaptainPiggie", {22204}},
|
||||
{"darkanturian", {25068}},
|
||||
{"Epic_Novice", {17331}},
|
||||
{"cerebr0n", {10576}},
|
||||
{"Fexx", {4919}},
|
||||
{"Pokka", {1685}},
|
||||
{"Tulmius", {53861}},
|
||||
{"Cubicgraphics", {1249}},
|
||||
{"Nexarius", {2584}},
|
||||
{"drigone", {4041}},
|
||||
{"penguincc3", {4677}},
|
||||
{"4pRiL", {22908}},
|
||||
{"PlatanoMangu", {35560}},
|
||||
{"HydraX26", {408560}},
|
||||
{"Ronin114", {16128}},
|
||||
{"Minra", {16738}},
|
||||
{"darkl0rd", {31390}},
|
||||
{"loki1224", {4108}},
|
||||
{"TickTack0", {24409}},
|
||||
{"Ethan1997", {5181}},
|
||||
{"Lgyts", {5764}},
|
||||
{"ManuelG", {2304}},
|
||||
{"killthekid", {14393}},
|
||||
{"dog80", {5628}},
|
||||
{"qseqse97", {6502}},
|
||||
{"Tamika", {3485}},
|
||||
{"Turboknot", {104782}},
|
||||
{"StarPirate", {29705}},
|
||||
{"tystroyer9001", {10050}},
|
||||
{"Rick556", {141254}},
|
||||
{"i9962784", {20629}},
|
||||
{"mgbparrot", {91045}}
|
||||
}
|
||||
return playsession
|
@ -34,7 +34,7 @@ local function on_player_joined_game(event)
|
||||
if not global.tracker_init_done then
|
||||
global.movement_done = 0
|
||||
global.file_name = ""
|
||||
global.movement_amount_required = 8
|
||||
global.movement_amount_required = 16
|
||||
global.player_totals = {}
|
||||
for _, session in pairs(play_sessions) do
|
||||
for _, player_data in pairs(session) do
|
||||
|
Loading…
x
Reference in New Issue
Block a user