Add direction to the door

This commit is contained in:
2024-10-06 23:21:28 -05:00
parent a1d4b0a1d7
commit 5334f0944e
5 changed files with 66 additions and 6 deletions

View File

@ -129,6 +129,32 @@ void assetMapLoad(
signTextSet(&ent->sign, val->string);
}
break;
case ENTITY_TYPE_DOOR:
val = assetJsonGetObjectValue(jEnt, "door");
if(val != NULL) {
assetjson_t *door = assetJsonGetObjectValue(val, "x");
x = (int32_t)door->number;
assertTrue(
door->type == ASSET_JSON_DATA_TYPE_NUMBER,
"assetMapLoad: Door x is not a number!"
);
door = assetJsonGetObjectValue(val, "y");
y = (int32_t)door->number;
assertTrue(
door->type == ASSET_JSON_DATA_TYPE_NUMBER,
"assetMapLoad: Door y is not a number!"
);
entitydirection_t direction = (entitydirection_t)assetJsonGetObjectValue(
val, "direction"
)->number;
doorDestinationSet(&ent->door, x, y, direction);
}
break;
default:
break;
}
// TODO: Parse any extra data.