Drag[en]gine Script Module DragonScript  1.23
Dragengine.Services.Mods.ServiceMods Interface Reference

Interface for services supporting managing game modifications. More...

Inheritance diagram for Dragengine.Services.Mods.ServiceMods:
Dragengine.Services.ServiceModio

Classes

enum  ManagementEvent
 

Public Member Functions

void activateMods ()
 Activate subscribed and installed modifications. More...
 
void addModsListener (ServiceModsListener listener)
 Add modification listener. More...
 
Dictionary getActiveMods ()
 Active mods. More...
 
ServiceModProgress getCurrentModUpdate ()
 Current mod install or update progress information. More...
 
void getModInfo (String id, ServiceModsListener listener)
 Retrieve information about game modification. More...
 
ServiceModsFeatures getModsFeatures ()
 Features supported by this service. More...
 
void getModTags (ServiceModsListener listener)
 Tags that can be used for ServiceModFilter. More...
 
bool getPauseModManagement ()
 Mod management is paused. More...
 
void getPurchasedMods (ServiceModsListener listener)
 Purchased mods. More...
 
Dictionary getSubscribedMods ()
 User subscribed mods. More...
 
Dictionary getSystemMods ()
 System mods. More...
 
bool isModManagementBusy ()
 Service is busy managing modifications. More...
 
void listAllMods (ServiceModFilter filter, ServiceModsListener listener)
 Filtered list of available game modifications. More...
 
void loadModResource (String url, ServiceModsListener listener)
 Load resource asynchronously. More...
 
bool modHasMatchingFiles (String id, String directory, bool recursive, Set patterns)
 Modification has files matching one or more patterns. More...
 
void purchaseMod (String id, String price, ServiceModsListener listener)
 Purchase mod. More...
 
void removeModsListener (ServiceModsListener listener)
 Remove modification listener. More...
 
void reportMod (String id, ServiceModReport report, ServiceModsListener listener)
 Report modification. More...
 
void revokeModRating (String id, ServiceModsListener listener)
 Revoke rating for modification. More...
 
void setModDisabled (String id, bool disabled, ServiceModsListener listener)
 Disable modification. More...
 
void setPauseModManagement (bool pause)
 Pause mod management. More...
 
void submitModRating (String id, int rating, ServiceModsListener listener)
 Submit rating for modification. More...
 
void subscribeMod (String id, ServiceModsListener listener)
 Subscribe to modification. More...
 
void unsubscribeMod (String id, ServiceModsListener listener)
 Unsubscribe from modification. More...
 

Detailed Description

Interface for services supporting managing game modifications.

Version
1.23

This interface is designed for services using a remote host to store modifications and user profiles with the installed and active mods. For this reason the majority of calls are asynchronous. This does not prevent local host only services to use this interface.

Member Function Documentation

◆ activateMods()

void Dragengine.Services.Mods.ServiceMods.activateMods ( )

Activate subscribed and installed modifications.

Installing modifications does not automatically activate them. This avoids interrupting a running game flow while modifications are beeing installed. A typical use case is calling activateMods() upon leaving the modification management dialog. This ensures modifications start affecting the game at a well known point in time.

Unsubscribing from a modification calls activateMods() to avoid the game potentially accessing to be deleted modification files.

Disabling and re-enabling modifications does not trigger activateMods().

Activating modifications runs immediately.

Starting a game automatically calls activateMods().

Implemented in Dragengine.Services.ServiceModio.

◆ addModsListener()

void Dragengine.Services.Mods.ServiceMods.addModsListener ( ServiceModsListener  listener)

Add modification listener.

Parameters
listenerListener to add

Implemented in Dragengine.Services.ServiceModio.

◆ getActiveMods()

Dictionary Dragengine.Services.Mods.ServiceMods.getActiveMods ( )

Active mods.

Returns all active modifications (subscribed and enabled). Active modifications are changed when activateMods() is called. This call is useful to know if a game save state has been created with the same set of active modifications. Returns dictionary with String modification identifier and ServiceModStatus value.

Implemented in Dragengine.Services.ServiceModio.

◆ getCurrentModUpdate()

