EmptyEpsilon Scripting Reference

This is the EmptyEpsilon script reference for this version of EmptyEpsilon.

By no means this is a guide to help you scripting, you should check emptyepsilon.org for the guide on scripting. As well as check the already existing scenario and ship data files on how to get started.

Some of the types in the parameters:

Note that most SpaceObjects directly switch to fully scanned, only SpaceShipss go through all the states.

Objects

Functions

BlackHole

A blackhole has a 5km radius where it pulls in all near objects. At the center of the black hole everything gets a lot of damage.
Which will lead to the eventual destruction of said object.
Subclass of: SpaceObject

BeamEffect

BeamEffect is a beam weapon fire effect that will fade after 1 seond
Example: BeamEffect():setSource(player):setTarget(enemy_ship)
Subclass of: SpaceObject
BeamEffect:setSource(P<SpaceObject> source, sf::Vector3f offset)
BeamEffect:setTarget(P<SpaceObject> target, sf::Vector2f hitLocation)
BeamEffect:setTexture(string texture)
BeamEffect:setBeamFireSound(string sound)
BeamEffect:setBeamFireSoundPower(float power)
BeamEffect:setDuration(float duration)
BeamEffect:setRing(bool ring)

SpaceShip

Subclass of: ShipTemplateBasedObject
SpaceShip:isFriendOrFoeIdentified()
[DEPRECATED]
SpaceShip:isFullyScanned()
[DEPRECATED]
SpaceShip:isFriendOrFoeIdentifiedBy(P<SpaceObject> other)
SpaceShip:isFullyScannedBy(P<SpaceObject> other)
SpaceShip:isFriendOrFoeIdentifiedByFaction(int faction_id)
SpaceShip:isFullyScannedByFaction(int faction_id)
SpaceShip:isDocked(P<SpaceObject> target)
SpaceShip:getDockedWith()
SpaceShip:getTarget()
SpaceShip:getWeaponStorage(EMissileWeapons weapon)
SpaceShip:getWeaponStorageMax(EMissileWeapons weapon)
SpaceShip:setWeaponStorage(EMissileWeapons weapon, int amount)
SpaceShip:setWeaponStorageMax(EMissileWeapons weapon, int amount)
SpaceShip:getShieldsFrequency(void)
SpaceShip:setShieldsFrequency(float freq)
SpaceShip:getBeamFrequency()
SpaceShip:getMaxEnergy()
SpaceShip:setMaxEnergy(float amount)
SpaceShip:getEnergy()
SpaceShip:setEnergy(float amount)
SpaceShip:hasSystem(ESystem system)
SpaceShip:getSystemHackedLevel(ESystem system)
SpaceShip:setSystemHackedLevel(ESystem system, float hacked_level)
SpaceShip:getSystemHealth(ESystem system)
SpaceShip:setSystemHealth(ESystem system, float health)
SpaceShip:getSystemHealthMax(ESystem system)
SpaceShip:setSystemHealthMax(ESystem system, float health_max)
SpaceShip:getSystemHeat(ESystem system)
SpaceShip:setSystemHeat(ESystem system, float heat)
SpaceShip:getSystemPower(ESystem system)
SpaceShip:setSystemPower(ESystem system, float power)
SpaceShip:getSystemPowerFactor(ESystem system)
SpaceShip:setSystemPowerFactor(ESystem system, float factor)
SpaceShip:getSystemCoolant(ESystem system)
SpaceShip:setSystemCoolant(ESystem system, float coolant)
SpaceShip:getImpulseMaxSpeed()
SpaceShip:setImpulseMaxSpeed(float speed)
SpaceShip:getRotationMaxSpeed()
SpaceShip:setRotationMaxSpeed(float speed)
SpaceShip:getAcceleration()
SpaceShip:setAcceleration(float acceleration)
SpaceShip:setCombatManeuver(float boost, float strafe)
SpaceShip:hasJumpDrive()
SpaceShip:setJumpDrive(bool has_jump)
SpaceShip:setJumpDriveRange(float min, float max)
SpaceShip:setJumpDriveCharge(float charge)
sets the current jump range charged.
ships will be able to jump when this is equal to their max jump drive range.
Example ship:setJumpDriveCharge(50000)
SpaceShip:getJumpDriveCharge()
returns the current amount of jump charged.
Example ship:getJumpDriveCharge()
SpaceShip:hasWarpDrive()
SpaceShip:setWarpDrive(bool has_warp)
SpaceShip:setWarpSpeed(float speed)
Set the warp speed for this ship's warp level 1.
Setting this is equivalent to also setting setWarpDrive(true).
If a value isn't specified in the ship template, the default is 1000.
Requires a numeric value.
Example: ship:setWarpSpeed(500);
SpaceShip:getWarpSpeed()
SpaceShip:getBeamWeaponArc(int index)
SpaceShip:getBeamWeaponDirection(int index)
SpaceShip:getBeamWeaponRange(int index)
SpaceShip:getBeamWeaponTurretArc(int index)
SpaceShip:getBeamWeaponTurretDirection(int index)
SpaceShip:getBeamWeaponCycleTime(int index)
SpaceShip:getBeamWeaponDamage(int index)
SpaceShip:getBeamWeaponEnergyPerFire(int index)
SpaceShip:getBeamWeaponHeatPerFire(int index)
SpaceShip:setBeamWeapon(int index, float arc, float direction, float range, float cycle_time, float damage)
SpaceShip:setBeamWeaponTurret(int index, float arc, float direction, float rotation_rate)
SpaceShip:setBeamWeaponTexture(int index, string texture)
SpaceShip:setBeamWeaponEnergyPerFire(int index, float energy)
SpaceShip:setBeamWeaponHeatPerFire(int index, float heat)
SpaceShip:setWeaponTubeCount(int amount)
SpaceShip:getWeaponTubeCount()
SpaceShip:getWeaponTubeLoadType(int index)
SpaceShip:weaponTubeAllowMissle(int index, EMissileWeapons type)
SpaceShip:weaponTubeDisallowMissle(int index, EMissileWeapons type)
SpaceShip:setWeaponTubeExclusiveFor(int index, EMissileWeapons type)
SpaceShip:setWeaponTubeDirection(int index, float direction)
SpaceShip:setTubeSize(int index, EMissileSizes size)
Set the tube size
Example: ship:setTubeSize(0,"small")
Valid Sizes: "small" "medium" "large"
SpaceShip:getTubeSize(int index)
Returns the size of the tube
Example: local size = ship:getTubeSize(0)
SpaceShip:getTubeLoadTime(int index)
SpaceShip:setTubeLoadTime(int index, float time)
SpaceShip:setRadarTrace(string trace)
Set the icon to be used for this ship on the radar.
For example, ship:setRadarTrace("RadarBlip.png") will show a dot instead of an arrow for this ship.
Note: Icon is only shown after scanning, before the ship is scanned it is always shown as an arrow.
SpaceShip:getDynamicRadarSignatureGravity()
Get the dynamic radar signature values for each component band.
Returns a float.
Example: obj:getDynamicRadarSignatureGravity()
SpaceShip:getDynamicRadarSignatureElectrical()
SpaceShip:getDynamicRadarSignatureBiological()
SpaceShip:addBroadcast(int threshold, string message)
SpaceShip:setScanState(EScannedState scanned)
Set the scan state of this ship for every faction.
SpaceShip:setScanStateByFaction(string faction_name, EScannedState scanned)
Set the scane state of this ship for a particular faction.

ExplosionEffect

ExplosionEffect is a visible explosion, like from nukes, missiles, ship destruction, etc
Example: ExplosionEffect():setPosition(500,5000):setSize(20)
Subclass of: SpaceObject
ExplosionEffect:setSize(float size)
ExplosionEffect:setOnRadar(bool on_radar)

WarpJammer

A warp jammer.
Subclass of: SpaceObject
WarpJammer:setRange(float range)
WarpJammer:onTakingDamage(ScriptSimpleCallback callback)
Set a function that will be called if the warp jammer is taking damage.
First argument given to the function will be the warp jammer, the second the instigator SpaceObject (or nil).
WarpJammer:onDestruction(ScriptSimpleCallback callback)
Set a function that will be called if the warp jammer is destroyed by taking damage.
First argument given to the function will be the warp jammer, the second the instigator SpaceObject that gave the final blow (or nil).

Nebula

Nebulae block long-range radar in a 5U range.
Subclass of: SpaceObject

FactionInfo

FactionInfo:setName(string name)
FactionInfo:setLocaleName(string name)
FactionInfo:setGMColor(int r, int g, int b)
FactionInfo:setDescription(string description)
FactionInfo:setEnemy(P<FactionInfo> other)
FactionInfo:setFriendly(P<FactionInfo> other)
FactionInfo:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
FactionInfo:destroy()
Removes this object from the game.
FactionInfo:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

HomingMissile

Homing missile
Subclass of: MissileWeapon

ModelData

ModelData:setName(string name)
ModelData:setMesh(string mesh_name)
ModelData:setTexture(string texture_name)
ModelData:setSpecular(string specular_texture_name)
ModelData:setIllumination(string illumination_texture_name)
ModelData:setRenderOffset(sf::Vector3f mesh_offset)
ModelData:setScale(float scale)
ModelData:setRadius(float radius)
ModelData:setCollisionBox(sf::Vector2f collision_box)
ModelData:addBeamPosition(sf::Vector3f position)
ModelData:addTubePosition(sf::Vector3f position)
ModelData:addEngineEmitor(sf::Vector3f position, sf::Vector3f color, float scale)
ModelData:addEngineEmitter(sf::Vector3f position, sf::Vector3f color, float scale)
ModelData:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
ModelData:destroy()
Removes this object from the game.
ModelData:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

Planet

A planet.
Subclass of: SpaceObject
Planet:setPlanetAtmosphereColor(float r, float g, float b)
Planet:setPlanetAtmosphereTexture(string texture_name)
Planet:setPlanetSurfaceTexture(string texture_name)
Planet:setPlanetCloudTexture(string texture_name)
Planet:getPlanetRadius()
Planet:setPlanetRadius(float size)
Planet:getCollisionSize()
Planet:setPlanetCloudRadius(float size)
Planet:setDistanceFromMovementPlane(float distance_from_movement_plane)
Planet:setAxialRotationTime(float time)
Planet:setOrbit(P<SpaceObject> target, float orbit_time)

Mine

A mine object. Simple, effective, deadly.
Subclass of: SpaceObject
Mine:getOwner()
Mine:onDestruction(ScriptSimpleCallback callback)

HVLI

HVLI missile
Subclass of: MissileWeapon

ShipTemplateBasedObject

Subclass of: SpaceObject
ShipTemplateBasedObject:setTemplate(string template_name)
Set the template to be used for this ship or station. Templates define hull/shields/looks etc.
Examples:
CpuShip():setTemplate("Phobos T3")
PlayerSpaceship():setTemplate("Phobos M3P")
SpaceStation():setTemplate("Large Station")
WARNING: Using a string that is not a valid template name lets the game crash! This is case-sensitive.
See `scripts/shipTemplates.lua` for the existing templates.
ShipTemplateBasedObject:setShipTemplate(string template_name)
[Depricated]
ShipTemplateBasedObject:setTypeName(string type_name)
Set the class name of this object. Normally the class name is copied from the template name (Ex "Cruiser") but you can override it with this function.
ShipTemplateBasedObject:getTypeName()
ShipTemplateBasedObject:getHull()
Get the current amount of hull
ShipTemplateBasedObject:getHullMax()
Get the maximum hull value
ShipTemplateBasedObject:setHull(float amount)
Set the current hull value, note that setting this to 0 does not destroy the station.
ShipTemplateBasedObject:setHullMax(float amount)
Set the maximum amount of hull for this station. Stations never repair hull damage, so this only effects the percentage displays
ShipTemplateBasedObject:setCanBeDestroyed(bool enabled)
Set whether the object can be destroyed.
Requires a Boolean value.
Example: ship:setCanBeDestroyed(true)
ShipTemplateBasedObject:getCanBeDestroyed()
Get whether the object can be destroyed.
Returns a Boolean value.
Example: ship:getCanBeDestroyed()
ShipTemplateBasedObject:getShieldLevel(int index)
Get the specified shield's current level.
Requires an integer index value.
Returns a float value.
Example to get shield level on front shields of a ship with two shields:
ship:getShieldLevel(0)
Rear shields: ship:getShieldLevel(1)
ShipTemplateBasedObject:getShieldCount()
Get the number of shields on this object.
For example, a ship with 1 shield count has a single shield covering
all angles, a ship with 2 covers front and back, etc.
Returns an integer count.
Example: ship:getShieldCount()
ShipTemplateBasedObject:getShieldMax(int index)
Get the maxium shield level.
ShipTemplateBasedObject:setShields(std::vector<float> amounts)
Set the current amount of shields.
ShipTemplateBasedObject:setShieldsMax(std::vector<float> amounts)
Set the maximum shield level. Note that this does low the current shield level when the max becomes lower, but it does not increase the shield level.
A seperate call to setShield is needed for that.
ShipTemplateBasedObject:setRadarTrace(string trace)
Set the icon to be used for this object on the radar.
For example, station:setRadarTrace("RadarArrow.png") will show an arrow instead of a dot for this station.
ShipTemplateBasedObject:setImpulseSoundFile(string sound)
Set the sound file to be used for this object's impulse engines.
Requires a string for a filename relative to the resources path.
Example: setImpulseSoundFile("engine.wav")
ShipTemplateBasedObject:getShieldsActive()
Are the shields online or not. Currently always returns true except for player ships, as only players can turn off shields.
ShipTemplateBasedObject:getSharesEnergyWithDocked()
ShipTemplateBasedObject:setSharesEnergyWithDocked(bool enabled)
ShipTemplateBasedObject:getRepairDocked()
ShipTemplateBasedObject:setRepairDocked(bool enabled)
ShipTemplateBasedObject:getRestocksScanProbes()
ShipTemplateBasedObject:setRestocksScanProbes(bool enabled)
ShipTemplateBasedObject:getRestocksMissilesDocked()
ShipTemplateBasedObject:setRestocksMissilesDocked(bool enabled)
ShipTemplateBasedObject:getLongRangeRadarRange()
ShipTemplateBasedObject:getShortRangeRadarRange()
ShipTemplateBasedObject:setLongRangeRadarRange(float range)
ShipTemplateBasedObject:setShortRangeRadarRange(float range)
ShipTemplateBasedObject:getFrontShield()
[Depricated]
ShipTemplateBasedObject:getFrontShieldMax()
[Depricated]
ShipTemplateBasedObject:setFrontShield(float amount)
[Depricated]
ShipTemplateBasedObject:setFrontShieldMax(float amount)
[Depricated]
ShipTemplateBasedObject:getRearShield()
[Depricated]
ShipTemplateBasedObject:getRearShieldMax()
[Depricated]
ShipTemplateBasedObject:setRearShield(float amount)
[Depricated]
ShipTemplateBasedObject:setRearShieldMax(float amount)
[Depricated]
ShipTemplateBasedObject:onTakingDamage(ScriptSimpleCallback callback)
Set a function that will be called if the object is taking damage.
First argument given to the function will be the object taking damage, the second the instigator SpaceObject (or nil).
ShipTemplateBasedObject:onDestruction(ScriptSimpleCallback callback)
Set a function that will be called if the object is destroyed by taking damage.
First argument given to the function will be the object taking damage, the second the instigator SpaceObject that gave the final blow (or nil).

MissileWeapon

Base class for every missile (mines are not missiles)
You cannot create a missile in script with this class, use derived classes
like HomingMissile, HVLI etc.
Subclass of: SpaceObject
MissileWeapon:getOwner()
Get the missile's owner's object.
MissileWeapon:getTarget()
Get the missile's target object.
MissileWeapon:setTarget(P<SpaceObject> target)
Must be an existing target, else does nothing. It does not check if really targetable or not.
MissileWeapon:getLifetime()
Lifetime is a number in seconds
MissileWeapon:setLifetime(float lifetime)
Lifetime is a number in seconds
MissileWeapon:getMissileSize()
Set the missile size as for tube size.
Valid sizes: see EMissileSizes
MissileWeapon:setMissileSize(EMissileSizes missile_size)
Get the missile size as for tube size.
Valid sizes: see EMissileSizes

Artifact

An artifact.
Can be used for mission scripting.
Subclass of: SpaceObject
Artifact:setModel(string name)
Set the 3D model used for this artifact.
Example: setModel("artifact6"), setModel("shield_generator"), setModel("ammo_box").
Check model_data.lua for all possible options.
Artifact:explode()
Have this object explode with a visual explosion. The Artifact is destroyed by this action.
Artifact:allowPickup(bool allow)
Set if this artifact can be picked up or not. When it is picked up, this artifact will be destroyed.
Artifact:onCollision(ScriptSimpleCallback callback)
Set a function that will be called every tick when a SpaceObject is
colliding with the artifact.
Passes the artifact and colliding SpaceObject.
Example:
artifact:onCollision(function(artifact, collider) print("Collision occurred") end)
Artifact:onPlayerCollision(ScriptSimpleCallback callback)
Set a function that will be called every tick when a PlayerSpaceship is
colliding with the artifact.
Passes the artifact and colliding PlayerSpaceship.
Example:
artifact:onCollision(function(artifact, player) print("Collision occurred") end)
Artifact:onPickUp(ScriptSimpleCallback callback)
Set a function that will be called once when a PlayerSpaceship collides
with the artifact while allowPickup is enabled. The artifact is
subsequently destroyed.
Passes the artifact and colliding PlayerSpaceship.
Example:
artifact:onPickUp(function(artifact, player) print("Artifact retrieved") end)
Artifact:onPickup(ScriptSimpleCallback callback)
Alias of onPickUp.
Artifact:setSpin(float spin=0.0)
Let the artifact rotate. For reference, normal asteroids in the game have spins between 0.1 and 0.8.
Artifact:setRadarTraceIcon(string icon)
Set the icon to be used for this artifact on the radar.
For example, artifact:setRadarTraceIcon("RadarArrow.png") will show an arrow instead of a dot for this artifact.
Artifact:setRadarTraceScale(float scale)
Scales the radar trace. Setting to 0 restores to standard autoscaling.
Setting to 1 is needed for mimicking ship traces.
Artifact:setRadarTraceColor(int r, int g, int b)
Sets the color of the radar trace.
Example: 255,200,100 for mimicking asteroids.

SpaceStation

Subclass of: ShipTemplateBasedObject

WormHole

A wormhole object that drags objects toward it like a black hole, and then
teleports them to another point when they reach its center.
Subclass of: SpaceObject
WormHole:setTargetPosition(sf::Vector2f v)
Set the target of this wormhole
WormHole:getTargetPosition()
WormHole:onTeleportation(ScriptSimpleCallback callback)
Set a function that will be called if a SpaceObject is teleported.
First argument given to the function will be the WormHole, the second the SpaceObject that has been teleported.

ElectricExplosionEffect

ElectricExplosionEffect is a visible electrical explosion, as seen from EMP missiles
Example: ElectricExplosionEffect():setPosition(500,5000):setSize(20)
Subclass of: SpaceObject
ElectricExplosionEffect:setSize(float size)
ElectricExplosionEffect:setOnRadar(bool on_radar)

Zone

A zone area
Subclass of: SpaceObject
Zone:setPoints(std::vector<sf::Vector2f> points)
Set corners of n-gon to x_1, y_1, x_2, y_2, ..., x_n, y_n.
Recall that x goes right and y goes down.
Example: zone = Zone():setPoints(2000, 0, 0, 3000, -2000, 0)
Zone:setColor(int r, int g, int b)
Example: zone:setColor(255, 140, 0)
Zone:setLabel(string label)
Zone:getLabel()
Zone:isInside(P<SpaceObject> obj)

CpuShip

CpuShips are AI controlled ships.
They can get different orders.
Example: CpuShip():setTemplate("Fighter"):setPosition(random(-10000, 10000), random(0, 3000)):setFaction("Human Navy"):orderRoaming():setScanned(true)
Subclass of: SpaceShip
CpuShip:setAI(string new_ai)
Switch the AI to a different state. AI state can be set per ship,
defined in the shipTemplate, or left to "default". AI state is distinct
from orders, and determines the AI's tactics and responses in combat.
Valid values are "default", "missileVolley", "fighter", and "evasion".
"missileVolley" prefers lining up missile attacks from long range.
"fighter" prefers attacking at close range with strafing maneuvers.
"evasion" maintains distance from enemy weapons and evades attacks.
Example: enemy:setAI("fighter")
CpuShip:orderIdle()
Order this ship to hold the current position. Do nothing; don't attack.
Orders are distinct from AI state, and determines what the ship's
current objectives.
Example: enemy:orderIdle()
CpuShip:orderRoaming()
Order this ship to roam and engage at will, without a specific target.
Example: enemy:orderRoaming()
CpuShip:orderRetreat(P<SpaceObject> object)
Order this ship to dock at [order_target] to re-stock missiles and
repair its hull. If neccessary, roam to locate a dockable target.
Continue roaming after repairs and re-stocking, or if no dockable
target is found.
Requires a target ShipTemplateBasedObject that supports docking.
Example: enemy:orderRetreat(spaceStation)
CpuShip:orderStandGround()
Order this ship to hold the current position. Do not retreat, and
attack nearby targets.
Example: enemy:orderStandGround()
CpuShip:orderDefendLocation(sf::Vector2f position)
Order this ship to defend [order_target_location] against enemies that
get too close.
Requires x,y coordinates to defend.
Example: enemy:orderDefendLocation(500, 1000)
CpuShip:orderDefendTarget(P<SpaceObject> object)
Order this ship to defend [order_target] against enemies that get too
close. Default to AI_Roaming if the defense target is destroyed.
Requires a SpaceObject to defend.
Example: enemy:orderDefendTarget(enemy2)
CpuShip:orderFlyFormation(P<SpaceObject> object, sf::Vector2f offset)
Order this ship to follow [order_target] from a specified distance, and
to use [order_target]'s target if one is selected.
Requires a SpaceObject to serve as the formation's flight leader, and a
float value for the offset distance to maintain.
Example: enemy:orderFlyFormation(enemy2, 500)
CpuShip:orderFlyTowards(sf::Vector2f target)
Order this ship to move towards [order_target_location] and attack
enemies that get too close during transit. Disengage from combat and
continue towards the destination if enemies are too distant.
Requires x,y coordinates to move towards.
Example: enemy:orderFlyTowards(500, 1000)
CpuShip:orderFlyTowardsBlind(sf::Vector2f target)
Order this ship to move towards [order_target_location] while ignoring
all enemies. Don't attack.
Requires x,y coordinates to move towards.
Example: enemy:orderFlyTowardsBlind(500, 1000)
CpuShip:orderAttack(P<SpaceObject> object)
Order this ship to attack the specified [order_target].
Requires a SpaceObject to attack.
Example: enemy:orderAttack(player)
CpuShip:orderDock(P<SpaceObject> object)
Order this ship to dock with the specified target, if possible.
Requires a dockable SpaceObject to dock with.
Example: enemy:orderDock(spaceStation)
CpuShip:getOrder()
Get this ship's current orders.
Returns a string representation of the ship's current EAIOrder value.
Example: local ship_orders = enemy:getOrder()
CpuShip:getOrderTargetLocation()
Get the target location of this ship's current orders.
Returns the targeted x,y coordinates, or 0,0 if not defined.
Example: local x, y = enemy:getOrderTargetLocation()
CpuShip:getOrderTarget()
Get the target SpaceObject of this ship's current orders.
Returns the targeted SpaceObject.
Example: local target = enemy:getOrderTarget()

Asteroid

An asteroid in space. Which you can fly into and hit. Will do damage.
Subclass of: SpaceObject
Asteroid:setSize(float size)
Set the radius of this asteroid
The default radius for an asteroid is between 110 and 130
Example: Asteroid():setSize(50)
Asteroid:getSize()
Gets the current radius of this asteroid
Example: local size=Asteroid():getSize()

VisualAsteroid

An asteroid in space. Outside of hit range, just for visuals.
Subclass of: SpaceObject
VisualAsteroid:setSize(float size)
Set the radius of this asteroid
The default radius for an VisualAsteroid is between 110 and 130
Example: VisualAsteroid():setSize(50)
VisualAsteroid:getSize()
Gets the current radius of this asteroid
Example: local size=VisualAsteroid():getSize()

PlayerSpaceship

Subclass of: SpaceShip
PlayerSpaceship:getWaypoint(int index)
Returns the sf::Vector2f of a specific waypoint set by this ship.
Takes the index of the waypoint as its parameter.
PlayerSpaceship:getWaypointCount()
Returns the total number of this ship's active waypoints.
PlayerSpaceship:getAlertLevel()
Returns the ship's EAlertLevel.
PlayerSpaceship:setShieldsActive(bool active)
Sets whether this ship's shields are raised or lowered.
Takes a Boolean value.
PlayerSpaceship:addToShipLog(string message, sf::Color color)
Adds a message to the ship's log. Takes a string as the message and a
sf::Color.
PlayerSpaceship:transferPlayersToShip(P<PlayerSpaceship> other_ship)
Move all players connected to this ship to the same stations on a
different PlayerSpaceship. If the target isn't a PlayerSpaceship, this
function does nothing.
This can be used in scenarios to change the crew's ship.
PlayerSpaceship:transferPlayersAtPositionToShip(ECrewPosition position, P<PlayerSpaceship> other_ship)
Transfers only the crew members who fill a specific station to another
PlayerSpaceship.
PlayerSpaceship:hasPlayerAtPosition(ECrewPosition position)
Returns true if a station is occupied by a player, and false if not.
PlayerSpaceship:isCommsInactive()
PlayerSpaceship:isCommsOpening()
PlayerSpaceship:isCommsBeingHailed()
PlayerSpaceship:isCommsBeingHailedByGM()
PlayerSpaceship:isCommsFailed()
PlayerSpaceship:isCommsBroken()
PlayerSpaceship:isCommsClosed()
PlayerSpaceship:isCommsChatOpen()
PlayerSpaceship:isCommsChatOpenToGM()
PlayerSpaceship:isCommsChatOpenToPlayer()
PlayerSpaceship:isCommsScriptOpen()
PlayerSpaceship:setEnergyLevel(float amount)
PlayerSpaceship:setEnergyLevelMax(float amount)
PlayerSpaceship:getEnergyLevel()
PlayerSpaceship:getEnergyLevelMax()
PlayerSpaceship:setMaxCoolant(float coolant)
Set the maximum coolant available to engineering. Default is 10.
PlayerSpaceship:getMaxCoolant()
PlayerSpaceship:setScanProbeCount(int amount)
PlayerSpaceship:getScanProbeCount()
PlayerSpaceship:setMaxScanProbeCount(int amount)
PlayerSpaceship:getMaxScanProbeCount()
PlayerSpaceship:addCustomButton(ECrewPosition position, string name, string caption, ScriptSimpleCallback callback)
PlayerSpaceship:addCustomInfo(ECrewPosition position, string name, string caption)
PlayerSpaceship:addCustomMessage(ECrewPosition position, string name, string caption)
PlayerSpaceship:addCustomMessageWithCallback(ECrewPosition position, string name, string caption, ScriptSimpleCallback callback)
PlayerSpaceship:removeCustom(string name)
PlayerSpaceship:getBeamSystemTarget()
PlayerSpaceship:getBeamSystemTargetName()
Gets the name of the target system, instead of the ID
PlayerSpaceship:commandTargetRotation(float target)
PlayerSpaceship:commandImpulse(float target)
PlayerSpaceship:commandWarp(int8_t target)
PlayerSpaceship:commandJump(float distance)
PlayerSpaceship:commandSetTarget(P<SpaceObject> target)
PlayerSpaceship:commandLoadTube(int8_t tubeNumber, EMissileWeapons missileType)
PlayerSpaceship:commandUnloadTube(int8_t tubeNumber)
PlayerSpaceship:commandFireTube(int8_t tubeNumber, float missile_target_angle)
PlayerSpaceship:commandFireTubeAtTarget(int8_t tubeNumber, P<SpaceObject> target)
PlayerSpaceship:commandSetShields(bool enabled)
PlayerSpaceship:commandMainScreenSetting(EMainScreenSetting mainScreen)
PlayerSpaceship:commandMainScreenOverlay(EMainScreenOverlay mainScreen)
PlayerSpaceship:commandScan(P<SpaceObject> object)
PlayerSpaceship:commandSetSystemPowerRequest(ESystem system, float power_level)
Set power of the system to e.g. 1.5 ("150 percent")
PlayerSpaceship:commandSetSystemCoolantRequest(ESystem system, float coolant_level)
PlayerSpaceship:commandDock(P<SpaceObject> station)
PlayerSpaceship:commandUndock()
PlayerSpaceship:commandAbortDock()
PlayerSpaceship:commandOpenTextComm(P<SpaceObject> obj)
PlayerSpaceship:commandCloseTextComm()
PlayerSpaceship:commandAnswerCommHail(bool awnser)
PlayerSpaceship:commandSendComm(uint8_t index)
PlayerSpaceship:commandSendCommPlayer(string message)
PlayerSpaceship:commandSetAutoRepair(bool enabled)
Command repair crews to automatically move to damaged subsystems.
is command on ships to require less player interaction, especially
when combined with setAutoCoolant/auto_coolant_enabled.
PlayerSpaceship:commandSetBeamFrequency(int32_t frequency)
PlayerSpaceship:commandSetBeamSystemTarget(ESystem system)
PlayerSpaceship:commandSetShieldFrequency(int32_t frequency)
PlayerSpaceship:commandAddWaypoint(sf::Vector2f position)
PlayerSpaceship:commandRemoveWaypoint(int32_t index)
PlayerSpaceship:commandMoveWaypoint(int32_t index, sf::Vector2f position)
PlayerSpaceship:commandActivateSelfDestruct()
PlayerSpaceship:commandCancelSelfDestruct()
PlayerSpaceship:commandConfirmDestructCode(int8_t index, uint32_t code)
PlayerSpaceship:commandCombatManeuverBoost(float amount)
PlayerSpaceship:commandLaunchProbe(sf::Vector2f target_position)
PlayerSpaceship:commandSetScienceLink(P<ScanProbe> probe)
Command the science screen to link to the given ScanProbe object.
This is equivalent of selecting a probe on Relay and clicking
"Link to Science".
Example: player:commandSetScienceLink(probeObject)
PlayerSpaceship:commandClearScienceLink()
Command the science screen to clear its link to any ScanProbe object.
This is equivalent to clicking "Link to Science" on Relay when a link
is already active.
Example: player:commandClearScienceLink()
PlayerSpaceship:commandSetAlertLevel(EAlertLevel level)
PlayerSpaceship:getRepairCrewCount()
Return the number of Engineering repair crews on the ship.
PlayerSpaceship:setRepairCrewCount(int amount)
Set the total number of Engineering repair crews. If this value is less
than the number of repair crews, this function removes repair crews.
If the value is greater, it adds new repair crews at random locations.
PlayerSpaceship:setAutoCoolant(bool active)
Sets whether automatic coolant distribution is enabled. This sets the
amount of coolant proportionally to the amount of heat in that system.
Use this command on ships to require less player interaction, especially
when combined with commandSetAutoRepair/auto_repair_enabled.
PlayerSpaceship:setControlCode(string code)
Set a password to join the ship.
PlayerSpaceship:onProbeLaunch(ScriptSimpleCallback callback)
Callback when this ship launches a probe.
Passes the launching PlayerSpaceship and launched ScanProbe.
Example:
player:onProbeLaunch(function (player, probe)
print("Probe " .. probe:getCallSign() .. " launched from ship " .. player:getCallSign())
end)
PlayerSpaceship:onProbeLink(ScriptSimpleCallback callback)
Callback when this ship links a probe to the Science screen.
Passes the PlayerShip and linked ScanProbe.
Example:
player:onProbeLink(function (player, probe)
print("Probe " .. probe:getCallSign() .. " linked to Science on ship " .. player:getCallSign())
end)
PlayerSpaceship:onProbeUnlink(ScriptSimpleCallback callback)
Callback when this ship unlinks a probe on the Science screen.
Passes the PlayerShip and previously linked ScanProbe.
Does _not_ fire when the probe is destroyed or expires;
see ScanProbe:onDestruction() and ScanProbe:onExpiration().
Example:
player:onProbeUnlink(function (player, probe)
print("Probe " .. probe:getCallSign() .. " unlinked from Science on ship " .. player:getCallSign())
end)
PlayerSpaceship:getLongRangeRadarRange()
PlayerSpaceship:getShortRangeRadarRange()
PlayerSpaceship:setLongRangeRadarRange(float range)
PlayerSpaceship:setShortRangeRadarRange(float range)
PlayerSpaceship:setCanScan(bool enabled)
Set whether the object can scan other objects.
Requires a Boolean value.
Example: ship:setCanScan(true)
PlayerSpaceship:getCanScan()
Get whether the object can scan other objects.
Returns a Boolean value.
Example: ship:getCanScan()
PlayerSpaceship:setCanHack(bool enabled)
Set whether the object can hack other objects.
Requires a Boolean value.
Example: ship:setCanHack(true)
PlayerSpaceship:getCanHack()
Get whether the object can hack other objects.
Returns a Boolean value.
Example: ship:getCanHack()
PlayerSpaceship:setCanDock(bool enabled)
Set whether the object can dock with other objects.
Requires a Boolean value.
Example: ship:setCanDock(true)
PlayerSpaceship:getCanDock()
Get whether the object can dock with other objects.
Returns a Boolean value.
Example: ship:getCanDock()
PlayerSpaceship:setCanCombatManeuver(bool enabled)
Set whether the object can perform combat maneuvers.
Requires a Boolean value.
Example: ship:setCanCombatManeuver(true)
PlayerSpaceship:getCanCombatManeuver()
Get whether the object can perform combat maneuvers.
Returns a Boolean value.
Example: ship:getCanCombatManeuver()
PlayerSpaceship:setCanSelfDestruct(bool enabled)
Set whether the object can self destruct.
Requires a Boolean value.
Example: ship:setCanSelfDestruct(true)
PlayerSpaceship:getCanSelfDestruct()
Get whether the object can self destruct.
This returns false if self destruct size and damage are both 0, even if
you set setCanSelfDestruct(true).
Returns a Boolean value.
Example: ship:getCanSelfDestruct()
PlayerSpaceship:setCanLaunchProbe(bool enabled)
Set whether the object can launch probes.
Requires a Boolean value.
Example: ship:setCanLaunchProbe(true)
PlayerSpaceship:getCanLaunchProbe()
Get whether the object can launch probes.
Returns a Boolean value.
Example: ship:getCanLaunchProbe()
PlayerSpaceship:setSelfDestructDamage(float amount)
Set the amount of damage done by self destruction.
Requires a float; the value used is randomized +/- 33%.
Example: ship:setSelfDestructDamage(150)
PlayerSpaceship:getSelfDestructDamage()
Get the amount of damage done by self destruction.
Returns a float.
Example: ship:getSelfDestructDamage()
PlayerSpaceship:setSelfDestructSize(float size)
Set the size of the explosion created by self destruction.
Requires a float.
Example: ship:setSelfDestructSize(1500)
PlayerSpaceship:getSelfDestructSize()
Get the size of the explosion created by self destruction.
Returns a float.
Example: ship:getSelfDestructSize()

ScienceDatabase

ScienceDatabase:setName(string name)
ScienceDatabase:getName()
ScienceDatabase:getId [NOT FOUND; see SeriousProton]
ScienceDatabase:getParentId [NOT FOUND; see SeriousProton]
ScienceDatabase:addEntry(string name)
ScienceDatabase:getEntryByName(string name)
returns a child entry by its case-insensitive name
ScienceDatabase:getEntries()
returns a table of all child entries in arbitrary order
ScienceDatabase:hasEntries()
returns true if this entry has child entries
ScienceDatabase:addKeyValue(string key, string value)
add a new key-value pair in the center column of the database
ScienceDatabase:setKeyValue(string key, string value)
if an entry with this key exists already, its value will be changed. If not, the pair is created.
ScienceDatabase:getKeyValue(string key)
get the value of the key value-pair with the given key. returns empty string when key does not exist.
ScienceDatabase:getKeyValues [NOT FOUND; see SeriousProton]
get all the key value pairs as a table. Warning: if there are duplicate keys only appear once with the last value.
ScienceDatabase:removeKey(string key)
remove all key value pairs with the case-insensitive key value name
ScienceDatabase:setLongDescription(string text)
ScienceDatabase:getLongDescription()
ScienceDatabase:setImage(string path)
ScienceDatabase:getImage()
ScienceDatabase:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
ScienceDatabase:destroy()
Removes this object from the game.
ScienceDatabase:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

Nuke

Nuke missile
Subclass of: MissileWeapon

SpaceObject

