-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Allow zoom even with overwritten default FOV #12953
base: master
Are you sure you want to change the base?
Conversation
I do not feel strongly one way or the other. @paramat insisted back then to put this extra check in. |
Hmm, if I'm reading this correctly, this would completely remove Wouldn't it be better to allow Also example of a mod that allows setting of fov without conflicts; it uses a product of all existing set_fov requests. that could be used in the case of zoom_fov and set_fov, to just multiply them. That way you could set zoom_fov to some value other than 0 but close to the default fov and effectively remove the message while implementing your own system. |
Really, I'm not sure why the message actually exists; if the game supports zoom, it will work. Otherwise it won't zoom. It not zooming tells you the game doesn't support it? If zoom_fov and set_fov gave a product instead of being only one or the other, then the message would be redundant; it's only because they are mutually exclusive that you might want to know that zoom is disabled. Think about it this way, if you set step_height to 0, the game doesn't tell you "Step height is currently disabled by the game or mod" whenever you try to walk up stairs. |
@SumianVoice If zoom is not wanted, mods can still set For example the following combinations are currently possible in master:
Now with the PR:
|
I guess if it's tested and works; it just seemed from reading the code that it does:
And then later does
So although you can enable both at the same time, zoom fov key will override everything else, and if it doesn't override everything else, it shows the message. The original issue was noted when trying to remove the inbuilt zoom and implement it properly using set_fov; I tried to use zoom_fov = player's fov setting and use get_player_control().zoom to apply my zoom effect, but found out the message will appear. If it works like the pseudo code above, then mods would be unable to do that, and become incompatible with other mods if those mods set zoom_fov to anything other than 0 |
(It's been a while and I forgot about the matter) Have you tested the PR or is the answer based on static analysis only? Mods can still overwrite both FOV's (zoom and normal) by overwriting both values. Would you please be so nice to provide a short Lua snippet to demonstrate the issue you're facing? |
I can't build from source for some unknown reason / error unfortunately otherwise I'd have a shot at testing different things. So yeah it's all from reading the code. minetest.register_on_joinplayer(function(player)
player:set_properties({
zoom_fov = 70.0, -- enables zoom
})
end)
minetest.register_chatcommand("p", {
func = function(name, param)
local player = minetest.get_player_by_name(name)
player:set_fov(tonumber(param) or 0, true, 0.2)
end
}) If I read the code correctly, this would result in the The best solution would be to use the product of both FOV values. This is one way: } else if (player->getPlayerControl().zoom && player->getZoomFOV() > 0.001f) {
// Player requests zoom, apply zoom FOV
m_curr_fov_degrees = player->getZoomFOV();
// For simultaneous use of both fov factors
if (m_server_sent_fov) {
m_curr_fov_degrees *= m_target_fov_degrees
} That would allow both inbuilt zoom and set_fov to function together instead of the engine choosing between one or the other and creating incompatibilities. I don't know if I'm making sense here, but hopefully that explains my thought process. |
If I understand you correctly, you'd like to use |
Fixes #12951
Zoom can still be disabled using the player object properties. I created a PR in case someone thinks that the
set_fov
value should be enforced (i.e. whether disabling zoom is intentional).To do
This PR is Ready for Review.
How to test
Based on code from #12951