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);