Getting started

Create, authorize and activate a minimal addon with matching runtime identity.

Requirements

  • Create an s&box Addon Project and set its Target or Parent Game to litherastudio.litherarp.
  • Restart the editor after changing the parent game.
  • Use one public implementation of ILitherarpAddon and mark it with [LitherarpAddon("id")].
  • Use the same normalized id in the attribute, AddonId, manifest and server entry.
1{
2 "Title": "My LitheraRP Addon",
3 "Type": "addon",
4 "Org": "creator",
5 "Ident": "myaddon",
6 "Schema": 1,
7 "Metadata": {
8 "ParentPackage": "litherastudio.litherarp"
9 }
10}

Entry point

1using System.Threading;
2using System.Threading.Tasks;
3using Sandbox;
4
5[LitherarpAddon( "myaddon" )]
6public sealed class MyAddon : ILitherarpAddon
7{
8 public string AddonId => "myaddon";
9 public string DisplayName => "My Addon";
10 public string Version => "1.0.0";
11 public int ProtocolVersion => 1;
12
13 public Task OnHostLoadingAsync( LitherarpAddonContext context, CancellationToken token )
14 => Task.CompletedTask;
15
16 public void OnHostLoaded( LitherarpAddonContext context )
17 {
18 context.Info( "Host side loaded." );
19 }
20
21 public void OnClientLoaded( LitherarpAddonContext context )
22 {
23 context.Info( "Client side loaded." );
24 }
25}

The attribute is required for deterministic discovery. LitheraRP refuses an implementation without it, a duplicate implementation id, an id mismatch or an implementation whose ProtocolVersion differs from the manifest.

Operator enablement

Code needs both the global opt-in and the per-entry opt-in. Both are false by default. The readiness settings shown below are the defaults.

1{
2 "version": 2,
3 "enabled": true,
4 "settings": {
5 "allowCodeAddons": true,
6 "blockConnectionsUntilCodeAddonsReady": true,
7 "blockConnectionsOnCodeAddonFailure": true,
8 "clientReadinessTimeoutSeconds": 90
9 },
10 "entries": [
11 {
12 "id": "myaddon",
13 "packageIdent": "creator.myaddon",
14 "enabled": true,
15 "allowCode": true,
16 "grantedCapabilities": []
17 }
18 ]
19}
  1. Apply from Admin Console, or run litherarp.addons_apply.
  2. Check lastStatus and lastMessage on the entry.
  3. Connect a separate client and verify that it reaches addon ready before its pawn is created.

Local development

A local.* package can activate from the editor TypeLibrary on the listen host. Remote clients never mount a local ident, so use a published package for multi-client readiness tests.