1
0
mirror of https://github.com/Oarcinae/FactorioScenarioMultiplayerSpawn.git synced 2025-01-18 02:58:37 +02:00

Spidertron makes a visit. Also magic chunks no longer use cloud power but have their own intputs. New config file as well. Probably buggy since I made a lot of changes with minimal testing.

This commit is contained in:
Oarcinae 2020-10-03 20:59:19 -04:00
parent 2224234e9f
commit 5a42f46381
10 changed files with 609 additions and 523 deletions

View File

@ -22,7 +22,6 @@
-- 4. Put all other files into lib folder
-- 5. Provided an examples folder for example/recommended map gen settings
-- Generic Utility Includes
require("lib/oarc_utils")
@ -104,11 +103,11 @@ script.on_init(function(event)
Compat.handle_factoriomaps()
if (global.ocfg.enable_chest_sharing) then
if (global.ocfg.enable_coin_shop and global.ocfg.enable_chest_sharing) then
SharedChestInitItems()
end
if (global.ocfg.enable_chest_sharing and global.ocfg.enable_magic_factories) then
if (global.ocfg.enable_coin_shop and global.ocfg.enable_magic_factories) then
MagicFactoriesInit()
end
@ -117,13 +116,6 @@ script.on_init(function(event)
-- Display starting point text as a display of dominance.
RenderPermanentGroundText(game.surfaces[GAME_SURFACE_NAME], {x=-29,y=-30}, 40, "OARC", {0.9, 0.7, 0.3, 0.8})
rendering.draw_sprite{sprite="item/coin",
render_layer=30,
target={0,0},
surface=game.surfaces[GAME_SURFACE_NAME],
tint={r = 0.1, g = 0.1, b = 0.1, a = 0.1},
x_scale=80,
y_scale=80}
end)
script.on_load(function()
@ -183,7 +175,10 @@ script.on_event(defines.events.on_gui_click, function(event)
SharedSpawnJoinWaitMenuClick(event)
ClickOarcGuiButton(event)
ClickOarcStoreButton(event)
if global.ocfg.enable_coin_shop then
ClickOarcStoreButton(event)
end
GameOptionsGuiClick(event)
end)
@ -195,7 +190,10 @@ end)
script.on_event(defines.events.on_gui_selected_tab_changed, function (event)
TabChangeOarcGui(event)
TabChangeOarcStore(event)
if global.ocfg.enable_coin_shop then
TabChangeOarcStore(event)
end
end)
----------------------------------------
@ -219,7 +217,10 @@ script.on_event(defines.events.on_player_created, function(event)
SeparateSpawnsPlayerCreated(event.player_index, true)
InitOarcGuiTabs(player)
InitOarcStoreGuiTabs(player)
if global.ocfg.enable_coin_shop then
InitOarcStoreGuiTabs(player)
end
end)
script.on_event(defines.events.on_player_respawned, function(event)
@ -426,7 +427,9 @@ end)
----------------------------------------
script.on_event(defines.events.on_gui_closed, function(event)
OarcGuiOnGuiClosedEvent(event)
OarcStoreOnGuiClosedEvent(event)
if global.ocfg.enable_coin_shop then
OarcStoreOnGuiClosedEvent(event)
end
end)
----------------------------------------
@ -435,7 +438,9 @@ end)
----------------------------------------
script.on_event(defines.events.on_post_entity_died, function(event)
if (game.surfaces[event.surface_index].name ~= GAME_SURFACE_NAME) then return end
CoinsFromEnemiesOnPostEntityDied(event)
if global.ocfg.enable_coin_shop then
CoinsFromEnemiesOnPostEntityDied(event)
end
end,
{{filter="type", type = "unit"}, {filter="type", type = "unit-spawner"}, {filter="type", type = "turret"}})

View File

