Module Sensors
A ship's sensors, which provide information about events that occurred on the previous tick. In general, a ship or team is aware of any event that happens to a ship that it controls, or to any ship that is visible to a ship that it controls.
Functions
Tables
Functions
- hitByLaserEvents ()
-
Details of lasers hitting ships under this program's control.
Return value:
A table of all HitByLaserEvent
s from the previous tick.
See also:
- hitByShipEvents ()
-
Details of ship-ship collisions with ships under this program's control.
Return value:
A table of all HitByShipEvent
s from the previous tick.
See also:
- hitByTorpedoEvents ()
-
Details of torpedos hitting ships under this program's control.
Return value:
A table of all HitByTorpedoEvent
s from the previous tick.
See also:
- hitWallEvents ()
-
Details of ship-wall collisions with ships under this program's control.
Return value:
A table of all HitWallEvent
s from the previous tick.
See also:
- laserHitShipEvents ()
-
Details of lasers hitting visible enemy ships.
Return value:
A table of all visible LaserHitShipEvent
s from the previous tick.
See also:
- shipDestroyedEvents ()
-
Details of all ships destroyed. Unlike most events, these are reported even to programs that didn't have vision of them.
Return value:
A table of all ShipDestroyedEvent
s from the previous tick.
See also:
- shipFiredLaserEvents ()
-
Details of lasers fired by visible enemy ships.
Return value:
A table of all visible ShipFiredLaserEvent
s from the previous tick.
See also:
- shipFiredTorpedoEvents ()
-
Details of torpedos fired by visible enemy ships.
Return value:
A table of all visible ShipFiredTorpedoEvent
s from the previous tick.
See also:
- stageEvents ()
-
All events sent from the stage to a ship under this program's control. These events can have any format - nil, number, string, boolean, or table with any combination of these types, including nested tables. So a ship needs to be designed to understand the specfiic event API of any stage that sends it stage events.
Tables
- HitByLaserEvent
- Details of a laser hitting a ship under this program's control.
Fields:
-
time: The time of the laser-ship collision.
-
targetName: The name of the ship that was hit.
-
laserX: The x coordinate of the hitting laser.
-
laserY: The y coordinate of the hitting laser.
-
laserHeading: The angle at which the laser was traveling.
- HitByShipEvent
- Details of a ship-ship collision.
Fields:
-
time: The time of the ship-ship collision.
-
targetName: The name of the ship (under this program's control) that was hit.
-
targetX: The x coordinate of the ship that was hit.
-
targetY: The y coordinate of the ship that was hit.
-
hittingName: The name of the hitting ship.
-
hittingX: The x coordinate of the hitting ship.
-
hittingY: The y coordinate of the hitting ship.
-
inAngle: The angle from the hitting ship to the target ship.
-
inForce: The magnitude of force that the hitting ship applied to the target ship, altering its momentum.
-
outAngle: The angle from the target ship to the hitting ship.
-
outForce: The magnitude of force that the target ship applied to the hitting ship, altering its momentum.
- HitByTorpedoEvent
- Details of a torpedo hitting a ship under this program's control.
Fields:
-
time: The time of the torpedo-ship collision.
-
targetName: The name of the ship that was hit.
-
hitAngle: The angle from the blast center to the target ship.
-
hitForce: The magnitude of force that the torpedo blast applied to the target ship, altering its momentum.
-
hitDamage: The damage done by the torpedo blast to the target ship, decreasing its energy.
- HitWallEvent
- Details of a ship under this program's control hitting the wall.
Fields:
-
time: The time of the ship-wall collision.
-
shipName: The name of the ship that hit the wall.
-
shipX: The x coordinate of the ship when it hit the wall.
-
shipY: The y coordinate of the ship when it hit the wall.
-
bounceAngle: The angle at which the collision exerted force against the ship.
-
bounceForce: The mangnitude of force that the wall collision applied to the target ship, altering its momentum.
- LaserHitShipEvent
- Details of a laser hitting a visible enemy ship.
Fields:
-
time: The time of the laser-ship collision.
-
targetName: The name of the ship that was hit.
-
targetX: The x coordinate of the ship when it was hit.
-
targetY: The y coordinate of the ship when it was hit.
- ShipDestroyedEvent
- Details of a ship being destroyed.
Fields:
-
time: The time that the ship was destroyed.
-
shipName: The name of the ship that was destroyed.
- ShipFiredLaserEvent
- Details of a visible enemy ship firing a laser.
Fields:
-
time: The time that the ship fired a laser.
-
shipName: The name of the ship that fired a laser.
-
shipX: The x coordinate of the ship when it fired a laser.
-
shipY: The y coordinate of the ship when it fired a laser.
- ShipFiredTorpedoEvent
- Details of a visible enemy ship firing a torpedo.
Fields:
-
time: The time that the ship fired a torpedo.
-
shipName: The name of the ship that fired a torpedo.
-
shipX: The x coordinate of the ship when it fired a torpedo.
-
shipY: The y coordinate of the ship when it fired a torpedo.