init
This commit is contained in:
68
scripts/levels/level2/mission1.ts
Normal file
68
scripts/levels/level2/mission1.ts
Normal file
@@ -0,0 +1,68 @@
|
||||
import { Vector3, world } from "@minecraft/server";
|
||||
import Level from "../../Commandeer/level/level";
|
||||
import pupeteer from "../../Commandeer/pupeteer";
|
||||
import { teleportAgent, isAgentAt, getAgentLocation, getAgent } from "../../Commandeer/utils/agentUtils";
|
||||
import { startLevel } from "../../Commandeer/utils/levelUtils";
|
||||
import { vector3, Vector3Add, Vector3ToCommandString } from "../../Commandeer/utils/vectorUtils";
|
||||
// import { level2Conditions } from "../../levelConditions/level2";
|
||||
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
const level2CommandBlockPos: Vector3 = vector3(-111, 70, 282);
|
||||
|
||||
const level2StartPosition: Vector3 = vector3(-111, 69, 272);
|
||||
const level2EndPosition: Vector3 = vector3(-124, 69, 258);
|
||||
|
||||
const level2ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
const level2: Level = new Level(
|
||||
() => {
|
||||
pupeteer.sendWorldMessage("%message.level2.started");
|
||||
pupeteer.setTitleTimed("%message.level2.name", 2.5);
|
||||
startLevel(level2CommandBlockPos);
|
||||
teleportAgent(level2StartPosition);
|
||||
},
|
||||
() => {
|
||||
pupeteer.setActionBar("%message.level2.make");
|
||||
},
|
||||
() => {
|
||||
pupeteer.clearActionBar();
|
||||
pupeteer.sendWorldMessage("%message.level2.complete");
|
||||
pupeteer.setTitleTimed("%message.level2.complete", 2.5);
|
||||
|
||||
mindKeeper.increment(CURRENT_LEVEL);
|
||||
},
|
||||
() => {
|
||||
let isComplete = false;
|
||||
let isOutOfBounds = false;
|
||||
|
||||
//6 blocks lower is lava
|
||||
|
||||
let agentPos = getAgentLocation();
|
||||
let blockAir = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -1, 0)));
|
||||
|
||||
if (blockAir && blockAir.type.id === MinecraftBlockTypes.Air) {
|
||||
isOutOfBounds = true;
|
||||
}
|
||||
|
||||
if (isAgentAt(level2EndPosition)) {
|
||||
isComplete = true;
|
||||
}
|
||||
|
||||
// world.sendMessage(`isComplete: ${isComplete}`);
|
||||
// world.sendMessage(`isOutOfBounds: ${isOutOfBounds}`);
|
||||
|
||||
if (isOutOfBounds) {
|
||||
pupeteer.sendWorldMessage("%message.level2.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level2.outOfBounds", 2.5);
|
||||
// world.getDimension("overworld").runCommand("/kill @e[type=agent]");
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
|
||||
teleportAgent(level2StartPosition);
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
export default level2;
|
||||
73
scripts/levels/level2/mission2.ts
Normal file
73
scripts/levels/level2/mission2.ts
Normal file
@@ -0,0 +1,73 @@
|
||||
import { Vector3, world } from "@minecraft/server";
|
||||
import Level from "../../Commandeer/level/level";
|
||||
import pupeteer from "../../Commandeer/pupeteer";
|
||||
import { teleportAgent, isAgentAt, getAgentLocation, getAgent } from "../../Commandeer/utils/agentUtils";
|
||||
import { startLevel } from "../../Commandeer/utils/levelUtils";
|
||||
import { vector3, Vector3Add, Vector3ToCommandString } from "../../Commandeer/utils/vectorUtils";
|
||||
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
const Level3CommandBlockPos: Vector3 = vector3(-133, 68, 281);
|
||||
|
||||
const level3StartPosition: Vector3 = vector3(-133, 68, 265);
|
||||
const Level3EndPosition: Vector3 = vector3(-148, 68, 265);
|
||||
|
||||
const level3ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
const level3: Level = new Level(
|
||||
() => {
|
||||
pupeteer.sendWorldMessage("%message.level3.started");
|
||||
pupeteer.setTitleTimed("%message.level3.name", 2.5);
|
||||
startLevel(Level3CommandBlockPos);
|
||||
teleportAgent(level3StartPosition);
|
||||
},
|
||||
() => {
|
||||
pupeteer.setActionBar("%message.level3.make");
|
||||
},
|
||||
() => {
|
||||
pupeteer.clearActionBar();
|
||||
pupeteer.sendWorldMessage("%message.level3.complete");
|
||||
pupeteer.setTitleTimed("%message.level3.complete", 2.5);
|
||||
|
||||
mindKeeper.increment(CURRENT_LEVEL);
|
||||
},
|
||||
() => {
|
||||
let isComplete = false;
|
||||
let isOutOfBounds = false;
|
||||
|
||||
//6 blocks lower is lava
|
||||
|
||||
let agentPos = getAgentLocation();
|
||||
let blockLava = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -7, 0)));
|
||||
let blockAir = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -1, 0)));
|
||||
|
||||
if (
|
||||
blockLava &&
|
||||
blockLava.type.id === MinecraftBlockTypes.Lava &&
|
||||
blockAir &&
|
||||
blockAir.type.id === MinecraftBlockTypes.Air
|
||||
) {
|
||||
isOutOfBounds = true;
|
||||
}
|
||||
|
||||
if (isAgentAt(Level3EndPosition)) {
|
||||
isComplete = true;
|
||||
}
|
||||
|
||||
// world.sendMessage(`isComplete: ${isComplete}`);
|
||||
// world.sendMessage(`isOutOfBounds: ${isOutOfBounds}`);
|
||||
|
||||
if (isOutOfBounds) {
|
||||
pupeteer.sendWorldMessage("%message.level3.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level3.outOfBounds", 2.5);
|
||||
// world.getDimension("overworld").runCommand("/kill @e[type=agent]");
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
|
||||
teleportAgent(level3StartPosition);
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
export default level3;
|
||||
72
scripts/levels/level2/mission3.ts
Normal file
72
scripts/levels/level2/mission3.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
import { Vector3, world } from "@minecraft/server";
|
||||
import Level from "../../Commandeer/level/level";
|
||||
import pupeteer from "../../Commandeer/pupeteer";
|
||||
import { teleportAgent, isAgentAt, getAgentLocation, getAgent } from "../../Commandeer/utils/agentUtils";
|
||||
import { startLevel } from "../../Commandeer/utils/levelUtils";
|
||||
import { vector3, Vector3Add, Vector3ToCommandString } from "../../Commandeer/utils/vectorUtils";
|
||||
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
const Level4CommandBlockPos: Vector3 = vector3(-161, 68, 291);
|
||||
const level4StartPosition: Vector3 = vector3(-161, 62, 261);
|
||||
const level4EndPosition: Vector3 = vector3(-174, 62, 268);
|
||||
|
||||
const level4ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
const level4: Level = new Level(
|
||||
() => {
|
||||
pupeteer.sendWorldMessage("%message.level4.started");
|
||||
pupeteer.setTitleTimed("%message.level4.name", 2.5);
|
||||
startLevel(Level4CommandBlockPos);
|
||||
teleportAgent(level4StartPosition);
|
||||
},
|
||||
() => {
|
||||
pupeteer.setActionBar("%message.level4.make");
|
||||
},
|
||||
() => {
|
||||
pupeteer.clearActionBar();
|
||||
pupeteer.sendWorldMessage("%message.level4.complete");
|
||||
pupeteer.setTitleTimed("%message.level4.complete", 2.5);
|
||||
|
||||
mindKeeper.increment(CURRENT_LEVEL);
|
||||
},
|
||||
() => {
|
||||
let isComplete = false;
|
||||
let isOutOfBounds = false;
|
||||
|
||||
//6 blocks lower is lava
|
||||
|
||||
let agentPos = getAgentLocation();
|
||||
let blockLava = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -7, 0)));
|
||||
let blockAir = world.getDimension("overworld").getBlock(Vector3Add(agentPos, vector3(0, -1, 0)));
|
||||
|
||||
if (
|
||||
blockLava &&
|
||||
blockLava.type.id === MinecraftBlockTypes.Lava &&
|
||||
blockAir &&
|
||||
blockAir.type.id === MinecraftBlockTypes.Air
|
||||
) {
|
||||
isOutOfBounds = true;
|
||||
}
|
||||
|
||||
if (isAgentAt(level4EndPosition)) {
|
||||
isComplete = true;
|
||||
}
|
||||
|
||||
// world.sendMessage(`isComplete: ${isComplete}`);
|
||||
// world.sendMessage(`isOutOfBounds: ${isOutOfBounds}`);
|
||||
|
||||
if (isOutOfBounds) {
|
||||
pupeteer.sendWorldMessage("%message.level4.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level4.outOfBounds", 2.5);
|
||||
// world.getDimension("overworld").runCommand("/kill @e[type=agent]");
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
|
||||
teleportAgent(level4StartPosition);
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
);
|
||||
|
||||
export default level4;
|
||||
Reference in New Issue
Block a user