generated from AriasCreations/vsmodtemplate
Adds a initial basic version of player sleeping percentage.
This commit is contained in:
parent
d2b92f95c5
commit
3ab3dc099f
3 changed files with 24 additions and 19 deletions
|
@ -238,7 +238,7 @@ namespace AriasServerUtils
|
|||
.HandleWith(Events.HandleASU)
|
||||
.WithDescription("Lists all Aria's Server Utils commands")
|
||||
.EndSubCommand()
|
||||
.BeginSubCommand("test")
|
||||
/*.BeginSubCommand("test")
|
||||
.RequiresPlayer()
|
||||
.RequiresPrivilege(Privilege.controlserver)
|
||||
.BeginSubCommand("sleep")
|
||||
|
@ -251,7 +251,7 @@ namespace AriasServerUtils
|
|||
.RequiresPrivilege(Privilege.controlserver)
|
||||
.HandleWith(TestCalendarSpeed)
|
||||
.EndSubCommand()
|
||||
.EndSubCommand();
|
||||
.EndSubCommand()*/ ;
|
||||
|
||||
api.ChatCommands.Create("setwarp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Creates a new server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarpUpdate);
|
||||
api.ChatCommands.Create("warp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Warp to the specified server warp").WithArgs(parsers.OptionalWord("name")).HandleWith(Events.HandleWarp);
|
||||
|
@ -286,7 +286,7 @@ namespace AriasServerUtils
|
|||
Sleeping = true
|
||||
});
|
||||
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||
}
|
||||
|
||||
return TextCommandResult.Success($"Test initiated, original calendar multiplier: '{OriginalSpeed}'");
|
||||
|
@ -313,7 +313,7 @@ namespace AriasServerUtils
|
|||
Sleeping = true
|
||||
});
|
||||
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||
|
||||
SendMessageTo(isp, "Applied calendar speed multiplier");
|
||||
}
|
||||
|
@ -349,6 +349,7 @@ namespace AriasServerUtils
|
|||
{
|
||||
EntityBehaviorTiredness ebt = player.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
||||
ebt.IsSleeping = false;
|
||||
ebt.Tiredness = 0;
|
||||
}
|
||||
|
||||
SleepingPlayers.Clear();
|
||||
|
@ -403,6 +404,14 @@ namespace AriasServerUtils
|
|||
int Percentage = TotalInBed * 100 / TotalOnline;
|
||||
if (Percentage >= config.PlayerSleepingPercentage)
|
||||
{
|
||||
|
||||
ServerNetworkChannel.BroadcastPacket(new ASUTimeAcceleration
|
||||
{
|
||||
Sleeping = true
|
||||
});
|
||||
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 1000);
|
||||
|
||||
// Call the API to make sleep happen
|
||||
foreach (var bed in BEBs)
|
||||
{
|
||||
|
@ -412,19 +421,12 @@ namespace AriasServerUtils
|
|||
EntityBehaviorTiredness EBT = bed.MountedBy.GetBehavior("tiredness") as EntityBehaviorTiredness;
|
||||
|
||||
EBT.IsSleeping = true;
|
||||
|
||||
// Get current calendar speed
|
||||
OriginalSpeed = API.World.Calendar.CalendarSpeedMul;
|
||||
Hours = API.World.Calendar.TotalHours;
|
||||
Sleeping = true;
|
||||
|
||||
ServerNetworkChannel.BroadcastPacket(new ASUTimeAcceleration
|
||||
{
|
||||
Sleeping = true
|
||||
});
|
||||
|
||||
API.World.Calendar.SetTimeSpeedModifier("asu_psp", 500);
|
||||
bed.MountedBy.TryUnmount(); // Stand up. We cant trigger the real sleep phase, but all code for starting time accel has been executed.
|
||||
}
|
||||
|
||||
// Get current calendar speed
|
||||
Hours = API.World.Calendar.TotalHours;
|
||||
Sleeping = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue