My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/games/rstnode/src/config.rs

41 lines
942 B

//! 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,
}