From 13ce8a66ac6695a38c7702816b80ea9cce60acff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 20 Jul 2024 18:23:10 +0300 Subject: [PATCH] Implement TouchTest, StartTouch, EndTouch inputs for triggers --- entities/entities/lambda_trigger.lua | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/entities/entities/lambda_trigger.lua b/entities/entities/lambda_trigger.lua index 10e44210..d2cf6895 100644 --- a/entities/entities/lambda_trigger.lua +++ b/entities/entities/lambda_trigger.lua @@ -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, @@ -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