Add Alot
This commit is contained in:
12
behavior_packs/cameras/presets/camera.json
Normal file
12
behavior_packs/cameras/presets/camera.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"format_version": "1.19.50",
|
||||||
|
"minecraft:camera_preset": {
|
||||||
|
"identifier": "example:custom",
|
||||||
|
"inherit_from": "minecraft:free",
|
||||||
|
"pos_x": 30,
|
||||||
|
"pos_y": 90,
|
||||||
|
"pos_z": -20,
|
||||||
|
"rot_x": 10,
|
||||||
|
"rot_y": 40
|
||||||
|
}
|
||||||
|
}
|
||||||
62
behavior_packs/entities/floating_text.json
Normal file
62
behavior_packs/entities/floating_text.json
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
{
|
||||||
|
"format_version": "1.10.0",
|
||||||
|
"minecraft:entity": {
|
||||||
|
"description": {
|
||||||
|
"identifier": "cc:floating_text",
|
||||||
|
"is_spawnable": true,
|
||||||
|
"is_summonable": true,
|
||||||
|
"is_experimental": false
|
||||||
|
},
|
||||||
|
"components": {
|
||||||
|
"minecraft:type_family": {
|
||||||
|
"family": ["floatingtext"]
|
||||||
|
},
|
||||||
|
"minecraft:health": {
|
||||||
|
"value": 999999999,
|
||||||
|
"max": 999999999
|
||||||
|
},
|
||||||
|
"minecraft:collision_box": {
|
||||||
|
"width": 0.6,
|
||||||
|
"height": 1.8
|
||||||
|
},
|
||||||
|
"minecraft:nameable": {
|
||||||
|
"alwaysShow": true,
|
||||||
|
"allowNameTagRenaming": true
|
||||||
|
},
|
||||||
|
"minecraft:fire_immune": true,
|
||||||
|
"minecraft:scale": {
|
||||||
|
"value": 0
|
||||||
|
},
|
||||||
|
"minecraft:knockback_resistance": {
|
||||||
|
"value": 1
|
||||||
|
},
|
||||||
|
"minecraft:physics": {
|
||||||
|
"has_gravity": false
|
||||||
|
},
|
||||||
|
"minecraft:pushable": {
|
||||||
|
"is_pushable": false
|
||||||
|
},
|
||||||
|
"minecraft:damage_sensor": {
|
||||||
|
"triggers": {
|
||||||
|
"cause": "all",
|
||||||
|
"deals_damage": false,
|
||||||
|
"on_damage": {
|
||||||
|
"event": "left_click"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"component_groups": {},
|
||||||
|
"events": {
|
||||||
|
"left_click": {
|
||||||
|
"run_command": {
|
||||||
|
"target": "self",
|
||||||
|
"command": [
|
||||||
|
"tag @s add edit",
|
||||||
|
"execute @s[tag=edit] ~ ~ ~ execute @e[tag=floating] ~ ~ ~ function floating_text_function/menu_edit_multi/edit"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
behavior_packs/functions/summon.mcfunction
Normal file
3
behavior_packs/functions/summon.mcfunction
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
summon cc:floating_text ~ ~ ~ "§f[§aUse Name Tag§f]"
|
||||||
|
playsound lodestone_compass.link_compass_to_lodestone @s ~ ~ ~
|
||||||
|
titleraw @s actionbar {"rawtext":[{"text":"§l§7[§6Floating §bText§7]§r §a\n§2Floating text spawned template"}]}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
"dependencies": [
|
"dependencies": [
|
||||||
{
|
{
|
||||||
"module_name": "@minecraft/server",
|
"module_name": "@minecraft/server",
|
||||||
"version": "1.4.0-beta"
|
"version": "1.12.0-beta"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"uuid": "3c83eb6b-d574-411e-a430-f0e0ea816a3a",
|
"uuid": "3c83eb6b-d574-411e-a430-f0e0ea816a3a",
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
## General messages
|
||||||
|
message.trail.follow=Follow the trail
|
||||||
|
message.levels.completed=You have completed all levels!
|
||||||
|
|
||||||
|
|
||||||
|
## Fail conditions
|
||||||
|
message.level.incorrect=§cIncorrect!§b
|
||||||
|
message.level.incorrect.subtext=Probeer opnieuw!
|
||||||
|
|
||||||
|
message.level.outofbounds=§cOut of bounds!§b
|
||||||
|
message.level.outofbounds.subtext=You can't be over water!
|
||||||
|
|
||||||
|
|
||||||
|
## npc names
|
||||||
|
npc.name.help=Help
|
||||||
|
npc.name.suki=§2Suki
|
||||||
|
npc.name.bilal=§6Bilal
|
||||||
|
npc.name.ramses=§dRamses
|
||||||
|
npc.name.chanel=§9Wetenschapper Chanel
|
||||||
|
npc.name.paul=§7Paul
|
||||||
|
npc.name.farah=§5Farah
|
||||||
|
npc.name.turt=§aTurt
|
||||||
|
npc.name.mo=§4Mo
|
||||||
|
npc.name.al=Al
|
||||||
|
|
||||||
|
## Default buttons
|
||||||
|
button.thanks=Thanks!
|
||||||
|
button.close=Close
|
||||||
|
button.ok=Ok
|
||||||
|
button.hello=Hello
|
||||||
|
button.noprob=No problem
|
||||||
|
button.letsgo=Let's Go!
|
||||||
|
|
||||||
|
message.talkto.ramses=Talk to §dRamses
|
||||||
|
message.talkto.chanel=Talk to §9Chanel
|
||||||
|
|
||||||
|
## Intro messages
|
||||||
|
message.intro.started=Crack the Vault!
|
||||||
|
message.intro.make=Break the code!
|
||||||
|
message.intro.done=§aYou have cracked the code!§b
|
||||||
|
|
||||||
|
## Level 1 messages
|
||||||
|
message.level1.name=Level 1
|
||||||
|
message.level1.started=Level 1 is started!
|
||||||
|
message.level1.complete=Level 1 is complete!
|
||||||
|
message.level1.make=Make Level 1
|
||||||
|
message.level1.outOfBoun=§cOut of bounds!§bwd
|
||||||
|
|
||||||
|
## Level 2 messages
|
||||||
|
message.level2.name=Level 2
|
||||||
|
message.level2.started=Level 2 is started!
|
||||||
|
message.level2.complete=Level 2 is complete!
|
||||||
|
message.level2.make=Make Level 2
|
||||||
|
|
||||||
|
## Level 3 messages
|
||||||
|
message.level3.name=Level 3
|
||||||
|
message.level3.started=Level 3 is started!
|
||||||
|
message.level3.complete=Level 3 is complete!
|
||||||
|
message.level3.make=Make Level 3
|
||||||
|
|
||||||
|
## Goto messages
|
||||||
|
message.goto.field.1=Go to the First Field
|
||||||
|
message.goto.field.2=Go to the Second Field
|
||||||
|
message.goto.field.3=Go to the Last Field
|
||||||
|
|
||||||
|
chanel.greeting.1.text=Hello! I'm §9Chanel§0, the scientist. I'm here to help you with the vault.
|
||||||
|
chanel.greeting.1.button=Ok!
|
||||||
BIN
resource_packs/textures/entity/agent.png
Normal file
BIN
resource_packs/textures/entity/agent.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 KiB |
@@ -5,6 +5,7 @@ class Level {
|
|||||||
levelCheckCallback: Function;
|
levelCheckCallback: Function;
|
||||||
levelSetupCallback: Function;
|
levelSetupCallback: Function;
|
||||||
levelUpdateCallback: Function;
|
levelUpdateCallback: Function;
|
||||||
|
levelResetCallback: Function;
|
||||||
isCompleted: boolean = false;
|
isCompleted: boolean = false;
|
||||||
isSetup: boolean = false;
|
isSetup: boolean = false;
|
||||||
|
|
||||||
@@ -12,12 +13,14 @@ class Level {
|
|||||||
levelSetupCallback: Function,
|
levelSetupCallback: Function,
|
||||||
levelUpdateCallback: Function,
|
levelUpdateCallback: Function,
|
||||||
levelCompleteCallback: Function,
|
levelCompleteCallback: Function,
|
||||||
levelCheckCallback: Function
|
levelCheckCallback: Function,
|
||||||
|
levelResetCallback: Function = () => {}
|
||||||
) {
|
) {
|
||||||
this.levelSetupCallback = levelSetupCallback;
|
this.levelSetupCallback = levelSetupCallback;
|
||||||
this.levelCompleteCallback = levelCompleteCallback;
|
this.levelCompleteCallback = levelCompleteCallback;
|
||||||
this.levelCheckCallback = levelCheckCallback;
|
this.levelCheckCallback = levelCheckCallback;
|
||||||
this.levelUpdateCallback = levelUpdateCallback;
|
this.levelUpdateCallback = levelUpdateCallback;
|
||||||
|
this.levelResetCallback = levelResetCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
setup() {
|
setup() {
|
||||||
@@ -37,6 +40,7 @@ class Level {
|
|||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
|
this.levelResetCallback();
|
||||||
this.isCompleted = false;
|
this.isCompleted = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,14 +12,13 @@ class TrailPoint {
|
|||||||
}
|
}
|
||||||
|
|
||||||
spawn() {
|
spawn() {
|
||||||
let spawnPosition: Vector3 = Vector3Add(this.postion, { x: 0.5, y: 0.5, z: 0.5 });
|
// let spawnPosition: Vector3 = Vector3Add(this.postion, { x: 0.5, y: 0.5, z: 0.5 });
|
||||||
|
let spawnPosition: Vector3 = this.postion;
|
||||||
try {
|
try {
|
||||||
world
|
world
|
||||||
.getDimension("overworld")
|
.getDimension("overworld")
|
||||||
.spawnParticle("minecraft:balloon_gas_particle", spawnPosition, new MolangVariableMap());
|
.spawnParticle("minecraft:balloon_gas_particle", spawnPosition, new MolangVariableMap());
|
||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,13 +26,15 @@ class Trail {
|
|||||||
id: string;
|
id: string;
|
||||||
points: TrailPoint[] = [];
|
points: TrailPoint[] = [];
|
||||||
currentPoint: number = 0;
|
currentPoint: number = 0;
|
||||||
|
wrapIndex: number = 0;
|
||||||
nextParticleTimer: number = 0;
|
nextParticleTimer: number = 0;
|
||||||
currentParticleCounter: number = 0;
|
currentParticleCounter: number = 0;
|
||||||
|
|
||||||
calculatedLength: number = 0;
|
calculatedLength: number = 0;
|
||||||
constructor(id: string, nextParticleTimer: number = 5) {
|
constructor(id: string, nextParticleTimer: number = 5, wrapIndex: number = 0) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.nextParticleTimer = nextParticleTimer;
|
this.nextParticleTimer = nextParticleTimer;
|
||||||
|
this.wrapIndex = wrapIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
addPoint(point: TrailPoint) {
|
addPoint(point: TrailPoint) {
|
||||||
@@ -58,10 +59,14 @@ class Trail {
|
|||||||
spawnNext() {
|
spawnNext() {
|
||||||
if (this.currentParticleCounter >= this.nextParticleTimer) {
|
if (this.currentParticleCounter >= this.nextParticleTimer) {
|
||||||
this.currentParticleCounter = 0;
|
this.currentParticleCounter = 0;
|
||||||
|
//wrapindex is in how many segments the trail is divided into
|
||||||
|
let pointsPerInterval = this.wrapIndex > 0 ? this.calculatedLength / this.wrapIndex : 0;
|
||||||
this.points
|
this.points
|
||||||
.filter((point) => {
|
.filter((point) => {
|
||||||
return point.index === this.currentPoint;
|
return (
|
||||||
|
point.index === this.currentPoint ||
|
||||||
|
(this.wrapIndex > 0 && point.index % pointsPerInterval === this.currentPoint)
|
||||||
|
);
|
||||||
})
|
})
|
||||||
.forEach((point) => {
|
.forEach((point) => {
|
||||||
point.spawn();
|
point.spawn();
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ export namespace TrailMaker {
|
|||||||
if (event.itemStack.typeId == "minecraft:stick" && event.itemStack.nameTag == "AddPoint") {
|
if (event.itemStack.typeId == "minecraft:stick" && event.itemStack.nameTag == "AddPoint") {
|
||||||
let block = event.block;
|
let block = event.block;
|
||||||
let pos = this.BlockToParticlePosition(block);
|
let pos = this.BlockToParticlePosition(block);
|
||||||
|
world.sendMessage(`Added Point ${Vector3ToString(pos)}`);
|
||||||
this.currentTrail.points.push(new Point(pos, this.currentTrail.currentPoint));
|
this.currentTrail.points.push(new Point(pos, this.currentTrail.currentPoint));
|
||||||
|
|
||||||
this.currentTrail.currentPoint++;
|
this.currentTrail.currentPoint++;
|
||||||
@@ -80,18 +81,14 @@ export namespace TrailMaker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.itemStack.typeId == "minecraft:stick" && event.itemStack.nameTag == "AddLine") {
|
if (event.itemStack.typeId == "minecraft:stick" && event.itemStack.nameTag == "AddLine") {
|
||||||
|
world.sendMessage(`Waiting for point 2: ${this.waitingForPoint2}`);
|
||||||
if (!this.waitingForPoint2) {
|
if (!this.waitingForPoint2) {
|
||||||
this.point1 = vector3(blockInteracted.location.x, blockInteracted.location.y, blockInteracted.location.z);
|
// this.point1 = vector3(blockInteracted.location.x, blockInteracted.location.y, blockInteracted.location.z);
|
||||||
this.point1 = Vector3Add(this.point1, vector3(0.5, 0, 0.5));
|
this.point1 = this.BlockToParticlePosition(blockInteracted);
|
||||||
let isHalfBlock = blockInteracted.typeId.includes("slab") || blockInteracted.typeId.includes("stair");
|
|
||||||
if (isHalfBlock) {
|
|
||||||
this.point1 = Vector3Add(this.point1, vector3(0, 0.5, 0));
|
|
||||||
} else {
|
|
||||||
this.point1 = Vector3Add(this.point1, vector3(0, 1.1, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.waitingForPoint2 = true;
|
this.waitingForPoint2 = true;
|
||||||
Pupeteer.setActionBar("Select a second point");
|
Pupeteer.setActionBar("Select a second point");
|
||||||
|
world.sendMessage("Select a second point");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@@ -166,9 +163,13 @@ export namespace TrailMaker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Export() {
|
Export() {
|
||||||
//Convert to json, and send to the log with console.warn
|
let output = "";
|
||||||
let json = JSON.stringify(this.currentTrail.points);
|
for (let i = 0; i < this.currentTrail.points.length; i++) {
|
||||||
console.warn(json);
|
let point = this.currentTrail.points[i];
|
||||||
|
let actualPos = point.position;
|
||||||
|
output += `{ index: ${point.index}, position: vector3(${actualPos.x}, ${actualPos.y}, ${actualPos.z}) },\n`;
|
||||||
|
}
|
||||||
|
console.warn(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
private BlockToParticlePosition(block: Block): Vector3 {
|
private BlockToParticlePosition(block: Block): Vector3 {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import { MinecraftEntityTypes, Vector3, world } from "@minecraft/server";
|
import { Entity, MinecraftEntityTypes, Vector3, world } from "@minecraft/server";
|
||||||
import { Vector3ToString, vector3 } from "./vectorUtils";
|
import { Vector3ToString, vector3 } from "./vectorUtils";
|
||||||
|
import { mindKeeper } from "../../main";
|
||||||
function teleportAgent(position: Vector3) {
|
function teleportAgent(position: Vector3) {
|
||||||
world
|
world
|
||||||
.getDimension("overworld")
|
.getDimension("overworld")
|
||||||
@@ -23,12 +24,17 @@ function isAgentAt(position: Vector3): boolean {
|
|||||||
return isAgentAt;
|
return isAgentAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getAgent(): Entity {
|
||||||
|
let agent = world.getEntity(mindKeeper.get("agentid") as string);
|
||||||
|
return agent!;
|
||||||
|
}
|
||||||
|
|
||||||
function getAgentLocation(): Vector3 {
|
function getAgentLocation(): Vector3 {
|
||||||
let agentLocation: Vector3 = vector3(0, 0, 0);
|
let agentLocation: Vector3 = vector3(0, 0, 0);
|
||||||
// let agent = world.getEntity(mindKeeper.get("agentid") as string);
|
let agent = world.getEntity(mindKeeper.get("agentid") as string);
|
||||||
// agentLocation = agent!.location;
|
agentLocation = agent!.location;
|
||||||
|
|
||||||
return agentLocation;
|
return agentLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
export { teleportAgent, isAgentAt, getAgentLocation };
|
export { teleportAgent, isAgentAt, getAgentLocation, getAgent };
|
||||||
|
|||||||
@@ -218,9 +218,10 @@ function spawnParticle(
|
|||||||
) {
|
) {
|
||||||
//check if the chunk is loaded
|
//check if the chunk is loaded
|
||||||
const chunk = world.getDimension("overworld").getBlock(position);
|
const chunk = world.getDimension("overworld").getBlock(position);
|
||||||
if (!chunk?.isValid) {
|
if (!chunk?.isValid()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
map.setVector3("variable.direction", vector3(0, 0, 0));
|
||||||
|
|
||||||
const dimension = world.getDimension("overworld");
|
const dimension = world.getDimension("overworld");
|
||||||
if (dimension) {
|
if (dimension) {
|
||||||
|
|||||||
139
scripts/levelConditions/level4.ts
Normal file
139
scripts/levelConditions/level4.ts
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
import { BlockType, MinecraftBlockTypes, Vector3 } from "@minecraft/server";
|
||||||
|
import { LevelBlockCondition } from "../Commandeer/level/levelTypes";
|
||||||
|
import { vector3 } from "../Commandeer/utils/vectorUtils";
|
||||||
|
|
||||||
|
let level3Conditions: LevelBlockCondition = {
|
||||||
|
conditions: [
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(57, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(58, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(59, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(60, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(60, 70, 234),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(60, 70, 233),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(60, 70, 232),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(60, 70, 231),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(61, 70, 231),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(62, 70, 231),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(63, 70, 231),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 231),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 232),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 233),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 234),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 236),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 237),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 238),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(64, 70, 239),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(65, 70, 239),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(66, 70, 239),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(67, 70, 239),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(68, 70, 239),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(68, 70, 238),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(68, 70, 237),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(68, 70, 236),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(68, 70, 235),
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(69, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(70, 70, 235),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
block: MinecraftBlockTypes.air,
|
||||||
|
position: vector3(71, 70, 235),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export { level3Conditions };
|
||||||
73
scripts/levels/level1/mission1.ts
Normal file
73
scripts/levels/level1/mission1.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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 { level1Conditions } from "../../levelConditions/level1";
|
||||||
|
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||||
|
const Level1CommandBlockPos: Vector3 = vector3(2439, 0, 36);
|
||||||
|
|
||||||
|
const level1StartPosition: Vector3 = vector3(2451, -2, 57);
|
||||||
|
const Level1EndPosition: Vector3 = vector3(2451, -2, 41);
|
||||||
|
|
||||||
|
const level1ResetCommandBlockPos: Vector3 = vector3(56, 68, 211);
|
||||||
|
const level1: Level = new Level(
|
||||||
|
() => {
|
||||||
|
pupeteer.sendWorldMessage("%message.level1.started");
|
||||||
|
pupeteer.setTitleTimed("%message.level1.name", 2.5);
|
||||||
|
startLevel(Level1CommandBlockPos);
|
||||||
|
teleportAgent(level1StartPosition);
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
pupeteer.setActionBar("%message.level1.make");
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
pupeteer.clearActionBar();
|
||||||
|
pupeteer.sendWorldMessage("%message.level1.complete");
|
||||||
|
pupeteer.setTitleTimed("%message.level1.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(Level1EndPosition)) {
|
||||||
|
isComplete = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// world.sendMessage(`isComplete: ${isComplete}`);
|
||||||
|
// world.sendMessage(`isOutOfBounds: ${isOutOfBounds}`);
|
||||||
|
|
||||||
|
if (isOutOfBounds) {
|
||||||
|
pupeteer.sendWorldMessage("%message.level1.outOfBounds");
|
||||||
|
pupeteer.setTitleTimed("%message.level1.outOfBounds", 2.5);
|
||||||
|
// world.getDimension("overworld").runCommand("/kill @e[type=agent]");
|
||||||
|
world.getDimension("overworld").runCommand("execute as @p run codebuilder runtime stop @s");
|
||||||
|
|
||||||
|
teleportAgent(level1StartPosition);
|
||||||
|
return false;
|
||||||
|
} else if (isComplete) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
export default level1;
|
||||||
72
scripts/levels/level1/mission2.ts
Normal file
72
scripts/levels/level1/mission2.ts
Normal file
@@ -0,0 +1,72 @@
|
|||||||
|
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 Level2CommandBlockPos: Vector3 = vector3(2439, 0, 35);
|
||||||
|
|
||||||
|
const level2StartPosition: Vector3 = vector3(2446, -2, 40);
|
||||||
|
const Level2EndPosition: Vector3 = vector3(2446, -2, 30);
|
||||||
|
|
||||||
|
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 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(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;
|
||||||
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;
|
||||||
73
scripts/levels/level2/mission1.ts
Normal file
73
scripts/levels/level2/mission1.ts
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
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 { level4Conditions } from "../../levelConditions/level4";
|
||||||
|
import { mindKeeper, CURRENT_LEVEL } from "../../main";
|
||||||
|
const level4CommandBlockPos: Vector3 = vector3(2439, 0, 36);
|
||||||
|
|
||||||
|
const level4StartPosition: Vector3 = vector3(2451, -2, 57);
|
||||||
|
const level4EndPosition: Vector3 = vector3(2451, -2, 41);
|
||||||
|
|
||||||
|
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 === MinecraftBlockTypes.lava &&
|
||||||
|
blockAir &&
|
||||||
|
blockAir.type === 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;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Vector3, world } from "@minecraft/server";
|
import { BlockType, MinecraftBlockTypes, Vector3, world } from "@minecraft/server";
|
||||||
import Level from "../Commandeer/level/level";
|
import Level from "../Commandeer/level/level";
|
||||||
import { leverOn } from "../Commandeer/level/levelTypes";
|
import { leverOn } from "../Commandeer/level/levelTypes";
|
||||||
import { teleportAgent, isAgentAt } from "../Commandeer/utils/agentUtils";
|
import { teleportAgent, isAgentAt } from "../Commandeer/utils/agentUtils";
|
||||||
@@ -11,15 +11,72 @@ import Pupeteer from "../Commandeer/pupeteer";
|
|||||||
// const levelIntroCommandBlockPos: Vector3 = vector3(58, 66, 276);
|
// const levelIntroCommandBlockPos: Vector3 = vector3(58, 66, 276);
|
||||||
// const levelIntroStartPosition: Vector3 = vector3(28, 70, 269);
|
// const levelIntroStartPosition: Vector3 = vector3(28, 70, 269);
|
||||||
// const levelIntroEndPosition: Vector3 = vector3(39, 70, 269);
|
// const levelIntroEndPosition: Vector3 = vector3(39, 70, 269);
|
||||||
|
const buttonPositions: Vector3[] = [
|
||||||
|
vector3(2471, 11, 106),
|
||||||
|
vector3(2469, 11, 106),
|
||||||
|
vector3(2468, 11, 106),
|
||||||
|
vector3(2464, 11, 106),
|
||||||
|
];
|
||||||
|
|
||||||
|
const blockPositions: Vector3[] = [
|
||||||
|
vector3(2471, 12, 108),
|
||||||
|
vector3(2469, 12, 108),
|
||||||
|
vector3(2468, 12, 108),
|
||||||
|
vector3(2464, 12, 108),
|
||||||
|
];
|
||||||
|
|
||||||
|
let currentBlockSequence: BlockType[] = [];
|
||||||
|
let currentBlockSeuqenceIndex: number[] = [];
|
||||||
|
|
||||||
|
const blockCycle: BlockType[] = [
|
||||||
|
MinecraftBlockTypes.redstoneBlock,
|
||||||
|
MinecraftBlockTypes.goldBlock,
|
||||||
|
MinecraftBlockTypes.diamondBlock,
|
||||||
|
MinecraftBlockTypes.emeraldBlock,
|
||||||
|
MinecraftBlockTypes.lapisBlock,
|
||||||
|
];
|
||||||
|
|
||||||
|
let buttonPressed: boolean[] = buttonPositions.map(() => false);
|
||||||
|
|
||||||
const levelIntro: Level = new Level(
|
const levelIntro: Level = new Level(
|
||||||
() => {
|
() => {
|
||||||
Pupeteer.sendWorldMessage("%message.intro.started");
|
Pupeteer.sendWorldMessage("%message.intro.started");
|
||||||
Pupeteer.setTitleTimed("%message.intro.started", 2.5);
|
Pupeteer.setTitleTimed("%message.intro.started", 2.5);
|
||||||
// startLevel(levelIntroCommandBlockPos);
|
// startLevel(levelIntroCommandBlockPos);
|
||||||
// teleportAgent(levelIntroStartPosition);
|
// teleportAgent(levelIntroStartPosition);
|
||||||
|
blockPositions.forEach((pos) => {
|
||||||
|
let block = world.getDimension("overworld").getBlock(pos);
|
||||||
|
let index = blockPositions.indexOf(pos);
|
||||||
|
let blockType = block!.type;
|
||||||
|
currentBlockSequence[index] = blockType;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
Pupeteer.setActionBar("%message.intro.make");
|
Pupeteer.setActionBar("%message.intro.make");
|
||||||
|
|
||||||
|
buttonPositions.forEach((pos) => {
|
||||||
|
let block = world.getDimension("overworld").getBlock(pos);
|
||||||
|
if (!block) return;
|
||||||
|
let index = buttonPositions.indexOf(pos);
|
||||||
|
let prevState = buttonPressed[index];
|
||||||
|
let currentState = block!.getRedstonePower()! > 0;
|
||||||
|
|
||||||
|
if (currentState && !prevState) {
|
||||||
|
buttonPressed[index] = true;
|
||||||
|
//NextBlock
|
||||||
|
let nextBlock = currentBlockSequence[index];
|
||||||
|
let nextIndex = blockCycle.indexOf(nextBlock);
|
||||||
|
nextIndex = (nextIndex + 1) % blockCycle.length;
|
||||||
|
currentBlockSequence[index] = blockCycle[nextIndex];
|
||||||
|
//Update the block
|
||||||
|
let blockPos = blockPositions[index];
|
||||||
|
world.getDimension("overworld").getBlock(blockPos)!.setType(blockCycle[nextIndex]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!currentState && prevState) {
|
||||||
|
buttonPressed[index] = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
Pupeteer.clearActionBar();
|
Pupeteer.clearActionBar();
|
||||||
@@ -29,17 +86,28 @@ const levelIntro: Level = new Level(
|
|||||||
mindKeeper.increment(CURRENT_LEVEL);
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
|
let counter = 0;
|
||||||
let isComplete = true;
|
let isComplete = true;
|
||||||
levelIntroConditions.conditions.forEach((condition) => {
|
levelIntroConditions.conditions.forEach((condition) => {
|
||||||
let blockInworld = world.getDimension("overworld").getBlock(condition.position);
|
let blockInworld = world.getDimension("overworld").getBlock(condition.position);
|
||||||
if (blockInworld?.type !== condition.block) {
|
if (blockInworld?.type !== condition.block) {
|
||||||
isComplete = false;
|
isComplete = false;
|
||||||
|
counter++;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
world.sendMessage(`%message.intro.progress ${counter}/${levelIntroConditions.conditions.length}`);
|
||||||
|
world.sendMessage(`isComplete: ${isComplete}`);
|
||||||
if (isComplete) {
|
if (isComplete) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
},
|
||||||
|
() => {
|
||||||
|
blockPositions.forEach((pos) => {
|
||||||
|
let block = world.getDimension("overworld").getBlock(pos);
|
||||||
|
let randomBlock = blockCycle[Math.floor(Math.random() * blockCycle.length)];
|
||||||
|
block!.setType(randomBlock);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
325
scripts/main.ts
325
scripts/main.ts
@@ -5,31 +5,24 @@ import {
|
|||||||
Vector3,
|
Vector3,
|
||||||
MolangVariableMap,
|
MolangVariableMap,
|
||||||
ChatSendAfterEvent,
|
ChatSendAfterEvent,
|
||||||
Player,
|
|
||||||
Dimension,
|
Dimension,
|
||||||
BlockType,
|
TicksPerSecond,
|
||||||
Block,
|
|
||||||
} from "@minecraft/server";
|
} from "@minecraft/server";
|
||||||
import { Mindkeeper, Store, StoreType } from "./Commandeer/mindKeeper";
|
import { Mindkeeper, StoreType } from "./Commandeer/mindKeeper";
|
||||||
import Pupeteer from "./Commandeer/pupeteer";
|
import Pupeteer from "./Commandeer/pupeteer";
|
||||||
import Level from "./Commandeer/level/level";
|
import { Vector3ToCommandString, Vector3ToFancyString, vector3 } from "./Commandeer/utils/vectorUtils";
|
||||||
import { leverOn } from "./Commandeer/level/levelTypes";
|
|
||||||
import { levelIntroConditions } from "./levelConditions/levelIntro";
|
|
||||||
import {
|
|
||||||
Vector3Add,
|
|
||||||
Vector3ToCommandString,
|
|
||||||
Vector3ToFancyString,
|
|
||||||
Vector3ToString,
|
|
||||||
vector3,
|
|
||||||
} from "./Commandeer/utils/vectorUtils";
|
|
||||||
import { delay } from "./Commandeer/utils/waitUtil";
|
import { delay } from "./Commandeer/utils/waitUtil";
|
||||||
import { PARTICLES, ParticleColumn, bedrockParticles, spawnParticle } from "./Commandeer/utils/particleUtils";
|
import { spawnParticle } from "./Commandeer/utils/particleUtils";
|
||||||
import { drawArrow } from "./Commandeer/utils/arrow";
|
|
||||||
import * as agentUtils from "./Commandeer/utils/agentUtils";
|
|
||||||
import { level3Conditions } from "./levelConditions/level3";
|
|
||||||
import { TrailMaker } from "./Commandeer/trail/trailMaker";
|
import { TrailMaker } from "./Commandeer/trail/trailMaker";
|
||||||
import * as CCTrigger from "./Commandeer/Trigger/CCTrigger";
|
import * as CCTrigger from "./Commandeer/Trigger/CCTrigger";
|
||||||
import { Command, Commands } from "./Commandeer/command/command";
|
import { Commands } from "./Commandeer/command/command";
|
||||||
|
import levelIntro from "./levels/levelIntro";
|
||||||
|
import { Trail } from "./Commandeer/trail/trailEngine";
|
||||||
|
import { startTrail } from "./trails/startTrail";
|
||||||
|
import { IntroToLevel1Trail } from "./trails/IntroToLevel1Trail";
|
||||||
|
import level1 from "./levels/level1/mission1";
|
||||||
|
import level2 from "./levels/level1/mission2";
|
||||||
|
import level3 from "./levels/level1/mission3";
|
||||||
// import { loadTriggers } from "./triggers";
|
// import { loadTriggers } from "./triggers";
|
||||||
|
|
||||||
const mindKeeper = new Mindkeeper(world);
|
const mindKeeper = new Mindkeeper(world);
|
||||||
@@ -51,40 +44,89 @@ async function resetLightPath() {
|
|||||||
world.getDimension("overworld").runCommand("/fill 2467 9 87 2468 9 105 air");
|
world.getDimension("overworld").runCommand("/fill 2467 9 87 2468 9 105 air");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let introToGlassBreakTimer: number = 0;
|
||||||
|
const glassBreakTime = 2 * TicksPerSecond;
|
||||||
|
|
||||||
|
let isIntroToLevel1Sqeuence = false;
|
||||||
|
|
||||||
|
let introTrail: Trail = new Trail("introTrail", 2, 4);
|
||||||
|
introTrail.fromTrail(startTrail);
|
||||||
|
|
||||||
|
let introToLevelTrail = new Trail("introToLevelTrail", 2, 2);
|
||||||
|
introToLevelTrail.fromTrail(IntroToLevel1Trail);
|
||||||
|
|
||||||
const DEVELOPER_MODE = true;
|
const DEVELOPER_MODE = true;
|
||||||
let tickCounter = 0;
|
let tickCounter = 0;
|
||||||
system.runInterval(() => {
|
system.runInterval(async () => {
|
||||||
tickCounter++;
|
tickCounter++;
|
||||||
if (mindKeeper.initialised) {
|
if (mindKeeper.initialised) {
|
||||||
trailMaker.Update();
|
trailMaker.Update();
|
||||||
updateIntro();
|
|
||||||
//run every 4 ticks
|
|
||||||
if (tickCounter % 2 == 0) {
|
if (tickCounter % 2 == 0) {
|
||||||
triggerManager.Update();
|
triggerManager.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
const currentLevel = mindKeeper.get(CURRENT_LEVEL);
|
const currentLevel = mindKeeper.get(CURRENT_LEVEL);
|
||||||
switch (currentLevel) {
|
switch (currentLevel) {
|
||||||
|
case 0:
|
||||||
|
// Show goto airlock text
|
||||||
|
Pupeteer.setActionBar("Go to the airlock");
|
||||||
|
introTrail.spawnNext();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
Pupeteer.setActionBar("Enter the airlock");
|
||||||
|
// Show Enter airlock text
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
levelIntro.update();
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
if (!isIntroToLevel1Sqeuence) {
|
||||||
|
isIntroToLevel1Sqeuence = true;
|
||||||
|
world.sendMessage("Intro to level1 sequence start");
|
||||||
|
await lightUpPath();
|
||||||
|
await randomExplosions();
|
||||||
|
blowUpDoor();
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
introToGlassBreakTimer++;
|
||||||
|
world.sendMessage("Glass break timer: " + introToGlassBreakTimer);
|
||||||
|
if (introToGlassBreakTimer > glassBreakTime) {
|
||||||
|
introToGlassBreakTimer = 0;
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
}
|
||||||
|
case 4:
|
||||||
|
// Show Goto Level 1
|
||||||
|
if (glassWindowState == GlassWindowState.Fixed) {
|
||||||
|
glassWindowState = GlassWindowState.Broken;
|
||||||
|
system.run(async () => {
|
||||||
|
world.sendMessage("Breaking glass");
|
||||||
|
await delay(10);
|
||||||
|
breakGlassWindow();
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
introToLevelTrail.spawnNext();
|
||||||
|
Pupeteer.setActionBar("Follow the path to the temple");
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
level1.update();
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
level2.update();
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
level3.update();
|
||||||
|
break;
|
||||||
|
case 9:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const buttonPositions: Vector3[] = [
|
|
||||||
vector3(2471, 11, 106),
|
|
||||||
vector3(2469, 11, 106),
|
|
||||||
vector3(2468, 11, 106),
|
|
||||||
vector3(2464, 11, 106),
|
|
||||||
];
|
|
||||||
|
|
||||||
const blockPositions: Vector3[] = [
|
|
||||||
vector3(2471, 12, 108),
|
|
||||||
vector3(2469, 12, 108),
|
|
||||||
vector3(2468, 12, 108),
|
|
||||||
vector3(2464, 12, 108),
|
|
||||||
];
|
|
||||||
|
|
||||||
let currentBlockSequence: BlockType[] = [];
|
|
||||||
let currentBlockSeuqenceIndex: number[] = [];
|
|
||||||
|
|
||||||
triggerManager.RegisterFunctionTrigger("lightPath", (event) => {
|
triggerManager.RegisterFunctionTrigger("lightPath", (event) => {
|
||||||
lightUpPath();
|
lightUpPath();
|
||||||
});
|
});
|
||||||
@@ -102,55 +144,6 @@ async function lightUpPath() {
|
|||||||
// let pos2 = vector3(2468, 9, 105);
|
// let pos2 = vector3(2468, 9, 105);
|
||||||
}
|
}
|
||||||
|
|
||||||
const blockCycle: BlockType[] = [
|
|
||||||
MinecraftBlockTypes.redstoneBlock,
|
|
||||||
MinecraftBlockTypes.goldBlock,
|
|
||||||
MinecraftBlockTypes.diamondBlock,
|
|
||||||
MinecraftBlockTypes.emeraldBlock,
|
|
||||||
MinecraftBlockTypes.lapisBlock,
|
|
||||||
];
|
|
||||||
|
|
||||||
let buttonPressed: boolean[] = buttonPositions.map(() => false);
|
|
||||||
|
|
||||||
function startIntro() {
|
|
||||||
//Determine the current squence
|
|
||||||
|
|
||||||
blockPositions.forEach((pos) => {
|
|
||||||
let block = world.getDimension("overworld").getBlock(pos);
|
|
||||||
let index = blockPositions.indexOf(pos);
|
|
||||||
let blockType = block!.type;
|
|
||||||
currentBlockSequence[index] = blockType;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function updateIntro() {
|
|
||||||
//Check each button if it's pressed
|
|
||||||
|
|
||||||
buttonPositions.forEach((pos) => {
|
|
||||||
let block = world.getDimension("overworld").getBlock(pos);
|
|
||||||
if (!block) return;
|
|
||||||
let index = buttonPositions.indexOf(pos);
|
|
||||||
let prevState = buttonPressed[index];
|
|
||||||
let currentState = block!.getRedstonePower()! > 0;
|
|
||||||
|
|
||||||
if (currentState && !prevState) {
|
|
||||||
buttonPressed[index] = true;
|
|
||||||
//NextBlock
|
|
||||||
let nextBlock = currentBlockSequence[index];
|
|
||||||
let nextIndex = blockCycle.indexOf(nextBlock);
|
|
||||||
nextIndex = (nextIndex + 1) % blockCycle.length;
|
|
||||||
currentBlockSequence[index] = blockCycle[nextIndex];
|
|
||||||
//Update the block
|
|
||||||
let blockPos = blockPositions[index];
|
|
||||||
world.getDimension("overworld").getBlock(blockPos)!.setType(blockCycle[nextIndex]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentState && prevState) {
|
|
||||||
buttonPressed[index] = false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
world.afterEvents.worldInitialize.subscribe(({ propertyRegistry }) => {
|
world.afterEvents.worldInitialize.subscribe(({ propertyRegistry }) => {
|
||||||
mindKeeper.registerStore(CURRENT_LEVEL, StoreType.number);
|
mindKeeper.registerStore(CURRENT_LEVEL, StoreType.number);
|
||||||
mindKeeper.registerStore(AGENT_ID, StoreType.string);
|
mindKeeper.registerStore(AGENT_ID, StoreType.string);
|
||||||
@@ -167,7 +160,7 @@ world.beforeEvents.itemUseOn.subscribe((event) => {
|
|||||||
triggerManager.OnItemUse(event);
|
triggerManager.OnItemUse(event);
|
||||||
});
|
});
|
||||||
|
|
||||||
function randomExplosions() {
|
async function randomExplosions() {
|
||||||
let pos1 = vector3(2465, 10, 82);
|
let pos1 = vector3(2465, 10, 82);
|
||||||
let pos2 = vector3(2471, 18, 90);
|
let pos2 = vector3(2471, 18, 90);
|
||||||
|
|
||||||
@@ -201,7 +194,7 @@ function restoreDoor() {
|
|||||||
world.getDimension("overworld").runCommandAsync("/clone 2463 -30 81 2470 -23 87 2463 10 81");
|
world.getDimension("overworld").runCommandAsync("/clone 2463 -30 81 2470 -23 87 2463 10 81");
|
||||||
}
|
}
|
||||||
|
|
||||||
world.afterEvents.chatSend.subscribe((event: ChatSendAfterEvent) => {
|
world.afterEvents.chatSend.subscribe(async (event: ChatSendAfterEvent) => {
|
||||||
const command = event.message.split(" ")[0];
|
const command = event.message.split(" ")[0];
|
||||||
|
|
||||||
trailMaker.OnChat(event);
|
trailMaker.OnChat(event);
|
||||||
@@ -210,6 +203,22 @@ world.afterEvents.chatSend.subscribe((event: ChatSendAfterEvent) => {
|
|||||||
|
|
||||||
if (command === "!reset") {
|
if (command === "!reset") {
|
||||||
world.sendMessage("Resetting");
|
world.sendMessage("Resetting");
|
||||||
|
|
||||||
|
mindKeeper.set(CURRENT_LEVEL, 0);
|
||||||
|
|
||||||
|
restoreDoor();
|
||||||
|
resetAirLock();
|
||||||
|
restoreGlassWindow(true);
|
||||||
|
|
||||||
|
resetLightPath();
|
||||||
|
|
||||||
|
levelIntro.reset();
|
||||||
|
level1.reset();
|
||||||
|
level2.reset();
|
||||||
|
|
||||||
|
//Reset the combination to a random squence
|
||||||
|
|
||||||
|
isIntroToLevel1Sqeuence = false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -231,6 +240,82 @@ class ClonePos {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum GlassWindowState {
|
||||||
|
Broken,
|
||||||
|
Fixed,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AirLockState {
|
||||||
|
Open,
|
||||||
|
Closed,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum AirLockChamberState {
|
||||||
|
Full,
|
||||||
|
Empty,
|
||||||
|
}
|
||||||
|
|
||||||
|
enum ExplosiveDoorState {
|
||||||
|
Closed,
|
||||||
|
Open,
|
||||||
|
}
|
||||||
|
|
||||||
|
let glassWindowState: GlassWindowState = GlassWindowState.Fixed;
|
||||||
|
let explosiveDoorState: ExplosiveDoorState = ExplosiveDoorState.Closed;
|
||||||
|
|
||||||
|
const doorRoot: Vector3 = vector3(2465, 11, 94);
|
||||||
|
|
||||||
|
const glassWindowClonePos: ClonePos = {
|
||||||
|
point1: vector3(2465, 14, 94),
|
||||||
|
point2: vector3(2470, 11, 94),
|
||||||
|
};
|
||||||
|
|
||||||
|
const glassBreakingFrames: ClonePos[] = [
|
||||||
|
///fill 2465 7 94 2470 4 94
|
||||||
|
{
|
||||||
|
point1: vector3(2465, 7, 94),
|
||||||
|
point2: vector3(2470, 4, 94),
|
||||||
|
},
|
||||||
|
//fill 2465 0 94 2470 -3 94
|
||||||
|
{
|
||||||
|
point1: vector3(2465, 0, 94),
|
||||||
|
point2: vector3(2470, -3, 94),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
//fill 2465 -7 94 2470 -10 94
|
||||||
|
point1: vector3(2465, -7, 94),
|
||||||
|
point2: vector3(2470, -10, 94),
|
||||||
|
},
|
||||||
|
//fill 2465 -14 94 2470 -17 94
|
||||||
|
{
|
||||||
|
point1: vector3(2465, -14, 94),
|
||||||
|
point2: vector3(2470, -17, 94),
|
||||||
|
},
|
||||||
|
//fill 2465 -21 94 2470 -24 94
|
||||||
|
{
|
||||||
|
point1: vector3(2465, -21, 94),
|
||||||
|
point2: vector3(2470, -24, 94),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
const crackedGlass: string = "cc:cracked_glass";
|
||||||
|
Commands.register(PREFIX, "breakGlass", (arg) => {
|
||||||
|
breakGlassWindow();
|
||||||
|
glassWindowState = GlassWindowState.Broken;
|
||||||
|
});
|
||||||
|
Commands.register(PREFIX, "restoreGlass", (arg) => {
|
||||||
|
restoreGlassWindow();
|
||||||
|
glassWindowState = GlassWindowState.Fixed;
|
||||||
|
});
|
||||||
|
|
||||||
|
async function breakGlassWindow() {
|
||||||
|
playAnimation(glassBreakingFrames, 5, false, doorRoot);
|
||||||
|
glassWindowState = GlassWindowState.Broken;
|
||||||
|
}
|
||||||
|
async function restoreGlassWindow(force: boolean = false) {
|
||||||
|
playAnimation(glassBreakingFrames, 5, true, doorRoot, force);
|
||||||
|
}
|
||||||
|
|
||||||
const FrontAirLockOpenFrames: ClonePos[] = [
|
const FrontAirLockOpenFrames: ClonePos[] = [
|
||||||
{
|
{
|
||||||
point1: vector3(2476, 9, 94),
|
point1: vector3(2476, 9, 94),
|
||||||
@@ -309,16 +394,6 @@ async function CycleAirLockWater(fill: boolean, delayTime: number) {
|
|||||||
animationPlaying = false;
|
animationPlaying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AirLockState {
|
|
||||||
Open,
|
|
||||||
Closed,
|
|
||||||
}
|
|
||||||
|
|
||||||
enum AirLockChamberState {
|
|
||||||
Full,
|
|
||||||
Empty,
|
|
||||||
}
|
|
||||||
|
|
||||||
let frontAirlockState: AirLockState = AirLockState.Closed;
|
let frontAirlockState: AirLockState = AirLockState.Closed;
|
||||||
let backAirlockState: AirLockState = AirLockState.Closed;
|
let backAirlockState: AirLockState = AirLockState.Closed;
|
||||||
|
|
||||||
@@ -340,6 +415,12 @@ triggerManager.RegisterFunctionTrigger("FrontAirLockOutside", async (event) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
triggerManager.RegisterFunctionTrigger("TempleFrontDoor", async (event) => {
|
||||||
|
if (mindKeeper.get(CURRENT_LEVEL) == 5) {
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
//Player enters FrontAirLockInside
|
//Player enters FrontAirLockInside
|
||||||
//Front door closes
|
//Front door closes
|
||||||
//Water drains
|
//Water drains
|
||||||
@@ -406,7 +487,7 @@ Commands.register(PREFIX, "restore", (arg) => {
|
|||||||
restoreDoor();
|
restoreDoor();
|
||||||
});
|
});
|
||||||
|
|
||||||
Commands.register(PREFIX, "resetAirlock", (arg) => {
|
function resetAirLock() {
|
||||||
SetFrontDoorClosed();
|
SetFrontDoorClosed();
|
||||||
SetBackDoorClosed();
|
SetBackDoorClosed();
|
||||||
FillAirlockWater();
|
FillAirlockWater();
|
||||||
@@ -414,8 +495,10 @@ Commands.register(PREFIX, "resetAirlock", (arg) => {
|
|||||||
frontAirlockState = AirLockState.Closed;
|
frontAirlockState = AirLockState.Closed;
|
||||||
backAirlockState = AirLockState.Closed;
|
backAirlockState = AirLockState.Closed;
|
||||||
chamberState = AirLockChamberState.Full;
|
chamberState = AirLockChamberState.Full;
|
||||||
});
|
glassWindowState = GlassWindowState.Fixed;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
Commands.register(PREFIX, "resetAirlock", (arg) => resetAirLock);
|
||||||
|
|
||||||
let frontDoorRoot: Vector3 = vector3(2474, 11, 94);
|
let frontDoorRoot: Vector3 = vector3(2474, 11, 94);
|
||||||
let backDoorRoot: Vector3 = vector3(2472, 11, 100);
|
let backDoorRoot: Vector3 = vector3(2472, 11, 100);
|
||||||
@@ -424,7 +507,12 @@ const frameDuration = 7;
|
|||||||
|
|
||||||
let SetFrontDoorClosed = () => SetFrame(FrontAirLockOpenFrames[0], frontDoorRoot);
|
let SetFrontDoorClosed = () => SetFrame(FrontAirLockOpenFrames[0], frontDoorRoot);
|
||||||
let SetFrontDoorOpen = () => SetFrame(FrontAirLockOpenFrames[FrontAirLockOpenFrames.length - 1], frontDoorRoot);
|
let SetFrontDoorOpen = () => SetFrame(FrontAirLockOpenFrames[FrontAirLockOpenFrames.length - 1], frontDoorRoot);
|
||||||
let PlayFrontDoorOpenAnimation = async () => playAnimation(FrontAirLockOpenFrames, frameDuration, false, frontDoorRoot);
|
let PlayFrontDoorOpenAnimation = async () => {
|
||||||
|
playAnimation(FrontAirLockOpenFrames, frameDuration, false, frontDoorRoot);
|
||||||
|
if (mindKeeper.get(CURRENT_LEVEL) == 0) {
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
}
|
||||||
|
};
|
||||||
let PlayFrontDoorCloseAnimation = async () => playAnimation(FrontAirLockOpenFrames, frameDuration, true, frontDoorRoot);
|
let PlayFrontDoorCloseAnimation = async () => playAnimation(FrontAirLockOpenFrames, frameDuration, true, frontDoorRoot);
|
||||||
|
|
||||||
let SetBackDoorClosed = () => SetFrame(BackAirLockOpenFrames[0], backDoorRoot);
|
let SetBackDoorClosed = () => SetFrame(BackAirLockOpenFrames[0], backDoorRoot);
|
||||||
@@ -433,7 +521,12 @@ let PlayBackDoorOpenAnimation = async () => playAnimation(BackAirLockOpenFrames,
|
|||||||
let PlayBackDoorCloseAnimation = async () => playAnimation(BackAirLockOpenFrames, frameDuration, true, backDoorRoot);
|
let PlayBackDoorCloseAnimation = async () => playAnimation(BackAirLockOpenFrames, frameDuration, true, backDoorRoot);
|
||||||
|
|
||||||
let FillAirlockWater = async () => CycleAirLockWater(true, frameDuration / 1.5);
|
let FillAirlockWater = async () => CycleAirLockWater(true, frameDuration / 1.5);
|
||||||
let EmptyAirlockWater = async () => CycleAirLockWater(false, frameDuration / 1.5);
|
let EmptyAirlockWater = async () => {
|
||||||
|
await CycleAirLockWater(false, frameDuration / 1.5);
|
||||||
|
if (mindKeeper.get(CURRENT_LEVEL) == 1) {
|
||||||
|
mindKeeper.increment(CURRENT_LEVEL);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
triggerManager.RegisterFunctionTrigger("openFrontDoor", (event) => PlayFrontDoorOpenAnimation());
|
triggerManager.RegisterFunctionTrigger("openFrontDoor", (event) => PlayFrontDoorOpenAnimation());
|
||||||
triggerManager.RegisterFunctionTrigger("closeFrontDoor", (event) => PlayFrontDoorCloseAnimation());
|
triggerManager.RegisterFunctionTrigger("closeFrontDoor", (event) => PlayFrontDoorCloseAnimation());
|
||||||
@@ -455,13 +548,21 @@ async function SetFrame(frame: ClonePos, destination: Vector3) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let animationPlaying = false;
|
let animationPlaying = false;
|
||||||
async function playAnimation(frames: ClonePos[], delayTime: number, reverse: boolean, destination: Vector3) {
|
async function playAnimation(
|
||||||
if (animationPlaying) {
|
frames: ClonePos[],
|
||||||
|
delayTime: number,
|
||||||
|
reverse: boolean,
|
||||||
|
destination: Vector3,
|
||||||
|
force: boolean = false
|
||||||
|
) {
|
||||||
|
if (animationPlaying && !force) {
|
||||||
world.sendMessage("Animation already playing");
|
world.sendMessage("Animation already playing");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let frameCount = frames.length;
|
let frameCount = frames.length;
|
||||||
|
if (!force) {
|
||||||
animationPlaying = true;
|
animationPlaying = true;
|
||||||
|
}
|
||||||
|
|
||||||
for (let i = 0; i < frameCount; i++) {
|
for (let i = 0; i < frameCount; i++) {
|
||||||
let frame = reverse ? frames[frameCount - i - 1] : frames[i];
|
let frame = reverse ? frames[frameCount - i - 1] : frames[i];
|
||||||
@@ -474,5 +575,15 @@ async function playAnimation(frames: ClonePos[], delayTime: number, reverse: boo
|
|||||||
);
|
);
|
||||||
await delay(delayTime);
|
await delay(delayTime);
|
||||||
}
|
}
|
||||||
|
if (!force) {
|
||||||
animationPlaying = false;
|
animationPlaying = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
system.afterEvents.scriptEventReceive.subscribe((event) => {
|
||||||
|
if (event.id == "cc:getId") {
|
||||||
|
let id = event.message;
|
||||||
|
world.sendMessage("Script got the id " + id);
|
||||||
|
mindKeeper.set(AGENT_ID, id);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|||||||
82
scripts/trails/IntroToLevel1Trail.ts
Normal file
82
scripts/trails/IntroToLevel1Trail.ts
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
import { Vector3 } from "@minecraft/server";
|
||||||
|
import { TrailType } from "../Commandeer/trail/trailTypes";
|
||||||
|
import { vector3 } from "../Commandeer/utils/vectorUtils";
|
||||||
|
|
||||||
|
let IntroToLevel1Trail: TrailType = {
|
||||||
|
name: "IntroToLevel1Trail",
|
||||||
|
points: [
|
||||||
|
{ index: 0, position: vector3(2468, 11.1, 104.5) },
|
||||||
|
{ index: 1, position: vector3(2468, 11.1, 103.5) },
|
||||||
|
{ index: 2, position: vector3(2468, 11.1, 102.5) },
|
||||||
|
{ index: 3, position: vector3(2468, 11.1, 101.5) },
|
||||||
|
{ index: 4, position: vector3(2468, 11.1, 100.5) },
|
||||||
|
{ index: 5, position: vector3(2468, 11.1, 99.5) },
|
||||||
|
{ index: 6, position: vector3(2468, 11.1, 98.5) },
|
||||||
|
{ index: 7, position: vector3(2468, 11.1, 97.5) },
|
||||||
|
{ index: 8, position: vector3(2468, 11.1, 96.5) },
|
||||||
|
{ index: 9, position: vector3(2468, 11.1, 95.5) },
|
||||||
|
{ index: 11, position: vector3(2468, 11.1, 94.5) },
|
||||||
|
{ index: 12, position: vector3(2468, 11.1, 93.5) },
|
||||||
|
{ index: 13, position: vector3(2468, 11.1, 92.5) },
|
||||||
|
{ index: 14, position: vector3(2468, 11.1, 91.5) },
|
||||||
|
{ index: 15, position: vector3(2468, 11.1, 90.5) },
|
||||||
|
{ index: 16, position: vector3(2468, 11.1, 89.5) },
|
||||||
|
{ index: 17, position: vector3(2468, 11.1, 88.5) },
|
||||||
|
{ index: 19, position: vector3(2468, 11.1, 87.5) },
|
||||||
|
{ index: 20, position: vector3(2468, 11.1, 86.5) },
|
||||||
|
{ index: 21, position: vector3(2468, 11.1, 85.5) },
|
||||||
|
{ index: 22, position: vector3(2468, 11.1, 84.5) },
|
||||||
|
{ index: 24, position: vector3(2468, 11.1, 83.5) },
|
||||||
|
{ index: 26, position: vector3(2468, 10.1, 82.5) },
|
||||||
|
{ index: 27, position: vector3(2468, 10.1, 81.5) },
|
||||||
|
{ index: 28, position: vector3(2468, 10.1, 80.5) },
|
||||||
|
{ index: 29, position: vector3(2468, 9.1, 80.5) },
|
||||||
|
{ index: 30, position: vector3(2468, 8.1, 80.5) },
|
||||||
|
{ index: 31, position: vector3(2468, 7.1, 79.5) },
|
||||||
|
{ index: 32, position: vector3(2468, 6.1, 78.5) },
|
||||||
|
{ index: 33, position: vector3(2468, 5.1, 77.5) },
|
||||||
|
{ index: 34, position: vector3(2468, 4.1, 76.5) },
|
||||||
|
{ index: 35, position: vector3(2468, 3.1, 75.5) },
|
||||||
|
{ index: 36, position: vector3(2468, 2.1, 74.5) },
|
||||||
|
{ index: 37, position: vector3(2468, 1.1, 73.5) },
|
||||||
|
{ index: 38, position: vector3(2468, 0.1, 72.5) },
|
||||||
|
{ index: 39, position: vector3(2468, -0.9, 71.5) },
|
||||||
|
{ index: 40, position: vector3(2468, -0.9, 70.5) },
|
||||||
|
{ index: 41, position: vector3(2468, -0.9, 69.5) },
|
||||||
|
{ index: 42, position: vector3(2468, -0.9, 68.5) },
|
||||||
|
{ index: 43, position: vector3(2468, -0.9, 67.5) },
|
||||||
|
{ index: 44, position: vector3(2468, -0.9, 66.5) },
|
||||||
|
{ index: 45, position: vector3(2468, -0.9, 65.5) },
|
||||||
|
{ index: 46, position: vector3(2468, -0.9, 64.5) },
|
||||||
|
{ index: 47, position: vector3(2468, -0.9, 63.5) },
|
||||||
|
{ index: 48, position: vector3(2468, -0.9, 62.5) },
|
||||||
|
{ index: 49, position: vector3(2468, -0.9, 61.5) },
|
||||||
|
{ index: 50, position: vector3(2468, -0.9, 60.5) },
|
||||||
|
{ index: 51, position: vector3(2468, -0.9, 59.5) },
|
||||||
|
{ index: 52, position: vector3(2468, -0.9, 58.5) },
|
||||||
|
{ index: 53, position: vector3(2468, -0.9, 57.5) },
|
||||||
|
{ index: 54, position: vector3(2468, -0.9, 56.5) },
|
||||||
|
{ index: 55, position: vector3(2468, -0.9, 55.5) },
|
||||||
|
{ index: 56, position: vector3(2468, -0.9, 54.5) },
|
||||||
|
{ index: 57, position: vector3(2468, -0.9, 53.5) },
|
||||||
|
{ index: 58, position: vector3(2468, -0.9, 52.5) },
|
||||||
|
{ index: 59, position: vector3(2468, -0.9, 51.5) },
|
||||||
|
{ index: 60, position: vector3(2468, -0.9, 50.5) },
|
||||||
|
{ index: 61, position: vector3(2468, -0.9, 49.5) },
|
||||||
|
{ index: 62, position: vector3(2468, -0.9, 48.5) },
|
||||||
|
{ index: 63, position: vector3(2468, -0.9, 47.5) },
|
||||||
|
{ index: 64, position: vector3(2468, -0.9, 46.5) },
|
||||||
|
{ index: 65, position: vector3(2468, -0.9, 45.5) },
|
||||||
|
{ index: 66, position: vector3(2468, -0.9, 44.5) },
|
||||||
|
{ index: 67, position: vector3(2468, -0.9, 43.5) },
|
||||||
|
{ index: 68, position: vector3(2468, -0.9, 42.5) },
|
||||||
|
{ index: 69, position: vector3(2468, -0.9, 41.5) },
|
||||||
|
{ index: 70, position: vector3(2468, -0.9, 40.5) },
|
||||||
|
{ index: 71, position: vector3(2468, -0.9, 39.5) },
|
||||||
|
{ index: 72, position: vector3(2468, -0.9, 38.5) },
|
||||||
|
{ index: 73, position: vector3(2468, -0.9, 37.5) },
|
||||||
|
{ index: 74, position: vector3(2468, -0.9, 36.5) },
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
export { IntroToLevel1Trail };
|
||||||
@@ -5,61 +5,57 @@ import { vector3 } from "../Commandeer/utils/vectorUtils";
|
|||||||
let startTrail: TrailType = {
|
let startTrail: TrailType = {
|
||||||
name: "startTrail",
|
name: "startTrail",
|
||||||
points: [
|
points: [
|
||||||
{ index: 0, position: vector3(50, 70, 266) },
|
{ index: 0, position: vector3(2493.5, 38.1, 88.5) },
|
||||||
{ index: 1, position: vector3(50, 70, 265) },
|
{ index: 1, position: vector3(2492.5, 38.1, 88.5) },
|
||||||
{ index: 2, position: vector3(50, 70, 264) },
|
{ index: 2, position: vector3(2491.5, 38.1, 88.5) },
|
||||||
{ index: 3, position: vector3(50, 70, 263) },
|
{ index: 3, position: vector3(2490.5, 38.1, 88.5) },
|
||||||
{ index: 4, position: vector3(50, 70, 262) },
|
{ index: 4, position: vector3(2489.5, 38.1, 88.5) },
|
||||||
{ index: 5, position: vector3(50, 70, 261) },
|
{ index: 5, position: vector3(2488.5, 38.1, 88.5) },
|
||||||
{ index: 6, position: vector3(50, 70, 260) },
|
{ index: 6, position: vector3(2487.5, 38.1, 88.5) },
|
||||||
{ index: 7, position: vector3(50, 70, 259) },
|
{ index: 7, position: vector3(2486.5, 38.1, 88.5) },
|
||||||
{ index: 8, position: vector3(50, 70, 258) },
|
{ index: 8, position: vector3(2486.5, 37.1, 88.5) },
|
||||||
{ index: 9, position: vector3(50, 70, 257) },
|
{ index: 9, position: vector3(2486.5, 36.1, 88.5) },
|
||||||
{ index: 10, position: vector3(50, 70, 256) },
|
{ index: 10, position: vector3(2486.5, 35.1, 88.5) },
|
||||||
{ index: 11, position: vector3(50, 70, 255) },
|
{ index: 11, position: vector3(2486.5, 34.1, 88.5) },
|
||||||
{ index: 12, position: vector3(50, 70, 254) },
|
{ index: 12, position: vector3(2486.5, 33.1, 88.5) },
|
||||||
{ index: 13, position: vector3(50, 70, 253) },
|
{ index: 13, position: vector3(2486.5, 32.1, 88.5) },
|
||||||
{ index: 14, position: vector3(50, 70, 252) },
|
{ index: 14, position: vector3(2485.5, 32.1, 88.5) },
|
||||||
{ index: 15, position: vector3(50, 70, 251) },
|
{ index: 15, position: vector3(2484.5, 32.1, 88.5) },
|
||||||
{ index: 16, position: vector3(50, 70, 250) },
|
{ index: 16, position: vector3(2483.5, 32.1, 88.5) },
|
||||||
{ index: 17, position: vector3(50, 70, 249) },
|
{ index: 17, position: vector3(2482.5, 32.1, 88.5) },
|
||||||
{ index: 18, position: vector3(50, 70, 248) },
|
{ index: 18, position: vector3(2481.5, 32.1, 88.5) },
|
||||||
{ index: 19, position: vector3(50, 70, 247) },
|
{ index: 19, position: vector3(2480.5, 32.1, 88.5) },
|
||||||
{ index: 20, position: vector3(50, 70, 246) },
|
{ index: 20, position: vector3(2479.5, 32.1, 88.5) },
|
||||||
{ index: 21, position: vector3(50, 70, 245) },
|
{ index: 21, position: vector3(2478.5, 32.1, 88.5) },
|
||||||
{ index: 22, position: vector3(50, 70, 244) },
|
{ index: 22, position: vector3(2477.5, 32.1, 88.5) },
|
||||||
{ index: 23, position: vector3(50, 70, 243) },
|
{ index: 23, position: vector3(2476.5, 32.1, 88.5) },
|
||||||
{ index: 24, position: vector3(50, 70, 242) },
|
{ index: 24, position: vector3(2475.5, 32.1, 88.5) },
|
||||||
{ index: 25, position: vector3(50, 70, 241) },
|
{ index: 25, position: vector3(2475.5, 31.1, 88.5) },
|
||||||
{ index: 26, position: vector3(50, 70, 240) },
|
{ index: 26, position: vector3(2475.5, 30.1, 88.5) },
|
||||||
{ index: 27, position: vector3(50, 70, 239) },
|
{ index: 27, position: vector3(2475.5, 29.1, 88.5) },
|
||||||
{ index: 1, position: vector3(50, 70, 238) },
|
{ index: 28, position: vector3(2475.5, 28.1, 88.5) },
|
||||||
{ index: 2, position: vector3(50, 70, 237) },
|
{ index: 29, position: vector3(2475.5, 27.1, 88.5) },
|
||||||
{ index: 3, position: vector3(50, 70, 236) },
|
{ index: 30, position: vector3(2475.5, 26.1, 88.5) },
|
||||||
{ index: 4, position: vector3(50, 70, 235) },
|
{ index: 31, position: vector3(2475.5, 25.1, 88.5) },
|
||||||
{ index: 5, position: vector3(50, 70, 234) },
|
{ index: 32, position: vector3(2475.5, 24.1, 88.5) },
|
||||||
{ index: 6, position: vector3(50, 70, 233) },
|
{ index: 33, position: vector3(2475.5, 23.1, 88.5) },
|
||||||
{ index: 7, position: vector3(50, 70, 232) },
|
{ index: 34, position: vector3(2475.5, 22.1, 88.5) },
|
||||||
{ index: 8, position: vector3(50, 70, 231) },
|
{ index: 35, position: vector3(2475.5, 21.1, 88.5) },
|
||||||
{ index: 9, position: vector3(50, 70, 230) },
|
{ index: 36, position: vector3(2475.5, 20.1, 88.5) },
|
||||||
{ index: 10, position: vector3(50, 70, 229) },
|
{ index: 37, position: vector3(2475.5, 19.1, 88.5) },
|
||||||
{ index: 11, position: vector3(50, 70, 228) },
|
{ index: 38, position: vector3(2475.5, 18.1, 88.5) },
|
||||||
{ index: 12, position: vector3(50, 70, 227) },
|
{ index: 39, position: vector3(2475.5, 17.1, 88.5) },
|
||||||
{ index: 13, position: vector3(50, 70, 226) },
|
{ index: 40, position: vector3(2475.5, 16.1, 88.5) },
|
||||||
{ index: 14, position: vector3(50, 70, 225) },
|
{ index: 41, position: vector3(2475.5, 15.1, 88.5) },
|
||||||
{ index: 15, position: vector3(50, 70, 224) },
|
{ index: 42, position: vector3(2475.5, 14.1, 88.5) },
|
||||||
{ index: 16, position: vector3(50, 70, 223) },
|
{ index: 43, position: vector3(2475.5, 13.1, 88.5) },
|
||||||
{ index: 17, position: vector3(50, 70, 222) },
|
{ index: 44, position: vector3(2475.5, 12.1, 88.5) },
|
||||||
{ index: 18, position: vector3(50, 70, 221) },
|
{ index: 45, position: vector3(2475.5, 11.1, 88.5) },
|
||||||
{ index: 19, position: vector3(50, 70, 220) },
|
{ index: 46, position: vector3(2475.5, 11.1, 89.5) },
|
||||||
{ index: 20, position: vector3(50, 70, 219) },
|
{ index: 47, position: vector3(2475.5, 11.1, 90.5) },
|
||||||
{ index: 21, position: vector3(50, 70, 218) },
|
{ index: 48, position: vector3(2475.5, 11.1, 91.5) },
|
||||||
{ index: 22, position: vector3(50, 70, 217) },
|
{ index: 49, position: vector3(2475.5, 11.1, 92.5) },
|
||||||
{ index: 23, position: vector3(50, 70, 216) },
|
{ index: 50, position: vector3(2475.5, 11.1, 93.5) },
|
||||||
{ index: 24, position: vector3(51, 70, 216) },
|
|
||||||
{ index: 25, position: vector3(52, 70, 216) },
|
|
||||||
{ index: 26, position: vector3(53, 70, 216) },
|
|
||||||
{ index: 27, position: vector3(54, 70, 216) },
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user