User talk:NeatNit

From Garry's Mod
Jump to: navigation, search

Best Practice?

Heya, question - mind elaborating on how precisely we're talking best practice when it comes to including clientside tool fields serverside? I can think of a couple reasons for which that approach might be warranted for other types of entities (mostly the fact that world entities can and do get duplicated), but I can't really come up with anything that warrants giving the server direct access to a tool's HUD and spawn menu elements. If anything, needlessly networking HUD events strikes me as bad practice since the rare cases in which networking would be involved would best be handled by solely transmitting the overriding information on its own and having a clientside hook that takes care of it. --Eli 14:50, 12 April 2016 (UTC)

There's no networking involved, it's just a few table members that would (or wouldn't) get set, and would never get used serverside. The same thing applies to to the ENT members I linked to - some of them are only ever used serverside, and some of them are only ever used clientside, but it's best practice to define all of them in both realms. Partially because not doing so complicates code and uglifies it with unnecessary "if SERVER then ... end" lines.
If you disagree, you can re-do your edit again, I won't revert it a second time.
--NeatNit 18:14, 12 April 2016 (UTC)
Gotcha, thank you for explaining where you're coming from. I kinda get it, can't really say that your argument changed my mind about whether it's best or bad practice however - I'd make the counterargument that recommending a clause would actually improve readability since it encourages people to have distinct and separate blocks of script for either side of the client-server fence; I'd also argue that encouraging performance-oriented scripting would be preferable to encouraging "anything goes", even if it's at a level at which it's unlikely to have any real impact. Either way, cheers!
--Eli 22:30, 12 April 2016 (UTC)
I personally think that anything that when you're making a single file (not split to init, cl_init and shared), anything that can exist in both realms without breaking anything, should exist in both realms; Even if it's not used in both. I base this mostly on the tip in ENT structure. Still, as promised, I'm not touching your edit. :)
--NeatNit 09:16, 13 April 2016 (UTC)
Honestly, that's fair enough. Re-reading my earlier posts, I guess I might've been a little too dogmatic about my own position - I guess it ultimately just boils down to personal preference. See, I'm writing a lot in C when I'm not working on my GMod projects and C makes it pretty easy to forget we're no longer in the 90ies at times where minimalism wasn't so much a style as it was a basic necessity, and working with an interpreter rather than a compiler gets to me as well at times, heh. Sorry, hope I didn't give you too much crap over something that's really not that likely to matter for the majority of end-users.
--Eli 12:01, 19 April 2016 (UTC)
Every night in the past week I cried myself to sleep because of this. You're a horrible, horrible person! --NeatNit 15:49, 19 April 2016 (UTC)
Personal tools