fix: Fixes house update range bug (#1790)

This commit is contained in:
Kamron Batman 2024-05-23 16:07:33 -07:00 committed by GitHub
parent 6596046216
commit 0011db7f47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 9 additions and 10 deletions

View file

@ -674,14 +674,14 @@ public static class Utility
InRange(p1.m_X, p1.m_Y, p2.m_X, p2.m_Y, range);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool InUpdateRange(Point2D p1, Point2D p2) => InRange(p1, p2, 18);
public static bool InUpdateRange(Point2D p1, Point2D p2) => InRange(p1, p2, Core.GlobalUpdateRange);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool InRange(Point3D p1, Point3D p2, int range) =>
InRange(p1.m_X, p1.m_Y, p2.m_X, p2.m_Y, range);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool InUpdateRange(Point3D p1, Point3D p2) => InRange(p1, p2, 18);
public static bool InUpdateRange(Point3D p1, Point3D p2) => InRange(p1, p2, Core.GlobalUpdateRange);
// Optimized method for handling 50% random chances in succession up to a maximum
public static int CoinFlips(int amount, int maximum)

View file

@ -265,7 +265,7 @@ namespace Server.Engines.Harvest
Definitions = new[] { OreAndStone, Sand };
}
public static Mining System => _system ?? (_system = new Mining());
public static Mining System => _system ??= new Mining();
public HarvestDefinition OreAndStone { get; }

View file

@ -19,8 +19,7 @@ public abstract partial class QuestGiverItem : Item, IQuestGiver
public override bool Nontransferable => true;
public List<MLQuest> MLQuests => m_MLQuests ??
(m_MLQuests = MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList);
public List<MLQuest> MLQuests => m_MLQuests ??= MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList;
public override void AddNameProperties(IPropertyList list)
{
@ -75,8 +74,7 @@ public abstract partial class TransientQuestGiverItem : TransientItem, IQuestGiv
public override bool Nontransferable => true;
public List<MLQuest> MLQuests => m_MLQuests ??
(m_MLQuests = MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList);
public List<MLQuest> MLQuests => m_MLQuests ??= MLQuestSystem.FindQuestList(GetType()) ?? MLQuestSystem.EmptyList;
public override void HandleInvalidTransfer(Mobile from)
{

View file

@ -716,7 +716,9 @@ namespace Server.Multis
return fromSecures + fromVendors + fromLockdowns + fromMovingCrate;
}
public bool InRange(Point2D from, int range)
public override bool InRange(Point3D from, int range) => InRange(new Point2D(from), range);
public override bool InRange(Point2D from, int range)
{
if (Region == null)
{
@ -725,7 +727,6 @@ namespace Server.Multis
foreach (var rect in Region.Area)
{
// TODO: Convert this to 3D - https://github.com/modernuo/ModernUO/issues/29
if (from.X >= rect.Start.X - range && from.Y >= rect.Start.Y - range && from.X < rect.End.X + range && from.Y < rect.End.Y + range)
{
return true;

View file

@ -201,7 +201,7 @@ namespace Server.Multis
}
}
public static ComponentVerification Verification => m_Verification ?? (m_Verification = new ComponentVerification());
public static ComponentVerification Verification => m_Verification ??= new ComponentVerification();
public bool IsFixture(Item item) => Fixtures.Contains(item);