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
|
|
@ -64,7 +64,7 @@ public partial class Acid : Item
|
|||
|
||||
using var queue = PooledRefQueue<Mobile>.Create();
|
||||
|
||||
foreach (var m in GetMobilesInRange(0))
|
||||
foreach (var m in GetMobilesAt())
|
||||
{
|
||||
if (m.AccessLevel == AccessLevel.Player &&
|
||||
m.Alive && !m.IsDeadBondedPet && (m is not BaseCreature bc || bc.Controlled || bc.Summoned))
|
||||
|
|
|
|||
|
|
@ -122,9 +122,8 @@ public partial class Firebomb : Item
|
|||
}
|
||||
else if (RootParent == null)
|
||||
{
|
||||
var eable = Map.GetMobilesInRange(Location, 1);
|
||||
using var targets = PooledRefQueue<Mobile>.Create();
|
||||
foreach (var m in eable)
|
||||
foreach (var m in Map.GetMobilesInRange(Location, 1))
|
||||
{
|
||||
if (m_LitBy == null || SpellHelper.ValidIndirectTarget(m_LitBy, m) &&
|
||||
m_LitBy.CanBeHarmful(m, false))
|
||||
|
|
|
|||
|
|
@ -78,8 +78,7 @@ public partial class MorphItem : Item
|
|||
public void Refresh()
|
||||
{
|
||||
var found = false;
|
||||
var eable = GetMobilesInRange(CurrentRange);
|
||||
foreach (var mob in eable)
|
||||
foreach (var mob in GetMobilesInRange(CurrentRange))
|
||||
{
|
||||
if (!mob.Hidden || mob.AccessLevel <= AccessLevel.Player)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue