better follow time calculation - clamped to positive values
This commit is contained in:
parent
8c5ea9cee4
commit
ff60969e67
1 changed files with 3 additions and 3 deletions
|
@ -20,11 +20,11 @@ local function calculateFollowTime()
|
|||
-- Modified formula from RubberMan's "Inquisitive Guards"
|
||||
-- https://www.nexusmods.com/morrowind/mods/46538
|
||||
local sneak = tes3.mobilePlayer.sneak.value and tes3.mobilePlayer.sneak.value or tes3.mobilePlayer.sneak.base
|
||||
-- if player sneak is greater than 100, guards won't follow at all
|
||||
-- if player sneak is 100 or greater, guards won't follow at all
|
||||
local max = tes3.hasCodePatchFeature(110) and (sneak <= 100 and 101 or 0) or 101
|
||||
local value = (max - sneak) / 3
|
||||
-- round to nearest integer
|
||||
return math.fmod(value, 1) >= 0.5 and math.ceil(value) or math.floor(value)
|
||||
-- round to nearest integer and clamp to positive
|
||||
return math.clamp(math.round(value, 0), 0, math.huge)
|
||||
end
|
||||
|
||||
-- }}}
|
||||
|
|
Loading…
Add table
Reference in a new issue