1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-26 14:37:44 +00:00

if player already zoned into instance, don't teleport them back to start on zonein

This commit is contained in:
Adam 2018-03-06 14:26:21 +11:00
parent dcd0d6b0cd
commit df4ee95cf5
2 changed files with 16 additions and 8 deletions

View file

@ -286,15 +286,22 @@ void Core::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object )
void Core::InstanceContent::onBeforePlayerZoneIn( Core::Entity::Player& player )
{
if( m_pEntranceEObj != nullptr )
// if a player has already spawned once inside this instance, don't move them if they happen to zone in again
auto it = m_spawnedPlayers.find( player.getId() );
if( it == m_spawnedPlayers.end() )
{
player.setRot( PI );
player.setPos( m_pEntranceEObj->getPos() );
}
else
{
player.setRot( PI );
player.setPos( { 0.f, 0.f, 0.f } );
if( m_pEntranceEObj != nullptr )
{
player.setRot( PI );
player.setPos( m_pEntranceEObj->getPos() );
}
else
{
player.setRot( PI );
player.setPos( { 0.f, 0.f, 0.f } );
}
m_spawnedPlayers.insert( player.getId() );
}
player.resetObjSpawnIndex( );

View file

@ -68,6 +68,7 @@ private:
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
std::set< uint32_t > m_spawnedPlayers;
};
}