Search in sources :

Example 1 with AIRobot

use of buildcraft.api.robots.AIRobot in project BuildCraft by BuildCraft.

the class EntityRobot method getDebugInfo.

@Override
public void getDebugInfo(List<String> left, List<String> right, EnumFacing side) {
    left.add("Robot:");
    if (board != null) {
        if (board.getNBTHandler() != null) {
            left.add("  " + board.getNBTHandler().getID());
        } else {
            left.add("  " + board.getClass());
        }
    } else {
        left.add("  Unknown type");
    }
    if (getBattery() != null) {
        left.add("  Battery " + getBattery().getEnergyStored() + "/" + getBattery().getMaxEnergyStored() + " RF");
    }
    left.add(String.format("Position: %.2f, %.2f, %.2f", posX, posY, posZ));
    left.add("AI tree:");
    AIRobot aiRobot = mainAI;
    while (aiRobot != null) {
        left.add("- " + RobotManager.getAIRobotName(aiRobot.getClass()) + " (" + aiRobot.getEnergyCost() + " RF/t)");
        if (aiRobot instanceof IDebuggable) {
            ((IDebuggable) aiRobot).getDebugInfo(left, right, side);
        }
        aiRobot = aiRobot.getDelegateAI();
    }
}
Also used : IDebuggable(buildcraft.api.tiles.IDebuggable) AIRobot(buildcraft.api.robots.AIRobot)

Example 2 with AIRobot

use of buildcraft.api.robots.AIRobot in project BuildCraft by BuildCraft.

the class ActionRobotGotoStation method actionActivate.

@Override
public void actionActivate(IStatementContainer container, IStatementParameter[] parameters) {
    IRobotRegistry registry = RobotManager.registryProvider.getRegistry(container.getTile().getWorld());
    List<DockingStation> stations = RobotUtils.getStations(container.getTile());
    for (DockingStation station : stations) {
        if (station.robotTaking() != null) {
            EntityRobot robot = (EntityRobot) station.robotTaking();
            AIRobot ai = robot.getOverridingAI();
            if (ai != null) {
                continue;
            }
            DockingStation newStation = station;
            if (parameters[0] != null) {
                newStation = getStation((StatementParameterItemStack) parameters[0], registry);
            }
            if (newStation != null) {
                robot.overrideAI(new AIRobotGoAndLinkToDock(robot, newStation));
            }
        }
    }
}
Also used : AIRobotGoAndLinkToDock(buildcraft.robotics.ai.AIRobotGoAndLinkToDock) DockingStation(buildcraft.api.robots.DockingStation) EntityRobot(buildcraft.robotics.EntityRobot) IRobotRegistry(buildcraft.api.robots.IRobotRegistry) StatementParameterItemStack(buildcraft.api.statements.StatementParameterItemStack) AIRobot(buildcraft.api.robots.AIRobot)

Aggregations

AIRobot (buildcraft.api.robots.AIRobot)2 DockingStation (buildcraft.api.robots.DockingStation)1 IRobotRegistry (buildcraft.api.robots.IRobotRegistry)1 StatementParameterItemStack (buildcraft.api.statements.StatementParameterItemStack)1 IDebuggable (buildcraft.api.tiles.IDebuggable)1 EntityRobot (buildcraft.robotics.EntityRobot)1 AIRobotGoAndLinkToDock (buildcraft.robotics.ai.AIRobotGoAndLinkToDock)1