pac3
pac3 copied to clipboard
Using_Physgun event doesn't function if physgun hidden with weapon_class
It appears the Using_Physgun event, at least with the 'find simple' or 'find' operators, does not seem to work. I cannot get it to detect usage of the physgun, regardless of what I do.
How to fix I have an idea: Place a weapon_class event, that tries to find weapon_physgun Make a child part button with arguments mouse_left
Logical check: Checks if you are holding weapon physics gun, if true, allows the child part to act. The child part checks for any presses on LMB, if there is, allows other child parts to act.
yeah, that's what I'm doing as it stands now, but then it activates during all UIs, which just feels wrong
don't capitalize event names.
using_physgun
okay that sounds just dumb enough to potentially be my problem, but I did select it through the menu, so it should be fine. However, I'm gonna go check that to see if that's actually what happened.
okay that definitely was not my problem, it just seems to not detect when the physgun is being used.
If you're really sure, then the obvious conclusion is that there's an addon conflict on the server end, lua junk or bad edited pac version. Something like that is messing with gmod's lua code. Whatever it is, the fault doesn't originate from pac. It works fine on my end, that's for sure. And I haven't heard of other people having this specific issue in any normal pac version in specific. If it was an issue in any official version, I'd have heard about it.
Best practice is to give us the info you have. What pac version are you using? What other addons are being used?
If disabling all other addons and going in singleplayer doesn't fix it, delete the lua folder and verify gmod files. That sometimes fixes some mysterious unexplained bugs.
Figured out the issue; if the physgun has been hidden using the weapon_class event, the using_physgun event does not trigger. This has been recreated with the latest version of PAC3, demo'd here: https://pastebin.com/PxVAKxQf
Any updates on this? I'd like to be able to hide my physgun, while still being able to rely on visuals tied to it only firing when it's valid to do so, such as the beam cutting out when I right click.
using_physgun and weapon_class events do have serious lua jank, but if the physgun beam hook doesn't run, in-pac3 alternatives still exist...
weapon_class + button event + do command events to cut it out on right click.
pac_event myphysgun 1 on LMB press with RMB released pac_event myphysgun 0 on RMB press, and on LMB release
use command event, command name myphysgun
demo video https://github.com/CapsAdmin/pac3/assets/3782245/b5766e55-ddc8-49c5-a155-f7cdd53a1c2a
(don't mind the fact the weapon_class isn't hiding, button events and command parts + command events work the same)