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

Let ragdolls pass through forcefield if disabled #44

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
60 changes: 36 additions & 24 deletions entities/entities/ix_forcefield.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,31 +184,43 @@ if (SERVER) then
end

hook.Add("ShouldCollide", "ix_forcefields", function(a, b)
local client
local client
local entity

if (a:IsPlayer()) then
client = a
entity = b
elseif (b:IsPlayer()) then
client = b
entity = a
end

if (IsValid(entity) and entity:GetClass() == "ix_forcefield") then
if (IsValid(client)) then
if (client:IsCombine() or client:Team() == FACTION_ADMIN) then
return false
end

local mode = entity:GetMode() or 1

return istable(MODES[mode]) and MODES[mode][1](client)
else
return entity:GetMode() != 4
end
end
end)
local ragdoll

if (a:IsPlayer()) then
client = a
entity = b
elseif (b:IsPlayer()) then
client = b
entity = a
elseif (a:IsRagdoll()) then
ragdoll = a
entity = b
elseif (b:IsRagdoll()) then
ragdoll = b
entity = a
end

if (IsValid(entity) and entity:GetClass() == "ix_forcefield") then
if (IsValid(ragdoll)) then
if (entity:GetMode() == 1) then
return false
end
end
if (IsValid(client)) then
if (client:IsCombine() or client:Team() == FACTION_ADMIN) then
return false
end

local mode = entity:GetMode() or 1

return istable(MODES[mode]) and MODES[mode][1](client)
else
return entity:GetMode() != 4
end
end
end)
else
local SHIELD_MATERIAL = ix.util.GetMaterial("effects/combineshield/comshieldwall3")

Expand Down