ServiceModProgress Dragengine.Services.Mods.ServiceMods.getCurrentModUpdate ( )

Current mod install or update progress information.

If no suitable mod management action is in progress null is returned.

Implemented in Dragengine.Services.ServiceModio.

◆ getModInfo()

void Dragengine.Services.Mods.ServiceMods.getModInfo ( String  id,
ServiceModsListener  listener 
)

Retrieve information about game modification.

Once finished ServiceModsListener.onGetModInfo() is called.

Parameters
idIdentifier of modification to retrieve.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ getModsFeatures()

ServiceModsFeatures Dragengine.Services.Mods.ServiceMods.getModsFeatures ( )

Features supported by this service.

Implemented in Dragengine.Services.ServiceModio.

◆ getModTags()

void Dragengine.Services.Mods.ServiceMods.getModTags ( ServiceModsListener  listener)

Tags that can be used for ServiceModFilter.

Once finished ServiceModsListener.onGetTags() is called with the list of ServiceModTagCategory. Each category contains a list of tags usable for this category.

Parameters
listenerIf not null called once in addition to added listeners.

◆ getPauseModManagement()

bool Dragengine.Services.Mods.ServiceMods.getPauseModManagement ( )

Mod management is paused.

Implemented in Dragengine.Services.ServiceModio.

◆ getPurchasedMods()

void Dragengine.Services.Mods.ServiceMods.getPurchasedMods ( ServiceModsListener  listener)

Purchased mods.

Once finished ServiceModsListener.onGetPurchasedMods() is called with array of ServiceModInfo value.

Parameters
listenerIf not null called once in addition to added listeners.

◆ getSubscribedMods()

Dictionary Dragengine.Services.Mods.ServiceMods.getSubscribedMods ( )

User subscribed mods.

Returns modifications are potentially not installed. Use ServiceModStatus.status to filter modifications of interest. Returns dictionary with String modification identifier and ServiceModStatus value.

Implemented in Dragengine.Services.ServiceModio.

◆ getSystemMods()

Dictionary Dragengine.Services.Mods.ServiceMods.getSystemMods ( )

System mods.

Returns all modifications installed on the system by all users. Returns dictionary with String modification identifier and ServiceModStatus value.

Implemented in Dragengine.Services.ServiceModio.

◆ isModManagementBusy()

bool Dragengine.Services.Mods.ServiceMods.isModManagementBusy ( )

Service is busy managing modifications.

Typical actions causing true to be returned are (non conclusive list):

  • Installing modification
  • Uninstalling modification
  • Updating modification to latest version
  • Uploading modification

While this method returns true certain functions will fail.

Implemented in Dragengine.Services.ServiceModio.

◆ listAllMods()

void Dragengine.Services.Mods.ServiceMods.listAllMods ( ServiceModFilter  filter,
ServiceModsListener  listener 
)

Filtered list of available game modifications.

Requests a list of game modifications using the provided filters. All filter parameters set to null cause default values to be used as defined by the service provider. Filters not supported by the service provider are ignored.

Once finished ServiceModsListener.onListMods() is called.

Receiving the results can take considerable amount of time depending on the load of the service provider.

Parameters
filterFilter to use.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ loadModResource()

void Dragengine.Services.Mods.ServiceMods.loadModResource ( String  url,
ServiceModsListener  listener 
)

Load resource asynchronously.

Loaded resources are cached for faster retrieval. Once the resource is cached locally ServiceModsListener.onLoadModResource() is called with the same URL as used in this function call.

Parameters
urlURL of image to load.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ modHasMatchingFiles()

bool Dragengine.Services.Mods.ServiceMods.modHasMatchingFiles ( String  id,
String  directory,
bool  recursive,
Set  patterns 
)

Modification has files matching one or more patterns.

Typically used to determine if an installed modification contains specific files. For example if a modification contains script code Engine.restart(String) has to be called to restart the game to re-parse the script. Another example is reloading cached game data if files are touched that have been cached before.

Parameters
idIdentifier of installed and enabled modification to scan for files.
directoryRoot directory to start searching in.
recursiveRecursively scan directories for matching files.
patternsSet of String file patterns without directories.
Exceptions
EInvalidActionModification does not exist or is not installed.

