generated from AriasCreations/vsmodtemplate
parent
aedef3317c
commit
86ff08b9e7
5 changed files with 113 additions and 0 deletions
|
@ -4,6 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using Vintagestory.API.Common;
|
||||
using Vintagestory.API.Config;
|
||||
using Vintagestory.API.MathTools;
|
||||
using Vintagestory.API.Server;
|
||||
|
||||
namespace AriasServerUtils
|
||||
|
@ -41,6 +42,23 @@ namespace AriasServerUtils
|
|||
|
||||
internal static TextCommandResult HandleRTP(TextCommandCallingArgs args)
|
||||
{
|
||||
if (args.Caller is IServerPlayer isp)
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:rtp-search"));
|
||||
|
||||
PlayerPosition pPos = RTPFactory.GetRandomPosition(isp);
|
||||
if (pPos == null)
|
||||
{
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:rtp-fail"));
|
||||
}
|
||||
Vec2i origin = new((int)isp.Entity.Pos.X, (int)isp.Entity.Pos.Z);
|
||||
Vec2i npos = new(pPos.X, pPos.Z);
|
||||
|
||||
float distance = RTPFactory.GetDistance(origin, npos);
|
||||
|
||||
ServerUtilities.SendMessageTo(isp, Lang.Get($"{ServerUtilities.MOD_ID}:rtp", distance));
|
||||
|
||||
}
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
|
@ -349,5 +367,18 @@ namespace AriasServerUtils
|
|||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
|
||||
internal static TextCommandResult HandleUpdateASURTPMax(TextCommandCallingArgs args)
|
||||
{
|
||||
if (args[0] is int maxDist)
|
||||
{
|
||||
ServerUtilities.config.MaxRTPBlockDistance = maxDist;
|
||||
ServerUtilities.MarkDirty();
|
||||
|
||||
return TextCommandResult.Success(Lang.Get($"{ServerUtilities.MOD_ID}:updatedconfig"));
|
||||
}
|
||||
|
||||
return TextCommandResult.Success();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue