/src/script/pause.ts
import { ScriptInstruction, InstructionPromise, InstructionStatus } from './';
import gs from '../gamestate';

export class PauseInstruction implements ScriptInstruction {
    text: string

    constructor(text?: string) {
        this.text = text || 'Continue';
    }

    execute(): InstructionPromise {
        return new Promise( (resolve, reject) => {
            gs.actions.clear();
            gs.actions.addAction(this.text, () => {
                gs.actions.clear();
                resolve({ status: InstructionStatus.OK });
            });
        });
    }
}