Skip to content

Commit

Permalink
fixed the logic removing xmlMapinfo when incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
Pshy0 committed Oct 15, 2022
1 parent 52d5e62 commit c819b16
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions lua/pshy/rotations/newgame.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,6 @@ local function EndMap(aborted)
--tfm.exec.giveTransformations(player_name, false)
--tfm.exec.linkMice(player_name, player_name, false) -- TODO: check player.soulmate ?
--end
-- clean tfm.get.room.xmlMapInfo because TFM doesnt
tfm.get.room.xmlMapInfo = nil
end


Expand Down Expand Up @@ -422,6 +420,15 @@ end
function eventNewGame()
newgame_called = false
newgame.current_map = nil
-- clean tfm.get.room.xmlMapInfo because TFM doesnt
local current_map = tostring(tfm.get.room.currentMap)
if string.sub(current_map, 1, 1) == "@" then
current_map = string.sub(current_map, 2)
end
current_map = tonumber(current_map)
if tfm.get.room.xmlMapInfo and current_map ~= tfm.get.room.xmlMapInfo.mapCode then
tfm.get.room.xmlMapInfo = nil
end
if not newgame.event_new_game_triggered then
newgame.current_map = newgame.current_settings.map
for i_func, begin_func in ipairs(newgame.current_settings.begin_funcs) do
Expand Down
2 changes: 1 addition & 1 deletion lua/pshy/tools/getxml.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ local function ChatCommandGetxml(user, index)
-- getting lines
if index == nil and last_map ~= tfm.get.room.currentMap then
if not tfm.get.room.xmlMapInfo or not tfm.get.room.xmlMapInfo.xml then
return false, "This map does not have an xml. Try changing the map with `!skip @MAPCODE` if you were using `/np @MAPCODE`?"
return false, "This map does not have an xml."
end
ComputeLines()
end
Expand Down

0 comments on commit c819b16

Please sign in to comment.