Class

cwinter.codecraft.core.api

DroneController

Related Doc: package api

Permalink

class DroneController extends DroneControllerBase

A drone controller is an object that governs the behaviour of a drone. It exposes a wide range of methods to query the underlying drone's state and give it commands. You can inherit from this class to and override the onEvent methods to implement a drone controller with custom behaviour.

In Java, use JDroneController instead.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. DroneController
  2. DroneControllerBase
  3. Drone
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new DroneController()

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. def alliesInSight: Set[Drone]

    Permalink

    Gets all allied drones currently within the sight radius of this drone.

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def availableStorage: Int

    Permalink

    Returns the number of free storage capacity.

    Returns the number of free storage capacity.

    Definition Classes
    Drone
  7. def buildDrone(controller: DroneControllerBase, storageModules: Int = 0, missileBatteries: Int = 0, constructors: Int = 0, engines: Int = 0, shieldGenerators: Int = 0): Unit

    Permalink

    Order the drone to start the construction of a new drone.

    Order the drone to start the construction of a new drone. While construction is in progress, the drone cannot move.

    controller

    The drone controller that will govern the behaviour of the new drone.

    storageModules

    The new drone's number of storage modules.

    missileBatteries

    The new drone's number of missile batteries.

    constructors

    The new drone's number of constructors.

    engines

    The new drone's number of engines.

    shieldGenerators

    The new drone's number of shield generators.

    Definition Classes
    DroneControllerBase
  8. def buildDrone(controller: DroneControllerBase, spec: DroneSpec): Unit

    Permalink

    Order the drone to start the construction of a new drone.

    Order the drone to start the construction of a new drone. While construction is in progress, the drone cannot move.

    controller

    The drone controller that will govern the behaviour of the new drone.

    spec

    The specification for the number of copies for each module equipped by the new drone.

    Definition Classes
    DroneControllerBase
  9. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  10. final def constructors: Int

    Permalink

    Returns the number of constructor modules

    Returns the number of constructor modules

    Definition Classes
    Drone
  11. def displayString: String

    Permalink

    Returns a string that encodes various properties of the drone.

    Returns a string that encodes various properties of the drone.

    Definition Classes
    Drone
  12. def dronesInSight: Set[Drone]

    Permalink

    Gets all drones currently within the sight radius of this drone.

  13. def enemiesInSight: Set[Drone]

    Permalink

    Gets all enemy drones currently within the sight radius of this drone.

  14. final def engines: Int

    Permalink

    Returns the number of engine modules

    Returns the number of engine modules

    Definition Classes
    Drone
  15. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  16. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  17. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  18. def fireMissilesAt(target: Drone): Unit

    Permalink

    Fires all homing missiles at target.

    Fires all homing missiles at target.

    Definition Classes
    DroneControllerBase
  19. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  20. def giveResourcesTo(otherDrone: Drone): Unit

    Permalink

    Order the drone to give all its resources to otherDrone.

    Order the drone to give all its resources to otherDrone.

    otherDrone

    The drone which will receive the resources.

    Definition Classes
    DroneControllerBase
  21. def halt(): Unit

    Permalink

    Order the drone to stop moving.

    Order the drone to stop moving.

    Definition Classes
    DroneControllerBase
  22. def harvest(mineralCrystal: MineralCrystal): Unit

    Permalink

    Order the drone to harvest mineralCrystal.

    Order the drone to harvest mineralCrystal. Must already be close to the position of the mineralCrystal.

    Definition Classes
    DroneControllerBase
  23. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  24. def hitpoints: Int

    Permalink

    Returns the current number of hitpoints, including shields.

    Returns the current number of hitpoints, including shields.

    Definition Classes
    Drone
  25. def isConstructing: Boolean

    Permalink

    Returns true if this drone is currently constructing another drone.

    Returns true if this drone is currently constructing another drone.

    Definition Classes
    Drone
  26. def isDead: Boolean

    Permalink

    Returns true if this drone is dead, false otherwise.

    Returns true if this drone is dead, false otherwise.

    Definition Classes
    Drone
  27. def isEnemy: Boolean

    Permalink

    Always returns false.

    Always returns false.

    Definition Classes
    DroneControllerBaseDrone
  28. def isHarvesting: Boolean

    Permalink

    Returns true if this drone is currently harvesting a mineral.

    Returns true if this drone is currently harvesting a mineral.

    Definition Classes
    Drone
  29. def isInHarvestingRange(mineralCrystal: MineralCrystal): Boolean

    Permalink

    Returns true if mineralCrystal is within harvesting range, otherwise false.

    Returns true if mineralCrystal is within harvesting range, otherwise false.

    Definition Classes
    DroneControllerBase
  30. def isInMissileRange(otherDrone: Drone): Boolean

    Permalink

    Returns true if otherDrone is within range of this drones homing missiles, otherwise false.

    Returns true if otherDrone is within range of this drones homing missiles, otherwise false.

    Definition Classes
    DroneControllerBase
  31. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  32. def isMoving: Boolean

    Permalink

    Returns true of this drone has a movement command active or queued up, false otherwise.

    Returns true of this drone has a movement command active or queued up, false otherwise.

    Definition Classes
    Drone
  33. def isVisible: Boolean

    Permalink

    Always returns true

    Always returns true

    Definition Classes
    DroneControllerBaseDrone
  34. def lastKnownOrientation: Double

    Permalink

    The orientation of this drone at the last time it was seen by any of your drones.

    The orientation of this drone at the last time it was seen by any of your drones.

    Definition Classes
    DroneControllerBaseDrone
  35. def lastKnownPosition: Vector2

    Permalink

    The position of this drone at the last time it was seen by any of your drones.

    The position of this drone at the last time it was seen by any of your drones.

    Definition Classes
    DroneControllerBaseDrone
  36. final def maxHitpoints: Int

    Permalink

    Returns the amount of hitpoints at full health.

    Returns the amount of hitpoints at full health.

    Definition Classes
    Drone
  37. final def maxSpeed: Double

    Permalink

    Returns the drone's maximum speed.

    Returns the drone's maximum speed.

    Definition Classes
    Drone
  38. def metaController: Option[MetaController]

    Permalink

    When you start the game, this method will be called once on your initial drone controller to give you an opportunity to provide a cwinter.codecraft.core.api.MetaController.

    When you start the game, this method will be called once on your initial drone controller to give you an opportunity to provide a cwinter.codecraft.core.api.MetaController.

    Definition Classes
    DroneControllerBase
  39. final def missileBatteries: Int

    Permalink

    Returns the number of missile battery modules.

    Returns the number of missile battery modules.

    Definition Classes
    Drone
  40. def missileCooldown: Int

    Permalink

    Returns the drone's homing missile cooldown.

    Returns the drone's homing missile cooldown.

    Definition Classes
    Drone
  41. def moveInDirection(direction: Float): Unit

    Permalink

    Order the drone to keep moving in the direction of direction.

    Order the drone to keep moving in the direction of direction.

    Definition Classes
    DroneControllerBase
  42. def moveInDirection(direction: Double): Unit

    Permalink

    Order the drone to keep moving in the direction of direction.

    Order the drone to keep moving in the direction of direction.

    Definition Classes
    DroneControllerBase
  43. def moveInDirection(directionVector: Vector2): Unit

    Permalink

    Order the drone to keep moving in the direction of directionVector.

    Order the drone to keep moving in the direction of directionVector.

    Definition Classes
    DroneControllerBase
  44. def moveTo(position: Vector2): Unit

    Permalink

    Order the drone to move to position.

    Order the drone to move to position.

    Definition Classes
    DroneControllerBase
  45. def moveTo(x: Double, y: Double): Unit

    Permalink

    Order the drone to move to coordinates (x, y).

    Order the drone to move to coordinates (x, y).

    Definition Classes
    DroneControllerBase
  46. def moveTo(mineralCrystal: MineralCrystal): Unit

    Permalink

    Order the drone to move towards mineralCrystal.

    Order the drone to move towards mineralCrystal.

    Definition Classes
    DroneControllerBase
  47. def moveTo(otherDrone: Drone): Unit

    Permalink

    Order the drone to move towards otherDrone, until it is within 10 units distance of colliding.

    Order the drone to move towards otherDrone, until it is within 10 units distance of colliding.

    Definition Classes
    DroneControllerBase
  48. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  49. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  50. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  51. def onArrivesAtDrone(drone: Drone): Unit

    Permalink

    Called when this drone arrives at another drone after invoking the moveTo(drone: DroneHandle) command.

    Called when this drone arrives at another drone after invoking the moveTo(drone: DroneHandle) command.

    Definition Classes
    DroneControllerBase
  52. def onArrivesAtMineral(mineralCrystal: MineralCrystal): Unit

    Permalink

    Called when this drone arrives at a mineral crystal after invoking the moveTo(mineral: MineralCrystalHandle) command.

    Called when this drone arrives at a mineral crystal after invoking the moveTo(mineral: MineralCrystalHandle) command.

    Definition Classes
    DroneControllerBase
  53. def onArrivesAtPosition(): Unit

    Permalink

    Called when this drone arrives a position after invoking the one of the moveTo methods.

    Called when this drone arrives a position after invoking the one of the moveTo methods.

    Definition Classes
    DroneControllerBase
  54. def onConstructionCancelled(): Unit

    Permalink

    Called if the drone constructing this drone is destroyed before construction completes.

    Called if the drone constructing this drone is destroyed before construction completes. In such a case, this is the only event function to be called.

    Definition Classes
    DroneControllerBase
  55. def onDeath(): Unit

    Permalink

    Called if the drone is destroyed.

    Called if the drone is destroyed.

    Definition Classes
    DroneControllerBase
  56. def onDroneEntersVision(drone: Drone): Unit

    Permalink

    Called when another drone enters the sight radius of this drone.

    Called when another drone enters the sight radius of this drone.

    Definition Classes
    DroneControllerBase
  57. def onMineralEntersVision(mineralCrystal: MineralCrystal): Unit

    Permalink

    Called when a mineral crystal enters the sight radius of this drone.

    Called when a mineral crystal enters the sight radius of this drone.

    Definition Classes
    DroneControllerBase
  58. def onSpawn(): Unit

    Permalink

    Called once when the drone is spawned.

    Called once when the drone is spawned. Called before any other onEvent method is called.

    Definition Classes
    DroneControllerBase
  59. def onTick(): Unit

    Permalink

    Called once every tick, after all other onEvent methods have been called.

    Called once every tick, after all other onEvent methods have been called.

    Definition Classes
    DroneControllerBase
  60. def orientation: Double

    Permalink

    Returns the drones orientation in radians.

    Returns the drones orientation in radians.

    Definition Classes
    Drone
  61. def playerID: Int

    Permalink

    Returns the identifier of the player that owns this drone.

    Returns the identifier of the player that owns this drone.

    Definition Classes
    Drone
  62. def position: Vector2

    Permalink

    Returns the drone's position.

    Returns the drone's position.

    Definition Classes
    Drone
  63. final def shieldGenerators: Int

    Permalink

    Returns the number of shield generator modules

    Returns the number of shield generator modules

    Definition Classes
    Drone
  64. def showText(text: String, position: Vector2): Unit

    Permalink

    Draws the specified text at the specified position on this timestep.

    Draws the specified text at the specified position on this timestep.

    Definition Classes
    DroneControllerBase
  65. def showText(text: String): Unit

    Permalink

    Draws the specified text at the position of the drone on this timestep.

    Draws the specified text at the position of the drone on this timestep.

    Definition Classes
    Drone
  66. final def spec: DroneSpec

    Permalink

    Returns an object that specifies how many copies of each module the drone has.

    Returns an object that specifies how many copies of each module the drone has.

    Definition Classes
    Drone
    Annotations
    @inline()
  67. final def storageModules: Int

    Permalink

    Returns the number of storage modules.

    Returns the number of storage modules.

    Definition Classes
    Drone
  68. def storedResources: Int

    Permalink

    Returns the amount of resources store by this drone.

    Returns the amount of resources store by this drone.

    Definition Classes
    Drone
  69. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  70. def tickPeriod: Int

    Permalink

    Indicates how many simulation steps pass in between calls to event methods.

    Indicates how many simulation steps pass in between calls to event methods.

    E.g. if tickDuration == 1, then event methods will be called on every simulation step. This is the default setting for singleplayer games. If tickDuration == 10, event methods will only be called on every 10th simulation step.

    Definition Classes
    DroneControllerBase
  71. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  72. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  73. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  74. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  75. def worldSize: Rectangle

    Permalink

    Returns the confines of the game world.

    Returns the confines of the game world.

    Definition Classes
    DroneControllerBase

