Add Formatting (Thank God)

This commit is contained in:
2024-08-29 15:47:58 +02:00
parent 545e47a9f3
commit 1ab45204b9
35 changed files with 2331 additions and 254 deletions

View File

@@ -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);
});
}