Page 1 of 1

City.getView() With Elevated Terrain

Posted: 01 Apr 2021, 18:53
by KINGTUT10101
I noticed that City.getView() does not account for tiles on elevated terrain. It will only see tiles on level zero. Is there any way around this limitation?

Re: City.getView() With Elevated Terrain

Posted: 03 Apr 2021, 19:10
by 1Code

Code: Select all    Reset

function script:draw() local x, y = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.setTile(x, y) Drawing.drawTileFrame(Icon.TOOLMARK + 16 + 1) end
Lua editor
Run

KINGTUT10101 wrote: 05 Apr 2021, 04:51 IS there a way to get this working with script:update?

Code: Select all    Reset

function script:update() local x, y, scale = City.getView() if Tile.isValid(x, y) then x = x + Tile.getTerrainHeight (x, y) y = y - Tile.getTerrainHeight (x, y) end Drawing.drawText('X:'..x..',Y:'..y..',S:'..s) end
Lua editor
Run

Re: City.getView() With Elevated Terrain

Posted: 05 Apr 2021, 04:32
by KINGTUT10101
I'll try this out. Thank you for the help. I must not have seen that command when I searched through the Lua Docs a few months ago.

Re: City.getView() With Elevated Terrain

Posted: 05 Apr 2021, 04:51
by KINGTUT10101
IS there a way to get this working with script:update?

Re: City.getView() With Elevated Terrain

Posted: 07 Apr 2021, 00:36
by KINGTUT10101
Thank you for trying to help again. However, I'm not sure if this is the right approach. Stuff like this can happen:
image.png
Do you have any ideas for how we could overcome this issue?