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
547 stars 332 forks source link

Rewrite to EGPLib `objectcontrol.lua` #3038

Closed Denneisk closed 3 months ago

Denneisk commented 3 months ago

Tidies up things and adds comments everywhere for good measure. Part one of an eventual refactor of EGP library entirely. (Is it really a refactor with this many API changes?)

Although I renamed the file, GH will not tolerate it, so sorry, I just felt like objectcontrol.lua was an outdated name. I can't be the only one, right? You can observe https://github.com/wiremod/wire/commit/0d75e21f63229e71a0e41cecf10aba06a44c24ec for most of the diff, or view the diff on your own. For your convenience, I've exported the diff for you here. If you see a problem, check the later commits in case they're fixed.

Certain method calls were changed to function calls preceded with nil. This was just an oversight thinking certain functions were not methods, and now it just serves as a memory aid that they're not actual methods.

Asking for testers

Noteworthy changes by file:

gmod_wire_expression2/core/e2lib.lua


All other changes were too small/insignificant and mostly involve changing/replacing usage of a few functions.

thegrb93 commented 3 months ago

The hasObject postInit setting is really cumbersome. Just use EGP.HasObject instead of localizing it, or define it before including those files.

Denneisk commented 3 months ago

There's a bit of overlap in all of the libraries so it's going to be more than just hasObject, and I'd prefer to keep EGP.HasObject localized because (especially right now) it's extremely expensive and common. I could change it to use an array defined in EGP or just use a hook I guess. I'll agree that scrolling to the bottom of the code to see if you defined something is pretty bad.

Denneisk commented 3 months ago

Hopefully this is a decent compromise. Same thing just more permissive.

thegrb93 commented 3 months ago

Conflicts