Skip to content
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

Fix world light config #4623

Closed
wants to merge 1 commit into from
Closed

Fix world light config #4623

wants to merge 1 commit into from

Conversation

ramon-bernardo
Copy link
Contributor

Pull Request Prelude

Changes Proposed

  • Move world light config to game core

Issues addressed:
#4621

@omarcopires
Copy link
Contributor

we had everything centralized in config.lua, now we have several scripts with several different configurations, this is a great return.

@Sajgon
Copy link

Sajgon commented Jan 15, 2024

Why is the config of defaultWorldLight even a thing? there's nothing in the code to handle it being false

@Sajgon
Copy link

Sajgon commented Jan 15, 2024

I think there's another issue with world light @ramon-bernardo

Here it's returned as "worldLightLevel, worldLightColor"

	function Game.getWorldLight()
		return worldLightLevel, worldLightColor
	end

but on other places it's fetched as:
local worldLightColor, worldLightLevel = Game.getWorldLight()

Copy link
Contributor

@amatria amatria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +192 to +195
-- World Light
-- NOTE: if defaultWorldLight is set to true the world light algorithm will
-- be handled in the sources. set it to false to avoid conflicts if you wish
-- to make use of the function Game.setWorldLight(color, level)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment still true? Is it handled in the sources or is it handled in Lua? data/scripts/globalevents/world_light.lua seems to be doing just that.

@amatria
Copy link
Contributor

amatria commented Jan 30, 2024

we had everything centralized in config.lua, now we have several scripts with several different configurations, this is a great return.

You are absolutely right. It is a pity this parameter is now decentralized. However, #4583 moved the world light algorithm to Lua and so it does not make sense to keep that parameter in the config.lua anymore. But again, I get you. Stating the intent behind this PR would probably reduce the amount of eyebrows raised.

Why is the config of defaultWorldLight even a thing? there's nothing in the code to handle it being false

Not at all. What if I want to make my own world light algorithm? I need this switch to turn the default behavior off. While it is true that there is no code to handle it being false, I could very well add my own.

@MillhioreBT
Copy link
Contributor

If it will no longer be a configuration then make the variable local, since it will only be used in that specific place, if someone changes it to false they know they have to create their own lighting system and they do not have to check if it is false or true elsewhere

Honestly, it doesn't bother me that this boolean is in the Lua configuration, it can be accessed from anywhere and it also doesn't litter the global environment with global variables.

@ramon-bernardo
Copy link
Contributor Author

Similar #4790

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants