0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 15:53:42 +00:00

interactions work

This commit is contained in:
ineslelin 2025-01-14 22:17:52 +01:00
parent 534fd48093
commit 5ffff57b5f

View File

@ -14,6 +14,9 @@ void InteractionComponent::update() {}
bool InteractionComponent::interact(Entity* interactor, Entity* interactee) bool InteractionComponent::interact(Entity* interactor, Entity* interactee)
{ {
if(interactee == nullptr)
return false;
if(!interactor->hasComponent<InteractionComponent>() || !interactor->getComponent<InteractionComponent>().canInteract) if(!interactor->hasComponent<InteractionComponent>() || !interactor->getComponent<InteractionComponent>().canInteract)
throw std::logic_error("Interactor entity cannot interact"); throw std::logic_error("Interactor entity cannot interact");