• func_door
    3 replies, posted
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 : [lua] local EntitySTouch = _R.Entity.StartTouch local EntityTouch = _R.Entity.Touch function _R.Entity:StartTouch() return (self:GetClass() != "func_door" and EntitySTouch(self)) or true end function _R.Entity:Touch() return (self:GetClass() != "func_door" and EntityTouch(self)) or true end [/lua] 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: [img]http://puu.sh/e34r[/img] 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.
[QUOTE=wizardsbane;34315758]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.[/QUOTE] I want to do this: [lua] hook.Add("InitPostEntity", "platformlock", function() for _,v in pairs(ents.FindByClass("func_door")) do v:Fire("lock", "") end end) [/lua] 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. [lua] 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 trace.Entity:Fire("lock") end end end hook.Add( "KeyPress", "KeyPressedUse", KeyPressedUse ) [/lua]
Sorry, you need to Log In to post a reply to this thread.