mirror of
https://github.com/JonnyBro/beatrun.git
synced 2024-12-29 05:13:02 +05:00
Merge pull request #7 from jeffthekillerz/master
This commit is contained in:
commit
019aa24125
1 changed files with 30 additions and 10 deletions
|
@ -302,9 +302,10 @@ end)
|
||||||
|
|
||||||
hook.Add("ShouldCollide", "NoPlayerCollisions", function(ent1, ent2)
|
hook.Add("ShouldCollide", "NoPlayerCollisions", function(ent1, ent2)
|
||||||
if ent1:IsPlayer() and (ent2:IsPlayer() or ent2.NoPlayerCollisions) then
|
if ent1:IsPlayer() and (ent2:IsPlayer() or ent2.NoPlayerCollisions) then
|
||||||
if ent2.BRCollisionFunc then return ent2:BRCollisionFunc(ent1)
|
if ent2.BRCollisionFunc then
|
||||||
|
return ent2:BRCollisionFunc(ent1)
|
||||||
else
|
else
|
||||||
if ent1.br_Fired or ent2.br_Fired then return true end
|
if (ent1.br_Fired and ent2.br_FiredBy == ent1) or (ent2.br_Fired and ent1.br_FiredBy == ent2) then return true end
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
@ -313,15 +314,34 @@ hook.Add("ShouldCollide", "NoPlayerCollisions", function(ent1, ent2)
|
||||||
if ent2:IsPlayer() and ent1:IsNPC() then return true end
|
if ent2:IsPlayer() and ent1:IsNPC() then return true end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- i was forced
|
local function calc_fov(src, dst)
|
||||||
hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data)
|
local v_src = src:Forward()
|
||||||
ent.br_Fired = true
|
local v_dst = dst:Forward()
|
||||||
|
|
||||||
timer.Simple(engine.TickInterval() * 2, function()
|
local result = math.deg(math.acos(v_dst:Dot(v_src) / v_dst:Length()))
|
||||||
if IsValid(ent) then
|
|
||||||
ent.br_Fired = false
|
if result != result or (result == math.huge or result == -math.huge) then
|
||||||
end
|
result = 0
|
||||||
end)
|
end
|
||||||
|
|
||||||
|
return result
|
||||||
|
end
|
||||||
|
|
||||||
|
// i was forced
|
||||||
|
hook.Add("EntityFireBullets", "thisengineismadebyacrackhead", function(ent, data)
|
||||||
|
if not IsValid(ent) or not isfunction(ent.GetShootPos) or not ent:IsPlayer() then return end
|
||||||
|
|
||||||
|
for i, ply in ipairs(player.GetAll()) do
|
||||||
|
if ply == ent then continue end
|
||||||
|
local fov = calc_fov(data.Dir:Angle(), (ply:GetShootPos() - data.Src):Angle())
|
||||||
|
if fov > 60 then continue end
|
||||||
|
|
||||||
|
ply.br_FiredBy = ent
|
||||||
|
timer.Simple(engine.TickInterval()*3, function() if IsValid(ply) then ply.br_FiredBy = nil end end)
|
||||||
|
end
|
||||||
|
|
||||||
|
ent.br_Fired = true
|
||||||
|
timer.Simple(engine.TickInterval()*3, function() if IsValid(ent) then ent.br_Fired = false end end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
hook.Add("PhysgunPickup", "AllowPlayerPickup", function(ply, ent)
|
hook.Add("PhysgunPickup", "AllowPlayerPickup", function(ply, ent)
|
||||||
|
|
Loading…
Reference in a new issue