Skip to content

Commit 16ed9b5

Browse files
committed
Code clean up
1 parent 0af67b8 commit 16ed9b5

19 files changed

+251
-250
lines changed

src/scripts/EventHandler.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,22 @@ class EventHandler {
142142
}
143143
}
144144
});
145+
$(document).on("mousedown", (e) => {
146+
if (e.which === 1) {
147+
this.game.mouse = true;
148+
if (this.game.eh.gameState === "gameLock") {
149+
this.game.bb.digRequest();
150+
}
151+
} else if (e.which === 3) {
152+
this.game.bp.placeBlock();
153+
}
154+
});
155+
$(document).on("mouseup", (e) => {
156+
if (e.which === 1) {
157+
this.game.mouse = false;
158+
return this.game.bb.stopDigging();
159+
}
160+
});
145161
$(".gameOn").on("click", () => {
146162
this.setState("game");
147163
});

src/scripts/Setup.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ import { WebGLRenderer, Scene, PerspectiveCamera, AmbientLight } from "three";
22
import TWEEN from "@tweenjs/tween.js";
33
import Stats from "stats-js";
44
import * as dat from "dat.gui";
5-
import { DistanceBasedFog } from "./DistanceBasedFog.js";
5+
import { DistanceBasedFog } from "./rendering/DistanceBasedFog.js";
66
import { UrlParams } from "./UrlParams.js";
7-
import { gpuInfo } from "./gpuInfo.js";
8-
import { World } from "./World/World.js";
9-
import { InventoryBar } from "./InventoryBar.js";
10-
import { Chat } from "./Chat.js";
11-
import { Entities } from "./Entities.js";
12-
import { PlayerInInventory } from "./PlayerInInventory.js";
13-
import { BlockBreak } from "./BlockBreak.js";
14-
import { BlockPlace } from "./BlockPlace.js";
7+
import { gpuInfo } from "./additional/gpuInfo.js";
8+
import { World } from "./world/World.js";
9+
import { InventoryBar } from "./gui/InventoryBar.js";
10+
import { Chat } from "./gui/Chat.js";
11+
import { Entities } from "./rendering/Entities.js";
12+
import { PlayerInInventory } from "./gui/PlayerInInventory.js";
13+
import { BlockBreak } from "./rendering/BlockBreak.js";
14+
import { BlockPlace } from "./rendering/BlockPlace.js";
1515
import { EventHandler } from "./EventHandler.js";
1616
import { Socket } from "./Socket.js";
1717

@@ -36,7 +36,8 @@ async function Setup(game) {
3636
game.stats.showPanel(0);
3737
document.body.appendChild(game.stats.dom);
3838
game.distanceBasedFog = new DistanceBasedFog(game);
39-
UrlParams(game, (password) => {
39+
UrlParams(game).then((password) => {
40+
$(".loadingText").text(`Connecting to ${game.server}...`);
4041
console.warn(gpuInfo());
4142
let prefix;
4243
if (document.location.protocol === "https:") {

0 commit comments

Comments
 (0)