Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign up[Request] setEffectDensity() to maximum instead of "density out of bounds" debug message #785
Comments
This comment has been minimized.
This comment has been minimized.
While it's not a fix, here's what we use on our server to mitigate this issue: _setEffectDensity = setEffectDensity
function setEffectDensity(effect, density)
local stat = dxGetStatus()
if stat then
local fx = stat.SettingFXQuality
if fx then
if tostring(fx) == "0" then
density = math.min(1, density)
elseif tostring(fx) == "1" then
density = math.min (1.5, density)
end
end
end
return _setEffectDensity(effect, density)
end |
This comment has been minimized.
This comment has been minimized.
Didnt know that. Good idea. Thx. |
botder
added
the
enhancement
label
Jan 25, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Einheit-101 commentedJan 20, 2019
•
edited
(Moved from https://bugs.mtasa.com/view.php?id=9235)
Description
setEffectDensity can return a debug warning about "density out of bounds" when a player has low fx settings set.
To reproduce
local x, y, z = getElementPosition(localPlayer)
local effect = createEffect("camflash", x, y, z, 0, 0, 0, 300)
setEffectDensity (effect, 2)
Will output a debug message if you are using low or medium fx setting.
Expected behaviour
Instead of a debug warning it should just set it to the max that is allowed for the current graphic setting.
Screenshot
http://i.imgur.com/ZmMaDdt.jpg
Latest MTA Nightly
Additional context
FX setting - maximum effect density without outputting debug warning
Low ---------- 1
Medium ----- 1.5
High --------- 2
Very High --- 2
Current workaround that only causes 1 debug message when joining:
local maxDensity = 2
function onStart()
if not setEffectDensity(createEffect("camflash", 0, 0, 0), maxDensity) then
maxDensity = 1
end
end
addEventHandler("onClientResourceStart", resourceRoot, onStart)