From 3b996534d8fd9dc91aaca471faee7a63b59e360c Mon Sep 17 00:00:00 2001 From: daijro Date: Sat, 12 Oct 2024 00:21:38 -0500 Subject: [PATCH] feat: Add humanize:minTime Set the minimum time of the cursor movement. --- additions/camoucfg/MouseTrajectories.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/additions/camoucfg/MouseTrajectories.hpp b/additions/camoucfg/MouseTrajectories.hpp index 67e0e6e..10b6a10 100644 --- a/additions/camoucfg/MouseTrajectories.hpp +++ b/additions/camoucfg/MouseTrajectories.hpp @@ -182,6 +182,13 @@ class HumanizeMouseTrajectory { return 150; } + int32_t getMinTime() const { + if (auto minTime = MaskConfig::GetDouble("humanize:minTime")) { + return static_cast(minTime.value() * 100); + } + return 0; + } + std::vector> tweenPoints( const std::vector>& points) const { assert(isListOfPoints(points) && "List of points not valid"); @@ -196,7 +203,7 @@ class HumanizeMouseTrajectory { // Uses a power scale to keep the speed consistent int targetPoints = std::min( getMaxTime(), - std::max(2, static_cast(std::pow(totalLength, 0.25) * 20))); + std::max(getMinTime() + 2, static_cast(std::pow(totalLength, 0.25) * 20))); std::vector> res; for (int i = 0; i < targetPoints; i++) {