mirror of
https://github.com/DeltaV-Station/Delta-v.git
synced 2026-10-04 05:17:28 +00:00
Fix currency duplication bug (#32524) Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
This commit is contained in:
@@ -284,6 +284,9 @@ public sealed partial class StoreSystem
|
||||
/// </remarks>
|
||||
private void OnRequestWithdraw(EntityUid uid, StoreComponent component, StoreRequestWithdrawMessage msg)
|
||||
{
|
||||
if (msg.Amount <= 0)
|
||||
return;
|
||||
|
||||
//make sure we have enough cash in the bank and we actually support this currency
|
||||
if (!component.Balance.TryGetValue(msg.Currency, out var currentAmount) || currentAmount < msg.Amount)
|
||||
return;
|
||||
@@ -307,7 +310,8 @@ public sealed partial class StoreSystem
|
||||
var cashId = proto.Cash[value];
|
||||
var amountToSpawn = (int) MathF.Floor((float) (amountRemaining / value));
|
||||
var ents = _stack.SpawnMultiple(cashId, amountToSpawn, coordinates);
|
||||
_hands.PickupOrDrop(buyer, ents.First());
|
||||
if (ents.FirstOrDefault() is {} ent)
|
||||
_hands.PickupOrDrop(buyer, ent);
|
||||
amountRemaining -= value * amountToSpawn;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user