I'm thinking of making a tiny mod just to see how it works. TL;DR: Is it possible to have conditional tile adjacency effects on a building?
My intent is to make it so upgraded planetary capitals (planetary administration, planetary capital, empire capital complex) boost science in addition to the resources which they already boost. The intent is to make it so that tiles adjacent to certain colony capitals can gain the same effect that other resources types get.
I made a simple proof-of-concept mod that gave a flat increase to the science resources for adjacent buildings, much like the tomb world tile blockers do for the vanilla game. While that certainly works, that's not exactly balanced. The bonus of the tomb world tile blockers is offset by their relative rarity and time before the player can exploit them. Giving the player the option to create a 2/2/2 basic science lab adjacent to a planetary administration building would ensure that players would only place labs around their capitals.
I would think a more balanced way of executing this idea is to have the adjacency bonus enhance only one of the three science resources at a time, at the same magnitude of the other resources. However, to actually implement this, I would need to write conditional tile adjacency effects and I know of no examples of this in the vanilla game. I don't even know if it's possible.
Pseudocode of what I'd like to implement:
Thanks in advance.
My intent is to make it so upgraded planetary capitals (planetary administration, planetary capital, empire capital complex) boost science in addition to the resources which they already boost. The intent is to make it so that tiles adjacent to certain colony capitals can gain the same effect that other resources types get.
I made a simple proof-of-concept mod that gave a flat increase to the science resources for adjacent buildings, much like the tomb world tile blockers do for the vanilla game. While that certainly works, that's not exactly balanced. The bonus of the tomb world tile blockers is offset by their relative rarity and time before the player can exploit them. Giving the player the option to create a 2/2/2 basic science lab adjacent to a planetary administration building would ensure that players would only place labs around their capitals.
I would think a more balanced way of executing this idea is to have the adjacency bonus enhance only one of the three science resources at a time, at the same magnitude of the other resources. However, to actually implement this, I would need to write conditional tile adjacency effects and I know of no examples of this in the vanilla game. I don't even know if it's possible.
Pseudocode of what I'd like to implement:
Code:
if (the adjacent tile has a +science bonus)
then
if (the adjacent tile has a +physics bonus)
then
increase physics research granted by +1/+2/+3
fi
if (the adjacent tile has a +society bonus)
then
increase society research granted by +1/+2/+3
fi
if (the adjacent tile has a +engineering bonus)
then
increase engineering research granted by +1/+2/+3
fi
else (the adjacent tile doesn't have a +science bonus)
if (the adjacent tile has a physics lab of any upgrade tier)
then
increase physics research granted by +1/+2/+3
fi
if (the adjacent tile has a biolab of any upgrade tier)
then
increase society research granted by +1/+2/+3
fi
if (the adjacent tile has an engineering lab of any upgrade tier)
then
increase engineering research granted by +1/+2/+3
fi
fi
Thanks in advance.