Skip to content

Commit

Permalink
Implement TouchTest, StartTouch, EndTouch inputs for triggers
Browse files Browse the repository at this point in the history
  • Loading branch information
ZehMatt authored and knoxed committed Jul 21, 2024
1 parent 3fc2362 commit 13ce8a6
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions entities/entities/lambda_trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,14 @@ if SERVER then
self:SetupOutput("OnStartTouchAll")
self:SetupOutput("OnEndTouch")
self:SetupOutput("OnEndTouchAll")
self:SetupOutput("OnTouching")
self:SetupOutput("OnNotTouching")
self:SetInputFunction("Enable", self.Enable)
self:SetInputFunction("Disable", self.Disable)
self:SetInputFunction("Toggle", self.Toggle)
self:SetInputFunction("TouchTest", self.TouchTest)
self:SetInputFunction("StartTouch", self.InputStartTouch)
self:SetInputFunction("EndTouch", self.InputEndTouch)

self:SetupNWVar("Disabled", "bool", {
Default = false,
Expand Down Expand Up @@ -318,6 +323,27 @@ if SERVER then
end
end

function ENT:TouchTest()
print(self, "ENT:TouchTest")
if table.Count(self.TouchingObjects) == 0 then
self:FireOutputs("OnNotTouching", nil, nil)
else
self:FireOutputs("OnTouching", nil, nil)
end
end

function ENT:InputStartTouch(data, activator, caller)
print(self, "ENT:InputStartTouch")
if not IsValid(caller) then return end
self:StartTouch(caller)
end

function ENT:InputEndTouch(data, activator, caller)
print(self, "ENT:InputEndTouch")
if not IsValid(caller) then return end
self:EndTouch(caller)
end

function ENT:GetTimeout()
local timeout = self:GetNWVar("Timeout", 0)
if timeout ~= 0 then return timeout end
Expand Down

0 comments on commit 13ce8a6

Please sign in to comment.