From 23677b4bd37fd88e86bb4a92f12e018b336c27ff Mon Sep 17 00:00:00 2001 From: Aaron Kimbre Date: Sun, 17 Apr 2022 12:38:12 -0500 Subject: [PATCH] Simplify some stuff Remove render component in startup --- dScripts/WhFans.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/dScripts/WhFans.cpp b/dScripts/WhFans.cpp index da9af43f..b11da6e5 100644 --- a/dScripts/WhFans.cpp +++ b/dScripts/WhFans.cpp @@ -7,22 +7,13 @@ void WhFans::OnStartup(Entity* self) { self->SetVar(u"on", false); ToggleFX(self, false); - - auto* renderComponent = static_cast(self->GetComponent(COMPONENT_TYPE_RENDER)); - - if (renderComponent == nullptr) { - return; - } - - renderComponent->PlayEffect(495, u"fanOn", "fanOn"); } void WhFans::ToggleFX(Entity* self, bool hit) { std::string fanGroup = self->GetGroups()[0]; std::vector fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup); - auto* renderComponent = static_cast(self->GetComponent(COMPONENT_TYPE_RENDER)); - + auto renderComponent = self->GetComponent(); if (renderComponent == nullptr) { return; } @@ -36,7 +27,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) { self->SetVar(u"on", false); for (Entity* volume : fanVolumes) { - PhantomPhysicsComponent* volumePhys = static_cast(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS)); + auto phantomPhysicsComponent = volume->GetComponent(); if (!volumePhys) continue; volumePhys->SetPhysicsEffectActive(false); EntityManager::Instance()->SerializeEntity(volume); @@ -48,7 +39,7 @@ void WhFans::ToggleFX(Entity* self, bool hit) { self->SetVar(u"on", true); for (Entity* volume : fanVolumes) { - PhantomPhysicsComponent* volumePhys = static_cast(volume->GetComponent(COMPONENT_TYPE_PHANTOM_PHYSICS)); + auto phantomPhysicsComponent = volume->GetComponent(); if (!volumePhys) continue; volumePhys->SetPhysicsEffectActive(true); EntityManager::Instance()->SerializeEntity(volume);