◆ purchaseMod()

void Dragengine.Services.Mods.ServiceMods.purchaseMod ( String  id,
String  price,
ServiceModsListener  listener 
)

Purchase mod.

Once finished ServiceModsListener.onPurchaseMod() is called.

Parameters
idIdentifier of modification to purchase.
pricePrice shown to the user. Used to verify the price matches.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ removeModsListener()

void Dragengine.Services.Mods.ServiceMods.removeModsListener ( ServiceModsListener  listener)

Remove modification listener.

Parameters
listenerListener to remove.

Implemented in Dragengine.Services.ServiceModio.

◆ reportMod()

void Dragengine.Services.Mods.ServiceMods.reportMod ( String  id,
ServiceModReport  report,
ServiceModsListener  listener 
)

Report modification.

Once finished ServiceModsListener.onReportMod() is called. Can be used if ServiceModsFeatures.canReportMods is true.

Parameters
idIdentifier of modification to report.
reportReport to submit.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ revokeModRating()

void Dragengine.Services.Mods.ServiceMods.revokeModRating ( String  id,
ServiceModsListener  listener 
)

Revoke rating for modification.

Once finished ServiceModsListener.onRevokeModRating() is called. Can be used if ServiceModsFeatures.canRateMods is true.

Parameters
idIdentifier of modification to revoke rating for.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ setModDisabled()

void Dragengine.Services.Mods.ServiceMods.setModDisabled ( String  id,
bool  disabled,
ServiceModsListener  listener 
)

Disable modification.

Modifications can be disabled by the user or the game if a modification is missbehaving or preventing the game from running. To get the disabled state of a modification use getSubscribedMods().

If modification is not found nothing is done.

Parameters
idIdentifier of modification to revoke rating for.
disabledDisabled state.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ setPauseModManagement()

void Dragengine.Services.Mods.ServiceMods.setPauseModManagement ( bool  pause)

Pause mod management.

By default the service automatically downloads, installs and uninstalls mods. This process can be temporarily paused for example during game play.

Implemented in Dragengine.Services.ServiceModio.

◆ submitModRating()

void Dragengine.Services.Mods.ServiceMods.submitModRating ( String  id,
int  rating,
ServiceModsListener  listener 
)

Submit rating for modification.

Once finished ServiceModsListener.onSubmitModRating() is called. Can be used if ServiceModsFeatures.canRateMods is true.

Parameters
idIdentifier of modification to submit rating for.
ratingRating to submit.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ subscribeMod()

void Dragengine.Services.Mods.ServiceMods.subscribeMod ( String  id,
ServiceModsListener  listener 
)

Subscribe to modification.

The user can also subscribe to a modification from outside the game using different means. In both situationsn modifications are installed automatically the next time possible if at least one user is subscribed to them. Hence subscribing and installing are different actions.

Once subscribing finished ServiceModsListener.onSubscribeMod() is called. At this point in time the modification is potentially not yet installed. Mod management installs mods as soon as possible if necessary. Listen to ServiceModsListener.onModManagement() events to know when the modification started and finished installing.

Parameters
tokenAuthentication token.
idIdentifier of modification to subscribe to.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.

◆ unsubscribeMod()

void Dragengine.Services.Mods.ServiceMods.unsubscribeMod ( String  id,
ServiceModsListener  listener 
)

Unsubscribe from modification.

The user can also unsubscribe from a modification from outside the game using different means. In both situationsn modifications are uninstalled automatically the next time possible if no user is subscribed to them. Hence unsubscribing and uninstalling are different actions.

Once unsubscribing finished ServiceModsListener.onUnsubscribeMod() is called. At this point in time the modification is still installed. Mod management uninstalls mods as soon as possible if necessary. Listen to ServiceModsListener.onModManagement() events to know when the modification started and finished uninstalling.

Parameters
tokenAuthentication token.
idIdentifier of modification to unsubscribe from.
listenerIf not null called once in addition to added listeners.

Implemented in Dragengine.Services.ServiceModio.


The documentation for this interface was generated from the following file: