Tanuki.Atlyss is a plugin framework for ATLYSS.
It runs on BepInEx, providing a wide variety of tools and simplifying development.
Commands can be executed on either the client or the server. Their execution can be restricted using caller policies.
Server-side commands are processed only by the host and can be executed by players who do not have the plugin installed.
[CommandMetadata(EExecutionSide.Client, typeof(Atlyss.Core.Policies.Commands.Caller.Player))]
internal sealed class BrandNewCommand : ICommand
{
public void Execute(IContext context)
{
IReadOnlyList<string> arguments = context.Arguments;
Atlyss.Core.Types.Commands.Callers.Player caller = (Atlyss.Core.Types.Commands.Callers.Player)context.Caller;
Player player = caller.Instance;
}
}Command configurations can be customized on the client side.
Configuration files can be generated automatically, but it is recommended to use the ones provided with the plugins.
Path pattern: BepInEx/config/{Plugin}/*.commands.json
{
"AssemblyName.Commands.BrandNewCommand": {
"Names": [
"brandnewcommand",
"bnc"
],
"Help": "Example command",
"Syntax": "<example> [helpful] <[syntax]>"
}
}Commands can be executed from the in-game chat.
Arguments are separated by spaces, but mixed quoting can be used.
Input
/example 123 "argument with spaces" 456 'argument with other quotes'
Result["123", "argument with spaces", "456", "argument with other quotes"]
| Command | Help |
|---|---|
/help [plugin names separated by spaces] |
Display a list of plugin commands. |
/reload [plugin names separated by spaces] |
Reload the specified plugins. |
Translation files are stored alongside the plugin configuration files.
Path pattern: BepInEx/config/{Plugin}/*.translations.json
{
"TranslationKey": "Translated string, {0} {1} {2}",
"AnotherTranslationKey": "example"
}The plugin base first tries to use one of the preferred languages specified in the core configuration. If none of them is available, it falls back to the first available language.
Language names should be written in lowercase. It's recommended to always include a neutral option.
[Translations]
PreferredLanguages = neutral, english, russianTranslations can be accessed by inheriting from the base plugin class.
public sealed class BrandNewPlugin : Tanuki.Atlyss.Core.Bases.Plugin
{
protected override void Load()
{
Logger.LogInfo(Translate("TranslationKey", "text", 12345, true)); // Output: "Translated string, text 12345 true"
}
}Networking is built on Steam Networking and provides a simple way to send data either to everyone in the lobby or to individual clients.
// JsonObjectPacket<T> provides simple serialization using the JSON format.
public class ExamplePacket : Tanuki.Atlyss.Network.Bases.JsonObjectPacket<ExamplePacket>
{
public string Text { get; set; } = string.Empty;
public float Number { get; set; } = 0;
}
private Atlyss.Network.Tanuki NetworkModule => Atlyss.Network.Tanuki.Instance;
private void OnTanukiAtlyssNetworkInitialized()
{
// Packet registration is required for identification and to receive data from clients.
NetworkModule.Registers.Packets.Register<ExamplePacket>();
// Adding a packet handler.
NetworkModule.Managers.Packets.AddHandler<ExamplePacket>(HandleExamplePacket);
// Packets can be dropped if necessary.
bool dropPackets = false;
NetworkModule.Managers.Packets.ChangeMuteState<ExamplePacket>(dropPackets);
}
private void SendExamplePackets()
{
ExamplePacket examplePacketInstance = new();
NetworkModule.Routers.Packets.SendPacketToLobbyChat(examplePacketInstance);
NetworkModule.Routers.Packets.SendPacketToUser(new CSteamID(1), examplePacketInstance, out EResult steamResult);
}
// Packet handler
public void HandleExamplePacket(CSteamID senderSteamId, ExamplePacket packet) { }- Tanuki.Atlyss.API - public API and contracts;
- Tanuki.Atlyss.Core - the main framework implementation;
- Tanuki.Atlyss.Game - game-specific patches, accessors, providers and extensions;
- Tanuki.Atlyss.Network - network communication and packet processing;
- Tanuki.Atlyss.Shared - shared utilities, extensions.
Examples of usage can be found here.
Core configuration: BepInEx/config/9c00d52e10b8413f9ee4bfde81762442.cfg
- Install BepInEx. The preconfigured package is recommended.
- Install the Tanuki.Atlyss files.