@ -1,8 +1,8 @@
-- example-config.lua (Rename this file to config.lua to use it)
-- Sep 24 2019 (updated on)
-- Oct 3 2020 (updated on)
-- Configuration Options
--
-- You should be able to leave most of the settings here as defaults.
-- You should be safe to leave most of the settings here as defaults if you want.
-- The only thing you definitely want to change are the welcome messages.
--------------------------------------------------------------------------------
@ -25,47 +25,36 @@ SCENARIO_INFO_MSG = "Latest updates in this scenario version:\n"..
CONTACT_MSG = "Contact: SteamID:Oarc | oarcinae@gmail.com | Discord:Oarc#8695"
DISCORD_INV = "discord.gg/trnpcen"
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Module Enables
--------------------------------------------------------------------------------
-- Each of the following things enable special features. These can't be changed once the game starts.
------------------------------------------------------------------------------------------------------------------------
-- Enable this to have a vanilla style starting spawn.
-- This changes the experience pretty drastically.
-- If you enable this, you will NOT get the option to spawn using the "pre-fab"
-- fixed layout spawns. This is because the spawn types just don't balance well with
-- each other.
ENABLE_VANILLA_SPAWNS = false
-- This allows 2 players to spawn next to each other in the wilderness,
-- each with their own starting point. It adds more GUI selection options.
-- This allows 2 players to spawn next to each other in the wilderness, each with their own starting point. It adds more
-- GUI selection options.
ENABLE_BUDDY_SPAWN = true
-- Frontier style rocket silo mode
-- This means you can't build silos, but some spawn out in the wild for you to use.
-- Frontier style rocket silo mode. This means you can't build silos, but some spawn out in the wild for you to use.
-- if ENABLE_MAGIC_FACTORIES=false, you will find a few special areas to launch rockets from.
-- If ENABLE_MAGIC_FACTORIES=true, you must buy a silo at one of the special chunks.
FRONTIER_ROCKET_SILO_MODE = true
-- Silo Islands
-- This options is only valid when used with ENABLE_VANILLA_SPAWNS and FRONTIER_ROCKET_SILO_MODE!
-- This spreads out rocket silos on every OTHER island/vanilla spawn
SILO_ISLANDS_MODE = false
-- Enable Undecorator
-- Removes decorative items to reduce save file size.
-- Enable Undecorator. Removes decorative items to reduce save file size.
ENABLE_UNDECORATOR = true
-- Enable Tags
-- Enable Tags (Players can add a name-tag to explain what type of role they are doing if they want.)
ENABLE_TAGS = true
-- Enable Long Reach
ENABLE_LONGREACH = true
-- Enable Autofill
-- Enable Autofill (My autofill is very simplistic, if you are using a similar mod disable this!)
ENABLE_AUTOFILL = true
-- Enable vanilla loaders
ENABLE_LOADERS = true
-- Enable auto decon of miners
-- Enable auto decon of miners (My miner decon is very simplistic, if you are using a similar mod disable this!)
ENABLE_MINER_AUTODECON = true
-- Enable Playerlist
@ -77,18 +66,20 @@ ENABLE_SHARED_TEAM_VISION = true
-- Cleans up unused chunks periodically. Helps keep map size down.
ENABLE_REGROWTH = true
-- Only works if you have the Unused Chunk Removal mod installed.
-- This removes player bases when they leave shortly after joining. Only works if you have regrowth enabled!
ENABLE_ABANDONED_BASE_REMOVAL = true
-- Enable the new 0.17 research queue by default for all forces.
-- Enable the research queue by default for all forces.
ENABLE_RESEARCH_QUEUE = true
-- Enable item & energy sharing system.
ENABLE_CHEST_SHARING = false
-- This enables coin drops from enemies and a shop (GUI) to buy stuff from.
ENABLE_COIN_SHOP = false
-- Enable magic factories around the map. (Similar to whistle stop mod)
ENABLE_MAGIC_FACTORIES = false -- REQUIRES ENABLE_CHEST_SHARING!
-- Enable item & energy sharing system.
ENABLE_ITEM_AND_ENERGY_SHARING = false -- REQUIRES ENABLE_COIN_SHOP=true!
-- Enable magic chunks around the map that let you buy powerful factories that smelt/assemble/process very very quickly.
ENABLE_MAGIC_FACTORIES = false -- REQUIRES ENABLE_COIN_SHOP=true!
-- This inhibits enemy attacks on bases where all players are offline.
-- Not 100% guaranteed.
@ -103,7 +94,7 @@ ENABLE_FORCE_LAB_PROD_BONUS = true
-- Each team/force must launch their own rocket to unlock this!
LOCK_GOODIES_UNTIL_ROCKET_LAUNCH = true
LOCKED_TECHNOLOGIES = {
{t="atomic-bomb"},{t="power-armor-mk2"},{t="artillery"}
{t="atomic-bomb"},{t="power-armor-mk2"},{t="artillery"},{t="spidertron"}
}
LOCKED_RECIPES = {
{r="productivity-module-3"},{r="speed-module-3"}
@ -111,15 +102,15 @@ LOCKED_RECIPES = {
-- Give cheaty items on start.
ENABLE_POWER_ARMOR_QUICK_START = false
ENABLE_MODULAR_ARMOR_QUICK_START = true
ENABLE_MODULAR_ARMOR_QUICK_START = false
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- MAP CONFIGURATION OPTIONS
-- In past versions I had a way to config map settings here to be used for cmd
-- line launching, but now you should just be using --map-gen-settings and
-- --map-settings option since it works with --start-server-load-scenario
-- Read the README.md file for instructions.
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- This scales resources so that even if you spawn "far away" from the center
-- of the map, resources near to your spawn point scale so you aren't
@ -127,9 +118,9 @@ ENABLE_MODULAR_ARMOR_QUICK_START = true
-- map gen settings you pick.
SCALE_RESOURCES_AROUND_SPAWNS = true
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Alien Options
--------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Adjust enemy spawning based on distance to spawns. All it does it make things
-- more balanced based on your distance and makes the game a little easier.
@ -137,18 +128,20 @@ SCALE_RESOURCES_AROUND_SPAWNS = true
-- If you're trying out the vanilla spawning, you might want to disable this.
OARC_MODIFIED_ENEMY_SPAWNING = true
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Starting Items
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Items provided to the player the first time they join
PLAYER_SPAWN_START_ITEMS = {
{name="pistol", count=1},
{name="firearm-magazine", count=200},
{name="iron-plate", count=100},
{name="burner-mining-drill", count = 4},
{name="stone-furnace", count = 4},
{name="coal", count = 50},
{name="stone", count = 50},
["pistol"]=1,
["firearm-magazine"]=200,
["iron-plate"]=100,
["burner-mining-drill"] = 4,
["stone-furnace"] = 4,
["coal"] = 50,
["stone"] = 50,
["coin"] = 2500, -- Don't give coins unless you have shared chests enabled.
}
-- Items provided after EVERY respawn (disabled by default)
@ -157,9 +150,9 @@ PLAYER_RESPAWN_START_ITEMS = {
-- {name="firearm-magazine", count=100}
}
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Distance Options
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- This is the radius, in chunks, that a spawn area is from any other generated
-- chunks. It ensures the spawn area isn't too near generated/explored/existing
@ -169,29 +162,19 @@ CHECK_SPAWN_UNGENERATED_CHUNKS_RADIUS = 10
-- Near Distance in chunks
-- When a player selects "near" spawn, they will be in or as close to this range as possible.
NEAR_MIN_DIST = 0
NEAR_MAX_DIST = 50
NEAR_MIN_DIST = 50
NEAR_MAX_DIST = 100
-- Far Distance in chunks
-- When a player selects "far" spawn, they will be at least this distance away.
FAR_MIN_DIST = 200
FAR_MAX_DIST = 300
---------------------------------------
-- Vanilla spawn point options
-- (only applicable if ENABLE_VANILLA_SPAWNS is enabled.)
---------------------------------------
-- Num total spawns pre-assigned (minimum number)
-- Points are in an even grid layout.
VANILLA_SPAWN_COUNT = 60
-- Num tiles between each spawn. (I recommend at least 1000)
VANILLA_SPAWN_SPACING = 2000
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- Resource & Spawn Circle Options
---------------------------------------
------------------------------------------------------------------------------------------------------------------------
-- This is where you can modify what resources spawn, how much, where, etc.
-- Once you have a config you like, it's a good idea to save it for later use
@ -441,9 +424,36 @@ GHOST_TIME_TO_LIVE = 10 * TICKS_PER_MINUTE
-- and stuff.
ENABLE_FRIENDLY_FIRE = false
--------------------------------------------------------------------------------
-- This turns on writing chat and certain events to specific files so that I can
-- use that for discord integration. I suggest you leave this off unless you
-- know what you are doing.
--------------------------------------------------------------------------------
ENABLE_SERVER_WRITE_FILES = false
------------------------------------------------------------------------------------------------------------------------
-- EXPERIMENTAL FEATURES
-- The following things are not recommended unless you really know what you are doing and are okay with crashes and
-- editing lua code.
------------------------------------------------------------------------------------------------------------------------
-- This turns on writing chat and certain events to specific files so that I can use that for discord integration. I
-- suggest you leave this off unless you know what you are doing.
ENABLE_SERVER_WRITE_FILES = false
-- Enable this to have a vanilla style starting spawn. This changes the experience pretty drastically. If you enable
-- this, you will NOT get the option to spawn using the "pre-fab" fixed layout spawns. This is because the spawn types
-- just don't balance well with each other.
ENABLE_VANILLA_SPAWNS = false
-- Vanilla spawn point options (only applicable if ENABLE_VANILLA_SPAWNS is enabled.)
-- Num total spawns pre-assigned (minimum number)
-- Points are in an even grid layout.
VANILLA_SPAWN_COUNT = 60
-- Num tiles between each spawn. (I recommend at least 1000)
VANILLA_SPAWN_SPACING = 2000
-- Silo Islands
-- This options is only valid when used with ENABLE_VANILLA_SPAWNS and FRONTIER_ROCKET_SILO_MODE!
-- This spreads out rocket silos on every OTHER island/vanilla spawn
SILO_ISLANDS_MODE = false
-- This is part of regrowth, and if both are enabled, any chunks which aren't active and have no entities will
-- eventually be deleted over time. DO NOT USE THIS WITH MODS!
ENABLE_WORLD_EATER = false

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@ require("lib/oarc_store_map_features")
OARC_STORE_GUI = "oarc_store_gui"
OARC_PLAYER_STORE_GUI_TAB_NAME = "Item Store"
OARC_MAP_FEATURE_GUI_TAB_NAME = "Map Features"
OARC_MAP_FEATURE_GUI_TAB_NAME = "Special Store"
local OARC_STORE_TAB_CONTENT_FUNCTIONS = {}
OARC_STORE_TAB_CONTENT_FUNCTIONS[OARC_PLAYER_STORE_GUI_TAB_NAME] = CreatePlayerStoreTab

View File

@ -41,7 +41,8 @@ function InitOarcConfig()
global.ocfg.enable_regrowth = ENABLE_REGROWTH
global.ocfg.enable_abandoned_base_removal = ENABLE_ABANDONED_BASE_REMOVAL
global.ocfg.enable_research_queue = ENABLE_RESEARCH_QUEUE
global.ocfg.enable_chest_sharing = ENABLE_CHEST_SHARING
global.ocfg.enable_coin_shop = ENABLE_COIN_SHOP
global.ocfg.enable_chest_sharing = ENABLE_ITEM_AND_ENERGY_SHARING
global.ocfg.enable_magic_factories = ENABLE_MAGIC_FACTORIES
global.ocfg.enable_offline_protect = ENABLE_OFFLINE_PROTECTION
global.ocfg.enable_power_armor_start = ENABLE_POWER_ARMOR_QUICK_START

View File

@ -5,7 +5,7 @@
require("lib/shared_chests")
require("lib/map_features")
OARC_STORE_MAP_CATEGORIES =
OARC_STORE_MAP_TEXT =
{
special_chests = "Special buildings for sharing or monitoring items and energy. This will convert the closest wooden chest (to you) within 16 tiles into a special building of your choice. Make sure to leave enough space! The combinators and accumulators can take up several tiles around them.",
special_chunks = "Map features that can be built on the special empty chunks found on the map. You must be standing inside an empty special chunk to be able to build these. Each player can only build one of each type. [color=red]THESE FEATURES ARE PERMANENT AND CAN NOT BE REMOVED![/color]",
@ -41,14 +41,14 @@ OARC_STORE_MAP_FEATURES =
multiplier_cost = 2,
max_cost = 2000,
-- limit = 100,
text="INPUT for shared energy system."},
text="INPUT for shared energy system. [color=red]Only starts to share once it is charged to 50%.[/color]"},
["electric-energy-interface"] = {
initial_cost = 200,
additional_cost = 100,
multiplier_cost = 2,
max_cost = 4000,
-- limit = 100,
text="OUTPUT for shared energy system."},
text="OUTPUT for shared energy system. [color=red]Will NOT power other special eletric interfaces! You especially can't power special chunks with this![/color]"},
["deconstruction-planner"] = {
initial_cost = 0,
text="Removes the closest special building within range. NO REFUNDS!"},
@ -133,9 +133,18 @@ function CreateMapFeatureStoreTab(tab_container, player)
line.style.bottom_margin = 5
for category,section in pairs(OARC_STORE_MAP_FEATURES) do
if (not global.ocfg.enable_chest_sharing and (category == "special_chests")) then
goto SKIP_CATEGORY
end
if (not global.ocfg.enable_magic_factories and (category == "special_chunks")) then
goto SKIP_CATEGORY
end
AddLabel(tab_container,
nil,
OARC_STORE_MAP_CATEGORIES[category],
OARC_STORE_MAP_TEXT[category],
{bottom_margin=5, maximal_width = 400, single_line = false})
local flow = tab_container.add{name = category, type="flow", direction="horizontal"}
for item_name,item in pairs(section) do
@ -171,11 +180,15 @@ function CreateMapFeatureStoreTab(tab_container, player)
else
btn.tooltip = item.text.." Cost: "..color..cost.."[/color] [item=coin]"
end
::SKIP_ITEM::
end
-- Spacer
local line2 = tab_container.add{type="line", direction="horizontal"}
line2.style.top_margin = 5
line2.style.bottom_margin = 5
::SKIP_CATEGORY::
end
end
@ -260,6 +273,11 @@ function OarcMapFeatureStoreButton(event)
return
end
if (player.vehicle) then
player.print("Sir, please step out of the vehicle before you try to make any purchases...")
return
end
-- Each button has a special function
local result = false
if (button.name == "logistic-chest-storage") then

