Skip to content

Commit cbe5770

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 34a364a commit cbe5770

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
@@ -676,24 +676,6 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
676676
b.category = "Sounds"
677677
block_list.append(b)
678678

679-
b = BLOCKS["statement_block"].instantiate()
680-
b.block_name = "audiostreamplayer_pause_continue"
681-
b.block_type = Types.BlockType.EXECUTE
682-
b.block_format = "{pause: OPTION} the sound"
683-
b.statement = (
684-
"""
685-
if "{pause}" == "pause":
686-
stream_paused = true
687-
else:
688-
stream_paused = false
689-
"""
690-
. dedent()
691-
)
692-
b.defaults = {"pause": OptionData.new(["Pause", "Continue"])}
693-
b.tooltip_text = "Pause/Continue the audio stream"
694-
b.category = "Sounds"
695-
block_list.append(b)
696-
697679
b = BLOCKS["statement_block"].instantiate()
698680
b.block_name = "audiostreamplayer_stop"
699681
b.block_type = Types.BlockType.EXECUTE
@@ -703,6 +685,14 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
703685
b.category = "Sounds"
704686
block_list.append(b)
705687

688+
props = {
689+
"stream_paused":
690+
{
691+
"category": "Sounds",
692+
"has_change": false,
693+
},
694+
}
695+
706696
"AnimationPlayer":
707697
var b = BLOCKS["statement_block"].instantiate()
708698
b.block_name = "animationplayer_play"

0 commit comments

Comments
 (0)