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 interface for model flags #1714
Add interface for model flags #1714
Conversation
Can we merge this? |
I don't feel it's ready for merge. I tested this codebase while @qaisjp watched as well. The API being provided for get/set is not adequate. It's difficult to use, confusing, and generally not user friendly. We don't have a recommendation/solution for this, but something should change to make it easier for people to use. |
Do you mean bitwise operations? If so then it would be possible to add functions |
Table with all model flags |
Private sheet |
Fixed |
Do all these flags actually work? |
I saw almost all flags in IDA, but im not sure that all of them have effect in MTA. My "must have" list:
|
i'm curious, will this fix vehicle/peds shadows over non-world objects created with createObject function? |
Is there any docs about what these flags do? We can guess some for sure like |
It won't. MTA created objects are treated by game as small dynamic objects like lampposts etc. and that's why they do not reflect shadows. |
As briefly mentioned on Discord - I think the API needs simplifying and the usage being more "consistent". We should have only 2 functions for setting and getting flag(s). Each function you can either pass a single flag ID, or a table of flag IDs (ints). Also, both functions should accept/return the flag IDs (ints). This is the consistency part, as currently you have to work with both ints as well as string names, depending on if you're setting one, or multiple flags. We can have a table of the flag IDs and their names on the wiki. This also gets rid of the need for that Ideally, the functions would be: table engineGetModelFlags( int modelID, int flagID / table flagIDs )
bool engineSetModelFlags( int modelID, int flagID / table flagIDs, bool state ) |
As i remember, GTA SA translates flags from IDE files in internal format, and we can't translate GTA format in IDE format. So, user friendly API should handle well-known information in this situation. As Pirulax said once "No magic numbers in API". We have some unfriendly examples like Current API is perfect for 2 types of operations:
|
If we can't translate it back, I don't think we should expose it. Most people would set flags in the IDE format, because that's the documented format. As pointed out above, current scripting functions take alternative parameters instead of having several functions. So we should keep it to one set/get/reset IMO. I also agree we shouldn't come up with magic numbers, so what about the following.
int/bool engineGetModelFlags( int modelID [, string flagName ] ) Returns IDE flags, or state of a specific flag if flagName is specified. bool engineSetModelFlags( int modelID, int flags / string flagName [, bool state ] ) Sets IDE flags, or a specific flag if flagName and state is specified |
I agreed, most people will use the flags id from corresponding idea file, this feature will benefit especially someone who are trying to do a map total convertion in MTA. |
This comment was marked as resolved.
This comment was marked as resolved.
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.
This is great, thank you very much.
API:
Flags:
Flags documentation
Important
engineGetModelFlags
returns internal GTA flags.You can transform IDE flags into GTA flags with 3 argument in
engineSetModelFlags
.