Dark Forest Dev Guides
images
images
  • Developing for Dark Forest!
  • Connecting to the blockchain
    • What is an RPC endpoint?
    • Changing your RPC endpoint
    • Running your own xDAI node
  • Plugins
    • What is a plugin?
    • Writing your first plugin
    • Porting v0.5 plugins to v0.6
  • Mining
    • What is mining?
    • Sharing map data
    • Running a headless miner
    • Connecting to a remote (headless) miner
  • Developer resources
    • Running a custom client
    • Developing plugins locally
    • 3rd-party contract development
    • Dark Forest subgraph
    • How to query a subgraph
  • SNARKing
    • Running a remote SNARKer
  • Contributing
    • Contributing to this knowledge base
Powered by GitBook
On this page

Was this helpful?

  1. Plugins

Porting v0.5 plugins to v0.6

PreviousWriting your first pluginNextWhat is mining?

Last updated 3 years ago

Was this helpful?

For most v0.5 plugins, upgrading is as simple as following these two steps:

  • First, replace plugin.register(new Plugin()); (usually the last line of the v0.5 plugin) with export default Plugin;.

  • If the plugin is tracked in the , replace 0.5.0 in the version field with 0.6.0, and the date to the current date.

Here's an port (doesn't update the date field).

In a few cases, you might have to alter a few more lines. Here is a (possibly incomplete) list of additional modifications you may have to make:

  • If the plugin is importing utils dynamically with import('https://plugins.zkga.me/utils/utils.js'), you should replace any instances of canUpgrade with canPlanetUpgrade.

  • entityStore.planetCanUpgrade is now a static method; any instance of df.entityStore.planetCanUpgrade(planet) should be replaced with df.entityStore.constructor.planetCanUpgrade(planet).

If you want to inspect the differences between the v0.5 and v0.6 clients, you can find the last v0.5 client source code . Documentation on the v0.6 df and ui objects can be found and , and the source code can be found in the .

plugins repository
example
example
here
here
here
Dark Forest open-source client