Ulysses
Ulysses Stuff => General Chat & Help and Support => Topic started by: TomatoSoup on April 10, 2015, 07:49:20 PM
-
Currently, PointShop can fail to function due to how ULib overrides the default Hook functions. If an option or ability was added to override them then that would be excellent.
Edit by Megiddo: Changed title to reflect the discussion
-
What makes you think that Pointshop failing has anything to do with ULib's custom hook system?
Just because ULib is in the stack trace for the error doesn't mean it is the cause.
More likely you have something else causing an issue.
-
Because I have made a clean server install with ULX, ULib, and PointShop, where it fails to operate correctly. Upon deleting ULX and ULib (or even just the hooks.lua file!) PointShop begins to operate correctly again.
-
You either have something coded wrong in your pointshop (custom group settings maybe?) Or a broken version of it altogether, otherwise, ulx and ulib shouldnt be interacting with pointshop.
You mentioned you did a clean server install with ulx, ulib, and pointshop, are these clean versions of each or customized?
-
Clean except for the MySQL settings configured for Pointshop and myself added as admin in ULX.
-
TomatoSoup,
Please provide some code and/or errors and links to what you're using in Pointshop that you believe to be 'broken' by ULib's hooks.
Though it is possible our latest changes to the hook library could be causing some oddity, too many times we've seen people use code that was already unstable to begin with break when prioritized.
-
There are plenty of people who use Pointshop and ULX together with no issues at all.
Though, like JamminR said, if you'd provide us the errors we could help determine what's going on.
-
The stack trace is
[ERROR] addons/pointshop/lua/pointshop/sv_player_extension.lua:283: attempt to index field 'PS_Items' (a nil value)
1. PS_HasItem - addons/pointshop/lua/pointshop/sv_player_extension.lua:283
2. PS_hasItemEquipped - addons/pointshop/lua/pointshop/sv_player_extension.lua:287
3. fn - addons/pointshop/lua/pointshop/sh_init.lua:145
4. unknown - addons/ulib/lua/ulib/shared/hook.lua:108
Adding prints in order to debug what gets called when, the PlayerInitialSpawn hook in Pointshop never gets called. That is, I put print("POINTSHOP INITIAL SPAWN")
into the function that hook calls and it never prints that.
-
FYI, TomatoSoup has posted more info on these GitHub issues, which Megiddo closed:
https://github.com/Nayruden/Ulysses/issues/449
https://github.com/Nayruden/Ulysses/issues/450
I'd like to look into this when I get a chance, but I have been busy as of late. Is there anyone here that can CONFIRM that pointshop works with the latest GitHub versions of ULX and ULib?
TomatoSoup, also let us know what gamemode, pointshop version, and maybe any other addons you're running to help us test. Thanks!
-
I have no problems with fresh installs of both.
-
I tested it initially on my addon-heavy sandbox server, where it first failed, so I then made a clone of my clean testing server and threw it in there, where it errored. I'll try it on my TTT server in a little and report back.
Also, again, I really want to apologize for opening two identical issues back-to-back on the bug tracker. I was just really frustrated.
EDIT:
Well, the TTT server doesn't have any errors. I thought maybe that was because I haven't used my sandbox server in quite some time, so perhaps ULib and ULX got out of date. And they were! But updating them didn't fix the problem. So the problem is persisting even on my clean (and now fully up-to-date) sandbox server.
-
It's all good- When you can narrow a problem down that far, it makes it seem likely that the hook.lua file would be causing the problem- but there are always some unseen factors at play that can be very hard to find. :P Plus, if there was an issue with the core functionality of the hook library, we'd likely be dealing with a LOT more issues.
One other thing to note- be sure your Garry's Mod servers are up-to-date (scrds if you have control over it). It's been a couple weeks since they updated, but they made some changes to NWVars that may be causing some issues.
EDIT: I just tried throwing Pointshop on my development server (dev version of Garry's Mod) and did not have any issues (sandbox, ULX/ULib only). Hopefully you can figure out what's causing this!
-
Well, the TTT server doesn't have any errors. I thought maybe that was because I haven't used my sandbox server in quite some time, so perhaps ULib and ULX got out of date. And they were! But updating them didn't fix the problem. So the problem is persisting even on my clean (and now fully up-to-date) sandbox server.
Would it be possible for us to get your item files? Perhaps it is something with a custom item you have, although that seems unlikely, worth a try I suppose.
-
I don't have any custom items yet and, when hooks.lua is missing, all the stock items appear, so I don't think that's related.
My modded sandbox isn't as up-to-date as I'd like, but the clean one is only a few days old. It's a bit of a bummer because a lot of my legacy stuff uses NWVars and I'm not looking forward to updating all that!
I'm gonna start seeing what's different between TTT and Sandbox. I put debug into hooks.lua and it stops trying to run hooks after one of them returns true.
I know that default behavior for GarrysMod is that, when you return true on a hook, it stops the Gamemode's hook from executing. It looks like the way hooks.lua works, once any hook returns true, it stops executing all the lower priority hooks of the same event from executing. Which is definitely a feature of the priority system so that a higher priority hook can stop a lower priority one from executing.
So that's hooks.lua's departure from default behavior. Now I just need to figure out what I have that's returning true and hooked to PlayerInitialSpawn that shouldn't be.
-
Do let us know if you find anything, as there are a few others having this same issue. Good luck! :)
Also, BuzzKill made a neat debug tool that can help you find the names of hooks that are calling "PlayerInitialSpawn":
http://forums.ulyssesmod.net/index.php/topic,8428.0.html (http://forums.ulyssesmod.net/index.php/topic,8428.0.html)
Edit: TomatoSoup, is your server running on Linux? We would like to rule out the possibility of this being a platform-specific bug, as well. (We've only tested on Windows)
-
Moving this thread to help and support; we will never implement a way to bypass ULib hooks. Such behavior would be nonsensical anyways, since ULib performs functionally exactly the same as gmod default, excepting hook ordering.
I also tried to replicate this behavior with no success, though I was also using Windows.
-
You said that the sandbox server was out of use for a while. What versions of ULX, ULib, Pointshop (1 or 2 and what update), and as said what OS (or host if unknown) are you running on?
-
I'm using Windows, Pointshop 1 with the latest from their git, the SVN version of ULX/ULib were downloaded less than an hour before the test, likewise with validating GMod itself via SteamCMD (but I made a mistake in earlier statements, more on that later).
Importantly, though, I have a way to replicate the issue.
function BreakPointshop()
return true
end
hook.Add("PlayerInitialSpawn", "breakpointshop", BreakPointshop)
In lua/autorun. When that is there, it breaks pointshop. When it's not there, pointshop works. When it's there and ULib is NOT there, Pointshop works.
The problem does not occur in a totally vanilla install of GMod, I'd accidently left some debug code that prints player information in lua/autorun. I only checked addons because I forgot about that code. Sorry for misrepresenting this as a bug that occurs in totally vanilla gmod.
But my point remains that hooks.lua does not actually have the same behavior as regular GMod. Returning true in a hook in regular gmod stops the gamemode's version of that hook from executing. Returning true under hooks.lua's regime, however, causes all subsequent hooks to not execute. This is not analogous to GMod's behavior as it stops other hooks from executing, rather than just stopping the default gamemode hook from executing.
-
Hmm, that's an interesting finding. I'll query Megiddo for clarification on the matter- it could be an oversight or a deliberate design choice, as hooks that return non-nil values have a history of causing conflicts between addons.
EDIT: Okay, I was just reading the code incorrectly.
Our hook does behave the same as GMod's hook system in terms of return behavior. The ONLY difference you're seeing with using ULib's hook is that the ORDER of hooks are being changed. Your code snippet above works with the standard GMod hooks likely because it's being called later.
Try moving your BreakPointshop hook INSIDE of Pointshop's code itself, directly before they add their PlayerInitialSpawn hook. I'm willing to bet that if yours gets added (and then run first), then it will break regardless of whether or not you're using ULib's hook.lua.
Megiddo made a good point to me: The fact that you're having these sorts of issues in the first place is a good indicator of why we are using our Hook priority feature in the first place- There's absolutely no easy way for developers to ensure that their hooks are being called in a predictable order, thus resolving conflicts between two third party addons over a single hook is not possible.