Skip to content

Commit a7ff0c5

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) https://phabricator.endlessm.com/T35609
1 parent c45835a commit a7ff0c5

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

738-
b = BLOCKS["statement_block"].instantiate()
739-
b.block_name = "audiostreamplayer_pause_continue"
740-
b.block_type = Types.BlockType.EXECUTE
741-
b.block_format = "{pause: OPTION} the sound"
742-
b.statement = (
743-
"""
744-
if "{pause}" == "pause":
745-
stream_paused = true
746-
else:
747-
stream_paused = false
748-
"""
749-
. dedent()
750-
)
751-
b.defaults = {"pause": OptionData.new(["Pause", "Continue"])}
752-
b.tooltip_text = "Pause/Continue the audio stream"
753-
b.category = "Sounds"
754-
block_list.append(b)
755-
756738
b = BLOCKS["statement_block"].instantiate()
757739
b.block_name = "audiostreamplayer_stop"
758740
b.block_format = "Stop"
@@ -761,6 +743,14 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
761743
b.category = "Sounds"
762744
block_list.append(b)
763745

746+
props = {
747+
"stream_paused":
748+
{
749+
"category": "Sounds",
750+
"has_change": false,
751+
},
752+
}
753+
764754
"AnimationPlayer":
765755
var b = BLOCKS["statement_block"].instantiate()
766756
b.block_name = "animationplayer_play"

0 commit comments

Comments
 (0)