wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
553 stars 332 forks source link

Add Expression2Reloaded hook and use it to reload CPPI wrap #3064

Closed wrefgtzweve closed 4 months ago

wrefgtzweve commented 4 months ago

Fixes https://github.com/wiremod/wire/issues/3055

Denneisk commented 4 months ago

I feel like there's a more graceful alternative to this. Maybe just check a global to allow this behavior.

wrefgtzweve commented 4 months ago

It needs to be done in some kind of callback, having a hook that runs when e2 is reloaded carries no downsides, could even be useful for other addons if they do function wraps. There is no good way to detect e2 reloads right now.

Denneisk commented 4 months ago

That's a fair reason, but it still bugs me that this code is stored in a hook when ideally it shouldn't have to redefine the function twice in the same tick.