1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 10:44:07 +02:00

work around circular derive dependency

This commit is contained in:
Robin Appelman 2023-11-12 14:30:16 +01:00
commit e5a3d7ae24
4 changed files with 829 additions and 495 deletions

View file

@ -20,7 +20,7 @@ lzma-rs = "0.3.0"
binrw = "0.13.1" binrw = "0.13.1"
static_assertions = "1.1.0" static_assertions = "1.1.0"
num_enum = "0.7.1" num_enum = "0.7.1"
vbsp-derive = { path = "derive", version = "0.1.0", features = ["__vbsp_as_self"] } vbsp-derive = { path = "derive", version = "0.1.0", features = ["__vbsp_as_self"], optional = true }
cgmath = "0.18.0" cgmath = "0.18.0"
zip = { package = "zip-lzma", version = "0.6.3", default-features = false, features = ["lzma"] } zip = { package = "zip-lzma", version = "0.6.3", default-features = false, features = ["lzma"] }
@ -28,8 +28,10 @@ zip = { package = "zip-lzma", version = "0.6.3", default-features = false, featu
obj = "0.10" obj = "0.10"
main_error = "0.1.2" main_error = "0.1.2"
[features]
bench = []
[profile.dev] [profile.dev]
opt-level = 2 opt-level = 2
[features]
default = ["typed_entities"]
typed_entities = ["vbsp-derive"]
bench = []

303
derive/Cargo.lock generated
View file

@ -2,12 +2,198 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "approx"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f2a05fd1bd10b2527e20a2cd32d8873d115b8b39fe219ee25f42a8aca6ba278"
dependencies = [
"num-traits",
]
[[package]]
name = "array-init"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d62b7694a562cdf5a74227903507c56ab2cc8bdd1f781ed5cb4cf9c9f810bfc"
[[package]]
name = "arrayvec"
version = "0.7.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711"
[[package]] [[package]]
name = "autocfg" name = "autocfg"
version = "1.1.0" version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "binrw"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a1b8720bedc0a503fd5c90bef3fbdc397144ac7efcc5610b30bde08083d7495"
dependencies = [
"array-init",
"binrw_derive",
"bytemuck",
]
[[package]]
name = "binrw_derive"
version = "0.13.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0741a1b1a70a36a1e7fb0316bba0828f6487a3b6e577353cf974b59fbbb92081"
dependencies = [
"either",
"owo-colors",
"proc-macro2",
"quote",
"syn 1.0.109",
]
[[package]]
name = "bitflags"
version = "2.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07"
[[package]]
name = "bv"
version = "0.11.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8834bb1d8ee5dc048ee3124f2c7c1afcc6bc9aed03f11e9dfd8c69470a5db340"
dependencies = [
"feature-probe",
]
[[package]]
name = "bytemuck"
version = "1.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6"
[[package]]
name = "byteorder"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "cfg-if"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
[[package]]
name = "cgmath"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a98d30140e3296250832bbaaff83b27dcd6fa3cc70fb6f1f3e5c9c0023b5317"
dependencies = [
"approx",
"num-traits",
]
[[package]]
name = "crc"
version = "3.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe"
dependencies = [
"crc-catalog",
]
[[package]]
name = "crc-catalog"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5"
[[package]]
name = "crc32fast"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
dependencies = [
"cfg-if",
]
[[package]]
name = "crossbeam-utils"
version = "0.8.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294"
dependencies = [
"cfg-if",
]
[[package]]
name = "either"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "equivalent"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5"
[[package]]
name = "feature-probe"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "835a3dc7d1ec9e75e2b5fb4ba75396837112d2060b03f7d43bc1897c7f7211da"
[[package]]
name = "hashbrown"
version = "0.14.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156"
[[package]]
name = "indexmap"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f"
dependencies = [
"equivalent",
"hashbrown",
]
[[package]]
name = "lzma"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "782ba3f542e8bc1349386c15e9dc3119ae6da96479f96b3863cc7a88bbdfd4e4"
dependencies = [
"byteorder 0.5.3",
]
[[package]]
name = "lzma-rs"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "297e814c836ae64db86b36cf2a557ba54368d03f6afcd7d947c266692f71115e"
dependencies = [
"byteorder 1.5.0",
"crc",
]
[[package]]
name = "memchr"
version = "2.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167"
[[package]] [[package]]
name = "merge" name = "merge"
version = "0.1.0" version = "0.1.0"
@ -39,6 +225,42 @@ dependencies = [
"autocfg", "autocfg",
] ]
[[package]]
name = "num_enum"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "683751d591e6d81200c39fb0d1032608b77724f34114db54f571ff1317b337c0"
dependencies = [
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c11e44798ad209ccdd91fc192f0526a369a01234f7373e1b141c96d7cee4f0e"
dependencies = [
"proc-macro-crate",
"proc-macro2",
"quote",
"syn 2.0.39",
]
[[package]]
name = "owo-colors"
version = "3.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f"
[[package]]
name = "proc-macro-crate"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8"
dependencies = [
"toml_edit",
]
[[package]] [[package]]
name = "proc-macro-error" name = "proc-macro-error"
version = "1.0.4" version = "1.0.4"
@ -81,6 +303,12 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "static_assertions"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
[[package]] [[package]]
name = "structmeta" name = "structmeta"
version = "0.2.0" version = "0.2.0"
@ -126,12 +354,65 @@ dependencies = [
"unicode-ident", "unicode-ident",
] ]
[[package]]
name = "thiserror"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.50"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.39",
]
[[package]]
name = "toml_datetime"
version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
[[package]]
name = "toml_edit"
version = "0.20.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81"
dependencies = [
"indexmap",
"toml_datetime",
"winnow",
]
[[package]] [[package]]
name = "unicode-ident" name = "unicode-ident"
version = "1.0.12" version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
[[package]]
name = "vbsp"
version = "0.2.0"
dependencies = [
"arrayvec",
"binrw",
"bitflags",
"bv",
"cgmath",
"lzma-rs",
"num_enum",
"static_assertions",
"thiserror",
"zip-lzma",
]
[[package]] [[package]]
name = "vbsp-derive" name = "vbsp-derive"
version = "0.1.0" version = "0.1.0"
@ -141,6 +422,7 @@ dependencies = [
"quote", "quote",
"structmeta", "structmeta",
"syn 2.0.39", "syn 2.0.39",
"vbsp",
] ]
[[package]] [[package]]
@ -148,3 +430,24 @@ name = "version_check"
version = "0.9.4" version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "winnow"
version = "0.5.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b"
dependencies = [
"memchr",
]
[[package]]
name = "zip-lzma"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b480cb31fccfb2786565c0e0712865fd6f1ea0ea850c50316f643c3948196e63"
dependencies = [
"byteorder 1.5.0",
"crc32fast",
"crossbeam-utils",
"lzma",
]

