some further bouncer refinements

This commit is contained in:
jadebenn 2023-12-28 18:21:45 -06:00
parent 5f8f200bfc
commit b83e1bf20d
2 changed files with 4 additions and 20 deletions

View File

@ -976,39 +976,25 @@ void PetComponent::StartInteractBouncer() {
void PetComponent::HandleInteractBouncer() { void PetComponent::HandleInteractBouncer() {
if (IsHandlingInteraction()) { if (IsHandlingInteraction()) {
auto* const owner = GetOwner();
if (!owner) return;
const auto sysAddr = owner->GetSystemAddress();
auto* const petSwitch = SwitchComponent::GetClosestSwitch(m_MovementAI->GetDestination()); // TODO: Find a better way to do this auto* const petSwitch = SwitchComponent::GetClosestSwitch(m_MovementAI->GetDestination()); // TODO: Find a better way to do this
if (!petSwitch) return; if (!petSwitch) return;
auto* const petSwitchEntity = petSwitch->GetParentEntity(); auto* const petSwitchEntity = petSwitch->GetParentEntity();
if (!petSwitchEntity) return; if (!petSwitchEntity) return;
m_Parent->AddCallbackTimer(1.0f, [this, petSwitch, petSwitchEntity, sysAddr]() { m_Parent->AddCallbackTimer(1.0f, [this, petSwitch, petSwitchEntity]() {
LOG_DEBUG("Callback start!"); auto* const bouncerComp = petSwitch->GetPetBouncer();
const auto bouncerComp = petSwitch->GetPetBouncer();
const auto bouncerCompPos = bouncerComp->GetParentEntity()->GetPosition(); const auto bouncerCompPos = bouncerComp->GetParentEntity()->GetPosition();
const auto bouncerId = bouncerComp->GetParentEntity()->GetObjectID(); const auto bouncerId = bouncerComp->GetParentEntity()->GetObjectID();
const auto petId = this->GetParentEntity()->GetObjectID();
RenderComponent::PlayAnimation(petSwitchEntity, u"launch"); //u"engaged");
bouncerComp->SetPetBouncerEnabled(true); bouncerComp->SetPetBouncerEnabled(true);
GameMessages::SendRequestClientBounce(bouncerId, this->GetOwnerId(), NiPoint3::ZERO, NiPoint3::ZERO, bouncerId, true, false, UNASSIGNED_SYSTEM_ADDRESS); //TODO: Check packet captures!! GameMessages::SendRequestClientBounce(bouncerId, this->GetOwnerId(), NiPoint3::ZERO, NiPoint3::ZERO, bouncerId, true, false, UNASSIGNED_SYSTEM_ADDRESS); //TODO: Check packet captures!!
bouncerComp->SetPetBouncerEnabled(false); bouncerComp->SetPetBouncerEnabled(false);
RenderComponent::PlayAnimation(petSwitchEntity, u"up"); RenderComponent::PlayAnimation(petSwitchEntity, u"up");
LOG_DEBUG("Callback end!");
}); });
//RenderComponent::PlayAnimation(petSwitchEntity, u"launch"); //u"engaged"); RenderComponent::PlayAnimation(petSwitchEntity, u"launch"); //u"engaged"); //TODO: Check if the timing on this is right
// TODO: Need to freeze player movement until the bounce begins!
auto* const petBouncer = petSwitch->GetPetBouncer();
petBouncer->SetPetBouncerEnabled(true);
Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, PetEmote::ActivateSwitch, true); // Plays 'jump on switch' animation Command(NiPoint3::ZERO, LWOOBJID_EMPTY, 1, PetEmote::ActivateSwitch, true); // Plays 'jump on switch' animation
StopInteract(); StopInteract();

View File

@ -3590,8 +3590,6 @@ void GameMessages::SendBouncerActiveStatus(LWOOBJID objectId, bool bActive, cons
} }
void GameMessages::SendRequestClientBounce(const LWOOBJID& objectId, const LWOOBJID& bounceTargetId, const NiPoint3& bounceTargetPos, const NiPoint3& bouncedObjLinVel, const LWOOBJID& requestSourceId, const bool bAllBounced, const bool bAllowClientOverload, const SystemAddress& sysAddr) { void GameMessages::SendRequestClientBounce(const LWOOBJID& objectId, const LWOOBJID& bounceTargetId, const NiPoint3& bounceTargetPos, const NiPoint3& bouncedObjLinVel, const LWOOBJID& requestSourceId, const bool bAllBounced, const bool bAllowClientOverload, const SystemAddress& sysAddr) {
LOG_DEBUG("REQUEST CLIENT BOUNCE!");
CBITSTREAM; CBITSTREAM;
CMSGHEADER; CMSGHEADER;