doesnt have a component

This commit is contained in:
David Markowitz 2023-06-11 04:39:28 -07:00
parent 5f139c75e0
commit b43e5c2165

View File

@ -257,7 +257,7 @@ void Entity::Initialize() {
AddComponent<BouncerComponent>(); AddComponent<BouncerComponent>();
break; break;
case eReplicaComponentType::DESTROYABLE: case eReplicaComponentType::DESTROYABLE:
if (HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>(); if (!HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>();
break; break;
case eReplicaComponentType::SKILL: case eReplicaComponentType::SKILL:
AddComponent<SkillComponent>(); AddComponent<SkillComponent>();
@ -279,7 +279,7 @@ void Entity::Initialize() {
break; break;
case eReplicaComponentType::COLLECTIBLE: case eReplicaComponentType::COLLECTIBLE:
AddComponent<CollectibleComponent>(); AddComponent<CollectibleComponent>();
if (HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>(); if (!HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>();
break; break;
case eReplicaComponentType::MOVING_PLATFORM: case eReplicaComponentType::MOVING_PLATFORM:
AddComponent<MovingPlatformComponent>(GetVarAsString(u"attached_path")); AddComponent<MovingPlatformComponent>(GetVarAsString(u"attached_path"));
@ -308,7 +308,7 @@ void Entity::Initialize() {
} }
case eReplicaComponentType::MODEL_BEHAVIOR: { case eReplicaComponentType::MODEL_BEHAVIOR: {
AddComponent<ModelBehaviorComponent>(); AddComponent<ModelBehaviorComponent>();
if (HasComponent(eReplicaComponentType::DESTROYABLE)) { if (!HasComponent(eReplicaComponentType::DESTROYABLE)) {
auto* destroyableComponent = AddComponent<DestroyableComponent>(); auto* destroyableComponent = AddComponent<DestroyableComponent>();
if (destroyableComponent) { if (destroyableComponent) {
destroyableComponent->SetHealth(1); destroyableComponent->SetHealth(1);
@ -327,7 +327,7 @@ void Entity::Initialize() {
break; break;
case eReplicaComponentType::QUICK_BUILD: case eReplicaComponentType::QUICK_BUILD:
AddComponent<QuickBuildComponent>(componentId); AddComponent<QuickBuildComponent>(componentId);
if (HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>(); if (!HasComponent(eReplicaComponentType::DESTROYABLE)) AddComponent<DestroyableComponent>();
break; break;
case eReplicaComponentType::SWITCH: case eReplicaComponentType::SWITCH:
AddComponent<SwitchComponent>(); AddComponent<SwitchComponent>();