"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const ActionGroup_1 = require("./ActionGroup");
const GroupAction_1 = require("./GroupAction");
const IScriptGenerationContext_1 = require("./IScriptGenerationContext");
class TickGroupAction extends GroupAction_1.default {
    get typeTitle() {
        return "Tick";
    }
    get typeId() {
        return "tick";
    }
    get title() {
        return this.typeTitle;
    }
    get ticks() {
        return this.getArgumentAsNumber("ticks");
    }
    validate() {
        this.validateArgumentIsType("ticks", "number");
        return true;
    }
    getScriptRequirements(options) {
        return {
            needsTest: true,
        };
    }
    getCommandRequirements(options) {
        return {};
    }
    addCommandLines(lines, indent, optons) { }
    addScriptLines(lines, options, context, placement) {
        if (placement === IScriptGenerationContext_1.ScriptGenerationPlacement.blockStart) {
            let functionLine = "export function " + this.group.name + "() {";
            lines.push(functionLine);
        }
        else if (placement === IScriptGenerationContext_1.ScriptGenerationPlacement.blockEnd) {
            lines.push("}");
        }
        if (placement === IScriptGenerationContext_1.ScriptGenerationPlacement.initInSequence) {
            let ticks = this.getProperty("everyNTicks");
            if (!ticks) {
                ticks = 1;
            }
            ActionGroup_1.default.addLine(lines, context.indent, "mc.system.runInterval(" + this.group.name + ", " + ticks + ");");
        }
    }
}
exports.default = TickGroupAction;

//# sourceMappingURL=../maps/actions/TickGroupAction.js.map
