mindcraft/src/agent/npc/data.js

23 lines
448 B
JavaScript
Raw Normal View History

2024-03-05 12:05:46 -08:00
export class NPCData {
constructor() {
this.goals = [];
2024-03-05 16:40:06 -08:00
this.built = {};
2024-03-05 12:05:46 -08:00
}
toObject() {
return {
2024-03-05 16:40:06 -08:00
goals: this.goals,
built: this.built
2024-03-05 12:05:46 -08:00
}
}
static fromObject(obj) {
if (!obj) return null;
let npc = new NPCData();
2024-03-05 16:40:06 -08:00
if (obj.goals)
npc.goals = obj.goals;
if (obj.built)
npc.built = obj.built;
2024-03-05 12:05:46 -08:00
return npc;
}
}