Goal: I wanted to restrict farms to be on or next to wheat, rice, and maize. This is impossible with the hard coded requirements.
Solution: In the database, I define and require a new terrain called "Farmland." I define the requirements I want in LUA, and when they are met, I set the terrain type to Farmland. When they are no longer met, I change the terrain back. This works!
In theory, you can hide this from the user: For example, you can replace "Plains" with "Farmland Plains" but use the same in-game text and graphics as Plains. Then, you can define whatever requirements you want under the hood. In my tests, the game still suggests farms (and in the right places I've defined), so AI should be able to interact with this appropriately.
Problem: To fully realize my custom requirements, I needed to define a new floodplain too. As a first pass, I copied the .artdef for grassland floodplains. I was able to generate the .dep file and the modding, database, and artdef logs report no trouble uploading them. However, the floodplains remain invisible, and the game eventually crashes, and I believe the crash occurs when a floodplains tile is updated. I merely want to duplicate the in-game graphics. To accomplish this, do I need to do more than copy and paste Terrains and Features? Are there other .artdef files I need to update?
Solution: In the database, I define and require a new terrain called "Farmland." I define the requirements I want in LUA, and when they are met, I set the terrain type to Farmland. When they are no longer met, I change the terrain back. This works!
In theory, you can hide this from the user: For example, you can replace "Plains" with "Farmland Plains" but use the same in-game text and graphics as Plains. Then, you can define whatever requirements you want under the hood. In my tests, the game still suggests farms (and in the right places I've defined), so AI should be able to interact with this appropriately.
Problem: To fully realize my custom requirements, I needed to define a new floodplain too. As a first pass, I copied the .artdef for grassland floodplains. I was able to generate the .dep file and the modding, database, and artdef logs report no trouble uploading them. However, the floodplains remain invisible, and the game eventually crashes, and I believe the crash occurs when a floodplains tile is updated. I merely want to duplicate the in-game graphics. To accomplish this, do I need to do more than copy and paste Terrains and Features? Are there other .artdef files I need to update?