wiremod / wire-extras

Community Contributed Wire Extras Repository (formerly UWSVN). These are addons which may be of use to wiremodders but do not undergo the same level of critique that the official repos do.
Apache License 2.0
83 stars 66 forks source link

Overall optimization (it should work without testing but testing would be better) #101

Closed EdoTM closed 3 years ago

EdoTM commented 3 years ago

Overall optimization:

I didn't actually edit anything else other than these things.

TomyLobo commented 3 years ago

Well anyone can replace one function call with another, so just to be sure you understand what you're doing, describe what SetNetworkedBeamString is.

thegrb93 commented 3 years ago

SetNetworkedBeamString are just wire's implementation of SetNWString that was removed a long time ago.

EdoTM commented 3 years ago

Networked Beams were an attempt to optimize the data flow between server and client when treating large data (there's also a description here, a more-than-10-years-old file) but they eventually got removed (along with the NW Beam library) by AbigailBuccaneer in 2015. Some wire extras items (such as doors and door controllers) still use these, and they do generate errors when you try to use them (actually, in some cases you can't use them due to these errors).

A fix would be changing SetNetworkedBeamString to SetNWString, as it has already been done in #74. I personally tried doors and door controllers, and with this fix they work smoothly without a single error.

thegrb93 commented 3 years ago

I'll have time to review tomorrow.

TomyLobo commented 3 years ago

@thegrb93 You do realize, that if you give any kind of hint on what beams are, that kinda defeats the point of that test :) @EdoTM passed with flying colors, though :)

thegrb93 commented 3 years ago

Oh, thought you were asking rather than testing

EdoTM commented 3 years ago

I'm now removing unused net.Write*/Read*, and I noticed that in wire_modular_panel.lua there's a strange behavior in usermessages and servermessages. On line 325 of the file that is currently on the repository, a usermessage named smsgModularPanel is initialized (the name is the same of the servermessage defined on line 204. They are correlated, but I don't know if the fact of them having an identical name is actually intentional), but there's no usermessage.Hook("smsgModularPanel", ...) or umsgModularPanel in any file, i.e. there's no clientside hook called smsgModularPanel from line 325. Am I missing something?

Edit: I've noticed that there are several problems with Modular Panels already (#63, #97) so maybe we can skip wire_modular_panel.lua and leave its implementation to #97.

thegrb93 commented 3 years ago

Looks like a 1 to 1 conversion and looks fine. If you wouldn't mind just cleaning up the unneeded comments and revert the GetConVar change, it will be perfect.

EdoTM commented 3 years ago

Removed unnecessary comments and reverted GetConVar(...):GetInt() with GetConVarNumber(...)

thegrb93 commented 3 years ago

Thanks. Looks good