LuvToBuild
Prince
I apologize if it seems that I've hijacked your thread KnelRivendar. It wasn't my intent to do so, I am just intrigued by the idea as it is something that I want to do as well.
I was looking through the XML and found the CIV5Trades.xml file in XML\GameInfo. It seems to me on initial examination that this is where you would add a new trade type called TRADE_ELECTRICTY or maybe TRADE_MEGAWATTS. In UI\Ingame\WorldView I found TradeLogic.lua which seems to handle the creation of a Deal instance. I am still learning how LUA works but it seems to me that you would create something like bElectricityTradeAllowed or bMegawattTradeAllowed modeled after the code for lump sum gold deals, bGoldTradeAllowed. For a GPT like trade, it looks like you would create something along the lines of bEPTAllowed or bMPTAllowed for electricity per turn or megawatts per turn, modeled after bGPTAllowed. You would also need some new functions in that same file modeled after PocketGoldHandler, ChangeGoldAmount, PocketGoldPerTurnHandler, TableGoldPerTurnHandler, and ChangeGoldPerTurnAmount.
To create the electricity yield, you would need a new yield type in the XML\Terrain\CIV5Yields.xml file called something like YIELD_ELECTRICITY or YIELD_MEGAWATT which would be added to the river tile terrain with a hydro plant. Solar plants could be modified to do the same thing for all desert tiles, which would make desert tiles really useful since they would help power generation in your post industrial age empire. The coal power plant would need a coal resource and the nuclear plant would need a uranium resource available in the city in order to build them initially. They would be modeled after the monastery but they would use the available coal to modify the electricity / megawatt yield so that if the coal is pillaged or is switched to being worked by another city, it no longer modifies the yield. I am not sure if this is the way the monastery works though. It probably needs to be tested.
If you wanted to, you could probably have a power plant improvement instead which would increase the yield for that resource type when you improve the tile. You would build hydro plants along the river, solar plants in the desert, nuclear plants on uranium, and coal plants on coal. Then you could build a power grid or substation or something like that in the city which would act like a market by increasing the electricity yield of the city by a certain percentage. In theory, you would have some cities that were literally powerhouses for your empire just like financial cities are now.
At this point my thoughts are still speculation but I still believe this is doable in XML/LUA. Of course, I'm not the one doing it yet,
. I will try to tackle it myself at some point if you haven't beaten me to it. If I do, this is probably the approach I would try to take assuming I didn't run into a lot of issues.
I was looking through the XML and found the CIV5Trades.xml file in XML\GameInfo. It seems to me on initial examination that this is where you would add a new trade type called TRADE_ELECTRICTY or maybe TRADE_MEGAWATTS. In UI\Ingame\WorldView I found TradeLogic.lua which seems to handle the creation of a Deal instance. I am still learning how LUA works but it seems to me that you would create something like bElectricityTradeAllowed or bMegawattTradeAllowed modeled after the code for lump sum gold deals, bGoldTradeAllowed. For a GPT like trade, it looks like you would create something along the lines of bEPTAllowed or bMPTAllowed for electricity per turn or megawatts per turn, modeled after bGPTAllowed. You would also need some new functions in that same file modeled after PocketGoldHandler, ChangeGoldAmount, PocketGoldPerTurnHandler, TableGoldPerTurnHandler, and ChangeGoldPerTurnAmount.
To create the electricity yield, you would need a new yield type in the XML\Terrain\CIV5Yields.xml file called something like YIELD_ELECTRICITY or YIELD_MEGAWATT which would be added to the river tile terrain with a hydro plant. Solar plants could be modified to do the same thing for all desert tiles, which would make desert tiles really useful since they would help power generation in your post industrial age empire. The coal power plant would need a coal resource and the nuclear plant would need a uranium resource available in the city in order to build them initially. They would be modeled after the monastery but they would use the available coal to modify the electricity / megawatt yield so that if the coal is pillaged or is switched to being worked by another city, it no longer modifies the yield. I am not sure if this is the way the monastery works though. It probably needs to be tested.
If you wanted to, you could probably have a power plant improvement instead which would increase the yield for that resource type when you improve the tile. You would build hydro plants along the river, solar plants in the desert, nuclear plants on uranium, and coal plants on coal. Then you could build a power grid or substation or something like that in the city which would act like a market by increasing the electricity yield of the city by a certain percentage. In theory, you would have some cities that were literally powerhouses for your empire just like financial cities are now.
At this point my thoughts are still speculation but I still believe this is doable in XML/LUA. Of course, I'm not the one doing it yet,
