Simplify wrap

This commit is contained in:
Brandon Sturgeon 2022-01-13 11:26:05 -08:00
parent f6a6a05f1b
commit 14b048550f

View File

@ -21,23 +21,12 @@ hook.Add "InitPostEntity", "ChatTransit_WrapUlxLog", ->
-- If second param is a string, then it's safe to send to everyone
return ulx._fancyLogAdmin(...) unless isstring args[2]
-- fancyLogAdmin only checks 'IsDedicated' when it's ready to make its final print
game._IsDedicated or= game.IsDedicated
game.IsDedicated = ->
game.IsDedicated = game._IsDedicated
-- When we're sure it's ready to print, we'll capture the next Msg call and use it for our webhook
_G["_Msg"] or= Msg
Msg = (msg) ->
_G.Msg = _G._Msg
Msg msg
ChatTransit\ReceiveULXAction msg
return game.IsDedicated!
_G["_Msg"] or= Msg
Msg = (msg) ->
_G.Msg = _G._Msg
Msg msg
ChatTransit\ReceiveULXAction msg
ulx._fancyLogAdmin ...
-- In case it didn't run as expected, return the wrapped functions to normal so we don't print something unrelated
game.IsDedicated = game._IsDedicated if game._IsDedicated
Msg = _G["_Msg"] if _G["_Msg"]