diff --git a/addons/block_code/blocks/math/cos.tres b/addons/block_code/blocks/math/cos.tres new file mode 100644 index 00000000..1f0bb4a8 --- /dev/null +++ b/addons/block_code/blocks/math/cos.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://c6g6ljp46lfrj"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_lxbvo"] + +[resource] +script = ExtResource("1_lxbvo") +name = &"cos" +description = "Calculate the cosine of [i]angle[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "cos {angle: FLOAT}" +code_template = "cos(deg_to_rad({angle}))" +defaults = { +"angle": 0.0 +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/math/sin.tres b/addons/block_code/blocks/math/sin.tres new file mode 100644 index 00000000..fca5fca4 --- /dev/null +++ b/addons/block_code/blocks/math/sin.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://b1r7f06rfci6o"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_dlr47"] + +[resource] +script = ExtResource("1_dlr47") +name = &"sin" +description = "Calculate the sine of [i]angle[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "sin {angle: FLOAT}" +code_template = "sin(deg_to_rad({angle}))" +defaults = { +"angle": 0.0 +} +signal_name = "" +scope = "" diff --git a/addons/block_code/blocks/math/tan.tres b/addons/block_code/blocks/math/tan.tres new file mode 100644 index 00000000..2c6b5cd6 --- /dev/null +++ b/addons/block_code/blocks/math/tan.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" load_steps=2 format=3 uid="uid://blpo01pjjheqb"] + +[ext_resource type="Script" path="res://addons/block_code/code_generation/block_definition.gd" id="1_e2566"] + +[resource] +script = ExtResource("1_e2566") +name = &"tan" +description = "Calculate the tangent of [i]angle[/i]" +category = "Math" +type = 3 +variant_type = 3 +display_template = "tan {angle: FLOAT}" +code_template = "tan(deg_to_rad({angle}))" +defaults = { +"angle": 0.0 +} +signal_name = "" +scope = "" diff --git a/addons/block_code/ui/picker/categories/category_factory.gd b/addons/block_code/ui/picker/categories/category_factory.gd index 3257c054..9ae41db1 100644 --- a/addons/block_code/ui/picker/categories/category_factory.gd +++ b/addons/block_code/ui/picker/categories/category_factory.gd @@ -198,7 +198,7 @@ static func get_general_blocks() -> Array[Block]: block_list.append(b) # Math - for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range"]: + for block_name in [&"add", &"subtract", &"multiply", &"divide", &"pow", &"randf_range", &"randi_range", &"sin", &"cos", &"tan"]: b = Util.instantiate_block(block_name) block_list.append(b)