BrokerUpgrade
- Outline
{
isUpgrade = function(self, thing) end,
new = function(self, config) end,
}
BrokerUpgrade.isUpgrade
check if the given thing is a BrokerUpgrade
- Usage
local b = BrokerUpgrade:isUpgrade(thing)
- thing
-
any
- returnValue
-
boolean
BrokerUpgrade.new
an upgrade that can be bought
- Usage
local b = BrokerUpgrade:new(config)
- config
-
table
- name
-
string
(mandatory) - onInstall
-
function
gets theupgrade
and theplayer
as arguments. - id
-
string|nil
- description
-
string|function|nil
- installMessage
-
string|function|nil
- price
-
number
(default:0
) - unique
-
boolean
(default:false
) - requiredUpgrade
-
string|BrokerUpgrade|nil
Return Value
- Outline
{
canBeInstalled = function(self, player) end,
getDescription = function(self, player) end,
getId = function(self) end,
getInstallMessage = function(self, player) end,
getName = function(self) end,
getPrice = function(self) end,
getRequiredUpgradeString = function(self) end,
install = function(self, player) end,
}
object.canBeInstalled
check if the upgrade can be installed on the player
- Usage
local b = object:canBeInstalled(player)
- player
-
PlayerSpaceship
- returnValue
-
boolean
object.getDescription
get the description of the upgrade
- Usage
local n = object:getDescription(player)
- player
-
PlayerSpaceship
- returnValue
-
nil|string
object.getId
This function is only for internal use. It might change at any time without further notice. |
get the id of the upgrade
- Usage
local s = object:getId()
- returnValue
-
string
object.getInstallMessage
get the install message of the upgrade
- Usage
local n = object:getInstallMessage(player)
- player
-
PlayerSpaceship
- returnValue
-
nil|string
object.getName
get the name of this upgrade
- Usage
local s = object:getName()
- returnValue
-
string
object.getPrice
get the price of the upgrade
- Usage
local n = object:getPrice()
- returnValue
-
number
object.getRequiredUpgradeString
get the id of the required upgrade
- Usage
local s = object:getRequiredUpgradeString()
- returnValue
-
string|nil
object.install
install the upgrade on the player
- Usage
local b = object:install(player)
- player
-
PlayerSpaceship
- returnValue
-
BrokerUpgrade
Chatter
- Outline
{
isChatFactory = function(self, thing) end,
isChatNoise = function(self, thing) end,
isChatter = function(self, thing) end,
new = function(self, config) end,
newFactory = function(self, cardinality, factory, config) end,
newNoise = function(self, chatter, config) end,
}
Chatter.isChatFactory
check if the given thing is a valid chat factory
- Usage
local b = Chatter:isChatFactory(thing)
- thing
-
any
- returnValue
-
boolean
Chatter.isChatNoise
check if the given thing is a valid ChatNoise
- Usage
local b = Chatter:isChatNoise(thing)
- thing
-
any
- returnValue
-
boolean
Chatter.isChatter
check if the given thing is a valid Chatter
- Usage
local b = Chatter:isChatter(thing)
- thing
-
any
- returnValue
-
boolean
Chatter.new
Chatter is a module to handle random messages flying through space. Usually they come from nearby ships and stations and the comms officer is able to monitor them.
- Usage
Chatter:new(config)
- config
-
table
- maxRange
-
number
(default:PlayerSpaceship:getLongRangeRadarRange() * 1.5
) the maximum range the player receives chats from their surrounding.
Return Value
- Outline
{
converse = function(self, messages) end,
say = function(self, sender, message) end,
}
object.converse
start a conversation
- Usage
object:converse(messages)
- messages
-
table
object.say
send a single message
- Usage
object:say(sender, message)
- sender
-
ShipTemplateBased
- message
-
string
Chatter.newFactory
create a factory that can create parameterized chats
- Usage
local c = Chatter:newFactory(cardinality, factory, config)
- cardinality
-
number
the number of participants in that conversation - factory
-
function
- config
-
table
- filters
-
table[number,function]
a function that returns a boolean if the given first argument is a suitable candidate for the chat
Return Value
- Outline
{
areValidArguments = function(self, ...) end,
createChat = function(self, ...) end,
getCardinality = function(self) end,
}
object.areValidArguments
This function is only for internal use. It might change at any time without further notice. |
- Usage
local b = object:areValidArguments(...)
- ... (multiple)
-
ShipTemplateBased
- returnValue
-
boolean
object.createChat
This function is only for internal use. It might change at any time without further notice. |
- Usage
local t = object:createChat(...)
- ... (multiple)
-
ShipTemplateBased
- returnValue
-
table
object.getCardinality
This function is only for internal use. It might change at any time without further notice. |
- Usage
local n = object:getCardinality()
- returnValue
-
number
Chatter.newNoise
a randomizer that generates chats between ships and stations
- Usage
local c = Chatter:newNoise(chatter, config)
- chatter
-
Chatter
- config
-
table
Return Value
- Outline
{
addChatFactory = function(self, chatFactory, id) end,
getChatFactories = function(self) end,
removeChatFactory = function(self, id) end,
}
object.addChatFactory
add a chat factory
- Usage
local s = object:addChatFactory(chatFactory, id)
- chatFactory
-
ChatFactory
- id
-
string
(optional) - returnValue
-
string
the id of this chat factory
object.getChatFactories
return all chat factories
- Usage
local r1, r2 = object:getChatFactories()
- returnValue
-
table[string,ChatFactory]
object.removeChatFactory
- Usage
object:removeChatFactory(id)
- id
-
string
Comms
- Outline
{
isReply = function(self, thing) end,
isScreen = function(self, thing) end,
merchantFactory = function(self, config) end,
missionBrokerFactory = function(self, config) end,
newReply = function(self, playerSays, nextScreen, condition) end,
newScreen = function(self, npcSays, howPlayerCanReact) end,
upgradeBrokerFactory = function(self, config) end,
}
Comms.isReply
check if the given thing is a valid CommsReply
- Usage
local b = Comms:isReply(thing)
- thing
-
any
- returnValue
-
boolean
Comms.isScreen
check if the given thing is a valid CommsScreen
- Usage
local b = Comms:isScreen(thing)
- thing
-
any
- returnValue
-
boolean
Comms.merchantFactory
create comms for a merchant
- Usage
Comms:merchantFactory(config)
- config
-
table
- label
-
string|function
the label that leads to the merchant in comms - mainScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - buyScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - buyProductScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - buyProductConfirmScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - sellScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - sellProductScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - sellProductConfirmScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - displayCondition
-
nil|function
getsstation
andcomms_source
. Should return aboolean
.
Comms.missionBrokerFactory
create comms for a mission broker
- Usage
local c = Comms:missionBrokerFactory(config)
- config
-
table
- label
-
string|function
the label that leads to the mission broker in comms - mainScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - detailScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - acceptScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - displayCondition
-
nil|function
getscomms_target
andcomms_source
. Should return aboolean
.
- returnValue
-
CommsReply
Comms.newReply
creates a CommsReply
- Usage
local c = Comms:newReply(playerSays, nextScreen, condition)
- playerSays
-
string|function
the short statement from the players - nextScreen
-
nil|function
get the next screen that should be displayed to the players - condition
-
nil|function
the condition under which this option should be displayed
Return Value
- Outline
{
checkCondition = function(self, station, player) end,
getNextScreen = function(self, station, player) end,
getWhatPlayerSays = function(self, station, player) end,
}
object.checkCondition
This function is only for internal use. It might change at any time without further notice. |
check if this option is supposed to be displayed
- Usage
object:checkCondition(station, player)
- station
-
ShipTemplateBased
- player
-
PlayerSpaceship
object.getNextScreen
This function is only for internal use. It might change at any time without further notice. |
- Usage
object:getNextScreen(station, player)
- station
-
ShipTemplateBased
- player
-
PlayerSpaceship
object.getWhatPlayerSays
This function is only for internal use. It might change at any time without further notice. |
- Usage
object:getWhatPlayerSays(station, player)
- station
-
ShipTemplateBased
- player
-
PlayerSpaceship
Comms.newScreen
creates a CommsScreen
- Usage
local c = Comms:newScreen(npcSays, howPlayerCanReact)
- npcSays
-
string
what the NPC says (aka longish text) - howPlayerCanReact
-
table[CommsReply]
possible answers of the player
Return Value
- Outline
{
addReply = function(self, reply) end,
addText = function(self, text) end,
getHowPlayerCanReact = function(self) end,
getWhatNpcSays = function(self) end,
}
object.addReply
add a reply to the screen
- Usage
local c = object:addReply(reply)
- reply
-
CommsReply
- returnValue
-
CommsScreen
object.addText
add text to the screen
- Usage
local c = object:addText(text)
- text
-
string
- returnValue
-
CommsScreen
object.getHowPlayerCanReact
This function is only for internal use. It might change at any time without further notice. |
- Usage
local t = object:getHowPlayerCanReact()
- returnValue
-
table[CommsReply]
object.getWhatNpcSays
This function is only for internal use. It might change at any time without further notice. |
- Usage
local s = object:getWhatNpcSays()
- returnValue
-
string
Comms.upgradeBrokerFactory
create comms for an upgrade broker
- Usage
local c = Comms:upgradeBrokerFactory(config)
- config
-
table
- label
-
string|function
the label that leads to the upgrade broker in comms - mainScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - detailScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - installScreen
-
function
gets ascreen
,comms_target
,comms_source
and aninfo
. Should manipulate the screen to contain human readable text. - displayCondition
-
nil|function
getscomms_target
andcomms_source
. Should return aboolean
.
- returnValue
-
CommsReply
Cron
- Outline
{
abort = function(name) end,
addDelay = function(name, delay) end,
getDelay = function(name) end,
now = function() end,
once = function(name, func, delay) end,
regular = function(name, func, interval, delay) end,
setDelay = function(name, delay) end,
tick = function(delta) end,
}
Cron.abort
Abort a Cron
- Usage
Cron.abort(name)
- name
-
string
unique identifier of the cron to be aborted.
Cron.addDelay
postpone the cron by the specified delay in seconds
- Usage
Cron.addDelay(name, delay)
- name
-
string
unique identifier of the cron - delay
-
number
seconds to postpone the execution
Cron.getDelay
Get the time in seconds until the cron will be called the next time
- Usage
local n = Cron.getDelay(name)
- name
-
string
unique identifier of the cron to be aborted. - returnValue
-
nil|number
Cron.now
get the current in-game time in seconds
- Usage
local n = Cron.now()
- returnValue
-
number
Cron.once
Calls a function once after a delay.
Example:
Cron.once("identifier", function() print("Hello World") end, 10)
- Usage
local s = Cron.once(name, func, delay)
- name
-
string
unique identifier - func
-
function
the function to call once - delay
-
number
the number of seconds after which the function should be called - returnValue
-
string
uid of the cron
Cron.regular
Calls a function regularily at a specific interval.
- Usage
local s = Cron.regular(name, func, interval, delay)
- name
-
string
unique identifier - func
-
function
the function to call once - interval
-
number
the interval in seconds at which the function should be called - delay
-
number
the initial delay in seconds after which the function is called for the first time - returnValue
-
string
uid of the cron
Cron.setDelay
This function is deprecated and should not be used anymore. will be removed |
- Usage
Cron.setDelay(name, delay)
- name
-
string
- delay
-
number
Cron.tick
- Usage
Cron.tick(delta)
- delta
-
number
of the ellapsed time since the last call
EventHandler
- Outline
{
new = function(self, config) end,
}
EventHandler.new
Creates a new event handler
- Usage
EventHandler:new(config)
- config
-
table
- allowedEvents
-
table[string]
a table of all valid event names - unique
-
boolean
if every event could only triggered once
Return Value
- Outline
{
fire = function(self, eventName, arg) end,
register = function(self, eventName, handler, priority) end,
}
object.fire
Fire an event
- Usage
object:fire(eventName, arg)
- eventName
-
string
- arg
-
table
an argument for all event listeners
object.register
Register a new event listener
- Usage
object:register(eventName, handler, priority)
- eventName
-
string
- handler
-
function
- priority
-
number
default:0
Fleet
- Outline
{
hasOrderQueue = function(self, fleet) end,
isFleet = function(self, thing) end,
new = function(self, ships, config) end,
withOrderQueue = function(self, object) end,
}
Fleet.hasOrderQueue
check if the thing is a fleet with an orderQueue
- Usage
local b = Fleet:hasOrderQueue(fleet)
- fleet
-
any
- returnValue
-
boolean
Fleet.isFleet
check if the given thing is a FleetObject
- Usage
local b = Fleet:isFleet(thing)
- thing
-
any
- returnValue
-
boolean
Fleet.new
creates a new fleet
- Usage
local f = Fleet:new(ships, config)
- ships
-
table[CpuShip]
- config
-
table
- id
-
string
(optional) - formation
-
string
(default:row
) row, circle
Return Value
- Outline
{
countShips = function(self) end,
getId = function(self) end,
getLeader = function(self) end,
getShips = function(self) end,
isValid = function(self) end,
}
object.countShips
count the valid ships in the fleet
- Usage
local n = object:countShips()
- returnValue
-
number
object.getId
This function is only for internal use. It might change at any time without further notice. |
get the id of the fleet
- Usage
local s = object:getId()
- returnValue
-
string
object.getLeader
get the leader of the fleet
- Usage
local c = object:getLeader()
- returnValue
-
CpuShip|nil
object.getShips
get all the valid ships that are belonging to the fleet
- Usage
local t = object:getShips()
- returnValue
-
table[CpuShip]
object.isValid
check if there are any valid ships in the fleet
- Usage
local b = object:isValid()
- returnValue
-
boolean
Fleet.withOrderQueue
- Usage
Fleet:withOrderQueue(object)
Return Value
- Outline
{
abortCurrentOrder = function(self) end,
addOrder = function(self, order) end,
countShips = function(self) end,
flushOrders = function(self) end,
forceOrderNow = function(self, order) end,
getId = function(self) end,
getLeader = function(self) end,
getShips = function(self) end,
isValid = function(self) end,
}
object.abortCurrentOrder
abort the current order
- Usage
local s = object:abortCurrentOrder()
- returnValue
-
self
object.addOrder
add an order that is executed after all other orders
- Usage
local s = object:addOrder(order)
- order
-
Order
- returnValue
-
self
object.countShips
count the valid ships in the fleet
- Usage
local n = object:countShips()
- returnValue
-
number
object.flushOrders
remove all orders that would be executed after the current one
- Usage
local s = object:flushOrders()
- returnValue
-
self
object.forceOrderNow
abort all orders and start executing the given order
- Usage
local s = object:forceOrderNow(order)
- order
-
Order
- returnValue
-
self
object.getId
This function is only for internal use. It might change at any time without further notice. |
get the id of the fleet
- Usage
local s = object:getId()
- returnValue
-
string
object.getLeader
get the leader of the fleet
- Usage
local c = object:getLeader()
- returnValue
-
CpuShip|nil
object.getShips
get all the valid ships that are belonging to the fleet
- Usage
local t = object:getShips()
- returnValue
-
table[CpuShip]
object.isValid
check if there are any valid ships in the fleet
- Usage
local b = object:isValid()
- returnValue
-
boolean
Generic
- Outline
{
hasTags = function(self, thing) end,
withTags = function(self, thing, ...) end,
}
Generic.hasTags
checks if the given object has tags configured
- Usage
local b = Generic:hasTags(thing)
- thing
-
any
- returnValue
-
booelan
Generic.withTags
allows to tag any object with strings
- Usage
local t = Generic:withTags(thing, ...)
- thing
-
table
- ... (multiple)
-
string
the strings to add as tags
Return Value
- Outline
{
addTag = function(self, tag) end,
addTags = function(self, ...) end,
getTags = function(self) end,
hasTag = function(self, tag) end,
removeTag = function(self, tag) end,
removeTags = function(self, ...) end,
}
object.addTag
add a tag
- Usage
object:addTag(tag)
- tag
-
string
object.addTags
add multiple tags
- Usage
object:addTags(...)
- ... (multiple)
-
string
object.getTags
get all tags assigned to this object
- Usage
local t = object:getTags()
- returnValue
-
table[string]
object.hasTag
check if the thing has a tag
- Usage
local b = object:hasTag(tag)
- tag
-
string
- returnValue
-
boolean
object.removeTag
remove a tag
- Usage
object:removeTag(tag)
- tag
-
string
object.removeTags
remove multiple tags
- Usage
object:removeTags(...)
- ... (multiple)
-
string
Menu
- Outline
{
addGmMenuItem = function(self, menuItem) end,
drawGmMenu = function(self, menu) end,
isMenu = function(self, thing) end,
isMenuItem = function(self, thing) end,
new = function(self) end,
newItem = function(self, label, onClick, priority) end,
removeGmMenuItem = function(self, label) end,
}
Menu.addGmMenuItem
add a menu item to the main menu of the GM screen
- Usage
Menu:addGmMenuItem(menuItem)
- menuItem
-
MenuItem
Menu.drawGmMenu
draw a specific menu on the GM screen
- Usage
Menu:drawGmMenu(menu)
- menu
-
Menu
(optional) the menu to draw. Draws the main menu by default.
Menu.isMenu
checks if a given thing is a valid Menu
- Usage
local b = Menu:isMenu(thing)
- thing
-
any
- returnValue
-
boolean
Menu.isMenuItem
checks if a given thing is a valid MenuItem
- Usage
local b = Menu:isMenuItem(thing)
- thing
-
any
- returnValue
-
boolean
Menu.new
create a new menu entry
- Usage
local m = Menu:new()
Return Value
- Outline
{
addItem = function(self, id, menuItem) end,
getItems = function() end,
removeItem = function(self, id) end,
}
object.addItem
add an entry to the menu
- Usage
object:addItem(id, menuItem)
- id
-
string
(optional) the unique identifier for this entry - menuItem
-
MenuItemObject
object.getItems
get all items from the menu
- Usage
local t = object.getItems()
- returnValue
-
table[MenuItemObject]
object.removeItem
remove an entry from the menu
- Usage
object:removeItem(id)
- id
-
string
Menu.newItem
create a new menu item
- Usage
local m = Menu:newItem(label, onClick, priority)
- label
-
string
the human readable label of this menu entry - onClick
-
string|nil|MenuObject|function
defines what happens when the menu item is clicked.nil
is a non-clickable label, astring
will be shown in a pop-up,MenuObject
opens this menu as submenu, andfunction
can return astring
orMenu
- priority
-
number
(default:0
)
Return Value
- Outline
{
getLabel = function(self) end,
getPriority = function(self) end,
}
object.getLabel
This function is only for internal use. It might change at any time without further notice. |
get the label of the menu item
- Usage
local s = object:getLabel()
- returnValue
-
string
object.getPriority
This function is only for internal use. It might change at any time without further notice. |
get the priority for this item in the menu list
- Usage
local n = object:getPriority()
- returnValue
-
number
Menu.removeGmMenuItem
add a menu item to the main menu of the GM screen
- Usage
Menu:removeGmMenuItem(label)
- label
-
string
the label of the menu item to remove
Mission
- Outline
{
allOf = function(self, ...) end,
chain = function(self, ...) end,
forPlayer = function(self, mission, initPlayer) end,
isBrokerMission = function(self, thing) end,
isMission = function(self, mission) end,
isPlayerMission = function(self, thing) end,
isSubMission = function(self, mission) end,
isTimeLimitMission = function(self, thing) end,
new = function(self, config) end,
registerMissionAcceptListener = function(self, handler, priority) end,
registerMissionCreationListener = function(self, handler, priority) end,
registerMissionDeclineListener = function(self, handler, priority) end,
registerMissionEndListener = function(self, handler, priority) end,
registerMissionFailureListener = function(self, handler, priority) end,
registerMissionStartListener = function(self, handler, priority) end,
registerMissionSuccessListener = function(self, handler, priority) end,
withBroker = function(self, mission, title, config) end,
withTimeLimit = function(self, mission, timeLimit) end,
}
Mission.allOf
A mission container where all submissions have to be finished successfully
- Usage
Mission:allOf(...)
- ... (multiple)
-
Mission|table
- acceptCondition
-
function
getsself
as arguments. should returntrue
orfalse
whether the mission can be accepted - onAccept
-
function
getsself
as argument - onDecline
-
function
getsself
as argument - onStart
-
function
getsself
as argument - onSuccess
-
function
getsself
as argument - onFailure
-
function
getsself
as argument - onEnd
-
function
getsself
as argument
Mission.chain
A mission chain where all submissions have to be run in the specified order
- Usage
Mission:chain(...)
- ... (multiple)
-
Mission|table
- acceptCondition
-
function
getsself
as arguments. should returntrue
orfalse
whether the mission can be accepted - onAccept
-
function
getsself
as argument - onDecline
-
function
getsself
as argument - onStart
-
function
getsself
as argument - onSuccess
-
function
getsself
as argument - onFailure
-
function
getsself
as argument - onEnd
-
function
getsself
as argument
Mission.forPlayer
mark a mission as relevant for a player
- Usage
Mission:forPlayer(mission, initPlayer)
- mission
-
Mission
- initPlayer
-
PlayerSpaceship
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Mission.isBrokerMission
check if the given thing is a broker mission
- Usage
local b = Mission:isBrokerMission(thing)
- thing
-
any
- returnValue
-
boolean
Mission.isMission
check if a thing is a Mission
- Usage
local b = Mission:isMission(mission)
- mission
-
any
- returnValue
-
boolean
Mission.isPlayerMission
check if the given thing is a PlayerMission
- Usage
local b = Mission:isPlayerMission(thing)
- thing
-
any
- returnValue
-
boolean
Mission.isSubMission
check if a thing is a Mission
and has a parent mission
- Usage
local b = Mission:isSubMission(mission)
- mission
-
any
- returnValue
-
boolean
Mission.isTimeLimitMission
check if the given thing is a Mission with TimeLimit
- Usage
local b = Mission:isTimeLimitMission(thing)
- thing
-
any
- returnValue
-
boolean
Mission.new
A mission
- Usage
Mission:new(config)
- config
-
table
- acceptCondition
-
function
getsself
as arguments. should returntrue
orfalse
whether the mission can be accepted - onAccept
-
function
getsself
as argument - onDecline
-
function
getsself
as argument - onStart
-
function
getsself
as argument - onSuccess
-
function
getsself
as argument - onFailure
-
function
getsself
as argument - onEnd
-
function
getsself
as argument
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getState = function(self) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Mission.registerMissionAcceptListener
Event listener if any mission is accepted
- Usage
Mission:registerMissionAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionCreationListener
Event listener if any mission is created
- Usage
Mission:registerMissionCreationListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionDeclineListener
Event listener if any mission is declined
- Usage
Mission:registerMissionDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionEndListener
Event listener if any mission ended
- Usage
Mission:registerMissionEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionFailureListener
Event listener if any mission failed
- Usage
Mission:registerMissionFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionStartListener
Event listener if any mission is started
- Usage
Mission:registerMissionStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.registerMissionSuccessListener
Event listener if any mission is successful
- Usage
Mission:registerMissionSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
Mission.withBroker
A mission that the player can accept. It is supposed to be used for side missions that ships can give you.
- Usage
Mission:withBroker(mission, title, config)
- mission
-
Mission
- title
-
string
the title of this mission - config
-
table
- description
-
string
the description of the mission - acceptMessage
-
string
the response the player get when the accept the message - missionBroker
-
ShipTemplateBased
the party that issued this mission - hint
-
string
a hint for this mission
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getAcceptMessage = function(self) end,
getDescription = function(self) end,
getHint = function(self) end,
getId = function(self) end,
getMissionBroker = function(self) end,
getState = function(self) end,
getTitle = function(self) end,
setHint = function(self, thing) end,
setMissionBroker = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setMissionBroker
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getAcceptMessage
get the printable response when the mission has been accepted
- Usage
local s = object:getAcceptMessage()
- returnValue
-
string
object.getDescription
get the printable description of this mission
- Usage
local s = object:getDescription()
- returnValue
-
string
object.getHint
get a printable hint for the current state of the mission
- Usage
local n = object:getHint()
- returnValue
-
nil|string
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getMissionBroker
get the broker that has offered this mission
- Usage
local s = object:getMissionBroker()
- returnValue
-
ShipTemplateBased
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getTitle
get the printable title of this mission
- Usage
local s = object:getTitle()
- returnValue
-
string
object.setHint
set a printable hint that can be displayed in the Mission Tracker
- Usage
object:setHint(thing)
- thing
-
string|function
object.setMissionBroker
set the broker that has offered this mission
- Usage
object:setMissionBroker(thing)
- thing
-
ShipTemplateBased
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Mission.withTimeLimit
limit the time a mission is "started" before it fails automatically
- Usage
Mission:withTimeLimit(mission, timeLimit)
- mission
-
Mission
- timeLimit
-
number
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getElapsedTime = function(self) end,
getId = function(self) end,
getRemainingTime = function(self) end,
getState = function(self) end,
modifyTimeLimit = function(self, delta) end,
setTimeLimit = function(self, timeLimit) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getElapsedTime
get the time that has already elapsed since the start of the mission
- Usage
local n = object:getElapsedTime()
- returnValue
-
number
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getRemainingTime
get the remaining time before the mission will automatically fail
- Usage
local n = object:getRemainingTime()
- returnValue
-
nil|number
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.modifyTimeLimit
modify the duration at which the mission will fail
- Usage
object:modifyTimeLimit(delta)
- delta
-
number
object.setTimeLimit
set the duration after which the mission will automatically fail
- Usage
object:setTimeLimit(timeLimit)
- timeLimit
-
number
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions
- Outline
{
answer = function(self, commable, question, playerSays, config) end,
bringProduct = function(self, station, config) end,
capture = function(self, bearer, config) end,
crewForRent = function(self, needy, config) end,
destroy = function(self, things, config) end,
destroyRagingMiner = function(self, things, config) end,
disable = function(self, target, config) end,
pickUp = function(self, things, deliveryStation, config) end,
scan = function(self, things, config) end,
transportProduct = function(self, from, to, product, config) end,
transportToken = function(self, from, to, config) end,
visit = function(self, station, config) end,
wayPoints = function(self, wayPoints, config) end,
}
Missions.answer
Someone asks a question and the crew needs to give the correct answer.
How they come to the conclusion does not really matter. It could be a riddle, something to observe, a reward by the GM after role playing or they might even guess the correct answer.
- Usage
local m = Missions:answer(commable, question, playerSays, config)
- commable
-
ShipTemplateBased
where to give the answer - question
-
string|function
- playerSays
-
string|function
- config
-
table
- acceptCondition
-
function
getsself
as arguments. should returntrue
orfalse
whether the mission can be accepted - onAccept
-
function
getsself
as argument - onDecline
-
function
getsself
as argument - onStart
-
function
getsself
as argument - correctAnswer
-
string|function|nil
- wrongAnswers
-
table[string]|function
- backLabel
-
string|nil|function
the label if you do not want to give an answer right now - correctAnswerResponse
-
string|function
what is said when the answer is correct - wrongAnswerResponse
-
string|function
what is said when the answer is wrong - onSuccess
-
function
getsself
as argument - onFailure
-
function
getsself
as argument - onEnd
-
function
getsself
as argument
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getCommable = function(self) end,
getId = function(self) end,
getState = function(self) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getCommable
get the place where to give the answer
- Usage
local s = object:getCommable()
- returnValue
-
ShipTemplateBased
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.bringProduct
The players need to bring a certain amount of products to the station.
It does not matter how they are achieved (mining, piracy, trading) for this mission.
- Usage
Missions:bringProduct(station, config)
- station
-
SpaceStation
- config
-
table
- product
-
Product
the product the players have to bring - amount
-
number
number of units the player have to bring - acceptCondition
-
function
- onAccept
-
function
- onDecline
-
function
- onStart
-
function
- onDelivery
-
function
- successScreen
-
function
- sellProductScreen
-
function
- commsLabel
-
string
- sellProductScreen
-
function
- onSuccess
-
function
- onFailure
-
function
- onEnd
-
function
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getBroughtAmount = function() end,
getId = function(self) end,
getProduct = function() end,
getState = function(self) end,
getTotalAmount = function() end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getBroughtAmount
- Usage
object.getBroughtAmount()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getProduct
- Usage
object.getProduct()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getTotalAmount
- Usage
object.getTotalAmount()
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.capture
Destroy something in order to pick up something that you have to drop at some station.
Think: "Retrieve plans for a super weapon", "Free prisoners", "Capture Mr. Superbaddy", etc.
- Usage
local m = Missions:capture(bearer, config)
- bearer
-
ShipTemplateBased|function
- config
-
table
- approachDistance
-
number
(default:10000
) - onApproach
-
function
- onBearerDestruction
-
function
- onItemDestruction
-
function
- onPickup
-
function
- dropOffTarget
-
nil|SpaceStation
- onDropOff
-
function
- onDropOffTargetDestroyed
-
function
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getBearer = function(self) end,
getDropOffTarget = function(self) end,
getId = function(self) end,
getItemObject = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getBearer
- Usage
local n = object:getBearer()
- returnValue
-
nil|ShipTemplateBased
object.getDropOffTarget
- Usage
local n = object:getDropOffTarget()
- returnValue
-
nil|SpaceStation
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getItemObject
- Usage
local n = object:getItemObject()
- returnValue
-
nil|SpaceObject
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.crewForRent
Lend someone part of your repair crew for a limited time
- Usage
local m = Missions:crewForRent(needy, config)
- needy
-
ShipTemplateBased
- config
-
table
- distance
-
number
(default:1000
) range to beam the crew - crewCount
-
number
(default:1
) - duration
-
number
(default:60
) how long the crew is occupied - sendCrewLabel
-
string
- sendCrewFailed
-
function
- onCrewArrived
-
function
- onCrewReady
-
function
- returnCrewLabel
-
string
- onCrewReturned
-
function
- onDestruction
-
function
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getNeedy = function(self) end,
getPlayer = function(self) end,
getRepairCrewCount = function(self) end,
getState = function(self) end,
getTimeToReady = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getNeedy
- Usage
local s = object:getNeedy()
- returnValue
-
ShipTemplateBased
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getRepairCrewCount
the number of crew members currently away
- Usage
local n = object:getRepairCrewCount()
- returnValue
-
number
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getTimeToReady
the time it still takes before the crew returns
- Usage
local n = object:getTimeToReady()
- returnValue
-
number|nil
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.destroy
Destroy stuff - pretty simple, huh?
- Usage
Missions:destroy(things, config)
- things
-
ShipTemplateBased|WarpJammer|ScanProbe|table[ShipTemplateBased|WarpJammer|ScanProbe]|function
what to destroy - config
-
table
- approachDistance
-
number
(default:10000
) - onApproach
-
function(mission,closestEnemy)
called when the player first approach one of the enemies - onDestruction
-
function(mission,enemy)
called when an enemy was destroyed
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
countEnemies = function(self) end,
countInvalidEnemies = function(self) end,
countValidEnemies = function(self) end,
decline = function(self) end,
fail = function(self) end,
getEnemies = function(self) end,
getId = function(self) end,
getInvalidEnemies = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
getValidEnemies = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.countEnemies
count all enemy targets - alive or dead
- Usage
local n = object:countEnemies()
- returnValue
-
number
object.countInvalidEnemies
count enemies that were killed
- Usage
local n = object:countInvalidEnemies()
- returnValue
-
number
object.countValidEnemies
count enemies that are still alive
- Usage
local n = object:countValidEnemies()
- returnValue
-
number
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getEnemies
get all enemy targets - alive or dead
- Usage
local n = object:getEnemies()
- returnValue
-
nil|table[ShipTemplateBased|WarpJammer|ScanProbe]
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getInvalidEnemies
get enemies that were killed
- Usage
local n = object:getInvalidEnemies()
- returnValue
-
nil|table[ShipTemplateBased|WarpJammer|ScanProbe]
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getValidEnemies
get enemies that are still alive
- Usage
local n = object:getValidEnemies()
- returnValue
-
nil|table[ShipTemplateBased|WarpJammer|ScanProbe]
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.destroyRagingMiner
This function is deprecated and should not be used anymore. Not sure if i will leave it in |
A mission engaging all crew members and allowing different ways to solve.
Here is the basic run through that should also explain its name A mining ship got out of control. It is roaming around trying to shoot everything that moves and the crew has to destroy it. Unfortunately it has a very strong, but slow firing, laser and a malfunctioning shield that will emit EMP bursts regularily. The good thing is, it is very slow and clumsy.
Possible ways to defeat it.
-
a good helms can outmanouver its laser
-
weapons can target specific systems to support the strategy
-
comms can hack specific systems to achieve the same
-
relay sees when EMP burst occur, so the crew may lower the shields to avoid damage
-
engineering won’t get bored during fights anyways
As a GM, if you really want to challenge your crew, take a faster and more agile ship or add more lasers. :)
- Usage
local m = Missions:destroyRagingMiner(things, config)
- things
-
CpuShip|table[CpuShip]
- config
-
table
- onDestruction
-
function(mission,enemy)
called when an enemy was destroyed - onPlayerHitByEmpBurst
-
function(enemy,player,damage)
- returnValue
-
Mission
Missions.disable
Disable a ship by destroying its engines and force it to stop.
Assuming the ship has it, the Impulse Drive, Warp Drive and Jump Drive have to be destroyed.
- Usage
local m = Missions:disable(target, config)
- target
-
CpuShip|function
- config
-
table
- approachDistance
-
(default:
10000
) - onApproach
-
function(mission)
- damageThreshold
-
number
(default:-0.2
) How far the systems need to be destroyed to count as success. (1
= full health,0
= disabled,-1
= severely damaged) - distanceToFinish
-
number
(default:1000
) How close the players need to be to the ship so they surrender - onSurrender
-
function(mission)
- onDestruction
-
function(mission)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
getTarget = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getTarget
- Usage
local n = object:getTarget()
- returnValue
-
nil|CpuShip
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.pickUp
Pick up Artifact
s or SupplyDrop
s
- Usage
local m = Missions:pickUp(things, deliveryStation, config)
- things
-
Artifact|SupplyDrop|table[Artifact|SupplyDrop]|function
the things to pick up - deliveryStation
-
SpaceStation|function|nil
where to deliver the things to - config
-
table
- onPickUp
-
function(mission,thing)
- onAllPickedUp
-
function(mission)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
countPickUps = function(self) end,
decline = function(self) end,
fail = function(self) end,
getDeliveryStation = function(self) end,
getId = function(self) end,
getPickUps = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.countPickUps
- Usage
local n = object:countPickUps()
- returnValue
-
number
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getDeliveryStation
- Usage
local n = object:getDeliveryStation()
- returnValue
-
nil|SpaceStation
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPickUps
- Usage
local t = object:getPickUps()
- returnValue
-
table[Artifact|SupplyDrop]
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.scan
The players have to scan some SpaceShip
s or other SpaceObjects
. The mission is successful when all valid targets are scanned.
It fails only if all targets are destroyed.
- Usage
local m = Missions:scan(things, config)
- things
-
function|table[CpuShip]|CpuShip
a CpuShip, a table ofCpuShip
s or a function returning a table ofCpuShip
s - config
-
table
- scan
-
string
(default:simple
) the required scan level (fof
,simple
orfull
) - onScan
-
function
function(mission,thing) - onDestruction
-
function
function(mission,thing)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
countScannedTargets = function(self) end,
countTargets = function(self) end,
countUnscannedTargets = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getScannedTargets = function(self) end,
getState = function(self) end,
getTargets = function(self) end,
getUnscannedTargets = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.countScannedTargets
- Usage
local n = object:countScannedTargets()
- returnValue
-
number
object.countTargets
- Usage
local n = object:countTargets()
- returnValue
-
number
object.countUnscannedTargets
- Usage
local n = object:countUnscannedTargets()
- returnValue
-
number
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getScannedTargets
- Usage
local t = object:getScannedTargets()
- returnValue
-
table[CpuShip]
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.getTargets
- Usage
local t = object:getTargets()
- returnValue
-
table[CpuShip]
object.getUnscannedTargets
- Usage
local t = object:getUnscannedTargets()
- returnValue
-
table[CpuShip]
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.transportProduct
Bring something to a station
This fills the storage on the ship
- Usage
local m = Missions:transportProduct(from, to, product, config)
- from
-
SpaceStation
- to
-
SpaceStation
- product
-
Product
- config
-
table
- amount
-
number
(default:1
) - onLoad
-
function(mission)
When the product is loaded - onUnload
-
function(mission)
- onInsufficientStorage
-
function(mission)
- onProductLost
-
function(mission)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getAmount = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getProduct = function(self) end,
getState = function(self) end,
isLoaded = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getAmount
- Usage
local n = object:getAmount()
- returnValue
-
number
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getProduct
- Usage
local p = object:getProduct()
- returnValue
-
Product
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.isLoaded
- Usage
local n = object:isLoaded()
- returnValue
-
number
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.transportToken
Bring something or someone from one station to another
This does not fill any storage on the ship.
- Usage
local m = Missions:transportToken(from, to, config)
- from
-
SpaceStation
- to
-
SpaceStation
- config
-
table
- onLoad
-
function(mission)
- onUnload
-
function(mission)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
isTokenLoaded = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.isTokenLoaded
- Usage
local b = object:isTokenLoaded()
- returnValue
-
boolean
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.visit
Your mission is to find a station and dock there
- Usage
local m = Missions:visit(station, config)
- station
-
SpaceStation
- config
-
table
- onVisit
-
function(mission)
Return Value
- Outline
{
accept = function(self) end,
addAcceptListener = function(self, handler, priority) end,
addDeclineListener = function(self, handler, priority) end,
addEndListener = function(self, handler, priority) end,
addFailureListener = function(self, handler, priority) end,
addStartListener = function(self, handler, priority) end,
addSuccessListener = function(self, handler, priority) end,
canBeAccepted = function(self) end,
decline = function(self) end,
fail = function(self) end,
getId = function(self) end,
getPlayer = function(self) end,
getState = function(self) end,
setPlayer = function(self, thing) end,
start = function(self) end,
success = function(self) end,
}
object.accept
mark the mission as accepted. setPlayer
needs to have been called beforehand.
- Usage
object:accept()
object.addAcceptListener
Event listener if this mission is accepted
- Usage
object:addAcceptListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addDeclineListener
Event listener if this mission is declined
- Usage
object:addDeclineListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addEndListener
Event listener if this mission end
- Usage
object:addEndListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addFailureListener
Event listener if this mission fails
- Usage
object:addFailureListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addStartListener
Event listener if this mission is started
- Usage
object:addStartListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.addSuccessListener
Event listener if this mission is successful
- Usage
object:addSuccessListener(handler, priority)
- handler
-
function
getsself
and themission
as arguments - priority
-
number
object.canBeAccepted
checks if the mission can be accepted
- Usage
object:canBeAccepted()
object.decline
mark the mission as declined
- Usage
object:decline()
object.fail
mark the mission as failed
- Usage
object:fail()
object.getId
This function is only for internal use. It might change at any time without further notice. |
The unique id of the mission
- Usage
local s = object:getId()
- returnValue
-
string
object.getPlayer
get the player that does the mission
- Usage
object:getPlayer()
object.getState
Get the state of the mission.
- Usage
local s = object:getState()
- returnValue
-
string
object.setPlayer
Set the player that does the mission
- Usage
object:setPlayer(thing)
- thing
-
PlayerSpaceship
object.start
mark the mission as started
- Usage
object:start()
object.success
mark the mission as successful
- Usage
object:success()
Missions.wayPoints
A mission to fly close to a sequence of wayPoints
- Usage
local m = Missions:wayPoints(wayPoints, config)
- wayPoints
-
table[table[number,
number]]|nil a table of coordinates that serve as wayPoints, e.g.{{0, 0}, {42000, -1000}}
- config
-
table
- minDistance
-
number
distance to a wayPoint to count as "visited" (default:1000
) - onWayPoint
-
function(mission)
- returnValue
-
Mission
Order
- Outline
{
_generic = function(self, config) end,
attack = function(self, enemy, config) end,
defend = function(self, arg1, arg2, config) end,
dock = function(self, station, config) end,
flyTo = function(self, x, y, config) end,
isOrder = function(self, order) end,
roaming = function(self, config) end,
use = function(self, wormhole, config) end,
}
Order._generic
This function is only for internal use. It might change at any time without further notice. |
- Usage
Order:_generic(config)
- config
-
table
- onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
Order.attack
order to attack an enemy
- Usage
local o = Order:attack(enemy, config)
- enemy
-
ShipTemplateBased
- config
-
table
- ignoreEnemies
-
boolean
(default:true
) - onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
Return Value
- Outline
{
getDelayAfter = function(self) end,
getEnemy = function(self) end,
getFleetExecutor = function() end,
getShipExecutor = function() end,
onAbort = function(self, reason, ship) end,
onCompletion = function(self, ship) end,
onExecution = function(self, ship) end,
}
object.getDelayAfter
This function is only for internal use. It might change at any time without further notice. |
get the delay until the next order is executed
- Usage
object:getDelayAfter()
object.getEnemy
get the enemy that is attacked
- Usage
local s = object:getEnemy()
- returnValue
-
ShipTemplateBased
object.getFleetExecutor
This function is only for internal use. It might change at any time without further notice. |
get the executor for a fleet
- Usage
object.getFleetExecutor()
object.getShipExecutor
This function is only for internal use. It might change at any time without further notice. |
get the executor for a ship
- Usage
object.getShipExecutor()
object.onAbort
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is aborted
- Usage
object:onAbort(reason, ship)
- reason
-
string
- ship
-
CpuShip|Fleet
object.onCompletion
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is completed
- Usage
object:onCompletion(ship)
- ship
-
CpuShip|Fleet
object.onExecution
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is started to being executed
- Usage
object:onExecution(ship)
- ship
-
CpuShip|Fleet
Order.defend
defend a location a ShipTemplateBased
or yourself
- Usage
local o = Order:defend(arg1, arg2, config)
- arg1
-
number|ShipTemplateBased
(optional) the x coordinate of the defense location or theShipTemplateBased
to defend. If not given the ship will defend itself. - arg2
-
number
(optional) the y coordinate of the defense location - config
-
table
(optional)- minDefendTime
-
number
(default: 60) the number of seconds to execute this order at least - minClearTime
-
number
(default: 10) the minimum number of seconds there should be no enemies in range - range
-
number
(default:30000
) how far to check for enemies - onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
Return Value
- Outline
{
getDelayAfter = function(self) end,
getFleetExecutor = function() end,
getShipExecutor = function() end,
onAbort = function(self, reason, ship) end,
onCompletion = function(self, ship) end,
onExecution = function(self, ship) end,
}
object.getDelayAfter
This function is only for internal use. It might change at any time without further notice. |
get the delay until the next order is executed
- Usage
object:getDelayAfter()
object.getFleetExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getFleetExecutor()
object.getShipExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getShipExecutor()
object.onAbort
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is aborted
- Usage
object:onAbort(reason, ship)
- reason
-
string
- ship
-
CpuShip|Fleet
object.onCompletion
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is completed
- Usage
object:onCompletion(ship)
- ship
-
CpuShip|Fleet
object.onExecution
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is started to being executed
- Usage
object:onExecution(ship)
- ship
-
CpuShip|Fleet
Order.dock
Order to dock at a station
- Usage
local o = Order:dock(station, config)
- station
-
SpaceStation
- config
-
table
- waitForRepair
-
boolean
(default:true
) if theCpuShip
orFleet
should wait until hull damage is repaired. It does not prevent the station from repairing the ship if it supports it. The ship will just not wait until it is fully repaired. - waitForMissileRestock
-
boolean
(default:true
) if theCpuShip
orFleet
should wait until missiles are restocked. It does not prevent the station from restocking the ship, but it will just not wait until it is fully restocked. - waitForShieldRecharge
-
boolean
(default:true
) if theCpuShip
orFleet
should wait until the shields are fully recharged. It does not prevent the station from recharging the ship, but it will just not wait until it is fully recharged. - onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
Return Value
- Outline
{
getDelayAfter = function(self) end,
getFleetExecutor = function() end,
getShipExecutor = function() end,
getStation = function(self) end,
onAbort = function(self, reason, ship) end,
onCompletion = function(self, ship) end,
onExecution = function(self, ship) end,
}
object.getDelayAfter
This function is only for internal use. It might change at any time without further notice. |
get the delay until the next order is executed
- Usage
object:getDelayAfter()
object.getFleetExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getFleetExecutor()
object.getShipExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getShipExecutor()
object.getStation
get the station to dock to
- Usage
local s = object:getStation()
- returnValue
-
SpaceStation
object.onAbort
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is aborted
- Usage
object:onAbort(reason, ship)
- reason
-
string
- ship
-
CpuShip|Fleet
object.onCompletion
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is completed
- Usage
object:onCompletion(ship)
- ship
-
CpuShip|Fleet
object.onExecution
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is started to being executed
- Usage
object:onExecution(ship)
- ship
-
CpuShip|Fleet
Order.flyTo
order to fly to a specific location
- Usage
local o = Order:flyTo(x, y, config)
- x
-
number
- y
-
number
- config
-
table
- minDistance
-
number
(default:500
) the order is considered completed when the ship is this far from the target location - ignoreEnemies
-
boolean
(default:false
) do not attack enemies on the way - onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
Return Value
- Outline
{
getDelayAfter = function(self) end,
getFleetExecutor = function() end,
getLocation = function(self) end,
getShipExecutor = function() end,
onAbort = function(self, reason, ship) end,
onCompletion = function(self, ship) end,
onExecution = function(self, ship) end,
}
object.getDelayAfter
This function is only for internal use. It might change at any time without further notice. |
get the delay until the next order is executed
- Usage
object:getDelayAfter()
object.getFleetExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getFleetExecutor()
object.getLocation
get the target location
- Usage
local r1, r2 = object:getLocation()
- returnValue
-
number,number
object.getShipExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getShipExecutor()
object.onAbort
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is aborted
- Usage
object:onAbort(reason, ship)
- reason
-
string
- ship
-
CpuShip|Fleet
object.onCompletion
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is completed
- Usage
object:onCompletion(ship)
- ship
-
CpuShip|Fleet
object.onExecution
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is started to being executed
- Usage
object:onExecution(ship)
- ship
-
CpuShip|Fleet
Order.isOrder
check whether the given thing is an OrderObject
- Usage
local b = Order:isOrder(order)
- order
-
any
- returnValue
-
boolean
Order.roaming
order to roam around
- Usage
local o = Order:roaming(config)
Return Value
- Outline
{
getDelayAfter = function(self) end,
getFleetExecutor = function() end,
getShipExecutor = function() end,
onAbort = function(self, reason, ship) end,
onCompletion = function(self, ship) end,
onExecution = function(self, ship) end,
}
object.getDelayAfter
This function is only for internal use. It might change at any time without further notice. |
get the delay until the next order is executed
- Usage
object:getDelayAfter()
object.getFleetExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getFleetExecutor()
object.getShipExecutor
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getShipExecutor()
object.onAbort
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is aborted
- Usage
object:onAbort(reason, ship)
- reason
-
string
- ship
-
CpuShip|Fleet
object.onCompletion
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is completed
- Usage
object:onCompletion(ship)
- ship
-
CpuShip|Fleet
object.onExecution
This function is only for internal use. It might change at any time without further notice. |
the callback when the order is started to being executed
- Usage
object:onExecution(ship)
- ship
-
CpuShip|Fleet
Order.use
order to use a wormhole
- Usage
local o = Order:use(wormhole, config)
- wormhole
-
WormHole
- config
-
table
- onExecution
-
function
the callback when the order is started to being executed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onCompletion
-
function
the callback when the order is completed. Gets theOrderObject
and theCpuShip
orFleet
that executed the order. - onAbort
-
function
the callback when the order is aborted. Gets theOrderObject
, astring
reason and theCpuShip
orFleet
that executed the order. - onBreakUp
-
function
the callback when the fleet is close enough to the wormhole that the formation is broken up. Gets theOrderObject
and theFleet
that executed the order. - delayAfter
-
number
how many seconds to wait before executing the next order
- returnValue
-
OrderObject
Person
- Outline
{
byName = function(self, name, nickName) end,
isPerson = function(self, thing) end,
}
Person.byName
create a new Person by name
- Usage
local p = Person:byName(name, nickName)
- name
-
string
- nickName
-
string|nil
Return Value
- Outline
{
getFormalName = function() end,
getNickName = function() end,
}
object.getFormalName
- Usage
object.getFormalName()
object.getNickName
- Usage
object.getNickName()
Person.isPerson
check if the given thing is a person
- Usage
local b = Person:isPerson(thing)
- thing
-
any
- returnValue
-
boolean
Player
- Outline
{
hasMenu = function(self, player) end,
hasMissionDisplay = function(self, player) end,
hasMissionTracker = function(self, player) end,
hasPowerPresets = function(self, player) end,
hasQuickDial = function(self, player) end,
hasStorage = function(self, player) end,
hasStorageDisplay = function(self, player) end,
hasUpgradeDisplay = function(self, player) end,
hasUpgradeTracker = function(self, player) end,
withMenu = function(self, player, config) end,
withMissionDisplay = function(self, player, config) end,
withMissionTracker = function(self, player) end,
withPowerPresets = function(self, player, config) end,
withQuickDial = function(self, player, config) end,
withStorage = function(self, player, config) end,
withStorageDisplay = function(self, player, config) end,
withUpgradeDisplay = function(self, player, config) end,
withUpgradeTracker = function(self, player) end,
}
Player.hasMenu
check if the thing has a menu
- Usage
local b = Player:hasMenu(player)
- player
-
any
- returnValue
-
boolean
Player.hasMissionDisplay
check if the player has a mission display
- Usage
local b = Player:hasMissionDisplay(player)
- player
-
any
- returnValue
-
boolean
Player.hasMissionTracker
check if the player has a MissionTracker
- Usage
local b = Player:hasMissionTracker(player)
- player
-
PlayerSpaceship
- returnValue
-
boolean
Player.hasPowerPresets
check if a player has power presets enabled
- Usage
local b = Player:hasPowerPresets(player)
- player
-
PlayerSpaceship
- returnValue
-
boolean
Player.hasQuickDial
check if the player has quick dials
- Usage
local b = Player:hasQuickDial(player)
- player
-
any
- returnValue
-
boolean
Player.hasStorage
check if the player has a storage
- Usage
Player:hasStorage(player)
- player
-
PlayerSpaceship
Player.hasStorageDisplay
check if the player has a storage display
- Usage
local b = Player:hasStorageDisplay(player)
- player
-
PlayerSpaceship
- returnValue
-
boolean
Player.hasUpgradeDisplay
check if the player has an upgrade display
- Usage
local b = Player:hasUpgradeDisplay(player)
- player
-
any
- returnValue
-
boolean
Player.hasUpgradeTracker
check if the player has an UpgradeTracker
- Usage
local b = Player:hasUpgradeTracker(player)
- player
-
PlayerSpaceship
- returnValue
-
boolean
Player.withMenu
Add menus to the player stations
- Usage
local p = Player:withMenu(player, config)
- player
-
PlayerSpaceship
- config
-
table
- backLabel
-
string
label to go back to the main menu - labelNext
-
string
label to go to the next page - labelPrevious
-
string
label to go to the previous page - itemsPerPage
-
number|table[string,number]
how many items to display at most per page
Return Value
- Outline
{
addEngineeringMenuItem = function(self, id, menuItem) end,
addHelmsMenuItem = function(self, id, menuItem) end,
addMenuItem = function(self, position, id, menuItem) end,
addRelayMenuItem = function(self, id, menuItem) end,
addScienceMenuItem = function(self, id, menuItem) end,
addWeaponsMenuItem = function(self, id, menuItem) end,
drawEngineeringMenu = function(self, menu) end,
drawHelmsMenu = function(self, menu) end,
drawMenu = function(self, position, menu) end,
drawRelayMenu = function(self, menu) end,
drawScienceMenu = function(self, menu) end,
drawWeaponsMenu = function(self, menu) end,
removeEngineeringMenuItem = function(self, id) end,
removeHelmsMenuItem = function(self, id) end,
removeMenuItem = function(self, position, id) end,
removeRelayMenuItem = function(self, id) end,
removeScienceMenuItem = function(self, id) end,
removeWeaponsMenuItem = function(self, id) end,
}
object.addEngineeringMenuItem
add a menu entry to the main menu
- Usage
local p = object:addEngineeringMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addHelmsMenuItem
add a menu entry to the main menu
- Usage
local p = object:addHelmsMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addMenuItem
add a menu entry to the main menu for that station
- Usage
local p = object:addMenuItem(position, id, menuItem)
- position
-
string
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addRelayMenuItem
add a menu entry to the main menu
- Usage
local p = object:addRelayMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addScienceMenuItem
add a menu entry to the main menu
- Usage
local p = object:addScienceMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addWeaponsMenuItem
add a menu entry to the main menu
- Usage
local p = object:addWeaponsMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.drawEngineeringMenu
draw menu for station
- Usage
local p = object:drawEngineeringMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawHelmsMenu
draw menu for station
- Usage
local p = object:drawHelmsMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawMenu
draw a menu for a station
- Usage
local p = object:drawMenu(position, menu)
- position
-
string
- menu
-
Menu
(optional) the menu to draw. If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawRelayMenu
draw menu for station
- Usage
local p = object:drawRelayMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawScienceMenu
draw menu for station
- Usage
local p = object:drawScienceMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawWeaponsMenu
draw menu for station
- Usage
local p = object:drawWeaponsMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.removeEngineeringMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeEngineeringMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeHelmsMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeHelmsMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeMenuItem
remove a menu entry from the main menu for that station
- Usage
local p = object:removeMenuItem(position, id)
- position
-
string
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeRelayMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeRelayMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeScienceMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeScienceMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeWeaponsMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeWeaponsMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
Player.withMissionDisplay
This function is deprecated and should not be used anymore. The integration will probably change, because I think having some kind of menu structure might be the better option |
add a mission display for the player to the relay station
- Usage
Player:withMissionDisplay(player, config)
- player
-
PlayerSpaceship
- config
-
table
- label
-
string
the label for the button - titleActiveMissions
-
string
the text displayed above active missions - noActiveMissions
-
string
the text to display if there are no missions
Player.withMissionTracker
tracks the active missions of the player
- Usage
local p = Player:withMissionTracker(player)
- player
-
PlayerSpaceship
Return Value
- Outline
{
addMission = function(self, mission) end,
getStartedMissions = function(self) end,
}
object.addMission
add a mission to the mission tracker
- Usage
local p = object:addMission(mission)
- mission
-
Mission
- returnValue
-
PlayerSpaceship
object.getStartedMissions
get all the started missions
- Usage
local t = object:getStartedMissions()
- returnValue
-
table[Mission]
Player.withPowerPresets
add power presets for the engineering station. This allows to quickly change between different configurations for power and coolant
- Usage
local p = Player:withPowerPresets(player, config)
- player
-
PlayerSpaceship
- config
-
table
- slots
-
number
(default:8
) - label
-
string
- labelLoad
-
string
- labelStore
-
string
- labelLoadItem
-
string
- labelStoreItem
-
string
- labelReset
-
string
- labelInfo
-
string
- infoText
-
string
- returnValue
-
PlayerSpaceship
Player.withQuickDial
add a quick dial panel to the relay station
- Usage
local p = Player:withQuickDial(player, config)
- player
-
PlayerSpaceship
- config
-
table
- label
-
string
the label for the menu item
Return Value
- Outline
{
addEngineeringMenuItem = function(self, id, menuItem) end,
addHelmsMenuItem = function(self, id, menuItem) end,
addMenuItem = function(self, position, id, menuItem) end,
addQuickDial = function(self, ShipTemplateBased|Fleet) end,
addRelayMenuItem = function(self, id, menuItem) end,
addScienceMenuItem = function(self, id, menuItem) end,
addWeaponsMenuItem = function(self, id, menuItem) end,
drawEngineeringMenu = function(self, menu) end,
drawHelmsMenu = function(self, menu) end,
drawMenu = function(self, position, menu) end,
drawRelayMenu = function(self, menu) end,
drawScienceMenu = function(self, menu) end,
drawWeaponsMenu = function(self, menu) end,
getQuickDials = function(self) end,
removeEngineeringMenuItem = function(self, id) end,
removeHelmsMenuItem = function(self, id) end,
removeMenuItem = function(self, position, id) end,
removeQuickDial = function(self, ShipTemplateBased|Fleet) end,
removeRelayMenuItem = function(self, id) end,
removeScienceMenuItem = function(self, id) end,
removeWeaponsMenuItem = function(self, id) end,
}
object.addEngineeringMenuItem
add a menu entry to the main menu
- Usage
local p = object:addEngineeringMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addHelmsMenuItem
add a menu entry to the main menu
- Usage
local p = object:addHelmsMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addMenuItem
add a menu entry to the main menu for that station
- Usage
local p = object:addMenuItem(position, id, menuItem)
- position
-
string
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addQuickDial
add a quick dial
- Usage
object:addQuickDial(ShipTemplateBased|Fleet)
- ShipTemplateBased|Fleet
-
any
object.addRelayMenuItem
add a menu entry to the main menu
- Usage
local p = object:addRelayMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addScienceMenuItem
add a menu entry to the main menu
- Usage
local p = object:addScienceMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.addWeaponsMenuItem
add a menu entry to the main menu
- Usage
local p = object:addWeaponsMenuItem(id, menuItem)
- id
-
string
- menuItem
-
MenuItem
- returnValue
-
PlayerSpaceship
object.drawEngineeringMenu
draw menu for station
- Usage
local p = object:drawEngineeringMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawHelmsMenu
draw menu for station
- Usage
local p = object:drawHelmsMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawMenu
draw a menu for a station
- Usage
local p = object:drawMenu(position, menu)
- position
-
string
- menu
-
Menu
(optional) the menu to draw. If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawRelayMenu
draw menu for station
- Usage
local p = object:drawRelayMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawScienceMenu
draw menu for station
- Usage
local p = object:drawScienceMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.drawWeaponsMenu
draw menu for station
- Usage
local p = object:drawWeaponsMenu(menu)
- menu
-
Menu
(optional) If not given draws the main menu - returnValue
-
PlayerSpaceship
object.getQuickDials
get quick dials
- Usage
local t = object:getQuickDials()
- returnValue
-
table[ShipTemplateBased|Fleet]
object.removeEngineeringMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeEngineeringMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeHelmsMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeHelmsMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeMenuItem
remove a menu entry from the main menu for that station
- Usage
local p = object:removeMenuItem(position, id)
- position
-
string
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeQuickDial
remove a quick dial
- Usage
object:removeQuickDial(ShipTemplateBased|Fleet)
- ShipTemplateBased|Fleet
-
any
object.removeRelayMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeRelayMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeScienceMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeScienceMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
object.removeWeaponsMenuItem
remove a menu entry from the main menu
- Usage
local p = object:removeWeaponsMenuItem(id)
- id
-
string
- returnValue
-
PlayerSpaceship
Player.withStorage
configure storage for a player
- Usage
local p = Player:withStorage(player, config)
- player
-
PlayerSpaceship
- config
-
table
Return Value
- Outline
{
getEmptyProductStorage = function(self, product) end,
getEmptyStorageSpace = function(self) end,
getMaxProductStorage = function(self, product) end,
getMaxStorageSpace = function(self) end,
getProductStorage = function(self, product) end,
getStorageSpace = function(self) end,
getStoredProducts = function(self) end,
modifyProductStorage = function(self, product, amount) end,
setMaxStorageSpace = function(self, number) end,
}
object.getEmptyProductStorage
get the free space to store a product
- Usage
local n = object:getEmptyProductStorage(product)
- product
-
Product
- returnValue
-
number
object.getEmptyStorageSpace
get the total empty storage space
- Usage
local n = object:getEmptyStorageSpace()
- returnValue
-
number
object.getMaxProductStorage
get the maximum amount the player can store
- Usage
local n = object:getMaxProductStorage(product)
- product
-
Product
- returnValue
-
number
object.getMaxStorageSpace
get the maximum storage space
- Usage
local n = object:getMaxStorageSpace()
- returnValue
-
number
object.getProductStorage
get the storage level of a given product
- Usage
local n = object:getProductStorage(product)
- product
-
Product
- returnValue
-
number
object.getStorageSpace
get the used storage space
- Usage
local n = object:getStorageSpace()
- returnValue
-
number
object.getStoredProducts
get a list of all products currently stored
- Usage
local r1, r2 = object:getStoredProducts()
- returnValue
-
table[Product,number]
object.modifyProductStorage
change the amount of stored product
- Usage
local p = object:modifyProductStorage(product, amount)
- product
-
Product
- amount
-
number
positive or negative number to add or remove - returnValue
-
PlayerSpaceship
object.setMaxStorageSpace
set the maximum storage space
- Usage
local p = object:setMaxStorageSpace(number)
- number
-
number
- returnValue
-
PlayerSpaceship
Player.withStorageDisplay
This function is deprecated and should not be used anymore. The integration will probably change, because I think having some kind of menu structure might be the better option |
add a storage display for the engineering station
- Usage
local p = Player:withStorageDisplay(player, config)
- player
-
PlayerSpaceship
- config
-
table
- label
-
string
the label for the menu item - title
-
string
the title displayed above the listing - labelUsedStorage
-
string
the label to indicate used storage - emptyStorage
-
string
the text to display if the storage is empty
- returnValue
-
PlayerSpaceship
Player.withUpgradeDisplay
This function is deprecated and should not be used anymore. The integration will probably change, because I think having some kind of menu structure might be the better option |
add a upgrade display for the engineering station
- Usage
local p = Player:withUpgradeDisplay(player, config)
- player
-
PlayerSpaceship
- config
-
table
- label
-
string
the label for the menu item - title
-
string
the title to display atop the listing - noUpgrades
-
string
the text to display if the ship got no upgrades
- returnValue
-
PlayerSpaceship
Player.withUpgradeTracker
add an upgrade tracker to the ship
- Usage
local p = Player:withUpgradeTracker(player)
- player
-
PlayerSpaceship
Return Value
- Outline
{
addUpgrade = function(self, upgrade) end,
getUpgrades = function(self) end,
hasUpgrade = function(self, upgrade) end,
}
object.addUpgrade
add an upgrade to the tracker
- Usage
local p = object:addUpgrade(upgrade)
- upgrade
-
Upgrade
- returnValue
-
PlayerSpaceship
object.getUpgrades
get all installed upgrades
- Usage
local t = object:getUpgrades()
- returnValue
-
table[Upgrade]
object.hasUpgrade
check if the player have an upgrade installed
- Usage
local b = object:hasUpgrade(upgrade)
- upgrade
-
Upgrade|string
- returnValue
-
boolean
Product
- Outline
{
isProduct = function(self, thing) end,
new = function(self, name, config) end,
toId = function(self, product) end,
}
Product.isProduct
check if the given thing is a product
- Usage
local b = Product:isProduct(thing)
- thing
-
any
- returnValue
-
boolean
Product.new
create a new Product
- Usage
local p = Product:new(name, config)
- name
-
string
- config
-
table
- id
-
string|nil
- size
-
number
(default:1
)
Return Value
- Outline
{
getId = function(self) end,
getName = function(self) end,
getSize = function(self) end,
}
object.getId
get the id of the product
- Usage
local s = object:getId()
- returnValue
-
string
object.getName
get the name of the product
- Usage
local s = object:getName()
- returnValue
-
string
object.getSize
get the size of this product
- Usage
local n = object:getSize()
- returnValue
-
number
Product.toId
This function is only for internal use. It might change at any time without further notice. |
accepts string or product and returns the id
- Usage
local s = Product:toId(product)
- product
-
Product
- returnValue
-
string
Ship
- Outline
{
behaveAsBuyer = function(self, ship, homeStation, product, config) end,
behaveAsMiner = function(self, ship, homeStation, whenMined, config) end,
hasCrew = function(self, ship) end,
hasFleet = function(self, ship) end,
hasOrderQueue = function(self, ship) end,
withCaptain = function(self, ship, person) end,
withCrew = function(self, ship, positions) end,
withEngineeringOfficer = function(self, ship, person) end,
withEvents = function(self, ship, config) end,
withFleet = function(self, ship, fleet) end,
withHelmsOfficer = function(self, ship, person) end,
withOrderQueue = function(self, object) end,
withRelayOfficer = function(self, ship, person) end,
withScienceOfficer = function(self, ship, person) end,
withWeaponsOfficer = function(self, ship, person) end,
}
Ship.behaveAsBuyer
let a ship act as a buyer of products for a station
- Usage
Ship:behaveAsBuyer(ship, homeStation, product, config)
- ship
-
CpuShip
- homeStation
-
SpaceStation
- product
-
Product
- config
-
table
- maxDistanceFromHome
-
number
(default:30000
)
Ship.behaveAsMiner
let a ship mine near asteroids and deliver to their home station
- Usage
Ship:behaveAsMiner(ship, homeStation, whenMined, config)
- ship
-
CpuShip
- homeStation
-
SpaceStation
- whenMined
-
function
getsasteroid
,miner
andhomeStation
as arguments. Should return atable
where aProduct
is key and the value is anumber
. - config
-
table
- timeToUnload
-
number
(default:15
) seconds it takes the miner to unload goods at home station - timeToMine
-
number
(default:15
) seconds it takes the miner to mine an asteroid - timeToGoHome
-
number
(default:900
) seconds the miner tries to mine asteroids before giving up and returning home disappointed - mineDistance
-
number
(default:beamWeaponRange
) units how close the miner needs to be to the asteroid - maxDistanceFromHome
-
number
(default:30000
) units how far away from home the miner looks for asteroids - maxDistanceToNext
-
number
(default:15000
) units how far from the current asteroid the miner will look for a next one - onHeadingAsteroid
-
function
getsminer
andasteroid
when the miner is flying towards an asteroid - onAsteroidMined
-
function
getsminer
,asteroid
and the return ofwhenMined
- onHeadingHome
-
function
getsminer
,asteroid
and all the gathered products - onUnloaded
-
function
getsminer
,asteroid
and all the gathered products
Ship.hasCrew
check if the given thing is a CpuShip
with crew
- Usage
local b = Ship:hasCrew(ship)
- ship
-
any
- returnValue
-
boolean
Ship.hasFleet
check if a ship is part of a fleet
- Usage
local b = Ship:hasFleet(ship)
- ship
-
any
- returnValue
-
boolean
Ship.hasOrderQueue
check if the given thing is a ship with order queue
- Usage
local b = Ship:hasOrderQueue(ship)
- ship
-
any
- returnValue
-
boolean
Ship.withCaptain
set a captain for the ship
- Usage
local c = Ship:withCaptain(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
Ship.withCrew
allow ships to have named crews
- Usage
local c = Ship:withCrew(ship, positions)
- ship
-
CpuShip
- positions
-
table[string,Person]
- returnValue
-
CpuShip
Ship.withEngineeringOfficer
set an engineer officer for the ship
- Usage
local c = Ship:withEngineeringOfficer(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
Ship.withEvents
This function is deprecated and should not be used anymore. I am not sure if i will leave it in or remove it |
add event listeners to the ship
- Usage
local c = Ship:withEvents(ship, config)
- ship
-
CpuShip
- config
-
table
- onDocking
-
function
when a ship docked at a station. getsship
andstation
as arguments. - onUndocking
-
function
when a ship is undocking a station. getsship
andstation
as arguments. - onDockInitiation
-
function
when a ship heading to a station intending to dock. getsship
andstation
as arguments. - onDestruction
-
nil|function
getsship
as argument. - onEnemyDetection
-
nil|function
getsship
as argument. - onEnemyClear
-
nil|function
getsship
as argument. - onBeingAttacked
-
nil|function
getsship
as argument.
- returnValue
-
CpuShip
Ship.withFleet
This function is only for internal use. It might change at any time without further notice. |
mark that a ship is part of a fleet
- Usage
local c = Ship:withFleet(ship, fleet)
- ship
-
CpuShip
- fleet
-
Fleet
Return Value
- Outline
{
getFleet = function(self) end,
getFleetLeader = function(self) end,
isFleetLeader = function(self) end,
}
object.getFleet
get the fleet this ship is belonging to
- Usage
local f = object:getFleet()
- returnValue
-
Fleet
object.getFleetLeader
get the fleet leader of the ships fleet
- Usage
local c = object:getFleetLeader()
- returnValue
-
CpuShip|nil
object.isFleetLeader
check if the current ship is leader of a fleet
- Usage
local b = object:isFleetLeader()
- returnValue
-
boolean
Ship.withHelmsOfficer
set a helms officer for the ship
- Usage
local c = Ship:withHelmsOfficer(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
Ship.withOrderQueue
- Usage
Ship:withOrderQueue(object)
Return Value
- Outline
{
abortCurrentOrder = function(self) end,
addOrder = function(self, order) end,
flushOrders = function(self) end,
forceOrderNow = function(self, order) end,
}
object.abortCurrentOrder
abort the current order
- Usage
local s = object:abortCurrentOrder()
- returnValue
-
self
object.addOrder
add an order that is executed after all other orders
- Usage
local s = object:addOrder(order)
- order
-
Order
- returnValue
-
self
object.flushOrders
remove all orders that would be executed after the current one
- Usage
local s = object:flushOrders()
- returnValue
-
self
object.forceOrderNow
abort all orders and start executing the given order
- Usage
local s = object:forceOrderNow(order)
- order
-
Order
- returnValue
-
self
Ship.withRelayOfficer
set a relay officer for the ship
- Usage
local c = Ship:withRelayOfficer(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
Ship.withScienceOfficer
set a science officer for the ship
- Usage
local c = Ship:withScienceOfficer(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
Ship.withWeaponsOfficer
set a weapons officer for the ship
- Usage
local c = Ship:withWeaponsOfficer(ship, person)
- ship
-
CpuShip
- person
-
Person
- returnValue
-
CpuShip
ShipTemplateBased
- Outline
{
hasComms = function(self, thing) end,
hasCrew = function(self, ship) end,
hasMissionBroker = function(self, thing) end,
hasStorage = function(self, station) end,
hasUpgradeBroker = function(self, thing) end,
withComms = function(self, spaceObject, config) end,
withCrew = function(self, ship, positions) end,
withEvents = function(self, shipTemplateBased, config) end,
withMissionBroker = function(self, spaceObject, config) end,
withStorageRooms = function(self, spaceObject, storages) end,
withUpgradeBroker = function(self, spaceObject, config) end,
}
ShipTemplateBased.hasComms
check if the given thing has comms
- Usage
local b = ShipTemplateBased:hasComms(thing)
- thing
-
any
- returnValue
-
boolean
ShipTemplateBased.hasCrew
check if the thing has a crew
- Usage
local b = ShipTemplateBased:hasCrew(ship)
- ship
-
any
- returnValue
-
boolean
ShipTemplateBased.hasMissionBroker
check if the given thing has a mission broker
- Usage
local b = ShipTemplateBased:hasMissionBroker(thing)
- thing
-
any
- returnValue
-
boolean
ShipTemplateBased.hasStorage
checks if the given object does have a storage
- Usage
local b = ShipTemplateBased:hasStorage(station)
- station
-
any
- returnValue
-
boolean
ShipTemplateBased.hasUpgradeBroker
check if the thing has an upgrade broker
- Usage
local b = ShipTemplateBased:hasUpgradeBroker(thing)
- thing
-
any
- returnValue
-
boolean
ShipTemplateBased.withComms
add an improved api to set comms
- Usage
local s = ShipTemplateBased:withComms(spaceObject, config)
- spaceObject
-
ShipTemplateBased
- config
-
table
- hailText
-
string|function
- comms
-
table[CommsReply]
Return Value
- Outline
{
addComms = function(self, reply, id) end,
getComms = function(self, player) end,
overrideComms = function(self, screen, once) end,
removeComms = function(self, id) end,
setHailText = function(self, hailText) end,
}
object.addComms
add a comms item
- Usage
local s = object:addComms(reply, id)
- reply
-
CommsReply
- id
-
string
(optional) - returnValue
-
string
the id of this item
object.getComms
This function is only for internal use. It might change at any time without further notice. |
get the comms screen to display
- Usage
local c = object:getComms(player)
- player
-
PlayerSpaceship
- returnValue
-
CommsScreen
object.overrideComms
This function is only for internal use. It might change at any time without further notice. |
temporarily override comms
- Usage
local s = object:overrideComms(screen, once)
- screen
-
CommsScreen
- once
-
boolean
(default:false
) - returnValue
-
ShipTemplateBased
object.removeComms
remove a comms item
- Usage
local s = object:removeComms(id)
- id
-
string
- returnValue
-
ShipTemplateBased
object.setHailText
set the hail text
- Usage
local s = object:setHailText(hailText)
- hailText
-
nil|string|function
- returnValue
-
ShipTemplatBased
ShipTemplateBased.withCrew
add a crew to the ShipTemplateBased
- Usage
local s = ShipTemplateBased:withCrew(ship, positions)
- ship
-
ShipTemplateBased
- positions
-
nil|table[string,Person]
Return Value
- Outline
{
getCrewAtPosition = function(self, position) end,
hasCrewAtPosition = function(self, position) end,
}
object.getCrewAtPosition
get the person at the position
- Usage
local p = object:getCrewAtPosition(position)
- position
-
string
- returnValue
-
Person|nil
object.hasCrewAtPosition
check if the ship or station has a person at the position with name
- Usage
local b = object:hasCrewAtPosition(position)
- position
-
string
- returnValue
-
boolean
ShipTemplateBased.withEvents
This function is deprecated and should not be used anymore. I am not sure if i will leave it in or remove it |
listen for events on the ShipTemplateBased
- Usage
local s = ShipTemplateBased:withEvents(shipTemplateBased, config)
- shipTemplateBased
-
ShipTemplateBased
- config
-
table
- onDestruction
-
nil|function
getsshipTemplateBased
as argument. - onEnemyDetection
-
nil|function
getsshipTemplateBased
as argument. - onEnemyClear
-
nil|function
getsshipTemplateBased
as argument. - onBeingAttacked
-
nil|function
getsshipTemplateBased
as argument.
- returnValue
-
ShipTemplateBased
ShipTemplateBased.withMissionBroker
let them have a mission broker
- Usage
local s = ShipTemplateBased:withMissionBroker(spaceObject, config)
- spaceObject
-
ShipTemplateBased
- config
-
table
- missions
-
table[Mission]
Return Value
- Outline
{
addMission = function(self, mission) end,
getMissions = function(self) end,
hasMissions = function(self) end,
removeMission = function(self, mission) end,
}
object.addMission
add a mission to the broker
- Usage
local s = object:addMission(mission)
- mission
-
Mission
- returnValue
-
ShipTemplateBased
object.getMissions
get all missions
- Usage
local t = object:getMissions()
- returnValue
-
table[Mission]
object.hasMissions
check if the broker has any mision to offer
- Usage
local b = object:hasMissions()
- returnValue
-
boolean
object.removeMission
remove a mission
- Usage
local s = object:removeMission(mission)
- mission
-
string|Mission
- returnValue
-
ShipTemplateBased
ShipTemplateBased.withStorageRooms
Add a storage.
This is a storage system where one room exists for each product stored. So storing one product does not take space away from another storage space.
- Usage
local s = ShipTemplateBased:withStorageRooms(spaceObject, storages)
- spaceObject
-
ShipTemplateBased
- storages
-
table[Product,number]
configure the storage space for each product
Return Value
- Outline
{
canStoreProduct = function(self, product) end,
getEmptyProductStorage = function(self, product) end,
getMaxProductStorage = function(self, product) end,
getProductStorage = function(self, product) end,
modifyProductStorage = function(self, product, amount) end,
}
object.canStoreProduct
returns true if the given product can be stored
- Usage
local b = object:canStoreProduct(product)
- product
-
Product
- returnValue
-
boolean
object.getEmptyProductStorage
get the empty storage level of the product
- Usage
local n = object:getEmptyProductStorage(product)
- product
-
Product
the product to get the empty storage level of - returnValue
-
number|nil
the empty storage level of the product ornil
if the product can not be stored
object.getMaxProductStorage
get the maximum storage level of the product
- Usage
local n = object:getMaxProductStorage(product)
- product
-
Product
the product to get the maximum storage level of - returnValue
-
number|nil
the maximum storage level of the product ornil
if the product can not be stored
object.getProductStorage
get the storage level of the product
- Usage
local n = object:getProductStorage(product)
- product
-
Product
the product to get the storage level of - returnValue
-
number|nil
the storage level of the product ornil
if the product can not be stored
object.modifyProductStorage
modify the storage levels of a product it will fail silently if the product can not be stored and will create products out of thin vacuum or discard products when storage is full.
- Usage
local s = object:modifyProductStorage(product, amount)
- product
-
Product
the product to change the storage level of - amount
-
number
positive number to add to the storage, negative number to remove - returnValue
-
ShipTemplateBased
ShipTemplateBased.withUpgradeBroker
add an upgrade broker to the ShipTemplateBased
- Usage
local s = ShipTemplateBased:withUpgradeBroker(spaceObject, config)
- spaceObject
-
ShipTemplateBased
- config
-
table
- upgrades
-
table[Upgrade]
(optional)
Return Value
- Outline
{
addUpgrade = function(self, upgrade) end,
getUpgrades = function(self) end,
hasUpgrade = function(self, string|Upgrade) end,
hasUpgrades = function(self) end,
removeUpgrade = function(self, upgrade) end,
}
object.addUpgrade
add an upgrade
- Usage
local s = object:addUpgrade(upgrade)
- upgrade
-
Upgrade
- returnValue
-
ShipTemplateBased
object.getUpgrades
get all upgrade currently offered
- Usage
local t = object:getUpgrades()
- returnValue
-
table[Upgrade]
object.hasUpgrade
check if the broker has a specific upgrade to offer
- Usage
local b = object:hasUpgrade(string|Upgrade)
- returnValue
-
boolean
object.hasUpgrades
check if the broker has any upgrades to offer
- Usage
local b = object:hasUpgrades()
- returnValue
-
boolean
object.removeUpgrade
remove an upgrade
- Usage
local s = object:removeUpgrade(upgrade)
- upgrade
-
string|Upgrade
- returnValue
-
ShipTemplateBased
Station
- Outline
{
hasMerchant = function(self, station) end,
hasProduction = function(self, station) end,
withMerchant = function(self, station, configuration) end,
withProduction = function(self, station, configuration) end,
}
Station.hasMerchant
checks if the given object has a merchant that buys or sells stuff
- Usage
local b = Station:hasMerchant(station)
- station
-
any
- returnValue
-
boolean
Station.hasProduction
checks if the given object has a production configured
- Usage
local b = Station:hasProduction(station)
- station
-
any
- returnValue
-
boolean
Station.withMerchant
enhances a station with the possibility to buy and sell products
- Usage
local s = Station:withMerchant(station, configuration)
- station
-
SpaceStation
- configuration
-
table[Product,table]
- buyingPrice
-
number|function|nil
- sellingPrice
-
number|function|nil
Return Value
- Outline
{
canStoreProduct = function(self, product) end,
getEmptyProductStorage = function(self, product) end,
getMaxProductBuying = function(self, product, seller) end,
getMaxProductSelling = function(self, product, buyer) end,
getMaxProductStorage = function(self, product) end,
getProductBuyingPrice = function(self, product, seller) end,
getProductSellingPrice = function(self, product, buyer) end,
getProductStorage = function(self, product) end,
getProductsBought = function(self, seller) end,
getProductsSold = function(self, buyer) end,
isBuyingProduct = function(self, product, seller) end,
isSellingProduct = function(self, product, buyer) end,
modifyProductStorage = function(self, product, amount) end,
}
object.canStoreProduct
returns true if the given product can be stored
- Usage
local b = object:canStoreProduct(product)
- product
-
Product
- returnValue
-
boolean
object.getEmptyProductStorage
get the empty storage level of the product
- Usage
local n = object:getEmptyProductStorage(product)
- product
-
Product
the product to get the empty storage level of - returnValue
-
number|nil
the empty storage level of the product ornil
if the product can not be stored
object.getMaxProductBuying
get the maximum number of units the station would buy
- Usage
local n = object:getMaxProductBuying(product, seller)
- product
-
Product
- seller
-
SpaceShip
- returnValue
-
number|nil
object.getMaxProductSelling
get the maximum number of units the station would sell
- Usage
local n = object:getMaxProductSelling(product, buyer)
- product
-
Product
- buyer
-
SpaceShip
- returnValue
-
number|nil
object.getMaxProductStorage
get the maximum storage level of the product
- Usage
local n = object:getMaxProductStorage(product)
- product
-
Product
the product to get the maximum storage level of - returnValue
-
number|nil
the maximum storage level of the product ornil
if the product can not be stored
object.getProductBuyingPrice
get the price the station is buying this product at
- Usage
local n = object:getProductBuyingPrice(product, seller)
- product
-
Product
- seller
-
SpaceShip
- returnValue
-
nil|number
object.getProductSellingPrice
get the price the station is selling this product at
- Usage
local n = object:getProductSellingPrice(product, buyer)
- product
-
Product
- buyer
-
SpaceShip
- returnValue
-
nil|number
object.getProductStorage
get the storage level of the product
- Usage
local n = object:getProductStorage(product)
- product
-
Product
the product to get the storage level of - returnValue
-
number|nil
the storage level of the product ornil
if the product can not be stored
object.getProductsBought
get a list of all products the station is buying
- Usage
local t = object:getProductsBought(seller)
- seller
-
SpaceShip
- returnValue
-
table[Product]
object.getProductsSold
get a list of all products the station is selling
- Usage
local t = object:getProductsSold(buyer)
- buyer
-
SpaceShip
- returnValue
-
table[Product]
object.isBuyingProduct
check if the station is buying the product
- Usage
local b = object:isBuyingProduct(product, seller)
- product
-
Product
- seller
-
SpaceShip
- returnValue
-
boolean
object.isSellingProduct
check if the station is selling the product
- Usage
local b = object:isSellingProduct(product, buyer)
- product
-
Product
- buyer
-
SpaceShip
- returnValue
-
boolean
object.modifyProductStorage
modify the storage levels of a product it will fail silently if the product can not be stored and will create products out of thin vacuum or discard products when storage is full.
- Usage
local s = object:modifyProductStorage(product, amount)
- product
-
Product
the product to change the storage level of - amount
-
number
positive number to add to the storage, negative number to remove - returnValue
-
ShipTemplateBased
Station.withProduction
a station that produces or consumes products
- Usage
local s = Station:withProduction(station, configuration)
- station
-
SpaceStation
- configuration
-
table
Return Value
- Outline
{
canStoreProduct = function(self, product) end,
getConsumedProducts = function(self) end,
getEmptyProductStorage = function(self, product) end,
getMaxProductStorage = function(self, product) end,
getProducedProducts = function(self) end,
getProductStorage = function(self, product) end,
modifyProductStorage = function(self, product, amount) end,
}
object.canStoreProduct
returns true if the given product can be stored
- Usage
local b = object:canStoreProduct(product)
- product
-
Product
- returnValue
-
boolean
object.getConsumedProducts
get all the products the station consumes
- Usage
local t = object:getConsumedProducts()
- returnValue
-
table[Product]
object.getEmptyProductStorage
get the empty storage level of the product
- Usage
local n = object:getEmptyProductStorage(product)
- product
-
Product
the product to get the empty storage level of - returnValue
-
number|nil
the empty storage level of the product ornil
if the product can not be stored
object.getMaxProductStorage
get the maximum storage level of the product
- Usage
local n = object:getMaxProductStorage(product)
- product
-
Product
the product to get the maximum storage level of - returnValue
-
number|nil
the maximum storage level of the product ornil
if the product can not be stored
object.getProducedProducts
get all the products the station produces
- Usage
local t = object:getProducedProducts()
- returnValue
-
table[Product]
object.getProductStorage
get the storage level of the product
- Usage
local n = object:getProductStorage(product)
- product
-
Product
the product to get the storage level of - returnValue
-
number|nil
the storage level of the product ornil
if the product can not be stored
object.modifyProductStorage
modify the storage levels of a product it will fail silently if the product can not be stored and will create products out of thin vacuum or discard products when storage is full.
- Usage
local s = object:modifyProductStorage(product, amount)
- product
-
Product
the product to change the storage level of - amount
-
number
positive number to add to the storage, negative number to remove - returnValue
-
ShipTemplateBased
Tools
- Outline
{
endStoryComms = function(self) end,
ensureComms = function(self, shipTemplateBased, player, message) end,
storyComms = function(self, shipTemplateBased, player, screen) end,
}
Tools.endStoryComms
End the story comms
- Usage
Tools:endStoryComms()
Tools.ensureComms
makes sure the player is able to at least once accept a communication
- Usage
Tools:ensureComms(shipTemplateBased, player, message)
- shipTemplateBased
-
ShipTemplateBased
- player
-
PlayerSpaceship
- message
-
nil|string
ifnil
it will offer a comms to the given target. Else it will just send the message.
Tools.storyComms
Force the players to accept a comms and follow the dialog. It also (initially) forces the comms screen to be displayed on the main screen so every crew member can read it.
This is helpful to ensure that a plot relevant chat is seen by the players.
- Usage
Tools:storyComms(shipTemplateBased, player, screen)
- shipTemplateBased
-
ShipTemplateBased
- player
-
PlayerSpaceship
- screen
-
CommsScreenObject
Translator
- Outline
{
inspect = function(self, translator) end,
isTranslator = function(self, thing) end,
new = function(self, defaultLocale) end,
printInspection = function(self, translator) end,
}
Translator.inspect
This function is only for internal use. It might change at any time without further notice. |
inspects for missing or excessive translations
- Usage
Translator:inspect(translator)
- translator
-
Translator
Translator.isTranslator
check if the given thing is a translator
- Usage
local b = Translator:isTranslator(thing)
- thing
-
any
- returnValue
-
boolean
Translator.new
create a new Translator
- Usage
local t = Translator:new(defaultLocale)
- defaultLocale
-
string
(default:en
)
Return Value
- Outline
{
getDefaultLocale = function() end,
getDictionaries = function() end,
getLocales = function() end,
register = function(self, locale, key, label) end,
translate = function(key, ...) end,
useLocale = function(self, ...) end,
}
object.getDefaultLocale
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getDefaultLocale()
object.getDictionaries
This function is only for internal use. It might change at any time without further notice. |
- Usage
object.getDictionaries()
object.getLocales
- Usage
object.getLocales()
object.register
register one or more translations
- Usage
local s = object:register(locale, key, label)
- locale
-
string
(optional) - key
-
string|table
could be the name of the key or a table with keys and translations - label
-
string|function
(optional) when key is a string this is the translation - returnValue
-
string
object.translate
translate a message
- Usage
local s = object.translate(key, ...)
- key
-
string
- ... (multiple)
-
any
whatever arguments the translation needs - returnValue
-
string
it will always return a string except when the translation key exists in no language
object.useLocale
change the current locale used for translation
- Usage
local t = object:useLocale(...)
- ... (multiple)
-
string
- returnValue
-
Translator
Translator.printInspection
This function is only for internal use. It might change at any time without further notice. |
prints the inspection for missing or excessive translations
- Usage
Translator:printInspection(translator)
- translator
-
Translator
Util
- Outline
{
addVector = function(x, y, angle, length) end,
angleDiff = function(angle1, angle2) end,
angleFromVector = function(dx, dy) end,
appendTables = function(...) end,
deepCopy = function(orig) end,
distanceToLineSegment = function(startX, startY, endX, endY, x, y) end,
heading = function(a, b, c, d) end,
isNumericTable = function(table) end,
keys = function(input) end,
map = function(table, mappingFunc) end,
mergeTables = function(...) end,
mkString = function(table, separator, lastSeparator) end,
onVector = function(x1, y1, x2, y2, ratio) end,
random = function(table, filterFunc) end,
randomSort = function(input) end,
randomUuid = function() end,
round = function(number, base) end,
sectorName = function(x, y) end,
size = function(table) end,
spawnAtStation = function(station, obj, distance) end,
totalLaserDps = function(ship) end,
totalShieldLevel = function(ship) end,
vectorFromAngle = function(angle, length) end,
}
Util.addVector
add a vector with the given direction an length to the point
- Usage
local r1, r2 = Util.addVector(x, y, angle, length)
- x
-
number
- y
-
number
- angle
-
number
- length
-
number
- returnValue
-
number,number
Util.angleDiff
calculates the difference between to angles - which ever direction is shorter
- Usage
local n = Util.angleDiff(angle1, angle2)
- angle1
-
number
- angle2
-
number
- returnValue
-
number
a number between 0 and 180
Util.angleFromVector
calculates the angle of a given vector
- Usage
local n = Util.angleFromVector(dx, dy)
- dx
-
number
- dy
-
number
- returnValue
-
number
Util.appendTables
merges multiple tables together where all items of following tables are appended to the first one
- Usage
local t = Util.appendTables(...)
- ... (multiple)
-
table
- returnValue
-
table
Util.deepCopy
returns a copy of a table
- Usage
local t = Util.deepCopy(orig)
- orig
-
table
- returnValue
-
table
Util.distanceToLineSegment
calculate the minimum distance of a point to a line segment
You can either give two arguments for x and y coordinates or one for a SpaceObject
- Usage
local n = Util.distanceToLineSegment(startX, startY, endX, endY, x, y)
- startX
-
number|SpaceObject
x-coordinate of line start - startY
-
number|SpaceObject
y-coordinate of line start - endX
-
number|SpaceObject
x-coordinate of line end - endY
-
number|SpaceObject|nil
y-coordinate of line end - x
-
number|SpaceObject|nil
x-coordinate of point - y
-
number|nil
y-coordinate of point - returnValue
-
number
Util.heading
returns the heading in the coordinate system used for the science station
- Usage
local n = Util.heading(a, b, c, d)
- a
-
SpaceShip|integer
- b
-
SpaceShip|integer
- c
-
SpaceShip|integer|nil
- d
-
integer|nil
- returnValue
-
number
Util.isNumericTable
returns true if the table only contains numberical keys
- Usage
local b = Util.isNumericTable(table)
- table
-
table
- returnValue
-
boolean
Util.keys
returns the keys of a table in an arbitrary order
- Usage
local t = Util.keys(input)
- input
-
table
- returnValue
-
table
Util.map
map all values of a table by a mapping function
- Usage
local t = Util.map(table, mappingFunc)
- table
-
table
- mappingFunc
-
function
the faction gets an entry from the table. Should return the new value. - returnValue
-
table
Util.mergeTables
merges multiple tables together where later tables take precedence
- Usage
local t = Util.mergeTables(...)
- ... (multiple)
-
table
- returnValue
-
table
Util.mkString
create a string from a table by concatenating
- Usage
Util.mkString(table, separator, lastSeparator)
- table
-
table[string]
- separator
-
string
- lastSeparator
-
string
the seperator between the last and the second to last item are seperated
Util.onVector
selects a point on a vector
- Usage
local r1, r2 = Util.onVector(x1, y1, x2, y2, ratio)
- x1
-
number
- y1
-
number
- x2
-
number
- y2
-
number
- ratio
-
number
if ratio is0
it will returnx1,y1
, if ratio is1
it will returnx2,y2
- returnValue
-
number,number
Util.random
selects a random item from a table
- Usage
local a = Util.random(table, filterFunc)
- table
-
table
- filterFunc
-
function
an optional filter function for items to consider - returnValue
-
any|nil
Util.randomSort
randomly sort a table and return a copy
- Usage
local t = Util.randomSort(input)
- input
-
table
- returnValue
-
table
Util.randomUuid
generate a random unique id
- Usage
local s = Util.randomUuid()
- returnValue
-
string
Util.round
rounds mathematically correct
- Usage
local n = Util.round(number, base)
- number
-
number
- base
-
number
(default:1
) if given it rounds to the closest multiple ofbase
- returnValue
-
number
Util.sectorName
gets the sector name by coordinates
- Usage
local s = Util.sectorName(x, y)
- x
-
number
- y
-
number
- returnValue
-
string
Util.size
returns the size of any given table
- Usage
local n = Util.size(table)
- table
-
table
- returnValue
-
number
Util.spawnAtStation
spawns a ship at the station
- Usage
Util.spawnAtStation(station, obj, distance)
- station
-
SpaceStation
- obj
-
SpaceShip
- distance
-
number
default: 500
Util.totalLaserDps
This function is deprecated and should not be used anymore. |
calculates the total damage the Lasers can deal per second
- Usage
local n = Util.totalLaserDps(ship)
- ship
-
SpaceShip
- returnValue
-
number
Util.totalShieldLevel
This function is deprecated and should not be used anymore. |
calculates the total current shield level of a ship
- Usage
local n = Util.totalShieldLevel(ship)
- ship
-
SpaceShip
- returnValue
-
number
Util.vectorFromAngle
calculates a vector the given direction and length
- Usage
local r1, r2 = Util.vectorFromAngle(angle, length)
- angle
-
number
- length
-
number
- returnValue
-
number,number