-
-
Notifications
You must be signed in to change notification settings - Fork 465
Add possibility of modifying dynamic objects behavior #784
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add possibility of modifying dynamic objects behavior #784
Conversation
- changed the way of how backup ObjectDynamicInfo works - added functions to get/set/restore model dynamic properties group - some other small changes
also added missing property change
Limited to default 160 groups, dunno how many references to current table location are in the gta sa, and current amount is plenty for what's needed i think. |
1. Added const modfier to functions where possible 2. Changed constructor to use initializer list 3. Removed unnecessary call to ChangeSafeguard() from one of the getters
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.
Thanks for the changes. Looks good to me!
I'm looking at this line: https://github.com/multitheftauto/mtasa-blue/pull/784/files?w=1#diff-72a39fa83b01cb9bbbfc41c8928ac793R1343 and right now I have PR #299 open for current LOD functions that crash the client if passed an ID of 20000+. You seem to error out if the ID is not between 0 and 20000. Can you give a little more context on why this is? I'm trying to understand what's beyond 19999 that makes it crash the client so I can figure out a permanent solution with good context for the other issue.
@qaisjp commented:
If there is an underlying bug with
CGameSA::GetModelInfo
then that should be fixed instead.
I'm trying to figure out how to give closure to this 20000 issue.
As far as I'm aware, (and in the IDB i'm using), 20000 is original size of that array in gta sa, trying to change physical properties of anything above that crashes the client. I think the additional space reserved in CGameSA (up to 26000) was made either by mistake, or in case of mta team wanting to expand some limits. |
Found something old but interesting regarding dynamic objects on the Wiki: https://wiki.multitheftauto.com/wiki/Dynamic_object |
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.
Looks good in general. I added some comments, but other than that it should be good.
Only issue apart from that would be the discussion on changing result on usage errors in scripting #821
…upDynamicProperty
Calling of internal functions without _asm blocks Const specifier in range loops where needed Replaced pointers with std::unique_ptrs Fixed inconsistency with bad arguments checking in some lua functions
Nice work! Does the collision properties work for custom objects? I'm planning to make |
Since most of the properties are assigned in object constructor, based on model group ID, it should work without problems on custom models that replace dynamic objects. I haven't tested that tho so can't be sure. |
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.
Looks good. Just needs a decision on the script error thing...
Once this PR is merged, modelers can use this to generate breakable models: https://github.com/DK22Pac/v2saconv |
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.
These errors should be changed accordingly (#821 (comment)).
@patrikjuvonen Done :) |
Great job! 👍 Thank you for the PR =) |
This pull request aims to add possibility of modifying behavior of dynamic objects. This includes properties like their mass, particle effects played by them, if their explode or not, etc. By now mta has setObjectProperty() function implemented, but it's limited to custom created objects, and doesn't allow to change behavior of original world objects. All default properties, along with simple documentation, can be found in object.dat in GTA SA data folder. All changed properties are restored to default once user leaves server.
1. Property groups used by certain models IDs
SA by default contains 160 property groups for dynamic objects, multiple models can share single properties group, i've added possibility to change which group is used by which model, which required addition of those 3 functions:
I didn't notice any change when i've changed group id's of static objects (or any non dynamic stuff in CModelInfo table), but game is stable when those are changed for them, so i didn't disable ability to do so.
2. Properties themselves
There are multiple adjustable properties for each group, most of the changes made in them are visible after object is created, so most changes require you to get far away from object, and back to become visible.
Those 3 functions were created to give ability to modify those properties:
Those are the modifiable properties, along with their lua names and types:
The specialized properties enums looks like so:
Fx system:
Any particle system included in SA could be used by dynamic objects, but after testing i noticed that looping particle systems stay on map forever (even after leaving server), so i had to disable ability to use those, only non looping system are acceptable by fx_system property, those are: (from effects.fxp file)
3. Test resource
DOWNLOAD: props.zip
I'm including simple resource containing editor for those properties, that looks like that:
Simply start resource, and write /showgui to make it visible, same command to hide it back again.
Properties editor:
-- Changes properties of given group
Model editor:
-- Gives ability to change properties group used by given model
Presets:
-- Some simple presets, and ability to restore properties of all groups.
-- Given presets are: make everything explode, make everything easy to destroy, make everything undestroyable