generated from AriasCreations/vsmodtemplate
Change method of time acceleration
This commit is contained in:
parent
720dafea87
commit
d2b92f95c5
4 changed files with 157 additions and 4 deletions
34
AriasServerUtils/ModSystems/ASUClient.cs
Normal file
34
AriasServerUtils/ModSystems/ASUClient.cs
Normal file
|
@ -0,0 +1,34 @@
|
|||
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;
|
||||
|
||||
if (accel)
|
||||
{
|
||||
CAPI.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
||||
}
|
||||
else CAPI.World.Calendar.RemoveTimeSpeedModifier("asu_psp");
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue