Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lua/entities/gmod_wire_trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ function ENT:Initialize()
self:SetSolid( SOLID_VPHYSICS )
local phys = self:GetPhysicsObject() if (phys:IsValid()) then phys:Wake() end

self.Outputs = WireLib.CreateOutputs(self, { "EntCount", "Entities [ARRAY]" })
self.Outputs = WireLib.CreateOutputs(self, {
"EntCount",
"Entities [ARRAY]",
"Entered (Entity that entered the trigger entity bounds last) [ENTITY]",
"Exited (Entity that left the trigger entity bounds last) [ENTITY]"
})
end

function ENT:Setup( model, filter, owneronly, sizex, sizey, sizez, offsetx, offsety, offsetz )
Expand Down
4 changes: 4 additions & 0 deletions lua/entities/gmod_wire_trigger_entity.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ function ENT:Reset()
if not IsValid( owner ) then return end
WireLib.TriggerOutput( owner, "EntCount", 0 )
WireLib.TriggerOutput( owner, "Entities", self.EntsInside )
WireLib.TriggerOutput( owner, "Entered", NULL )
WireLib.TriggerOutput( owner, "Exited", NULL )
end

function ENT:StartTouch( ent )
Expand All @@ -40,6 +42,7 @@ function ENT:StartTouch( ent )

WireLib.TriggerOutput( owner, "EntCount", #self.EntsInside )
WireLib.TriggerOutput( owner, "Entities", self.EntsInside )
WireLib.TriggerOutput( owner, "Entered", ent, nil, true )

end
function ENT:EndTouch( ent )
Expand All @@ -55,5 +58,6 @@ function ENT:EndTouch( ent )

WireLib.TriggerOutput( owner, "EntCount", #self.EntsInside )
WireLib.TriggerOutput( owner, "Entities", self.EntsInside )
WireLib.TriggerOutput( owner, "Exited", ent, nil, true )

end
4 changes: 2 additions & 2 deletions lua/wire/server/wirelib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ local function Wire_Link(dst, dstid, src, srcid, path)
WireLib.TriggerInput(dst, dstid, output.Value)
end

function WireLib.TriggerOutput(ent, oname, value, iter)
function WireLib.TriggerOutput(ent, oname, value, iter, force)
if not entIsValid(ent) then return end
if not HasPorts(ent) then return end

Expand All @@ -599,7 +599,7 @@ function WireLib.TriggerOutput(ent, oname, value, iter)
value = ty.Zero()
end

if value ~= output.Value or output.Type == "ARRAY" or output.Type == "TABLE" or (output.Type == "ENTITY" and not rawequal(value, output.Value) --[[Covers the NULL==NULL case]]) then
if value ~= output.Value or output.Type == "ARRAY" or output.Type == "TABLE" or (output.Type == "ENTITY" and not rawequal(value, output.Value) --[[Covers the NULL==NULL case]]) or force then
local timeOfFrame = CurTime()
if timeOfFrame ~= output.TriggerTime then
-- Reset the TriggerLimit every frame
Expand Down
2 changes: 1 addition & 1 deletion lua/wire/stools/trigger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ function TOOL:GetConVars()
end

local function DrawTriggerOutlines( list )
cam.Start3D( LocalPlayer():EyePos(), LocalPlayer():EyeAngles() )
cam.Start3D( EyePos(), EyeAngles() )
for k,ent in pairs( list ) do
local trig = ent:GetTriggerEntity()

Expand Down
Loading