Difference between revisions of "Lib PAD"

From Elite Wiki
(First draft)
 
m (Doc part II)
Line 5: Line 5:
  
 
==Categories==
 
==Categories==
The categories in Lib_PAD are the first component of all dotted pathes. Pages in a category do share a template which defines the layout of the page.
+
The categories in Lib_PAD are the first component of all dotted pathes. Pages in a category do share a template which defines the layout of the page. All pages, except LOGS, do have 6 slots for textures (t0 - t5).
 
:;GALCOP:Category for GalCop, Police, Navy and other official organisations related to GalCop.
 
:;GALCOP:Category for GalCop, Police, Navy and other official organisations related to GalCop.
 +
:::Contains entries: name, entry, rank, enlisted, missions, awards, info.
 
:;GUILDS:Category for other organisations which do have a membership.
 
:;GUILDS:Category for other organisations which do have a membership.
 +
:::Contains entries: name, entry, rank, enlisted, missions, awards, info.
 
:;INFOS:Category for special events, news, specific stations, etc.
 
:;INFOS:Category for special events, news, specific stations, etc.
 +
:::Contains entries: name, location, beacon, purpose, special, notes.
 
:;LOGS:Category for standard events like rescued escape pods, bailed out, fined, etc.
 
:;LOGS:Category for standard events like rescued escape pods, bailed out, fined, etc.
 +
:::Contains entries: list.
 
:;PERSONS:Category for characters you have met or you got infos about.
 
:;PERSONS:Category for characters you have met or you got infos about.
 +
:::Contains entries: name, origin, species, gender, age, rank, ship, info, notes.
 
:;SYSTEMS:Category for special systems like Leesti, Tianve, Tionisla, etc.
 
:;SYSTEMS:Category for special systems like Leesti, Tianve, Tionisla, etc.
 +
:::Contains entries: name, info, notes.
 +
 +
===Types===
 +
:;Number: age.
 +
:;String: beacon, enlisted, entry, gender, location, name, origin, purpose, rank, ship, species.
 +
:;Array: awards, info, list, missions, notes, special.
  
  
 
==Methods==
 
==Methods==
 +
The following entry points for AddOns can be used on [[Oolite_JavaScript_Reference:_World_script_event_handlers#startUpComplete|.startUpComplete]] or later.
 
===_addPageInCategory===
 
===_addPageInCategory===
 
{{CodeEx|codeex= _addPageInCategory: function( path, content )}}
 
{{CodeEx|codeex= _addPageInCategory: function( path, content )}}
Register a new page entry in the specified dotted path on [[Oolite_JavaScript_Reference:_World_script_event_handlers#startUpComplete|.startUpComplete]] or later.
+
Register a new page entry in the specified dotted path. The inserted Object is cloned and merged with the corresponding template.
  
 
'''Parameters:'''
 
'''Parameters:'''
:;path:String.
+
:;path:String. Dotted path: [[#Categories|Category]] and page identifier. E.g. "GALCOP.NAVY".
 
:;content:Object.
 
:;content:Object.
  
Line 29: Line 41:
 
===_setPageEntry===
 
===_setPageEntry===
 
{{CodeEx|codeex= _setPageEntry: function( path, value )}}
 
{{CodeEx|codeex= _setPageEntry: function( path, value )}}
Set value in the specified dotted path on [[Oolite_JavaScript_Reference:_World_script_event_handlers#startUpComplete|.startUpComplete]] or later.
+
Set value in the specified dotted path.
  
 
'''Parameters:'''
 
'''Parameters:'''
:;path:String.
+
:;path:String. Dotted path: [[#Categories|Category]], page identifier and [[#Types|page entry]]. E.g. "GALCOP.NAVY.enlisted".
:;value:Primitive.
+
:;value:Primitive (String or Number). If the path points to an Array the value will be pushed.
  
 
'''Returns:'''
 
'''Returns:'''
Line 41: Line 53:
 
===_getData===
 
===_getData===
 
{{CodeEx|codeex= _getData: function( path )}}
 
{{CodeEx|codeex= _getData: function( path )}}
Return the data-object in the specified dotted path on [[Oolite_JavaScript_Reference:_World_script_event_handlers#startUpComplete|.startUpComplete]] or later.
+
Returns the cloned data-object in the specified dotted path.
  
 
'''Parameters:'''
 
'''Parameters:'''
:;path:String.
+
:;path:String. Dotted path: [[#Categories|Category]] and page identifier. E.g. "GALCOP.NAVY".
  
 
'''Returns:'''
 
'''Returns:'''

Revision as of 08:48, 29 March 2018

IconLib.png

Overview

Lib_PAD (part of Library) is a logbook, mission-log, diary and interface. AddOns can implement data to get important organisations, events, systems or persons exposed to the player in an unified way. It also ships search functionality, a way to customize players data (species, gender, etc) and players can also add own notes.


Categories

The categories in Lib_PAD are the first component of all dotted pathes. Pages in a category do share a template which defines the layout of the page. All pages, except LOGS, do have 6 slots for textures (t0 - t5).

GALCOP
Category for GalCop, Police, Navy and other official organisations related to GalCop.
Contains entries: name, entry, rank, enlisted, missions, awards, info.
GUILDS
Category for other organisations which do have a membership.
Contains entries: name, entry, rank, enlisted, missions, awards, info.
INFOS
Category for special events, news, specific stations, etc.
Contains entries: name, location, beacon, purpose, special, notes.
LOGS
Category for standard events like rescued escape pods, bailed out, fined, etc.
Contains entries: list.
PERSONS
Category for characters you have met or you got infos about.
Contains entries: name, origin, species, gender, age, rank, ship, info, notes.
SYSTEMS
Category for special systems like Leesti, Tianve, Tionisla, etc.
Contains entries: name, info, notes.

Types

Number
age.
String
beacon, enlisted, entry, gender, location, name, origin, purpose, rank, ship, species.
Array
awards, info, list, missions, notes, special.


Methods

The following entry points for AddOns can be used on .startUpComplete or later.

_addPageInCategory

_addPageInCategory: function( path, content )

Register a new page entry in the specified dotted path. The inserted Object is cloned and merged with the corresponding template.

Parameters:

path
String. Dotted path: Category and page identifier. E.g. "GALCOP.NAVY".
content
Object.

Returns:

true (on success) or false (if the page already exists).


_setPageEntry

_setPageEntry: function( path, value )

Set value in the specified dotted path.

Parameters:

path
String. Dotted path: Category, page identifier and page entry. E.g. "GALCOP.NAVY.enlisted".
value
Primitive (String or Number). If the path points to an Array the value will be pushed.

Returns:

true (on success) or false (if the path does not exist).


_getData

_getData: function( path )

Returns the cloned data-object in the specified dotted path.

Parameters:

path
String. Dotted path: Category and page identifier. E.g. "GALCOP.NAVY".

Returns:

Object (on success) or false (if the path does not exist).