lib_curveball/map/
entity.rs

1// Copyright 2025 Jordan Johnson
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3
4//! Custom Quake3 entities defined for Neverball.
5use crate::map::geometry::Brush;
6use crate::map::qmap::QEntity;
7use std::collections::HashMap;
8
9/// A basic representation of a `Worldspawn`, an entity defining the static geometry of a level.
10#[derive(Debug, Clone)]
11pub struct SimpleWorldspawn {
12    pub brushes: Vec<Brush>,
13}
14
15impl SimpleWorldspawn {
16    pub fn new(brushes: Vec<Brush>) -> Self {
17        Self { brushes }
18    }
19}
20
21impl From<SimpleWorldspawn> for QEntity {
22    fn from(item: SimpleWorldspawn) -> Self {
23        let mut parameters = HashMap::new();
24        parameters.insert(String::from("classname"), String::from("worldspawn"));
25        Self {
26            parameters,
27            brushes: item.brushes,
28        }
29    }
30}
31
32// TODO: Add other Neverball entities, like coins
33// TODO: Add TrenchbroomGroup entity
34
35#[cfg(test)]
36mod tests {}