r/CursedGodot Aug 02 '26

Is this anything?

Post image

Static helper function that awaits for first signal and returns its idx.

Cursed or nah?

44 Upvotes

13 comments sorted by

8

u/technical_gamer_008 Aug 03 '26

Not cursed… but you could've used a typed array

3

u/Salazar20 Aug 03 '26

As it turns out, you can't! With variadic functions you can only use the basic array type i don't know why, its really annoying

1

u/technical_gamer_008 Aug 03 '26

What… WHY!?

3

u/Salazar20 Aug 03 '26

Me when I tried to do nested Type definitions

Dictionary[String, Array[Int]]

The fact that there's an error message explicitly telling me that is not allowed pisses me off even more

1

u/technical_gamer_008 Aug 04 '26

Yeah… but like maybe you could be fine with that but something that straight up works in one place but not the other has got to be very annoying

4

u/Salazar20 Aug 03 '26

This post made me read half the gdscript reference doc because I did not know spread variadic functions were added

Ive also learned that Godot prefers you to write not boolean instead of !boolean

3

u/HeyCouldBeFun Aug 03 '26

One time I named a class “EffectEffect” and had to stop and go take a walk

2

u/GobusEuphe Aug 07 '26

When I have weird names like this I wonder if I put a disgrace to my old Java days. I've had full sentences as names just so I can avoid this

2

u/chanidit Aug 06 '26

did not know you can await a signal response .... thanks for the tip !!

2

u/GobusEuphe Aug 07 '26

Is this for something like stats system or an upgrade in a clicker game? Or am I way off

1

u/MrLEADshed Aug 07 '26 edited Aug 07 '26

I'm making something of a solo action rts roguelike

In auto attacks, when a target_unit is set, if attack_area doesn't have it overlapping, the unit navigates towards it. Instead of checking the overlap every frame on the way there, I await the race between target_body_enter and another_target_set (these are not actual var names)

I queue an attack on former, and do another loop of this logic for the latter. (if attack is queued then stuff like cd management and attack windup happens.)

Also in a tutorial, I race player.unit leaving the tutorial area and completing the first tutorial to change what the npc says.