@maka/maka-cli 5.179.0 → 5.180.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.180.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 3.x applications using React.",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Door } from '../models/door.js';
|
|
2
2
|
import { Command } from './command.js';
|
|
3
3
|
import { ensureAtExit, lockedRouteHint } from '../utilities/spots.js';
|
|
4
|
+
import { applyDeviceOpened } from '../utilities/devices.js';
|
|
4
5
|
export class UnlockCommand extends Command {
|
|
5
6
|
static verb = 'unlock';
|
|
6
7
|
static description = 'Unlock a door.';
|
|
@@ -51,6 +52,34 @@ export class UnlockCommand extends Command {
|
|
|
51
52
|
if (reach.refusal)
|
|
52
53
|
return reach.refusal;
|
|
53
54
|
const crossNote = reach.line ? `${reach.line}\n` : '';
|
|
55
|
+
// A DOOR HELD BY A DEVICE IN THIS ROOM (8XDR2BCZoSmpqdkXG). The
|
|
56
|
+
// Door itself knows no key -- scene-factory seals it through the
|
|
57
|
+
// device (heldByDevice), and the KEY lives on the device as its
|
|
58
|
+
// keyItem. This verb only ever read the Door, so on a keyed maglock
|
|
59
|
+
// it answered "you don't have the key" to the player holding it --
|
|
60
|
+
// while the device's own wrong-verb line promised exactly this:
|
|
61
|
+
// "The right key opens it clean: 'unlock' with Corvid's Fob in
|
|
62
|
+
// hand." Same offer `use` makes, so the same code path and the same
|
|
63
|
+
// aftermath (applyDeviceOpened), never a second copy of "what opens
|
|
64
|
+
// this".
|
|
65
|
+
const holder = room.deviceOpening(direction);
|
|
66
|
+
if (holder) {
|
|
67
|
+
if (holder.keyItem && this.actor.inventory.hasItem(holder.keyItem.name)) {
|
|
68
|
+
const result = holder.offer('', this.actor.inventory);
|
|
69
|
+
this.logger.write(`UnlockCommand: ${this.actor.name} turned ${holder.keyItem.name} in ${holder.name}: ${result.success}`);
|
|
70
|
+
this.actor.performAction('unlocked', result.message);
|
|
71
|
+
if (!result.success)
|
|
72
|
+
return crossNote + result.message;
|
|
73
|
+
const lines = applyDeviceOpened(this.scene, this.actor, room, holder, 'unlock');
|
|
74
|
+
return crossNote + [result.message, ...lines].join('\n');
|
|
75
|
+
}
|
|
76
|
+
const ways = holder.verbs().map(v => `"${v} ${holder.name}"`).join(' or ');
|
|
77
|
+
const takes = holder.keyItem
|
|
78
|
+
? `It takes ${holder.keyItem.name}, which you don't have.`
|
|
79
|
+
: `No key you could carry fits it.`;
|
|
80
|
+
this.logger.write(`UnlockCommand: ${this.actor.name} has no key for ${holder.name} on "${target}".`);
|
|
81
|
+
return crossNote + `${holder.name} holds it. ${takes} Or force it: ${ways}.`;
|
|
82
|
+
}
|
|
54
83
|
const requiredKeyOrSolution = door.unlockItemOrSolution?.toLowerCase();
|
|
55
84
|
if (requiredKeyOrSolution && this.actor.inventory.hasItem(requiredKeyOrSolution)) {
|
|
56
85
|
const key = this.actor.inventory.getItem(requiredKeyOrSolution);
|
|
@@ -147,6 +147,20 @@ export class UseCommand extends Command {
|
|
|
147
147
|
return resolved.error ?? `You don't have the ${itemName} to use.`;
|
|
148
148
|
}
|
|
149
149
|
const itemToUse = resolved.item;
|
|
150
|
+
// A KEY, USED ON ITS OWN, GOES INTO THE LOCK IT OPENS
|
|
151
|
+
// (8XDR2BCZoSmpqdkXG). "use Corvid's Fob" is the most natural thing
|
|
152
|
+
// to type at a maglock that says it takes the fob, and it used to
|
|
153
|
+
// fall all the way down this ladder to "You can't use the fob in
|
|
154
|
+
// this way" -- the Key category has no use() of its own. When
|
|
155
|
+
// exactly one shut device in the room answers to this item, the
|
|
156
|
+
// item IS the offer, the same one "use <item> on <device>" makes.
|
|
157
|
+
const opensHere = devices.filter(d => d.keyItem?.name === itemToUse.name);
|
|
158
|
+
if (opensHere.length === 1) {
|
|
159
|
+
return this.useDevice(opensHere[0], itemToUse.name);
|
|
160
|
+
}
|
|
161
|
+
if (opensHere.length > 1) {
|
|
162
|
+
return `${itemToUse.name} opens more than one thing here -- say which: ${opensHere.map(d => d.name).join(', ')}.`;
|
|
163
|
+
}
|
|
150
164
|
if (itemToUse.category === Category.Medical) {
|
|
151
165
|
return this.applyFirstAid(itemToUse);
|
|
152
166
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maka/maka-cli",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.180.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"summary": "A command line tool for scaffolding Meteor 3.x applications using either React.",
|
|
6
6
|
"description": "A command line tool for scaffolding Meteor 3.x applications using React.",
|