fix: Fixes movement issue (#814)

* Fixes wrong item list used for item detection
This commit is contained in:
Kamron Batman 2021-10-03 19:19:26 -07:00 committed by GitHub
parent a845f8a1c0
commit 8e4d5bb169
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View file

@ -150,6 +150,7 @@ namespace Server
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Impassable | TileFlag.Surface];
set => this[TileFlag.Impassable | TileFlag.Surface] = value;
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]

View file

@ -212,10 +212,14 @@ namespace Server.Movement
continue;
}
if (item.AtWorldPoint(xStart, yStart) || sectorStartIsForward && item.AtWorldPoint(xForward, yForward))
if (item.AtWorldPoint(xStart, yStart))
{
itemsStart.Add(item);
}
else if (sectorStartIsForward && item.AtWorldPoint(xForward, yForward))
{
itemsForward.Add(item);
}
}
if (checkMobs)
@ -619,10 +623,9 @@ namespace Server.Movement
{
var tile = staticTiles[i];
var id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
var calcTop = tile.Z + id.CalcHeight;
if (isSet && calcTop < zCenter || !id.Surface && !(m.CanSwim && id.Wet) || loc.Z < calcTop)
if (isSet && calcTop < zCenter || loc.Z < calcTop || !id.Surface && !(m.CanSwim && id.Wet))
{
continue;
}
@ -648,12 +651,10 @@ namespace Server.Movement
for (var i = 0; i < itemList.Count; ++i)
{
var item = itemList[i];
var id = item.ItemData;
var calcTop = item.Z + id.CalcHeight;
if (isSet && calcTop < zCenter || !id.Surface && !(m.CanSwim && id.Wet) || loc.Z < calcTop)
if (isSet && calcTop < zCenter || loc.Z < calcTop || !id.Surface && !(m.CanSwim && id.Wet))
{
continue;
}