mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 02:24:12 +02:00
wip
This commit is contained in:
parent
45e9df31e5
commit
43b7270fcd
29 changed files with 3818 additions and 76 deletions
|
|
@ -2,7 +2,13 @@ use crate::Stream;
|
|||
/// Messages that consists only of primitives and string and can be derived
|
||||
use bitbuffer::{BitRead, BitWrite, LittleEndian};
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[cfg(feature = "wasm")]
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FileMessage {
|
||||
pub transfer_id: u32,
|
||||
|
|
@ -10,6 +16,10 @@ pub struct FileMessage {
|
|||
pub requested: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct NetTickMessage {
|
||||
pub tick: u32,
|
||||
|
|
@ -17,22 +27,38 @@ pub struct NetTickMessage {
|
|||
pub std_dev: u16,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct StringCmdMessage {
|
||||
pub command: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SignOnStateMessage {
|
||||
pub state: u8,
|
||||
pub count: u32,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct PrintMessage {
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct ServerInfoMessage {
|
||||
pub version: u16,
|
||||
|
|
@ -54,17 +80,29 @@ pub struct ServerInfoMessage {
|
|||
pub replay: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SetPauseMessage {
|
||||
pub pause: bool,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct SetViewMessage {
|
||||
#[size = 11]
|
||||
pub index: u16,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct FixAngleMessage {
|
||||
pub relative: bool,
|
||||
|
|
@ -73,6 +111,10 @@ pub struct FixAngleMessage {
|
|||
pub z: u16,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[endianness = "LittleEndian"]
|
||||
#[serde(bound(deserialize = "'a: 'static"))]
|
||||
|
|
@ -87,12 +129,17 @@ pub struct EntityMessage<'a> {
|
|||
pub data: Stream<'a>,
|
||||
}
|
||||
|
||||
#[cfg_attr(feature = "wasm", wasm_bindgen::prelude::wasm_bindgen)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct PreFetchMessage {
|
||||
#[size = 14]
|
||||
pub index: u16,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[endianness = "LittleEndian"]
|
||||
#[serde(bound(deserialize = "'a: 'static"))]
|
||||
|
|
@ -103,12 +150,20 @@ pub struct MenuMessage<'a> {
|
|||
pub index: Stream<'a>,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct GetCvarValueMessage {
|
||||
pub cookie: u32,
|
||||
pub value: String,
|
||||
}
|
||||
|
||||
#[cfg_attr(
|
||||
feature = "wasm",
|
||||
derive(wasm_typescript_definition::TypescriptDefinition)
|
||||
)]
|
||||
#[derive(BitRead, BitWrite, Debug, PartialEq, Serialize, Deserialize)]
|
||||
#[endianness = "LittleEndian"]
|
||||
#[serde(bound(deserialize = "'a: 'static"))]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue