#plugins-dev-chat
1 messages · Page 95 of 1
tbh, i just go for easier to read and quick
i doubt there is even the smallest slowdown using foreach over for in most cases
makes it easier to read anyway
Thats literally foreach
ehhh
also
found smth weird today
Player::UserGroup can't be equal to ServerStatic.PermissionsHandler.GetGroup(name)
for some odd reason
you have to compare the names 😭
I think that new UserGroup gets created on assignment?
with just like a copy
properties
i was looking at master 
probably
And is dev any better?
maybe add an implicit operator and an Equals method to compare the names instead?
yes
Get group calls .Clone()
but why
idk
but yeah
i think the implicit operator with the Equals method would just be better
lol
easier than figuring out why that is done

To not be able to edit the original group
delete
xddddd
trueing
You would quickly realise that is NOT happening
what's not happening
tbf technically the game is being rewritten one update at a time 
Yea
when CustomNetworkManager update
everytime someone touches 2017 code and need to change it for something that it just cant support, it gets rewritten

decontamination was changed to support disabling but it's uh
kinda weird still
thn it wasnt bad enough to the point where it had to be killed 
yeah
What would you like to see for decontamination
wdym
optoin to disable the announcementú
like the uh
announcements could be triggered by the server instead of being client bound
I would love to support custom time announcements
but they are kinda hardcoded into the audio
that's fine
just let the server decide when to play them instead of this
whatever we have currently
Yea why not
decontamination pausing doesn't work properly on the client
Ik
Then fix it 
let's make everything server-side so zero can make it client-side again
I love making client side stuff
And not knowing what is going on
!status
bruh
Skill issue
Do we need to sync scale by ourselves for new players? Sometimes a new player will se a (0.5, 0.5, 0.5) player as their full size equivalent, just in the ground. Sometimes players also just retain their old scale despite me setting it to (1, 1, 1) through the Player wrapper.
nw skill issue
sp
sp?
sp
Ye that happens to our server too
Bug with the new rolesync
as it just ignores the message if the player's role is not fpc sync
Already got fix for it and it will hopefully make it in the hotfix
Thanks, I waiting for that hotfix
Hopefully it will be hot
And actually fixing stuff

go to tech support, its an issue with the library for webrequests
we need people that can reproduce the issue so we can make bugreports for the library and test what the issue actually is
btw the issue that using webrequests for http request makes players lag
ig smth blocked main thead?
possibly, but webrequests dont really occur on the main thread
so thats a bit weird
server makes them on 2 other threads
and so do clients
u could try it urslef
I don't have this issue so
nope i mean use -- --unity-web-request as start args
that will make server use unitywebrequest for http request
hey uh how do i get the time until chaos/mtf spawns?
WaveManager
ok so did some testing....... OnBeforePlayerDestroyed in ReferenceHub is infact called before setting the players role to destroyed... but it's after setting to spectator so now i don't really know what to do... (fyi for the people unaware, i need an event to track when the person leaves the server, but before they turn into spectator or destroyed as i need their information before that, like health and position)
what method should i patch? as i dont think ima find an event...
Changing role?
would reason be that the user is disconnecting or smth?
CustomNetworkManager::OnServerDisconnect
If the target role is being destroyed well you can get their stuff
and that's called before the user's roles change?
and how exactly if you had an code example on your hand rq?
roles go from ur current role to spectator to destroyed, so it's hard to track with changing roles
okie cool, thanks ax
Ah, uh
check #1385288384070815835
np
still can't believe how we don't have something actually usable for this
@unique crane 
what
off to issues
what
poggies
.
god damnit gotta do a transpiler for this i think
yyyyeeaaaaaa
wdym
how will that break shit tho?
like either your transpiler won't work or the other transpilers won't work
cuz
conflict
Just dont care about it 


