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

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

Here is where ideas can be collected for the skirmish AI in development

Moderators: hoijui, Moderators

Post Reply
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

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

Post 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
Last edited by abma on 26 Aug 2009, 14:51, edited 1 time in total.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: How to get all energy producing Units?

Post by Tobi »

Maybe getWindResourceGenerator (and getTidalResourceGenerator for tidals) will help you?
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: How to get all energy producing Units?

Post 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.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

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

Post by AF »

its a hack from the OTA engine that allows a solar to stop producing energy when it closes.
Post Reply

Return to “AI”