Add Formatting (Thank God)
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
import { BlockType, Vector3, world } from "@minecraft/server";
|
||||
import { Vector3, world } from "@minecraft/server";
|
||||
import Level from "../Commandeer/level/level";
|
||||
import { leverOn } from "../Commandeer/level/levelTypes";
|
||||
import { teleportAgent, isAgentAt } from "../Commandeer/utils/agentUtils";
|
||||
import { startLevel } from "../Commandeer/utils/levelUtils";
|
||||
import { vector3 } from "../Commandeer/utils/vectorUtils";
|
||||
import { levelIntroConditions } from "../levelConditions/levelIntro";
|
||||
import { CURRENT_LEVEL, mindKeeper } from "../main";
|
||||
@@ -26,8 +23,7 @@ const blockPositions: Vector3[] = [
|
||||
vector3(2464, 12, 108),
|
||||
];
|
||||
|
||||
let currentBlockSequence: string[] = [];
|
||||
let currentBlockSeuqenceIndex: number[] = [];
|
||||
const currentBlockSequence: string[] = [];
|
||||
|
||||
const blockCycle: string[] = [
|
||||
// MinecraftBlockTypes.RedstoneBlock,
|
||||
@@ -37,7 +33,7 @@ const blockCycle: string[] = [
|
||||
MinecraftBlockTypes.LapisBlock,
|
||||
];
|
||||
|
||||
let buttonPressed: boolean[] = buttonPositions.map(() => false);
|
||||
const buttonPressed: boolean[] = buttonPositions.map(() => false);
|
||||
|
||||
const levelIntro: Level = new Level(
|
||||
() => {
|
||||
@@ -46,9 +42,9 @@ const levelIntro: Level = new Level(
|
||||
// startLevel(levelIntroCommandBlockPos);
|
||||
// teleportAgent(levelIntroStartPosition);
|
||||
blockPositions.forEach((pos) => {
|
||||
let block = world.getDimension("overworld").getBlock(pos);
|
||||
let index = blockPositions.indexOf(pos);
|
||||
let blockType = block!.type;
|
||||
const block = world.getDimension("overworld").getBlock(pos);
|
||||
const index = blockPositions.indexOf(pos);
|
||||
const blockType = block!.type;
|
||||
currentBlockSequence[index] = blockType.id;
|
||||
});
|
||||
},
|
||||
@@ -56,21 +52,21 @@ const levelIntro: Level = new Level(
|
||||
Pupeteer.setActionBar("%message.intro.make");
|
||||
|
||||
buttonPositions.forEach((pos) => {
|
||||
let block = world.getDimension("overworld").getBlock(pos);
|
||||
const block = world.getDimension("overworld").getBlock(pos);
|
||||
if (!block) return;
|
||||
let index = buttonPositions.indexOf(pos);
|
||||
let prevState = buttonPressed[index];
|
||||
let currentState = block!.getRedstonePower()! > 0;
|
||||
const index = buttonPositions.indexOf(pos);
|
||||
const prevState = buttonPressed[index];
|
||||
const currentState = block!.getRedstonePower()! > 0;
|
||||
|
||||
if (currentState && !prevState) {
|
||||
buttonPressed[index] = true;
|
||||
//NextBlock
|
||||
let nextBlock = currentBlockSequence[index];
|
||||
const nextBlock = currentBlockSequence[index];
|
||||
let nextIndex = blockCycle.indexOf(nextBlock);
|
||||
nextIndex = (nextIndex + 1) % blockCycle.length;
|
||||
currentBlockSequence[index] = blockCycle[nextIndex];
|
||||
//Update the block
|
||||
let blockPos = blockPositions[index];
|
||||
const blockPos = blockPositions[index];
|
||||
world.getDimension("overworld").getBlock(blockPos)!.setType(blockCycle[nextIndex]);
|
||||
}
|
||||
|
||||
@@ -87,13 +83,11 @@ const levelIntro: Level = new Level(
|
||||
mindKeeper.increment(CURRENT_LEVEL);
|
||||
},
|
||||
() => {
|
||||
let counter = 0;
|
||||
let isComplete = true;
|
||||
levelIntroConditions.conditions.forEach((condition) => {
|
||||
let blockInworld = world.getDimension("overworld").getBlock(condition.position);
|
||||
const blockInworld = world.getDimension("overworld").getBlock(condition.position);
|
||||
if (blockInworld?.type.id !== condition.block) {
|
||||
isComplete = false;
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
if (isComplete) {
|
||||
@@ -103,8 +97,8 @@ const levelIntro: Level = new Level(
|
||||
},
|
||||
() => {
|
||||
blockPositions.forEach((pos) => {
|
||||
let block = world.getDimension("overworld").getBlock(pos);
|
||||
let randomBlock = blockCycle[Math.floor(Math.random() * blockCycle.length)];
|
||||
const block = world.getDimension("overworld").getBlock(pos);
|
||||
const randomBlock = blockCycle[Math.floor(Math.random() * blockCycle.length)];
|
||||
block!.setType(randomBlock);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ const level1StartPosition: Vector3 = vector3(2451, -2, 57);
|
||||
const level1AgentFacing: Vector3 = vector3(0, 0, -1);
|
||||
const Level1EndPosition: Vector3 = vector3(2451, -2, 41);
|
||||
|
||||
let mission1part1: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
const mission1part1: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
"mission1part1",
|
||||
level1StartPosition,
|
||||
level1AgentFacing,
|
||||
|
||||
@@ -8,9 +8,7 @@ const level2StartPosition: Vector3 = vector3(2446, -2, 40);
|
||||
const level2AgentFacing: Vector3 = vector3(1, 0, 0);
|
||||
const Level2EndPosition: Vector3 = vector3(2446, -2, 30);
|
||||
|
||||
const level2ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
|
||||
let mission1part2: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
const mission1part2: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
"mission1part2",
|
||||
level2StartPosition,
|
||||
level2AgentFacing,
|
||||
|
||||
@@ -7,9 +7,7 @@ const level3AgentFacing: Vector3 = vector3(0, 0, -1);
|
||||
const level3StartPosition: Vector3 = vector3(2447, -2, 30);
|
||||
const level3EndPosition: Vector3 = vector3(2451, -2, 18);
|
||||
|
||||
const level3ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
|
||||
let mission1part3: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
const mission1part3: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
"mission1part3",
|
||||
level3StartPosition,
|
||||
level3AgentFacing,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { vector3, Vector3Add, Vector3ToCommandString } from "../../Commandeer/utils/vectorUtils";
|
||||
import { teleportAgent, isAgentAt } from "../../Commandeer/utils/agentUtils";
|
||||
import { vector3 } from "../../Commandeer/utils/vectorUtils";
|
||||
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
import { mission2part1Conditions } from "../../levelConditions/mission2part1Conditions";
|
||||
@@ -38,9 +38,9 @@ const mission2part1: Level = new Level(
|
||||
//Check if the agent is at the end position
|
||||
//than check if the level is correct
|
||||
let isComplete = false;
|
||||
let isAgentAtEndPosition = isAgentAt(mission2part1EndPosition);
|
||||
const isAgentAtEndPosition = isAgentAt(mission2part1EndPosition);
|
||||
if (isAgentAtEndPosition) {
|
||||
let isCorrect = checkBlockCondition(mission2part1Conditions);
|
||||
const isCorrect = checkBlockCondition(mission2part1Conditions);
|
||||
|
||||
if (isCorrect) {
|
||||
isComplete = true;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { vector3, Vector3Add, Vector3ToCommandString } from "../../Commandeer/utils/vectorUtils";
|
||||
import { teleportAgent, isAgentAt } from "../../Commandeer/utils/agentUtils";
|
||||
import { vector3 } from "../../Commandeer/utils/vectorUtils";
|
||||
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||
import { MinecraftBlockTypes } from "../../vanilla-data/mojang-block";
|
||||
import { checkBlockCondition } from "../../Commandeer/level/levelTypes";
|
||||
@@ -38,9 +38,9 @@ const mission2part2: Level = new Level(
|
||||
//Check if the agent is at the end position
|
||||
//than check if the level is correct
|
||||
let isComplete = false;
|
||||
let isAgentAtEndPosition = isAgentAt(mission2part2EndPosition);
|
||||
const isAgentAtEndPosition = isAgentAt(mission2part2EndPosition);
|
||||
if (isAgentAtEndPosition) {
|
||||
let isCorrect = checkBlockCondition(mission2part2Conditions);
|
||||
const isCorrect = checkBlockCondition(mission2part2Conditions);
|
||||
|
||||
if (isCorrect) {
|
||||
isComplete = true;
|
||||
|
||||
@@ -8,7 +8,7 @@ const level1StartPosition: Vector3 = vector3(2487, -2, 36);
|
||||
const level1AgentFacing: Vector3 = vector3(1, 0, 0);
|
||||
const Level1EndPosition: Vector3 = vector3(2488, -2, 57);
|
||||
|
||||
let mission3part2: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
const mission3part2: AbstractAgentTrackMission = new AbstractAgentTrackMission(
|
||||
"mission3part2",
|
||||
level1StartPosition,
|
||||
level1AgentFacing,
|
||||
|
||||
Reference in New Issue
Block a user