Jump to content

DEVBLOG: LUA IMPROVEMENTS AND CHANGES, PART 2


NQ-Deckard

Recommended Posts

DevBlog 169 (2).png

 

In Part 1, we went over some of the fresh new Lua options available, such as changes to repositories, the removal of quaternions, and docking-related changes. In Part 2, we’re back to spread the good word about exciting things like radars and transponders.  

 

Previously, we announced that Part 2 would also include databases, the atlas, and event libraries. Instead, these will be covered in Part 3


RADAR LUA API CHANGES AND ADDITIONS
There are some future backend radar changes in the planning stages now. In preparation, we have made some improvements to the Lua implementation of the radar. These should not only have a usability benefit, but also improve performance as we reduce the usage of JSON strings to deliver payloads in Lua in favour of tables and values.


See below:

  • <list> radar.getEntries() : DEPRECATED (renamed to getConstructIds for consistency).
  • <int> radar.isOperational() : Returns 1 if the radar is not broken, works in the current environment and is not used by another control unit.
  • <float> radar.getRange() : Returns the scan range of the radar unit.
  • <list> radar.getIdentifyRanges() : Returns ranges to identify a target based on its core size.
  • <list> radar.getConstructIds() : Returns the list of construct IDs in the scan range.
  • <list> radar.getIdentifiedConstructIds() : Returns the list of identified construct IDs.
  • <int> radar.getTargetId() : Returns the ID of the target construct.
  • <float> radar.getConstructDistance(<int> cid) : Returns the distance to the given construct.
  • <int> radar.isConstructIdentified(<int> cid) : Returns 1 if the given construct is identified.
  • <int> radar.isConstructAbandoned(<int> cid) : Returns 1 if the given construct was abandoned.
  • <int> radar.getConstructCoreSize(<int> cid) : Returns the core size of the given construct.
  • <string> radar.getThreatTo(<int> cid) : Returns the threat rate your construct is for the given construct.
  • <string> radar.getThreatFrom(<int> cid) : Returns the threat rate the given construct is for your construct.

With a matching transponder:

  • <table> radar.getConstructOwner(<int> cid) : Returns a table with ID of the owner entities (player or organization) of the given construct if in range and if active transponder tags match.
  • <vec3> radar.getConstructPos(<int> cid) : Returns the position of the given construct in construct local coordinates if the active transponder tags match.
  • <vec3> radar.getConstructWorldPos(<int> cid) : Returns the position of the given construct in world coordinates if in range and if the active transponder tags match.

If identified:

  • <float> radar.getConstructSpeed(<int> cid) : Returns the speed of the given construct if identified.
  • <float> radar.getConstructAngularSpeed(<int> cid) : Returns the angular speed of the given construct if identified.
  • <float> radar.getConstructRadialSpeed(<int> cid) : Returns the radial speed of the given construct if identified.
  • <float> radar.getConstructMass(<int> cid) : Returns the mass of the given construct if identified.
  • <list> radar.getConstructInfos(<int> cid) : Returns a list of working elements on the given construct if identified.

If identified AND a matching transponder:  :

  • <vec3> radar.getConstructVelocity(<int> cid) : Returns the velocity vector of the given construct in construct local coordinates if identified and if the active transponder tags match.
  • <vec3> radar.getConstructWorldVelocity(<int> cid) : Returns the velocity vector of the given construct in world coordinates if identified and if the active transponder tags match.


TRANSPONDER LUA API ADDITIONS
We also heard your feedback that many of you found the transponder lacking in usability. To counter this,  we’ve added and modified the following functions:

  • transponder.activate() : Activate the transponder.
  • transponder.deactivate() : Deactivate the transponder.
  • transponder.toggle() : Toggle the state of the transponder.
  • <int> transponder.getState() : Returns the activation state of the transponder.
  • <int> transponder.setTags(<list> tags) : Set the tags list with up to eight entries. Returns 1 if the application is successful, 0 if the list is too long or if the tag format is invalid.
  • <list> transponder.getTags() : Returns the tag list.
  • transponder.toggled(<int> active) event : Emitted when the transponder is started or stopped.

 

JOIN THE CONVERSATION
What do you think of these Lua changes and additions? Are there more you’d like to see? We’d love to hear your thoughts in this thread
 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...