~starkingdoms/starkingdoms

ref: dcd9c9f2b306be1c865452d17c044c41d7a2c92c starkingdoms/server/src/packet.rs -rw-r--r-- 551 bytes
dcd9c9f2 — ghostlyzsh server can spawn player in theory, removed some old client code 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
use std::collections::HashMap;

use serde::Serialize;

#[derive(Debug, Serialize)]
pub struct SpawnPlayer {
    pub id: u32,
    pub username: String,
    pub position: (f32, f32),
}

#[derive(Debug, Serialize)]
pub struct PacketPlanet {
    pub planet_type: u8,
    pub position: (f32, f32),
}

#[derive(Debug, Serialize)]
pub struct PlanetPositionPacket {
    pub planets: HashMap<u32, PacketPlanet> // id, (Type, x, y)
}

#[derive(Debug, Serialize)]
pub struct PartPositionPacket {
    pub parts: HashMap<u32, (u8, f32, f32)> // id, (Type, x, y)
}