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
|
|
@ -48,8 +48,7 @@ namespace Server.Spells.Fourth
|
|||
pool.Enqueue(directTarget);
|
||||
}
|
||||
|
||||
var eable = map.GetMobilesInRange(loc, 2);
|
||||
foreach (var m in eable)
|
||||
foreach (var m in map.GetMobilesInRange(loc, 2))
|
||||
{
|
||||
if (m != directTarget && AreaCanTarget(m, feluccaRules))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,10 +48,8 @@ namespace Server.Spells.Fourth
|
|||
return;
|
||||
}
|
||||
|
||||
var eable = Caster.Map.GetMobilesInRange(loc, Core.AOS ? 2 : 3);
|
||||
using var targets = PooledRefQueue<Mobile>.Create();
|
||||
|
||||
foreach (var m in eable)
|
||||
foreach (var m in Caster.Map.GetMobilesInRange(loc, Core.AOS ? 2 : 3))
|
||||
{
|
||||
if (Caster.CanBeBeneficial(m, false))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -244,7 +244,7 @@ namespace Server.Spells.Fourth
|
|||
}
|
||||
|
||||
using var queue = PooledRefQueue<Mobile>.Create();
|
||||
foreach (var m in m_Item.GetMobilesInRange(0))
|
||||
foreach (var m in m_Item.GetMobilesAt())
|
||||
{
|
||||
if (m.Z + 16 > m_Item.Z && m_Item.Z + 12 > m.Z && (!Core.AOS || m != caster) &&
|
||||
SpellHelper.ValidIndirectTarget(caster, m) && caster.CanBeHarmful(m, false))
|
||||
|
|
@ -256,10 +256,6 @@ namespace Server.Spells.Fourth
|
|||
while (queue.Count > 0)
|
||||
{
|
||||
var m = queue.Dequeue();
|
||||
if (m == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (SpellHelper.CanRevealCaster(m))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue