diff --git a/AriasServerUtils/ModSystems/ASUServer.cs b/AriasServerUtils/ModSystems/ASUServer.cs index c5d6d75..31b6bab 100644 --- a/AriasServerUtils/ModSystems/ASUServer.cs +++ b/AriasServerUtils/ModSystems/ASUServer.cs @@ -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; } } diff --git a/AriasServerUtils/assets/ariasserverutils/lang/en.json b/AriasServerUtils/assets/ariasserverutils/lang/en.json index cf23780..162d5a9 100644 --- a/AriasServerUtils/assets/ariasserverutils/lang/en.json +++ b/AriasServerUtils/assets/ariasserverutils/lang/en.json @@ -40,5 +40,8 @@ "rtp-fail": "Giving up on RTP search. No valid position could be found. Try again later", "rtp-capped": "The distance you tried to go [{0}] is greater than the maximum allowable by the server [{1}]", - "cmd-cooldown": "[{0}] is currently on cooldown. You can use this command again in [{1}]" + "cmd-cooldown": "[{0}] is currently on cooldown. You can use this command again in [{1}]", + + "psp": "[ASU] PSP Starting... you do not need to stay in bed", + "psp-ending": "[ASU] PSP Complete" } diff --git a/AriasServerUtils/modinfo.json b/AriasServerUtils/modinfo.json index 3aec4e6..e8035c4 100644 --- a/AriasServerUtils/modinfo.json +++ b/AriasServerUtils/modinfo.json @@ -3,8 +3,8 @@ "modid": "ariasserverutils", "name": "Aria's Server Utilities", "authors": ["zontreck"], - "description": "A collection of server utilities\n\nBuild Date: 03-11-2025 @ 00:37 AM MST", - "version": "1.0.7-dev.3", + "description": "A collection of server utilities\n\nBuild Date: 03-11-2025 @ 00:52 AM MST", + "version": "1.0.7", "dependencies": { "game": "" }