tangled
alpha
login
or
join now
eldridge.cam
/
cartography
0
fork
atom
Trading card city builder game?
0
fork
atom
overview
issues
pulls
pipelines
fixes
eldridge.cam
1 month ago
90007a14
0fffb057
verified
This commit was signed with the committer's
known signature
.
eldridge.cam
SSH Key Fingerprint:
SHA256:MAgO4sya2MgvdgUjSGKAO0lQ9X2HQp1Jb+x/Tpeeims=
0/0
Waiting for spindle ...
+15
-7
3 changed files
expand all
collapse all
unified
split
app
src
lib
appserver
socket
SocketV1Protocol.ts
src
actor
player_socket
mod.rs
db.rs
+12
-3
app/src/lib/appserver/socket/SocketV1Protocol.ts
···
126
126
});
127
127
export type GameState = StaticDecode<typeof GameState>;
128
128
129
129
-
export const Authenticate = Type.Object({ type: Type.Literal("Authenticate"), data: Type.String() });
129
129
+
export const Authenticate = Type.Object({
130
130
+
type: Type.Literal("Authenticate"),
131
131
+
data: Type.String(),
132
132
+
});
130
133
export type Authenticate = StaticDecode<typeof Authenticate>;
131
134
132
135
export const ListFields = Type.Object({ type: Type.Literal("ListFields") });
···
138
141
export const Unsubscribe = Type.Object({ type: Type.Literal("Unsubscribe") });
139
142
export type Unsubscribe = StaticDecode<typeof Unsubscribe>;
140
143
141
141
-
export const DebugAddCard = Type.Object({ type: Type.Literal("DebugAddCard"), data: Type.String() });
144
144
+
export const DebugAddCard = Type.Object({
145
145
+
type: Type.Literal("DebugAddCard"),
146
146
+
data: Type.String(),
147
147
+
});
142
148
export type DebugAddCard = StaticDecode<typeof DebugAddCard>;
143
149
144
150
export const Request = Type.Union([
···
159
165
export const PutState = Type.Object({ type: Type.Literal("PutState"), data: GameState });
160
166
export type PutState = StaticDecode<typeof PutState>;
161
167
162
162
-
export const PatchState = Type.Object({ type: Type.Literal("PatchState"), data: Type.Array(JsonPatch) });
168
168
+
export const PatchState = Type.Object({
169
169
+
type: Type.Literal("PatchState"),
170
170
+
data: Type.Array(JsonPatch),
171
171
+
});
163
172
export type PatchState = StaticDecode<typeof PatchState>;
164
173
165
174
export const Response = Type.Union([Authenticated, FieldList, PutState, PatchState]);
+2
-4
src/actor/player_socket/mod.rs
···
67
67
) -> Self::Reply {
68
68
let result = match request {
69
69
Request::Authenticate(account_id) => self.authenticate(tx, account_id).await,
70
70
-
Request::ListFields if self.account_id.is_some() => {
71
71
-
self.list_fields(tx).await
72
72
-
}
73
73
-
_ => Err(anyhow::anyhow!("authentication required"))
70
70
+
Request::ListFields if self.account_id.is_some() => self.list_fields(tx).await,
71
71
+
_ => Err(anyhow::anyhow!("authentication required")),
74
72
};
75
73
if let Err(error) = result {
76
74
tracing::error!("error handling player socket message: {}", error);
+1
src/db.rs
···
4
4
#[derive(sqlx::Type)]
5
5
#[sqlx(type_name = "card_class", rename_all = "lowercase")]
6
6
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Clone, Copy, Debug, ToSchema)]
7
7
+
#[expect(dead_code)]
7
8
pub enum CardClass {
8
9
Tile,
9
10
Citizen,