-
-
Notifications
You must be signed in to change notification settings - Fork 496
Add setElementCollidableWithType #181
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 setElementCollidableWithType #181
Conversation
@Necktrox
Necktrox
Dec 1, 2017
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.
I am not certain if you can use a for-range loop here, but .begin() and .end() seem promising
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.
Should I change GetEntitiesFromRoot return to list instead of CFastList?
@Necktrox
Necktrox
Dec 1, 2017
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.
You should rather wait for somebody else to comment or benchmark both variants and keep the better one, because I can't answer this question.
Changed all, thanks for the infos (C++ newbie here ^^)
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.
Does someone understand why this line (without "this->" too) gives a "LNK2019" error?
Maybe because it's CClientVehicle is getting destructed before, so GetType is not implemented for the element anymore?
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.
Calling any virtual member function in a destructor is a very bad idea.
@Necktrox
Necktrox
Dec 2, 2017
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.
GetType is virtual
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.
So either not check the type and do it for all element-types or get the type in another way.
Einheit-101
commented
Mar 21, 2018
Is it possible to enhance this in a way so that its possible to make an element non-collidable with WORLD elements? This would allow vehicles to pass through certain default world objects.
A version of this PR with master merged in can be found here: https://github.com/qaisjp/mtasa-blue/tree/setElementCollidableWithImprovement
If someone wants to take it forward, please do so. I can't push to this PR because @emre1702 deleted their fork.
Replaced with #1719
Uh oh!
There was an error while loading. Please reload this page.
With this function you can disable the collision of a element with all the elements of a type and also new created ones.
I had struggles to create this kind of script in my newbie-times and also experienced many other new scripters having problems. So why not create a simple function which does, what you want?
Syntax:
bool setElementCollidableWithType ( element theElement, string withType, bool enabled[, bool onlyWithCreated = false ])
Use "onlyWithCreated" if you don't want to consider new created elements (like it is right now in setElementCollidableWith).
Oh and the first commits could be strange.
Wanted to overload the setElementCollidableWith function, then decided to create a new function.