fix: Cleans up movement code (#787)

* Removes FastMovementImpl since it isn't used and I am not convinced it is better.
* Moves some of the new movement logic from FastMovementImpl to MovementImpl
* Makes MovementImpl more readable
This commit is contained in:
Kamron Batman 2021-09-16 23:23:22 -07:00 • committed by GitHub
parent 7785f7e06c
commit 73c65a43ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 312 additions and 989 deletions

View file

@ -692,7 +692,7 @@ namespace Server
var tile = staticTiles[i];
var id = TileData.ItemTable[tile.ID & TileData.MaxItemValue];
if (id.Surface || (id.Flags & TileFlag.Wet) != 0)
if (id.Surface || id.Wet)
{
var tileZ = tile.Z + id.CalcHeight;
@ -720,7 +720,7 @@ namespace Server
{
var id = item.ItemData;
if (id.Surface || (id.Flags & TileFlag.Wet) != 0)
if (id.Surface || id.Wet)
{
var itemZ = item.Z + id.CalcHeight;

View file

@ -104,11 +104,28 @@ namespace Server
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public int CalcHeight => (Flags & TileFlag.Bridge) != 0 ? _height / 2 : _height;
public int CalcHeight => Bridge ? _height / 2 : _height;
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Door
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Door];
set => this[TileFlag.Door] = value;
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Background
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Background];
set => this[TileFlag.Background] = value;
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Bridge
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Bridge];
set => this[TileFlag.Bridge] = value;
}
@ -116,6 +133,7 @@ namespace Server
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Wall
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Wall];
set => this[TileFlag.Wall] = value;
}
@ -123,13 +141,21 @@ namespace Server
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Window
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Window];
set => this[TileFlag.Window] = value;
}
public bool ImpassableSurface
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Impassable | TileFlag.Surface];
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Impassable
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Impassable];
set => this[TileFlag.Impassable] = value;
}
@ -137,6 +163,7 @@ namespace Server
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Surface
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Surface];
set => this[TileFlag.Surface] = value;
}
@ -144,6 +171,7 @@ namespace Server
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Roof
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Roof];
set => this[TileFlag.Roof] = value;
}
@ -151,10 +179,19 @@ namespace Server
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool LightSource
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.LightSource];
set => this[TileFlag.LightSource] = value;
}
[CommandProperty(AccessLevel.GameMaster, AccessLevel.Administrator)]
public bool Wet
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get => this[TileFlag.Wet];
set => this[TileFlag.Wet] = value;
}
public bool this[TileFlag flag]
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]