version without npcs, levels work, everything is build
This commit is contained in:
@@ -1,4 +1,12 @@
|
||||
import { BlockType, BlockTypes, EntityInventoryComponent, Player, Vector3, world } from "@minecraft/server";
|
||||
import {
|
||||
BlockType,
|
||||
BlockTypes,
|
||||
BlockVolume,
|
||||
EntityInventoryComponent,
|
||||
Player,
|
||||
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";
|
||||
@@ -51,6 +59,9 @@ let toolBlocks = [
|
||||
MinecraftBlockTypes.BlueWool,
|
||||
];
|
||||
|
||||
let noDrillYet = true;
|
||||
let noChainsawYet = true;
|
||||
|
||||
const level1ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||
const level1: Level = new Level(
|
||||
() => {
|
||||
@@ -84,6 +95,20 @@ const level1: Level = new Level(
|
||||
}
|
||||
}
|
||||
|
||||
let drillBlock = world.getDimension("overworld").getBlock(vector3(-75, 68, 268));
|
||||
if (drillBlock?.type.id == MinecraftBlockTypes.Air && noDrillYet) {
|
||||
noDrillYet = false;
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-70, 71, 285), vector3(-70, 71, 285));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
}
|
||||
|
||||
let chainsawBlock = world.getDimension("overworld").getBlock(vector3(-79, 68, 264));
|
||||
if (chainsawBlock?.type.id == MinecraftBlockTypes.Air && noChainsawYet) {
|
||||
noChainsawYet = false;
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-69, 71, 285), vector3(-69, 71, 285));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
}
|
||||
|
||||
for (let i = 0; i < flowerPositions.length; i++) {
|
||||
let block = world.getDimension("overworld").getBlock(flowerPositions[i]);
|
||||
if (block?.type.id == MinecraftBlockTypes.BlueOrchid) {
|
||||
@@ -114,11 +139,13 @@ const level1: Level = new Level(
|
||||
}
|
||||
|
||||
if (isOutOfBounds) {
|
||||
teleportAndFaceAgent(level1StartPosition, vector3(-84, 69, 272));
|
||||
|
||||
pupeteer.sendWorldMessage("%message.level1.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level1.outOfBounds", 2.5);
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
world.getDimension("Overworld").runCommand("/fill -74 69 272 -83 69 259 air replace blue_orchid");
|
||||
|
||||
world.getDimension("Overworld").runCommand("/fill -74 69 272 -83 69 259 air replace blue_orchid");
|
||||
toolPositions = [vector3(-75, 68, 268), vector3(-77, 68, 266), vector3(-79, 68, 264), vector3(-81, 68, 262)];
|
||||
for (let i = 0; i < toolPositions.length; i++) {
|
||||
let blockToReplace = world.getDimension("overworld").getBlock(toolPositions[i]);
|
||||
@@ -127,8 +154,6 @@ const level1: Level = new Level(
|
||||
}
|
||||
}
|
||||
|
||||
teleportAndFaceAgent(level1StartPosition, vector3(-84, 69, 272));
|
||||
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
|
||||
@@ -49,13 +49,14 @@ const level2: Level = new Level(
|
||||
}
|
||||
|
||||
if (isOutOfBounds) {
|
||||
teleportAndFaceAgent(level2StartPosition, vector3(-125, 69, 272));
|
||||
|
||||
pupeteer.sendWorldMessage("%message.level2.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level2.outOfBounds", 2.5);
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
world.getDimension("Overworld").runCommand("/fill -111 69 272 -124 69 258 air replace sweet_berry_bush");
|
||||
world.getDimension("Overworld").runCommand("/fill -111 69 272 -124 69 258 air replace jungle_sapling");
|
||||
|
||||
teleportAndFaceAgent(level2StartPosition, vector3(-125, 69, 272));
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
|
||||
@@ -53,14 +53,16 @@ const level3: Level = new Level(
|
||||
}
|
||||
|
||||
if (isOutOfBounds) {
|
||||
teleportAndFaceAgent(level3StartPosition, vector3(-148, 68, 265));
|
||||
|
||||
pupeteer.sendWorldMessage("%message.level3.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level3.outOfBounds", 2.5);
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
world.getDimension("Overworld").runCommand("/fill -133 68 272 -148 68 258 air replace sweet_berry_bush");
|
||||
world.getDimension("Overworld").runCommand("/fill -133 67 272 -148 67 258 magma replace cobblestone");
|
||||
world.getDimension("overworld").runCommand("/execute at @e[tag=KillingPandas] run kill @e[type=panda, r=10]");
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-131, 69, 284), vector3(-131, 69, 284));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
|
||||
teleportAndFaceAgent(level3StartPosition, vector3(-148, 68, 265));
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
|
||||
@@ -46,18 +46,23 @@ const level4: Level = new Level(
|
||||
}
|
||||
|
||||
if (isOutOfBounds) {
|
||||
teleportAndFaceAgent(level4StartPosition, vector3(-175, 62, 261));
|
||||
|
||||
pupeteer.sendWorldMessage("%message.level4.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level4.outOfBounds", 2.5);
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-163, 67, 291), vector3(-163, 67, 291));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
|
||||
teleportAndFaceAgent(level4StartPosition, vector3(-175, 62, 261));
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
() => {
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-163, 67, 291), vector3(-163, 67, 291));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -77,11 +77,13 @@ const level5: Level = new Level(
|
||||
}
|
||||
|
||||
if (isOutOfBounds) {
|
||||
teleportAndFaceAgent(level5StartPosition, vector3(-226, 65, 229));
|
||||
|
||||
pupeteer.sendWorldMessage("%message.level5.outOfBounds");
|
||||
pupeteer.setTitleTimed("%message.level5.outOfBounds", 2.5);
|
||||
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-163, 67, 291), vector3(-163, 67, 291));
|
||||
let volume: BlockVolume = new BlockVolume(vector3(-255, 67, 246), vector3(-255, 67, 246));
|
||||
world.getDimension("overworld").fillBlocks(volume, MinecraftBlockTypes.RedstoneBlock);
|
||||
|
||||
for (let i = 0; i < diamondAndPickaxePositions.length; i++) {
|
||||
@@ -91,7 +93,6 @@ const level5: Level = new Level(
|
||||
}
|
||||
}
|
||||
|
||||
teleportAndFaceAgent(level5StartPosition, vector3(-226, 65, 229));
|
||||
return false;
|
||||
} else if (isComplete) {
|
||||
return true;
|
||||
|
||||
@@ -126,6 +126,8 @@ system.runInterval(async () => {
|
||||
gateState = GateState.open;
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
Pupeteer.setActionBar("You completed the mission.");
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -149,7 +151,7 @@ world.afterEvents.chatSend.subscribe(async (event: ChatSendAfterEvent) => {
|
||||
world.getDimension("Overworld").runCommand("/fill -128 71 255 -128 74 276 barrier replace air");
|
||||
world.getDimension("Overworld").runCommand("/fill -154 69 255 -154 74 276 barrier replace air");
|
||||
world.getDimension("Overworld").runCommand("/fill -182 69 255 -182 74 276 barrier replace air");
|
||||
mindKeeper.set(CURRENT_LEVEL, 8);
|
||||
mindKeeper.set(CURRENT_LEVEL, 0);
|
||||
world.sendMessage("currentlevel = " + mindKeeper.get(CURRENT_LEVEL));
|
||||
}
|
||||
});
|
||||
@@ -269,6 +271,12 @@ triggerManager.RegisterFunctionTrigger("PastLevel4", async (event) => {
|
||||
}
|
||||
});
|
||||
|
||||
triggerManager.RegisterFunctionTrigger("CompletedTheMission", async (event) => {
|
||||
if (mindKeeper.get(CURRENT_LEVEL) == 10) {
|
||||
mindKeeper.increment(CURRENT_LEVEL);
|
||||
}
|
||||
});
|
||||
|
||||
Commands.register(PREFIX, "info", (arg) => {
|
||||
world.sendMessage("-----------------");
|
||||
world.sendMessage("Current level: " + mindKeeper.get(CURRENT_LEVEL));
|
||||
|
||||
Reference in New Issue
Block a user