clear the entity viewer before restarting ESS script engine

This commit is contained in:
Stephen Birarda 2017-02-26 09:38:51 -08:00
parent 4925b3c47c
commit f213b32167

View file

@ -324,16 +324,8 @@ void EntityScriptServer::nodeActivated(SharedNodePointer activatedNode) {
void EntityScriptServer::nodeKilled(SharedNodePointer killedNode) { void EntityScriptServer::nodeKilled(SharedNodePointer killedNode) {
switch (killedNode->getType()) { switch (killedNode->getType()) {
case NodeType::EntityServer: { case NodeType::EntityServer: {
if (!_shuttingDown) { clear();
if (_entitiesScriptEngine) {
_entitiesScriptEngine->unloadAllEntityScripts();
_entitiesScriptEngine->stop();
}
resetEntitiesScriptEngine();
_entityViewer.clear();
}
break; break;
} }
case NodeType::Agent: { case NodeType::Agent: {
@ -440,12 +432,12 @@ void EntityScriptServer::clear() {
_entitiesScriptEngine->stop(); _entitiesScriptEngine->stop();
} }
_entityViewer.clear();
// reset the engine // reset the engine
if (!_shuttingDown) { if (!_shuttingDown) {
resetEntitiesScriptEngine(); resetEntitiesScriptEngine();
} }
_entityViewer.clear();
} }
void EntityScriptServer::shutdownScriptEngine() { void EntityScriptServer::shutdownScriptEngine() {