Fix some machine construction bugs. (#18179)

This commit is contained in:
Leon Friedrich
2023-07-30 05:29:59 +12:00
committed by GitHub
parent 55f935e3fe
commit 35d6d490f1
4 changed files with 194 additions and 108 deletions

View File

@@ -50,15 +50,15 @@ namespace Content.Server.Stack
if (!Resolve(uid, ref stack))
return null;
// Try to remove the amount of things we want to split from the original stack...
if (!Use(uid, amount, stack))
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)
? stackType.Spawn
: Prototype(uid)?.ID;
// Try to remove the amount of things we want to split from the original stack...
if (!Use(uid, amount, stack))
return null;
// Set the output parameter in the event instance to the newly split stack.
var entity = Spawn(prototype, spawnPosition);