#5: Add debug to player sleeping percentage

This commit is contained in:
zontreck 2025-05-03 12:53:44 -07:00
parent 4c585f647e
commit e56a123cb8
4 changed files with 26 additions and 10 deletions

View file

@ -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")
@ -246,12 +246,7 @@ namespace AriasServerUtils
.RequiresPrivilege(Privilege.controlserver)
.HandleWith(TestSleep)
.EndSubCommand()
.BeginSubCommand("calendarspeed")
.RequiresPlayer()
.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);
@ -263,12 +258,16 @@ namespace AriasServerUtils
api.ChatCommands.Create("rtp").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithArgs(parsers.OptionalInt("maxDist", defaultValue: -1)).WithDescription("Seeks a position possibly thousands of blocks away to teleport to.").HandleWith(Events.HandleRTP);
api.ChatCommands.Create("listcooldowns").RequiresPrivilege(Privilege.chat).WithDescription("Lists the cooldown settings on the server, as well as your own active cooldowns if applicable.").HandleWith(Events.HandleListCooldowns);
api.ChatCommands.Create("debugasu_sleepy").RequiresPlayer().RequiresPrivilege(Privilege.controlserver).WithDescription("Debugging command to test the sleeping system").HandleWith(Events.HandleSleepyDebug);
}
private TextCommandResult TestSleep(TextCommandCallingArgs args)
{
// Initiate the sleep process
// Basically run all the same commands as we would on a player in bed
Events.HandleSleepyDebug(args);
OriginalSpeed = API.World.Calendar.CalendarSpeedMul;
if (args.Caller.Player is IServerPlayer isp)
{
@ -361,6 +360,8 @@ namespace AriasServerUtils
});
API.World.Calendar.RemoveTimeSpeedModifier("asu_psp");
API.Logger.Notification("Stopping PSP Time Acceleration");
}
return;
}
@ -422,6 +423,9 @@ namespace AriasServerUtils
EntityBehaviorTiredness EBT = bed.MountedBy.GetBehavior<EntityBehaviorTiredness>();
EBT.IsSleeping = true;
API.Logger.Notification("Starting PSP Time Acceleration");
bed.MountedBy.TryUnmount(); // Stand up. We cant trigger the real sleep phase, but all code for starting time accel has been executed.
}