SpaceObject is the base for every object which can be seen in space.
General properties can read and set for each object.
Each object has a position, rotation, and collision shape.
SpaceObject:setPosition(sf::Vector2f v)
Sets this object's position on the map, in meters from the origin.
Requires two numeric values.
Example: obj:setPosition(x, y)
SpaceObject:getPosition()
Gets this object's position on the map.
Returns x, y as meters from the origin.
Example: local x, y = obj:getPosition()
SpaceObject:setRotation(float angle)
Sets this object's absolute rotation, in degrees.
Unlike setHeading, a value of 0 points to the right of the map.
The value can also be unbounded; it can be negative, or greater than
360 degrees.
Requires a numeric value.
Example: obj:setRotation(270)
SpaceObject:getRotation()
Gets this object's absolute rotation.
setHeading and setRotation do not change the target heading of
PlayerSpaceships; use PlayerSpaceship's commandTargetRotation.
Returns a value in degrees.
Example: local rotation = obj:getRotation()
SpaceObject:setHeading(float heading)
Sets this object's heading, in degrees ranging from 0 to 360.
Unlike setRotation, a value of 0 points to the top of the map.
Values that are negative or greater than 360 are are converted to values
within that range.
setHeading and setRotation do not change the target heading of
PlayerSpaceships; use PlayerSpaceship's commandTargetRotation.
Requires a numeric value.
Example: obj:setHeading(0)
SpaceObject:getHeading()
Gets this object's heading, in degrees ranging from 0 to 360.
Returns a value in degrees.
Example: local heading = obj:getHeading(0)
SpaceObject:getVelocity()
Gets this object's directional velocity within 2D space.
Returns a pair of values x, y which are relative x, y coordinates from current position (2D velocity vector).
Example: local vx, vy = obj:getVelocity()
SpaceObject:getAngularVelocity()
Gets this object's rotational velocity within 2D space.
Returns a value in degrees/second.
Example: local angular_velocity = obj:getAngularVelocity()
SpaceObject:setFaction(string faction_name)
Sets the faction to which this object belongs, by faction name.
Factions are defined by the FactionInfo() function, and default
factions are defined in scripts/factionInfo.lua.
Requires a faction name string as input.
Example: obj:setFaction("Human Navy")
SpaceObject:getFaction()
Gets the name of the faction to which this object belongs.
Example: local faction = obj:getFaction()
SpaceObject:getLocaleFaction()
Gets the localized name of the faction to which this object belongs, for displaying to the players.
Example: local faction = obj:getLocaleFaction()
SpaceObject:setFactionId(unsigned int faction_id)
Sets the faction to which this object belongs, by the faction's index
in the faction list.
Requires the index of a faction in the faction list.
Example: local faction_id = obj:getFactionId()
SpaceObject:getFactionId()
Gets the faction list index for the faction to which this object
belongs. Can be used in combination with setFactionId() to ensure that
two objects have the same faction.
Example: other:setFactionId(obj:getFactionId())
SpaceObject:isEnemy(P<SpaceObject> obj)
Gets the friend-or-foe status of the parameter's faction relative to
this object's faction.
Requires a SpaceObject.
Returns true if the parameter's faction is hostile to this object's.
Example: local is_enemy = obj:isEnemy()
SpaceObject:isFriendly(P<SpaceObject> obj)
Requires a SpaceObject.
Returns true if the parameter's faction is friendly to this object's.
If an object is neither friendly nor enemy, it is neutral.
Example: local is_friendly = obj:isFriendly()
SpaceObject:setCommsScript(string script_name)
Sets the communications script used when this object is hailed.
Accepts the filename of a Lua script as a string, or can be set to an
empty string to disable comms with this object.
In the script, `comms_source` (or `player`, deprecated) (PlayerSpaceship)
and `comms_target` (SpaceObject) are available.
Compare `setCommsFunction`.
Examples:
obj:setCommsScript("")
obj:setCommsScript("comms_custom_script.lua")
Defaults:
"comms_station.lua" (in `spaceStation.cpp`)
"comms_ship.lua" (in `cpuShip.cpp`)
Call `setCommsMessage` once and `addCommsReply` zero or more times in each dialogue.
SpaceObject:setCommsFunction(ScriptSimpleCallback callback)
Defines a callback function to use when handling hails, in lieu of any
current or default comms script.
For a detailed example, see scenario_53_escape.lua.
Requires a function to call back to when hailed.
The globals `comms_source` (PlayerSpaceship)
and `comms_target` (SpaceObject) are made available in the scenario script.
(Note: They remain as globals. As usual, such globals are not accessible in required files.)
Compare `setCommsScript`.
Example: obj:setCommsFunction(commsStation)
where commsStation is a function
calling `setCommsMessage` once and `addCommsReply` zero or more times.
Instead of using the globals, the callback can take two parameters.
Example: obj:setCommsFunction(function(comms_source, comms_target) ... end)
SpaceObject:setCallSign(string new_callsign)
Set this object's callsign. Objects are assigned random callsigns at
creation; this function overrides that default.
Requires a string value.
Example: obj:setCallSign("Epsilon")
SpaceObject:sendCommsMessage(P<PlayerSpaceship> target, string message)
Hails a PlayerSpaceship from this object. The players' comms station is
notified and can accept or deny the hail. If the hail is answered, the
specified message is displayed to the player.
WARNING/TOFIX: If the PlayerSpaceship refuses the hail, the script
DOES NOT receive any feedback.
Returns true when the hail is accepted.
Returns false when the target player cannot be hailed right now, for
example because it's already communicating with something else.
Requires a target option and message. The message can be an empty
string.
Example: obj:sendCommsMessage(player, "Prepare to die")
SpaceObject:openCommsTo(P<PlayerSpaceship> target)
As sendCommsMessage, but sends an empty string as the message.
Example: obj:openCommsTo(player)
SpaceObject:getCallSign()
Gets this object's callsign.
Returns a string.
Example: local callsign = obj:getCallSign()
SpaceObject:areEnemiesInRange(float range)
Gets whether any objects from a hostile faction are within a specific
radius of this object, in meters.
Requires a numeric value for the radius.
Returns true if hostiles are in range.
Example: obj:areEnemiesInRange(5000)
SpaceObject:getObjectsInRange(float range)
Gets any objects within a specific radius of this object, in meters.
Requires a numeric value for the radius.
Returns a list of SpaceObjects within range.
Example: for _, obj_in_range in ipairs(obj:getObjectsInRange(5000)) ...
SpaceObject:setReputationPoints(float amount)
Sets this object's faction reputation to the specified amount.
Requires a numeric value.
Example: obj:setReputationPoints(1000)
SpaceObject:takeReputationPoints(float amount)
Deduct a specified amount of faction reputation points from this object.
Requires a numeric value.
Returns true if there are enough points to deduct the specified amount.
Returns false if there are not enough points, and does not deduct any.
Example: local took_reputation = obj:takeReputationPoints(1000)
SpaceObject:addReputationPoints(float amount)
Adds a specified amount of faction reputation points to this object.
Requires a numeric value.
Example: obj:addReputationPoints(1000)
SpaceObject:getSectorName()
Gets the name of the map sector, such as "A4", where this object is
located.
Returns a string value.
Example: obj:getSectorName()
SpaceObject:getReputationPoints()
Gets this object's current faction reputation points.
Returns an integer value.
Example: local reputation = obj:getReputationPoints();
SpaceObject:takeDamage(float damage_amount, DamageInfo info)
Deals a specific amount of a specific type of damage to this object.
Requires a numeric value for the damage amount, and accepts an optional
DamageInfo type.
The DamageInfo parameter can be empty, or a string that indicates
whether to deal the default "energy" damage, "kinetic" damage, or "emp"
damage, and can optionally be followed by the location of the damage's
origin (for instance, to damage the correct shield on ships).
SpaceObjects by default do not implement damage, instead leaving it to
be overridden by specialized subclasses.
Examples:
amount, type, x, y
obj:takeDamage(20, "emp", 1000, 0)
obj:takeDamage(20)
SpaceObject:setDescriptions(string unscanned_description, string scanned_description)
Sets this object's description in unscanned and scanned states. These
descriptions are displayed when this object is targeted from a ship's
Science station.
Requires two string values, one for the descriptions when unscanned
and another for when it has been scanned.
Example:
obj:setDescriptions([[A refitted Atlantis X23...]], [[It's a trap!]])
SpaceObject:setDescription(string description)
As setDescriptions, but sets the same description for both unscanned
and scanned states.
Requires a string value.
Example: obj:setDescription([[A refitted Atlantis X23 for more ...]])
SpaceObject:setDescriptionForScanState(EScannedState state, string description)
Sets a description for a specific EScannedState. String equivalents for
EScannedState are defined in the convert<EScannedState> function of
src/spaceObjects/spaceObject.cpp.
Requires a string-equivalent EScannedState and a string description.
Example:
obj:setDescriptionForScanState("friendorfoeidentified", [[This...]])
SpaceObject:getDescription(getScannedStateFor(obj)
Gets this object's description.
Accepts an optional string-equivalent EScannedState.
Returns a string.
Examples:
obj:getDescription()
obj:getDescription("friendorfoeidentified")
SpaceObject:setRadarSignatureInfo(float grav, float elec, float bio)
Sets this object's radar signature, which creates noise on the Science
station's raw radar signal ring.
Certain SpaceObject types might modify their signatures using this value
as a baseline. Default values also depend on the SpaceObject type.
Requires numeric values ranging from 0.0 to 1.0 for the gravitational,
electrical, and biological radar bands.
Example: obj:setRadarSignatureInfo(0.0, 0.5, 1.0)
SpaceObject:getRadarSignatureGravity()
Gets this object's component values from its radar signature.
Returns a numeric value between 0.0 and 1.0; larger and negative values
are possible, but currently have no visual effect on the bands.
Examples:
local grav_band = obj:getRadarSignatureGravity()
local elec_band = obj:getRadarSignatureElectrical()
local bio_band = obj:getRadarSignatureBiological()
SpaceObject:getRadarSignatureElectrical()
SpaceObject:getRadarSignatureBiological()
SpaceObject:setScanningParameters(int complexity, int depth)
Sets this object's scanning complexity (number of bars in the scanning
minigame) and depth (number of scanning minigames to complete).
Also clears the scanned state.
Requires two integer values.
Example: obj:setScanningParameters(2, 3)
SpaceObject:scanningComplexity(P<SpaceObject> target)
Gets the scanning complexity for the parameter object.
Requires a SpaceObject.
Returns an integer value.
Example: local scan_complexity = obj:scanningComplexity(obj)
SpaceObject:scanningChannelDepth(P<SpaceObject> target)
Gets the scanning depth for the parameter object.
Requires a SpaceObject.
Returns an integer value.
Example: local scan_depth = obj:scanningChannelDepth(obj)
SpaceObject:setScanned(bool scanned)
Sets whether all factions consider this object as having been scanned.
Requires a boolean value. If false, all factions treat this object as
unscanned; if true, all factions treat this object as fully scanned.
Example: obj:setScanned(true)
SpaceObject:isScanned()
[DEPRECATED]
Gets whether this object has been scanned.
Use isScannedBy or isScannedByFaction instead.
SpaceObject:isScannedBy(P<SpaceObject> obj)
Gets whether the parameter object has successfully scanned this object.
Requires a SpaceObject.
Returns a boolean value.
Example: obj:isScannedBy(other)
SpaceObject:setScannedByFaction(string faction_name, bool scanned)
Sets whether a specific faction considers this object as having been
scanned.
Requires a faction name string value and a boolean value.
Example: obj:setScannedByFaction("Human Navy", false)
SpaceObject:isScannedByFaction(string faction)
Gets whether the parameter faction has successfully scanned this object.
Requires a faction name string value.
Returns a boolean value.
Example: obj:isScannedByFaction("Human Navy")
SpaceObject:onDestroyed(ScriptSimpleCallback callback)
SpaceObject:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
SpaceObject:destroy()
Removes this object from the game.
SpaceObject:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

TutorialGame

The TutorialGame object is normally never created.
And it only used to setup the special tutorial level.
It contains functions to assist in explaining the game, but do not work outside of the tutorial.
TutorialGame:setPlayerShip(P<PlayerSpaceship> ship)
TutorialGame:switchViewToMainScreen()
TutorialGame:switchViewToTactical()
TutorialGame:switchViewToLongRange()
TutorialGame:switchViewToScreen(int n)
TutorialGame:showMessage(string message, bool show_next)
TutorialGame:setMessageToTopPosition()
TutorialGame:setMessageToBottomPosition()
TutorialGame:onNext(ScriptSimpleCallback callback)
TutorialGame:finish()
TutorialGame:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
TutorialGame:destroy()
Removes this object from the game.
TutorialGame:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

EMPMissile

EMP missile
Subclass of: MissileWeapon

SupplyDrop

A supply drop.
Subclass of: SpaceObject
SupplyDrop:setEnergy(float amount)
SupplyDrop:setWeaponStorage(EMissileWeapons weapon, int amount)
SupplyDrop:onPickUp(ScriptSimpleCallback callback)
Set a function that will be called if a player picks up the supply drop.
First argument given to the function will be the supply drop, the second the player.

ScanProbe

A scan probe.
Subclass of: SpaceObject
ScanProbe:setSpeed(float probe_speed)
Set the probe's speed. A value of 1000 = 1U/second.
Probes move at a fixed rate of speed and ignore physics.
Requires a float value. The default vaule is 1000.
Example: probe:setSpeed(2000)
ScanProbe:getSpeed()
Get the probe's speed. A value of 1000 = 1U/second.
Returns a float value.
Example: local speed = probe:getSpeed()
ScanProbe:setLifetime(float lifetime)
Set the probe's remaining lifetime, in seconds.
The default initial lifetime is 10 minutes.
Example: probe:setLifetime(60 * 5)
ScanProbe:getLifetime()
Get the probe's remaining lifetime.
Example: local lifetime = probe:getLifetime()
ScanProbe:setTarget(sf::Vector2f target)
Set the probe's target coordinates.
Example: probe:setTarget(1000, 5000)
ScanProbe:getTarget()
Get the probe's target coordinates.
Example: local targetX, targetY = probe:getTarget()
ScanProbe:setOwner(P<SpaceObject> owner)
Set the probe's owner SpaceObject.
Requires a SpaceObject.
Example: probe:setOwner(owner_ship)
ScanProbe:getOwner()
Get the probe's owner SpaceObject.
Example: local owner_ship = probe:getOwner()
ScanProbe:onArrival(ScriptSimpleCallback callback)
Callback when the probe arrives to its target coordinates.
Passes the probe and position as arguments to the callback.
Example: probe:onArrival(probeArrived)
ScanProbe:onExpiration(ScriptSimpleCallback callback)
Callback when the probe's lifetime expires.
Passes the probe as an argument to the callback.
Example: probe:onExpiration(probeExpired)
ScanProbe:onDestruction(ScriptSimpleCallback callback)
Callback when the probe is destroyed by damage.
Passes the probe and instigator as arguments to the callback.
Example: probe:onDestruction(probeDestroyed)

ScriptStorage

ScriptStorage:get [NOT FOUND; see SeriousProton]
Get a value from persistent script storage.
Requires the key as a string.
Returns the value as a JSON string.
Returns nothing if the key is not found.
Example: storage = getScriptStorage()
storage:get('key')
ScriptStorage:set [NOT FOUND; see SeriousProton]
Set a value in persistent script storage.
Requires the key and value as strings.
Creates scriptstorage.json if it doesn't exist.
Example: storage = getScriptStorage()
storage:set('key', 'value')
ScriptStorage:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
ScriptStorage:destroy()
Removes this object from the game.
ScriptStorage:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

Script

Object which can be used to create and run another script.
Other scripts have their own lifetime, update and init functions.
Scripts can destroy themselves (destroyScript()), or be destroyed by the main script.
Example: local script = Script():run("script.lua"); script:destroy();
Script:run(string filename)
Run a script with a certain filename
Script:setVariable(string variable_name, string value)
Set a global variable in this script instance, this variable can be accessed in the main script.
Script:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
Script:destroy()
Removes this object from the game.
Script:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end

ShipTemplate

ShipTemplates are created when EmptyEpsilon is started.
And used to fill the ship starting statistics, and other information.
ShipTemplate:setName(string name)
ShipTemplate:setLocaleName(string name)
ShipTemplate:setClass(string class_name, string sub_class_name)
Set the class name, and subclass name for the ship. Used to divide ships into different classes.
ShipTemplate:setDescription(string description)
Set the description shown for this ship in the science database.
ShipTemplate:setType(TemplateType type)
Sets the type of template. Defaults to normal ships, so then it does not need to be set.
Example: template:setType("ship"), template:setType("playership"), template:setType("station")
ShipTemplate:setDefaultAI(string default_ai_name)
Set the default AI behaviour. EE has 3 types of AI coded into the game right now: "default", "fighter", "missilevolley"
ShipTemplate:setModel(string model_name)
Set the 3D model to be used for this template. The model referers to data set in the model_data.lua file.
ShipTemplate:setDockClasses(std::vector<string> classes)
Supply a list of ship classes that can be docked to this ship. setDockClasses("Starfighter") will allow all small starfighter type ships to dock with this ship.
ShipTemplate:setEnergyStorage(float energy_amount)
Set the amount of energy available for this ship. Note that only player ships use energy. So setting this for anything else is useless.
ShipTemplate:setRepairCrewCount(int amount)
ShipTemplate:setBeam(int index, float arc, float direction, float range, float cycle_time, float damage)
Setup a beam weapon.
ShipTemplate:setBeamWeapon(int index, float arc, float direction, float range, float cycle_time, float damage)
Setup a beam weapon.
ShipTemplate:setBeamWeaponTurret(int index, float arc, float direction, float rotation_rate)
Setup a beam's turret.
ShipTemplate:setBeamTexture(int index, string texture)
Setup a beam weapon texture
ShipTemplate:setBeamWeaponEnergyPerFire(int index, float energy)
ShipTemplate:setBeamWeaponHeatPerFire(int index, float heat)
ShipTemplate:setTubes(int amount, float load_time)
Set the amount of missile tubes, limited to a maximum of 16.
ShipTemplate:setTubeLoadTime(int index, float load_time)
ShipTemplate:weaponTubeAllowMissle(int index, EMissileWeapons type)
ShipTemplate:weaponTubeDisallowMissle(int index, EMissileWeapons type)
ShipTemplate:setWeaponTubeExclusiveFor(int index, EMissileWeapons type)
ShipTemplate:setTubeDirection(int index, float direction)
ShipTemplate:setTubeSize(int index, EMissileSizes size)
ShipTemplate:setHull(float amount)
Set the amount of starting hull
ShipTemplate:setShields(std::vector<float> values)
Set the shield levels, amount of parameters defines the amount of shields. (Up to a maximum of 8 shields)
Example: setShieldData(400) setShieldData(100, 80) setShieldData(100, 50, 50)
ShipTemplate:setSpeed(float impulse, float turn, float acceleration)
Set the impulse speed, rotation speed and impulse acceleration for this ship.
Compare SpaceShip:setImpulseMaxSpeed, :setRotationMaxSpeed, :setAcceleration.
ShipTemplate:setCombatManeuver(float boost, float strafe)
Sets the combat maneuver power of this ship.
ShipTemplate:setWarpSpeed(float warp)
Set the warp speed for warp level 1 for this ship. Setting this will indicate that this ship has a warpdrive. (normal value is 1000)
ShipTemplate:setSharesEnergyWithDocked(bool enabled)
Set if this ship shares energy with docked ships. Example: template:setSharesEnergyWithDocked(false)
ShipTemplate:setRepairDocked(bool enabled)
Set if this ship repairs docked ships. Example: template:setRepairDocked(false)
ShipTemplate:setRestocksScanProbes(bool enabled)
Set if this ship restocks scan probes on docked ships. Example: template:setRestocksScanProbes(false)
ShipTemplate:setRestocksMissilesDocked(bool enabled)
Set if this ship restores missiles on docked cpuships. Example template:setRestocksMissilesDocked(false)
ShipTemplate:setJumpDrive(bool enabled)
Set if this ship has a jump drive. Example: template:setJumpDrive(true)
ShipTemplate:setJumpDriveRange(float min, float max)
Set this ship's minimum and maximum jump drive distances.
Example: template:setJumpDrive(5000.0, 50000.0)
ShipTemplate:setCloaking(bool enabled)
ShipTemplate:setWeaponStorage(EMissileWeapons weapon, int amount)
ShipTemplate:addRoom(sf::Vector2i position, sf::Vector2i size)
Add an empty room to a ship template.
Rooms are shown on the engineering and damcon screens.
If a system room isn't accessible via other rooms connected by doors, that system
might not be repairable.
Rooms are placed on an integer x/y grid. The minimum size for a room is 1x1.
Accepts four parameters: the room's x coordinate, y coordinate, width, and height.
Example: template:addRoom(1, 2, 3, 4)
ShipTemplate:addRoomSystem(sf::Vector2i position, sf::Vector2i size, ESystem system)
Add a room containing a ship system to a ship template.
Rooms are shown on the engineering and damcon screens.
If a system doesn't have a room, or repair crews can't reach a system's room, it
might not be repairable.
Accepts five parameters: the room's x coordinate, y coordinate, width, height, and
the ship system as the string equivalent of an ESystem value.
Example: template:addRoomSystem(1, 2, 3, 4, "Reactor")
ShipTemplate:addDoor(sf::Vector2i position, bool horizontal)
Add a door between rooms in a ship template.
Rooms are shown on the engineering and damcon screens.
If a system room doesn't have a door connecting it to other rooms, repair crews
might not be able to reach it for repairs.
Accepts three parameters: the door's x coordinate, y coordinate, and a Boolean
value for whether it's horizontal (true) or vertical (false).
Example: template:addDoor(2, 2, false)
ShipTemplate:setRadarTrace(string trace)
ShipTemplate:setLongRangeRadarRange(float range)
ShipTemplate:setShortRangeRadarRange(float range)
ShipTemplate:setImpulseSoundFile(string sound)
ShipTemplate:setCanScan(bool enabled)
ShipTemplate:setCanHack(bool enabled)
ShipTemplate:setCanDock(bool enabled)
ShipTemplate:setCanCombatManeuver(bool enabled)
ShipTemplate:setCanSelfDestruct(bool enabled)
ShipTemplate:setCanLaunchProbe(bool enabled)
ShipTemplate:copy(string new_name)
Return a new template with the given name, which is an exact copy of this template.
Used to make easy variations of templates.
ShipTemplate:isValid()
Check if this is still looking at a valid object. Returns false when the objects that this variable references is destroyed.
ShipTemplate:destroy()
Removes this object from the game.
ShipTemplate:typeName
Returns the class name of this object, this is not a function, but a direct member: if object.typeName == "Mine" then print("MINE!") end