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

Behaviour of some OOP methods depend on min client version setting #1240

Closed
ccw808 opened this issue Jan 30, 2020 · 7 comments · Fixed by #1582
Closed

Behaviour of some OOP methods depend on min client version setting #1240

ccw808 opened this issue Jan 30, 2020 · 7 comments · Fixed by #1582
Labels
bug Something isn't working
Milestone

Comments

@ccw808
Copy link
Member

ccw808 commented Jan 30, 2020

The following OOP methods change their behaviour depending on the min client version setting. The min client requirement can change for various reasons (e.g. compiling) and therefore cause the script to break.

getElementBoundingBox
getVehicleComponentPosition
getVehicleComponentRotatio
@qaisjp
Copy link
Contributor

qaisjp commented Jan 30, 2020

I think that OOP functions should always return vectors, and if we make a mistake, it needs to be fixed.

The min client requirement can change for various reasons (e.g. compiling) and therefore cause the script to break.

Why does it do this?

Maybe I've missed a page or issue that documents/discusses this behaviour, but if it overrides whatever is defined in the meta.xml file, I'd say this (what I've quoted) is unexpected behaviour.

@qaisjp
Copy link
Contributor

qaisjp commented Jan 30, 2020

Fwiw, there's nothing on the wiki that actually documents that OOP functions need to return vectors, but I think most people assume that it does? We should document that convention somewhere.

In this case, I don't think there's anything we can do here except let those scripts break. If we had a way to track statistics we could make a more informed decision

Related to #305, #332

@ccw808
Copy link
Member Author

ccw808 commented Jan 30, 2020

Why does it do this?

The effective min client requirement increases because the newer obsfucation methods need a higher client version. I guess what we need is the ability to check the declared min client requirement in meta.xml

@ccw808
Copy link
Member Author

ccw808 commented Feb 1, 2020

I've investigated further:
The effective min client requirement is calculated on the server by checking the script source. If the source is compiled with obfuscation 2+ or the source contains new client functions then the effective min client requirement is increased.

Adding the ability for the client to check for the declared min client requirement needs a server side change. After that, a resource which uses any client function introduced after 1.5.6 will get a change in behaviour of :getVehicleComponentPosition (when run on the new server version).

Also, resources which use later functions with missing version requirements get a nag warning to use the upgrade command. Using the upgrade command will change the declared min client requirement and switch the behaviour of :getVehicleComponentPosition.

In summary, I think we should try to remove the link to the min client requirement. I also think we should be brave now and consider something drastic which will eventually be better.
e.g.

  1. Change behaviour of the methods to always return 3 floats or Vector3
    or
  2. Rename the methods and deprecate the old names

@Woovie
Copy link
Contributor

Woovie commented Feb 1, 2020

I vote for option 1, we frequently stagnate on issues like this for compatibility sake, but to simplify this entire issue, just switch to Vector3.

@qaisjp
Copy link
Contributor

qaisjp commented Feb 1, 2020

Renaming shows a useful message but confusing since it goes against convention

I'd say #1 with vectors too

@patrikjuvonen patrikjuvonen changed the title Behaviour of some OPP methods depend on min client version setting Behaviour of some OOP methods depend on min client version setting Feb 22, 2020
@prnxdev
Copy link

prnxdev commented Feb 26, 2020

I think that OOP functions should always return vectors

I agree with that 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants