I know we’ve had a thread about this a little but ago, but we never got a good solution, so I’ll try to clear things up as I’m having the same problem.

I have a map with func_door entities in it (entities are put in by the map creator in SDK) and I want them not to activate when they are touched.

This has not worked for me :

local EntitySTouch = _R.Entity.StartTouch
local EntityTouch = _R.Entity.Touch

function _R.Entity:StartTouch()
return (self:GetClass() != “func_door” and EntitySTouch(self)) or true

function _R.Entity:Touch()
return (self:GetClass() != “func_door” and EntityTouch(self)) or true

Here, I confirm it is a func_door, first getting my looking ent while looking at the world, then when looking at the func_door entity:

Does anyone have any ideas?

So you want to lock the door? Or do you just not want it to be responsive at all?

[editline] in the future [/editline]
Does touch just refer to something literally touching the entity, or using it? I mean, I’ve never seen doors responding to an entity merely touching them which is why this is confusing me.

I want to do this:

hook.Add(“InitPostEntity”, “platformlock”, function()
for _,v in pairs(ents.FindByClass(“func_door”)) do
v:Fire(“lock”, “”)

Except I want to override the Touch functions.

Also, I think Touch refers to when a player Collides with an ENT in forms of collision or standing on it.

try this.
put this function in a lua file name it denyfuncdoor.lua or something.
and put it in lua/autorun i think.

function KeyPressedUse (ply, key)
if key == IN_USE then
local t = {}
t.start = ply:GetPos()
t.endpos = ply:GetShootPos() + ply:GetAimVector() * 100
t.filter = ply
local trace = util.TraceLine(t)
if trace.Entity and trace.Entity:IsValid() and (trace.Entity:GetClass() == “func_door” ) then
hook.Add( “KeyPress”, “KeyPressedUse”, KeyPressedUse )