Skip to content

Commit fc8f192

Browse files
committed
category_factory: Add pause and continue audio feature
https://phabricator.endlessm.com/T35582
1 parent 319a8a1 commit fc8f192

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

addons/block_code/ui/picker/categories/category_factory.gd

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,25 @@ static func get_general_blocks() -> Array[Block]:
503503
b.category = "Sounds"
504504
block_list.append(b)
505505

506+
b = BLOCKS["statement_block"].instantiate()
507+
b.block_name = "pause_continue_sound"
508+
b.block_type = Types.BlockType.EXECUTE
509+
b.block_format = "{pause: OPTION} the sound {name: STRING}"
510+
b.statement = (
511+
"""
512+
var __sound_node = get_node({name})
513+
if "{pause}" == "pause":
514+
__sound_node.stream_paused = true
515+
else:
516+
__sound_node.stream_paused = false
517+
"""
518+
. dedent()
519+
)
520+
b.defaults = {"pause": OptionData.new(["Pause", "Continue"])}
521+
b.tooltip_text = "Pause/Continue the audio stream"
522+
b.category = "Sounds"
523+
block_list.append(b)
524+
506525
b = BLOCKS["statement_block"].instantiate()
507526
b.block_name = "stop_sound"
508527
b.block_type = Types.BlockType.EXECUTE

0 commit comments

Comments
 (0)