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:
parent
e28920307d
commit
51ec380330
@ -480,8 +480,8 @@ local function undo(cmd)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if cmd.parameter and game.players[cmd.parameter] then
|
if cmd.parameter and game.players[cmd.parameter] then
|
||||||
if not global.undo_warned_players[game.player.index] then
|
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] = true
|
global.undo_warned_players[game.player.index] = game.players[cmd.parameter].index
|
||||||
game.player.print(
|
game.player.print(
|
||||||
string.format("Warning! You are about to remove %s entities and restore %s entities.",
|
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),
|
#Utils.find_entities_by_last_user(game.players[cmd.parameter], game.surfaces.nauvis),
|
||||||
@ -492,6 +492,7 @@ local function undo(cmd)
|
|||||||
end
|
end
|
||||||
Antigrief.undo(game.players[cmd.parameter])
|
Antigrief.undo(game.players[cmd.parameter])
|
||||||
game.print(string.format("Undoing everything %s did...", cmd.parameter))
|
game.print(string.format("Undoing everything %s did...", cmd.parameter))
|
||||||
|
global.undo_warned_players[game.player.index] = nil
|
||||||
else
|
else
|
||||||
player_print("Usage: /undo <player>")
|
player_print("Usage: /undo <player>")
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user