Deprecated Value Members

  1. def availableRefineries: Int

    Permalink

    Returns 0.

    Returns 0.

    Definition Classes
    DroneControllerBase
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.0) The refinery module has been removed.

  2. def buildDrone(spec: DroneSpec, controller: DroneControllerBase): Unit

    Permalink

    Order the drone to start the construction of a new drone.

    Order the drone to start the construction of a new drone. While construction is in progress, the drone cannot move.

    spec

    The specification for the number of copies for each module equipped by the new drone.

    controller

    The drone controller that will govern the behaviour of the new drone.

    Definition Classes
    DroneControllerBase
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.3) Swap the positions of the spec and controller arguments.

  3. def giveMineralsTo(otherDrone: Drone): Unit

    Permalink
    Definition Classes
    DroneControllerBase
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.3) Use giveResourcesTo instead.

  4. def storedMinerals: Seq[MineralCrystal]

    Permalink

    Returns an empty Seq.

    Returns an empty Seq.

    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.0) Drones do not store mineral crystals anymore, only resources.

  5. def totalAvailableResources: Int

    Permalink

    Returns the total amount of resources available to this drone.

    Returns the total amount of resources available to this drone. This includes any mineral crystals that are small enough to be processed by this drone.

    Definition Classes
    Drone
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.0) Use storedResources instead.

  6. def weaponsCooldown: Int

    Permalink
    Definition Classes
    Drone
    Annotations
    @deprecated
    Deprecated

    (Since version 0.2.4.3) Use missileCooldown instead.

Inherited from DroneControllerBase

Inherited from Drone

Inherited from AnyRef

Inherited from Any

Ungrouped