fix: toJSON
This commit is contained in:
parent
e00ade960d
commit
c4e798a2a5
|
@ -208,6 +208,15 @@ export default (latus) => class EntityList extends decorate(JsonResource) {
|
|||
}
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
const json = [];
|
||||
for (let i = 0; i < this.#flatEntities.length; i++) {
|
||||
const entity = this.#flatEntities[i];
|
||||
json.push(entity.mergeDiff(entity.toJSON()));
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
toNetwork(informed) {
|
||||
const {areaToInform} = informed;
|
||||
const visibleEntities = this.visibleEntities(areaToInform);
|
||||
|
|
|
@ -240,6 +240,14 @@ export default (latus) => class Layer extends decorate(JsonResource) {
|
|||
// return this.tileEntities[index];
|
||||
// }
|
||||
|
||||
toJSON() {
|
||||
return {
|
||||
entities: this.entityList.toJSON(),
|
||||
tilesetUri: this.tileset.uri,
|
||||
tiles: this.tiles.toJSON(),
|
||||
};
|
||||
}
|
||||
|
||||
toNetwork(informed) {
|
||||
return {
|
||||
entities: this.entityList.toNetwork(informed),
|
||||
|
|
|
@ -108,7 +108,7 @@ export default () => class Tiles extends decorate(Class) {
|
|||
return index < 0 || index >= this.data.length ? undefined : this.data[index];
|
||||
}
|
||||
|
||||
toNetwork() {
|
||||
toJSON() {
|
||||
return {
|
||||
size: this.size,
|
||||
data: this.data,
|
||||
|
|
Loading…
Reference in New Issue
Block a user