News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

[Script API] Factory_x get list of fields.

Started by Yona-TYT, December 19, 2021, 09:49:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT

I would like to be able to obtain a list of the fields around a factory, I think the result would be an "array <field_x> ()".

Yona-TYT

#1
Well, since I received a (like) here, I decided to make a small patch.  8)ADD-Get-tile_x-list-all-fields.patch


This gets a list of coordinates of all the fields, unfortunately I couldn't list "tile_x" so it's just "coord".
If someone knows how to make a list of real "tile_x", welcome :)

Edit. Now if you get a list of tile_x

list = factory_x(pos.x, pos.y).get_tile_fields_list()

Yona-TYT

Quote from: Yona-TYT on November 28, 2022, 02:18:47 AMWell, since I received a (like) here, I decided to make a small patch.  8)ADD-Get-tile_x-list-all-fields.patch


This gets a list of coordinates of all the fields, unfortunately I couldn't list "tile_x" so it's just "coord".
If someone knows how to make a list of real "tile_x", welcome :)

Edit. Now if you get a list of tile_x

list = factory_x(pos.x, pos.y).get_tile_fields_list()

Maybe this post was overlooked?... ??? 

Dwachs

it was not overlooked. People have some rl sometimes ... It is in r10819. I renamed the method to get_fields_list.
Parsley, sage, rosemary, and maggikraut.

Yona-TYT

Quote from: Dwachs on November 30, 2022, 06:32:06 PMit was not overlooked. People have some rl sometimes ... It is in r10819. I renamed the method to get_fields_list.
Oh great ! , now I can use this in the tutorial. :)