mirror of
https://github.com/DaanVandenBosch/phantasmal-world.git
synced 2025-04-05 15:28:29 +08:00
Fixed a bug in area variants computation.
This commit is contained in:
parent
ecbab0637d
commit
cf1cd26c41
@ -95,34 +95,42 @@ export class ObservableQuest {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@observable.ref private _map_designations!: Map<number, number>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map of area IDs to area variant IDs. One designation per area.
|
* Map of area IDs to area variant IDs. One designation per area.
|
||||||
*/
|
*/
|
||||||
@observable map_designations: Map<number, number>;
|
get map_designations(): Map<number, number> {
|
||||||
|
return this._map_designations;
|
||||||
|
}
|
||||||
|
|
||||||
|
set_map_designations(map_designations: Map<number, number>): void {
|
||||||
|
this._map_designations = map_designations;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* One variant per area.
|
* One variant per area.
|
||||||
*/
|
*/
|
||||||
@computed get area_variants(): ObservableAreaVariant[] {
|
@computed get area_variants(): ObservableAreaVariant[] {
|
||||||
const variants: ObservableAreaVariant[] = [];
|
const variants = new Map<number, ObservableAreaVariant>();
|
||||||
|
|
||||||
for (const area_id of this.entities_per_area.keys()) {
|
for (const area_id of this.entities_per_area.keys()) {
|
||||||
try {
|
try {
|
||||||
variants.push(area_store.get_variant(this.episode, area_id, 0));
|
variants.set(area_id, area_store.get_variant(this.episode, area_id, 0));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(e);
|
logger.warn(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const [area_id, variant_id] of this.map_designations) {
|
for (const [area_id, variant_id] of this._map_designations) {
|
||||||
try {
|
try {
|
||||||
variants.push(area_store.get_variant(this.episode, area_id, variant_id));
|
variants.set(area_id, area_store.get_variant(this.episode, area_id, variant_id));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warn(e);
|
logger.warn(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return variants;
|
return [...variants.values()];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -160,7 +168,7 @@ export class ObservableQuest {
|
|||||||
this.set_short_description(short_description);
|
this.set_short_description(short_description);
|
||||||
this.set_long_description(long_description);
|
this.set_long_description(long_description);
|
||||||
this.episode = episode;
|
this.episode = episode;
|
||||||
this.map_designations = map_designations;
|
this.set_map_designations(map_designations);
|
||||||
this.objects = objects;
|
this.objects = objects;
|
||||||
this.npcs = npcs;
|
this.npcs = npcs;
|
||||||
this.dat_unknowns = dat_unknowns;
|
this.dat_unknowns = dat_unknowns;
|
||||||
|
@ -66,12 +66,15 @@ export class QuestRenderer extends Renderer<PerspectiveCamera> {
|
|||||||
|
|
||||||
const model_manager = new QuestModelManager(this);
|
const model_manager = new QuestModelManager(this);
|
||||||
|
|
||||||
autorun(() => {
|
autorun(
|
||||||
|
() => {
|
||||||
model_manager.load_models(
|
model_manager.load_models(
|
||||||
quest_editor_store.current_quest,
|
quest_editor_store.current_quest,
|
||||||
quest_editor_store.current_area,
|
quest_editor_store.current_area,
|
||||||
);
|
);
|
||||||
});
|
},
|
||||||
|
{ name: "call load_models" },
|
||||||
|
);
|
||||||
|
|
||||||
this.entity_controls = new QuestEntityControls(this);
|
this.entity_controls = new QuestEntityControls(this);
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { observable } from "mobx";
|
import { action, observable } from "mobx";
|
||||||
import { editor } from "monaco-editor";
|
import { editor } from "monaco-editor";
|
||||||
import AssemblyWorker from "worker-loader!./assembly_worker";
|
import AssemblyWorker from "worker-loader!./assembly_worker";
|
||||||
import {
|
import {
|
||||||
@ -38,12 +38,13 @@ export class AssemblyAnalyser {
|
|||||||
this.worker.terminate();
|
this.worker.terminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
private process_worker_message = (e: MessageEvent): void => {
|
private process_worker_message = (e: MessageEvent): void => {
|
||||||
const message: AssemblyWorkerOutput = e.data;
|
const message: AssemblyWorkerOutput = e.data;
|
||||||
|
|
||||||
if (message.type === "new_object_code_output" && this.quest) {
|
if (message.type === "new_object_code_output" && this.quest) {
|
||||||
this.quest.object_code.splice(0, this.quest.object_code.length, ...message.object_code);
|
this.quest.object_code.splice(0, this.quest.object_code.length, ...message.object_code);
|
||||||
this.quest.map_designations = message.map_designations;
|
this.quest.set_map_designations(message.map_designations);
|
||||||
this.warnings = message.warnings;
|
this.warnings = message.warnings;
|
||||||
this.errors = message.errors;
|
this.errors = message.errors;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user