Merge pull request #45 from BClark09/master

Added cases for func_physbox_multiplayer
This commit is contained in:
William Moodhe / JetBoom 2014-11-27 10:52:56 -05:00
commit 5b96000830
2 changed files with 4 additions and 4 deletions

View file

@ -157,8 +157,8 @@ function GM:TryHumanPickup(pl, entity)
if self.ZombieEscape or pl.NoObjectPickup then return end if self.ZombieEscape or pl.NoObjectPickup then return end
if entity:IsValid() and not entity.m_NoPickup then if entity:IsValid() and not entity.m_NoPickup then
local entclass = entity:GetClass() local entclass = string.sub(entity:GetClass(), 1, 12)
if (string.sub(entclass, 1, 12) == "prop_physics" or entclass == "func_physbox" or entity.HumanHoldable and entity:HumanHoldable(pl)) and pl:Team() == TEAM_HUMAN and not entity:IsNailed() and pl:Alive() and entity:GetMoveType() == MOVETYPE_VPHYSICS and entity:GetPhysicsObject():IsValid() and entity:GetPhysicsObject():GetMass() <= CARRY_MAXIMUM_MASS and entity:GetPhysicsObject():IsMoveable() and entity:OBBMins():Length() + entity:OBBMaxs():Length() <= CARRY_MAXIMUM_VOLUME then if (entclass == "prop_physics" or entclass == "func_physbox" or entity.HumanHoldable and entity:HumanHoldable(pl)) and pl:Team() == TEAM_HUMAN and not entity:IsNailed() and pl:Alive() and entity:GetMoveType() == MOVETYPE_VPHYSICS and entity:GetPhysicsObject():IsValid() and entity:GetPhysicsObject():GetMass() <= CARRY_MAXIMUM_MASS and entity:GetPhysicsObject():IsMoveable() and entity:OBBMins():Length() + entity:OBBMaxs():Length() <= CARRY_MAXIMUM_VOLUME then
local holder, status = entity:GetHolder() local holder, status = entity:GetHolder()
if not holder and not pl:IsHolding() and CurTime() >= (pl.NextHold or 0) if not holder and not pl:IsHolding() and CurTime() >= (pl.NextHold or 0)
and pl:GetShootPos():Distance(entity:NearestPoint(pl:GetShootPos())) <= 64 and pl:GetGroundEntity() ~= entity then and pl:GetShootPos():Distance(entity:NearestPoint(pl:GetShootPos())) <= 64 and pl:GetGroundEntity() ~= entity then
@ -2396,7 +2396,7 @@ function GM:EntityTakeDamage(ent, dmginfo)
end end
end end
end end
elseif entclass == "func_physbox" then elseif string.sub(entclass, 1, 12) == "func_physbox" then
local holder, status = ent:GetHolder() local holder, status = ent:GetHolder()
if holder then status:Remove() end if holder then status:Remove() end

View file

@ -250,7 +250,7 @@ end
meta.OldSetPhysicsAttacker = meta.SetPhysicsAttacker meta.OldSetPhysicsAttacker = meta.SetPhysicsAttacker
function meta:SetPhysicsAttacker(ent) function meta:SetPhysicsAttacker(ent)
if self:GetClass() == "func_physbox" and ent:IsValid() then if string.sub(self:GetClass(), 1, 12) == "func_physbox" and ent:IsValid() then
self.PBAttacker = ent self.PBAttacker = ent
self.NPBAttacker = CurTime() + 1 self.NPBAttacker = CurTime() + 1
end end