Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -12,23 +12,13 @@ namespace Server.Movement
|
|||
|
||||
private const TileFlag ImpassableSurface = TileFlag.Impassable | TileFlag.Surface;
|
||||
|
||||
private static bool m_AlwaysIgnoreDoors;
|
||||
private static bool m_IgnoreMovableImpassables;
|
||||
private static bool m_IgnoreSpellFields;
|
||||
private static Point3D m_Goal;
|
||||
public static bool AlwaysIgnoreDoors { get; set; }
|
||||
|
||||
public static bool AlwaysIgnoreDoors{ get => m_AlwaysIgnoreDoors;
|
||||
set => m_AlwaysIgnoreDoors = value;
|
||||
}
|
||||
public static bool IgnoreMovableImpassables{ get => m_IgnoreMovableImpassables;
|
||||
set => m_IgnoreMovableImpassables = value;
|
||||
}
|
||||
public static bool IgnoreSpellFields{ get => m_IgnoreSpellFields;
|
||||
set => m_IgnoreSpellFields = value;
|
||||
}
|
||||
public static Point3D Goal{ get => m_Goal;
|
||||
set => m_Goal = value;
|
||||
}
|
||||
public static bool IgnoreMovableImpassables { get; set; }
|
||||
|
||||
public static bool IgnoreSpellFields { get; set; }
|
||||
|
||||
public static Point3D Goal { get; set; }
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
|
|
@ -120,7 +110,7 @@ namespace Server.Movement
|
|||
int stepTop = startTop + StepHeight;
|
||||
int checkTop = startZ + PersonHeight;
|
||||
|
||||
bool ignoreDoors = ( m_AlwaysIgnoreDoors || !m.Alive || m.Body.BodyID == 0x3DB || m.IsDeadBondedPet );
|
||||
bool ignoreDoors = ( AlwaysIgnoreDoors || !m.Alive || m.Body.BodyID == 0x3DB || m.IsDeadBondedPet );
|
||||
bool ignoreSpellFields = m is PlayerMobile && map != Map.Felucca;
|
||||
|
||||
#region Tiles
|
||||
|
|
@ -311,7 +301,7 @@ namespace Server.Movement
|
|||
List<Item> itemsLeft = m_Pools[2];
|
||||
List<Item> itemsRight = m_Pools[3];
|
||||
|
||||
bool ignoreMovableImpassables = m_IgnoreMovableImpassables;
|
||||
bool ignoreMovableImpassables = IgnoreMovableImpassables;
|
||||
TileFlag reqFlags = ImpassableSurface;
|
||||
|
||||
if ( m.CanSwim )
|
||||
|
|
@ -321,7 +311,7 @@ namespace Server.Movement
|
|||
List<Mobile> mobsLeft = m_MobPools[1];
|
||||
List<Mobile> mobsRight = m_MobPools[2];
|
||||
|
||||
bool checkMobs = ( m is BaseCreature creature && !creature.Controlled && ( xForward != m_Goal.X || yForward != m_Goal.Y ) );
|
||||
bool checkMobs = ( m is BaseCreature creature && !creature.Controlled && ( xForward != Goal.X || yForward != Goal.Y ) );
|
||||
|
||||
if ( checkDiagonals )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,16 +9,15 @@ namespace Server
|
|||
{
|
||||
public sealed class MovementPath
|
||||
{
|
||||
private Map m_Map;
|
||||
private Point3D m_Start;
|
||||
private Point3D m_Goal;
|
||||
private Direction[] m_Directions;
|
||||
public Map Map { get; }
|
||||
|
||||
public Map Map => m_Map;
|
||||
public Point3D Start => m_Start;
|
||||
public Point3D Goal => m_Goal;
|
||||
public Direction[] Directions => m_Directions;
|
||||
public bool Success => ( m_Directions != null && m_Directions.Length > 0 );
|
||||
public Point3D Start { get; }
|
||||
|
||||
public Point3D Goal { get; }
|
||||
|
||||
public Direction[] Directions { get; }
|
||||
|
||||
public bool Success => ( Directions != null && Directions.Length > 0 );
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
@ -33,7 +32,7 @@ namespace Server
|
|||
|
||||
private static void Path( Mobile from, IPoint3D p, PathAlgorithm alg, string name, int zOffset )
|
||||
{
|
||||
m_OverrideAlgorithm = alg;
|
||||
OverrideAlgorithm = alg;
|
||||
|
||||
long start = DateTime.UtcNow.Ticks;
|
||||
MovementPath path = new MovementPath( from, new Point3D( p ) );
|
||||
|
|
@ -70,7 +69,7 @@ namespace Server
|
|||
|
||||
Path( from, p, FastAStarAlgorithm.Instance, "Fast", 0 );
|
||||
Path( from, p, SlowAStarAlgorithm.Instance, "Slow", 2 );
|
||||
m_OverrideAlgorithm = null;
|
||||
OverrideAlgorithm = null;
|
||||
|
||||
/*MovementPath path = new MovementPath( from, new Point3D( p ) );
|
||||
|
||||
|
|
@ -114,22 +113,16 @@ namespace Server
|
|||
}
|
||||
}
|
||||
|
||||
private static PathAlgorithm m_OverrideAlgorithm;
|
||||
|
||||
public static PathAlgorithm OverrideAlgorithm
|
||||
{
|
||||
get => m_OverrideAlgorithm;
|
||||
set => m_OverrideAlgorithm = value;
|
||||
}
|
||||
public static PathAlgorithm OverrideAlgorithm { get; set; }
|
||||
|
||||
public MovementPath( Mobile m, Point3D goal )
|
||||
{
|
||||
Point3D start = m.Location;
|
||||
Map map = m.Map;
|
||||
|
||||
m_Map = map;
|
||||
m_Start = start;
|
||||
m_Goal = goal;
|
||||
Map = map;
|
||||
Start = start;
|
||||
Goal = goal;
|
||||
|
||||
if ( map == null || map == Map.Internal )
|
||||
return;
|
||||
|
|
@ -139,7 +132,7 @@ namespace Server
|
|||
|
||||
try
|
||||
{
|
||||
PathAlgorithm alg = m_OverrideAlgorithm;
|
||||
PathAlgorithm alg = OverrideAlgorithm;
|
||||
|
||||
if ( alg == null )
|
||||
{
|
||||
|
|
@ -150,7 +143,7 @@ namespace Server
|
|||
}
|
||||
|
||||
if ( alg != null && alg.CheckCondition( m, map, start, goal ) )
|
||||
m_Directions = alg.Find( m, map, start, goal );
|
||||
Directions = alg.Find( m, map, start, goal );
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,41 +9,35 @@ namespace Server
|
|||
private static bool Enabled = true;
|
||||
|
||||
private Mobile m_From;
|
||||
private IPoint3D m_Goal;
|
||||
private MovementPath m_Path;
|
||||
private int m_Index;
|
||||
private Point3D m_Next, m_LastGoalLoc;
|
||||
private DateTime m_LastPathTime;
|
||||
private MoveMethod m_Mover;
|
||||
|
||||
public MoveMethod Mover
|
||||
{
|
||||
get => m_Mover;
|
||||
set => m_Mover = value;
|
||||
}
|
||||
public MoveMethod Mover { get; set; }
|
||||
|
||||
public IPoint3D Goal => m_Goal;
|
||||
public IPoint3D Goal { get; }
|
||||
|
||||
public PathFollower( Mobile from, IPoint3D goal )
|
||||
{
|
||||
m_From = from;
|
||||
m_Goal = goal;
|
||||
Goal = goal;
|
||||
}
|
||||
|
||||
public MoveResult Move( Direction d )
|
||||
{
|
||||
if ( m_Mover == null )
|
||||
if ( Mover == null )
|
||||
return ( m_From.Move( d ) ? MoveResult.Success : MoveResult.Blocked );
|
||||
|
||||
return m_Mover( d );
|
||||
return Mover( d );
|
||||
}
|
||||
|
||||
public Point3D GetGoalLocation()
|
||||
{
|
||||
if ( m_Goal is Item item )
|
||||
if ( Goal is Item item )
|
||||
return item.GetWorldLocation();
|
||||
|
||||
return new Point3D( m_Goal );
|
||||
return new Point3D( Goal );
|
||||
}
|
||||
|
||||
private static TimeSpan RepathDelay = TimeSpan.FromSeconds( 2.0 );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue