NPC full circle.
This commit is contained in:
@ -14,6 +14,8 @@ 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) {
|
||||
@ -28,6 +30,7 @@ void npcInteract(entity_t *player, entity_t *self) {
|
||||
break;
|
||||
|
||||
case NPC_INTERACT_TYPE_TEXT:
|
||||
uiTextboxSetText(languageGet(self->npc.text));
|
||||
break;
|
||||
|
||||
case NPC_INTERACT_TYPE_CONVO:
|
||||
@ -46,29 +49,29 @@ void npcInteract(entity_t *player, entity_t *self) {
|
||||
// "of Darth Plagueis the Wise? He was a dark lord of the Sith, "
|
||||
// "so powerful and so wise he could use the Force to influence the midichlorians"
|
||||
// );
|
||||
const char_t *name = "Dom";
|
||||
const char_t *key = "name";
|
||||
uint16_t len = languageFormat(
|
||||
"test.npc.text",
|
||||
NULL,
|
||||
0,
|
||||
(const char_t *[]){ key },
|
||||
(const char_t *[]){ name },
|
||||
1
|
||||
);
|
||||
// const char_t *name = "Dom";
|
||||
// const char_t *key = "name";
|
||||
// uint16_t len = languageFormat(
|
||||
// "test.npc.text",
|
||||
// NULL,
|
||||
// 0,
|
||||
// (const char_t *[]){ key },
|
||||
// (const char_t *[]){ name },
|
||||
// 1
|
||||
// );
|
||||
|
||||
char_t *buffer = malloc(sizeof(char_t) + len + 1);
|
||||
assertNotNull(buffer, "Failed to allocate buffer for NPC text");
|
||||
// char_t *buffer = malloc(sizeof(char_t) + len + 1);
|
||||
// assertNotNull(buffer, "Failed to allocate buffer for NPC text");
|
||||
|
||||
languageFormat(
|
||||
"test.npc.text",
|
||||
buffer,
|
||||
len + 1,
|
||||
(const char_t *[]){ key },
|
||||
(const char_t *[]){ name },
|
||||
1
|
||||
);
|
||||
// languageFormat(
|
||||
// "test.npc.text",
|
||||
// buffer,
|
||||
// len + 1,
|
||||
// (const char_t *[]){ key },
|
||||
// (const char_t *[]){ name },
|
||||
// 1
|
||||
// );
|
||||
|
||||
uiTextboxSetText(buffer);
|
||||
free(buffer);
|
||||
// uiTextboxSetText(buffer);
|
||||
// free(buffer);
|
||||
}
|
@ -35,6 +35,6 @@ def parseEntity(obj, chunkData):
|
||||
obj['data'] = {}
|
||||
obj['data']['npc'] = {}
|
||||
obj['data']['npc']['interactType'] = 'NPC_INTERACT_TYPE_TEXT'
|
||||
obj['data']['npc']['text'] = '"test"'
|
||||
obj['data']['npc']['text'] = '"test.npc.text"'
|
||||
|
||||
return obj
|
Reference in New Issue
Block a user