Airship + Unittest (#496)
* wings * update cargo shuttle * update goblin sound * add new unit test * Update CP14EntityTest.cs * Update CP14RitualTest.cs * add buy and sell hints * paper reading * hardwork * clean task * body forkfiltered * Update crystal.yml * more fork flitered * Update basic.yml * Update wild.yml * Update CP14EntityTest.cs * realise pusharing * pusharing alchemical vials * coin disappear works * Fix
This commit is contained in:
@@ -149,11 +149,6 @@ public sealed partial class CP14CurrencySystem : CP14SharedCurrencySystem
|
||||
args.Verbs.Add(platinumVerb);
|
||||
}
|
||||
|
||||
public HashSet<EntityUid> GenerateMoney(EntProtoId currencyType, int target, EntityCoordinates coordinates)
|
||||
{
|
||||
return GenerateMoney(currencyType, target, coordinates, out _);
|
||||
}
|
||||
|
||||
public HashSet<EntityUid> GenerateMoney(EntProtoId currencyType, int target, EntityCoordinates coordinates, out int remainder)
|
||||
{
|
||||
remainder = target;
|
||||
@@ -189,18 +184,18 @@ public sealed partial class CP14CurrencySystem : CP14SharedCurrencySystem
|
||||
spawns.Add(ent);
|
||||
remainder -= singleCurrency;
|
||||
|
||||
if (TryComp<StackComponent>(ent, out var stack))
|
||||
if (TryComp<StackComponent>(ent, out var stack) && _proto.TryIndex<StackPrototype>(stack.StackTypeId, out var indexedStack))
|
||||
{
|
||||
AdjustStack(ent, stack, singleCurrency, ref remainder);
|
||||
AdjustStack(ent, stack, indexedStack, singleCurrency, ref remainder);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void AdjustStack(EntityUid ent, StackComponent stack, float singleCurrency, ref int remainder)
|
||||
private void AdjustStack(EntityUid ent, StackComponent stack, StackPrototype stackProto, float singleCurrency, ref int remainder)
|
||||
{
|
||||
var singleStackCurrency = singleCurrency / stack.Count;
|
||||
var stackLeftSpace = stack.MaxCountOverride - stack.Count;
|
||||
var stackLeftSpace = stackProto.MaxCount - stack.Count;
|
||||
|
||||
if (stackLeftSpace is not null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user