Skip to content

Commit 67759af

Browse files
authored
Add win message to DO (#1525)
1 parent 0675968 commit 67759af

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

map_gen/maps/danger_ores/modules/rocket_launched.lua

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,17 @@ return function(config)
157157
game.print('Warning incoming biter attack! Number of waves: ' .. number_of_waves)
158158
end
159159

160+
local function win()
161+
if ShareGlobals.data.map_won then
162+
return
163+
end
164+
165+
ShareGlobals.data.map_won = true
166+
local message = 'Congratulations! The map has been won. Restart the map with /restart'
167+
game.print({'danger_ores.win'})
168+
Server.to_discord_bold(message)
169+
end
170+
160171
local function rocket_launched(event)
161172
local entity = event.rocket
162173

@@ -216,7 +227,7 @@ return function(config)
216227
return
217228
end
218229

219-
local win_message = 'Congratulations! Biters have been wiped from the map!'
230+
local win_message = 'Biters have been wiped from the map!'
220231
game.print(win_message)
221232
Server.to_discord_bold(win_message)
222233

@@ -226,6 +237,8 @@ return function(config)
226237
for _, enemy_entity in pairs(RS.get_surface().find_entities_filtered({force = 'enemy'})) do
227238
enemy_entity.destroy()
228239
end
240+
241+
win()
229242
end
230243

231244
local bad_tiles = {'deepwater-green', 'deepwater', 'out-of-map', 'water-green', 'water'}

0 commit comments

Comments
 (0)