Skip to content

Conversation

itslewiswatson
Copy link
Contributor

@itslewiswatson itslewiswatson commented Nov 2, 2021

This PR introduces some quality of life improvements to the joinquit resource, as well as some basic enhancements:

  • Moved the script server-side
  • Added *showColorCodes setting which accepts a boolean value
  • Added *defaultColor setting which accepts an RGB input, and controls what color to output the message text in
  • Removed anonymous functions
  • Removed redundant support for alpha values which weren't present in hex code so I'm not sure why we used them
  • Resource listens for settings changes
  • Moved a few pieces of functionality into functions, namely getDefaultColor (which has a fallback now) and getHexFriendlyNick which makes the outputChatBox calls read nicer

- Added OOP
- Use RGB instead of hex codes for ease of use
- No more anonymous functions
- Listen for settings changes
@sacr1ficez
Copy link
Contributor

sacr1ficez commented Nov 2, 2021

Refactored to use OOP

Don't get me wrong but OOP is mistake in MTA, i would avoid it at any cost (especially for such simple script), unless you can't do some code without it.
It's horrible in performance, and simply enabling it in meta would cause increased memory/cpu usage.
obraz

@itslewiswatson
Copy link
Contributor Author

Regardless of the perceived efficiency, it is simply much easier for most people to read and write object-oriented code. Which is frankly more important than micro-efficiencies and premature optimizations, especially for a project of this magnitude. Writing it this way means it is more accessible to more people, and much easier for people like me who context-switch a lot.

I doubt the overhead of OOP degrades performance by such a margin that could be reasonably referred to as "horrible". If you have serious concerns about my code using OOP, please raise them here. Otherwise I fear this is off-topic, but feel free to open an issue and we could discuss OOP usage in this repo potentially.

@sacr1ficez
Copy link
Contributor

sacr1ficez commented Nov 2, 2021

it is simply much easier for most people to read and write object-oriented code

Most of people uses POP, i can tell you that by observing scripting help channels from many years. Also, there is way more scripts written in just POP.
Anyways it's up to you, i just suggested refraining by using it :)

@Dutchman101
Copy link
Member

@itslewiswatson There is no clear coding guidelines yet, but we won't accept this PR if it uses OOP.. performance hit can be ~ 20% additional load

@itslewiswatson
Copy link
Contributor Author

@Dutchman101 the PR uses good old-fashioned procedural now

@jlillis jlillis merged commit bbd536d into multitheftauto:master Nov 22, 2021
@patrikjuvonen patrikjuvonen changed the title enhancement: joinquit settings support + code refactor joinquit settings support + code refactor Apr 22, 2022
@patrikjuvonen patrikjuvonen added this to the 1.6 milestone Apr 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants