OK! Hard mode #godot challenge question:

Is there any way to set up a Resource with a signal that has a call bound?

By default, defining signals works fine but they cannot be bound in the editor. I have been using trashy workarounds. I would prefer to just bind the signal.

Ugh, the only answer I got to this was on BlueSky and was "why would you ever want something easy and useful? You should just do backflips like everyone else!"

I guess I'm glad for the silence here on Mastodon, at least it's not people telling me to not ask the question.

This is probably not Godot-specific, but I can't help except notice that whenever I ask a Godot question, 95% of the answers are about how I shouldn't have asked.

And then like 5% are "here's how:" and it's super easy.

Be part of the 5%.

Since it seems people don't know why you'd want this:

You have a Resource class: Potion.

How do you tell each type what it does?

Easiest way would be to bind arbitrary functions and args on a on_drunk Signal.

Otherwise you have to duplicate that functionality and it's either flabby or brittle. #godot

@view shouldn't potion should just be a node type? Why do you need it to be a resource?

@thebestnom Why would an inventory item be a node? It's a data object, not a functional scene object.

You just have a generic "item" node that shows an icon, links to a resource, and lets you choose whether to use it or sell it.

@view Can you have a kind of PotionManager, which job will be be to take a potion resource, figure out what to do and have all the signals connected to/from that manager ?
@uzakl You can, but the wiring ends up backwards. It's pretty clumsy.
@view I was going to have potions be things with a bag of effect components (can be an Array of the component Resources for example), and then when someone drinks a potion, you apply the effects to them. But I’m still figuring out ECS stuff.

@Taffer I think that's probably the best way to do it given the restrictions, but it's still a real annoyingly flabby way to go about it. It means you have to have a bunch of different classes you instantiate willy-nilly, saving and loading to a spreadsheet becomes really obnoxious-

It'd be so much nicer with a reflection-based function system. Sigh.

@view Yeah, I don’t want to have a big hierarchy of resources. I’ve been pondering a way to recreate things from a spreadsheet in a sensible way but haven’t written anything down yet.