This wiki is archived from 2021-09-05

Planetary Annihilation mods API: Difference between revisions

From Planetary Annihilation: TITANS and Classic PA Wiki
Jump to navigation Jump to search
(Created page with "Category:Modding = 50px Planetary Annihilation mods API = Also see Planetary Annihilation Mod Structure. == deprecated: api.mods.getMountedM...")
 
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:Modding]]
[[Category:Modding]]
= [[File:Titans-icon.png|50px]] Planetary Annihilation mods API =
= Planetary Annihilation mods API =


Also see [[Planetary Annihilation Mod Structure]].
Also see [[Planetary Annihilation Mod Structure]].
Line 6: Line 6:
== deprecated: api.mods.getMountedMods( context, callback ) ==
== deprecated: api.mods.getMountedMods( context, callback ) ==


use api.mods.getMounted( context, false ).
Returns a list of mounted mod in context.


returns a list of mounted mod in context:
{| class="wikitable"
* context: client or server string
!context
* callback: function(data)
|mandatory
|string
|client or server
|-
!callback
|mandatory
|function(data)
|data contains an array of modinfo objects
|}


data contains an array of modinfo objects with:
<pre>api.mods.getMountedMods('client',function(data){console.log(data);});</pre>
* author (string)
* context (string)
* dependencies (array)
* description (string)
* display_name (string)
* identifier (string)
* signature (string)
* version (string)
 
Example: api.mods.getMountedMods('client',function(data){console.log(data);});


== api.mods.getMounted( context, raw ) ==
== api.mods.getMounted( context, raw ) ==


returns a promise for a list of mounted mods in context:
Returns a promise for a list of mounted mods in context.
* context: client or server string
* raw: boolean (use true to return full modinfo)


promise data contains an object with a single property mounted_mods which contains an array of modinfo objects.
{| class="wikitable"
!context
|mandatory
|string
|client or server
|-
!raw
|optional
|boolean
|true to return full modinfo objects
|-
!returns
|
|promise
|object with a single property mounted_mods which contains an array of modinfo objects
|}


Example: api.mods.getMounted('client',true).always(function(data){console.log(data);});
<pre>api.mods.getMounted('client',true).always(function(data){console.log(data);});</pre>

Latest revision as of 11:23, 9 September 2021

Planetary Annihilation mods API

Also see Planetary Annihilation Mod Structure.

deprecated: api.mods.getMountedMods( context, callback )

Returns a list of mounted mod in context.

context mandatory string client or server
callback mandatory function(data) data contains an array of modinfo objects
api.mods.getMountedMods('client',function(data){console.log(data);});

api.mods.getMounted( context, raw )

Returns a promise for a list of mounted mods in context.

context mandatory string client or server
raw optional boolean true to return full modinfo objects
returns promise object with a single property mounted_mods which contains an array of modinfo objects
api.mods.getMounted('client',true).always(function(data){console.log(data);});