Allow cargo bounties to be sold off-station (#26469)
* Ported over code for delta-v to fix bounties * Added requested changes * Removed the station arg from "IsBountyComplete". It is unneeded and all calls just use a null value for it anyways
This commit is contained in:
@@ -230,9 +230,8 @@ public sealed partial class CargoSystem
|
||||
|
||||
#region Station
|
||||
|
||||
private bool SellPallets(EntityUid gridUid, EntityUid? station, out double amount)
|
||||
private bool SellPallets(EntityUid gridUid, out double amount)
|
||||
{
|
||||
station ??= _station.GetOwningStation(gridUid);
|
||||
GetPalletGoods(gridUid, out var toSell, out amount);
|
||||
|
||||
Log.Debug($"Cargo sold {toSell.Count} entities for {amount}");
|
||||
@@ -240,11 +239,9 @@ public sealed partial class CargoSystem
|
||||
if (toSell.Count == 0)
|
||||
return false;
|
||||
|
||||
if (station != null)
|
||||
{
|
||||
var ev = new EntitySoldEvent(station.Value, toSell);
|
||||
RaiseLocalEvent(ref ev);
|
||||
}
|
||||
|
||||
var ev = new EntitySoldEvent(toSell);
|
||||
RaiseLocalEvent(ref ev);
|
||||
|
||||
foreach (var ent in toSell)
|
||||
{
|
||||
@@ -299,7 +296,7 @@ public sealed partial class CargoSystem
|
||||
return false;
|
||||
}
|
||||
|
||||
var complete = IsBountyComplete(uid, (EntityUid?) null, out var bountyEntities);
|
||||
var complete = IsBountyComplete(uid, out var bountyEntities);
|
||||
|
||||
// Recursively check for mobs at any point.
|
||||
var children = xform.ChildEnumerator;
|
||||
@@ -332,7 +329,7 @@ public sealed partial class CargoSystem
|
||||
return;
|
||||
}
|
||||
|
||||
if (!SellPallets(gridUid, null, out var price))
|
||||
if (!SellPallets(gridUid, out var price))
|
||||
return;
|
||||
|
||||
var stackPrototype = _protoMan.Index<StackPrototype>(component.CashType);
|
||||
@@ -354,4 +351,4 @@ public sealed partial class CargoSystem
|
||||
/// deleted but after the price has been calculated.
|
||||
/// </summary>
|
||||
[ByRefEvent]
|
||||
public readonly record struct EntitySoldEvent(EntityUid Station, HashSet<EntityUid> Sold);
|
||||
public readonly record struct EntitySoldEvent(HashSet<EntityUid> Sold);
|
||||
|
||||
Reference in New Issue
Block a user