Teleport to a specific SpawnLocation; do nothing if the SpawnLocation is not found.
| 2503 | |
| 2504 | // Teleport to a specific SpawnLocation; do nothing if the SpawnLocation is not found. |
| 2505 | void MapInstance::setSpawnLocation(Entity &e, const QString &spawnLocation) |
| 2506 | { |
| 2507 | if(m_all_spawners.empty() || !m_all_spawners.contains(spawnLocation)) |
| 2508 | return; |
| 2509 | |
| 2510 | glm::mat4 v = m_all_spawners.values(spawnLocation)[rand() % m_all_spawners.values(spawnLocation).size()]; |
| 2511 | |
| 2512 | // Position |
| 2513 | glm::vec3 spawn_pos = glm::vec3(v[3]); |
| 2514 | |
| 2515 | // Orientation |
| 2516 | auto valquat = glm::quat_cast(v); |
| 2517 | glm::vec3 spawn_pyr = toCoH_YPR(valquat); |
| 2518 | forcePosition(e, spawn_pos); |
| 2519 | forceOrientation(e, spawn_pyr); |
| 2520 | } |
| 2521 | |
| 2522 | glm::vec3 MapInstance::closest_safe_location(glm::vec3 v) const |
| 2523 | { |
no test coverage detected