-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
Add new world properties (time cycle and weather related features) #2989
Add new world properties (time cycle and weather related features) #2989
Conversation
Wow amazing 😄 |
I really don't understand why no one has looked into this for a year. It's a pity that so few people have write access |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job
@TracerDS I will make changes to getters and data types later today. Thank you. |
Magic values are already a hindrance in mta source code. Having them as a definition makes it easier to understand
👌 |
I actually agree with this and it's useful for reusing address within getter and setter. But it's harder to copy memory address during review / code inspection. And the last one is important since we have PRs without review for years due limited interest / manpower. |
How so? |
Double click and Ctrl + C is faster and more intuitive than hovering and clicking Copy or switching directly to #define value. The only benefit is that it can be easier to understand in some cases and less risk of using wrong address in multiple places. In this case all addresses are related to method names so we don't really have any problem with understanding what it will change. |
Thats just laziness that doesnt benefit anyone. Memory addresses dont change, definitions do. |
In our case nothing will really change. This is why it's better to keep it consistent imo. |
Thats not consistency. Going with harder to understand codeblocks just because is not a good approach. Magic values are NEVER the way to go |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Debating whether to use a definition for addresses should not be part of this PR. The same applies to discussions about whether to use std library types (recommended for C++) or types from the global namespace (typical for C and available in C++ as well). Such debates should not be part of this PR, as they only lengthen its review. This is not a code refactoring PR. We all know that the MTA code is long spaghetti, but separate PRs are used for refactoring (by the way, they have been waiting for further steps for a long time). Imo code review concerns how the code was written in terms of conventions and consistency with the project, and in this case, consistency was maintained. Mixing it up so that half the code uses definitions and the other half uses direct addresses will only create even more spaghetti.
Its better to not create problems that would add up in the future. That way there would be less code refactoring PRs. |
I agree with you on this, the only problem with it is that these are not clarified in the community, they are not stipulated in the coding guidelines. If these were all clarified and prescribed in a format readable by anyone, there would basically be no problem with it - it would be really useful in the case of a new implementation, preventing further refactoring. I personally think that to avoid future problems it would be worthwhile to use std namespace types, but it takes a lot of people's opinions to decide that, and this PR is not the place for that. |
To start with, the coding guidelines haven't been updated for several years. No official documentation is currently up to date regarding the development of the MTA. There is no one who would take care of it and develop it at the appropriate level. Arguing now on every PR will not solve this problem. We should seriously consider developing coding guidelines and establishing some clear community standards. |
It's true. This is why in all my PRs I prefer to make code consistent with existing codebase even when it's not really good in some cases. Without proper refactor many things look out of place. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
If someone is interested in merging this for testing in nightly, I will add information to wiki within several hours. |
Resolve conversations, please 😃 |
Regarding the coding guidelines, there's been some discussion on dev discord, and contributors took a draft initiative: https://wiki.multitheftauto.com/wiki/New_coding_guidelines This PR has been reviewed a bunch of times by good people, merging. Thanks to @samr46 for his work to get this highly demanded set of features into MTA. |
This adds
getWorldProperty
,setWorldProperty
,resetWorldProperty
to modify remaining time cycle and weather related properties. UnlikesetTimeCycle
from stale PR #276 this implementation is consistent with existing related functions and adds more features.Imgur album: https://imgur.com/a/jeUxx7L
Added for convenience to adjust shadows height on demand. Can be used to resolve #2723
Turns on lights on ground during daytime
Also affects skyline clouds and shadows visibility
Some properties like
AmbientColor
are float by default and adjusted to regular RGB for usability (consistent with timecyc.dat).Discarded properties:
ExtraSunnyness
,CloudCoverage
CloudsAlpha2
,CloudsAlpha3
Tested and can be added:
TrafficLightsBrightness
orTrafficLights
Fixes #385
Fixes #2778
Fixes #2785 (kind of)
Using new parser for this was tricky. But I think it looks good.
It shouldn't be too hard to review. Offsets are used to make memory address validation easier. Test resource with GUI.
Test resource: worldprops.zip