~starkingdoms/starkingdoms

ref: f73656c66fcec95e0957a7500c291926e0dcab2e starkingdoms/server/src/packet.rs -rw-r--r-- 551 bytes
f73656c6 — core the server currently does much nothing 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)
}