The "roll" ui operation is going to want this too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
|| format!("die.{}.{}", nfaces, image.itemname()));
let initial_state = {
- let t = cooldown_time.try_into().map_err(IE::from)?;
- State { cooldown_expires: Some(t) }
+ State { cooldown_expires: cooldown_start_value(cooldown_time)? }
};
let _state: &mut State = gpc.xdata_mut(|| initial_state)?;
}
}
+#[throws(IE)]
+pub fn cooldown_start_value(cooldown_time: Duration) -> Option<FutureInstant> {
+ let t = cooldown_time.try_into().map_err(IE::from)?;
+ Some(t)
+}
+
impl Die {
#[throws(IE)]
pub fn cooldown_remaining(&self, state: &State) -> Duration {