This commit is contained in:
Aaron Kimbre 2022-04-18 08:27:37 -05:00
parent 2122448284
commit d05601ce64

View File

@ -10,16 +10,19 @@ void WhFans::OnStartup(Entity* self) {
} }
void WhFans::ToggleFX(Entity* self, bool hit) { void WhFans::ToggleFX(Entity* self, bool hit) {
std::string fanGroup = ""; std::string fanGroup;
try { const auto& groups = self->GetGroups();
fanGroup = self->GetGroups()[0]; if (!groups.empty()) {
} catch(...) { fanGroup = groups[0];
} else {
fanGroup = ""; fanGroup = "";
} }
std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup); std::vector<Entity*> fanVolumes = EntityManager::Instance()->GetEntitiesInGroup(fanGroup);
auto* renderComponent = static_cast<RenderComponent*>(self->GetComponent(COMPONENT_TYPE_RENDER)); auto* renderComponent = self->GetComponent<RenderComponent*>();
if (renderComponent == nullptr) return;
if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return; if (fanVolumes.size() == 0 || !self->GetVar<bool>(u"alive")) return;