Page 1 of 1

Local Requirement

Posted: Wed May 27, 2020 11:51 pm
by drakeraider
I can't find an answer for this, (I feel I may have asked it myself,) but what does the "Local" requirement setting actually mean?

Re: Local Requirement

Posted: Thu May 28, 2020 8:38 am
by Ignatus
Depends on what is the requirement and where is it used, see https://freeciv.fandom.com/wiki/Requirements. Generally, it means that a property of a specific unit or tile is queried; for DiplRel, that means relation between a specific pair of players.

Re: Local Requirement

Posted: Thu May 28, 2020 4:21 pm
by drakeraider
What I'm trying to do with it is detect Cities, I assume with CityTile. Currently I'm using Adjacent, but I would like for it to work anywhere in the City's radius if possible. (I don't know if it is).
Right now I'm using Extras (Base infra), as Owned_Extra isn't a thing in 2.6 yet.

Another thing I'm wondering is if I can require one of a certain list of other extras as an Adjacent, like an OR list. (I can't seem to find the right wording in the Requirements page).

For example.
I have a set of extras that all give related bonuses.
I want them to only be constructable if:
A) They are on a tile owned by a city, and
B) They are adjacent to either the City itself, or another entry in the set.

Thus requiring you to build outward from the City.
I could do this, really impractically, by simply defining dozens of copies of the extra with slightly different requirements, but I'm really hoping there's a simpler way.

Re: Local Requirement

Posted: Thu May 28, 2020 4:50 pm
by Ignatus
Consider a city with squared radius 4 on rectangular map:

Code: Select all

  3
 212 
31013
 212
  3
For city-ranged effects, tile requirements of range "Local" relate to 0, "CAdjacent" to 01, "Adjacent" to 012, "City" to 0123. You can't test tiles other than city center for what is adjacent to them. There are tile-ranged effects ("Tile_Workable", some of "Output_*", see https://freeciv.fandom.com/wiki/Editing_Effects), they are evaluated for each city tile and can test what is adjacent to it. Extra building reqs are tile-ranged, so may check adjacent tiles, but they can't support OR requirements. You can get something reasonable if you define some invisible extra with "AlwaysOnCityTile" flag and an extra flag that it and any of your extras should have, and test "ExtraFlag" in range "Adjacent".