Stack System Cleanup (#38872)
* eye on the prize * OnStackInteractUsing, TryMergeStacks, TryMergeToHands, TryMergeToContacts * namespace * Use, get count, getMaxCount * component access * add regions, mark TODO * obsolete TryAdd, public TryMergeStacks * GetMaxCount * event handlers * event handlers * SetCount * client server event handlers * move to shared * Revert "move to shared" This reverts commit 45540a2d6b8e1e6d2a8f83a584267776c7edcd73. * misc changes to shared * split * spawn and SpawnNextToOrDrop * SpawnMultipleAtPosition, SpawnMultipleNextToOrDrop, CalculateSpawns, general server cleanup * Rename Use to TryUse. * Small misc changes * Remove obsolete functions * Remove some SetCount calls * Partialize * small misc change * don't nuke the git dif with the namespace block * Comments and reordering * touchup to UpdateLingering * Summary comment for StackStatusControl * Last pass * Actual last pass (for now) * I know myself too well * fixup * goodbye lingering * fixes * review * fix test * second look * fix test * forgot * remove early comp getting --------- Co-authored-by: iaada <iaada@users.noreply.github.com> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com>
This commit is contained in:
@@ -1219,7 +1219,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
if (!_stackQuery.TryGetComponent(ent, out var containedStack))
|
||||
continue;
|
||||
|
||||
if (!_stack.TryAdd(insertEnt, ent, insertStack, containedStack))
|
||||
if (!_stack.TryMergeStacks((insertEnt, insertStack), (ent, containedStack), out var _))
|
||||
continue;
|
||||
|
||||
stackedEntity = ent;
|
||||
@@ -1773,7 +1773,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
return GetCumulativeItemAreas(uid) < uid.Comp.Grid.GetArea() || HasSpaceInStacks(uid);
|
||||
}
|
||||
|
||||
private bool HasSpaceInStacks(Entity<StorageComponent?> uid, string? stackType = null)
|
||||
private bool HasSpaceInStacks(Entity<StorageComponent?> uid, ProtoId<StackPrototype>? stackType = null)
|
||||
{
|
||||
if (!Resolve(uid, ref uid.Comp))
|
||||
return false;
|
||||
@@ -1783,7 +1783,7 @@ public abstract class SharedStorageSystem : EntitySystem
|
||||
if (!_stackQuery.TryGetComponent(contained, out var stack))
|
||||
continue;
|
||||
|
||||
if (stackType != null && !stack.StackTypeId.Equals(stackType))
|
||||
if (stackType != null && stack.StackTypeId != stackType)
|
||||
continue;
|
||||
|
||||
if (_stack.GetAvailableSpace(stack) == 0)
|
||||
|
||||
Reference in New Issue
Block a user