mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
give entity-script-server a simulation
This commit is contained in:
parent
6e35c8b804
commit
0a8c640ab5
2 changed files with 12 additions and 2 deletions
|
@ -301,10 +301,17 @@ void EntityScriptServer::run() {
|
|||
|
||||
entityScriptingInterface->setEntityTree(_entityViewer.getTree());
|
||||
|
||||
DependencyManager::set<AssignmentParentFinder>(_entityViewer.getTree());
|
||||
auto treePtr = _entityViewer.getTree();
|
||||
DependencyManager::set<AssignmentParentFinder>(treePtr);
|
||||
|
||||
if (!_entitySimulation) {
|
||||
SimpleEntitySimulationPointer simpleSimulation { new SimpleEntitySimulation() };
|
||||
simpleSimulation->setEntityTree(treePtr);
|
||||
treePtr->setSimulation(simpleSimulation);
|
||||
_entitySimulation = simpleSimulation;
|
||||
}
|
||||
|
||||
auto tree = _entityViewer.getTree().get();
|
||||
auto tree = treePtr.get();
|
||||
connect(tree, &EntityTree::deletingEntity, this, &EntityScriptServer::deletingEntity, Qt::QueuedConnection);
|
||||
connect(tree, &EntityTree::addingEntity, this, &EntityScriptServer::addingEntity, Qt::QueuedConnection);
|
||||
connect(tree, &EntityTree::entityServerScriptChanging, this, &EntityScriptServer::entityServerScriptChanging, Qt::QueuedConnection);
|
||||
|
@ -451,6 +458,7 @@ void EntityScriptServer::resetEntitiesScriptEngine() {
|
|||
|
||||
connect(newEngine.data(), &ScriptEngine::update, this, [this] {
|
||||
_entityViewer.queryOctree();
|
||||
_entityViewer.getTree()->preUpdate();
|
||||
_entityViewer.getTree()->update();
|
||||
});
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <EntityEditPacketSender.h>
|
||||
#include <plugins/CodecPlugin.h>
|
||||
#include <ScriptEngine.h>
|
||||
#include <SimpleEntitySimulation.h>
|
||||
#include <ThreadedAssignment.h>
|
||||
#include "../entities/EntityTreeHeadlessViewer.h"
|
||||
|
||||
|
@ -75,6 +76,7 @@ private:
|
|||
|
||||
static int _entitiesScriptEngineCount;
|
||||
ScriptEnginePointer _entitiesScriptEngine;
|
||||
SimpleEntitySimulationPointer _entitySimulation;
|
||||
EntityEditPacketSender _entityEditSender;
|
||||
EntityTreeHeadlessViewer _entityViewer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue