45 lines
1.1 KiB
C
45 lines
1.1 KiB
C
/**
|
|
* Copyright (c) 2025 Dominic Masters
|
|
*
|
|
* This software is released under the MIT License.
|
|
* https://opensource.org/licenses/MIT
|
|
*/
|
|
|
|
#include "entity.h"
|
|
#include "ui/uitextbox.h"
|
|
#include "locale/language.h"
|
|
#include "assert/assert.h"
|
|
|
|
void npcLoad(entity_t *entity, const entity_t *source) {
|
|
assertNotNull(entity, "Entity pointer cannot be NULL");
|
|
assertNotNull(source, "Source entity pointer cannot be NULL");
|
|
assertTrue(source->type == ENTITY_TYPE_NPC, "Source entity type must be NPC");
|
|
|
|
entity->npc = source->npc;
|
|
}
|
|
|
|
void npcUpdate(entity_t *entity) {
|
|
}
|
|
|
|
void npcInteract(entity_t *player, entity_t *self) {
|
|
assertTrue(self->type == ENTITY_TYPE_NPC, "Entity must be of type NPC");
|
|
|
|
switch(self->npc.interactType) {
|
|
case NPC_INTERACT_TYPE_NONE:
|
|
break;
|
|
|
|
case NPC_INTERACT_TYPE_TEXT:
|
|
uiTextboxSetText(languageGet(self->npc.text));
|
|
break;
|
|
|
|
case NPC_INTERACT_TYPE_CONVO:
|
|
break;
|
|
|
|
case NPC_INTERACT_TYPE_EVENT:
|
|
eventSetActive(self->npc.eventData);
|
|
break;
|
|
|
|
default:
|
|
assertUnreachable("Unknown NPC interaction type");
|
|
}
|
|
} |