Garry's Mod

Garry's Mod

271 értékelés
Addon hooks Conflict Finder
   
Díjazás
Kedvenc
Kedvenc
Törlés
Content Type: Addon
Addon Type: Tool
Fájlméret:
Közzétéve:
Frissítve:
3.276 KB
2015. jan. 3., 17:00
2016. máj. 9., 7:49
12 változásjegyzék ( megnézés )

Feliratkozás a letöltéshez
Addon hooks Conflict Finder

5 Alban CHAMPIGNON [GiletJaune] készítette gyűjteményben
Soccer by Mohamed RACHID
37 elem
Université Joseph Poireau (serveur)
70 elem
MR: Serveur Garry's Mod Jeu en 2D
11 elem
Dev Tests Mohamed
50 elem
G-1:788429
50 elem
Leírás
Intro
This tool allows the developer or the technician to discover the name of the hook that overrides the result and stops the execution of a given event name.

Available on GitHub: Addon hooks Conflict Finder[github.com]

The problem
When an event is triggered, all the hooks (callbacks) added to it are executed in an unknown order. If the event name is listed here[wiki.garrysmod.com] then this event has a default behavior, probably that from the base gamemode. For user-created event names, the event is triggered manually.
If any hook returns a value then the event execution stops, so pending hooks are ignored as well as the default behavior. This can be correct, but some Lua coders make crap and accidentally stop the event execution list.
That is why this addon has been created! If you have dozens of addons but do not know where to search for the conflict, this addon will help. This addon does not use hooks so it will always work!

Notes
• Event names and hook names are case-sensitive!
• Because the table read order in Lua is unknown, if the failing addons work correctly right after you started the test then you may have to temporary disable the failing addons.
• This addon cannot work with event names that are not strings.
• This addon will not return a meaningful hook name if it is neither a string nor a number.

Step 1
At first, if you see an addon that obviously has an overridden behavior, look inside of the source code to find the event name. An overridden hook is never called.
-- In an addon, you will see this: hook.Add( "EventName", "HookName", ThatHookFunction ) -- In the gamemode, you will more likely find this: function GM:EventName( args ) -- Something to do after all hooks created with hook.Add() have been executed. end

Step 2
Once you get the hook that seems not to work, note the event name.
The command name is find_conflicts_hook_sv to find a hook conflict serverside, or find_conflicts_hook_cl clientside. Only superadmins can use it serverside.

To start the test, use this command:
find_conflicts_hook_sv "EventName"
To stop the test then, use this:
find_conflicts_hook_sv "EventName" 0

Step 3
The screen will display something like the following each time the specified event gets a hook that returns a value:
• for a value returned by a hook created with hook.Add():
Event "EventName", hook "HookName", returned: Arg #1 = table: 0x37e5a550
• for a value returned by the gamemode:
Event "EventName", GAMEMODE, returned: Arg #1 = table: 0x2c69db10

Step 4
Once you got the hook name that stops the event, you can look into the source code of your addons. The addon name is mostly already given in the reports.
Be sure that the selected hook has both the right EventName and the right HookName.
It is now up to you to correct / remove the addon that incorrectly stops the event!
If you can't find the involved addon, for example with Notepad++ (hotkey Ctrl+Shift+F) you can look into every *.lua and *.gma file in the garrysmod\addons folder (+subfolders) by searching for HookName.

Good luck!
55 megjegyzés
Alban CHAMPIGNON [GiletJaune]  [készítő] ápr. 21., 23:37 
I don't have full examples. I'm sorry if you feel confused with the instructions in the description.
Mark ápr. 21., 21:11 
do you have any examples on how to use this mod?
Alban CHAMPIGNON [GiletJaune]  [készítő] ápr. 16., 23:54 
If you can find the event that is blocked then my conflict finder will help you locate the guilty add-on. You may need help to find the name of the event. What are the symptoms?
user ápr. 16., 12:55 
so do i actually have to find the event or do i just have to locate the addon with the problem
Alban CHAMPIGNON [GiletJaune]  [készítő] ápr. 16., 4:52 
If you can't tell which event has a problem then you cannot use this tool.
I apologize for not being helpful.
user ápr. 15., 10:47 
i thought this addon was gonna automatically display addons that are conflicting, i didn't know i would have to be messing around with code and other shit, im not a dev
Alban CHAMPIGNON [GiletJaune]  [készítő] febr. 24., 14:59 
There are a limited number of events names that you can put your eyes on. Damage scaling and stuff is pretty painless to inspect with this tool.
All you need is to gather the event names relative to damage and see what this add-on identifies.
You don't need an automated conflict compass when you know what you need to inspect.

And for the slow-down problem, you should give my lag finder a try. This other add-on is easier to use than the conflict finder, since the only things it's able to detect are slow-downs, which is why you would use the tool in the first place.
♬♫~Joe Blaze~♫♬ febr. 18., 10:21 
As well as regularly getting 1 FPS during NPC battles.
♬♫~Joe Blaze~♫♬ febr. 18., 10:21 
I'm currently stuck with conflicts that are braking my game, how damage works and textures even.
Alban CHAMPIGNON [GiletJaune]  [készítő] febr. 18., 2:21 
My reason is that there needs to be a rule for each event based on how much it makes sense to return a given value in a hook. For example, it does not make much sense to return true from a hook on an event used to determine the allowance to enter a vehicle, since it's the default. So technically you can tackle some conflicts, but even then, the conflict can be totally intended.