Add Alot
This commit is contained in:
71
scripts/levels/level1/mission3.ts
Normal file
71
scripts/levels/level1/mission3.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
import { MinecraftBlockTypes, 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";
|
||||
const Level3CommandBlockPos: Vector3 = vector3(2439, 0, 34);
|
||||
const level3StartPosition: Vector3 = vector3(2447, -2, 30);
|
||||
const level3EndPosition: Vector3 = vector3(2451, -2, 18);
|
||||
|
||||
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 === MinecraftBlockTypes.lava &&
|
||||
blockAir &&
|
||||
blockAir.type === 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;
|
||||
Reference in New Issue
Block a user