summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-06-16 23:34:40 -0300
committerJesusaves <cpntb1@ymail.com>2019-06-16 23:34:40 -0300
commit508c75860c19527a4481b022ebe5bdf26ed87de6 (patch)
tree59766429e9844905f618a0be9058d18ec789bebc
parentae22105e139fa53a8e3b6da12d53e819bcb2fb55 (diff)
downloadserverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.gz
serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.bz2
serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.tar.xz
serverdata-508c75860c19527a4481b022ebe5bdf26ed87de6.zip
New (unused) math function: limit(lower, target, higher)
-rw-r--r--npc/functions/math.txt8
1 files changed, 8 insertions, 0 deletions
diff --git a/npc/functions/math.txt b/npc/functions/math.txt
index b213cfd79..068d46cba 100644
--- a/npc/functions/math.txt
+++ b/npc/functions/math.txt
@@ -77,6 +77,14 @@ function script is_between {
}
+// forces the equation: lower <= target <= higher.
+// Note it still works if higher and target values are swapped.
+// limit ( lower, target, higher)
+function script limit {
+ return max(getarg(0), min(getarg(1), getarg(2)));
+}
+
+
// result is the ponderate average.
// ponderate_avg ( arg1, sub1, arg2, sub2)
function script ponderate_avg {