Proto_Noob
Chieftain
- Joined
- Jan 11, 2016
- Messages
- 42
Simple question.
I am familiar with programming (vb.net, C#, xml, sql), but new to lua. I would like to know the best way to loop through all adjacent tiles and check for something. Can someone give me a code example that would actually run if placed in a lua file (i've seen enough 'something LIKE this but won't work' examples for a lifetime). It can be really simple (that may actually be better), but if you are interested in what I am trying to to and can give that code, all the better.
I am expanding the mod "Trading Posts Grow into Towns". I want to disallow Trading Posts (TPs) from being adjacent (and all later evolutions of trading posts). Normally, I could just flip the NoTwoAdjacent bit to true in xml, but if a trade post has grown into a town, the code behind that bit will not recognize them as the same 'class' of improvement. So, I would like to check to make sure there are no hamlets, villages, or towns adjacent to where a worker stands and prevent him from building a TP in much the same way you are prevented from building a city too close to another.
Thank you.
I am familiar with programming (vb.net, C#, xml, sql), but new to lua. I would like to know the best way to loop through all adjacent tiles and check for something. Can someone give me a code example that would actually run if placed in a lua file (i've seen enough 'something LIKE this but won't work' examples for a lifetime). It can be really simple (that may actually be better), but if you are interested in what I am trying to to and can give that code, all the better.
I am expanding the mod "Trading Posts Grow into Towns". I want to disallow Trading Posts (TPs) from being adjacent (and all later evolutions of trading posts). Normally, I could just flip the NoTwoAdjacent bit to true in xml, but if a trade post has grown into a town, the code behind that bit will not recognize them as the same 'class' of improvement. So, I would like to check to make sure there are no hamlets, villages, or towns adjacent to where a worker stands and prevent him from building a TP in much the same way you are prevented from building a city too close to another.
Thank you.