mirror of
https://github.com/space-syndicate/space-station-14.git
synced 2026-06-09 15:06:34 +02:00
Fix BuyBeforeCondition's Blacklist and remove Whitelist requirement (#44152)
Update BuyBeforeCondition.cs
This commit is contained in:
@@ -9,12 +9,13 @@ public sealed partial class BuyBeforeCondition : ListingCondition
|
||||
/// <summary>
|
||||
/// Required listing(s) needed to purchase before this listing is available
|
||||
/// </summary>
|
||||
[DataField(required: true)]
|
||||
public HashSet<ProtoId<ListingPrototype>> Whitelist;
|
||||
[DataField]
|
||||
public HashSet<ProtoId<ListingPrototype>>? Whitelist;
|
||||
|
||||
/// <summary>
|
||||
/// Listing(s) that if bought, block this purchase, if any.
|
||||
/// </summary>
|
||||
[DataField]
|
||||
public HashSet<ProtoId<ListingPrototype>>? Blacklist;
|
||||
|
||||
public override bool Condition(ListingConditionArgs args)
|
||||
@@ -38,18 +39,22 @@ public sealed partial class BuyBeforeCondition : ListingCondition
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var requiredListing in Whitelist)
|
||||
if (Whitelist != null)
|
||||
{
|
||||
foreach (var listing in allListings)
|
||||
foreach (var requiredListing in Whitelist)
|
||||
{
|
||||
if (listing.ID == requiredListing.Id)
|
||||
foreach (var listing in allListings)
|
||||
{
|
||||
purchasesFound = listing.PurchaseAmount > 0;
|
||||
break;
|
||||
if (listing.ID == requiredListing.Id)
|
||||
{
|
||||
purchasesFound = listing.PurchaseAmount > 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return purchasesFound;
|
||||
}
|
||||
|
||||
return purchasesFound;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user