plugin/cheat: check value is a mulitple of step

This commit is contained in:
cracyc 2020-09-13 19:03:22 -05:00
parent 0d3b24b32c
commit 35bfe62b59

View File

@ -569,7 +569,11 @@ function cheat.startplugin()
end
cheat.set_index = set_index;
cheat.set_value = function(cheat, value)
local idx, chg = cheat:set_index((value / cheat.parameter.step) + 1)
local idx = (value / cheat.parameter.step) + 1
local chg = false
if math.integer(idx) == idx then
idx, chg = cheat:set_index(idx)
end
return cheat.parameter.value, chg
end
cheat.get_index = function(cheat) return cheat.parameter.index end