Skip to content

Commit

Permalink
Added logic to support pumps with E2 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
KieranFYI authored Mar 18, 2024
1 parent 7a2fe92 commit 89e7bf4
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lua/entities/gmod_wire_expression2/core/custom/lifesupport.lua
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,13 @@ e2function number entity:lsLink(entity node)
if canToolThis and canToolNode then
local distance = this:GetPos():Distance(node:GetPos())
if distance <= node.range then
local netid = ls_get_ent_netid(node)
RD.Link(this, netid)
if this.IsPump then
this:SetNetwork(node.netid)
this.node = node
else
local netid = ls_get_ent_netid(node)
RD.Link(this, netid)
end
return 1
end
end
Expand All @@ -269,7 +274,13 @@ e2function number entity:lsUnlink()

local canTool = this:CPPICanTool(self.player, "toolgun") and 1 or 0
if canTool then
RD.Unlink(this)
if this.IsPump then
this.node = nil
this:SetNetwork(0)
RD.Beam_clear(this)
else
RD.Unlink(this)
end
return 1
end
return 0
Expand Down

0 comments on commit 89e7bf4

Please sign in to comment.