View file

@ -18,5 +18,8 @@ proc-macro2 = "1.0.69"
structmeta = "0.2.0" structmeta = "0.2.0"
merge = "0.1.0" merge = "0.1.0"
[dev-dependencies]
vbsp = { version = "0.2.0", path = "..", default-features = false }
[features] [features]
__vbsp_as_self = [] __vbsp_as_self = []

View file

@ -3,7 +3,6 @@ use crate::Vector;
use std::fmt; use std::fmt;
use std::fmt::Debug; use std::fmt::Debug;
use std::str::FromStr; use std::str::FromStr;
use vbsp_derive::Entity;
#[derive(Clone)] #[derive(Clone)]
pub struct Entities { pub struct Entities {
@ -102,7 +101,7 @@ impl<'a> RawEntity<'a> {
.ok_or(EntityParseError::NoSuchProperty(key)) .ok_or(EntityParseError::NoSuchProperty(key))
} }
fn prop_parse<T: EntityProp<'a>>(&self, key: &'static str) -> Result<T, EntityParseError> { pub fn prop_parse<T: EntityProp<'a>>(&self, key: &'static str) -> Result<T, EntityParseError> {
T::parse(self.prop(key)?) T::parse(self.prop(key)?)
} }
@ -111,7 +110,7 @@ impl<'a> RawEntity<'a> {
} }
} }
trait EntityProp<'a>: Sized { pub trait EntityProp<'a>: Sized {
fn parse(raw: &'a str) -> Result<Self, EntityParseError>; fn parse(raw: &'a str) -> Result<Self, EntityParseError>;
} }
@ -165,8 +164,34 @@ impl<'a, T: EntityProp<'a>> EntityProp<'a> for Option<T> {
} }
} }
#[derive(Debug, Clone, Entity)] pub use typed::*;
pub enum Entity<'a> {
#[cfg(not(feature = "typed_entities"))]
mod typed {
use crate::error::EntityParseError;
use crate::RawEntity;
#[derive(Debug, Clone)]
pub enum Entity<'a> {
Unknown(RawEntity<'a>),
}
impl<'a> TryFrom<RawEntity<'a>> for Entity<'a> {
type Error = EntityParseError;
fn try_from(value: RawEntity<'a>) -> Result<Self, Self::Error> {
Ok(Entity::Unknown(value))
}
}
}
#[cfg(feature = "typed_entities")]
mod typed {
use crate::{RawEntity, Vector};
use vbsp_derive::Entity;
#[derive(Debug, Clone, Entity)]
pub enum Entity<'a> {
#[entity(name = "point_spotlight")] #[entity(name = "point_spotlight")]
SpotLight(SpotLight), SpotLight(SpotLight),
#[entity(name = "light")] #[entity(name = "light")]
@ -245,37 +270,37 @@ pub enum Entity<'a> {
KothLogic(KothLogic), KothLogic(KothLogic),
#[entity(default)] #[entity(default)]
Unknown(RawEntity<'a>), Unknown(RawEntity<'a>),
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct Light { pub struct Light {
pub origin: Vector, pub origin: Vector,
#[entity(name = "_light")] #[entity(name = "_light")]
pub light: [u32; 4], pub light: [u32; 4],
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct SpotLight { pub struct SpotLight {
pub origin: Vector, pub origin: Vector,
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "rendercolor")] #[entity(name = "rendercolor")]
pub color: [u8; 3], pub color: [u8; 3],
#[entity(name = "spotlightwidth")] #[entity(name = "spotlightwidth")]
pub cone: u8, pub cone: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct LightSpot { pub struct LightSpot {
pub origin: Vector, pub origin: Vector,
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "_light")] #[entity(name = "_light")]
pub light: [u32; 4], pub light: [u32; 4],
#[entity(name = "_cone")] #[entity(name = "_cone")]
pub cone: u8, pub cone: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct PropDynamic<'a> { pub struct PropDynamic<'a> {
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "disablereceiveshadows", default)] #[entity(name = "disablereceiveshadows", default)]
pub disable_receive_shadows: bool, pub disable_receive_shadows: bool,
@ -291,10 +316,10 @@ pub struct PropDynamic<'a> {
pub name: Option<&'a str>, pub name: Option<&'a str>,
#[entity(name = "parentname", default)] #[entity(name = "parentname", default)]
pub parent: Option<&'a str>, pub parent: Option<&'a str>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct PropDynamicOverride<'a> { pub struct PropDynamicOverride<'a> {
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "disablereceiveshadows", default)] #[entity(name = "disablereceiveshadows", default)]
pub disable_receive_shadows: bool, pub disable_receive_shadows: bool,
@ -310,19 +335,19 @@ pub struct PropDynamicOverride<'a> {
pub name: Option<&'a str>, pub name: Option<&'a str>,
#[entity(name = "parentname", default)] #[entity(name = "parentname", default)]
pub parent: Option<&'a str>, pub parent: Option<&'a str>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct EnvSprite<'a> { pub struct EnvSprite<'a> {
pub origin: Vector, pub origin: Vector,
pub scale: f32, pub scale: f32,
pub model: &'a str, pub model: &'a str,
#[entity(name = "rendercolor")] #[entity(name = "rendercolor")]
pub color: [u8; 3], pub color: [u8; 3],
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct Spawn<'a> { pub struct Spawn<'a> {
pub origin: Vector, pub origin: Vector,
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
@ -333,10 +358,10 @@ pub struct Spawn<'a> {
pub start_disabled: bool, pub start_disabled: bool,
#[entity(name = "TeamNum")] #[entity(name = "TeamNum")]
pub team: u8, pub team: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct RespawnRoom<'a> { pub struct RespawnRoom<'a> {
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target: Option<&'a str>, pub target: Option<&'a str>,
pub model: &'a str, pub model: &'a str,
@ -344,19 +369,19 @@ pub struct RespawnRoom<'a> {
pub start_disabled: bool, pub start_disabled: bool,
#[entity(name = "TeamNum")] #[entity(name = "TeamNum")]
pub team: u8, pub team: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct Regenerate<'a> { pub struct Regenerate<'a> {
#[entity(name = "associatedmodel")] #[entity(name = "associatedmodel")]
pub associated_model: &'a str, pub associated_model: &'a str,
pub model: &'a str, pub model: &'a str,
#[entity(name = "TeamNum")] #[entity(name = "TeamNum")]
pub team: u8, pub team: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct Door<'a> { pub struct Door<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target: &'a str, pub target: &'a str,
@ -366,20 +391,20 @@ pub struct Door<'a> {
#[entity(name = "movedir")] #[entity(name = "movedir")]
pub move_direction: Vector, pub move_direction: Vector,
pub model: &'a str, pub model: &'a str,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct AmmoPack { pub struct AmmoPack {
pub origin: Vector, pub origin: Vector,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct HealthPack { pub struct HealthPack {
pub origin: Vector, pub origin: Vector,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct WorldSpawn<'a> { pub struct WorldSpawn<'a> {
#[entity(name = "world_mins")] #[entity(name = "world_mins")]
pub min: Vector, pub min: Vector,
#[entity(name = "world_mins")] #[entity(name = "world_mins")]
@ -394,10 +419,10 @@ pub struct WorldSpawn<'a> {
pub skybox: &'a str, pub skybox: &'a str,
#[entity(name = "mapversion")] #[entity(name = "mapversion")]
pub version: u32, pub version: u32,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct ObserverPoint<'a> { pub struct ObserverPoint<'a> {
#[entity(name = "StartDisabled", default)] #[entity(name = "StartDisabled", default)]
pub start_disabled: bool, pub start_disabled: bool,
pub angles: [f32; 3], pub angles: [f32; 3],
@ -406,20 +431,20 @@ pub struct ObserverPoint<'a> {
pub target: Option<&'a str>, pub target: Option<&'a str>,
#[entity(name = "parentname", default)] #[entity(name = "parentname", default)]
pub parent: Option<&'a str>, pub parent: Option<&'a str>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct BrushEntity<'a> { pub struct BrushEntity<'a> {
pub model: &'a str, pub model: &'a str,
pub origin: Vector, pub origin: Vector,
#[entity(name = "StartDisabled", default)] #[entity(name = "StartDisabled", default)]
pub start_disabled: bool, pub start_disabled: bool,
#[entity(name = "rendercolor")] #[entity(name = "rendercolor")]
pub color: [f32; 3], pub color: [f32; 3],
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct LightGlow { pub struct LightGlow {
pub origin: Vector, pub origin: Vector,
#[entity(name = "VerticalGlowSize")] #[entity(name = "VerticalGlowSize")]
pub vertical_size: u32, pub vertical_size: u32,
@ -433,10 +458,10 @@ pub struct LightGlow {
pub min_distance: u32, pub min_distance: u32,
#[entity(name = "MaxDist")] #[entity(name = "MaxDist")]
pub max_distance: u32, pub max_distance: u32,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct TriggerMultiple<'a> { pub struct TriggerMultiple<'a> {
pub model: &'a str, pub model: &'a str,
pub origin: Vector, pub origin: Vector,
#[entity(name = "OnStartTouch", default)] #[entity(name = "OnStartTouch", default)]
@ -456,10 +481,10 @@ pub struct TriggerMultiple<'a> {
pub wait: Option<u32>, pub wait: Option<u32>,
#[entity(name = "StartDisabled", default)] #[entity(name = "StartDisabled", default)]
pub start_disabled: bool, pub start_disabled: bool,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct FilterActivatorTeam<'a> { pub struct FilterActivatorTeam<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target_name: Option<&'a str>, pub target_name: Option<&'a str>,
@ -467,26 +492,26 @@ pub struct FilterActivatorTeam<'a> {
pub negated: Option<&'a str>, pub negated: Option<&'a str>,
#[entity(name = "TeamNum", default)] #[entity(name = "TeamNum", default)]
pub team: u8, pub team: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct LogicRelay<'a> { pub struct LogicRelay<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target_name: Option<&'a str>, pub target_name: Option<&'a str>,
#[entity(name = "OnTrigger", default)] #[entity(name = "OnTrigger", default)]
pub on_trigger: Option<&'a str>, pub on_trigger: Option<&'a str>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct LogicAuto<'a> { pub struct LogicAuto<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "OnMapSpawn", default)] #[entity(name = "OnMapSpawn", default)]
pub on_map_spawn: Option<&'a str>, pub on_map_spawn: Option<&'a str>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct DustMotes<'a> { pub struct DustMotes<'a> {
pub model: &'a str, pub model: &'a str,
pub origin: Vector, pub origin: Vector,
#[entity(name = "StartDisabled", default)] #[entity(name = "StartDisabled", default)]
@ -501,10 +526,10 @@ pub struct DustMotes<'a> {
pub size_max: u32, pub size_max: u32,
#[entity(name = "Alpha")] #[entity(name = "Alpha")]
pub alpha: u8, pub alpha: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct SkyCamera { pub struct SkyCamera {
pub origin: Vector, pub origin: Vector,
#[entity(name = "fogenable")] #[entity(name = "fogenable")]
pub fog: bool, pub fog: bool,
@ -521,10 +546,10 @@ pub struct SkyCamera {
pub color: [u8; 3], pub color: [u8; 3],
#[entity(name = "fogcolor2", default)] #[entity(name = "fogcolor2", default)]
pub color2: Option<[u8; 3]>, pub color2: Option<[u8; 3]>,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct PathTrack<'a> { pub struct PathTrack<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(default)] #[entity(default)]
pub target: Option<&'a str>, pub target: Option<&'a str>,
@ -535,28 +560,28 @@ pub struct PathTrack<'a> {
pub angles: [u32; 3], pub angles: [u32; 3],
pub radius: f32, pub radius: f32,
pub speed: f32, pub speed: f32,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct SoundScapeProxy<'a> { pub struct SoundScapeProxy<'a> {
pub origin: Vector, pub origin: Vector,
pub radius: f32, pub radius: f32,
#[entity(name = "MainSoundscapeName")] #[entity(name = "MainSoundscapeName")]
pub main_name: &'a str, pub main_name: &'a str,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct RespawnVisualizer<'a> { pub struct RespawnVisualizer<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "respawnroomname")] #[entity(name = "respawnroomname")]
pub room_name: &'a str, pub room_name: &'a str,
#[entity(name = "rendercolor")] #[entity(name = "rendercolor")]
pub color: [f32; 3], pub color: [f32; 3],
pub solid_to_enemies: bool, pub solid_to_enemies: bool,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct ParticleSystem<'a> { pub struct ParticleSystem<'a> {
pub origin: Vector, pub origin: Vector,
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "targetname")] #[entity(name = "targetname")]
@ -564,10 +589,10 @@ pub struct ParticleSystem<'a> {
pub effect_name: &'a str, pub effect_name: &'a str,
#[entity(default)] #[entity(default)]
pub start_active: bool, pub start_active: bool,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct TeamControlPoint<'a> { pub struct TeamControlPoint<'a> {
pub origin: Vector, pub origin: Vector,
pub angles: [f32; 3], pub angles: [f32; 3],
#[entity(name = "targetname")] #[entity(name = "targetname")]
@ -582,20 +607,20 @@ pub struct TeamControlPoint<'a> {
pub point_default_owner: u8, pub point_default_owner: u8,
#[entity(name = "StartDisabled", default)] #[entity(name = "StartDisabled", default)]
pub start_disabled: bool, pub start_disabled: bool,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct AreaPortal { pub struct AreaPortal {
#[entity(name = "PortalVersion")] #[entity(name = "PortalVersion")]
pub version: u8, pub version: u8,
#[entity(name = "portalnumber")] #[entity(name = "portalnumber")]
pub number: u8, pub number: u8,
#[entity(name = "StartOpen")] #[entity(name = "StartOpen")]
pub start_open: bool, pub start_open: bool,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct GameText<'a> { pub struct GameText<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target_name: Option<&'a str>, pub target_name: Option<&'a str>,
@ -613,10 +638,10 @@ pub struct GameText<'a> {
#[entity(name = "fxtime")] #[entity(name = "fxtime")]
pub fx_time: f32, pub fx_time: f32,
pub channel: u8, pub channel: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct RopeKeyFrame<'a> { pub struct RopeKeyFrame<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target_name: Option<&'a str>, pub target_name: Option<&'a str>,
@ -640,10 +665,10 @@ pub struct RopeKeyFrame<'a> {
pub move_speed: f32, pub move_speed: f32,
#[entity(name = "Subdiv")] #[entity(name = "Subdiv")]
pub sub_div: u8, pub sub_div: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct RopeMove<'a> { pub struct RopeMove<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "RopeMaterial")] #[entity(name = "RopeMaterial")]
pub material: &'a str, pub material: &'a str,
@ -669,10 +694,10 @@ pub struct RopeMove<'a> {
pub next_key: &'a str, pub next_key: &'a str,
#[entity(name = "Subdiv")] #[entity(name = "Subdiv")]
pub sub_div: u8, pub sub_div: u8,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct GameRules<'a> { pub struct GameRules<'a> {
pub origin: Vector, pub origin: Vector,
#[entity(name = "targetname", default)] #[entity(name = "targetname", default)]
pub target_name: Option<&'a str>, pub target_name: Option<&'a str>,
@ -680,11 +705,12 @@ pub struct GameRules<'a> {
pub ctf_overtime: bool, pub ctf_overtime: bool,
#[entity(default)] #[entity(default)]
pub hud_type: u32, pub hud_type: u32,
} }
#[derive(Debug, Clone, Entity)] #[derive(Debug, Clone, Entity)]
pub struct KothLogic { pub struct KothLogic {
pub origin: Vector, pub origin: Vector,
pub unlock_point: u32, pub unlock_point: u32,
pub timer_length: u32, pub timer_length: u32,
}
} }