Make deleting a visited entity not cleaning it up in the mind.
This commit is contained in:
@@ -231,6 +231,9 @@ namespace Content.Server.Mobs
|
||||
{
|
||||
Session?.AttachToEntity(entity);
|
||||
VisitingEntity = entity;
|
||||
|
||||
var comp = entity.AddComponent<VisitingMindComponent>();
|
||||
comp.Mind = this;
|
||||
}
|
||||
|
||||
public void UnVisit()
|
||||
@@ -241,7 +244,14 @@ namespace Content.Server.Mobs
|
||||
}
|
||||
|
||||
Session?.AttachToEntity(OwnedEntity);
|
||||
var oldVisitingEnt = VisitingEntity;
|
||||
// Null this before removing the component to avoid any infinite loops.
|
||||
VisitingEntity = null;
|
||||
|
||||
if (oldVisitingEnt.HasComponent<VisitingMindComponent>())
|
||||
{
|
||||
oldVisitingEnt.RemoveComponent<VisitingMindComponent>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user