The International Simutrans Forum

 

Author Topic: tile_x is ignoring height ( coordinate z)  (Read 192 times)

0 Members and 1 Guest are viewing this topic.

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
tile_x is ignoring height ( coordinate z)
« 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:
Code: [Select]
    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
        }
    }


Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4555
  • Languages: EN, DE, AT
Re: tile_x is ignoring height ( coordinate z)
« Reply #1 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.

Offline Yona-TYT ve

  • Devotee
  • *
  • Posts: 1174
    • Simutrans-BLOG
  • Languages: ES
Re: tile_x is ignoring height ( coordinate z)
« Reply #2 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: