Skip to content

T35591 more block definitions #199

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions addons/block_code/blocks/communication/add_to_group.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
[resource]
script = ExtResource("1_bcm71")
name = &"add_to_group"
target_node_class = ""
description = "Add this node into the group"
category = "Communication | Groups"
type = 2
variant_type = 0
display_template = "Add to group {group: STRING}"
code_template = "add_to_group({group})"
description = "Add this node into the group"
category = "Communication | Groups"
defaults = {}
signal_name = ""
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/communication/area2d_on_entered.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://de4k7t7uqws1j"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_xotf5"]

[resource]
script = ExtResource("1_xotf5")
name = &"area2d_on_entered"
target_node_class = "Area2D"
description = ""
category = "Communication | Methods"
type = 1
variant_type = 0
display_template = "On [body: OBJECT] entered"
code_template = "func _on_body_entered(body: Node2D):
"
defaults = {}
signal_name = "body_entered"
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/communication/area2d_on_exited.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b36nq4mau6lu6"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_21qth"]

[resource]
script = ExtResource("1_21qth")
name = &"area2d_on_exited"
target_node_class = "Area2D"
description = ""
category = "Communication | Methods"
type = 1
variant_type = 0
display_template = "On [body: OBJECT] exited"
code_template = "func _on_body_exited(body: Node2D):
"
defaults = {}
signal_name = "body_entered"
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/communication/rigidbody2d_on_entered.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://dl1xd1jit2mlp"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_v2421"]

[resource]
script = ExtResource("1_v2421")
name = &"rigidbody2d_on_entered"
target_node_class = "RigidBody2D"
description = ""
category = "Communication | Methods"
type = 1
variant_type = 0
display_template = "On [body: OBJECT] entered"
code_template = "func _on_body_entered(body: Node2D):
"
defaults = {}
signal_name = "body_entered"
scope = ""
18 changes: 18 additions & 0 deletions addons/block_code/blocks/communication/rigidbody2d_on_exited.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://c15ymi1kxb570"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_sahiu"]

[resource]
script = ExtResource("1_sahiu")
name = &"rigidbody2d_on_exited"
target_node_class = "RigidBody2D"
description = ""
category = "Communication | Methods"
type = 1
variant_type = 0
display_template = "On [body: OBJECT] exited"
code_template = "func _on_body_exited(body: Node2D):
"
defaults = {}
signal_name = "body_exited"
scope = ""
17 changes: 17 additions & 0 deletions addons/block_code/blocks/graphics/animationplayer_is_playing.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://mg4y3o0rsqd5"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_xr50b"]

[resource]
script = ExtResource("1_xr50b")
name = &"animationplayer_is_playing"
target_node_class = "AnimationPlayer"
description = "Check if an animation is currently playing."
category = "Graphics | Animation"
type = 3
variant_type = 1
display_template = "Is playing"
code_template = "is_playing()"
defaults = {}
signal_name = ""
scope = ""
17 changes: 17 additions & 0 deletions addons/block_code/blocks/graphics/animationplayer_pause.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://clopo7gmje5a"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_2enqv"]

[resource]
script = ExtResource("1_2enqv")
name = &"animationplayer_pause"
target_node_class = "AnimationPlayer"
description = "Pause the currently playing animation."
category = "Graphics | Animation"
type = 2
variant_type = 0
display_template = "Pause"
code_template = "pause()"
defaults = {}
signal_name = ""
scope = ""
29 changes: 29 additions & 0 deletions addons/block_code/blocks/graphics/animationplayer_play.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[gd_resource type="Resource" load_steps=4 format=3 uid="uid://c5e1byehtxwc0"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_emeuv"]
[ext_resource type="Script" path="res://addons/block_code/ui/block_canvas/option_data.gd" id="1_xu43h"]

[sub_resource type="Resource" id="Resource_vnp2w"]
script = ExtResource("1_xu43h")
selected = 0
items = ["ahead", "backwards"]

[resource]
script = ExtResource("1_emeuv")
name = &"animationplayer_play"
target_node_class = "AnimationPlayer"
description = "Play the animation."
category = "Graphics | Animation"
type = 2
variant_type = 0
display_template = "Play {animation: STRING} {direction: OPTION}"
code_template = "if \"{direction}\" == \"ahead\":
play({animation})
else:
play_backwards({animation})
"
defaults = {
"direction": SubResource("Resource_vnp2w")
}
signal_name = ""
scope = ""
17 changes: 17 additions & 0 deletions addons/block_code/blocks/graphics/animationplayer_stop.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b4v00oxoxbfet"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_wp8gr"]

[resource]
script = ExtResource("1_wp8gr")
name = &"animationplayer_stop"
target_node_class = "AnimationPlayer"
description = "Stop the currently playing animation."
category = "Graphics | Animation"
type = 2
variant_type = 0
display_template = "Stop"
code_template = "stop()"
defaults = {}
signal_name = ""
scope = ""
31 changes: 31 additions & 0 deletions addons/block_code/blocks/input/characterbody2d_move.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cu3ru61vg6bx5"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_btxic"]

