Wire: E2: Add "Namer" functionality

Created on 23 Apr 2017  Â·  14Comments  Â·  Source: wiremod/wire

There is somewhat "funny" tool I find in Wire, it is called "Namer" (in Tools category).
So, I thought why not allow E2 to use this functionality?
Perhaps I could add it myself. Does anyone care about it?
If so, I suggest to simply add an overload for the existing function setName(string) to accept an additional argument (number) to specify whether to set the standard E2 "name" or the component name instead (Namer functionality).
Edit: Ignore my silly suggestion above, I will just create new functions, I'll call them [g|s]etComponentName.

All 14 comments

Initially, I thought to myself, well what's the purpose of adding this. But after thinking about it for a while, I guess it would be kinda nice to have a getter and setter for this.

Alright, I am on it. Will also add getter function..

But, I have a question here about implementation. I see there is no limit to how long Wire Namer can set component name. So, how about I limit it to 512 characters (and no new lines and such)? I think 512 is more than enough for component name.

WireName uses SetNWString, which going off what the wiki says is limited to 199 characters (wtf kind of number is that garry).

Alright, then we let the GMod handle the length.
What about special characters such as double-quote, new-line, etc?
From what I read in the Namer tool source code, there is literally no validation. However, it does something behind the scenes, CPanel builds a TextBox control which is single-line only, and also double-quotes are replaced with a single-quote. If it didn't do this, then the ConCommand code could be exploited.
Edit: I guess I will just run string.find to see if it contains [\n\r\"], if it does, it would exit the function.

Closing this because we now have the PR

@Divran Why do this?! The issue should not be closed until the PR is merged, and also GitHub would have automatically closed this issue because I have included Fixes #1365 in the PR title.
Learn how to GitHub, Divran.

@CaptainPRICE Is there actually a solid use-case for this, or is it a "just because" kind of thing?

@AbigailBuccaneer Actually it is both. There are solid use-cases for those functions, but it is also "just because" kind of thing..
I have mentioned it a few times already in #1366 (and discord)..

I've seen you mention that you could hypothetically implement a remote communication system between E2s (which is a hack, not a use case), and that the already existing setName(s) is useful for debugging (again, a hack, not a use case). If you have a solid use-case for this then I can't find it but I'm interested in hearing it. If it's a 'just because' thing then I think we should probably bring the discussion back to "will this add any real value to Wiremod" before we move onto discussing APIs and reviewing code.

@AbigailBuccaneer

implement a remote communication system between E2s

You understood it wrong, for that I do use data-signals (or global/shared table) - which is not a hack.
I implemented a "Bridge" communication system between E2 and client-side GLua, that's right. And is not a "hack", really. Improved Wire Debugger (and many other stuff) I have built upon it.

If someone else has solid use-case for this, please speak up. (@oldmud0 ?).
(Well, I could always push this as my first Wire E2 extension on the Workshop...)
But, consider this, @Divran said on discord that he is fine with #1366 PR (since I implemented his B option), and a number of my friends would appreciate those as well, and so would I. Look it also adds anti-spam system to the existing setName(string) E2 function; It increases the overall security in server networking.
It is fun, so why not? :female_detective:

Using the entity's name to transmit arbitrary data from server to client is a hack, sorry.

@Divran said in #1366:

I think I've changed my mind and option B is probably the better choice here. The question now is whether or not we should add this at all. Is it really necessary?

So I think it's disingenuous to say "he said he's fine with it since I implemented option B".

It is fun, so why not? :female_detective:

"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." — Antoine de Saint-Exupéry

Using the entity's name to transmit arbitrary data from server to client is a hack, sorry.

... again repeating yourself. No point in trying to explain it to you.

Divran said in ...

Yeah, I read that (btw I said "on discord" didn't I).
And so now it is waiting for either TomyLobo or Divran to review it again. I don't know what's taking so much time for them to review it.

On discord I said something along the lines of "idk we'll see what the others think".

It's taking so long because this issue turned into a shitshow so I opted to ignore it.
My opinion is: Do we really need this? Probably not. Most of the time, people who use gates don't use E2, and people who use E2 don't use gates. The wire namer was created for gates, therefore it doesn't make much sense to add a link between E2 and namer, because nobody will ever use it.

Was this page helpful?
0 / 5 - 0 ratings