BF2042 Portal - Code Snippet Plugin
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
- 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/
- Pin the extension to be able to click on it
- Click on the extension icon and a popup should appear
- Click on
official extension manifest
in the text to automatically fill the “Manifest URL” and “Version” input. - Click confirm
- Reload any Rules Editor Page and right-click in the Workspace
- 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) - Click on
Options >
and thenPlugin Manager
- In the Plugin Manager click on
Add Plugin
on the top-right corner - Enter the Plugin Manifest URL below and click
Review
, then clickConfirm
after seeing the sourcecode of the plugin. - 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
- List of predefined code snippets you can insert to your experience / workspace
- Create and manage your own private snippets
- Add snippets to a favourites list for faster use
How to use
Insert Code Snippet
- Right click on the workspace (not on a block)
- In the opening context menu select
Insert Snippet
- 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
- Click on the snippet name you want to insert
Manage Code Snippets
With the “Manage Dialog” you can
- add and remove favourites
- create and delete your own private snippets
- browse predefined snippets
- insert snippets to the workspace
- export and import settings (favourites and private snippets)
To open the manage dialog, right-click on the workspace (not on a block) and select Manage Snippets
from the context menu.
Create your own private Code Snippet
- Open the manage dialog
- Click on
[Add New]
in the “private” section - 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.
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:
- Add the snippet as xml file in an according sub-folder in
snippets
- 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
anddescription
- Use the sub-folder name as