diff --git a/src/turfs.rs b/src/turfs.rs index 5ba7a0bc..8779fedb 100644 --- a/src/turfs.rs +++ b/src/turfs.rs @@ -533,14 +533,16 @@ fn update_visuals(src: ByondValue) -> Result<ByondValue> { // gas_overlays: list( GAS_ID = list( VIS_FACTORS = OVERLAYS )) got it? I don't let gas_overlays = ByondValue::new_global_ref() .read_var_id(byond_string!("GLOB")) - .wrap_err("GLOB is null")? + .wrap_err("Unable to get GLOB from BYOND globals")? .read_var_id(byond_string!("gas_data")) - .wrap_err("gas_data is null")? + .wrap_err("gas_data is undefined on GLOB")? .read_var_id(byond_string!("overlays")) - .wrap_err("overlays is null")?; + .wrap_err("overlays is undefined in GLOB.gas_data")?; let ptr = air - .read_number_id(byond_string!("_extools_pointer_gasmixture")) - .wrap_err("Gas mixture doesn't have a valid pointer")? as usize; + .read_var_id(byond_string!("_extools_pointer_gasmixture")) + .wrap_err("air is undefined on turf")? + .get_number() + .wrap_err("Gas mixture has invalid pointer")? as usize; let overlay_types = GasArena::with_gas_mixture(ptr, |mix| { Ok(mix .enumerate() diff --git a/src/turfs/processing.rs b/src/turfs/processing.rs index 42d2a145..8da1313c 100644 --- a/src/turfs/processing.rs +++ b/src/turfs/processing.rs @@ -420,6 +420,15 @@ fn post_process() { if should_update_vis { drop(sender.try_send(Box::new(move || { let turf = ByondValue::new_ref(ValueType::Turf, id); + + // Not valid for visuals updating if it doesn't have air defined now + if !turf + .read_var_id(byond_string!("air")) + .is_ok_and(|air| !air.is_null()) + { + return Ok(()); + } + update_visuals(turf).wrap_err("Updating Visuals")?; Ok(()) })));