Lua question regarding City:IsHasResourceLocal(ResourceType)

LeeS

Imperator
Joined
Jul 23, 2013
Messages
7,241
Location
Illinois, USA
Does anyone know if City:IsHasResourceLocal(ResourceID#) returns "true" only if the city has the resource local to it and the resource has been improved or does it return "true" merely if the resource is in the range of the city?

As in if I do this:
Code:
if City:IsHasResourceLocal(GameInfoTypes.RESOURCE_STONE) then
	blah blah
	blah blah
end
  1. Will the "blah blah" psuedo-code lines only run if Stone is local to the city and has been improved? Or will those lines be executed if Stone is within the work-radius of the city, regardless of whether the Stone plot has been improved?
  2. Are there other gotchas with this lua method in that it doesn't work quite as one would expect and I would also need to do checks within the "blah blah" lines for such things as is the city itself working the resource or is some other city (of same or other civ) working the plot where the Stone is located?

[edit] perhaps I should have posted this question in the SDK/LUA sub-forum? I am always confused on best forum-use practice when it comes to a specific lua-proramming question like this.
 
[edit] perhaps I should have posted this question in the SDK/LUA sub-forum? I am always confused on best forum-use practice when it comes to a specific lua-proramming question like this.

Moderator Action: Yes, it is generally best practice to ask lua or c++ questions in the SDK/LUA subforum. :)
 
I just checked the C++, IsHasResourceLocal only returns true if the resource is actually connected to that city (ie if it has been improved).
 
Top Bottom