mindustry logic execution, map- and schematic- parsing and rendering
fix mop
bendn 3 months ago
parent dfe973e · commit 51c915b
-rw-r--r--lemu/Cargo.toml2
-rw-r--r--lemu/rust-toolchain.toml2
-rw-r--r--lemu/src/instructions/mop.rs17
3 files changed, 13 insertions, 8 deletions
diff --git a/lemu/Cargo.toml b/lemu/Cargo.toml
index bacfdea..0d45ebd 100644
--- a/lemu/Cargo.toml
+++ b/lemu/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "lemu"
-version = "0.2.20"
+version = "0.2.21"
edition = "2024"
description = "M-LOG runner"
authors = ["bend-n <[email protected]>"]
diff --git a/lemu/rust-toolchain.toml b/lemu/rust-toolchain.toml
index b67ba8f..5d56faf 100644
--- a/lemu/rust-toolchain.toml
+++ b/lemu/rust-toolchain.toml
@@ -1,2 +1,2 @@
[toolchain]
-channel = "nightly-2025-07-29"
+channel = "nightly"
diff --git a/lemu/src/instructions/mop.rs b/lemu/src/instructions/mop.rs
index a008c45..7a9a4d7 100644
--- a/lemu/src/instructions/mop.rs
+++ b/lemu/src/instructions/mop.rs
@@ -24,6 +24,11 @@ macro_rules! num {
f64::from($c(get_num!(x)))
}
};
+ (deg $fn: ident $c:expr) => {
+ fn $fn(x: &LVar<'_>) -> f64 {
+ f64::from($c(get_num!(x).to_radians()))
+ }
+ };
}
macro_rules! flbop {
@@ -43,12 +48,12 @@ const fn rand(_: &LVar<'_>) -> f64 {
}
num!(ceil f64::ceil);
num!(sqrt f64::sqrt);
-num!(sin f64::sin);
-num!(cos f64::cos);
-num!(tan f64::tan);
-num!(asin f64::asin);
-num!(acos f64::acos);
-num!(atan f64::atan);
+num!(deg sin f64::sin);
+num!(deg cos f64::cos);
+num!(deg tan f64::tan);
+num!(deg asin f64::asin);
+num!(deg acos f64::acos);
+num!(deg atan f64::atan);
num!(log10 f64::log10);
super::op_impl!(MathOp1, ptr type = for<'v> fn(&LVar<'v>) -> f64 {