From 74047bcc9caad77e85447ef40bd6d9660e54206b Mon Sep 17 00:00:00 2001 From: jadebenn Date: Fri, 17 Nov 2023 19:29:42 -0600 Subject: [PATCH] Working on pet bouncers --- dGame/dComponents/BouncerComponent.cpp | 3 ++- dGame/dComponents/SwitchComponent.cpp | 13 +++++++++++-- dGame/dComponents/SwitchComponent.h | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/dGame/dComponents/BouncerComponent.cpp b/dGame/dComponents/BouncerComponent.cpp index 56002ac4..49f6757f 100644 --- a/dGame/dComponents/BouncerComponent.cpp +++ b/dGame/dComponents/BouncerComponent.cpp @@ -25,7 +25,8 @@ BouncerComponent::~BouncerComponent() { void BouncerComponent::Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) { outBitStream->Write(m_PetEnabled); if (m_PetEnabled) { - outBitStream->Write(m_PetBouncerEnabled); + LOG("NOPE."); + //outBitStream->Write(m_PetBouncerEnabled); } } diff --git a/dGame/dComponents/SwitchComponent.cpp b/dGame/dComponents/SwitchComponent.cpp index 41dff9f5..9d8cd7bc 100644 --- a/dGame/dComponents/SwitchComponent.cpp +++ b/dGame/dComponents/SwitchComponent.cpp @@ -101,6 +101,15 @@ void SwitchComponent::Update(float deltaTime) { } } +void SwitchComponent::OnUse(Entity* originator) { + LOG("YOU USED ME!"); + m_Parent->TriggerEvent(eTriggerEventType::INTERACT, originator); + + for (CppScripts::Script* script : CppScripts::GetEntityScripts(m_Parent)) { + script->OnUse(m_Parent, originator); + } +} + Entity* SwitchComponent::GetParentEntity() const { return m_Parent; } @@ -126,8 +135,8 @@ void SwitchComponent::SetPetBouncer(BouncerComponent* value) { m_PetBouncer = value; if (value != nullptr) { - m_PetBouncer->SetPetEnabled(true); - petSwitches.push_back(this); + //m_PetBouncer->SetPetEnabled(true); + //petSwitches.push_back(this); //This seems to govern if pets can "see" this } } diff --git a/dGame/dComponents/SwitchComponent.h b/dGame/dComponents/SwitchComponent.h index 25f694ba..f27dc7b0 100644 --- a/dGame/dComponents/SwitchComponent.h +++ b/dGame/dComponents/SwitchComponent.h @@ -23,6 +23,8 @@ public: void Update(float deltaTime) override; + void OnUse(Entity* originator) override; + Entity* GetParentEntity() const; void Serialize(RakNet::BitStream* outBitStream, bool bIsInitialUpdate) override;