I’m sure there’s a straightforward answer to this problem, but I haven’t the tiniest clue.
I’m making a portable module for my gamemode which, among other things, modifies the direction of a bullet via EntityFireBullets in shared space, via the following code:
hook.Add("EntityFireBullets", "ThirdPersonBulletDir", function(ply, data) if !IsValid(ply) or !ply:IsPlayer() or !ply:IsThirdPerson() then return end data.Dir = (CalculateBulletDirTP(ply, false) - ply:GetShootPos()):GetNormal() return true end)
That’s all well and good. However, elsewhere, on serverside only, I have the following code:
hook.Add("EntityFireBullets", "NextBotHeadHitGroup", function(ent, data) local defaultCallback = data.Callback data.Callback = function(ply, tr, dmg) defaultCallback(ply, tr, dmg) if tr.Entity:IsNextBot() then tr.Entity:SetLastHitGroup(tr.HitGroup) end end return true end)
Now my problem is that the NextBotHeadHitGroup hook function returns true, stopping the thirdperson hook from even being called on the server. Is there anyway to make it so that this is not the case, and both can override the bullet? I came up with the solution of removing return true from both and returning true in the gamemode GM:EntityFireBullets function, which worked, but I’d like the thirdperson code to function / override regardless of any other hook, as I want it to be loadable into other gamemodes. Any ideas?