generated from AriasCreations/vsmodtemplate
35 lines
No EOL
974 B
C#
35 lines
No EOL
974 B
C#
using System;
|
|
using Vintagestory.API.Client;
|
|
using Vintagestory.API.Common;
|
|
|
|
public class ASUModClient : ModSystem
|
|
{
|
|
public static ICoreClientAPI CAPI;
|
|
bool accel = false;
|
|
|
|
public override bool ShouldLoad(EnumAppSide forSide)
|
|
{
|
|
return forSide == EnumAppSide.Client;
|
|
}
|
|
|
|
public override void StartClientSide(ICoreClientAPI api)
|
|
{
|
|
CAPI = api;
|
|
api.Network.RegisterChannel("asutimeaccel")
|
|
.RegisterMessageType<ASUTimeAcceleration>()
|
|
.SetMessageHandler<ASUTimeAcceleration>(onReceiveTimeAccel);
|
|
}
|
|
|
|
private void onReceiveTimeAccel(ASUTimeAcceleration packet)
|
|
{
|
|
// Time acceleration handler
|
|
accel = packet.Sleeping;
|
|
CAPI.Logger.Notification("Time acceleration: " + packet.Sleeping);
|
|
|
|
if (accel)
|
|
{
|
|
CAPI.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
|
}
|
|
else CAPI.World.Calendar.RemoveTimeSpeedModifier("asu_psp");
|
|
}
|
|
} |