Page 1 of 1

[JAVA-AI] How to get all energy producing Units?

Posted: 26 Aug 2009, 13:53
by abma
Hi,

i'm trying to write an java-ai and i have a problem to find all units producing energy:

getResourceMake works to find advanced fusion and so...
and getUpkeep to find the solar-plants (in BA).

But wich property makes a Windmill produce Energy?
getMakesResource and getExtractsResource always returns zero...

See this table (BA 7.00):
http://pastebin.com/f3008861e

Re: How to get all energy producing Units?

Posted: 26 Aug 2009, 14:41
by Tobi
Maybe getWindResourceGenerator (and getTidalResourceGenerator for tidals) will help you?

Re: How to get all energy producing Units?

Posted: 26 Aug 2009, 14:48
by abma
yes, this was the function i searched thanks.

In short this does what i searched:

Code: Select all

if (UnitDef.getUpkeep(redID) *-1 + 
UnitDef.getResourceMake(redID) + UnitDef.getWindResourceGenerator(redID)  +
UnitDef.getTidalResourceGenerator(redID)) > 0 ) {
...
}

i was confused about the negative energy usage of a solarplant in the ba mod.

Re: [JAVA-AI] How to get all energy producing Units?

Posted: 26 Aug 2009, 18:14
by AF
its a hack from the OTA engine that allows a solar to stop producing energy when it closes.