Module ship
Functions for ship instances
Global functions
Ship.create (template, baseName) | create a ship from a ship template. |
Ship.createOrReuseFromList (templateName, names, owner) | Utility function to find/create an available ship given a template and list of names. |
Ship.getFromName (name) | finds any ship by name |
Ship.getOrCreate (templateName, name, owner) | Utility function to find a ship by name, or create one with the given template and owner if it's not found. |
Class Ship
Ship.prototype.characters (self) | using the rooms iterator, generate an iterator for all the characters in a ship |
ship:addNavchart (the) | adds a navchart to the ship. |
ship:damage (damage, byCharacter, byShip) | damage the ship with conventional damage (not ion). |
ship:damageIon (damage, byCharacter) | damage the ship with conventional damage (not ion). |
ship:destroy (byCharacter, byShip) | immediately destroy this ship. |
ship:disableSystem (system) | disable a system on this ship. |
ship:distanceToShip (other) | Gets distance between this ship and another |
ship:echoAt (text) | echo a message to this ship, visible to any players in its cockpit/viewports/turrets/etc |
ship:echoToSystem (text) | echo to all ships in the system, visible to any players in cockpits/viewports/turrets/etc |
ship:getAutopilot () | get the ship's current autopilot status. |
ship:getBlasters () | return the ship's blaster count |
ship:getChaff () | returns current chaff. |
ship:getClass () | get the ship's class number, from 0 (fighter) to 10 (satellite) |
ship:getCockpit () | get the ship's cockpit room |
ship:getComms () | return the ship's comms |
ship:getCopilot () | get the ship's copilot name |
ship:getCrew () | get the ship's crew list |
ship:getDockRoom () | get the ship's dock room |
ship:getDockedShip () | gets the ship (if any) docked to the ship |
ship:getEnergy () | returns current energy. |
ship:getEngineRoom () | get the ship's engine room |
ship:getEntrance () | get the ship's entrance room |
ship:getFirstVNum () | get the vnum of the ship's first room |
ship:getFlags () | get the ship's flags |
ship:getFullName () | get the ship's full name, including model name |
ship:getGunSeat () | get the ship's gun seat room |
ship:getHull () | returns current hull. |
ship:getHyperspeed () | return the ship's hyperspeed |
ship:getIons () | return the ship's ion count |
ship:getLasers () | return the ship's laser count |
ship:getLastVNum () | get the vnum of the ship's last room |
ship:getLeader () | get the ship's leader, either in battlegroups or for a squadron fighter. |
ship:getLocation () | get room where the ship is located |
ship:getManeuver () | return the ship's maneuver value |
ship:getMaxChaff () | return the ship's max chaff |
ship:getMaxEnergy () | return the ship's max energy |
ship:getMaxHull () | return the ship's max hull |
ship:getMaxMissiles () | return the ship's max missiles |
ship:getMaxPulses () | return the ship's max pulses |
ship:getMaxRockets () | return the ship's max rockets |
ship:getMaxShield () | return the ship's max shield |
ship:getMaxSpeed () | return the ship's max speed |
ship:getMaxTorpedoes () | return the ship's max torpedoes |
ship:getMissileTubes () | return the ship's missile tubes |
ship:getMissiles () | returns current missiles. |
ship:getName () | get the ship's name |
ship:getNavSeat () | get the ship's nav seat room |
ship:getOwner () | get the ship's owner name |
ship:getPilot () | get the ship's pilot name |
ship:getPilotBy () | gets the character piloting the ship |
ship:getPilotSeat () | get the ship's pilot seat room |
ship:getPosition () | get current position within system |
ship:getPulses () | returns current pulses. |
ship:getRockets () | returns current rockets. |
ship:getRoomByOffset (offset) | get a room within the ship by its offset |
ship:getSelfDestruct () | returns current self destruct status |
ship:getSensors () | return the ship's sensors |
ship:getShield () | returns current shield. |
ship:getShieldBoosters () | return the ship's shield boosters |
ship:getShipyard () | returns current shipyard. |
ship:getSpeed () | returns current speed. |
ship:getStarsystem () | get current starsystem |
ship:getTarget () | get the ship's primary target |
ship:getTemplate () | get the ship's template |
ship:getTorpedoes () | returns current torpedoes. |
ship:getTractorbeams () | return the ship's tractorbeam count |
ship:getTurbolasers () | return the ship's turbolasers count |
ship:getVector () | get current vector |
ship:hasAutoFlag (flagName) | determine whether an autopilot config is set on a ship |
ship:hasFlag (flagName) | determine whether a flag is set on a ship |
ship:hasNavchart () | checks if the ship has a matching navchart. |
ship:radio (text) | radios a message to the system originating from this ship, always in basic |
ship:removeNavchart (the) | remove a navchart from the ship. |
ship:repairSystem (system) | repair a system on this ship. |
ship:restore () | Restores this ship, raising all consumables to max |
ship:setAutoFlag (flag, value) | set an autopilot config on this ship. |
ship:setAutopilot (autopilot) | set the ship's current autopilot status. |
ship:setBattlegroupLeader (leader) | set the ship's battlegroup leader to add or remove it from a battlegroup. |
ship:setBayOpen (hangar, state) | sets the open/close status of a hangar bay. |
ship:setBlasters (blasters) | set the ship's blaster count. |
ship:setChaff (chaff) | set the ship's current chaff |
ship:setComms (comm) | set the ship's comms. |
ship:setCopilot (copilot) | set the ship's current copilot |
ship:setCrew (crew) | set the ship's current crew list |
ship:setEnergy (energy) | set the ship's current energy |
ship:setFlag (flag, value) | set a flag on this ship. |
ship:setFleetPosition (position) | set the ship's position for battlegroup/squadron protection. |
ship:setFullName (name) | set the ship's full name, including model name |
ship:setHull (hull) | set the ship's current hull |
ship:setHyperspeed (hyperspeed) | set the ship's hyperspeed. |
ship:setInterceptor (leader) | set this ship to serve as an interceptor for another ship. |
ship:setIons (ion) | set the ship's ion count. |
ship:setLasers (lasers) | set the ship's laser count. |
ship:setManeuver (maneuver) | set the ship's maneuver value. |
ship:setMaxChaff (max_chaff) | set the ship's max chaff. |
ship:setMaxEnergy (max_energy) | set the ship's max energy. |
ship:setMaxHull (max_hull) | set the ship's max hull. |
ship:setMaxMissiles (max_missiles) | set the ship's max missiles. |
ship:setMaxPulses (max_pulses) | set the ship's max pulses. |
ship:setMaxRockets (max_rockets) | set the ship's max rockets. |
ship:setMaxShield (max_shield) | set the ship's max shield. |
ship:setMaxSpeed (max_speed) | set the ship's max speed. |
ship:setMaxTorpedoes (max_torpedoes) | set the ship's max torpedoes. |
ship:setMissileTubes (missile_tubes) | set the ship's missile tubes. |
ship:setMissiles (missiles) | set the ship's current missiles |
ship:setName (name) | set the ship's name |
ship:setOwner (owner) | set the ship's current owner |
ship:setPilot (pilot) | set the ship's current pilot |
ship:setPulses (pulses) | set the ship's current pulses |
ship:setRockets (rockets) | set the ship's current rockets |
ship:setSelfDestruct (delay) | sets or clears self destruct. |
ship:setSensors (sensor) | set the ship's sensors. |
ship:setShield (shield) | set the ship's current shield |
ship:setShieldBoosters (shield_boosters) | set the ship's shield boosters. |
ship:setSpeed (speed) | set the ship's current speed |
ship:setSquadronLeader (leader) | set the ship's squadron leader to add or remove it from squadrons. |
ship:setTarget (target) | sets the target for an autopiloted ship. |
ship:setTorpedoes (torpedoes) | set the ship's current torpedoes |
ship:setTractorbeams (tractorbeam) | set the ship's tractorbeam count. |
ship:setTurbolasers (turbolasers) | set the ship's turbolaser count. |
ship:setVector (x, y, z) | sets this ship's new vector. |
ship:toRoom (room) | moves this ship to the given room as if landed there. |
ship:toStarsystem (starsystem, x, y, z) | moves this ship to the given system and coordinates. |
Global functions
- Ship.create (template, baseName)
-
create a ship from a ship template.
The ship will be spawned in room 45 with no owner set, and should then be moved to the location you want
Parameters:
- template string the name of the template to use, as in xwing.img
- baseName string the base name of the ship ("X-Wing Starfighter"), optional if basename is set on the template.
Returns:
-
Ship
the created ship
- Ship.createOrReuseFromList (templateName, names, owner)
-
Utility function to find/create an available ship given a template and list of names.
This will randomly pick from the list of names. If it finds a ship from the same template matching the
name and that ship is in its shipyard (typically 45), it'll use it. If it doesn't exist, it'll create it.
If all names are taken by instances of the template but none are in its shipyard, this will cause an error.
Parameters:
- templateName string The ship template name to create if the ship isn't found
- names stringArray The table of ship name options
- owner string The ship owner to set if the ship needs to be created
Returns:
-
Ship
the resulting ship
Usage:
-- Randomly create or get an available x-wing local shipNameOptions = {"Red1", "Red2", "Red3", "Red4", "Red5"} local shipForLuke = Ship.createOrReuseFromList("xwing.img", shipNameOptions, "Luke Skywalker")
- Ship.getFromName (name)
-
finds any ship by name
Parameters:
- name string the ship name, either the part in quotes or the whole thing
Returns:
-
Ship
the ship, or nil if not found
- Ship.getOrCreate (templateName, name, owner)
-
Utility function to find a ship by name, or create one with the given template and owner if it's not found.
Templates used in this function must have a basename set.
Parameters:
- templateName string The ship template name to create if the ship isn't found
- name string The ship name, not including model name
- owner string The ship owner to set if the ship needs to be created
Returns:
-
Ship
the ship
Class Ship
Functions on ship variables
- Ship.prototype.characters (self)
-
using the rooms iterator, generate an iterator for all the
characters in a ship
Parameters:
- self
- ship:addNavchart (the)
-
adds a navchart to the ship.
Parameters:
- the string name of the starsystem
Returns:
-
Ship
this ship, for call chaining
- ship:damage (damage, byCharacter, byShip)
-
damage the ship with conventional damage (not ion).
Parameters:
- damage integer the amount of damage to do
- byCharacter Character the character to attribute the damage to (optional)
- byShip Ship the ship to attribute the damage to (optional)
Returns:
-
Ship
this ship, for call chaining
- ship:damageIon (damage, byCharacter)
-
damage the ship with conventional damage (not ion).
Parameters:
- damage integer the amount of ion damage to do (affects shields 2x this much)
- byCharacter Character the character to attribute the damage to (optional)
Returns:
-
Ship
this ship, for call chaining
- ship:destroy (byCharacter, byShip)
-
immediately destroy this ship.
Parameters:
- ship:disableSystem (system)
-
disable a system on this ship.
Parameters:
- system string the system to disable (drive, ion, etc)
Returns:
-
Ship
this ship, for call chaining
- ship:distanceToShip (other)
-
Gets distance between this ship and another
Parameters:
- other Ship The other ship to measure distance to
Usage:
-- Go aggro on a ship if it's within 1000 prox if self:distanceToShip(otherShip) < 1000 then self:setTarget(otherShip) end
- ship:echoAt (text)
-
echo a message to this ship, visible to any players in its cockpit/viewports/turrets/etc
Parameters:
- text string the text to echo
- ship:echoToSystem (text)
-
echo to all ships in the system, visible to any players in cockpits/viewports/turrets/etc
Parameters:
- text string the text to echo
- ship:getAutopilot ()
-
get the ship's current autopilot status.
Returns:
-
boolean
true if autopilot is on
- ship:getBlasters ()
-
return the ship's blaster count
Returns:
-
number
the ship's blaster count
- ship:getChaff ()
-
returns current chaff.
Returns:
-
number
the current chaff
- ship:getClass ()
-
get the ship's class number, from 0 (fighter) to 10 (satellite)
Returns:
-
integer
the ship's class
- ship:getCockpit ()
-
get the ship's cockpit room
Returns:
-
Room
the ship's cockpit room
- ship:getComms ()
-
return the ship's comms
Returns:
-
number
the ship's comms
- ship:getCopilot ()
-
get the ship's copilot name
Returns:
-
string
the ship's current copilot, or nil if none is set
- ship:getCrew ()
-
get the ship's crew list
Returns:
-
string
the ship's current crew list, or empty string if none is set
- ship:getDockRoom ()
-
get the ship's dock room
Returns:
-
Room
the ship's dock room
- ship:getDockedShip ()
-
gets the ship (if any) docked to the ship
Returns:
-
Ship
the ship, or nil if not found
- ship:getEnergy ()
-
returns current energy.
Returns:
-
number
the current energy
- ship:getEngineRoom ()
-
get the ship's engine room
Returns:
-
Room
the ship's engine room
- ship:getEntrance ()
-
get the ship's entrance room
Returns:
-
Room
the ship's entrance room
- ship:getFirstVNum ()
-
get the vnum of the ship's first room
Returns:
-
number
the vnum of the ship's first room
- ship:getFlags ()
-
get the ship's flags
Returns:
-
table
an table of all ship flag names to a boolean for this ship's value for it
- ship:getFullName ()
-
get the ship's full name, including model name
Returns:
-
string
the ship's full name, for example
X-Wing Starfighter 'Red 5'
- ship:getGunSeat ()
-
get the ship's gun seat room
Returns:
-
Room
the ship's gun seat room
- ship:getHull ()
-
returns current hull.
Returns:
-
number
the current hull
- ship:getHyperspeed ()
-
return the ship's hyperspeed
Returns:
-
number
the ship's hyperspeed
- ship:getIons ()
-
return the ship's ion count
Returns:
-
number
the ship's ion count
- ship:getLasers ()
-
return the ship's laser count
Returns:
-
number
the ship's laser count
- ship:getLastVNum ()
-
get the vnum of the ship's last room
Returns:
-
number
the vnum of the ship's last room
- ship:getLeader ()
-
get the ship's leader, either in battlegroups or for a squadron fighter.
Returns:
-
Ship
the ship's battlegroup or squadron leader
- ship:getLocation ()
-
get room where the ship is located
Returns:
-
Room
the room the ship is in, or nil if it's in space or hyperspace
- ship:getManeuver ()
-
return the ship's maneuver value
Returns:
-
number
the ship's maneuver value
- ship:getMaxChaff ()
-
return the ship's max chaff
Returns:
-
number
the ship's max chaff
- ship:getMaxEnergy ()
-
return the ship's max energy
Returns:
-
number
the ship's max energy
- ship:getMaxHull ()
-
return the ship's max hull
Returns:
-
number
the ship's max hull
- ship:getMaxMissiles ()
-
return the ship's max missiles
Returns:
-
number
the ship's max missiles
- ship:getMaxPulses ()
-
return the ship's max pulses
Returns:
-
number
the ship's max pulses
- ship:getMaxRockets ()
-
return the ship's max rockets
Returns:
-
number
the ship's max rockets
- ship:getMaxShield ()
-
return the ship's max shield
Returns:
-
number
the ship's max shield
- ship:getMaxSpeed ()
-
return the ship's max speed
Returns:
-
number
the ship's max speed
- ship:getMaxTorpedoes ()
-
return the ship's max torpedoes
Returns:
-
number
the ship's max torpedoes
- ship:getMissileTubes ()
-
return the ship's missile tubes
Returns:
-
number
the ship's missile tubes
- ship:getMissiles ()
-
returns current missiles.
Returns:
-
number
the current missiles
- ship:getName ()
-
get the ship's name
Returns:
-
string
the ship's name, for example
Red 5
- ship:getNavSeat ()
-
get the ship's nav seat room
Returns:
-
Room
the ship's nav seat room
- ship:getOwner ()
-
get the ship's owner name
Returns:
-
string
the ship's current owner, or nil if none is set
- ship:getPilot ()
-
get the ship's pilot name
Returns:
-
string
the ship's current pilot, or nil if none is set
- ship:getPilotBy ()
-
gets the character piloting the ship
Returns:
-
Character
the character piloting the ship, or nil if not found
- ship:getPilotSeat ()
-
get the ship's pilot seat room
Returns:
-
Room
the ship's pilot seat room
- ship:getPosition ()
-
get current position within system
Returns:
- number the ship's x coordinate
- number the ship's y coordinate
- number the ship's z coordinate
Usage:
local x, y, z = self:getPosition()
- ship:getPulses ()
-
returns current pulses.
Returns:
-
number
the current pulses
- ship:getRockets ()
-
returns current rockets.
Returns:
-
number
the current rockets
- ship:getRoomByOffset (offset)
-
get a room within the ship by its offset
Parameters:
- offset number the number to add to the ship's starting vnum
Returns:
-
Room
the room within the ship, or nil if it was an invalid offset
- ship:getSelfDestruct ()
-
returns current self destruct status
Returns:
-
number
the countdown to self destruct, or nil if disabled
- ship:getSensors ()
-
return the ship's sensors
Returns:
-
number
the ship's sensors
- ship:getShield ()
-
returns current shield.
Returns:
-
number
the current shield
- ship:getShieldBoosters ()
-
return the ship's shield boosters
Returns:
-
number
the ship's shield boosters
- ship:getShipyard ()
-
returns current shipyard.
Returns:
-
number
the current shipyard
- ship:getSpeed ()
-
returns current speed.
Returns:
-
number
the current speed
- ship:getStarsystem ()
-
get current starsystem
Returns:
-
Starsystem
the ship's current starsystem, or nil if it's landed or in hyperspace
- ship:getTarget ()
-
get the ship's primary target
Returns:
-
Ship
the ship's current target, or nil if not targeting anything
- ship:getTemplate ()
-
get the ship's template
Returns:
-
ShipTemplate
the ship's template or nil if it is not based on a template.
- ship:getTorpedoes ()
-
returns current torpedoes.
Returns:
-
number
the current torpedoes
- ship:getTractorbeams ()
-
return the ship's tractorbeam count
Returns:
-
number
the ship's tractorbeam count
- ship:getTurbolasers ()
-
return the ship's turbolasers count
Returns:
-
number
the ship's turbolasers count
- ship:getVector ()
-
get current vector
Returns:
- number the ship vector's x coordinate
- number the ship vector's y coordinate
- number the ship vector's z coordinate
Usage:
local x, y, z = self:getVector()
- ship:hasAutoFlag (flagName)
-
determine whether an autopilot config is set on a ship
Parameters:
- flagName string the name of the flag to check
Returns:
-
boolean
true if the flag is set, false if not or it's an invalid flag
Usage:
if self:hasAutoFlag("uselaser")
if not self:hasAutoFlag("sentinel")
- ship:hasFlag (flagName)
-
determine whether a flag is set on a ship
Parameters:
- flagName string the name of the flag to check
Returns:
-
boolean
true if the flag is set, false if not or it's an invalid flag
Usage:
if self:hasFlag("spawned")
if not self:hasFlag("legendary")
- ship:hasNavchart ()
-
checks if the ship has a matching navchart.
Returns:
-
boolean
true if the ship has a matching chart.
- ship:radio (text)
-
radios a message to the system originating from this ship, always in basic
Parameters:
- text string the text to radio
- ship:removeNavchart (the)
-
remove a navchart from the ship.
Parameters:
- the string name of the starsystem
Returns:
-
Ship
this ship, for call chaining
- ship:repairSystem (system)
-
repair a system on this ship.
Parameters:
- system string the system to repair (drive, ion, etc)
Returns:
-
Ship
this ship, for call chaining
- ship:restore ()
-
Restores this ship, raising all consumables to max
Returns:
-
Ship
this ship, for call chaining
- ship:setAutoFlag (flag, value)
-
set an autopilot config on this ship.
Parameters:
- flag string The flag to set
- value boolean The new value to set
Returns:
-
Ship
this ship, for call chaining
Usage:
ship:setAutoFlag("uselaser", true)
- ship:setAutopilot (autopilot)
-
set the ship's current autopilot status.
Parameters:
- autopilot boolean the new autopilot value
Returns:
-
Ship
this ship, for call chaining
- ship:setBattlegroupLeader (leader)
-
set the ship's battlegroup leader to add or remove it from a battlegroup.
Parameters:
- leader Ship the lead ship for the battlegroup, or nil to remove this ship from a battlegroup.
Returns:
-
Ship
this ship, for call chaining
- ship:setBayOpen (hangar, state)
-
sets the open/close status of a hangar bay.
Parameters:
- hangar number the hangar bay number
- state bool true for open, false for closed
Returns:
-
Ship
this ship, for call chaining
- ship:setBlasters (blasters)
-
set the ship's blaster count.
Parameters:
- blasters number the new blasters value
Returns:
-
Ship
this ship, for call chaining
- ship:setChaff (chaff)
-
set the ship's current chaff
Parameters:
- chaff number the new chaff
Returns:
-
Ship
this ship, for call chaining
- ship:setComms (comm)
-
set the ship's comms.
Parameters:
- comm number the new comm value
Returns:
-
Ship
this ship, for call chaining
- ship:setCopilot (copilot)
-
set the ship's current copilot
Parameters:
- copilot string the ship's new copilot, or nil to clear
Returns:
-
Ship
this ship, for call chaining
- ship:setCrew (crew)
-
set the ship's current crew list
Parameters:
- crew string the ship's new crew list, a space-separated list of character names, or empty string to clear
Returns:
-
Ship
this ship, for call chaining
- ship:setEnergy (energy)
-
set the ship's current energy
Parameters:
- energy number the new energy
Returns:
-
Ship
this ship, for call chaining
- ship:setFlag (flag, value)
-
set a flag on this ship.
Parameters:
- flag string The flag to set
- value boolean The new value to set
Returns:
-
Ship
this ship, for call chaining
Usage:
ship:setFlag("legendary", true)
- ship:setFleetPosition (position)
-
set the ship's position for battlegroup/squadron protection.
Parameters:
- position integer the position number: 1 = outer, 2 = mid, 3 = central
Returns:
-
Ship
this ship, for call chaining
- ship:setFullName (name)
-
set the ship's full name, including model name
Parameters:
- name
string
the ship's full name, for example
X-Wing Starfighter 'Red 5'
Returns:
-
Ship
this ship, for call chaining
- name
string
the ship's full name, for example
- ship:setHull (hull)
-
set the ship's current hull
Parameters:
- hull number the new hull
Returns:
-
Ship
this ship, for call chaining
- ship:setHyperspeed (hyperspeed)
-
set the ship's hyperspeed.
Parameters:
- hyperspeed number the new hyperspeed value
Returns:
-
Ship
this ship, for call chaining
- ship:setInterceptor (leader)
-
set this ship to serve as an interceptor for another ship.
Also handles the interceptor flag, adding or removing as necessary.
Parameters:
- leader Ship the home ship for the fighter, or nil to make this stop being an interceptor.
Returns:
-
Ship
this ship, for call chaining
- ship:setIons (ion)
-
set the ship's ion count.
Parameters:
- ion number the new ion value
Returns:
-
Ship
this ship, for call chaining
- ship:setLasers (lasers)
-
set the ship's laser count.
Parameters:
- lasers number the new lasers value
Returns:
-
Ship
this ship, for call chaining
- ship:setManeuver (maneuver)
-
set the ship's maneuver value.
Parameters:
- maneuver number the new maneuver value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxChaff (max_chaff)
-
set the ship's max chaff.
Parameters:
- max_chaff number the new max_chaff value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxEnergy (max_energy)
-
set the ship's max energy.
Parameters:
- max_energy number the new max_energy value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxHull (max_hull)
-
set the ship's max hull.
Parameters:
- max_hull number the new max_hull value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxMissiles (max_missiles)
-
set the ship's max missiles.
Parameters:
- max_missiles number the new max_missiles value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxPulses (max_pulses)
-
set the ship's max pulses.
Parameters:
- max_pulses number the new max_pulses value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxRockets (max_rockets)
-
set the ship's max rockets.
Parameters:
- max_rockets number the new max_rockets value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxShield (max_shield)
-
set the ship's max shield.
Parameters:
- max_shield number the new max_shield value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxSpeed (max_speed)
-
set the ship's max speed.
Parameters:
- max_speed number the new max_speed value
Returns:
-
Ship
this ship, for call chaining
- ship:setMaxTorpedoes (max_torpedoes)
-
set the ship's max torpedoes.
Parameters:
- max_torpedoes number the new max_torpedoes value
Returns:
-
Ship
this ship, for call chaining
- ship:setMissileTubes (missile_tubes)
-
set the ship's missile tubes.
Parameters:
- missile_tubes number the new missile_tubes value
Returns:
-
Ship
this ship, for call chaining
- ship:setMissiles (missiles)
-
set the ship's current missiles
Parameters:
- missiles number the new missiles
Returns:
-
Ship
this ship, for call chaining
- ship:setName (name)
-
set the ship's name
Parameters:
- name
string
the ship's new name, for example
Red 5
Returns:
-
Ship
this ship, for call chaining
- name
string
the ship's new name, for example
- ship:setOwner (owner)
-
set the ship's current owner
Parameters:
- owner string the ship's new owner, or nil to clear ownership
Returns:
-
Ship
this ship, for call chaining
- ship:setPilot (pilot)
-
set the ship's current pilot
Parameters:
- pilot string the ship's new pilot, or nil to clear
Returns:
-
Ship
this ship, for call chaining
- ship:setPulses (pulses)
-
set the ship's current pulses
Parameters:
- pulses number the new pulses
Returns:
-
Ship
this ship, for call chaining
- ship:setRockets (rockets)
-
set the ship's current rockets
Parameters:
- rockets number the new rockets
Returns:
-
Ship
this ship, for call chaining
- ship:setSelfDestruct (delay)
-
sets or clears self destruct.
Parameters:
- delay number the countdown to self destruct, or nil or 0 to disable it
Returns:
-
Ship
this ship, for call chaining
- ship:setSensors (sensor)
-
set the ship's sensors.
Parameters:
- sensor number the new sensor value
Returns:
-
Ship
this ship, for call chaining
- ship:setShield (shield)
-
set the ship's current shield
Parameters:
- shield number the new shield
Returns:
-
Ship
this ship, for call chaining
- ship:setShieldBoosters (shield_boosters)
-
set the ship's shield boosters.
Parameters:
- shield_boosters number the new shield boosters count
Returns:
-
Ship
this ship, for call chaining
- ship:setSpeed (speed)
-
set the ship's current speed
Parameters:
- speed number the new speed
Returns:
-
Ship
this ship, for call chaining
- ship:setSquadronLeader (leader)
-
set the ship's squadron leader to add or remove it from squadrons.
Parameters:
- leader Ship the ship to add this one to a squadron on, or nil to remove it from any squadrons.
Returns:
-
Ship
this ship, for call chaining
Usage:
xwing:setSquadronLeader(redLeader)
- ship:setTarget (target)
-
sets the target for an autopiloted ship.
Ship will immediately aggro on the target if possible. This ship must be on autopilot for this to work.
Parameters:
- target Ship the ship to target
Returns:
-
Ship
this ship, for call chaining
- ship:setTorpedoes (torpedoes)
-
set the ship's current torpedoes
Parameters:
- torpedoes number the new torpedoes
Returns:
-
Ship
this ship, for call chaining
- ship:setTractorbeams (tractorbeam)
-
set the ship's tractorbeam count.
Parameters:
- tractorbeam number the new tractorbeam value
Returns:
-
Ship
this ship, for call chaining
- ship:setTurbolasers (turbolasers)
-
set the ship's turbolaser count.
Parameters:
- turbolasers number the new turbolasers value
Returns:
-
Ship
this ship, for call chaining
- ship:setVector (x, y, z)
-
sets this ship's new vector.
Parameters:
- x number the x-coordinate to point the ship towards
- y number the y-coordinate to point the ship towards
- z number the z-coordinate to point the ship towards
Returns:
-
Ship
this ship, for call chaining
- ship:toRoom (room)
-
moves this ship to the given room as if landed there.
Parameters:
- room Room the room to move the ship to
Returns:
-
Ship
this ship, for call chaining
- ship:toStarsystem (starsystem, x, y, z)
-
moves this ship to the given system and coordinates.
Parameters:
- starsystem Starsystem the system to move the ship to
- x number the x-coordinate to move the ship to
- y number the y-coordinate to move the ship to
- z number the z-coordinate to move the ship to
Returns:
-
Ship
this ship, for call chaining