mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
Initialize Atmospherics much faster (#27862)
* Read atmos from MILLA instead. * Runtime fix * Build Rust library --------- Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
parent
2fd9200036
commit
24f6787b91
@@ -6,6 +6,7 @@ use crate::milla::simulate;
|
||||
use crate::milla::statics::*;
|
||||
use crate::milla::tick;
|
||||
use byondapi::global_call::call_global;
|
||||
use byondapi::map::byond_block;
|
||||
use byondapi::map::byond_xyz;
|
||||
use byondapi::prelude::*;
|
||||
use eyre::eyre;
|
||||
@@ -97,6 +98,54 @@ pub(crate) fn internal_create_environment(
|
||||
buffers.create_environment(tile)
|
||||
}
|
||||
|
||||
/// BYOND API for loading a block of turfs into MILLA with their default air.
|
||||
#[byondapi::bind]
|
||||
fn milla_load_turfs(data_property: ByondValue, low_corner: ByondValue, high_corner: ByondValue) -> eyre::Result<ByondValue> {
|
||||
let property_ref = data_property.get_strid()?;
|
||||
for turf in byond_block(byond_xyz(&low_corner)?, byond_xyz(&high_corner)?)? {
|
||||
let (x, y, z) = byond_xyz(&turf)?.coordinates();
|
||||
let data = turf.read_var_id(property_ref)?.get_list_values()?;
|
||||
if data.len() != 17 {
|
||||
return Err(eyre!("data property has the wrong length: {} vs {}", data.len(), 17));
|
||||
}
|
||||
|
||||
internal_set_tile(
|
||||
x as i32 - 1,
|
||||
y as i32 - 1,
|
||||
z as i32 - 1,
|
||||
conversion::byond_to_option_f32(data[0])?,
|
||||
conversion::byond_to_option_f32(data[1])?,
|
||||
conversion::byond_to_option_f32(data[2])?,
|
||||
conversion::byond_to_option_f32(data[3])?,
|
||||
conversion::byond_to_option_f32(data[4])?,
|
||||
conversion::byond_to_option_f32(data[5])?,
|
||||
conversion::bounded_byond_to_option_f32(data[6], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[7], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[8], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[9], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[10], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[11], 0.0, f32::INFINITY)?,
|
||||
conversion::bounded_byond_to_option_f32(data[12], 0.0, f32::INFINITY)?,
|
||||
None,
|
||||
Some(0.0),
|
||||
Some(0.0),
|
||||
Some(0.0),
|
||||
)?;
|
||||
|
||||
internal_reset_superconductivity(x as i32 - 1, y as i32 - 1, z as i32 - 1)?;
|
||||
internal_reduce_superconductivity(
|
||||
x as i32 - 1,
|
||||
y as i32 - 1,
|
||||
z as i32 - 1,
|
||||
conversion::bounded_byond_to_option_f32(data[13], 0.0, 1.0)?,
|
||||
conversion::bounded_byond_to_option_f32(data[14], 0.0, 1.0)?,
|
||||
conversion::bounded_byond_to_option_f32(data[15], 0.0, 1.0)?,
|
||||
conversion::bounded_byond_to_option_f32(data[16], 0.0, 1.0)?,
|
||||
)?;
|
||||
}
|
||||
Ok(ByondValue::null())
|
||||
}
|
||||
|
||||
/// BYOND API for setting the atmos details of a tile.
|
||||
#[byondapi::bind]
|
||||
fn milla_set_tile(
|
||||
|
||||
Reference in New Issue
Block a user