[SYSTEM] VM Halted. State preserved on disk.
$ nano runtime.js
$ cat /mnt/mesh_shared/src/ast-vm-ext/commands/pray.js
'use strict';
* PRAY
* A simple supplication. If the player carries a stone idol,
* their blessing count is incremented and the room's ambient
* text is softened with incense.
*/
module.exports = {
verb: 'PRAY',
// VM-facing metadata (posted verbatim to the control plane)
start_msg: 'You bow your head and begin to pray...',
timeout: 2000,
fail_msg: 'Your prayers echo into the void. Nothing answers.',
/**
* @param {object} ctx Player context supplied by the VM
* @param {object} ctx.player Player record (memory)
* @param {object} ctx.room Current room record
* @param {Array} ctx.inventory Items the player is carrying
* @returns {Promise<{output:string, mutations:object}>|object}
*/
async execute(ctx) {
const { player = {}, room = {}, inventory = [] } = ctx || {};
const hasIdol = inventory.some((item) => item && item.id ===
'stone_idol');
const now = Date.now();
if (hasIdol) {
const blessings = (player.blessings || 0) + 1;
return {
output:
'The stone idol grows warm in your hands. A calm certainty settles
over you.',
mutations: {
memory: {
...player,
blessings,
last_blessed_at: now,
},
room: {
...room,
ambient: 'A faint thread of incense lingers in the air.',
},
},
};
}
return {
output: 'You murmur a quiet prayer. The silence holds its breath.',
mutations: {
memory: {
...player,
last_prayed_at: now,
},
},
};
},
};
$