|
if CLIENT or not trace2.Entity:IsValid() or not WireLib.CanTool(self:GetOwner(), trace2.Entity, "wire_hydraulic") then return false end |
The tool only checks if the entity at the end is valid, without checking the validity of entity at the start of the trace.
This causes the tool to stop working if you aim at the entity and the other side happens to be the world itself.
Strangely, if the world is at the start of the trace, but the entity is at the end, the tool will create the hydraulic at the trace location.
The code at the linked line has to be changed to
if CLIENT or (not trace.Entity:IsValid() and not trace2.Entity:IsValid()) or not WireLib.CanTool(self:GetOwner(), trace2.Entity, "wire_hydraulic") then return false end
, so entities at both sides are checked.
wire/lua/wire/stools/hydraulic.lua
Line 181 in 082523d
The tool only checks if the entity at the end is valid, without checking the validity of entity at the start of the trace.
This causes the tool to stop working if you aim at the entity and the other side happens to be the world itself.
Strangely, if the world is at the start of the trace, but the entity is at the end, the tool will create the hydraulic at the trace location.
The code at the linked line has to be changed to
, so entities at both sides are checked.