mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-04-26 22:37:45 +00:00
if player already zoned into instance, don't teleport them back to start on zonein
This commit is contained in:
parent
dcd0d6b0cd
commit
df4ee95cf5
2 changed files with 16 additions and 8 deletions
|
@ -286,15 +286,22 @@ void Core::InstanceContent::onRegisterEObj( Entity::EventObjectPtr object )
|
||||||
|
|
||||||
void Core::InstanceContent::onBeforePlayerZoneIn( Core::Entity::Player& player )
|
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 );
|
if( m_pEntranceEObj != nullptr )
|
||||||
player.setPos( m_pEntranceEObj->getPos() );
|
{
|
||||||
}
|
player.setRot( PI );
|
||||||
else
|
player.setPos( m_pEntranceEObj->getPos() );
|
||||||
{
|
}
|
||||||
player.setRot( PI );
|
else
|
||||||
player.setPos( { 0.f, 0.f, 0.f } );
|
{
|
||||||
|
player.setRot( PI );
|
||||||
|
player.setPos( { 0.f, 0.f, 0.f } );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_spawnedPlayers.insert( player.getId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
player.resetObjSpawnIndex( );
|
player.resetObjSpawnIndex( );
|
||||||
|
|
|
@ -68,6 +68,7 @@ private:
|
||||||
|
|
||||||
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
|
std::map< std::string, Entity::EventObjectPtr > m_eventObjectMap;
|
||||||
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
|
std::unordered_map< uint32_t, Entity::EventObjectPtr > m_eventIdToObjectMap;
|
||||||
|
std::set< uint32_t > m_spawnedPlayers;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue