pub struct LevelData {
pub version: VersionSpecs,
pub spawners: Vec<Spawner>,
pub cells: Cells,
pub tile_properties: Vec<TileProperties>,
pub metadata: LevelMetaData,
pub background_layers: Vec<BackgroundLayer>,
}Expand description
The overarching level data structure. Holds everything pertaining to a level in CNM Online.
Fields§
§version: VersionSpecsVersion specifications
spawners: Vec<Spawner>A list of all the objects in the level
cells: CellsA grid of cells (tiles, blocks, whatever you want to call them) in the level.
tile_properties: Vec<TileProperties>An array of tile properties. A tile ID corresponds to a entry in this array.
metadata: LevelMetaDataLevel select metadata
background_layers: Vec<BackgroundLayer>An array of background layers. Ones futher in the array draw over ones in front (smaller indices).
Implementations§
Source§impl LevelData
impl LevelData
Sourcepub fn from_version(version: u32) -> Result<Self, Error>
pub fn from_version(version: u32) -> Result<Self, Error>
Create a blank level from a level version.
Only version supported is version ID 1.
Sourcepub fn from_lparse(
cnmb: &LParse,
cnms: &LParse,
ignore_warnings: bool,
) -> Result<Self, Error>
pub fn from_lparse( cnmb: &LParse, cnms: &LParse, ignore_warnings: bool, ) -> Result<Self, Error>
Load a level from the .cnmb and .cnms lparse files
Ignore warnings loads levels with illogical configurations of elements, like for example a cell with a ID that goes beyond the tile properties array, but sometimes this has to be used because old CNM levels sometimes have garbage data that will trigger the warnings anyway. If a warning does get triggered anyway, it will return it as an error.
Hasn’t been tested but levels created with the API under normal circumstances shouldn’t trigger any warnings.