Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Client Mod Example 🐱‍👤

Note

This example is for C# Dotnet Core

Registering A Mod

To register a dotnet mod using RealLoader, you must attach an attribute to your mod's main class. This class can be named anything. Below is an example of this attribute.

[PalworldMod("Sample", "poofyfox", ".poofyfox", "1.0.0", PalworldModType.Universal)]
public class Sample : IPalworldMod {

Tip

Mod compatibility allows you to flag on which environments your mod is meant to run on. Client, Server, Universal.

The parameters for this attribute are

  • Your mod's name
  • Your contact
  • Your alias
  • Mod version
  • Mod compatibility

Mod Constructor

A mod may have a parameters-less constructor. We always recommend passing and storing the CancellationToken. You can use this to gracefully shutdown your mod. After cancel has been requested there is a 5 second window to shutdown before a force shutdown occurs.

public Sample(CancellationToken cancellationToken, ILogger logger, IUnrealHookManager unrealHookManager) {
_cancellationToken = cancellationToken;
_logger = logger;
_unrealHookManager = unrealHookManager;
}

Tip

Even when an ISbStartup class is not specified, a mod may consume any dependency from the root DI service container via the constructor arguments. In this case, ILogger is satisfied by the DI service.

Loading

Loading and unloading are both called as functions a mod must implement.

IRealLoaderMod::Load

  • Mod load is a mod's main entry point for initial code execution.

IRealLoaderMod::Unload

  • Mod unload has a 5 second window before it will force the shutdown of a mod.