entity pos sets chunk now

This commit is contained in:
2026-07-04 18:43:09 -05:00
parent 589e4224f3
commit 85bf455731
5 changed files with 48 additions and 22 deletions
+1 -7
View File
@@ -35,15 +35,9 @@ errorret_t rpgInit(void) {
assertTrue(entIndex != 0xFF, "No available entity slots!.");
entity_t *ent = &ENTITIES[entIndex];
entityInit(ent, ENTITY_TYPE_PLAYER);
entityPositionSet(ent, (worldpos_t){ 10, 2, 0 });
entityPositionSet(ent, (worldpos_t){ 10, 2, 0 });// Also assigns the chunk.
RPG_CAMERA.mode = RPG_CAMERA_MODE_FOLLOW_ENTITY;
RPG_CAMERA.followEntity.followEntityId = ent->id;
{
chunkpos_t cp;
worldPosToChunkPos(&ent->position, &cp);
chunkindex_t ci = mapGetChunkIndexAt(cp);
if(ci != -1) entitySetChunk(ent, (uint8_t)ci);
}
mapSpawnEntity(3, (worldpos_t){ 8, 8, 1 });