Make more uids nullable (#5794)

This commit is contained in:
Leon Friedrich
2021-12-26 15:32:45 +13:00
committed by GitHub
parent 83114de0e4
commit afc3ae6335
42 changed files with 161 additions and 204 deletions

View File

@@ -42,7 +42,7 @@ namespace Content.Server.Stack
public EntityUid? Split(EntityUid uid, int amount, EntityCoordinates spawnPosition, SharedStackComponent? stack = null)
{
if (!Resolve(uid, ref stack))
return default;
return null;
// Get a prototype ID to spawn the new entity. Null is also valid, although it should rarely be picked...
var prototype = _prototypeManager.TryIndex<StackPrototype>(stack.StackTypeId, out var stackType)
@@ -51,7 +51,7 @@ namespace Content.Server.Stack
// Try to remove the amount of things we want to split from the original stack...
if (!Use(uid, amount, stack))
return default;
return null;
// Set the output parameter in the event instance to the newly split stack.
var entity = Spawn(prototype, spawnPosition);