New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] setEffectDensity() to maximum instead of "density out of bounds" debug message #785

Open
Einheit-101 opened this Issue Jan 20, 2019 · 2 comments

Comments

Projects
None yet
3 participants
@Einheit-101
Copy link

Einheit-101 commented Jan 20, 2019

(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)

@forkerer

This comment has been minimized.

Copy link
Collaborator

forkerer commented Jan 20, 2019

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
@Einheit-101

This comment has been minimized.

Copy link
Author

Einheit-101 commented Jan 20, 2019

Didnt know that. Good idea. Thx.

@botder 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