Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utilities: fix some blocks breaking if specific costumes exist #1119

Merged
merged 3 commits into from
Oct 30, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions extensions/utilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -279,11 +279,11 @@
}

isLessOrEqual({ A, B }) {
return A <= B;
return Scratch.Cast.compare(A, B) <= 0;
}

isMoreOrEqual({ A, B }) {
return A >= B;
return Scratch.Cast.compare(A, B) >= 0;
}

trueBlock() {
Expand All @@ -295,6 +295,8 @@
}

exponent({ A, B }) {
A = Scratch.Cast.toNumber(A);
B = Scratch.Cast.toNumber(B);
return Math.pow(A, B);
}

Expand All @@ -311,6 +313,9 @@
}

clamp({ INPUT, MIN, MAX }) {
INPUT = Scratch.Cast.toNumber(INPUT);
MIN = Scratch.Cast.toNumber(MIN);
MAX = Scratch.Cast.toNumber(MAX);
if (MIN > MAX) {
return Scratch.Cast.toNumber(Math.min(Math.max(INPUT, MAX), MIN));
GarboMuffin marked this conversation as resolved.
Show resolved Hide resolved
} else {
Expand Down