Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PowerCell can't be found using radar() while in PowerPlant
#1
When the new PowerCell is produced, calling
Code:
radar(PowerCell);
doesn't return it.

I have written small program to demonstrate this behaviour:
Code:
extern void object::GetPowerCell()
{
    object pPlant, pCell;
    
    // place PowerPlant nearby
    produce(flatspace(position, 0), 0, PowerPlant, "");
    
    pPlant = radar(PowerPlant);
    
    // grab Titanium
    produce(position, 0, Titanium, "");
    grab();
    goto(pPlant.position);
    drop();
    
    // detect PowerCell in PowerPlant only
    pCell = radar(PowerCell, 0, 360, 0, 5);
    while (pCell == null)
    {
        message("Waiting for power cell.");
        
        wait(3);
        pCell = radar(PowerCell, 0, 360, 0, 5);
    }
    
    // never happens, since the new PowerCell remains undetectable
    message(pCell.id);
}

Although it is possible to retrieve the PowerCell by grabing blindly while near PowerPlant, IMO it feels very counerintuitive, especially since retrieving Titanium as above works as expected.

I think fixing this would make the game less confusing for beginner players (like me).

Best regards,
Virzen

PS I didn't post it as issue on GitHub, because I don't know the game well and I account for the possibility this is inteded behaviour.
#2
@Virzen

The radar(); function only detects this type of object if it is on the ground.

However, using the above code as an example:

Code:
pPlant = radar(PowerPlant);

pPlant.busy(); // returns true if the PowerCell is being produced and false when it is done.

pCell = pPlant.energyCell; // is a pointer to the object that was produced, and returns as null until it is produced.

This is true for PowerCells on robots and other buildings as well.
#3
Exactly like @melex750 said - radar only detects objects on the ground, use .energyCell on the PowerPlant to get the item in the object's slot. If you goto() to the PowerPlant, you'll always be positioned in front of the PowerCell in the building.
#4
Well, I haven't thought of that. Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)