Use static typing in all demos (#1063)

This leads to code that is easier to understand and runs
faster thanks to GDScript's typed instructions.

The untyped declaration warning is now enabled on all projects
where type hints were added. All projects currently run without
any untyped declration warnings.

Dodge the Creeps and Squash the Creeps demos intentionally don't
use type hints to match the documentation, where type hints haven't
been adopted yet (given its beginner focus).
This commit is contained in:
Hugo Locurcio
2024-06-01 12:12:18 +02:00
committed by GitHub
parent 8e9c180278
commit bac1e69164
498 changed files with 5218 additions and 4776 deletions

View File

@@ -19,6 +19,10 @@ run/main_scene="res://vrs.tscn"
config/features=PackedStringArray("4.2")
config/icon="res://icon.webp"
[debug]
gdscript/warnings/untyped_declaration=1
[display]
window/stretch/mode="canvas_items"

View File

@@ -10,7 +10,7 @@ extends Node3D
var xr_interface: MobileVRInterface
func _set_xr_mode() -> void:
var vrs_mode = get_viewport().vrs_mode
var vrs_mode := get_viewport().vrs_mode
if vrs_mode == Viewport.VRS_XR:
xr_interface = XRServer.find_interface("Native mobile")
if xr_interface and xr_interface.initialize():
@@ -34,7 +34,7 @@ func _set_xr_mode() -> void:
func _update_texture() -> void:
var vrs_mode = get_viewport().vrs_mode
var vrs_mode := get_viewport().vrs_mode
if vrs_mode == Viewport.VRS_DISABLED:
texture_rect.visible = false
elif vrs_mode == Viewport.VRS_TEXTURE:
@@ -52,7 +52,7 @@ func _update_texture() -> void:
func _ready() -> void:
var vrs_mode = get_viewport().vrs_mode
var vrs_mode := get_viewport().vrs_mode
option_button.selected = vrs_mode
_update_texture()

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://byr2ixl00dqdl"]
[gd_scene load_steps=16 format=3 uid="uid://byr2ixl00dqdl"]
[ext_resource type="Script" path="res://vrs.gd" id="1_5k5b8"]
[ext_resource type="Texture2D" uid="uid://dsdx5gplyr6or" path="res://vrs_texture.png" id="2_44sk1"]
@@ -19,6 +19,9 @@ tonemap_mode = 3
tonemap_white = 6.0
glow_enabled = true
[sub_resource type="BoxMesh" id="BoxMesh_t8cmv"]
size = Vector3(1024, 1, 1024)
[sub_resource type="BoxMesh" id="BoxMesh_ocds8"]
[sub_resource type="Gradient" id="Gradient_f30sk"]
@@ -72,6 +75,10 @@ fov = 50.0
[node name="XRCamera3D" type="XRCamera3D" parent="XROrigin3D"]
transform = Transform3D(0.92086, -0.232944, 0.312657, 0, 0.801902, 0.597456, -0.389894, -0.550173, 0.738439, 1.02558, 2.09094, 2.36376)
[node name="Ground" type="MeshInstance3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -4.65, 0)
mesh = SubResource("BoxMesh_t8cmv")
[node name="Boxes" type="Node3D" parent="."]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Boxes"]
@@ -908,6 +915,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1, 1, 0)
light_color = Color(1, 0.952941, 0.392157, 1)
shadow_enabled = true
shadow_bias = 0.03
omni_range = 20.0
[node name="CanvasLayer" type="CanvasLayer" parent="."]