Fix /restart not working in editor

master
Wuzzy 2022-01-20 14:30:34 +01:00
parent f3c854a34d
commit 955b031b8a
1 changed files with 4 additions and 1 deletions

View File

@ -221,9 +221,12 @@ minetest.register_chatcommand("restart", {
params = "",
description = S("Restart current level"),
func = function(name, param)
if lzr_gamestate.get_state() == lzr_gamestate.LEVEL then
local state = lzr_gamestate.get_state()
if state == lzr_gamestate.LEVEL or state == lzr_gamestate.EDITOR then
lzr_levels.start_level(current_level)
return true
elseif state == lzr_gamestate.LEVEL_COMPLETE then
return false, S("Cant restart level right now.")
else
return false, S("Not playing in a level!")
end