small tweaks, cleanup, and cranks offset

This commit is contained in:
Llywelwyn 2023-08-17 15:11:24 +01:00
parent 6eab48e616
commit 72f8dbbdf4
6 changed files with 22 additions and 8 deletions

View file

@ -68,8 +68,8 @@ macro_rules! impl_ParseJson {
$(impl ParseJson for $t {
fn parse_raws_into_vector(path: String) -> $t {
let raw_data = rltk::embedding::EMBED.lock().get_resource(path).unwrap();
let raw_string = std::str::from_utf8(&raw_data).expect("Unable to convert to a valid UTF-8 string.");
return serde_json::from_str(&raw_string).expect("Unable to parse items.json");
let raw_string = std::str::from_utf8(&raw_data).expect("Failed to convert UTF-8 to &str.");
return serde_json::from_str(&raw_string).expect("Failed to convert &str to json");
}
})*
}

View file

@ -697,6 +697,8 @@ pub enum SpawnsAs {
LargeGroup,
}
/// Looks up a key in the mob index, and if a corresponding mob is found, searches the
/// entry for a group spawn flag. i.e. SMALL_GROUP/LARGE_GROUP.
pub fn get_mob_spawn_type(raws: &RawMaster, key: &str) -> SpawnsAs {
if raws.mob_index.contains_key(key) {
let mob_template = &raws.raws.mobs[raws.mob_index[key]];