summaryrefslogtreecommitdiff
path: root/test-client/main.ts
diff options
context:
space:
mode:
authormetamuffin <metamuffin@disroot.org>2024-09-25 15:30:09 +0200
committermetamuffin <metamuffin@disroot.org>2024-09-25 15:55:00 +0200
commit9587d6b4d4389f6108e2be0ff5c0f4a495ff842d (patch)
tree3cc2ea9a93de6dd39acd5396fddfbadafef471cf /test-client/main.ts
parent64564a25db65d7a578fee537a0cf91db1a7dbc60 (diff)
downloadhurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar
hurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar.bz2
hurrycurry-9587d6b4d4389f6108e2be0ff5c0f4a495ff842d.tar.zst
player class decoupled from character id
Diffstat (limited to 'test-client/main.ts')
-rw-r--r--test-client/main.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/test-client/main.ts b/test-client/main.ts
index 3568244e..c56f9db4 100644
--- a/test-client/main.ts
+++ b/test-client/main.ts
@@ -20,7 +20,7 @@
import { init_locale } from "./locale.ts";
import { MovementBase, collide_player_player, update_movement } from "./movement.ts";
import { particle_splash, tick_particles } from "./particles.ts";
-import { Gamedata, ItemIndex, ItemLocation, Message, MessageTimeout, PacketC, PacketS, PlayerID, Score, TileIndex } from "./protocol.ts";
+import { Gamedata, ItemIndex, ItemLocation, Message, MessageTimeout, PacketC, PacketS, PlayerClass, PlayerID, Score, TileIndex } from "./protocol.ts";
import { V2, lerp_exp_v2_mut, normalize, lerp_exp } from "./util.ts";
import { draw_ingame, draw_wait } from "./visual.ts";
@@ -50,7 +50,7 @@ document.addEventListener("DOMContentLoaded", async () => {
ws.onclose = () => console.log("close")
ws.onopen = () => {
console.log("open")
- send({ type: "join", name: "test", character: Math.floor(Math.random() * 255) })
+ send({ type: "join", name: "test", character: Math.floor(Math.random() * 255), class: "chef" })
}
canvas = document.createElement("canvas");
@@ -85,6 +85,7 @@ export interface PlayerData extends MovementBase {
name: string,
item?: ItemData,
direction: V2,
+ class: PlayerClass,
character: number,
anim_position: V2,
message_persist?: MessageData,
@@ -153,6 +154,7 @@ function packet(p: PacketC) {
position: { x: p.position[0], y: p.position[1], },
anim_position: { x: p.position[0], y: p.position[1] },
character: p.character,
+ class: p.class,
name: p.name,
rot: 0,
facing: { x: 0, y: 1 },