mirror of
https://github.com/wiremod/wire.git
synced 2025-03-04 03:03:04 -05:00
Micro-optimization for E2Lib.IsOwner (#3162)
Remove the singleplayer check and just define the function right away
This commit is contained in:
parent
185717464f
commit
6f7f2c8e53
@ -466,12 +466,17 @@ function E2Lib.isFriend(owner, player)
|
||||
return owner == player
|
||||
end
|
||||
|
||||
function E2Lib.isOwner(self, entity)
|
||||
if game.SinglePlayer() then return true end
|
||||
local owner = E2Lib.getOwner(self, entity)
|
||||
if not IsValid(owner) then return false end
|
||||
|
||||
return E2Lib.isFriend(owner, self.player)
|
||||
if game.SinglePlayer() then
|
||||
function E2Lib.isOwner(self, entity)
|
||||
return true
|
||||
end
|
||||
else
|
||||
function E2Lib.isOwner(self, entity)
|
||||
local owner = E2Lib.getOwner(self, entity)
|
||||
if not IsValid(owner) then return false end
|
||||
|
||||
return E2Lib.isFriend(owner, self.player)
|
||||
end
|
||||
end
|
||||
|
||||
local isOwner = E2Lib.isOwner
|
||||
|
Loading…
Reference in New Issue
Block a user