diff --git a/src/raws/mob_structs.rs b/src/raws/mob_structs.rs index b73a16a..0ede0a0 100644 --- a/src/raws/mob_structs.rs +++ b/src/raws/mob_structs.rs @@ -20,6 +20,13 @@ pub struct Mob { pub equipped: Option>, pub natural: Option, pub loot_table: Option, + pub light: Option, +} + +#[derive(Deserialize, Debug)] +pub struct MobLight { + pub range: i32, + pub color: String, } #[derive(Deserialize, Debug)] diff --git a/src/raws/rawmaster.rs b/src/raws/rawmaster.rs index 840b90f..0ba884d 100644 --- a/src/raws/rawmaster.rs +++ b/src/raws/rawmaster.rs @@ -1,9 +1,9 @@ use std::collections::{HashMap, HashSet}; use ::regex::Regex; +use ::rltk::{RandomNumberGenerator, RGB}; use ::specs::prelude::*; use ::specs::saveload::{MarkedBuilder, SimpleMarker}; -use rltk::RandomNumberGenerator; use crate::components::*; use crate::gamesystem::{mana_at_level, npc_hp}; @@ -420,6 +420,13 @@ pub fn spawn_named_mob( }); } + if let Some(light) = &mob_template.light { + eb = eb.with(LightSource { + range: light.range, + color: RGB::from_hex(&light.color).expect("Bad color"), + }); + } + let new_mob = eb.build(); // Are they weilding anything?