Skip to content

Commit 3ba53f5

Browse files
authored
Merge pull request #174 from endlessm/T35582-refactor-sounds
category_factory: Add another Sounds blocks for GDScript flavor
2 parents b11b95e + dbdaca8 commit 3ba53f5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,13 +564,15 @@ static func property_to_blocklist(property: Dictionary) -> Array[Block]:
564564
var variant_type = property.type
565565

566566
const FALLBACK_SET_FOR_TYPE = {
567+
TYPE_BOOL: false,
567568
TYPE_INT: "0",
568569
TYPE_FLOAT: "0",
569570
TYPE_VECTOR2: "0,0",
570571
TYPE_COLOR: "DARK_ORANGE",
571572
}
572573

573574
const FALLBACK_CHANGE_FOR_TYPE = {
575+
TYPE_BOOL: true,
574576
TYPE_INT: "1",
575577
TYPE_FLOAT: "1",
576578
TYPE_VECTOR2: "1,1",
@@ -724,6 +726,31 @@ static func get_built_in_blocks(_class_name: String) -> Array[Block]:
724726
"angular_velocity": {"category": "Physics | Velocity"},
725727
}
726728

729+
"AudioStreamPlayer":
730+
var b = BLOCKS["statement_block"].instantiate()
731+
b.block_name = "audiostreamplayer_play"
732+
b.block_format = "Play"
733+
b.statement = "play()"
734+
b.tooltip_text = "Play the audio stream"
735+
b.category = "Sounds"
736+
block_list.append(b)
737+
738+
b = BLOCKS["statement_block"].instantiate()
739+
b.block_name = "audiostreamplayer_stop"
740+
b.block_format = "Stop"
741+
b.statement = "stop()"
742+
b.tooltip_text = "Stop the audio stream"
743+
b.category = "Sounds"
744+
block_list.append(b)
745+
746+
props = {
747+
"stream_paused":
748+
{
749+
"category": "Sounds",
750+
"has_change": false,
751+
},
752+
}
753+
727754
"AnimationPlayer":
728755
var b = BLOCKS["statement_block"].instantiate()
729756
b.block_name = "animationplayer_play"

0 commit comments

Comments
 (0)