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:
parent
cb1638591b
commit
977fdc2c5a
21 changed files with 543 additions and 461 deletions
|
|
@ -751,29 +751,47 @@ namespace Server.Multis
|
|||
vendor = false;
|
||||
rentalContract = false;
|
||||
|
||||
var eable = map.GetObjectsInRange(location, 0);
|
||||
|
||||
foreach (var entity in eable)
|
||||
foreach (var m in map.GetMobilesAt(location))
|
||||
{
|
||||
if ((location.Z - entity.Z).Abs() <= 16)
|
||||
if ((location.Z - m.Z).Abs() <= 16 && m is PlayerVendor or PlayerBarkeeper)
|
||||
{
|
||||
if (entity is PlayerVendor or PlayerBarkeeper or PlayerVendorPlaceholder)
|
||||
vendor = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in map.GetItemsAt(location))
|
||||
{
|
||||
if ((location.Z - item.Z).Abs() <= 16)
|
||||
{
|
||||
if (item is PlayerVendorPlaceholder)
|
||||
{
|
||||
vendor = true;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (entity is VendorRentalContract)
|
||||
if (item is VendorRentalContract)
|
||||
{
|
||||
rentalContract = true;
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Mobile> AvailableVendorsFor(Mobile m) =>
|
||||
PlayerVendors.Where(vendor => vendor.CanInteractWith(m, false)).ToList<Mobile>();
|
||||
public List<Mobile> AvailableVendorsFor(Mobile m)
|
||||
{
|
||||
List<Mobile> list = new List<Mobile>();
|
||||
foreach (PlayerVendor vendor in PlayerVendors)
|
||||
{
|
||||
if (vendor.CanInteractWith(m, false))
|
||||
{
|
||||
list.Add(vendor);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
public bool AreThereAvailableVendorsFor(Mobile m)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue