mirror of
https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git
synced 2025-01-30 03:38:00 +02:00
Moving around stuff, about to test on headless.
This commit is contained in:
parent
07de8d1fe5
commit
e1839a8756
22
config.lua
22
config.lua
@ -287,7 +287,7 @@ MIN_ONLINE_TIME = TICKS_PER_MINUTE * MIN_ONLINE_TIME_IN_MINUTES
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Enable/Disable enemy expansion
|
||||
ENEMY_EXPANSION = true
|
||||
ENEMY_EXPANSION = false
|
||||
|
||||
-- Divide the alien evolution factors by this number to reduce it (or multiply if < 1)
|
||||
ENEMY_TIME_FACTOR_DISABLE = false -- Set this to true to disable time based evolution completely.
|
||||
@ -352,6 +352,8 @@ AUTOFILL_TURRET_AMMO_QUANTITY = 10
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- Set this to true if you are creating the scenario at the cmd line.
|
||||
-- Set this to false if you want to configure the world settings using the in-game
|
||||
-- scenario settings.
|
||||
CMD_LINE_MAP_GEN = true
|
||||
|
||||
-- Adjust settings here to set your map stuff.
|
||||
@ -367,14 +369,14 @@ global.clMapGen.width = 2000000
|
||||
|
||||
-- These are my go to default vanilla settings, it's not RSO, but it's okay.
|
||||
global.clMapGen.autoplace_controls = {
|
||||
["coal"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["copper-ore"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["crude-oil"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["enemy-base"] = {frequency = 0.20, richness = 1.00, size = 0.50},
|
||||
["iron-ore"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["stone"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["trees"] = {frequency = 0.20, richness = 1.00, size = 1.50},
|
||||
["uranium-ore"] = {frequency = 0.20, richness = 1.00, size = 1.50}
|
||||
["coal"] = {frequency = 0.20, richness = 0.50, size = 1.50},
|
||||
["copper-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50},
|
||||
["crude-oil"] = {frequency = 0.20, richness = 0.50, size = 1.50},
|
||||
["enemy-base"] = {frequency = 0.20, richness = 0.50, size = 0.50},
|
||||
["iron-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50},
|
||||
["stone"] = {frequency = 0.20, richness = 0.50, size = 1.50},
|
||||
["trees"] = {frequency = 0.50, richness = 1.00, size = 1.50},
|
||||
["uranium-ore"] = {frequency = 0.20, richness = 0.50, size = 1.50}
|
||||
}
|
||||
|
||||
-- Cliff defaults are 10 and 10, set both to 0 to turn cliffs off I think?
|
||||
@ -390,7 +392,7 @@ global.clMapGen.property_expression_names = {
|
||||
["control-setting:aux:frequency:multiplier"] = "1.00",
|
||||
["control-setting:moisture:bias"] = "0.00",
|
||||
["control-setting:moisture:frequency:multiplier"] = "1.00",
|
||||
elevation = "0_17-islands+continents"
|
||||
-- elevation = "0_17-islands+continents"
|
||||
}
|
||||
|
||||
|
||||
|
30
control.lua
30
control.lua
@ -1,5 +1,5 @@
|
||||
-- control.lua
|
||||
-- Apr 2017
|
||||
-- Mar 2019
|
||||
|
||||
-- Oarc's Separated Spawn Scenario
|
||||
--
|
||||
@ -16,31 +16,31 @@
|
||||
|
||||
|
||||
|
||||
-- To keep the scenario more manageable I have done the following:
|
||||
-- To keep the scenario more manageable (for myself) I have done the following:
|
||||
-- 1. Keep all event calls in control.lua (here)
|
||||
-- 2. Put all config options in config.lua
|
||||
-- 3. Put mods into their own files where possible (RSO has multiple)
|
||||
-- 3. Put other stuff into their own files where possible.
|
||||
|
||||
|
||||
-- Generic Utility Includes
|
||||
require("oarc_utils")
|
||||
-- require("locale/rso/rso_control")
|
||||
-- require("locale/frontier_silo")
|
||||
-- require("locale/tag")
|
||||
-- require("locale/game_opts")
|
||||
require("lib/oarc_utils")
|
||||
-- require("lib/rso/rso_control")
|
||||
-- require("lib/frontier_silo")
|
||||
-- require("lib/tag")
|
||||
require("lib/game_opts")
|
||||
|
||||
-- For Philip. I currently do not use this and need to add proper support for
|
||||
-- commands like this in the future.
|
||||
-- require("locale/temp/rgcommand")
|
||||
-- require("locale/temp/helper_commands")
|
||||
-- require("lib/temp/rgcommand")
|
||||
-- require("lib/temp/helper_commands")
|
||||
|
||||
-- Main Configuration File
|
||||
require("config")
|
||||
|
||||
-- Scenario Specific Includes
|
||||
require("separate_spawns")
|
||||
require("separate_spawns_guis")
|
||||
require("regrowth_map")
|
||||
require("lib/separate_spawns")
|
||||
require("lib/separate_spawns_guis")
|
||||
-- require("regrowth_map")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Rocket Launch Event Code
|
||||
@ -188,7 +188,7 @@ script.on_event(defines.events.on_gui_click, function(event)
|
||||
SharedSpawnJoinWaitMenuClick(event)
|
||||
end
|
||||
|
||||
-- GameOptionsGuiClick(event)
|
||||
GameOptionsGuiClick(event)
|
||||
|
||||
end)
|
||||
|
||||
@ -205,7 +205,7 @@ end)
|
||||
----------------------------------------
|
||||
script.on_event(defines.events.on_player_joined_game, function(event)
|
||||
|
||||
-- CreateGameOptionsGui(event)
|
||||
CreateGameOptionsGui(event)
|
||||
|
||||
PlayerJoinedMessages(event)
|
||||
|
||||
|
318
lib/frontier_silo.lua
Normal file
318
lib/frontier_silo.lua
Normal file
@ -0,0 +1,318 @@
|
||||
-- frontier_silo.lua
|
||||
-- Jan 2018
|
||||
-- My take on frontier silos for my Oarc scenario
|
||||
|
||||
require("config")
|
||||
require("locale/oarc_utils")
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- Frontier style rocket silo stuff
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- This creates a random silo position, stored to global.siloPosition
|
||||
-- It uses the config setting SILO_CHUNK_DISTANCE and spawns the silo somewhere
|
||||
-- on a circle edge with radius using that distance.
|
||||
function SetRandomSiloPosition(num_silos)
|
||||
if (global.siloPosition == nil) then
|
||||
|
||||
global.siloPosition = {}
|
||||
|
||||
random_angle_offset = math.random(0, math.pi * 2)
|
||||
|
||||
for i=1,num_silos do
|
||||
theta = ((math.pi * 2) / num_silos);
|
||||
angle = (theta * i) + random_angle_offset;
|
||||
|
||||
tx = (SILO_CHUNK_DISTANCE*CHUNK_SIZE * math.cos(angle))
|
||||
ty = (SILO_CHUNK_DISTANCE*CHUNK_SIZE * math.sin(angle))
|
||||
|
||||
table.insert(global.siloPosition, {x=math.floor(tx), y=math.floor(ty)})
|
||||
|
||||
log("Silo position: " .. tx .. ", " .. ty .. ", " .. angle)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Sets the global.siloPosition var to the set in the config file
|
||||
function SetFixedSiloPosition(pos)
|
||||
if (global.siloPosition == nil) then
|
||||
global.siloPosition = {}
|
||||
table.insert(global.siloPosition, SILO_POSITION)
|
||||
end
|
||||
end
|
||||
|
||||
-- Create a rocket silo at the specified positionmmmm
|
||||
-- Also makes sure tiles and entities are cleared if required.
|
||||
local function CreateRocketSilo(surface, siloPosition, force)
|
||||
|
||||
-- Delete any entities beneath the silo?
|
||||
for _, entity in pairs(surface.find_entities_filtered{area = {{siloPosition.x-5,
|
||||
siloPosition.y-6},
|
||||
{siloPosition.x+6,
|
||||
siloPosition.y+6}}}) do
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
-- Remove nearby enemies again
|
||||
for _, entity in pairs(surface.find_entities_filtered{area = {{siloPosition.x-(CHUNK_SIZE*4),
|
||||
siloPosition.y-(CHUNK_SIZE*4)},
|
||||
{siloPosition.x+(CHUNK_SIZE*4),
|
||||
siloPosition.y+(CHUNK_SIZE*4)}}, force = "enemy"}) do
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
-- Set tiles below the silo
|
||||
tiles = {}
|
||||
i = 1
|
||||
for dx = -5,5 do
|
||||
for dy = -6,5 do
|
||||
tiles[i] = {name = "concrete", position = {siloPosition.x+dx, siloPosition.y+dy}}
|
||||
i=i+1
|
||||
end
|
||||
end
|
||||
surface.set_tiles(tiles, true)
|
||||
|
||||
-- Create indestructible silo and assign to a force
|
||||
local silo = surface.create_entity{name = "rocket-silo", position = {siloPosition.x+0.5, siloPosition.y}, force = force}
|
||||
silo.destructible = false
|
||||
silo.minable = false
|
||||
|
||||
-- Make silo safe from being removed by regrowth
|
||||
if ENABLE_REGROWTH then
|
||||
OarcRegrowthOffLimits(siloPosition, 5)
|
||||
end
|
||||
|
||||
|
||||
if ENABLE_SILO_BEACONS then
|
||||
PhilipsBeaconsAndShit(surface, siloPosition, game.forces[MAIN_FORCE])
|
||||
end
|
||||
if ENABLE_SILO_RADAR then
|
||||
PhilipsRadarAndShit(surface, siloPosition, game.forces[MAIN_FORCE])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Generates all rocket silos, should be called after the areas are generated
|
||||
-- Includes a crop circle
|
||||
function GenerateAllSilos(surface)
|
||||
|
||||
-- Create each silo in the list
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
CreateRocketSilo(surface, siloPos, MAIN_FORCE)
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate clean land and trees around silo area on chunk generate event
|
||||
function GenerateRocketSiloChunk(event)
|
||||
|
||||
-- Silo generation can take awhile depending on the number of silos.
|
||||
if (game.tick < SILO_NUM_SPAWNS*10*TICKS_PER_SECOND) then
|
||||
local surface = event.surface
|
||||
local chunkArea = event.area
|
||||
|
||||
local chunkAreaCenter = {x=chunkArea.left_top.x+(CHUNK_SIZE/2),
|
||||
y=chunkArea.left_top.y+(CHUNK_SIZE/2)}
|
||||
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
local safeArea = {left_top=
|
||||
{x=siloPos.x-(CHUNK_SIZE*4),
|
||||
y=siloPos.y-(CHUNK_SIZE*4)},
|
||||
right_bottom=
|
||||
{x=siloPos.x+(CHUNK_SIZE*4),
|
||||
y=siloPos.y+(CHUNK_SIZE*4)}}
|
||||
|
||||
|
||||
-- Clear enemies directly next to the rocket
|
||||
if CheckIfInArea(chunkAreaCenter,safeArea) then
|
||||
for _, entity in pairs(surface.find_entities_filtered{area = chunkArea, force = "enemy"}) do
|
||||
entity.destroy()
|
||||
end
|
||||
|
||||
-- Remove trees/resources inside the spawn area
|
||||
RemoveInCircle(surface, chunkArea, "tree", siloPos, ENFORCE_LAND_AREA_TILE_DIST+5)
|
||||
RemoveInCircle(surface, chunkArea, "resource", siloPos, ENFORCE_LAND_AREA_TILE_DIST+5)
|
||||
RemoveInCircle(surface, chunkArea, "cliff", siloPos, ENFORCE_LAND_AREA_TILE_DIST+5)
|
||||
RemoveDecorationsArea(surface, chunkArea)
|
||||
|
||||
-- Create rocket silo
|
||||
CreateCropOctagon(surface, siloPos, chunkArea, CHUNK_SIZE*2)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Generate chunks where we plan to place the rocket silos.
|
||||
function GenerateRocketSiloAreas(surface)
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
if (ENABLE_SILO_VISION) then
|
||||
ChartRocketSiloAreas(surface, game.forces[MAIN_FORCE])
|
||||
end
|
||||
surface.request_to_generate_chunks({siloPos.x, siloPos.y}, 3)
|
||||
end
|
||||
end
|
||||
|
||||
-- Chart chunks where we plan to place the rocket silos.
|
||||
function ChartRocketSiloAreas(surface, force)
|
||||
for idx,siloPos in pairs(global.siloPosition) do
|
||||
force.chart(surface, {{siloPos.x-(CHUNK_SIZE*2),
|
||||
siloPos.y-(CHUNK_SIZE*2)},
|
||||
{siloPos.x+(CHUNK_SIZE*2),
|
||||
siloPos.y+(CHUNK_SIZE*2)}})
|
||||
end
|
||||
end
|
||||
|
||||
global.oarc_silos_generated = false
|
||||
function DelayedSiloCreationOnTick(event)
|
||||
|
||||
-- Delay the creation of the silos so we place them on already generated lands.
|
||||
if (not global.oarc_silos_generated and (game.tick >= SILO_NUM_SPAWNS*10*TICKS_PER_SECOND)) then
|
||||
DebugPrint("Frontier silos generated!")
|
||||
global.oarc_silos_generated = true
|
||||
GenerateAllSilos(game.surfaces[GAME_SURFACE_NAME])
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
function PhilipsBeaconsAndShit(surface, siloPos, force)
|
||||
|
||||
-- Add Beacons
|
||||
-- x = right, left; y = up, down
|
||||
-- top 1 left 1
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-8, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- top 2
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-5, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- top 3
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-2, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- top 4
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+2, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- top 5
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+5, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- top 6 right 1
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+8, siloPos.y-9}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 2
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-6, siloPos.y-6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 3
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-6, siloPos.y-3}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 4
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-6, siloPos.y}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 5
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-6, siloPos.y+3}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 6 bottom 1
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-8, siloPos.y+6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- left 7 bottom 2
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x-5, siloPos.y+6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 2
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+6, siloPos.y-6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 3
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+6, siloPos.y-3}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 4
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+6, siloPos.y}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 5
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+6, siloPos.y+3}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 6 bottom 3
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+5, siloPos.y+6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- right 7 bottom 4
|
||||
local beacon = surface.create_entity{name = "beacon", position = {siloPos.x+8, siloPos.y+6}, force = force}
|
||||
beacon.destructible = false
|
||||
beacon.minable = false
|
||||
-- substations
|
||||
-- top left
|
||||
local substation = surface.create_entity{name = "substation", position = {siloPos.x-8, siloPos.y-6}, force = force}
|
||||
substation.destructible = false
|
||||
substation.minable = false
|
||||
-- top right
|
||||
local substation = surface.create_entity{name = "substation", position = {siloPos.x+9, siloPos.y-6}, force = force}
|
||||
substation.destructible = false
|
||||
substation.minable = false
|
||||
-- bottom left
|
||||
local substation = surface.create_entity{name = "substation", position = {siloPos.x-8, siloPos.y+4}, force = force}
|
||||
substation.destructible = false
|
||||
substation.minable = false
|
||||
-- bottom right
|
||||
local substation = surface.create_entity{name = "substation", position = {siloPos.x+9, siloPos.y+4}, force = force}
|
||||
substation.destructible = false
|
||||
substation.minable = false
|
||||
|
||||
-- end adding beacons
|
||||
end
|
||||
|
||||
function PhilipsRadarAndShit(surface, siloPos, force)
|
||||
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-33, siloPos.y+3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-33, siloPos.y-3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-30, siloPos.y-6}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-27, siloPos.y-6}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-24, siloPos.y-6}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-24, siloPos.y-3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-24, siloPos.y}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-24, siloPos.y+3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-33, siloPos.y-6}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-30, siloPos.y+3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "solar-panel", position = {siloPos.x-27, siloPos.y+3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "radar", position = {siloPos.x-33, siloPos.y}, force = force}
|
||||
radar.destructible = false
|
||||
local substation = surface.create_entity{name = "substation", position = {siloPos.x-28, siloPos.y-1}, force = force}
|
||||
substation.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-30, siloPos.y-1}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-30, siloPos.y-3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-30, siloPos.y+1}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-28, siloPos.y-3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-28, siloPos.y+1}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-26, siloPos.y-1}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-26, siloPos.y-3}, force = force}
|
||||
radar.destructible = false
|
||||
local radar = surface.create_entity{name = "accumulator", position = {siloPos.x-26, siloPos.y+1}, force = force}
|
||||
radar.destructible = false
|
||||
end
|
145
lib/game_opts.lua
Normal file
145
lib/game_opts.lua
Normal file
@ -0,0 +1,145 @@
|
||||
-- game_opts.lua
|
||||
-- Jan 2018
|
||||
-- Display current game options, maybe have some admin controls here
|
||||
|
||||
-- Main Configuration File
|
||||
require("config")
|
||||
require("lib/oarc_utils")
|
||||
|
||||
function CreateGameOptionsGui(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.gui.top.game_options == nil then
|
||||
player.gui.top.add{name="game_options", type="button", caption="Info"}
|
||||
end
|
||||
end
|
||||
|
||||
local function ExpandGameOptionsGui(player)
|
||||
local frame = player.gui.left["game_options_panel"]
|
||||
if (frame) then
|
||||
frame.destroy()
|
||||
else
|
||||
local frame = player.gui.left.add{type="frame",
|
||||
name="game_options_panel",
|
||||
caption="Server Info:",
|
||||
direction="vertical"}
|
||||
|
||||
-- General Server Info:
|
||||
AddLabel(frame, "info_1", global.welcome_msg, my_longer_label_style)
|
||||
AddLabel(frame, "info_2", SERVER_MSG, my_longer_label_style)
|
||||
AddSpacer(frame, "info_spacer1")
|
||||
|
||||
-- Enemy Settings:
|
||||
local enemy_expansion_txt = "disabled"
|
||||
if game.map_settings.enemy_expansion.enabled then enemy_expansion_txt = "enabled" end
|
||||
|
||||
local enemy_text="Server Run Time: " .. formattime_hours_mins(game.tick) .. "\n" ..
|
||||
"Current Evolution: " .. string.format("%.4f", game.forces["enemy"].evolution_factor) .. "\n" ..
|
||||
"Enemy evolution time factor: " .. game.map_settings.enemy_evolution.time_factor .. "\n" ..
|
||||
"Enemy evolution pollution factor: " .. game.map_settings.enemy_evolution.pollution_factor .. "\n" ..
|
||||
"Enemy evolution destroy factor: " .. game.map_settings.enemy_evolution.destroy_factor .. "\n" ..
|
||||
"Enemy expansion is " .. enemy_expansion_txt
|
||||
|
||||
AddLabel(frame, "enemy_info", enemy_text, my_longer_label_style)
|
||||
AddSpacer(frame, "enemy_info_spacer1")
|
||||
|
||||
-- Game Mode:
|
||||
AddLabel(frame, "core_mod_en", "Core game mode (separate spawns) is enabled.", my_longer_label_style)
|
||||
if (not ENABLE_SEPARATE_SPAWNS) then
|
||||
frame.core_mod_en.caption="Core game mode (separate spawns) is DISABLED."
|
||||
frame.core_mod_en.style.font_color=my_color_red
|
||||
end
|
||||
|
||||
-- Soft Mods:
|
||||
local soft_mods_string = "Oarc Core"
|
||||
if (not ENABLE_SEPARATE_SPAWNS) then
|
||||
soft_mods_string = "Oarc Core [DISABLED!]"
|
||||
end
|
||||
if (ENABLE_RSO) then
|
||||
soft_mods_string = soft_mods_string .. ", RSO"
|
||||
end
|
||||
if (ENABLE_UNDECORATOR) then
|
||||
soft_mods_string = soft_mods_string .. ", Undecorator"
|
||||
end
|
||||
if (ENABLE_TAGS) then
|
||||
soft_mods_string = soft_mods_string .. ", Tags"
|
||||
end
|
||||
if (ENABLE_LONGREACH) then
|
||||
soft_mods_string = soft_mods_string .. ", Long Reach"
|
||||
end
|
||||
if (ENABLE_AUTOFILL) then
|
||||
soft_mods_string = soft_mods_string .. ", Auto Fill"
|
||||
end
|
||||
if (ENABLE_PLAYER_LIST) then
|
||||
soft_mods_string = soft_mods_string .. ", Player List"
|
||||
end
|
||||
|
||||
local game_info_str = "Soft Mods Enabled: " .. soft_mods_string
|
||||
|
||||
-- Spawn options:
|
||||
if (ENABLE_SEPARATE_TEAMS) then
|
||||
game_info_str = game_info_str.."\n".."You are allowed to spawn on your own team (have your own research tree). All teams are friendly!"
|
||||
end
|
||||
if (ENABLE_BUDDY_SPAWN) then
|
||||
game_info_str = game_info_str.."\n".."You can chose to spawn alongside a buddy if you spawn together at the same time."
|
||||
end
|
||||
if (ENABLE_SHARED_SPAWNS) then
|
||||
game_info_str = game_info_str.."\n".."Spawn hosts may choose to share their spawn and allow other players to join them."
|
||||
end
|
||||
if (ENABLE_SEPARATE_TEAMS and ENABLE_SHARED_TEAM_VISION) then
|
||||
game_info_str = game_info_str.."\n".."Everyone (all teams) have shared vision."
|
||||
end
|
||||
if (FRONTIER_ROCKET_SILO_MODE) then
|
||||
game_info_str = game_info_str.."\n".."Silos are NOT craftable. There is at least one already located on the map."
|
||||
end
|
||||
if (ENABLE_REGROWTH) then
|
||||
game_info_str = game_info_str.."\n".."Old parts of the map will slowly be deleted over time (chunks without any player buildings)."
|
||||
end
|
||||
if (ENABLE_POWER_ARMOR_QUICK_START) then
|
||||
game_info_str = game_info_str.."\n".."Power armor quick start enabled."
|
||||
end
|
||||
|
||||
AddLabel(frame, "game_info_label", game_info_str, my_longer_label_style)
|
||||
|
||||
if (ENABLE_ABANDONED_BASE_REMOVAL) then
|
||||
AddLabel(frame, "leave_warning_msg", "If you leave within " .. MIN_ONLINE_TIME_IN_MINUTES .. " minutes of joining, your base and character will be deleted.", my_longer_label_style)
|
||||
frame.leave_warning_msg.style.font_color=my_color_red
|
||||
end
|
||||
|
||||
-- Ending Spacer
|
||||
AddSpacer(frame, "end_spacer")
|
||||
|
||||
-- ADMIN CONTROLS
|
||||
if (player.admin) then
|
||||
player_list = {}
|
||||
for _,player in pairs(game.connected_players) do
|
||||
table.insert(player_list, player.name)
|
||||
end
|
||||
frame.add{name = "ban_players_dropdown",
|
||||
type = "drop-down",
|
||||
items = player_list}
|
||||
frame.add{name="ban_player", type="button", caption="Ban Player"}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function GameOptionsGuiClick(event)
|
||||
if not (event and event.element and event.element.valid) then return end
|
||||
local player = game.players[event.element.player_index]
|
||||
local name = event.element.name
|
||||
|
||||
if (name == "game_options") then
|
||||
ExpandGameOptionsGui(player)
|
||||
end
|
||||
|
||||
if (name == "ban_player") then
|
||||
banIndex = event.element.parent.ban_players_dropdown.selected_index
|
||||
|
||||
if (banIndex ~= 0) then
|
||||
banPlayer = event.element.parent.ban_players_dropdown.get_item(banIndex)
|
||||
if (game.players[banPlayer]) then
|
||||
game.ban_player(banPlayer, "Banned for griefing - Banned from admin panel.")
|
||||
DebugPrint("Banning " .. banPlayer)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
67
lib/helper_commands.lua
Normal file
67
lib/helper_commands.lua
Normal file
@ -0,0 +1,67 @@
|
||||
-- helper_commands.lua
|
||||
-- Jan 2018
|
||||
-- None of this is my code.
|
||||
|
||||
require("locale/oarc_utils")
|
||||
|
||||
commands.add_command("run", "change player speed bonus", function(command)
|
||||
local player = game.players[command.player_index];
|
||||
if player ~= nil then
|
||||
if (command.parameter ~= nil) then
|
||||
if command.parameter == "fast" then
|
||||
player.character_running_speed_modifier = 1
|
||||
elseif command.parameter == "slow" then
|
||||
player.character_running_speed_modifier = 0
|
||||
else
|
||||
player.print("run fast | slow");
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command("handcraft", "change player speed bonus", function(command)
|
||||
local player = game.players[command.player_index];
|
||||
if player ~= nil then
|
||||
if (command.parameter ~= nil) then
|
||||
if command.parameter == "fast" then
|
||||
player.character_crafting_speed_modifier = 5
|
||||
elseif command.parameter == "slow" then
|
||||
player.character_crafting_speed_modifier = 0
|
||||
else
|
||||
player.print("handcraft fast | slow");
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command("mine", "change player speed bonus", function(command)
|
||||
local player = game.players[command.player_index];
|
||||
if player ~= nil then
|
||||
if (command.parameter ~= nil) then
|
||||
if command.parameter == "fast" then
|
||||
player.character_mining_speed_modifier = 2
|
||||
elseif command.parameter == "slow" then
|
||||
player.character_mining_speed_modifier = 0
|
||||
else
|
||||
player.print("mine fast | slow");
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
commands.add_command("kit", "give a start kit", function(command)
|
||||
local player = game.players[command.player_index];
|
||||
if player ~= nil and player.admin then
|
||||
local target = player
|
||||
if (command.parameter ~= nil) then
|
||||
target = game.players[command.parameter]
|
||||
end
|
||||
if target ~= nil then
|
||||
GivePlayerStarterItems(target);
|
||||
player.print("gave a kit to " .. target.name);
|
||||
target.print("you have been given a start kit");
|
||||
else
|
||||
player.print("no player " .. command.parameter);
|
||||
end
|
||||
end
|
||||
end)
|
@ -1018,7 +1018,7 @@ function CreateMoat(surface, centerPos, chunkArea, tileRadius)
|
||||
-- Create a circle of water
|
||||
if ((distVar < tileRadSqr+(1500*MOAT_SIZE_MODIFIER)) and
|
||||
(distVar > tileRadSqr)) then
|
||||
table.insert(waterTiles, {name = "water-shallow", position ={i,j}})
|
||||
table.insert(waterTiles, {name = "water", position ={i,j}})
|
||||
end
|
||||
|
||||
-- Enforce land inside the edges of the circle to make sure it's
|
||||
@ -1146,7 +1146,7 @@ function SetupAndClearSpawnAreas(surface, chunkArea, spawnPointTable)
|
||||
RemoveInCircle(surface, chunkArea, "tree", spawn.pos, ENFORCE_LAND_AREA_TILE_DIST)
|
||||
RemoveInCircle(surface, chunkArea, "resource", spawn.pos, ENFORCE_LAND_AREA_TILE_DIST+5)
|
||||
RemoveInCircle(surface, chunkArea, "cliff", spawn.pos, ENFORCE_LAND_AREA_TILE_DIST+5)
|
||||
RemoveDecorationsArea(surface, chunkArea)
|
||||
-- RemoveDecorationsArea(surface, chunkArea)
|
||||
|
||||
if (SPAWN_TREE_CIRCLE_ENABLED) then
|
||||
CreateCropCircle(surface, spawn.pos, chunkArea, ENFORCE_LAND_AREA_TILE_DIST)
|
@ -18,7 +18,7 @@
|
||||
-- 7. For now, oarc spawns are deletion safe as well, but only immediate area.
|
||||
|
||||
-- Generic Utility Includes
|
||||
require("oarc_utils")
|
||||
require("lib/oarc_utils")
|
||||
|
||||
|
||||
-- Default timeout of generated chunks
|
49
lib/rgcommand.lua
Normal file
49
lib/rgcommand.lua
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
local function RemoveTileGhosts()
|
||||
local surface = game.player.surface
|
||||
for c in surface.get_chunks() do
|
||||
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name= "tile-ghost"})) do
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function RemoveBlueprintedModulesGhosts()
|
||||
local surface = game.player.surface
|
||||
for c in surface.get_chunks() do
|
||||
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name= "item-request-proxy"})) do
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function RemoveGhostEntities()
|
||||
local surface = game.player.surface
|
||||
for c in surface.get_chunks() do
|
||||
for key, entity in pairs(surface.find_entities_filtered({area={{c.x * 32, c.y * 32}, {c.x * 32 + 32, c.y * 32 + 32}}, name= "entity-ghost"})) do
|
||||
entity.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
commands.add_command("rg", "remove ghosts", function(command)
|
||||
local player = game.players[command.player_index];
|
||||
if player ~= nil and player.admin then
|
||||
if (command.parameter ~= nil) then
|
||||
if command.parameter == "all" then
|
||||
RemoveTileGhosts()
|
||||
RemoveBlueprintedModulesGhosts()
|
||||
RemoveGhostEntities()
|
||||
elseif command.parameter == "tiles" then
|
||||
RemoveTileGhosts()
|
||||
elseif command.parameter == "modules" then
|
||||
RemoveBlueprintedModulesGhosts()
|
||||
elseif command.parameter == "entities" then
|
||||
RemoveGhostEntities()
|
||||
else
|
||||
player.print("remove all ghostes | tiles | modules | entities");
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
2
separate_spawns_guis.lua → lib/separate_spawns_guis.lua
Executable file → Normal file
2
separate_spawns_guis.lua → lib/separate_spawns_guis.lua
Executable file → Normal file
@ -3,7 +3,7 @@
|
||||
|
||||
-- I made a separate file for all the GUI related functions
|
||||
|
||||
require("separate_spawns")
|
||||
require("lib/separate_spawns")
|
||||
|
||||
local SPAWN_GUI_MAX_WIDTH = 500
|
||||
local SPAWN_GUI_MAX_HEIGHT = 1000
|
61
lib/tag.lua
Normal file
61
lib/tag.lua
Normal file
@ -0,0 +1,61 @@
|
||||
-- tag.lua
|
||||
-- Apr 2017
|
||||
-- Allows adding play tags
|
||||
|
||||
function CreateTagGui(event)
|
||||
local player = game.players[event.player_index]
|
||||
if player.gui.top.tag == nil then
|
||||
player.gui.top.add{name="tag", type="button", caption="Tag"}
|
||||
end
|
||||
end
|
||||
|
||||
-- Tag list
|
||||
local roles = {
|
||||
{display_name = "[Solo]"},
|
||||
{display_name = "[Mining]"},
|
||||
{display_name = "[Power]"},
|
||||
{display_name = "[Oil]"},
|
||||
{display_name = "[Smelt]"},
|
||||
{display_name = "[Rail]"},
|
||||
{display_name = "[Defense]"},
|
||||
{display_name = "[Circuits]"},
|
||||
{display_name = "[Science!]"},
|
||||
{display_name = "[Logistics]"},
|
||||
{display_name = "[Misc]"},
|
||||
{display_name = "[Aliens]"},
|
||||
{display_name = "[Rocket]"},
|
||||
{display_name = "[AFK]"},
|
||||
{display_name = "Clear"}}
|
||||
|
||||
local function ExpandTagGui(player)
|
||||
local frame = player.gui.left["tag-panel"]
|
||||
if (frame) then
|
||||
frame.destroy()
|
||||
else
|
||||
local frame = player.gui.left.add{type="frame", name="tag-panel", caption="What are you doing:"}
|
||||
for _, role in pairs(roles) do
|
||||
frame.add{type="button", caption=role.display_name, name=role.display_name}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TagGuiClick(event)
|
||||
if not (event and event.element and event.element.valid) then return end
|
||||
local player = game.players[event.element.player_index]
|
||||
local name = event.element.name
|
||||
|
||||
if (name == "tag") then
|
||||
ExpandTagGui(player)
|
||||
end
|
||||
|
||||
if (name == "Clear") then
|
||||
player.tag = ""
|
||||
return
|
||||
end
|
||||
|
||||
for _, role in pairs(roles) do
|
||||
if (name == role.display_name) then
|
||||
player.tag = role.display_name
|
||||
end
|
||||
end
|
||||
end
|
1
lib/test_lib_file.lua
Normal file
1
lib/test_lib_file.lua
Normal file
@ -0,0 +1 @@
|
||||
-- test_lib_file.lua
|
Loading…
x
Reference in New Issue
Block a user