[READY] The most unholy solution to 515 and 516 rustlibs (#28590)

* What in the heck is this

* Tweaks I should have made before opening the PR

* gah

* Fix if () spacing issue

* Use the proper package
This commit is contained in:
AffectedArc07
2025-03-13 16:14:31 +00:00
committed by GitHub
parent 13d69ff614
commit 7b40fe651b
18 changed files with 121 additions and 35 deletions
+8
View File
@@ -1,3 +1,11 @@
mod logging;
mod mapmanip;
mod milla;
#[cfg(all(not(feature = "byond-515"), not(feature = "byond-516")))]
compile_error!("Please specify byond-515 or byond-516 as a feature to specify BYOND version.");
#[cfg(all(feature = "byond-515", feature = "byond-516"))]
compile_error!(
"Please specify ONLY byond-515 or bypnd-516 as a feature to specify BYOND version, not all features."
);
+16 -2
View File
@@ -100,15 +100,29 @@ pub(crate) fn internal_create_environment(
/// 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> {
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 mut property = turf.read_var_id(property_ref)?;
let data = property.get_list_values()?;
#[cfg(feature = "byond-516")]
property.decrement_tempref();
#[cfg(feature = "byond-515")]
property.decrement_ref();
if data.len() != 17 {
return Err(eyre!("data property has the wrong length: {} vs {}", data.len(), 17));
return Err(eyre!(
"data property has the wrong length: {} vs {}",
data.len(),
17
));
}
internal_set_tile(