The International Simutrans Forum

Development => Scripting Scenarios and AI => Topic started by: Yona-TYT on December 18, 2024, 04:34:15 AM

Title: Is a tunnel entrance
Post by: Yona-TYT on December 18, 2024, 04:34:15 AM
Is there a simple way to identify the entrance/mouth of a tunnel in a tile?. A specific function for this would be great.

I've been looking through the code but there's nothing in the tunnels descriptor and I'm not sure how I can add this.
Title: Re: Is a tunnel entrance
Post by: Andarix on December 18, 2024, 11:29:05 AM
It is possible that a combined query will provide this.

tile_x.is_tunnel() && tile_x.get_slope() > 0

or

tile_x.is_tunnel() && tile_x.has_ways()

or

tile_x.is_tunnel() && tile_x.is_ground()
Title: Re: Is a tunnel entrance
Post by: prissi on December 18, 2024, 12:30:01 PM
This is also how simutrans check for being in tunnel or not ist_kartenboden() und ist_tunnel(). Works well.