Use query for cargo sell blacklist (#11887)

This commit is contained in:
metalgearsloth
2022-10-16 07:17:03 +11:00
committed by GitHub
parent 2f862312d8
commit 434da2df36

View File

@@ -311,11 +311,12 @@ public sealed partial class CargoSystem
double amount = 0;
var toSell = new HashSet<EntityUid>();
var xformQuery = GetEntityQuery<TransformComponent>();
var blacklistQuery = GetEntityQuery<CargoSellBlacklistComponent>();
foreach (var pallet in GetCargoPallets(component))
{
// Containers should already get the sell price of their children so can skip those.
foreach (var ent in _lookup.GetEntitiesIntersecting(pallet.Owner, LookupFlags.Anchored))
foreach (var ent in _lookup.GetEntitiesIntersecting(pallet.Owner, LookupFlags.Anchored | LookupFlags.Approximate))
{
// Don't re-sell anything, sell anything anchored (e.g. light fixtures), or anything blacklisted
// (e.g. players).
@@ -323,7 +324,7 @@ public sealed partial class CargoSystem
(xformQuery.TryGetComponent(ent, out var xform) && xform.Anchored))
continue;
if (HasComp<CargoSellBlacklistComponent>(ent))
if (blacklistQuery.HasComponent(ent))
continue;
var price = _pricing.GetPrice(ent);