Skip to content

Commit

Permalink
Add Expression2Reloaded hook and use it to reload CPPI wrap (#3064)
Browse files Browse the repository at this point in the history
* Add Expression2Reloaded hook and use it to reload CPPI wrap

* Use tabs
  • Loading branch information
wrefgtzweve authored May 16, 2024
1 parent 3ca8282 commit e88e317
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lua/entities/gmod_wire_expression2/core/e2lib.lua
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ for funcname, _ in pairs(makeglobal) do
_G[funcname] = E2Lib[funcname]
end

hook.Add("InitPostEntity", "e2lib", function()
local function e2libDelayedSetup()
-- If changed, put them into the global scope again.
registerCallback("e2lib_replace_function", function(funcname, func, oldfunc)
if makeglobal[funcname] then
Expand Down Expand Up @@ -950,7 +950,10 @@ hook.Add("InitPostEntity", "e2lib", function()
end)
end
end
end)
end

hook.Add("Expression2Reloaded", "wire_expression2_e2lib", e2libDelayedSetup)
hook.Add("InitPostEntity", "wire_expression2_e2lib", e2libDelayedSetup)

--- Valid file extensions kept to avoid trying to make files with extensions gmod doesn't allow.
-- https://wiki.facepunch.com/gmod/file.Write
Expand Down
2 changes: 2 additions & 0 deletions lua/entities/gmod_wire_expression2/core/extloader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ if ENT then
end

_Msg( "Done reloading Expression 2 extensions." )

hook.Run("Expression2Reloaded")
end

concommand.Add( "wire_expression2_reload", wire_expression2_reload )
Expand Down

0 comments on commit e88e317

Please sign in to comment.