Skip to main content
NanosSharp

NanosSharp

Write nanos world server packages in C#.

Native speed

NanosSharp talks to the engine directly instead of going through Lua. Calls into nanos world are faster than from Lua and C# code itself runs many times faster.

Typed API with hot reload

The whole scripting API is generated with types, properties, events and documentation. Save a .cs file and the package rebuilds and reloads without restarting the server.

Fits into nanos world

Every C# package is a regular nanos world package. It runs next to Lua packages, shares values with them and can use any NuGet package.

Server/Gamemode.cs
public sealed class Gamemode : Package
{
protected override void OnStart() => Player.OnReady += OnPlayerReady;

private static void OnPlayerReady(Player player)
{
var character = new Character(new Vector(0, 0, 200), Rotator.Zero, "nanos-world::SK_Mannequin");
player.Possess(character);
}

[ServerEvent]
private void OnDeath(CharacterDeathEvent e) => Log.Info($"{e.Character} was killed by {e.Instigator}");
}