Skip to content

Commit

Permalink
add E2 to :hasInstance() (#1837)
Browse files Browse the repository at this point in the history
* add E2 to :hasInstance()

* return false if neither sf or e2
  • Loading branch information
ax255 authored and thegrb93 committed Aug 28, 2024
1 parent a2535e4 commit 9d9599c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lua/starfall/libs_sh/entities.lua
Original file line number Diff line number Diff line change
Expand Up @@ -951,12 +951,19 @@ function ents_methods:getQuotaMax()
end
end

--- Return if the entity has a starfall instance
--- Return if the entity has a starfall instance or E2 instance
-- @shared
-- @return boolean if has starfall instance
-- @return boolean if has starfall instance or E2 instance
function ents_methods:hasInstance()
local ent = getent(self)
return ent.Starfall and ent.instance~=nil

if ent.Starfall then
return ent.instance~=nil
elseif ent:GetClass()=="gmod_wire_expression2" then
return SERVER and not ent.error
end

return false
end

if SERVER then
Expand Down

0 comments on commit 9d9599c

Please sign in to comment.