diff --git a/control.lua b/control.lua index fe91399..b9304e4 100644 --- a/control.lua +++ b/control.lua @@ -299,9 +299,9 @@ end) script.on_event(defines.events.on_research_finished, function(event) -- Never allows players to build rocket-silos in "frontier" mode. - -- if global.ocfg.frontier_rocket_silo then - -- RemoveRecipe(event.research.force, "rocket-silo") - -- end + if global.ocfg.frontier_rocket_silo and not global.ocfg.frontier_allow_build then + RemoveRecipe(event.research.force, "rocket-silo") + end if LOCK_GOODIES_UNTIL_ROCKET_LAUNCH and (not global.satellite_sent or not global.satellite_sent[event.research.force.name]) then diff --git a/example-config.lua b/example-config.lua index 2d66751..1d2a330 100644 --- a/example-config.lua +++ b/example-config.lua @@ -389,6 +389,13 @@ ENABLE_SILO_VISION = true ENABLE_SILO_BEACONS = false ENABLE_SILO_RADAR = false +-- Allow silos to be built by the player, but forces them to build in +-- the fixed locations. If this is false, silos are built and assigned +-- only to the main force. This can cause a problem for non main forces +-- when playing with LOCK_GOODIES_UNTIL_ROCKET_LAUNCH enabled. +ENABLE_SILO_PLAYER_BUILD = true + + -------------------------------------------------------------------------------- -- Long Reach Options -------------------------------------------------------------------------------- diff --git a/lib/frontier_silo.lua b/lib/frontier_silo.lua index fd5bb07..e2dd184 100644 --- a/lib/frontier_silo.lua +++ b/lib/frontier_silo.lua @@ -110,9 +110,11 @@ local function CreateRocketSilo(surface, siloPosition, force) 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 + if not global.ocfg.frontier_allow_build then + local silo = surface.create_entity{name = "rocket-silo", position = {siloPosition.x+0.5, siloPosition.y}, force = force} + silo.destructible = false + silo.minable = false + end -- TAG it on the main force at least. game.forces[global.ocfg.main_force].add_chart_tag(game.surfaces[GAME_SURFACE_NAME], diff --git a/lib/oarc_global_cfg.lua b/lib/oarc_global_cfg.lua index 2237173..16e4100 100644 --- a/lib/oarc_global_cfg.lua +++ b/lib/oarc_global_cfg.lua @@ -65,6 +65,7 @@ function InitOarcConfig() global.ocfg.frontier_fixed_pos = SILO_FIXED_POSITION global.ocfg.frontier_pos_table = SILO_POSITIONS global.ocfg.frontier_silo_vision = ENABLE_SILO_VISION + global.ocfg.frontier_allow_build = ENABLE_SILO_PLAYER_BUILD -- MOD VERSION else @@ -187,6 +188,7 @@ function InitOarcConfig() global.ocfg.frontier_fixed_pos = false global.ocfg.frontier_pos_table = {{x = 0, y = 100}} global.ocfg.frontier_silo_vision = settings.global["oarc-frontier-silo-vision"].value + global.ocfg.frontier_allow_build = true end