Skip to content

Add a custom Action

Refer to the ExamineAction.ts in the backend for an example.

  1. Create a class with the name [Name]Action, for example SmellAction.
  2. Extend the class from Action.
  3. Implement the required abstract functions. All actions need:

    • A public static readonly Alias attribute with an unique alias.
    • This alias has to be provided through an empty constructor.
    • A name function to return the name of the action.
  4. Create an interface* with the name [Name], for example Smell.

  5. Add one or more abstract functions to the interface to describe the action. Make sure the return type is always ActionResult | undefined.
  6. Register the action in the constructor of the GameService using this.registerAction, for example this.registerAction(SmellAction).

* Interface in TypeScript: export abstract class with @Interface decorator.

Relevante instructievideo