~starkingdoms/starkingdoms

ref: 5be633fa761caff1e614a6a025edd01ded4bd1d8 starkingdoms/server/src/packet.rs -rw-r--r-- 553 bytes
5be633fa — core its json now, also remove the old client 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)
}