Skip to content

Commit 621fe34

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 22877e7 commit 621fe34

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

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

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

0 commit comments

Comments
 (0)