[resource]
script = ExtResource("1_btxic")
name = &"characterbody2d_move"
target_node_class = "CharacterBody2D"
description = ""
category = "Input"
type = 2
variant_type = 0
display_template = "Move with keys {up: STRING} {down: STRING} {left: STRING} {right: STRING} with speed {speed: VECTOR2}"
code_template = "var dir = Vector2()
dir.x += float(Input.is_key_pressed(OS.find_keycode_from_string({right})))
dir.x -= float(Input.is_key_pressed(OS.find_keycode_from_string({left})))
dir.y += float(Input.is_key_pressed(OS.find_keycode_from_string({down})))
dir.y -= float(Input.is_key_pressed(OS.find_keycode_from_string({up})))
dir = dir.normalized()
velocity = dir*{speed}
move_and_slide()
"
defaults = {
"down": "S",
"left": "A",
"right": "D",
"speed": Vector2(100, 100),
"up": "W"
}
signal_name = ""
scope = ""
1 change: 1 addition & 0 deletions addons/block_code/blocks/log/print.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_0lih2")
name = &"print"
target_node_class = ""
description = "Print the text to output"
category = "Log"
type = 2
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/logic/compare.tres
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ items = ["==", ">", "<", ">=", "<=", "!="]
[resource]
script = ExtResource("1_wp40r")
name = &"compare"
target_node_class = ""
description = ""
category = "Logic | Comparison"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/add.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_rks7c")
name = &"add"
target_node_class = ""
description = ""
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/divide.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_rhh7v")
name = &"divide"
target_node_class = ""
description = ""
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/multiply.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_c5vny")
name = &"multiply"
target_node_class = ""
description = ""
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/pow.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_cx5g5")
name = &"pow"
target_node_class = ""
description = ""
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/randf_range.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_03jps")
name = &"randf_range"
target_node_class = ""
description = "Generate a random floating point number between [i]from[/i] and [i]to[/i] inclusively"
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/randi_range.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_hk574")
name = &"randi_range"
target_node_class = ""
description = "Generate a random signed 32-bits integer number between [i]from[/i] and [i]to[/i] inclusively. [i]from[/i] and [i]to[/i] can be a negative or positive number"
category = "Math"
type = 3
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/math/subtract.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_n0dmm")
name = &"subtract"
target_node_class = ""
description = ""
category = "Math"
type = 3
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://cp6ak6wea8ogh"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_e3r2r"]

[resource]
script = ExtResource("1_e3r2r")
name = &"characterbody2d_move_and_slide"
target_node_class = "CharacterBody2D"
description = ""
category = "Physics | Velocity"
type = 2
variant_type = 0
display_template = "Move and slide"
code_template = "move_and_slide()"
defaults = {}
signal_name = ""
scope = ""
17 changes: 17 additions & 0 deletions addons/block_code/blocks/sounds/audiostreamplayer_play.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://bxjjml7u3rokv"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_vyl5w"]

[resource]
script = ExtResource("1_vyl5w")
name = &"audiostreamplayer_play"
target_node_class = "AudioStreamPlayer"
description = "Play the audio stream"
category = "Sounds"
type = 2
variant_type = 0
display_template = "Play"
code_template = "play()"
defaults = {}
signal_name = ""
scope = ""
17 changes: 17 additions & 0 deletions addons/block_code/blocks/sounds/audiostreamplayer_stop.tres
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://ib16grbtduab"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_db4g2"]

[resource]
script = ExtResource("1_db4g2")
name = &"audiostreamplayer_stop"
target_node_class = "AudioStreamPlayer"
description = "Stop the audio stream"
category = "Sounds"
type = 2
variant_type = 0
display_template = "Stop"
code_template = "stop()"
defaults = {}
signal_name = ""
scope = ""
1 change: 1 addition & 0 deletions addons/block_code/blocks/sounds/load_sound.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_4w4si")
name = &"load_sound"
target_node_class = ""
description = "Load a resource file as the audio stream"
category = "Sounds"
type = 2
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/sounds/pause_continue_sound.tres
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ items = ["Pause", "Continue"]
[resource]
script = ExtResource("1_q04gm")
name = &"pause_continue_sound"
target_node_class = ""
description = "Pause/Continue the audio stream"
category = "Sounds"
type = 2
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/sounds/play_sound.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_llfp1")
name = &"play_sound"
target_node_class = ""
description = "Play the audio stream with volume and pitch"
category = "Sounds"
type = 2
Expand Down
1 change: 1 addition & 0 deletions addons/block_code/blocks/sounds/stop_sound.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_rfujh")
name = &"stop_sound"
target_node_class = ""
description = "Stop the audio stream"
category = "Sounds"
type = 2
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[gd_resource type="Resource" load_steps=2 format=3 uid="uid://ses5486g56q"]

[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_72i54"]

[resource]
script = ExtResource("1_72i54")
name = &"rigidbody2d_physics_position"
target_node_class = "RigidBody2D"
description = ""
category = "Transform | Position"
type = 2
variant_type = 0
display_template = "Set Physics Position {position: VECTOR2}"
code_template = "PhysicsServer2D.body_set_state(
get_rid(),
PhysicsServer2D.BODY_STATE_TRANSFORM,
Transform2D.IDENTITY.translated({position})
)
"
defaults = {}
signal_name = ""
scope = ""
1 change: 1 addition & 0 deletions addons/block_code/blocks/variables/vector2.tres
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
[resource]
script = ExtResource("1_ilw3v")
name = &"vector2"
target_node_class = ""
description = ""
category = "Variables"
type = 3
Expand Down
Loading