-
Notifications
You must be signed in to change notification settings - Fork 333
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
Rewrite to EGPLib objectcontrol.lua
#3038
Conversation
Rewrote EGPLib init Moved EGP to a subtable of E2Lib(?) Modified E2Lib init to merge any preexisting value
The hasObject postInit setting is really cumbersome. Just use EGP.HasObject instead of localizing it, or define it before including those files. |
There's a bit of overlap in all of the libraries so it's going to be more than just |
Hopefully this is a decent compromise. Same thing just more permissive. |
Conflicts |
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 0d75e21 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
gmod_wire_egp/lib/init.lua
EGP
a subtable ofE2Lib
to avoid global pollution.EGP
still exists for backwards compatibility and will be removed once everything is done.EGP.HookPostInit
function as a simple postinit handlergmod_wire_egp/lib/egplib/objectcontrol.lua
objects.lua
objects
). Numerical indices track IDs while string keys track object names. Greatly simplifies getter logic.EGP.GetObjectByID
EGPObject
base and metatable.IsValid
metatable method.EGPObject
type.EGP
for future use.baseObj.EditObject
when they should be calling their ownself.EditObject
to initialize instead.baseObj.Set
to callSetObject
if a position key is foundbaseObj
initialization to a single table initializerNULL_EGPOBJECT
to be anEGPObject
object instead of its own specialized metatableEGP.IsEGPObject
EGP.NewObject
to fit new APIEGP.InheritObject
EGP.EditObject
EGP.HasObject
EGP.SetOrder
EGP.PerformReorder
EGP.PerformReorder_Ex
EGP.CreateObject
->EGP.Create
Entity, string|integer, table
tostring|integer, table, Entity
gmod_wire_expression2/core/egpfunctions.lua
EGP.HasObject
with localized versionEGP.CreateObject
with updated, localized versionself.player
argumentEGP.EditObject
with EGP Object methodgmod_wire_expression2/core/egpobjects.lua
EGPObject.IsValid
for validity checkingEGP.HasObject
with localized versionEGP.CreateObject
with updated, localized versionself.player
argumentEGP.EditObject
with EGP Object methodremove
e2functions to not change metatableAll other changes were too small/insignificant and mostly involve changing/replacing usage of a few functions.