Team specific denial brush as SENT

I’m working on making some maps from a SourceMod work with GMod, and they come with team based area denial brushes, similar to the ones in TF2.

Anyone know how to go about writing the SENT for one?

My first thought was to use Touch to check the player’s team, then change the ent’s mask, but seems clunky.

I heard there was a hook called ShouldCollide.

Then again I also heard that it was buggy as hell so, you know, take it with a grain of salt.

ShouldCollide is buggy if you toggle collision inside of the hook. If you bind it to static values, or things that rarely change you’re for the most part ok.

I bound my nocollides to move-type noclip or invisibility ( which can be toggled so it requires IsAdmin too although I may simply change it to IsAdmin only because IsAdmin can be bound to character, or toggled depending on the game-mode ) and I have yet to have an issue and I put it through stress tests.

Reading up on ShouldCollide sounds buggy without even trying it.
Seems to me that the brush would stop anything from denied players, but not from allowed ones.
Including bullets.

Well, now I know how to do one-way kill boxes. lol

But seriously, there’s got to be an easier way to do this.
I look through TF2’s fgd to see if it had any key values that would point me in the right direction, but nothing.

Know of any better ways to get entity data from source and sourcemod games?

In a perfect world, you’d just use

Entity:SetTrigger on a brush and control it that way, but that doesn’t appear to work anymore.

Alright, so I know this is late as hell, but I just got back into working on this project and finally figured this out.
Posting the SENT code here for anyone else having this problem.


ENT.Base = "base_brush"
ENT.Type = "brush"

function ENT:Initialize()
	self:SetCustomCollisionCheck( true )
	self:SetTrigger( true )
	self:SetNotSolid( false )
end

function ENT:KeyValue( key, value )
	if key == "denyteam" then
		self.DenyTeam = tonumber( value )
	end
end

hook.Add("ShouldCollide", "DenyTeamArea", function( ent1, ent2 )
	if ent1:GetClass() == "brush_deny" and ent2:GetClass() == "player" then
		if ent2:Team() != ent1.DenyTeam then
			return false
		else
			return true
		end
	end
	if ent2:GetClass() == "brush_deny" and ent1:GetClass() == "player" then
		if ent1:Team() != ent2.DenyTeam then
			return false
		else
			return true
		end
	end
end)

Thanks again for the help, and sorry for the necro. :boxhide: