feat: Adds walk/run restriction configs (#2345)

This commit is contained in:
Bohica 2026-02-28 09:41:40 -08:00 committed by GitHub
parent 5ea926bf1c
commit 36e91b2228
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -30,7 +30,8 @@ public static class StaminaSystem
public static DFAlgorithm DFA { get; set; }
public static int StonesOverweightAllowance { get; set; }
public static bool CannotMoveWhenFatigued { get; set; }
public static bool CannotRunWhenFatigued { get; set; }
public static bool CannotWalkWhenFatigued { get; set; }
public static int StonesPerOverweightLoss { get; set; }
public static int BaseOverweightLoss { get; set; }
public static double AdditionalLossWhenBelow { get; set; }
@ -42,7 +43,8 @@ public static class StaminaSystem
public static void Configure()
{
CannotMoveWhenFatigued = ServerConfiguration.GetOrUpdateSetting("stamina.cannotMoveWhenFatigued", !Core.AOS);
CannotRunWhenFatigued = ServerConfiguration.GetOrUpdateSetting("stamina.cannotRunWhenFatigued", !Core.AOS);
CannotWalkWhenFatigued = ServerConfiguration.GetOrUpdateSetting("stamina.cannotWalkWhenFatigued", false);
StonesPerOverweightLoss = ServerConfiguration.GetOrUpdateSetting("stamina.stonesPerOverweightLoss", 25);
StonesOverweightAllowance = ServerConfiguration.GetOrUpdateSetting("stamina.stonesOverweightAllowance", 4);
BaseOverweightLoss = ServerConfiguration.GetOrUpdateSetting("stamina.baseOverweightLoss", 5);
@ -324,6 +326,13 @@ public static class StaminaSystem
var from = e.Mobile;
var running = (e.Direction & Direction.Running) != 0;
if (CannotWalkWhenFatigued && from.Stam <= 0)
{
from.SendLocalizedMessage(500110); // You are too fatigued to move.
e.Blocked = true;
return;
}
if (overweight > 0)
{
var stamLoss = GetStamLoss(from, overweight, running);
@ -349,7 +358,7 @@ public static class StaminaSystem
--from.Stam;
}
if (CannotMoveWhenFatigued && from.Stam <= 0)
if (CannotRunWhenFatigued && from.Stam <= 0)
{
from.SendLocalizedMessage(500110); // You are too fatigued to move.
e.Blocked = true;