MCPcopy Create free account
hub / github.com/Segs/Segs / setSpawnLocation

Method setSpawnLocation

Projects/CoX/Servers/MapServer/MapInstance.cpp:2505–2520  ·  view source on GitHub ↗

Teleport to a specific SpawnLocation; do nothing if the SpawnLocation is not found.

Source from the content-addressed store, hash-verified

2503
2504// Teleport to a specific SpawnLocation; do nothing if the SpawnLocation is not found.
2505void 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
2522glm::vec3 MapInstance::closest_safe_location(glm::vec3 v) const
2523{

Callers 2

on_enter_doorMethod · 0.80

Calls 5

toCoH_YPRFunction · 0.85
forcePositionFunction · 0.85
forceOrientationFunction · 0.85
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected