The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on October 20, 2018, 12:15:47 AM

Title: tile_x is ignoring height ( coordinate z)
Post by: Yona-TYT on October 20, 2018, 12:15:47 AM


The tile_x function does not recognize the z coordinate at all, is this an error?

I try to use "tile_x (pos.x, pos.y, pos.z +1) .is_marked ()" to prevent the use of elevated tracks, but I need the height coordinates to be working well.

Example:
    function is_work_allowed_here(pl, tool_id, pos) {
        if (tool_id==4110){
            if(tile_x(pos.x, pos.y, pos.z +1).is_marked())
                return 0 // High tracks are not allowed            else
                return null
        }
    }

(https://www.mediafire.com/convkey/9034/319bvq1b50ye0636g.jpg)
Title: Re: tile_x is ignoring height ( coordinate z)
Post by: Dwachs on October 20, 2018, 07:03:45 AM
You cannot mark non-existing tiles. If tile at given coordinate does not exist, tile_x uses the ground tile.
Title: Re: tile_x is ignoring height ( coordinate z)
Post by: Yona-TYT on October 20, 2018, 10:13:23 PM
I wonder if it is possible to get the coordinates of the cursor when it builds an elevated track ??.

Maybe you can distinguish between a elevated track and a normal track.
Look at the image:
(https://www.mediafire.com/convkey/a62d/xh60sqc1ubwglay6g.jpg)