fix: Removes GetObjectsInRange and fixes boat planks closing (#1579)

## BREAKING CHANGE

- Deletes `map.GetObjectsInRange` and `map.GetObejctsInBounds`

### Notes

Developers are expected to enumerate mobiles and items separately now using `map.GetMobilesInRange` and `map.GetItemsInRange`. This helps keep the code streamlined so we don't have to maintain multiple copies of ref struct enumerators that do the same thing.


### Fixes

- [X] Fixes bug with planks closing
- [X] Fixes issue with iterating items/mobiles from a null map
This commit is contained in:
Kamron Batman 2023-11-03 13:45:18 -07:00 • committed by GitHub
parent cb1638591b
commit 977fdc2c5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 543 additions and 461 deletions

View file

@ -142,29 +142,27 @@ public abstract partial class BaseExplosionPotion : BasePotion
alchemyBonus = (int)(from.Skills.Alchemy.Value / (Core.AOS ? 5 : 10));
}
var eable = map.GetObjectsInRange(loc, ExplosionRange);
using var queue = PooledRefQueue<IEntity>.Create();
var toDamage = 0;
foreach (var entity in eable)
foreach (var mobile in map.GetMobilesInRange(loc, ExplosionRange))
{
if (entity == this)
if (from == null || SpellHelper.ValidIndirectTarget(from, mobile) && from.CanBeHarmful(mobile, false))
{
continue;
++toDamage;
queue.Enqueue(mobile);
}
}
if (entity is Mobile mobile)
if (LeveledExplosion)
{
foreach (var item in map.GetItemsInRange<BaseExplosionPotion>(loc, ExplosionRange))
{
if (from == null || SpellHelper.ValidIndirectTarget(from, mobile) && from.CanBeHarmful(mobile, false))
if (item != this)
{
++toDamage;
queue.Enqueue(entity);
queue.Enqueue(item);
}
}
else if (LeveledExplosion && entity is BaseExplosionPotion)
{
queue.Enqueue(entity);
}
}
var min = Scale(from, MinDamage);