Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "fire_bullets" event from erroring. #1350

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lua/pac3/core/client/parts/event.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1462,8 +1462,8 @@ PART.OldEvents = {
operator_type = "string", preferred_operator = "find simple",
tutorial_explanation = "fire_bullets supposedly checks what types of bullets you're firing",
arguments = {{find_ammo = "string"}, {time = "number"}},
callback = function(self, ent, find, time)
time = time or 0.1
callback = function(self, ent, find_ammo, time)
local time = time or 0.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This local isn't needed


ent = try_viewmodel(ent)

Expand Down Expand Up @@ -3382,10 +3382,6 @@ pac.AddHook("EntityFireBullets", "firebullets", function(ent, data)
ent.pac_fire_bullets = {name = data.AmmoType, time = pac.RealTime, reset = true}

pac.CallRecursiveOnAllParts("OnFireBullets")

if ent.pac_hide_bullets then
return false
end
Comment on lines -3385 to -3388
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idk if removing this is right. Someone else verify

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At first glance, if we search "pac_hide_bullets", it seemed as though the field isn't created anywhere (so, accessing it would always be nil if that was the case)
But, if we run the search without the pac_ prefix, it leads to EntityField functions, the builder thing that set an entity field with that prefix.
(for OP's information) This one wasn't obvious, that prefix business is just a thing that we do a few times throughout the code.

We still want that return because we still want the option to hide the bullets.

But there's some side issues in singleplayer. I tried to test, it appears the EntityFireBullets hook is ineffective. But it's fine with local server and p2p setups for some reason... oh well!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@unknao can you revert this change?

end)

--for regaining focus on cameras from first person, hacky thing to not loop through localparts every time
Expand Down
Loading