Fix recreating land and galaxy map after uninstall/reinstall of client
This commit is contained in:
parent
053918418c
commit
4dc005893f
2
mfile
2
mfile
@ -1,4 +1,4 @@
|
|||||||
{
|
{
|
||||||
"package": "lotj-ui",
|
"package": "lotj-ui",
|
||||||
"version": "v2.0"
|
"version": "v2.2"
|
||||||
}
|
}
|
@ -19,6 +19,8 @@ function lotj.galaxyMap.setup()
|
|||||||
height = "100%",
|
height = "100%",
|
||||||
}, lotj.layout.upperRightTabData.contents["galaxy"])
|
}, lotj.layout.upperRightTabData.contents["galaxy"])
|
||||||
lotj.galaxyMap.container:setBackgroundImage(getMudletHomeDir().."/@PKGNAME@/space.jpg")
|
lotj.galaxyMap.container:setBackgroundImage(getMudletHomeDir().."/@PKGNAME@/space.jpg")
|
||||||
|
-- This seems necessary when recreating the UI after upgrading the package.
|
||||||
|
lotj.galaxyMap.container:raiseAll()
|
||||||
|
|
||||||
lotj.galaxyMap.refreshButton = Geyser.Label:new({
|
lotj.galaxyMap.refreshButton = Geyser.Label:new({
|
||||||
name = "galaxyMapRefresh",
|
name = "galaxyMapRefresh",
|
||||||
|
@ -208,12 +208,6 @@ function lotj.mapper.startMapping(areaName)
|
|||||||
if areaTable[areaName] == nil then
|
if areaTable[areaName] == nil then
|
||||||
addAreaName(areaName)
|
addAreaName(areaName)
|
||||||
lotj.mapper.log("Mapping in new area <yellow>"..areaName.."<reset>.")
|
lotj.mapper.log("Mapping in new area <yellow>"..areaName.."<reset>.")
|
||||||
|
|
||||||
if lotj.mapper.noAreasPrompt ~= nil then
|
|
||||||
lotj.mapper.noAreasPrompt:hide()
|
|
||||||
lotj.mapper.noAreasPrompt = nil
|
|
||||||
lotj.mapper.mapperInstance:show()
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
lotj.mapper.log("Mapping in existing area <yellow>"..areaName.."<reset>.")
|
lotj.mapper.log("Mapping in existing area <yellow>"..areaName.."<reset>.")
|
||||||
end
|
end
|
||||||
@ -292,11 +286,18 @@ end
|
|||||||
|
|
||||||
|
|
||||||
function lotj.mapper.setup()
|
function lotj.mapper.setup()
|
||||||
lotj.mapper.mapperInstance = Geyser.Mapper:new({
|
if not geyserMapper then
|
||||||
|
-- Preserve this as a global. We can only create one mapper in a profile, so if we
|
||||||
|
-- unload and reload this UI, we need to reuse what was created before.
|
||||||
|
geyserMapper = Geyser.Mapper:new({
|
||||||
x = 0, y = 0,
|
x = 0, y = 0,
|
||||||
width = "100%",
|
width = "100%",
|
||||||
height = "100%",
|
height = "100%",
|
||||||
}, lotj.layout.upperRightTabData.contents["map"])
|
}, lotj.layout.upperRightTabData.contents["map"])
|
||||||
|
else
|
||||||
|
lotj.layout.upperRightTabData.contents["map"]:add(geyserMapper)
|
||||||
|
geyserMapper:raiseAll()
|
||||||
|
end
|
||||||
setMapZoom(15)
|
setMapZoom(15)
|
||||||
|
|
||||||
local hasAnyAreas = false
|
local hasAnyAreas = false
|
||||||
@ -313,6 +314,11 @@ function lotj.mapper.setup()
|
|||||||
lotj.setup.registerEventHandler("gmcp.Room.Info", lotj.mapper.onEnterRoom)
|
lotj.setup.registerEventHandler("gmcp.Room.Info", lotj.mapper.onEnterRoom)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function lotj.mapper.teardown()
|
||||||
|
lotj.layout.upperRightTabData.contents["map"]:remove(geyserMapper)
|
||||||
|
geyserMapper:hide()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
-- Track the most recent movement command so we know which direction we moved when automapping
|
-- Track the most recent movement command so we know which direction we moved when automapping
|
||||||
function lotj.mapper.handleSentCommand(event, cmd)
|
function lotj.mapper.handleSentCommand(event, cmd)
|
||||||
|
@ -41,6 +41,7 @@ local function teardown()
|
|||||||
killAnonymousEventHandler(killId)
|
killAnonymousEventHandler(killId)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
lotj.mapper.teardown()
|
||||||
lotj.layout.teardown()
|
lotj.layout.teardown()
|
||||||
lotj = nil
|
lotj = nil
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user