| 173 | } |
| 174 | |
| 175 | void ScriptEngine::onNPCInserted(Daedalus::GameState::NpcHandle npc, const std::string& spawnpoint) |
| 176 | { |
| 177 | // LogInfo() << "Created npc " << npc.index <<" on: " << spawnpoint; |
| 178 | |
| 179 | // Create the NPC-vob |
| 180 | Handle::EntityHandle e = VobTypes::initNPCFromScript(m_World, npc); |
| 181 | registerNpc(e); |
| 182 | |
| 183 | VobTypes::NpcVobInformation vob = VobTypes::asNpcVob(m_World, e); |
| 184 | |
| 185 | if (vob.isValid() && !spawnpoint.empty()) |
| 186 | { |
| 187 | if (World::Waynet::waypointExists(m_World.getWaynet(), spawnpoint)) |
| 188 | vob.playerController->teleportToWaypoint(World::Waynet::getWaypointIndex(m_World.getWaynet(), spawnpoint)); |
| 189 | else if(m_World.doesFreepointExist(spawnpoint)) |
| 190 | { |
| 191 | vob.playerController->teleportToPosition(m_World.getFreepointPosition(spawnpoint)); |
| 192 | } else |
| 193 | { |
| 194 | LogError() << "spawnpoint does not exist: " << spawnpoint; |
| 195 | assert(false); |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | Daedalus::GameState::DaedalusGameState& ScriptEngine::getGameState() |
| 201 | { |
nothing calls this directly
no test coverage detected