Skip to content

Commit

Permalink
fix: actor stuck on traveling through door
Browse files Browse the repository at this point in the history
  • Loading branch information
RobbeBryssinck committed May 28, 2022
1 parent 7222a5a commit 6cd70c5
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Code/client/Services/Generic/CharacterService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,21 +269,24 @@ void CharacterService::OnAssignCharacter(const AssignCharacterResponse& acMessag
return;
}

auto* const pForm = TESForm::GetById(formIdComponent->Id);
auto* pActor = Cast<Actor>(pForm);
if (!pActor)
{
spdlog::error(__FUNCTION__ ": actor not found, form id: {:X}", formIdComponent->Id);
m_world.destroy(cEntity);
return;
}

if (acMessage.Owner)
{
m_world.emplace<LocalComponent>(cEntity, acMessage.ServerId);
m_world.emplace<LocalAnimationComponent>(cEntity);

pActor->GetExtension()->SetRemote(false);
}
else
{
auto* const pForm = TESForm::GetById(formIdComponent->Id);
auto* pActor = Cast<Actor>(pForm);
if (!pActor)
{
m_world.destroy(cEntity);
return;
}

m_world.emplace_or_replace<RemoteComponent>(cEntity, acMessage.ServerId, formIdComponent->Id);

pActor->GetExtension()->SetRemote(true);
Expand Down

0 comments on commit 6cd70c5

Please sign in to comment.