diff options
author | Katharina Fey <kookie@spacekookie.de> | 2020-03-22 19:44:26 +0100 |
---|---|---|
committer | Katharina Fey <kookie@spacekookie.de> | 2020-03-22 19:44:26 +0100 |
commit | 22c18205bcb3702ddf60f41f77f6f06554202f35 (patch) | |
tree | 5f402722bbd767354e040179f0b4cd5ccb6b3899 /src/config.rs | |
parent | a55c5bded047e1e2c54f6e3f25c9b8e36e605110 (diff) |
Updating gameplay starting mechanics, adding quadtree to map
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs new file mode 100644 index 000000000000..8a1b0b4deb0a --- /dev/null +++ b/src/config.rs @@ -0,0 +1,41 @@ +//! The file formats backing maps and other configs + +use crate::data::{NodeId, LinkId}; +use serde::{Serialize, Deserialize}; +use std::path::Path; + +/// A config tree that describes a map +#[derive(Serialize, Deserialize)] +pub struct MapCfg { + /// The set of nodes + pub nodes: Vec<NodeCfg>, + /// Links connecting nodes + pub links: Vec<LinkCfg>, + /// Default spawn points (player count) + pub spawns: Vec<SpawnCfg>, +} + +#[derive(Serialize, Deserialize)] +pub struct NodeCfg { + /// Node ID + pub id: NodeId, + /// Render/world position + pub x: f64, + pub y: f64, +} + +#[derive(Serialize, Deserialize)] +pub struct LinkCfg { + /// The link ID + id: LinkId, + /// List of connectioned nodes + con: Vec<NodeId>, +} + +#[derive(Serialize, Deserialize)] +pub struct SpawnCfg { + /// The node of the spawn point + pub n_id: NodeId, + /// At what number of players is this spawn available? + pub max_players: usize, +} |