yeah lol
as i said
And check for RoleChangeReason to Destroyed
no
because
OnServerDisconnect gives the reason Unknown
which sets to spectator
and then spectator to destroyed has the reason Destroyed
anyone know why this might not be working? im looping through the new codes from the codematcher and nothing has changed, my IL hasn't been added...
why do you match the whole statement 😭
you have a ldsfld
with no field
does that match?
idk lol
i thought i had to do that!
can I just shorten it down to the Callvirt then?
yeah
uh, this is the resulting output...
which i dont think is right?
wait
Advance back
okie
Huh
how do i send more than 1 hint at the same time? like uh how do i make 2 differant hints which show at the same time but at different positions?
use RueI or HSM
make your own system
its easy way
thx
You really don't need that much of check
Hey. Quick question. How versatile is the 106 pocket dimention work. Like is it possible to get the correct door needed to escape?
Absolutely
yes
Veryyyyyy interesting 
PocketDimensionTeleport.PDTeleportType
This will be noted. Ty
PocketDimensionTeleport.AllInstances
You can use our pocket dimension wrapper
PocketDimension
PocketDimension.PocketTeleports
There is get/set property IsExit
why nw use Enum for it ?
Why do you ask me about 2017 code 😭
Idk
i made hubert modify this code to implement the PocketDimensionTeleport.AllInstances
ye you should use byte to yknow uint256
because they was still doing last year an GameObject.Finds<PocketDimensionTeleport>()
actually it's int
but we could technically do custom escape
with that
(PDTeleportType)3
and implement your new stuff
to it
actually Yeah
new if (this._type == 3)
DebugBool
that pddebug command
i did it because if I do MatchStartForward, it will put the index at the start of the match, if I just did Callvirt it would put the index before the callvirt... but i found it easier to just .Advance(-6) and it worked lol
i found easier to work with Index
The goat ty
might be using the wrong constructor
it's fine now dw
btw must say the game im playing rn is good but fight are dogshit (the category is a bit dogshit i must say) but story wise really good im loving it (rn im at the start of chapter 4 after 4.30h of gameplay but i had some bugs and needed to restart so like 20/30 minutes cannot be counted to the main run i was doing)
I hate networking xd
@celest thorn Will surely join you
I was wanted to do the same
I see what happens... its stupid becuase its doing same thing twice
while serialize of syncvars when theres like TextToy class it uses AdminToyBase soo what happens its writing...```
AdminToyBase
writer.WriteULong(base.syncVarDirtyBits);
TextToy
writer.WriteULong(base.syncVarDirtyBits);
twice lol
Yes
Ax, me fixed it on my thing, and zero has his own implementation of it too
That mirror for u
:P
currently making lobby
And dont you have the full src of the client and server
Well, you could do some stuff since many just spawning and doing messages but
How would you handle moving on objects
Trusting client fully?
Its only for purpose of lobby I not making like way to play with multiple players
this will use normal sl server but proxied when playing with multiple
What
Its fake server with only you being connected
and thats like whole thing required to make this
I want to add like portals but still I need to fix receiving position from client
914 SEEMS TO BE THE CAUSE OF CARD DUPLICATION
I can swear that since the 14.1.3 update, players on my server started reporting a drop of cards out of nowhere at the beginning of the game, and I can swear that every time 914 finished his improvement process, he generated more, I even recorded it, but when it was going to happen, he stopped duplicating cards
Ye it randomly appearing most of stuff i seen was in heavy or in random players feet
What can I do with CustomDataStore?
Good stuff
I use it for doing special effects to players
For example my custom role is basically a DataStore that contains function that uses the parsed yml to do things
Ah okay thanks
Since you have the player you can basically do anything you want with the player there
So for example if I make a storage where every 5 sec there will be a hint and if I add that storage to a player then only that player will get that hint every 5 sec.
Ye, but you have to do some sort of starter mechanism (like just a Start function in there)
Okay, thanks 😄
Ye we use datastore for some of our custom roles and its great, the initial making was headache and made me hate it but after fixing the spawn issue (players didn't registered their custom storage) I cleaned up some stuff and its easy and great
I'm trying to make a custom role too 😄
32 of our custom role has datastore (out of idk, 100?)
👀
Moment
Personally i store stuff in the custom role
Datastore is pretty good
for me just bool issocool; works fine
Its an extension for it, most of it just extra things that doesn't need to be handled inside
Like what
Every X minute you get effect
You don't need to have that for every role
Only like what you choose to be
Or after X hit you spawn a grenade for example
Not really needed to code that inside the core
Like a disk which you can put into the players and remove it?
ngl that server switching is fast lol when properly done
What is the event for 079 pinging?
OnScp079Pinging
Where is that?
LabApi.Events.Handlers.Scp079Events.Pinging
Doesn't exist
I was in the wrong labapi version mb
damn i thought this was just a my server issue
Same here lol, been driving me nuts
@rugged laurel feel free to ping any member of QA management (me, banzai, or multiverse), if you have questions about bugs that pop up
whoops
@pallid galleon
I just assume a lot of stuff is an us issue, then by the time it starts getting annoying usually someone in here posts or it's fixed 😛
this is pretty neat though
skill issue

You made the classic blunder of going down in an up elevator
yep my fault. i wont do that next time
can you ask them for player logs?
most of the clips I've seen of this issue are spectators, interesting to see it happens to live players as well
did you add any custom waypoints?
Hai
It's taken from a modded server though, but I don't think the player has any scale changes applied to them
it is possible a scale application happened. previous custom role on spawning, but last i checked it was disabled being worked on
any custom doors?
It seems like even when you set the cassie messages isHeld: false it still waits the 3 seconds
And it makes me angry
If you want pauses between Cassie messages just add yields to it
Like with a respawn wave
I don't want pauses
That's why I set the isHeld to false
and it still waits 3 seconds >:(
Well why do you not need pauses
Why are you sending messages in quick succession
Becuse I want it to say a couple messages quickly
Cuz I wanna
You can make breaks between messages without making them actual entire separate announcements
They are generated messages.
Yeah, and?
Its just a pain in the ass when the isHeld could just ya know work.
True because it deviates from what you wanted but I would say the process of
Generate messages -> combine them into one announcement -> send isn't too much more difficult than
Generate messages -> send as separate announcements
A lot of things are really buggy and don't work but the beauty is finding as way around it
Or something like that idk I'm tired
Lmfao, I mean
Suuuuuuure
But like
Plz fix papa northwood
Never
If you have bugs, throw it in the LabAPI requests
They actually tend to be pretty good at addressing a lot of them
the story of sl dev
Oh that could be the reason but that would affect all the players right ?
I'm not sure tbh, that's more of a question for riptide
Yeah
I was sleeping
Does the shotgun choke & extended barrel have the incorrect text?
Bugreports channel please
Create one
❌ join the qa server
✅ make a labapi bug report
-# 
#unknown
hangout today is so lonely
Cus I'm at work
im just streaming a game
A Roblox game
No a nintendo switch game
not a nw game
Then I'm not interested either
Honestly i must say this game is fun for the story not gameplay lol
normalize doing labapi stuff in labapi hangout without people joining for 2 seconds then leaving
Huh
Normalize doing labapi staff??
Someone just did it
😭
the hungyarian alphabet kicked in for a sec

Im going to scream
this boss is too high level
and i farmed for 4 hours
(8h rn)
Ok
Hi! Is it possible to make a Window not to be damaged by SCPs
playerdamagingwindow event?
Thanks
np
110 euro / question
109 euro / answer
how to fix
Verify files
reinstall
whats the issue w the reinstall button
save configs and other
it doesnt delete configs though
unless you have a custom egg that does that
unless ur modifying configs directly through assembly csharp dll youd be fine
every server running ptero does this to update between versions of the game
If i would fake sync an interactable toys position far away, would the person who sees it still be able to interact with it and call the toys' events, or would it be caught/denied by some anticheat or anything 
they also use a standard verification rule, ~3m
btw you can just set islocked
Probably client side you can interact but server doesn't do anything
yeah slejm is right
if it's there for the server then it'll check the server thing
i'd fake sync IsLocked instead and check if that client has IsLocked on the server (store in a set)
You can always try it i guess
try a hacked client 
Nah use David's client
how can i reset the players scale?
player.Scale = Vector3.one
and for what is Normalize?=
you don't need that here
vector.normalized gives you a vector pointing in the same direction with a magnitude (length) of 1
oh k thanks good to know.
np
While we're talking about scale, is it a known bug that the ragdoll spawns at scale 1, 1, 1 even when the player isn't that scale?
that's not really a bug, that's expected
ragdolls don't have player scale mirroring
Ragdolls do not match players size as they look weird when scaled
Intended behavior
Is there a way I can scale the ragdoll
yes
huh
change it before NetworkServer.Spawn in RagdollManager.SpawnRagdolls
basic mirror
Okay, that's what I tried. What am I doing wrong?
- which event is this in
- what is the player's role
OnPlayerDeath, ClassD
OnPlayerDeath
by this time the player is dead so their role is spectator
also labapi has a scale parameter for this even though it's not really supported...?
nw moment
So should I put this in OnPlayerDying?
isn't there a ragdoll spawning event
I'll try
???
kinda worked. Got a lil bit of body horror going on with the ragdolls now lol
Wdym not really supported
you just said it
they look weird when scaled
Intended behavior
so it doesn't shit itself
right?
or am i twittering
oh was it the uh
there was a bug report with some objects not having a default scale of one
yamato did it
was it with ragdolls? i forgor
Yea
049 has default of like 0.42 or something
So 1,1,1 makes it hugeeeeeee
But yea im not gonna spend time on it now
i thuoght that was fixed 
I dont think so
how long does it exactly take until you spawn from an wave? like how long is the time between it blinks and then you actually spawn?
check the wave's animation time
IAnimatedWave
though the labapi wrappers probably include them already
k
What if instead of wrappers you made basegame perfect so wrappers wouldnt be needed
🙄
Oh right game would be SO much managable if we had everything in a single network behavior
Someone gets it
You should have 1 class for the entire game
Oh..
punch strength multiplier
Hello everybody my name is multiplier
ohohohooo you're so portuguese
Lets stay at the multiplier and never go beyond that
mark bot
with markiplier gif
peak
based off that
this reminds me of something hungarian
can't say it here though cuz it's kinda political :(
Yes
So you could fakesync everything


I’m trying to create a lobby overlay using hints. The problem is that the hint system seems to only allow one active hint per player.
If I send a hint for the server title, then another for the round info, the second one replaces the first instead of displaying both.
This forces me to combine all my text into a single hint, but then <align>, <line-height>, and padding changes affect the whole overlay at once, making it impossible to position each block independently.
Does anyone know of a way to position the text separately? For example: Round information on the left, vertically centered at the height of the square that indicates the number of players on the server.
You can either use unity rich text tags, or use a hint manager
Ruei
Or HSM

or create your own hint manager
Yep
Please no
tysm guyss
HSM isn't bad in my experience
I'm using it until RueI is actually finished lol
I switched off because my server was destroying and tanking my tps
Skill issue
I use HSM on 32 player servers and get 60 tps
I do alot more than a normal sl server
And hsm was doing alot of useless stuff
😁
hints be expensive
Where's that one emoji that's "Works fine on my machine"
You're not all servers though 
Says you
You don't know me
I work on probably the most heavily modded servers ever, I know hints are expensive from experience ¯_(ツ)_/¯
Once you start having to compute and send them for every player it gets a little slow
Especially at higher player counts
I do, I just do that efficiently
Though I don't do like 50 billion hints
You're talking to the guy that patched a ton of performance improvements to servers :p Efficiently or not it's inherently not a fast system
I have a decent amount but not above average I'd say
The more you have to use it for every player, the slower it gets
I learned that from my experience
48 player servers are like, already tough to handle unfortunately
Since the game really doesn't seem to be made for more than 30 according to NW
I stopped using AutoText in HSM in favor of updating it manually to prevent constant updates
I had to patch some health setters and things to get that to work
I wish there was a better system to display stuff on clients
Don't we all
More than 5
Trol
Anyway
Oh so this is a known issue?
There is no issue what do you mean
Is there any fix I can implement or is it client-side and we have to wait for the next update?
Its client validation irrc so you cant patch it
Bffr
Hi! How can I get which plugin eats the most tps?
#1384311982953332736 message
Though this only applies to coroutines
To my knowledge, there isn't really a good way to check which plugin "eats the most TPS"
It's really just about taking inventory over what you're doing and cutting out the most resource-intensive stuff
But I gather you're not making a plugin in-house and are instead collecting LabAPI plugins
So may I ask what plugins you have
I'm making plugins I just don't know if I'm coding in an optimalized way 😄
Oh gotcha
My advice is generally don't worry about optimization so much for a majority of things
Ah okay
Unless you're someone like Zer0Two or Cyn developing some crazy heavily modded servers, you generally won't have much of a performance impact from plugins
I'd hope @unique crane can back this up at some point cause from reading past messages it appears he was the one behind the change
@slate flume Did you get that proxchat working btw?
Yep
Though I'd advise not doing prox chat rn
If 106 sends a prox chat message it kicks people
holy crap, do we know why?
Client validation iirc
got it
but that's only 106 using prox chat, not their typical global scp voice chat right?
what if I found a 106 prox chat without any lab api updates?
as if its only removed from lab API...
it should be possible to do it
No
they fully removed it?
No
The problem is the client can't validate a proximity chat channel message from 106
Even if you send a proximity chat channel message from 106 not using LabAPI, the client still has to validate it
This isn't necessarily a LabAPI issue, it's a base-game validation bug
ahhh alrig
my question is if I want to send audio, through a player's prox chat, or if they're an scp, through their global chat, how does the listener.Connection.Send() code change in your snippet from earlier to send audio files loaded as a stream
for context, I wanted to use the speech synthesis (ideally from DECTalk, but that's a WIP) from Windows built-in to receive a text command from a player, take the string that was sent, create a speech clip in memory stream, and then send from the player that sent that command as a prox chat/global chat
Oh very interesting
I have a friend who can't always play with a microphone, so this felt like a decent way to allow communication that didn't require line of sight, plus I imagine it should work with 939's voice stealing if done right?
I'm unsure
If it's been updated?
I've used this lib for one of my projects, and it seems to still be working, but so far iirc for local stuff, they attach a speaker object to a player's position? this would make voice stealing impossible to my knowledge. Still, a great way to start I suppose
Oh true!
Honestly I've never had to play audio files myself, so I'm unsure what the process is like to convert audio files -> voice messages
But I'll spend a bit here looking into it and throwing out ideas and thoughts
I really appreciate it, don't worry too much if it takes too long or anything, and of course if I figure it out I'm happy to share what I learnt
Okay I've been checking around for a bit
Generally the goal is to get a working VoiceMessage, which to my understanding you can make from an AudioMessage
I say this because you need the byte[] data for the message, but I'm unsure what these bytes are supposed to be or how to get them from an audio file
SpeakerToys to play audio use AudioTransmitters
I have noticed the AudioTransmitter::Transmit does a bunch of stuff, but then runs audioMessage.SendToHubsConditionally<AudioMessage>(new Func<ReferenceHub, bool>(audioTransmitter.\u003CTransmit\u003Eb__32_0));
Now the problem is that's a compiler-generated method
I know that if you prescribe to OnPlayerSendingVoiceMessage or otherwise you can change the ev.Message.Speaker to any referencehub it'll send the through the player specified by the reference hub
so it looks like the issue really is how to convert an audio stream into the format send() expects, right?
Pretty much
I'm also unsure if the message requires constant sending
But I would believe that you'd have to constantly send the message
if that were the case, then surely you can run an async task that reads a bit from the memory stream, and then sends, and continues until the stream end is reached, and then finishes up the send
One thought I preliminarily have is if you can get the audio sending through a speakertoy, would it be possible to grab the audio message from that, convert it to a voice message, and send it through a player?
If I do that, would likely see if I can write out to file the data in and out to try compare and figure out what transformation happened
I think what I would do is check out the AudioTransmitter::Transmit
thanks, will do
If you harmony patch to replace the SendToHubsConditionally call with a call to your function, check if the speakertoy is what you want, and then convert the audio message to a voice message and send it yourself, that should give the desired effectr
I see, this is all stuff I'll have to learn, I'm still new to C# in general, but I'm sure I'll come back around to this and might be able to get something really cool working
the audio message shoulf work if you just construct the same thing but as a voice message
I mainly recommend this course of action cause the two main barriers are converting the float[] PSM samples to byte[] message data that is expected and timing it so the data is sent correctly
Routing through speakertoys and patching the AudioMessage send should be the easiest way of overcoming those barriers
only issue is sending a voice message and the player actually speaking has been known to sometimes function weirdlg
mostly with intercom though.
Interesting
Haven't heard of that before
anyone know if there's a way to override magazine capacity of a gun, or how much ammo is currently in a gun?
Is there a method to find out ZoneType from Vector3?
Max ammo requires a patch. Current ammo can be accessed via wrappers
I think you can do Room.GetRoomAtPosition(), then Room.Zone
RoomUtils.RoomAtPosition(pos)?.Zone
Thx
DAVID
MY HERO
I have a question
answer
@unique crane is it possible to fix 106's prox chat issues with a patch or is it client-side where I can't do anything about it
.

additionally ^ if David sees this
Fuck
Just use a channel that isnt Proximity
Scps dont have a handler for proximity anyway
So itd just play globally
So using a different channel that does the same would give you the desired effect
hello chat
no
still broken
it worked 1 update and then broke
That's fucked

honestly its sl
I just wanna remove reverb from my speaker
my expectation are so low that even if a cube gets added and doesn't break in one update im happy
You can't :3
because IsSpatial was for that
you can try
but atleast for me no changes and always that way
Well the issue is still open so I assume no fix
(opened by me)
Hope instead nw gives us a way to like set them
how the reverb works
I just don't want reverb :(
no but settings for reverb and everything they would allow you to remove it to add slightly
etc...
isSpatial does work, reverb is a seperate thing from it
so the fix would be to add away to control reverb
so wait
why when it first came out it worked fine
and it was without reverb and then at some point got changed
it doesn't make any sense
yeah unity 6 did that
Thank you unity 6
Daily hate on unity 
I need graphic masks 
i wonder what modding tool will be added next
Don't use the proximity channel
everything recently has been amazing
Don't use async
any reason not to?
Unity
It's PCM :3
-# pulse-code modulation
does Unity get angory when async is used?
actually using async with unity is fine
oh, how do you run things without blocking then?
Why would it be broken?
My bad
because it should be without reverb like before
I need actual modding
you can try using MEC coroutines
Never happens
I would love to, but I have no idea how to get a hold of the dll for MEC
but async also works but i recommend async for I/O blocking stuff like web requests
firstpass
Again, it's been said that reverb is a separate control
So just give us an option to change the reverb zone mix parameter
Kek
Assembly-CSharp-firstpass
By the time Cyn told me to use a different channel I had already time sunk into using SpeakerToys instead
sprcifically
Yeah I gave up on it 
I get reverb but I was able to use Opus to boost the gain on it
So it's not too quiet
@worthy rune you wouldn't happen to know how I could send an audiostream through a player's microphone would you?
There will be a fix at some point (hopefully)
👆 🤓
I just Opus Decode -> Boost Gain -> Opus Encode
Worked for me
To run a coroutine just use Timing.RunCoroutine
and provide a method with return type IEnumerator<float> and each yield return (number) is a waiting period
thanks Chai!!!
Weird wording but
Just play the packets in order
Yield return float.Nan
yield return Timing.WaitForSeconds(1f);
Construct VoiceMessage with referencehub as sender and then send to all
*NaN
Don't just pass in random floats
@pine parcel
obviously dont do that
voice message is just a series of PCM?
Wait for 1000 float tick
Timing.CallDelayed(Timing.WaitForSeconds()) 
Yes, encoded with opus
It's compressed using opus
I just want to give a comprehensive explanation to newer devs cus i had to figure some stuff all on my own
oh!!! thanks!!!
I'm working on a library to make audio stuff a million times easier
Me when coroutine abuse, make components and save your sanity
I'd love to be notified when you get that working!
Easier to maintain in the long run
Writing docs is pain though
Trueing
That's why I dont
I can send you some code that I use to Decode/Encode the Opus messages if you'd like
Let me share a sneak peek
Tell me more
I would really appreciate that
Easier to handle components over coroutines
Slap em on a player or whatever's playing audio
Hell even the host player since it's a thing for some stupid reason, make it useful instead of just there to crash your server
"Just FIGURE IT OUT ugh"
Ahh
yes
interesting
I don't know how components work
:)
i love components, audio or not
Bro just AddComponent
while (true)
yr Timing.WaitForOneFrame
or you can use awaitables for more complex stuff
ive seen more than one SL dev have a moral objection to unity as a company and therefore the software
not for audio
Then dont do SL modding kek
but like some complex state
ikr
So uh how do I get shit in the update function
Like I have a coroutine I use to move players into a black hole, can I get the position of the primitive inside of the component?
Unity sucks ass but if you're gonna make SL stuff just bite the bullet and use the engine properly
i dont even know if unity is bad
Yes keep a reference to it in your component
like what did they do
They shit on devs
How would I do that
Have an Init() method where you pass relevant objects
Player _player;
However you're already doing it, just pass the reference to a component you create
Instead of passing it to a coroutine
I only used unity when I did the game object tree check and decompiled the game
and do gameObject.AddComponent<ComponentType>().Init(objcets);
Please split your stuff heh
I make some devious one-liners that no one can ever read
var component = gameObject.AddComponent<MyComponent>();
component.Initialize(data);
Including myself
I chew out people who do that for a living
yeah one-line if statements
Unless there's a good reason to and it's readable
One line if statements are an immediate execution
I mean I get not liking large one-liners
What's the problem with a short one-line if statement though
Congrats your git diff screwed up, your if statement now applies to another line of code instead of what it did before, oops runtime bug you didn't catch
My IDE would warn me in that scenario
It does big flashing underlines
Not always
um no
Yes it does
Nah you gotta do
void AddModules(GameObject go) { go.AddComponent<MyLovelyConponentThatHasALongName>().Start(); }
okay
I'm telling you it literally does
i don't even use braces for one line if statements but i put the exec on a new line
Start is a Unity method you're fucked up if you call it manually heh
😭
i try to avoid one liners more now, they suck to write and suck to read
Depending on what the code is, it could be valid and your IDE doesn't generally understand what you want to do
indent
I don't see the issue with that
but i dont always think about them so i end up writing a lot
It wont always be like that
It's still valid code, my IDE is just smarter
It does that with every if statement
Yoh forgor return
Exactly
Because you're applying an if to an if
And my IDE warned me
It won't always be the case
Give me a case where it won't tell me
Source: has happened multiple times at work which is why I kill anyone who does it nowadays
I don't believe it until I see it
Because my IDE warns me when I don't use proper indentation, if I forget a return, it'll warn me because I didn't indent
me when 5 ||s in one if statement (both on their own line)
I.E. I get warned if my one-liner doesn't work
can't indent if you don't do a new line 
if (something) method();
anotherMethod();
if (something) anotherMethod();
anotherMethod();
Okay? That's the damn point I'm getting at
I can't check the broken commits from work
Either way it's happened
It's a bad habit
bruh
That's just a call to the wrong method lmao
WDYM
I have not once experienced an issue like that
Which is great, not the case for everyone else
Good for them
having the code on a new line makes it much more readable
if (someAbsurdlyLongConditionLikeJavaXdIDontEventKnowWhatToPutHereJustForDemonstration) DoSomething();
vs
if (someAbsurdlyLongConditionLikeJavaXdIDontEventKnowWhatToPutHereJustForDemonstration)
DoSomething();
i don't have to read the entire condition
It's unreadable
That's why I don't do it with absurdly long conditions
if (ev.Message.Channel != VoiceChatChannel.ScpChat) return;
Simple
Easy
nobody cares how you write your code, only you do, unless youre gonna work on a team or professionally
"unless you work in a team"
If my if statement is long I indent
so true
only person you hurt is yourself (or potential contributors)
What will you ever do with those {} you didn't type, saved ya a lot of time 
I just think it's cleaner
It's not about saving time
Yeah I work in big teams on monolithic codebases
I think it looks like shit lol, i always put brackets around shit
We have reasons we forbid stuff like that
everyone else has different coding styles and they refuse to reformat, no .editorconfig
2 lines
not needed
*python walks in*
We have an editorconfig and bypassing it or not following conventions gets your PR denied
and ive seen more talented programmers doing the same stuff (one liner or no brackets), its weird to see but i guess everyones different
Funilly enough I use python
YES
i should get an editor config that i just put in every project
When we work in codebases that have 50k+ files, we can't afford wasting time because someone decided they were better than everyone else
Same reason we ban AI
rn i install stylecop 50% of the time and then ignore the warnings i dislike instead of reconfiguring it. so i should probably get an editorconfig
I personally spent enough time rewriting shitty AI generated code merged by a junior to get it banned by management
Like yeah it looks okay on merge, then you find out it's sheite when it interacts with the rest of the codebase later down the line
Enjoy the ticking bomb you'll have to cleanup a few weeks or months later
😭
I can say I fully understand why you have the conventions you do
Why you're strict about editing style and using AI and those things
Most large tech companies have those rules because people will misuse them
AI generated code in a professional context is insane
Real
I'm fine with AI if you're experienced and know when it spews bs
I'll still judge but I won't be annoyed or worried
hate to see my coworker porting the website to Nuxt with ai, comments everywhere, random shit, uses axios
Juniors that abuse it just piss me off
This makes sense
some just don't care, and that's kinda sad
And they get their head screwed back on or fired
why are you programming at this point if you just prompt 
Job security for me
No AI can write a disasterous code than me
You wish heh
I'm back
What is your worst code
or at least the cringiest code
Cringing at your old code is great
I wanted to sleep but someone outside decided to lawn grass
Means you've improved
Sometimes with database and bunch of if statement
So fucking real
@grand flower https://www.youtube.com/watch?v=6lU11IHfJgo
You might like this video
Gorgeous C++? That's not even possible.
Or... maybe it is. Google at least thinks so. In this video, we discuss Google's C++ style guide, and how they use it to write future proof code.
🏫 COURSES 🏫 Learn to code in C at https://lowlevel.academy
📰 NEWSLETTER 📰 Sign up for our newsletter at https://mailchi.mp/lowlevel/the-low-down
...
personal lib i wrote last year. i might need to rewrite it sometime both for LabAPI and general improvements
I watch a lot of videos like that
I don't watch much of those
C++ cife is never gorgeous
Some are good, others are just eh
c++ wife
I wrote plugins 3 or 4 years ago, and i wonder to myself how i just didnt know super basic things

True, which is why I sent you that one
I thought it was pretty good
It is
like i wrote a switch statement for a bool
Like it's not bad but wouldn't apply for us
and i had a function dedicated to calling the biggest if statement ever
which was like 99% redundant i think
auto is automatically forbidden 95% of the time
The only time I'd accept it is for structured bindings
That's one of the points of the video
https://github.com/icedchai/LoneFoundation-EXILED/blob/main/LoneFoundation%2FEventHandlers.cs#L52
true 12 year old programmer right here
Did I misread
is auto like var
Yeah
I'll happily type a full name over auto
var is good
What it means is you can't do like
int a = Function();
but you could do something like
var a = Function<int>();
i think it depends on context
So long as the type is explicitly stated in the line
We'd still type it explicitly
sometimes its fine if the type is very easily inferrable
but other times its just laziness and can hurt readabilty
as a beginner csharp programmer, why do I ever use var? shouldn't I always know what type something is going to be?
C++ is a lot wilder
That's interesting cause I like to use var when I'm grabbing long ass variables like CoroutineHandle
var is for convenience i think
- laziness
- sometimes the compiler knows better
You'll know from what you assign and your IDE will tell you
Thats fine in C# - I always use var for local variables
like don't do IEnumerator<int> = list.GetEnumerator(); (it boxes)
Actually a rule of mine
var type is always the most specific possible right
what else would you use them for
yes
I just mean that while that is fair in C#, I would never do the same in C++
if you did var enumerator = list.GetEnumerator() it would be List<T>.Enumerator and not IEnumerator<T>
In C++ I will happily type UE::TSomeTemplate<MyClass>::Descriptor Something = ....
why not in C# then
ah
Especially once you start getting into pointers and references etc
c++ is more low level right
Yes
so you're saying that the compiler is dumber? 
C# is also a lot easier for your IDE to analyse
No more like static analysis of C++ is extremely expensive computation wise
i prefer to blame the compiler
Meaning most IDEs won't or they'll do their best
But they can't always catch everything
Not as much as C#
what can go wrong
Unreal is also huge itself, so add that and then the game itself on top and you'll understand why I have 192GB of RAM
Can compile differently between auto and typed out
Compiler might prioritize another possible inferred type
jesus
C# generally has the IDE yell at you if that can happen, C++ it generally won't unless it's very wrong
So you might end up with behaviour that differs from what you wanted
They yell st compile time
Maybe not a lot different, could still work fine but be a little costlier for instance
i thought that was impossible
Spending 30 minutes fixing a buffer overflow just for it to be somewhere else
I think I've only had it happen a single digit amount of times in the past
java looking getters and setters
But when it happens it's either just costlier or catastrophic and hard to debug
Memory management be like 
More like stack corruption
Funny is , not even learned java at that time
Especially when you start getting the bug in non-debug builds/optimized builds and not your editor/dev ones
Yeah that's ass
Had it happen a few times
Generally it was a more junior dev returning references when they shouldn't
i need an example, what your describing sounds way to wild for the compiler to be doing

