2025-08-17 15:03:30 -04:00
|
|
|
use polariton_server::operations::Immediate;
|
2025-02-12 18:46:27 -05:00
|
|
|
use polariton::operation::{ParameterTable, Typed};
|
|
|
|
|
|
|
|
|
|
const PARAM_KEY: u8 = 61;
|
|
|
|
|
|
2025-08-17 15:03:30 -04:00
|
|
|
pub(super) fn power_bar_provider(conf: &oj_rc_core::ConfigImpl) -> Immediate<51, crate::UserTy> {
|
|
|
|
|
let energy_conf = <oj_rc_core::ConfigImpl as oj_rc_core::ConfigProvider<()>>::energy(conf);
|
|
|
|
|
Immediate::new(|| {
|
|
|
|
|
let mut params = ParameterTable::with_capacity(2);
|
2025-02-12 18:46:27 -05:00
|
|
|
params.insert(PARAM_KEY, Typed::HashMap(vec![
|
2025-08-17 15:03:30 -04:00
|
|
|
(Typed::Str("refillRatePerSecond".into()), Typed::Float(energy_conf.refill_rate)),
|
|
|
|
|
(Typed::Str("powerForAllRobots".into()), Typed::Int(energy_conf.total as _)),
|
2025-02-12 18:46:27 -05:00
|
|
|
].into()
|
|
|
|
|
));
|
2025-08-17 15:03:30 -04:00
|
|
|
params
|
2025-02-12 18:46:27 -05:00
|
|
|
})
|
|
|
|
|
}
|