fix(core): Fixes regions (#642)

This commit is contained in:
Kamron Batman 2021-06-04 23:34:22 -07:00 committed by GitHub
parent 20422e5f11
commit 7ddf2b1a8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 13 deletions

View file

@ -133,6 +133,8 @@ namespace Server
{ {
Map = json.GetProperty("map", options, out Map map) ? map : null; Map = json.GetProperty("map", options, out Map map) ? map : null;
Parent = json.GetProperty("parent", options, out string parent) ? Find(parent, Map) : null; Parent = json.GetProperty("parent", options, out string parent) ? Find(parent, Map) : null;
Name = json.GetProperty("name", options, out string name) ? name : null;
Dynamic = false; Dynamic = false;
if (Parent == null) if (Parent == null)
@ -146,9 +148,7 @@ namespace Server
Priority = Parent.Priority; Priority = Parent.Priority;
} }
Name = json.GetProperty("name", options, out string name) ? name : null; Priority = json.GetProperty("priority", options, out int priority) ? priority : Priority;
Priority = json.GetProperty("priority", options, out int priority) ? priority : 0;
Area = json.GetProperty("rects", options, out List<Rectangle3D> rects) Area = json.GetProperty("rects", options, out List<Rectangle3D> rects)
? rects.ToArray() ? rects.ToArray()
@ -230,15 +230,8 @@ namespace Server
return 1; return 1;
} }
var thisPriority = Priority;
var regPriority = reg.Priority; var regPriority = reg.Priority;
return Priority != regPriority ? reg.Priority - Priority : reg.ChildLevel - ChildLevel;
if (thisPriority != regPriority)
{
return regPriority - thisPriority;
}
return reg.ChildLevel - ChildLevel;
} }
// This is not optimized. Use sparingly // This is not optimized. Use sparingly

View file

@ -1,7 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Text.Json; using System.Text.Json;
using Server.Buffers;
using Server.Gumps; using Server.Gumps;
using Server.Json; using Server.Json;
using Server.Mobiles; using Server.Mobiles;

View file

@ -5,7 +5,6 @@ using System.Text.Json;
using Server.Json; using Server.Json;
using Server.Logging; using Server.Logging;
using Server.Mobiles; using Server.Mobiles;
using Server.Network;
using Server.Utilities; using Server.Utilities;
namespace Server.Regions namespace Server.Regions