Merge branch 'main' into feature/robust-logging
This commit is contained in:
@@ -180,6 +180,14 @@ fn attitude_color(att: Attitude) -> &'static str {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_time_of_day(tick: u64) -> &'static str {
|
||||
let day_tick = tick % 1440;
|
||||
if day_tick < 360 { "Night" }
|
||||
else if day_tick < 720 { "Morning" }
|
||||
else if day_tick < 1080 { "Afternoon" }
|
||||
else { "Evening" }
|
||||
}
|
||||
|
||||
pub fn render_room_view(
|
||||
room_id: &str,
|
||||
player_id: usize,
|
||||
@@ -195,13 +203,19 @@ pub fn render_room_view(
|
||||
.map(|c| c.player.name.as_str())
|
||||
.unwrap_or("");
|
||||
|
||||
let time_of_day = get_time_of_day(st.tick_count);
|
||||
let mut out = format!(
|
||||
"\r\n{} {}\r\n {}\r\n",
|
||||
"\r\n{} {} {}\r\n {}\r\n",
|
||||
ansi::room_name(&room.name),
|
||||
ansi::system_msg(&format!("[{}]", room.region)),
|
||||
ansi::color(ansi::YELLOW, &format!("[{}]", time_of_day)),
|
||||
room.description
|
||||
);
|
||||
|
||||
if room.outdoors {
|
||||
out.push_str(&format!(" {}\r\n", ansi::color(ansi::CYAN, st.weather.kind.description())));
|
||||
}
|
||||
|
||||
let npc_strs: Vec<String> = room
|
||||
.npcs
|
||||
.iter()
|
||||
|
||||
Reference in New Issue
Block a user