Anvil
Anvil.Services.IUpdateable Interface Reference

Implement this interface in your service to get a callback each server loop. More...

+ Inheritance diagram for Anvil.Services.IUpdateable:

Public Member Functions

void Update ()
 Called once every main loop frame. You may safely use any of the NWN API in this callback, but it is recommended to keep the processing in this function to a minimum, as it may have adverse effect on server performance. More...
 

Detailed Description

Implement this interface in your service to get a callback each server loop.

Examples

/*
* Report the current tick rate every server loop.
*/
using Anvil.API;
using NLog;
namespace NWN.Anvil.Samples
{
[ServiceBinding(typeof(IUpdateable))]
[ServiceBinding(typeof(PerformanceReportService))]
public class PerformanceReportService : IUpdateable
{
// Gets the server log. By default, this reports to "anvil.log"
private static readonly Logger Log = LogManager.GetCurrentClassLogger();
public void Update()
{
Log.Info($"Current tick rate: {1 / Time.DeltaTime.TotalSeconds}");
}
}
}

Member Function Documentation

◆ Update()

void Anvil.Services.IUpdateable.Update ( )

Called once every main loop frame. You may safely use any of the NWN API in this callback, but it is recommended to keep the processing in this function to a minimum, as it may have adverse effect on server performance.


The documentation for this interface was generated from the following file: