@TheNamelessOne, terrific work! Your efforts have opened up so many opportunities for advanced scenarios. I've been experimenting quite a bit recently with TOTPP enhancements to rules.txt, as well as Lua scripts, testing out various ideas to see what's feasible.
I've noticed a couple things related to terrain that I'm hoping you can work into an upcoming release of TOTPP. You've already made huge improvements in this area (special thanks for allowing fertility to be set in a way the AI understands!) but the two following items seem like they may have slipped through the cracks. I think including them would really help fill out terrain support nicely.
1. Each terrain slot has a hardcoded value for how many turns it takes for a settler to build a road: For, Hil, Gla, Swa, and Jun are 4; Mou is 6; and all other land terrains -- including all of the additional Bbb through Fff slots -- are 2. Could you create a way for this to be customizable for all terrains within rules.txt?
2. The first three terrain slots (Drt, Pln, and Grs) are the only ones for which a road will add the
first trade arrow (if the tile otherwise gives none). On all other terrain types, a road will add an additional arrow if the tile already produces at least one, but not the first arrow. Could this also be configurable for every terrain in rules.txt?
Then I've also run into a number of roadblocks in Lua scripts:
3. I see that I can call "city.shields" to both read and write the number of shields that have accumulated in a city's shield box, but similar support for a city's food box appears to be missing. Could support for reading and writing the number of bundles in the food box be added?
4. It seems that tile improvements are stored in a bitmask that is readable, but not writeable. So a Lua script can change a tile's terrain type, but not add or remove improvements on it (irrigation, roads, fortress, etc.). Could support for that be added? Also, while I can probably figure out how to interpret and set the bitmask appropriately, it doesn't seem like a very friendly format... I expect I'll end up writing separate functions to deal with it. Any chance you could also make the management of tile improvements a bit more user-friendly?
5. I played around a little bit with trying to analyze relationships between civilizations (tribes) -- my initial goal was to find out whether a tribe was at war with at least one other tribe in the game. But my calls to tribe.attitude, tribe.reputation, or tribe.treaties were returning something like "userdata: 04F1A010" or "attempt to call a userdata value" rather than the type of information I was looking for. Could you add support for this type of check into Lua, or if I'm doing something wrong, give me a code snippet that will work?
6. This last one is a "nice-to-have" and lower priority to me than the other things I've listed, but I had one idea that would require a new trigger for "onCityFounded" -- this would nicely parallel the existing "onCityDestroyed". I know that it's technically possible for me to find new cities at the end of every turn, if I keep my own copy of the city list in memory, and then run a check every turn to see if any cities exist in the game that aren't in my list. But that's pretty cumbersome, and also only lets me take action at the
end of the turn on which a city is founded, rather than immediately.
Of course, none of these requests should in any way diminish the fantastic work you've already done! I'm sure you already have a long list of ideas for improvements, but I'm hoping that these are reasonable and can be worked into your list of priorities. Thanks again for your great work! Cheers!