Skip to content

Object Functions: Module Management

Richard Kettering edited this page Jun 20, 2016 · 2 revisions

Anura has a module system that allows us to take all assets for a game and put them inside a single, self-contained directory. We also have a rudimentary package-management system (c.f. things like Node, Aptitude, Homebrew etc) which lets you download modules and establish dependencies between modules.

  • module_client() — creates a module client object. The object will immediately start retrieving basic module info from the server. module_pump() should be called on it every frame. Has the following fields:
    • is_complete: true if the current operation is complete and a new operation can be started. When the module_client is first created it automatically starts an operation to get the summary of modules.
    • downloaded_modules: a list of downloaded modules that are currently installed.
    • module_info: info about the modules available on the server.
    • error: contains an error string if the operation resulted in an error, null otherwise.
    • kbytes_transferred: number of kbytes transferred in the current operation
    • kbytes_total: total number of kbytes to transfer to complete the operation.
  • module_install(module_client, string module_id) — begins downloading the given module and installing it. This should only be called when module_client.is_complete = true (i.e. there is no operation currently underway)
  • module_launch(string module_id) — launch the game using the given module.
  • module_pump(module_client) — pumps module client events. Should be called every cycle.
  • module_rate(module_client, string module_id, int num_stars (1-5), (optional) string review) — begins a request to rate the given module with the given number of stars, optionally with a review.
  • module_uninstall(string module_id) — uninstalls the given module
Clone this wiki locally