Begin to add player sleeping percentage

This commit is contained in:
zontreck 2025-01-20 04:10:17 -07:00
parent 3e0896f5f9
commit 1f5458b8b1
4 changed files with 21 additions and 2 deletions

View file

@ -5,6 +5,7 @@ using Vintagestory.API.Client;
using Vintagestory.API.Common;
using Vintagestory.API.Common.Entities;
using Vintagestory.API.Config;
using Vintagestory.API.MathTools;
using Vintagestory.API.Server;
using Vintagestory.GameContent;
@ -128,6 +129,14 @@ namespace AriasServerUtils
.WithDescription("Max number of back positions cached for players")
.HandleWith(Events.HandleUpdateASUMaxBack)
.EndSubCommand()
.BeginSubCommand("playerSleepingPercentage")
.RequiresPrivilege(Privilege.controlserver)
.WithArgs(
parsers.OptionalIntRange("psp", 1, 100, 50)
)
.WithDescription("Percentage of players required to sleep before sleeping through the night")
.HandleWith(Events.HandleUpdateASUPSP)
.EndSubCommand()
.EndSubCommand()
.BeginSubCommand("help")
.RequiresPrivilege(Privilege.chat)
@ -143,6 +152,7 @@ namespace AriasServerUtils
api.ChatCommands.Create("back").RequiresPlayer().RequiresPrivilege(Privilege.chat).WithDescription("Returns you to the last location you were at").HandleWith(Events.HandleBack);
}
public static void NewBackCacheForPlayer(IServerPlayer player)
{
backCaches.AddPosition(player.PlayerName, PlayerPosition.from(player.Entity));