Skip to content

Commit

Permalink
update libs
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Oct 22, 2024
1 parent ea81335 commit bb56131
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 216 deletions.
239 changes: 99 additions & 140 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
members = ["crates/*"]

[workspace.dependencies]
byondapi = "0.4.8"
byondapi = "0.4.10"
coarsetime = "0.1.34"
flume = "0.11.0"
flume = "0.11.1"
eyre = "0.6.12"
tracing = "0.1.40"

Expand Down Expand Up @@ -47,17 +47,17 @@ parking_lot = "0.12.3"
fxhash = "0.2.1"
ahash = "0.8.11"
lazy_static = "1.5.0"
indexmap = { version = "2.4.0", features = ["rayon"] }
dashmap = { version = "6.0.1", features = ["rayon"] }
hashbrown = "0.14.5"
atomic_float = "1.0.0"
indexmap = { version = "2.6.0", features = ["rayon"] }
dashmap = { version = "6.1.0", features = ["rayon"] }
hashbrown = "0.15.0"
atomic_float = "1.1.0"
petgraph = "0.6.5"
bitflags = "2.6.0"
nom = "7.1.3"
mimalloc = { version = "0.1.43", default-features = false }

tracing = { version = "0.1.40", optional = true }
tracing-tracy = { version = "0.11.1", optional = true }
tracing-tracy = { version = "0.11.3", optional = true }
tracing-subscriber = { version = "0.3.18", optional = true }

[dependencies.tinyvec]
Expand Down
6 changes: 2 additions & 4 deletions src/gas/mixture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ impl GasCache {
self.0.store(f32::NAN, Relaxed);
}
//cannot fix this, because f is FnMut and then() takes FnOnce
#[allow(clippy::redundant_closure)]
pub fn get_or_else(&self, mut f: impl FnMut() -> f32) -> f32 {
match self
.0
.fetch_update(Relaxed, Relaxed, |x| x.is_nan().then(|| f()))
.fetch_update(Relaxed, Relaxed, |x| x.is_nan().then(&mut f))
{
Ok(_) => self.0.load(Relaxed),
Err(x) => x,
Expand All @@ -60,8 +59,7 @@ impl GasCache {
pub fn visibility_step(gas_amt: f32) -> u32 {
(gas_amt / MOLES_GAS_VISIBLE_STEP)
.ceil()
.min(FACTOR_GAS_VISIBLE_MAX)
.max(1.0) as u32
.clamp(FACTOR_GAS_VISIBLE_MAX, 1.0) as u32
}

/// The data structure representing a Space Station 13 gas mixture.
Expand Down
8 changes: 4 additions & 4 deletions src/gas/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ pub fn destroy_gas_info_structs() {
}

#[byondapi::bind("/proc/_auxtools_register_gas")]
fn hook_register_gas(gas: ByondValue) {
fn hook_register_gas(gas: ByondValue) -> Result<ByondValue> {
let gas_id = gas.read_string_id(byond_string!("id"))?;
match GAS_INFO_BY_STRING
.read()
Expand Down Expand Up @@ -283,7 +283,7 @@ fn hook_register_gas(gas: ByondValue) {
}

#[byondapi::bind("/proc/auxtools_atmos_init")]
fn hook_init(gas_data: ByondValue) {
fn hook_init(gas_data: ByondValue) -> Result<ByondValue> {
let data = gas_data.read_var_id(byond_string!("datums"))?;
data.iter()?
.map(|(_, gas)| hook_register_gas(gas))
Expand Down Expand Up @@ -327,7 +327,7 @@ fn get_reaction_info() -> BTreeMap<ReactionPriority, Reaction> {
}

#[byondapi::bind("/datum/controller/subsystem/air/proc/auxtools_update_reactions")]
fn update_reactions() {
fn update_reactions() -> Result<ByondValue> {
*REACTION_INFO.write() = Some(get_reaction_info());
Ok(true.into())
}
Expand Down Expand Up @@ -430,7 +430,7 @@ pub fn update_gas_refs() {
}

#[byondapi::bind("/proc/finalize_gas_refs")]
fn finalize_gas_refs() {
fn finalize_gas_refs() -> Result<ByondValue> {
update_gas_refs();
Ok(ByondValue::null())
}
Expand Down
Loading

0 comments on commit bb56131

Please sign in to comment.