mappy 1.0.0

A parser for Quake .map files and their descendent formats
Documentation
# mappy


A parser for Quake `.map` files and their descendent formats.

| Format | Description |
|--------|-------------|
| Quake `.map` | Standard and Valve 220 texture coordinate variants, including Quake II surface flags |
| Valve `.vmf` | Full fidelity, including displacements, I/O connections, visgroups, cameras, and cordons |

## Usage


```toml
[dependencies]
mappy = "1"
```

Parse a `.map` file:

```rust
use mappy::{EntityProperties, Map};

let map: Map = include_str!("assets/start.map").parse()?;

for entity in &map.entities {
    let classname: String = entity.get("classname")?;
    println!("{classname}");
}
```

Parse a `.vmf` file:

```rust
use mappy::{EntityProperties, Vmf};

let vmf: Vmf = include_str!("assets/start.vmf").parse()?;

for entity in &vmf.entities {
    let classname: String = entity.get("classname")?;
    println!("{classname}");
}
```

Convert entities to typed game objects with [`FromEntity`]:

```rust
use mappy::{Entity, FromEntity};

struct PlayerStart {
    origin: String,
}

impl FromEntity for PlayerStart {
    type Error = String;

    fn from_entity(entity: &Entity) -> Result<Self, Self::Error> {
        if entity.properties.get("classname").map(String::as_str) != Some("info_player_start") {
            return Err("not a player start".into());
        }
        Ok(PlayerStart {
            origin: entity.properties.get("origin").cloned().unwrap_or_default(),
        })
    }
}
```

## Features


| Feature | Description |
|---------|-------------|
| `serde` | Derive `Serialize`/`Deserialize` for all public types |

## License


MIT OR Apache-2.0