Account for graph actions being able to delete the entity in ChangeNode.

Fixes an exception that occurs if a node action deletes a construction.
This commit is contained in:
Vera Aguilera Puerto
2022-03-05 10:58:30 +01:00
parent 34385d467e
commit c76414362d
2 changed files with 5 additions and 1 deletions

View File

@@ -140,6 +140,10 @@ namespace Content.Server.Construction
if(performActions)
PerformActions(uid, userUid, node.Actions);
// An action might have deleted the entity... Account for this.
if (!Exists(uid))
return false;
// ChangeEntity will handle the pathfinding update.
if (node.Entity is {} newEntity && ChangeEntity(uid, userUid, newEntity, construction) != null)
return true;