Code Snippet Plugin - BF2042 Portal Rules Editor

This is a plugin for the Battlefield Portal Browser Extension to provide code snippets to insert into the workspace of the Battlefield 2042 Portal Rules Editor.

View on GitHub

BF2042 Portal - Code Snippet Plugin

manageDialog

About

This is a plugin for the Battlefield Portal Browser Extension to provide code snippets to insert into the workspace of the Battlefield 2042 Portal Rules Editor.

Install

  1. Install the Battlefield Portal Browser Extension
    • Chrome: https://chrome.google.com/webstore/detail/bf2042-portal-extensions/ojegdnmadhmgfijhiibianlhbkepdhlj
    • Firefox: https://addons.mozilla.org/en-US/firefox/addon/bf2042-portal-extensions/
  2. Pin the extension to be able to click on it
  3. Click on the extension icon and a popup should appear
  4. Click on official extension manifest in the text to automatically fill the “Manifest URL” and “Version” input.
  5. Click confirm
  6. Reload any Rules Editor Page and right-click in the Workspace
  7. A context menu should appear which shows an Options > item (if not, reload the page again and check that the Portal browser extension is active)
  8. Click on Options > and then Plugin Manager
  9. In the Plugin Manager click on Add Plugin on the top-right corner
  10. Enter the Plugin Manifest URL below and click Review, then click Confirm after seeing the sourcecode of the plugin.
  11. After the plugin was added to the list of plugins, you need to reload the rules editor page in order to activate it

Plugin manifest.json URL

https://the0zzy.github.io/bf2042-portal-snippet-plugin/manifest.json

Features

How to use

Insert Code Snippet

  1. Right click on the workspace (not on a block)
  2. In the opening context menu select Insert Snippet
  3. Select the according category of the snippet
    • Favourites: Snippets you marked as your favourites
    • Private: Snippets that you created on your own
    • Other Categories: Predefined categories and snippets
  4. Click on the snippet name you want to insert

insertSnippet01 insertSnippet02 insertSnippet03

insertSnippet04

Manage Code Snippets

With the “Manage Dialog” you can

To open the manage dialog, right-click on the workspace (not on a block) and select Manage Snippets from the context menu.

manageDialog

Create your own private Code Snippet

  1. Open the manage dialog
  2. Click on [Add New] in the “private” section
  3. In the Edit Dialog that was openend, you can define the name and content of your snippet

The content of a snippet is the underlying Blockly XML Code.
Such code can be obtained by using the Copy to Clipboard function of the Battlefield Portal Browser Extension.

editDialog

Export and Import Plugin Data

You can export and import the configured favourites and your private snippets. This can be done by clicking the according icon in the top-right of the manage dialog. The export will create a JSON file with the according data. When you import this file, it will remove your current favourites and private snippets before loading the ones from the file.

Contribute Predefined Snippets

You think that an important frequently used snippet is missing or needs to be changed?
Then feel free to open a pull-request to this repository with the missing snippet added in the following way:

  1. Add the snippet as xml file in an according sub-folder in snippets
  2. Add a reference to your snippet in the snippets/index.json file
    • Use the sub-folder name as category
    • use the filename (without extension) as id
    • Give the relative path to your snippet as url
    • give a user friendly short name and description