Skip to content

Commit

Permalink
Fix DO+EI restart conditions (#1390)
Browse files Browse the repository at this point in the history
* Fix DO+EI restart conditions

* DOEI remove redundant condition
  • Loading branch information
RedRafe authored Dec 20, 2023
1 parent 6b0cbf9 commit 91596c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
2 changes: 1 addition & 1 deletion locale/en/redmew_maps.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -177,5 +177,5 @@ biters_disabled=Launching the first [item=satellite] has killed all the biters.
win=Congratulations! The map has been won. Restart the map with /restart
satellite_launch=Launch another __1__ [item=satellite] to win the map.
biters_disabled_k2=Launching the first [item=satellite] has killed all the biters. Build and activate the Intergalactic Transceiver to win the map.
biters_disabled_ei=Launching the first [item=satellite] has killed all the biters. Launch more satellites to the asteroids to unloch the final age.
biters_disabled_ei=Launching the first [item=satellite] has killed all the biters. Launch more Exploration Satellites to the asteroids to unlock the final age.
biters_disabled_py=Launching the first [item=satellite] has killed all the biters. Research [technology-name=pyrrhic] to win the game.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local ShareGlobals = require 'map_gen.maps.danger_ores.modules.shared_globals'
return function()
ShareGlobals.data.biters_disabled = false
ShareGlobals.data.map_won = false
ShareGlobals.data.show_reset_message = true

local function disable_biters()
if ShareGlobals.data.biters_disabled then
Expand All @@ -21,7 +20,7 @@ return function()

local message = table.concat {
'Launching the first satellite has killed all the biters. ',
'Launch more satellites to the asteroids to unloch the final age'
'Launch more Exploration Satellites to the asteroids to unlock the final age'
}
game.print({'danger_ores.biters_disabled_ei'})
Server.to_discord_bold(message)
Expand Down Expand Up @@ -57,19 +56,17 @@ return function()
return
end

if not game.finished_but_continuing then
return
end

ShareGlobals.data.map_won = true
local message = 'Congratulations! The map has been won. Restart the map with /restart'
game.print({'danger_ores.win'})
Server.to_discord_bold(message)
end

local function on_win_condition_met()
if ShareGlobals.show_reset_message and game.finished_but_continuing then
win()
end
end

Event.on_nth_tick(60 * 17, on_win_condition_met)
Event.on_nth_tick(60 * 17, win)
Event.add(defines.events.on_rocket_launched, rocket_launched)
end

0 comments on commit 91596c0

Please sign in to comment.