fix: Changes Map.Sector.Mobiles to link list & Fixes various related crash bugs (#1553)
### Summary
Eliminates `IPooledEnumerable<T>` and `eable.Free()` from `Map` for mobiles. This drastically simplifies code that iterates in range, for example:
```cs
foreach (var m in m.GetMobilesInRange(5))
{
}
```
The code above no longer requires an eable and calling `Free()`.
- [X] Fixed several locations where an NPC that was damaged would cause a server crash.
- [X] Removed an unnecessary allocation in guard fake calls (NPCs calling guards on you)
- [X] Fixes damage precision loss in Poison Strike Spell
- [X] BogThing no longer attempts to "search" for boglings to eat when it is at full health
This commit is contained in:
parent
27f0cec1fa
commit
28c06c1cc0
71 changed files with 796 additions and 591 deletions
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ModernUO.Serialization;
|
||||
using Server.Collections;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.Items;
|
||||
|
|
@ -343,28 +344,13 @@ public abstract partial class BaseDoor : Item, ILockable, ITelekinesisable
|
|||
}
|
||||
}
|
||||
|
||||
var mobs = map.GetSector(x, y).Mobiles;
|
||||
|
||||
for (var i = 0; i < mobs.Count; ++i)
|
||||
foreach (var m in map.GetMobilesAt(x, y))
|
||||
{
|
||||
var m = mobs[i];
|
||||
|
||||
if (m.Location.X == x && m.Location.Y == y)
|
||||
// At the same location, not hidden, or is a player, alive, and within z-bounds - then cannot fit
|
||||
if (m.Location.X == x && m.Location.Y == y &&
|
||||
(!m.Hidden || m.AccessLevel == AccessLevel.Player) && m.Alive && m.Z + 16 > z && z + height > m.Z)
|
||||
{
|
||||
if (m.Hidden && m.AccessLevel > AccessLevel.Player)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!m.Alive)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (m.Z + 16 > z && z + height > m.Z)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue