multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.42k stars 438 forks source link

Add the ability to completely remove or disable unused functions. #3774

Open Daniheee opened 1 month ago

Daniheee commented 1 month ago

Is your feature request related to a problem? Please describe.

No response

Describe the solution you'd like

A new line could be added to the 'mtaserver.conf' file, something like:

<disabled_functions>setElementInterior, createVehicle<disabled_functions>

Here, we could list functions that our gamemode doesn't use at all, allowing us to completely remove them from both the server and client side.

Describe alternatives you've considered

You can always do:

setElementInterior = nil

But I believe that's not a permanent solution, and it might be possible to ""bypass"" it.

Additional context

Removing unnecessary functions might free up a very small amount of memory as well, though I'm not entirely sure about this, please feel free to correct me on this one.

Security Policy

TracerDS commented 1 month ago

You cant prevent client from using these functions. Disabling them on server also doesnt make much sense unless you have third party resources that you didnt write. You can already disable functions with addDebugHook though that is not an optimal solution.

Daniheee commented 1 month ago

Just as you said, addDebugHook isn’t an optimal solution, it hits performance hard most of the time, and i would prefer not to use it. I would love to remove them simply because i don't use them a single time, ever, so they are completely useless for the server. But it's okay if my idea isn't isn't possible or worth trying

tederis commented 1 month ago

I don't see the practical side of it.

Daniheee commented 1 month ago

I can understand it's nothing practical, it's more likely a matter of personal preference, nothing serious

CrosRoad95 commented 1 month ago

Just do clientside setFarClipDistance(getFarClipDistance() - 0.01) to same same amount of memory you would otherwise save by not including few functions xD

Daniheee commented 1 month ago

Just do clientside setFarClipDistance(getFarClipDistance() - 0.01) to same same amount of memory you would otherwise save by not including few functions xD

haha, thanks for clarifying it