viniciusgerevini / godot-clyde-dialogue

Clyde Dialogue Language Importer and interpreter for Godot.
MIT License
89 stars 11 forks source link

Add a `has_block` method to check if a dialogue contains a given block #41

Closed HexagonNico closed 6 months ago

HexagonNico commented 6 months ago

I ran into this issue when I was trying to add multiple dialogues in the same file and separate them using blocks, but the start function gives an error if called with a block name that does not exist, so I though it could use a has_block method to check if a given block exists.

For example, one could use it to default to a "default block" when a block with the given name does not exist.

if dialogue.has_block(block_name):
    dialogue.start(block_name)
else:
    dialogue.start("default_block")

There might be some other use cases for it, and since it only requires two accessor methods I though it would be a useful addition.

viniciusgerevini commented 6 months ago

Hello. Thanks. This makes sense.