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.
Functions
- addGMFunction
- addGMFunction(name, function) Add a function that can be called from the GM console. This can be used to create helper scripts for the GM. Or to give the GM console certain control over the scenario.
- removeGMFunction
- removeGMFunction(name) Remove a function from the GM console
- clearGMFunctions
- clearGMFunctions() Remove all the GM functions from the GM console.
- getGMSelection
- getGMSelection() Returns an list of objects that the GM currently has selected.
- addGMMessage
- addGMMessage(message) shows a message on the GM screen
- setCommsMessage
- setCommsMessage(message) Sets the message/reply shown to the comms officer.
- addCommsReply
- addCommsReply(message, function) Add an reply option for communications.
- victory
- victory(string) Called with a faction name as parameter, sets a certain faction as victor and ends the game.
- globalMessage
- globalMessage(string) Show a global message on the main screens of all active player ships.
- setBanner
- setBanner(string) Show a scrolling banner containing this text on the cinematic and top down views.
- getPlayerShip
- getPlayerShip(index) Return the player's ship, use -1 to get the first active player ship.
- getObjectsInRadius
- getObjectsInRadius(x, y, radius) Return a list of all space objects at the x,y location within a certain radius.
- getAllObjects
- getAllObjects() Return a list of all space objects. (Use with care, this could return a very long list which could slow down the game when called every update)
- getScenarioVariation
- getScenarioVariation() Returns the currently used scenario variation.
- setScenario
- setScenario(script_name, variation_name) Change the current scenario to a different one.
- shutdownGame
- Shutdown the game. Calling this function will close the game. Mainly usefull for a headless server setup.
- pauseGame
- Pause the game Calling this function will pause the game. Mainly usefull for a headless server setup.
- unpauseGame
- Pause the game Calling this function will pause the game. Mainly usefull for a headless server setup. As the scenario functions are not called when paused.
- playSoundFile
- Play a sound file on the server. Will work with any file supported by SFML (.wav, .ogg, .flac) Note that the sound is only played on the server. Not on any of the clients.
- getScriptStorage
- getStorage() Exposes the ScriptStorage object, which can be used to save/load key value pairs These key value pairs are permanently stored and survive server restarts.
- require
- require(filename) Run the script with the given filename in the same context as the current running script.
- _
- _(string) Translate the given string with the user configured language.
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 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)
Subclass of:
ShipTemplateBasedObject- SpaceShip:isFriendOrFoeIdentified()
- SpaceShip:isFullyScanned()
- 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: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:getSystemHealth(ESystem system)
- SpaceShip:setSystemHealth(ESystem system, float health)
- SpaceShip:getSystemHeat(ESystem system)
- SpaceShip:setSystemHeat(ESystem system, float heat)
- SpaceShip:getSystemPower(ESystem system)
- SpaceShip:setSystemPower(ESystem system, float power)
- SpaceShip:getSystemCoolant(ESystem system)
- SpaceShip:setSystemCoolant(ESystem system, float coolant)
- SpaceShip:getImpulseMaxSpeed()
- SpaceShip:setImpulseMaxSpeed(float speed)
- SpaceShip:getRotationMaxSpeed()
- SpaceShip:setRotationMaxSpeed(float speed)
- SpaceShip:setCombatManeuver(float boost, float strafe)
- SpaceShip:hasJumpDrive()
- SpaceShip:setJumpDrive(bool has_jump)
- SpaceShip:setJumpDriveRange(float min, float max)
- SpaceShip:hasWarpDrive()
- SpaceShip:setWarpDrive(bool has_warp)
- 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: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 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)
- 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
- 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
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)
A mine object. Simple, effective, deadly.
Subclass of:
SpaceObject- Mine:onDestruction(ScriptSimpleCallback callback)
Subclass of:
SpaceObject- ShipTemplateBasedObject:setTemplate(string template_name)
- Set the ship template to be used for this station. Stations use ship-templates to define hull/shields/looks
- 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 if the object can be destroyed or not. true or false
- ShipTemplateBasedObject:getCanBeDestroyed()
- Get if the object can be destroyed or not. true or false
- ShipTemplateBasedObject:getShieldLevel(int index)
- Get the current shield level, stations only have a single shield, unlike ships that have a front&back shield
- ShipTemplateBasedObject:getShieldCount()
- Get the amount of shields fit on this object.
- 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 station on the radar. For example, station:setRadarTrace("RadarArrow.png") will show an arrow instead of a dot for this station.
- 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: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).
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:onPickUp(ScriptSimpleCallback callback)
- Set a function that will be called if a player picks up the artifact. First argument given to the function will be the artifact, the second the player.
- 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.
Subclass of:
SpaceShip- PlayerSpaceship:getWaypoint(int index)
- PlayerSpaceship:getWaypointCount()
- PlayerSpaceship:getAlertLevel()
- PlayerSpaceship:setShieldsActive(bool active)
- PlayerSpaceship:addToShipLog(string message, sf::Color color)
- PlayerSpaceship:transferPlayersToShip(P<PlayerSpaceship> other_ship)
- PlayerSpaceship:transferPlayersAtPositionToShip(ECrewPosition position, P<PlayerSpaceship> other_ship)
- PlayerSpaceship:hasPlayerAtPosition(ECrewPosition position)
- 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)
- 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)
- 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:commandSetScienceLink(int32_t id)
- PlayerSpaceship:commandSetAlertLevel(EAlertLevel level)
- PlayerSpaceship:getRepairCrewCount()
- PlayerSpaceship:setRepairCrewCount(int amount)
- PlayerSpaceship:setAutoCoolant(bool active)
- PlayerSpaceship:setControlCode(string code)
- PlayerSpaceship:onProbeLaunch(ScriptSimpleCallback callback)
- PlayerSpaceship:getLongRangeRadarRange()
- PlayerSpaceship:getShortRangeRadarRange()
- PlayerSpaceship:setLongRangeRadarRange(float range)
- PlayerSpaceship:setShortRangeRadarRange(float range)
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 is a visible electrical explosion, as seen from EMP missiles Example: ElectricExplosionEffect():setPosition(500,5000):setSize(20)
Subclass of:
SpaceObject- ElectricExplosionEffect:setSize(float size)
A zone area
Subclass of:
SpaceObject- Zone:setPoints(std::vector<sf::Vector2f> points)
- Zone:setColor(int r, int g, int b)
- Zone:setLabel(string label)
- Zone:isInside(P<SpaceObject> obj)
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 type. AI can be set per ship, or left per default which will be taken from the shipTemplate then.
- CpuShip:orderIdle()
- Order this ship to stand still and do nothing.
- CpuShip:orderRoaming()
- Order this ship to roam around the world and attack targets
- CpuShip:orderStandGround()
- Order this ship to stand still, but still target and try to hit nearby enemies
- CpuShip:orderDefendLocation(sf::Vector2f position)
- Order this ship to defend a specific location. It will attack enemies near this target.
- CpuShip:orderDefendTarget(P<SpaceObject> object)
- Order this ship to defend a specific object. It will attack enemies near this object.
- CpuShip:orderFlyFormation(P<SpaceObject> object, sf::Vector2f offset)
- Order this ship to fly in formation with another ship. It will attack nearby enemies.
- CpuShip:orderFlyTowards(sf::Vector2f target)
- Order this ship to fly to a location, attacking everything alogn the way.
- CpuShip:orderFlyTowardsBlind(sf::Vector2f target)
- Order this ship to fly to a location, without attacking anything
- CpuShip:orderAttack(P<SpaceObject> object)
- Order this ship to attack a specific target. If the target is destroyed it will fall back to roaming orders.
- CpuShip:orderDock(P<SpaceObject> object)
- Order this ship to dock at a specific object (station or otherwise)
- CpuShip:getOrder()
- Get the order this ship is executing
- CpuShip:getOrderTargetLocation()
- Get the target location of the currently executed order
- CpuShip:getOrderTarget()
- Get the target SpaceObject of the currently executed order
An asteroid in space. Which you can fly into and hit. Will do damage.
Subclass of:
SpaceObject- Asteroid:setSize(float size)
- Set the size of this asteroid, per default asteroids have a size of 120
An asteroid in space. Outside of hit range, just for visuals.
Subclass of:
SpaceObject- VisualAsteroid:setSize(float size)
- Set the size of this asteroid, per default asteroids have a size of 120
- ScienceDatabase:setName(string name)
- ScienceDatabase:addEntry(string name)
- ScienceDatabase:addKeyValue(string key, string value)
- ScienceDatabase:setLongDescription(string text)
- 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
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 [NOT FOUND; see SeriousProton]
- Sets this object's position on the map, in meters from the origin. Requires two numeric values. Example: obj:setPosition(x, y)
- SpaceObject:getPosition [NOT FOUND; see SeriousProton]
- Gets this object's position on the map. Returns x, y as meters from the origin. Example: local x, y = obj:getPosition()
- SpaceObject:setRotation [NOT FOUND; see SeriousProton]
- 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 [NOT FOUND; see SeriousProton]
- 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 [NOT FOUND; see SeriousProton]
- Gets this object's directional velocity within 2D space. Returns a value in meters/second. Example: local velocity = obj:getVelocity()
- SpaceObject:getAngularVelocity [NOT FOUND; see SeriousProton]
- 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. Examples: obj:setCommsScript("") obj:setCommsScript("comms_custom_script.lua")
- 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 the name of a function to call back to when hailed. Example: obj:setCommsFunction(commsStation)
- 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). 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: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
Subclass of:
SpaceObject- ScanProbe:onExpiration(ScriptSimpleCallback callback)
- ScanProbe:onDestruction(ScriptSimpleCallback callback)
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
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.
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).
- ScriptStorage:get [NOT FOUND; see SeriousProton]
- ScriptStorage:set [NOT FOUND; see SeriousProton]
- 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
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, or be destroyed by the main script.
- Script:run [NOT FOUND; see SeriousProton]
- Run a script with a certain filename
- Script:setVariable [NOT FOUND; see SeriousProton]
- 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
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.
- 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:setRestocksScanProbes(bool enabled)
- Set if this ship restocks scan probes on docked ships. Example: template:setRestocksScanProbes(false)
- ShipTemplate:setJumpDrive(bool enabled)
- Set if this ship has a jump drive. Example: template:setJumpDrive(true)
- ShipTemplate:setJumpDriveRange(float min, float max)
- ShipTemplate:setCloaking(bool enabled)
- ShipTemplate:setWeaponStorage(EMissileWeapons weapon, int amount)
- ShipTemplate:addRoom(sf::Vector2i position, sf::Vector2i size)
- ShipTemplate:addRoomSystem(sf::Vector2i position, sf::Vector2i size, ESystem system)
- ShipTemplate:addDoor(sf::Vector2i position, bool horizontal)
- ShipTemplate:setRadarTrace(string trace)
- ShipTemplate:setLongRangeRadarRange(float range)
- ShipTemplate:setShortRangeRadarRange(float range)
- 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