1
0
Fork 0
undar-lang-register/docs/project-example-v3/src/common.ztl

38 lines
713 B
Plaintext

type Vec {
init(f32 x, f32 y, f32 z) {
set this.x to x;
set this.y to y;
set this.z to z;
}
}
type Color {
init(i8 r, i8 g, i8 b) {
set this.r to r;
set this.g to g;
set this.b to b;
}
}
type Player {
init (9p server, str username, Vec pos, Color color) {
set this.server to server;
set this.username to username;
set this.pos to pos;
set this.color to color;
}
login (str password) Player[] {
this.server.auth(this.username, password);
set this.players to server.open("players");
return players.read();
}
logout() {
this.players.flush();
this.server.clunk();
}
}
const purple is Color(255, 255, 0);