View File

@ -82,6 +82,11 @@ OARC_STORE_PLAYER_ITEMS =
["energy-shield-equipment"] = {cost = 50, count = 1, play_time_locked=false},
["energy-shield-mk2-equipment"] = {cost = 500, count = 1, play_time_locked=false},
},
["Spidertron"] = {
["spidertron"] = {cost = 5000, count = 1, play_time_locked=false},
["spidertron-remote"] = {cost = 500, count = 1, play_time_locked=false},
},
}
function CreatePlayerStoreTab(tab_container, player)

View File

@ -273,15 +273,15 @@ end
-- Give player these default items.
function GivePlayerItems(player)
for _,item in pairs(PLAYER_RESPAWN_START_ITEMS) do
player.insert(item)
for name,count in pairs(PLAYER_RESPAWN_START_ITEMS) do
player.insert({name=name, count=count})
end
end
-- Starter only items
function GivePlayerStarterItems(player)
for _,item in pairs(PLAYER_SPAWN_START_ITEMS) do
player.insert(item)
for name,count in pairs(PLAYER_SPAWN_START_ITEMS) do
player.insert({name=name, count=count})
end
if global.ocfg.enable_power_armor_start then

View File

@ -6,6 +6,7 @@
require("lib/oarc_utils")
require("config")
local crash_site = require("crash-site")
--[[
___ _ _ ___ _____
@ -295,6 +296,15 @@ function SendPlayerToNewSpawnAndCreateIt(delayedSpawn)
-- y=delayedSpawn.pos.y},transition_time=150,time_to_wait=150,zoom=0.8},{target=player.character,transition_time=60,time_to_wait=30,zoom=0.8}},
-- final_transition_time=45}
end
crash_site.create_crash_site(game.surfaces[GAME_SURFACE_NAME],
{x=delayedSpawn.pos.x+15, y=delayedSpawn.pos.y-25},
{["spidertron"] = 1,
["electronic-circuit"] = math.random(100,200),
["iron-gear-wheel"] = math.random(50,100),
["copper-cable"] = math.random(100,200),
["steel-plate"] = math.random(50,100)},
{["iron-plate"] = math.random(50,100)})
end
function DisplayWelcomeGroundTextAtSpawn(player, pos)

View File

@ -659,14 +659,8 @@ function CreateSharedItemsGuiTab(tab_container, player)
AddSpacerLine(scrollFrame)
-- MW charging/discharging rate. (delta change * sample rate per second)
local smelter_energy_used = 0
if (global.omagic.factory_energy_history) then
for k,v in pairs(global.omagic.factory_energy_history) do
smelter_energy_used = smelter_energy_used + v
end
end
local energy_change_add = (global.oshared.energy_stored_history.after_input - global.oshared.energy_stored_history.start)*60/1000000
local energy_change_sub = (((global.oshared.energy_stored_history.after_input - global.oshared.energy_stored_history.after_output)*60)+smelter_energy_used)/1000000
local energy_change_sub = (((global.oshared.energy_stored_history.after_input - global.oshared.energy_stored_history.after_output)*60))/1000000
local energy_add_str = string.format("+%.3fMW", energy_change_add)
local energy_sub_str = string.format("-%.3fMW", energy_change_sub)
local rate_color = "green"