BlueGit

timfa questward

Files

questward / server / src / quests / runtime.js

runtime.js

runtime.js 22.2 KiB Download Raw
1import { evaluateConditionSet, EffectKind } from "../../../shared/quests/conditions.js";
2import { normalizeInitialQuests } from "../../../shared/quests/initialQuests.js";
3import { countItemInSlots, insertStack, takeMatchingFromSlots, insertStackGrowable } from "../../../shared/items/inventory.js";
4import { attachOrigins, godsOrigin } from "../../../shared/items/origin.js";
5import { itemDefinition } from "../../../shared/definitions/items.js";
6import { applySkillXp } from "../../../shared/skills/state.js";
7import { skillLevel } from "../../../shared/definitions/skills.js";
8import { formatDialogueRewardMessage } from "../../../shared/quests/dialogueRewards.js";
9import { CHUNK_SIZE } from "../../../shared/protocol/constants.js";
10import { floorDiv } from "../world/coordinates.js";
11import { WorkerMessage } from "../simulation/protocol.js";
12
13/**
14 * Quest progress + dialogue sessions (main simulation thread).
15 */
16export class QuestRuntime
17{
18 constructor ({ stateDb, content, simulation })
19 {
20 this.stateDb = stateDb;
21 this.content = content;
22 this.simulation = simulation;
23 /** @type {Map<number, { entityId: number, dialogueId: string, stepId: string }>} */
24 this.sessions = new Map();
25 }
26
27 reloadContent ()
28 {
29 this.content.reload();
30 }
31
32 closeAllSessions ()
33 {
34 for (const characterId of [...this.sessions.keys()])
35 { this.closeDialogue(characterId, "revision"); }
36 }
37
38 questSnapshot (characterId)
39 {
40 const states = this.stateDb.listQuestStates(characterId)
41 .filter((row) => row.state !== "not-started");
42 const quests = [];
43 for (const row of states)
44 {
45 const def = this.content.quest(row.questId);
46 if (!def)
47 {
48 quests.push({
49 questId: row.questId,
50 title: "Quest unavailable",
51 orphaned: true,
52 state: row.state,
53 description: "",
54 step: null,
55 journal: this.stateDb.listQuestJournal(characterId, row.questId).map(journalPublic)
56 });
57 continue;
58 }
59 const stepIndex = typeof row.state === "number" ? row.state : null;
60 const stepDef = stepIndex != null ? def.steps[stepIndex - 1] : null;
61 const completedObjectiveIds = row.progress?.completedObjectiveIds ?? [];
62 quests.push({
63 questId: def.questId,
64 title: def.title,
65 orphaned: false,
66 state: row.state,
67 description: def.description,
68 step: stepDef
69 ? {
70 stepId: stepDef.stepId,
71 title: stepDef.title,
72 description: stepDef.description,
73 objectives: stepDef.objectives.map((obj) => ({
74 objectiveId: obj.objectiveId,
75 text: obj.text,
76 done: completedObjectiveIds.includes(obj.objectiveId)
77 }))
78 }
79 : null,
80 journal: this.stateDb.listQuestJournal(characterId, def.questId).map(journalPublic)
81 });
82 }
83 quests.sort((a, b) =>
84 {
85 const aDone = a.state === "completed" ? 1 : 0;
86 const bDone = b.state === "completed" ? 1 : 0;
87 if (aDone !== bDone)
88 { return aDone - bDone; }
89 return String(a.title).localeCompare(String(b.title));
90 });
91 return { quests };
92 }
93
94 playerViewFor (characterId)
95 {
96 const entityId = this.simulation.characterEntities.get(characterId | 0);
97 const record = entityId != null ? this.simulation.directory.get(entityId) : null;
98 const skills = this.stateDb.getSkills(characterId) ?? {};
99 let hp = 1;
100 let maxHp = 1;
101 let stamina = 1;
102 let maxStamina = 1;
103 if (entityId != null && record)
104 {
105 const staminaComp = this.simulation.staminaOf(entityId);
106 if (staminaComp)
107 {
108 stamina = Number(staminaComp.current) || 0;
109 maxStamina = Math.max(1, Number(staminaComp.max) || 1);
110 }
111 const worker = this.simulation.workers[record.workerId];
112 const view = worker?.call?.({
113 type: WorkerMessage.inspect,
114 entityId
115 });
116 if (view && view.health != null)
117 {
118 hp = Number(view.health) || 0;
119 maxHp = Math.max(1, Number(view.maxHealth) || 1);
120 }
121 }
122 return {
123 tileX: record?.tileX | 0,
124 tileY: record?.tileY | 0,
125 dimensionId: record?.dimensionId ?? "overworld",
126 skills,
127 hp,
128 maxHp,
129 stamina,
130 maxStamina
131 };
132 }
133
134 buildConditionContext (characterId, playerView, activeQuestId = null)
135 {
136 const bag = this.#loadBag(characterId);
137 const inventory = bag?.inventory ?? [];
138 const tileX = playerView?.tileX | 0;
139 const tileY = playerView?.tileY | 0;
140 const dimensionId = playerView?.dimensionId ?? "overworld";
141 const chunkX = floorDiv(tileX, CHUNK_SIZE);
142 const chunkY = floorDiv(tileY, CHUNK_SIZE);
143 const questRow = activeQuestId ? this.stateDb.getQuestState(characterId, activeQuestId) : null;
144 return {
145 tileX,
146 tileY,
147 chunkX,
148 chunkY,
149 dimensionId,
150 hp: playerView?.hp ?? 0,
151 maxHp: playerView?.maxHp ?? 1,
152 stamina: playerView?.stamina ?? 0,
153 maxStamina: playerView?.maxStamina ?? 1,
154 countItem: (itemId) => countItemInSlots(inventory, itemId | 0),
155 questState: (questId) => this.stateDb.getQuestState(characterId, questId).state,
156 dialogueHeard: (dialogueId, stepId) => this.stateDb.isDialogueHeard(characterId, dialogueId, stepId),
157 dialogueTriggerLatched: (dialogueId, trigger) =>
158 this.stateDb.isDialogueTriggerLatched(characterId, dialogueId, trigger),
159 skillLevel: (skillId) => skillLevel(playerView?.skills ?? {}, skillId),
160 hasVisitedDimension: (dimId) => this.stateDb.hasVisitedDimension(characterId, dimId),
161 killCount: (condition) =>
162 {
163 if (!questRow)
164 { return 0; }
165 return questRow.progress?.counters?.[killKey(condition)] | 0;
166 },
167 interactBlockDone: (condition) =>
168 {
169 if (!questRow)
170 { return false; }
171 return !!questRow.progress?.interacts?.[interactKey(condition)];
172 }
173 };
174 }
175
176 tryOpenDialogue (characterId, entityId, dialogueId)
177 {
178 const tree = this.content.dialogue(dialogueId);
179 if (!tree)
180 { return { ok: false, error: "Nothing to say." }; }
181 this.closeDialogue(characterId, "replace");
182 const playerView = this.playerViewFor(characterId);
183 return this.#enterStep(characterId, entityId, tree, tree.entryStepId, playerView);
184 }
185
186 chooseDialogue (characterId, triggerId)
187 {
188 const session = this.sessions.get(characterId | 0);
189 if (!session)
190 { return { ok: false, error: "No dialogue open." }; }
191 if (session.phase === "lines")
192 { return { ok: false, error: "Finish reading first." }; }
193 if (session.phase === "rewards")
194 { return { ok: false, error: "Finish reading first." }; }
195 const tree = this.content.dialogue(session.dialogueId);
196 if (!tree)
197 {
198 this.closeDialogue(characterId, "missing");
199 return { ok: false, error: "Dialogue missing." };
200 }
201 const step = tree.steps.find((s) => s.stepId === session.stepId);
202 if (!step || step.exit?.kind !== "triggers")
203 { return { ok: false, error: "Cannot choose now." }; }
204 const trigger = step.exit.triggers.find((t) => t.trigger === String(triggerId));
205 if (!trigger)
206 { return { ok: false, error: "Unknown choice." }; }
207 const playerView = this.playerViewFor(characterId);
208 const ctx = this.buildConditionContext(characterId, playerView);
209 if (!evaluateConditionSet(trigger.when, ctx))
210 { return { ok: false, error: "That choice is unavailable." }; }
211 this.stateDb.latchDialogueTrigger(characterId, tree.dialogueId, trigger.trigger);
212 const events = [];
213 this.#applyEffects(characterId, trigger.effects, playerView, events);
214 this.#reevaluateQuests(characterId, playerView, events);
215 if (!trigger.nextStepId)
216 {
217 const npcEntityId = session.entityId;
218 this.sessions.delete(characterId | 0);
219 events.push({ type: "dialogueClose", reason: "end", npcEntityId });
220 return { ok: true, events };
221 }
222 return this.#enterStep(characterId, session.entityId, tree, trigger.nextStepId, playerView, events);
223 }
224
225 closeDialogue (characterId, reason = "close")
226 {
227 const id = characterId | 0;
228 const session = this.sessions.get(id);
229 if (!session)
230 { return { events: [] }; }
231 this.sessions.delete(id);
232 return {
233 events: [{
234 type: "dialogueClose",
235 reason,
236 npcEntityId: session.entityId
237 }]
238 };
239 }
240
241 interruptDialogueForEntity (entityId)
242 {
243 const events = [];
244 for (const [characterId, session] of [...this.sessions])
245 {
246 if (session.entityId === (entityId | 0))
247 {
248 const closed = this.closeDialogue(characterId, "attacked");
249 events.push(...closed.events.map((e) => ({ ...e, characterId })));
250 }
251 }
252 return events;
253 }
254
255 #enterStep (characterId, entityId, tree, stepId, playerView, priorEvents = [])
256 {
257 const step = tree.steps.find((s) => s.stepId === stepId);
258 if (!step)
259 {
260 this.sessions.delete(characterId | 0);
261 priorEvents.push({ type: "dialogueClose", reason: "missing-step" });
262 return { ok: false, error: "Broken dialogue.", events: priorEvents };
263 }
264 this.stateDb.markDialogueHeard(characterId, tree.dialogueId, step.stepId);
265 const events = [...priorEvents];
266 const linePayloads = [];
267 for (const line of step.lines)
268 {
269 this.#applyEffects(characterId, line.effects, playerView, events);
270 linePayloads.push({ speaker: line.speaker, text: line.text });
271 }
272 // Stay open while the client pages lines; resolve exit only on dialogueAdvance.
273 this.sessions.set(characterId | 0, {
274 entityId: entityId | 0,
275 dialogueId: tree.dialogueId,
276 stepId: step.stepId,
277 phase: "lines",
278 pendingExit: step.exit ?? { kind: "end" }
279 });
280 events.push({
281 type: "dialogueStep",
282 dialogueId: tree.dialogueId,
283 stepId: step.stepId,
284 label: step.label,
285 npcEntityId: entityId | 0,
286 lines: linePayloads
287 });
288 this.#reevaluateQuests(characterId, playerView, events);
289 return { ok: true, events };
290 }
291
292 /** Client finished reading all lines (or reward notices) of the current step. */
293 advanceDialogue (characterId)
294 {
295 const session = this.sessions.get(characterId | 0);
296 if (!session || (session.phase !== "lines" && session.phase !== "rewards"))
297 { return { ok: false, error: "No dialogue lines to advance." }; }
298 const tree = this.content.dialogue(session.dialogueId);
299 if (!tree)
300 {
301 this.sessions.delete(characterId | 0);
302 return { ok: true, events: [{ type: "dialogueClose", reason: "missing" }] };
303 }
304 const playerView = this.playerViewFor(characterId);
305 const events = [];
306
307 if (session.phase === "lines")
308 {
309 const step = tree.steps.find((s) => s.stepId === session.stepId);
310 const rewardMessages = this.#grantStepItemRewards(
311 characterId,
312 step,
313 events
314 );
315 this.#reevaluateQuests(characterId, playerView, events);
316 if (rewardMessages.length > 0)
317 {
318 session.phase = "rewards";
319 events.push({
320 type: "dialogueItemRewards",
321 dialogueId: session.dialogueId,
322 stepId: session.stepId,
323 npcEntityId: session.entityId,
324 messages: rewardMessages
325 });
326 return { ok: true, events };
327 }
328 }
329
330 return this.#resolveDialogueExit(characterId, session, tree, playerView, events);
331 }
332
333 #resolveDialogueExit (characterId, session, tree, playerView, events)
334 {
335 const exit = session.pendingExit ?? { kind: "end" };
336
337 if (exit.kind === "branches")
338 {
339 const ctx = this.buildConditionContext(characterId, playerView);
340 let matched = null;
341 for (const branch of exit.branches ?? [])
342 {
343 if (evaluateConditionSet(branch.when, ctx))
344 {
345 matched = branch;
346 break;
347 }
348 }
349 if (!matched || !matched.nextStepId)
350 {
351 this.#applyEffects(characterId, matched?.effects, playerView, events);
352 const npcEntityId = session.entityId;
353 this.sessions.delete(characterId | 0);
354 events.push({ type: "dialogueClose", reason: "branch-end", npcEntityId });
355 return { ok: true, events };
356 }
357 this.#applyEffects(characterId, matched.effects, playerView, events);
358 return this.#enterStep(characterId, session.entityId, tree, matched.nextStepId, playerView, events);
359 }
360
361 if (exit.kind === "triggers")
362 {
363 const ctx = this.buildConditionContext(characterId, playerView);
364 const triggers = (exit.triggers ?? [])
365 .filter((t) => evaluateConditionSet(t.when, ctx))
366 .map((t) => ({ trigger: t.trigger, text: t.text }));
367 if (triggers.length === 0)
368 {
369 const npcEntityId = session.entityId;
370 this.sessions.delete(characterId | 0);
371 events.push({ type: "dialogueClose", reason: "no-triggers", npcEntityId });
372 return { ok: true, events };
373 }
374 session.phase = "choices";
375 session.pendingExit = null;
376 events.push({
377 type: "dialogueChoices",
378 dialogueId: session.dialogueId,
379 stepId: session.stepId,
380 npcEntityId: session.entityId,
381 triggers
382 });
383 return { ok: true, events };
384 }
385
386 const npcEntityId = session.entityId;
387 this.sessions.delete(characterId | 0);
388 events.push({ type: "dialogueClose", reason: "end", npcEntityId });
389 return { ok: true, events };
390 }
391
392 /**
393 * Grant step.itemRewards into bag (overflow → bank/vault). Returns player-facing notices.
394 */
395 #grantStepItemRewards (characterId, step, events)
396 {
397 const rewards = step?.itemRewards ?? [];
398 if (!rewards.length)
399 { return []; }
400 const bagParts = [];
401 const bankParts = [];
402 for (const reward of rewards)
403 {
404 const bag = this.#loadBag(characterId);
405 if (!bag)
406 { continue; }
407 const itemId = reward.itemId | 0;
408 const def = itemDefinition(itemId);
409 const quantity = Math.max(1, Number(reward.quantity) || 1);
410 const displayName = def?.displayName ?? `Item ${itemId}`;
411 const stack = attachOrigins({
412 itemId,
413 quantity,
414 origins: [{ origin: godsOrigin(), quantity }]
415 });
416 const result = insertStack(bag.inventory, stack, def);
417 bag.inventory = result.slots;
418 const intoBag = quantity - Math.max(0, result.remainder | 0);
419 let intoBank = 0;
420 if (result.remainder > 0)
421 {
422 const vaultResult = insertStackGrowable(
423 bag.vault,
424 attachOrigins({
425 itemId,
426 quantity: result.remainder,
427 origins: [{ origin: godsOrigin(), quantity: result.remainder }]
428 }),
429 def
430 );
431 bag.vault = vaultResult.slots;
432 intoBank = (result.remainder | 0) - Math.max(0, vaultResult.remainder | 0);
433 }
434 this.#persistBag(characterId, bag);
435 events.push({ type: "inventoryDirty" });
436 if (intoBag > 0)
437 { bagParts.push({ displayName, quantity: intoBag }); }
438 if (intoBank > 0)
439 { bankParts.push({ displayName, quantity: intoBank }); }
440 }
441 const messages = [];
442 const bagMsg = formatDialogueRewardMessage(bagParts, "bag");
443 const bankMsg = formatDialogueRewardMessage(bankParts, "bank");
444 if (bagMsg)
445 { messages.push(bagMsg); }
446 if (bankMsg)
447 { messages.push(bankMsg); }
448 return messages;
449 }
450
451 #loadBag (characterId)
452 {
453 const onlineId = this.simulation.characterEntities.get(characterId | 0);
454 const bag = onlineId
455 ? this.simulation.bagOf(onlineId)
456 : this.stateDb.getBag(characterId);
457 return bag;
458 }
459
460 #persistBag (characterId, bag)
461 {
462 this.stateDb.saveBag(characterId, bag);
463 const onlineId = this.simulation.characterEntities.get(characterId | 0);
464 if (onlineId)
465 {
466 this.simulation.applyBag?.(onlineId, bag);
467 this.simulation.pushInventory?.(characterId, bag);
468 }
469 }
470
471 #applyEffects (characterId, effects, playerView, events)
472 {
473 if (!Array.isArray(effects) || effects.length === 0)
474 { return; }
475 for (const effect of effects)
476 {
477 if (effect.kind === EffectKind.giveItem)
478 {
479 const bag = this.#loadBag(characterId);
480 if (!bag)
481 { continue; }
482 const def = itemDefinition(effect.itemId | 0);
483 const quantity = Math.max(1, Number(effect.quantity) || 1);
484 const stack = attachOrigins({
485 itemId: effect.itemId | 0,
486 quantity,
487 origins: [{ origin: godsOrigin(), quantity }]
488 });
489 const result = insertStack(bag.inventory, stack, def);
490 bag.inventory = result.slots;
491 if (result.remainder > 0)
492 {
493 const vaultResult = insertStackGrowable(
494 bag.vault,
495 attachOrigins({
496 itemId: effect.itemId | 0,
497 quantity: result.remainder,
498 origins: [{ origin: godsOrigin(), quantity: result.remainder }]
499 }),
500 def
501 );
502 bag.vault = vaultResult.slots;
503 }
504 this.#persistBag(characterId, bag);
505 events.push({ type: "inventoryDirty" });
506 }
507 else if (effect.kind === EffectKind.takeItem)
508 {
509 const bag = this.#loadBag(characterId);
510 if (!bag)
511 { continue; }
512 const taken = takeMatchingFromSlots(bag.inventory, {
513 itemId: effect.itemId | 0,
514 quantity: Math.max(1, Number(effect.quantity) || 1),
515 compact: false
516 });
517 if (taken.ok)
518 {
519 bag.inventory = taken.slots;
520 this.#persistBag(characterId, bag);
521 events.push({ type: "inventoryDirty" });
522 }
523 }
524 else if (effect.kind === EffectKind.giveXp)
525 {
526 const skills = this.stateDb.getSkills(characterId);
527 if (skills)
528 {
529 applySkillXp(skills, effect.skillId, Math.max(0, Number(effect.amount) || 0));
530 this.stateDb.saveSkills(characterId, skills);
531 if (playerView)
532 { playerView.skills = skills; }
533 events.push({ type: "skillsDirty" });
534 }
535 }
536 else if (effect.kind === EffectKind.startQuest)
537 { this.startQuest(characterId, effect.questId, playerView, events); }
538 }
539 }
540
541 startQuest (characterId, questId, playerView, events = [])
542 {
543 const def = this.content.quest(questId);
544 if (!def)
545 { return; }
546 const current = this.stateDb.getQuestState(characterId, questId);
547 if (current.state !== "not-started")
548 { return; }
549 this.stateDb.saveQuestState(characterId, questId, 1, {
550 completedObjectiveIds: [],
551 counters: {},
552 interacts: {}
553 }, Date.now(), null);
554 this.#applyEffects(characterId, def.steps[0]?.onEnter, playerView, events);
555 events.push({ type: "questsDirty" });
556 this.#reevaluateQuests(characterId, playerView, events);
557 }
558
559 /**
560 * Grant world-settings initial quests when the character has not started or completed them.
561 */
562 ensureInitialQuests (characterId, playerView = null, events = [])
563 {
564 const list = normalizeInitialQuests(this.simulation?.settings?.initialQuests);
565 for (const questId of list)
566 { this.startQuest(characterId, questId, playerView, events); }
567 return events;
568 }
569
570 /** Apply initial quests to every character in state (settings save / apply). */
571 grantInitialQuestsToAllCharacters ()
572 {
573 const events = [];
574 for (const characterId of this.stateDb.listAllCharacterIds())
575 { this.ensureInitialQuests(characterId, null, events); }
576 return events;
577 }
578
579 #reevaluateQuests (characterId, playerView, events)
580 {
581 const states = this.stateDb.listQuestStates(characterId)
582 .filter((row) => typeof row.state === "number");
583 for (const row of states)
584 {
585 const def = this.content.quest(row.questId);
586 if (!def)
587 { continue; }
588 const stepDef = def.steps[row.state - 1];
589 if (!stepDef)
590 { continue; }
591 const ctx = this.buildConditionContext(characterId, playerView, row.questId);
592 const completed = new Set(row.progress?.completedObjectiveIds ?? []);
593 let changed = false;
594 for (const obj of stepDef.objectives)
595 {
596 if (completed.has(obj.objectiveId))
597 { continue; }
598 if (evaluateConditionSet(obj.when, ctx))
599 {
600 completed.add(obj.objectiveId);
601 changed = true;
602 }
603 }
604 if (!changed)
605 { continue; }
606 const progress = {
607 ...row.progress,
608 completedObjectiveIds: [...completed]
609 };
610 const allDone = stepDef.objectives.every((obj) => completed.has(obj.objectiveId));
611 if (!allDone)
612 {
613 this.stateDb.saveQuestState(characterId, row.questId, row.state, progress, row.startedAt, row.completedAt);
614 events.push({ type: "questsDirty" });
615 continue;
616 }
617 this.#applyEffects(characterId, stepDef.onComplete, playerView, events);
618 const journal = this.stateDb.appendQuestJournal(
619 characterId,
620 row.questId,
621 stepDef.stepId,
622 stepDef.completionJournalText
623 );
624 const nextIndex = row.state + 1;
625 if (nextIndex > def.steps.length)
626 {
627 this.#applyEffects(characterId, def.rewards, playerView, events);
628 this.stateDb.saveQuestState(characterId, row.questId, "completed", progress, row.startedAt, Date.now());
629 }
630 else
631 {
632 const nextStep = def.steps[nextIndex - 1];
633 this.stateDb.saveQuestState(characterId, row.questId, nextIndex, {
634 completedObjectiveIds: [],
635 counters: {},
636 interacts: {}
637 }, row.startedAt, null);
638 this.#applyEffects(characterId, nextStep?.onEnter, playerView, events);
639 }
640 events.push({
641 type: "questStepComplete",
642 questId: row.questId,
643 title: def.title,
644 journalText: journal?.text ?? null
645 });
646 events.push({ type: "questsDirty" });
647 }
648 }
649
650 noteKill (characterId, { mobTypeId, spawnerId })
651 {
652 const events = [];
653 const playerView = this.playerViewFor(characterId);
654 const states = this.stateDb.listQuestStates(characterId)
655 .filter((row) => typeof row.state === "number");
656 for (const row of states)
657 {
658 const def = this.content.quest(row.questId);
659 const stepDef = def?.steps[row.state - 1];
660 if (!stepDef)
661 { continue; }
662 let changed = false;
663 const counters = { ...(row.progress?.counters ?? {}) };
664 for (const obj of stepDef.objectives)
665 {
666 for (const clause of obj.when?.all ?? [])
667 {
668 const c = clause.condition;
669 if (c?.kind !== "killCount")
670 { continue; }
671 const matchMob = c.mobTypeId != null && String(c.mobTypeId) === String(mobTypeId);
672 const matchSpawner = c.spawnerId != null && String(c.spawnerId) === String(spawnerId);
673 if (!matchMob && !matchSpawner)
674 { continue; }
675 const key = killKey(c);
676 counters[key] = (counters[key] | 0) + 1;
677 changed = true;
678 }
679 }
680 if (!changed)
681 { continue; }
682 this.stateDb.saveQuestState(characterId, row.questId, row.state, {
683 ...row.progress,
684 counters
685 }, row.startedAt, row.completedAt);
686 }
687 this.#reevaluateQuests(characterId, playerView, events);
688 return events;
689 }
690}
691
692function journalPublic (row)
693{
694 return {
695 entryId: row.entry_id ?? row.entryId,
696 questId: row.quest_id ?? row.questId,
697 stepId: row.step_id ?? row.stepId,
698 text: row.text,
699 writtenAt: row.written_at ?? row.writtenAt
700 };
701}
702
703function killKey (condition)
704{
705 if (condition.spawnerId)
706 { return `spawner:${condition.spawnerId}`; }
707 return `mob:${condition.mobTypeId}`;
708}
709
710function interactKey (condition)
711{
712 if (condition.tileX != null)
713 { return `tile:${condition.tileX},${condition.tileY}`; }
714 return `block:${condition.blockTypeId}`;
715}