generated from AriasCreations/vsmodtemplate
Begin to add player sleeping percentage
This commit is contained in:
parent
3e0896f5f9
commit
1f5458b8b1
4 changed files with 21 additions and 2 deletions
|
@ -5,6 +5,7 @@ using Vintagestory.API.Client;
|
||||||
using Vintagestory.API.Common;
|
using Vintagestory.API.Common;
|
||||||
using Vintagestory.API.Common.Entities;
|
using Vintagestory.API.Common.Entities;
|
||||||
using Vintagestory.API.Config;
|
using Vintagestory.API.Config;
|
||||||
|
using Vintagestory.API.MathTools;
|
||||||
using Vintagestory.API.Server;
|
using Vintagestory.API.Server;
|
||||||
using Vintagestory.GameContent;
|
using Vintagestory.GameContent;
|
||||||
|
|
||||||
|
@ -128,6 +129,14 @@ namespace AriasServerUtils
|
||||||
.WithDescription("Max number of back positions cached for players")
|
.WithDescription("Max number of back positions cached for players")
|
||||||
.HandleWith(Events.HandleUpdateASUMaxBack)
|
.HandleWith(Events.HandleUpdateASUMaxBack)
|
||||||
.EndSubCommand()
|
.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()
|
.EndSubCommand()
|
||||||
.BeginSubCommand("help")
|
.BeginSubCommand("help")
|
||||||
.RequiresPrivilege(Privilege.chat)
|
.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);
|
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)
|
public static void NewBackCacheForPlayer(IServerPlayer player)
|
||||||
{
|
{
|
||||||
backCaches.AddPosition(player.PlayerName, PlayerPosition.from(player.Entity));
|
backCaches.AddPosition(player.PlayerName, PlayerPosition.from(player.Entity));
|
||||||
|
|
|
@ -253,6 +253,14 @@ namespace AriasServerUtils
|
||||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal static TextCommandResult HandleUpdateASUPSP(TextCommandCallingArgs args)
|
||||||
|
{
|
||||||
|
if (args[0] is int psp) ServerUtilities.config.PlayerSleepingPercentage = psp;
|
||||||
|
ServerUtilities.MarkDirty();
|
||||||
|
|
||||||
|
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
||||||
|
}
|
||||||
|
|
||||||
internal static TextCommandResult HandleWarp(TextCommandCallingArgs args)
|
internal static TextCommandResult HandleWarp(TextCommandCallingArgs args)
|
||||||
{
|
{
|
||||||
string name = "default";
|
string name = "default";
|
||||||
|
|
|
@ -17,6 +17,7 @@ namespace AriasServerUtils
|
||||||
public bool AdminsBypassMaxHomes { get; set; } = true;
|
public bool AdminsBypassMaxHomes { get; set; } = true;
|
||||||
public bool onlyAdminsCreateWarps { get; set; } = true;
|
public bool onlyAdminsCreateWarps { get; set; } = true;
|
||||||
public int MaxBackCache { get; set; } = 10;
|
public int MaxBackCache { get; set; } = 10;
|
||||||
|
public int PlayerSleepingPercentage { get; set; } = 50;
|
||||||
|
|
||||||
|
|
||||||
public PlayerPosition Spawn { get; set; }
|
public PlayerPosition Spawn { get; set; }
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
"modid": "ariasserverutils",
|
"modid": "ariasserverutils",
|
||||||
"name": "Aria's Server Utilities",
|
"name": "Aria's Server Utilities",
|
||||||
"authors": ["zontreck"],
|
"authors": ["zontreck"],
|
||||||
"description": "A collection of server utilities\n\nBuild Date: 01-18-2025 @ 09:22 PM",
|
"description": "A collection of server utilities\n\nBuild Date: 01-20-2025 @ 12:38 AM MST",
|
||||||
"version": "1.0.3",
|
"version": "1.0.4-dev.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"game": ""
|
"game": ""
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue