Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make starfall error hook use 'world' for server errors #1833

Merged
merged 2 commits into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions lua/starfall/libs_sh/hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,10 @@ add("Tick")
-- @class hook
-- @shared
-- @param Entity ent Starfall chip that errored
-- @param Player ply Who's fault it errored. Owner of the chip if on server, or player that the script errored if on client
-- @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 owner), 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
Loading