1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-03 14:53:01 +02:00

Made undo warning appear more than once

Undo will only not spell a warning if the undo was ran twice by the same user with the same user as target
This commit is contained in:
Valansch 2018-06-06 22:53:30 +02:00 committed by GitHub
parent e28920307d
commit 51ec380330
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -480,8 +480,8 @@ local function undo(cmd)
return
end
if cmd.parameter and game.players[cmd.parameter] then
if not global.undo_warned_players[game.player.index] then
global.undo_warned_players[game.player.index] = true
if not global.undo_warned_players[game.player.index] or global.undo_warned_players[game.player.index] ~= game.players[cmd.parameter].index then
global.undo_warned_players[game.player.index] = game.players[cmd.parameter].index
game.player.print(
string.format("Warning! You are about to remove %s entities and restore %s entities.",
#Utils.find_entities_by_last_user(game.players[cmd.parameter], game.surfaces.nauvis),
@ -492,6 +492,7 @@ local function undo(cmd)
end
Antigrief.undo(game.players[cmd.parameter])
game.print(string.format("Undoing everything %s did...", cmd.parameter))
global.undo_warned_players[game.player.index] = nil
else
player_print("Usage: /undo <player>")
end