Skip to content

Commit

Permalink
Use world instead of false for server errors
Browse files Browse the repository at this point in the history
  • Loading branch information
thegrb93 committed Aug 21, 2024
1 parent 2dac509 commit eb43241
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lua/entities/starfall_processor/cl_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ hook.Add("StarfallError", "StarfallErrorReport", function(_, owner, client, main
if not IsValid(owner) then return end
local local_player = LocalPlayer()
if owner == local_player then
if not client or client == owner then
if client:IsWorld() or client == owner then
SF.AddNotify(owner, message, "ERROR", 7, "ERROR1")
elseif client then
if should_notify then
Expand Down
2 changes: 1 addition & 1 deletion lua/entities/starfall_processor/shared.lua
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function ENT:Error(err)
self:SetColor(Color(255, 0, 0, 255))
end

hook.Run("StarfallError", self, self.owner, CLIENT and LocalPlayer() or false, self.sfdata and self.sfdata.mainfile or "", msg, traceback)
hook.Run("StarfallError", self, self.owner, CLIENT and LocalPlayer() or Entity(0), self.sfdata and self.sfdata.mainfile or "", msg, traceback)
SF.SendError(self, msg, traceback)
end

Expand Down
2 changes: 1 addition & 1 deletion lua/starfall/libs_sh/hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ add("Tick")
-- @param Player|Entity ply Who's fault it errored. World-entity if it was a server error, or player that the script errored if on client
-- @param string err Error message
add("StarfallError", nil, function(instance, ent, owner, errply, _, err)
return true, {instance.WrapObject(ent), instance.WrapObject(errply or Entity(0)), err}
return true, {instance.WrapObject(ent), instance.WrapObject(errply), err}
end)

-- Game Events
Expand Down
1 change: 0 additions & 1 deletion lua/starfall/transfer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ else
callback = callback - 1
if callback>0 then return end
if chip and owner and client then
if client:IsWorld() then client = nil end
hook.Run("StarfallError", chip, owner, client, mainfile, message, traceback, should_notify)
end
end
Expand Down

0 comments on commit eb43241

Please sign in to comment.