public override void OnPositionChanging(Point3D newPos) { List <Mobile> mlist = new List <Mobile>(World.Mobiles.Values); for (int i = 0; i < mlist.Count; i++) { Mobile m = mlist[i]; if (m != this) { if (!Utility.InRange(m.Position, newPos, VisRange)) { m.Remove(); } else { Targeting.CheckLastTargetRange(m); } } } mlist = null; List <Item> ilist = new List <Item>(World.Items.Values); ScavengerAgent s = ScavengerAgent.Instance; for (int i = 0; i < ilist.Count; i++) { Item item = ilist[i]; if (item.Deleted || item.Container != null) { continue; } int dist = Utility.Distance(item.GetWorldPosition(), newPos); if (item != DragDropManager.Holding && (dist > MultiVisRange || (!item.IsMulti && dist > VisRange))) { item.Remove(); } else if (!IsGhost && Visible && dist <= 2 && s.Enabled && item.Movable) { s.Scavenge(item); } } ilist = null; base.OnPositionChanging(newPos); }
public override void OnPositionChanging(Point3D oldPos) { if (!IsGhost) { StealthSteps.OnMove(); } AutoOpenDoors(false); List <Mobile> mlist = new List <Mobile>(World.Mobiles.Values); for (int i = 0; i < mlist.Count; i++) { Mobile m = mlist[i]; if (m != this) { if (!Utility.InRange(m.Position, Position, VisRange)) { m.Remove(); } else { Targeting.CheckLastTargetRange(m); } } } mlist = null; List <Item> ilist = new List <Item>(World.Items.Values); ScavengerAgent s = ScavengerAgent.Instance; for (int i = 0; i < ilist.Count; i++) { Item item = ilist[i]; if (item.Deleted || item.Container != null) { continue; } int dist = Utility.Distance(item.GetWorldPosition(), Position); if (item != DragDropManager.Holding && (dist > MultiVisRange || (!item.IsMulti && dist > VisRange))) { item.Remove(); } else if (!IsGhost && Visible && dist <= 2 && s.Enabled && item.Movable) { s.Scavenge(item); } } ilist = null; if (Engine.MainWindow != null && Engine.MainWindow.MapWindow != null) { Engine.MainWindow.SafeAction(f => f.MapWindow.PlayerMoved()); } base.OnPositionChanging(oldPos); }