Skip to content

Commit bc29651

Browse files
committed
category_factory: Use AudioStreamPlayer's stream_paused as a property
According to the discussion [1], stream_paused is AudioStreamPlayer's a property. Use it as property flavor to generate blocks automatically. [1]: #161 (comment)
1 parent 145aaa5 commit bc29651

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

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

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -666,24 +666,6 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
666666
b.category = "Sounds"
667667
block_list.append(b)
668668

669-
b = BLOCKS["statement_block"].instantiate()
670-
b.block_name = "audiostreamplayer_pause_continue"
671-
b.block_type = Types.BlockType.EXECUTE
672-
b.block_format = "{pause: OPTION} the sound"
673-
b.statement = (
674-
"""
675-
if "{pause}" == "pause":
676-
stream_paused = true
677-
else:
678-
stream_paused = false
679-
"""
680-
. dedent()
681-
)
682-
b.defaults = {"pause": OptionData.new(["Pause", "Continue"])}
683-
b.tooltip_text = "Pause/Continue the audio stream"
684-
b.category = "Sounds"
685-
block_list.append(b)
686-
687669
b = BLOCKS["statement_block"].instantiate()
688670
b.block_name = "audiostreamplayer_stop"
689671
b.block_type = Types.BlockType.EXECUTE
@@ -693,6 +675,14 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
693675
b.category = "Sounds"
694676
block_list.append(b)
695677

678+
props = {
679+
"stream_paused":
680+
{
681+
"category": "Sounds",
682+
"has_change": false,
683+
},
684+
}
685+
696686
"AnimationPlayer":
697687
var b = BLOCKS["statement_block"].instantiate()
698688
b.block_name = "animationplayer_play"

0 commit comments

Comments
 (0)