From ab0816a44e8f444023a4a3f3839f96a550568005 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 27 Mar 2022 19:05:07 -0500 Subject: [PATCH 1/2] Rename RigidBody -> RigidDynamicBody --- 2d/dodge_the_creeps/Mob.gd | 2 +- 2d/dodge_the_creeps/Mob.tscn | 2 +- 2d/instancing/ball.tscn | 2 +- 2d/physics_platformer/README.md | 6 +++--- 2d/physics_platformer/background/Seesaw.tscn | 2 +- 2d/physics_platformer/enemy/Enemy.tscn | 2 +- 2d/physics_platformer/enemy/enemy.gd | 2 +- 2d/physics_platformer/platform/MovingPlatform.tscn | 2 +- 2d/physics_platformer/platform/moving_platform.gd | 2 +- 2d/physics_platformer/player/Bullet.tscn | 2 +- 2d/physics_platformer/player/Player.tscn | 2 +- 2d/physics_platformer/player/bullet.gd | 2 +- 2d/physics_platformer/player/player.gd | 2 +- 2d/physics_platformer/project.godot | 10 +++++----- 2d/physics_tests/tests/functional/test_character.gd | 2 +- .../tests/functional/test_character_pixels.tscn | 4 ++-- .../tests/functional/test_character_slopes.tscn | 4 ++-- .../tests/functional/test_character_tilemap.tscn | 4 ++-- .../tests/functional/test_one_way_collision.gd | 4 ++-- .../tests/functional/test_one_way_collision.tscn | 6 +++--- 2d/platformer/project.godot | 2 +- 2d/platformer/src/Objects/Bullet.gd | 2 +- 2d/platformer/src/Objects/Bullet.tscn | 2 +- 3d/ik/fps/simple_bullet.gd | 2 +- 3d/ik/fps/simple_bullet.tscn | 2 +- 3d/platformer/enemy/enemy.gd | 2 +- 3d/platformer/enemy/enemy.tscn | 2 +- 3d/platformer/player/bullet/bullet.gd | 2 +- 3d/platformer/player/bullet/bullet.tscn | 2 +- 3d/platformer/player/follow_camera.gd | 2 +- 3d/rigidbody_character/cube_rigidbody.tscn | 2 +- 3d/rigidbody_character/player/cubio.gd | 2 +- 3d/rigidbody_character/player/cubio.tscn | 2 +- 3d/rigidbody_character/project.godot | 2 +- 3d/truck_town/follow_camera.gd | 2 +- 3d/truck_town/tow_truck.tscn | 10 +++++----- mono/dodge_the_creeps/Mob.cs | 2 +- mono/dodge_the_creeps/Mob.tscn | 2 +- 38 files changed, 54 insertions(+), 54 deletions(-) diff --git a/2d/dodge_the_creeps/Mob.gd b/2d/dodge_the_creeps/Mob.gd index c62bf7c2..713906d3 100644 --- a/2d/dodge_the_creeps/Mob.gd +++ b/2d/dodge_the_creeps/Mob.gd @@ -1,4 +1,4 @@ -extends RigidBody2D +extends RigidDynamicBody2D func _ready(): $AnimatedSprite2D.playing = true diff --git a/2d/dodge_the_creeps/Mob.tscn b/2d/dodge_the_creeps/Mob.tscn index bc95b4ff..79b0e0fd 100644 --- a/2d/dodge_the_creeps/Mob.tscn +++ b/2d/dodge_the_creeps/Mob.tscn @@ -30,7 +30,7 @@ animations = [{ radius = 35.2706 height = 23.3281 -[node name="Mob" type="RigidBody2D" groups=["mobs"]] +[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]] collision_mask = 0 gravity_scale = 0.0 script = ExtResource( 1 ) diff --git a/2d/instancing/ball.tscn b/2d/instancing/ball.tscn index 552703a9..71796a40 100644 --- a/2d/instancing/ball.tscn +++ b/2d/instancing/ball.tscn @@ -8,7 +8,7 @@ bounce = 0.4 [sub_resource type="CircleShape2D" id=2] radius = 30.0 -[node name="Ball" type="RigidBody2D"] +[node name="Ball" type="RigidDynamicBody2D"] physics_material_override = SubResource( 1 ) [node name="Sprite2D" type="Sprite2D" parent="."] diff --git a/2d/physics_platformer/README.md b/2d/physics_platformer/README.md index e1e1a43c..c45c8f36 100644 --- a/2d/physics_platformer/README.md +++ b/2d/physics_platformer/README.md @@ -1,11 +1,11 @@ # Physics Platformer -This demo uses [`RigidBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigidbody2d.html) +This demo uses [`RigidDynamicBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigiddynamicbody2d.html) for the player and enemies. These character controllers are more powerful than [`KinematicBody2D`](https://docs.godotengine.org/en/latest/classes/class_kinematicbody2d.html), but can be more difficult to handle, as they require -manual modification of the RigidBody velocity. +manual modification of the RigidDynamicBody velocity. Language: GDScript @@ -17,7 +17,7 @@ Check out this demo on the asset library: https://godotengine.org/asset-library/ The player and enemies use dynamic character controllers for movement, made with -[`RigidBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigidbody2d.html), +[`RigidDynamicBody2D`](https://docs.godotengine.org/en/latest/classes/class_rigiddynamicbody2d.html), which means that they can perfectly interact with physics (there is a see-saw, and you can even ride enemies). Because of this, all movement must be done in sync with diff --git a/2d/physics_platformer/background/Seesaw.tscn b/2d/physics_platformer/background/Seesaw.tscn index fc97ab90..a1b5dc85 100644 --- a/2d/physics_platformer/background/Seesaw.tscn +++ b/2d/physics_platformer/background/Seesaw.tscn @@ -11,7 +11,7 @@ extents = Vector2(8, 13.5) [node name="Seesaw" type="Node2D"] -[node name="Plank" type="RigidBody2D" parent="."] +[node name="Plank" type="RigidDynamicBody2D" parent="."] mass = 5.10204 [node name="Sprite2D" type="Sprite2D" parent="Plank"] diff --git a/2d/physics_platformer/enemy/Enemy.tscn b/2d/physics_platformer/enemy/Enemy.tscn index 55880b01..62e1d618 100644 --- a/2d/physics_platformer/enemy/Enemy.tscn +++ b/2d/physics_platformer/enemy/Enemy.tscn @@ -106,7 +106,7 @@ radius = 7.0 offsets = PackedFloat32Array(0.5, 1) colors = PackedColorArray(1, 1, 1, 0.501961, 0, 0, 0, 0) -[node name="Enemy" type="RigidBody2D"] +[node name="Enemy" type="RigidDynamicBody2D"] mode = 2 physics_material_override = SubResource( 1 ) contacts_reported = 4 diff --git a/2d/physics_platformer/enemy/enemy.gd b/2d/physics_platformer/enemy/enemy.gd index e20f35f0..24749398 100644 --- a/2d/physics_platformer/enemy/enemy.gd +++ b/2d/physics_platformer/enemy/enemy.gd @@ -1,5 +1,5 @@ class_name Enemy -extends RigidBody2D +extends RigidDynamicBody2D const WALK_SPEED = 50 diff --git a/2d/physics_platformer/platform/MovingPlatform.tscn b/2d/physics_platformer/platform/MovingPlatform.tscn index 3843a340..1780ac7b 100644 --- a/2d/physics_platformer/platform/MovingPlatform.tscn +++ b/2d/physics_platformer/platform/MovingPlatform.tscn @@ -6,7 +6,7 @@ [node name="MovingPlatform" type="Node2D"] script = ExtResource( 1 ) -[node name="Platform" type="RigidBody2D" parent="."] +[node name="Platform" type="RigidDynamicBody2D" parent="."] mode = 3 [node name="Sprite2D" type="Sprite2D" parent="Platform"] diff --git a/2d/physics_platformer/platform/moving_platform.gd b/2d/physics_platformer/platform/moving_platform.gd index 13b5c4fe..8e0a8ce0 100644 --- a/2d/physics_platformer/platform/moving_platform.gd +++ b/2d/physics_platformer/platform/moving_platform.gd @@ -14,4 +14,4 @@ func _physics_process(delta): var xf = Transform2D() xf[2]= motion * d - ($Platform as RigidBody2D).transform = xf + ($Platform as RigidDynamicBody2D).transform = xf diff --git a/2d/physics_platformer/player/Bullet.tscn b/2d/physics_platformer/player/Bullet.tscn index 2acb7a79..7d0e79e8 100644 --- a/2d/physics_platformer/player/Bullet.tscn +++ b/2d/physics_platformer/player/Bullet.tscn @@ -50,7 +50,7 @@ tracks/2/keys = { "values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] } -[node name="Bullet" type="RigidBody2D"] +[node name="Bullet" type="RigidDynamicBody2D"] continuous_cd = 2 script = ExtResource( 1 ) diff --git a/2d/physics_platformer/player/Player.tscn b/2d/physics_platformer/player/Player.tscn index 7435cc38..930762cb 100644 --- a/2d/physics_platformer/player/Player.tscn +++ b/2d/physics_platformer/player/Player.tscn @@ -190,7 +190,7 @@ tracks/0/keys = { custom_solver_bias = 0.5 length = 18.0 -[node name="Player" type="RigidBody2D"] +[node name="Player" type="RigidDynamicBody2D"] mode = 2 mass = 1.5 physics_material_override = SubResource( 1 ) diff --git a/2d/physics_platformer/player/bullet.gd b/2d/physics_platformer/player/bullet.gd index 07e286bd..9b276daf 100644 --- a/2d/physics_platformer/player/bullet.gd +++ b/2d/physics_platformer/player/bullet.gd @@ -1,5 +1,5 @@ class_name Bullet -extends RigidBody2D +extends RigidDynamicBody2D var disabled = false diff --git a/2d/physics_platformer/player/player.gd b/2d/physics_platformer/player/player.gd index a94fc66c..9dcac2fb 100644 --- a/2d/physics_platformer/player/player.gd +++ b/2d/physics_platformer/player/player.gd @@ -1,5 +1,5 @@ class_name Player -extends RigidBody2D +extends RigidDynamicBody2D # Character Demo, written by Juan Linietsky. # diff --git a/2d/physics_platformer/project.godot b/2d/physics_platformer/project.godot index 453faa92..0e330a16 100644 --- a/2d/physics_platformer/project.godot +++ b/2d/physics_platformer/project.godot @@ -9,7 +9,7 @@ config_version=4 _global_script_classes=[{ -"base": "RigidBody2D", +"base": "RigidDynamicBody2D", "class": &"Bullet", "language": &"GDScript", "path": "res://player/bullet.gd" @@ -19,7 +19,7 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://coin/coin.gd" }, { -"base": "RigidBody2D", +"base": "RigidDynamicBody2D", "class": &"Enemy", "language": &"GDScript", "path": "res://enemy/enemy.gd" @@ -29,7 +29,7 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://platform/moving_platform.gd" }, { -"base": "RigidBody2D", +"base": "RigidDynamicBody2D", "class": &"Player", "language": &"GDScript", "path": "res://player/player.gd" @@ -45,10 +45,10 @@ _global_script_class_icons={ [application] config/name="Physics-Based Platformer 2D" -config/description="This demo uses RigidBody2D for the player and enemies. These +config/description="This demo uses RigidDynamicBody2D for the player and enemies. These character controllers are more powerful than CharacterBody2D, but can be more difficult to handle, as they require -manual modification of the RigidBody3D velocity." +manual modification of the RigidDynamicBody3D velocity." run/main_scene="res://Stage.tscn" config/icon="res://icon.png" diff --git a/2d/physics_tests/tests/functional/test_character.gd b/2d/physics_tests/tests/functional/test_character.gd index d27fd02d..1fda3905 100644 --- a/2d/physics_tests/tests/functional/test_character.gd +++ b/2d/physics_tests/tests/functional/test_character.gd @@ -61,7 +61,7 @@ func _ready(): var enabled = _body_type == E_BodyType.CHARACTER_BODY_RAY options.add_menu_item(OPTION_OBJECT_TYPE_CHARACTER_RAY, true, enabled, true) - _rigid_body_template = find_node("RigidBody2D") + _rigid_body_template = find_node("RigidDynamicBody2D") if _rigid_body_template: _body_parent = _rigid_body_template.get_parent() _body_parent.remove_child(_rigid_body_template) diff --git a/2d/physics_tests/tests/functional/test_character_pixels.tscn b/2d/physics_tests/tests/functional/test_character_pixels.tscn index 609026a4..f17bdd80 100644 --- a/2d/physics_tests/tests/functional/test_character_pixels.tscn +++ b/2d/physics_tests/tests/functional/test_character_pixels.tscn @@ -74,7 +74,7 @@ shape = SubResource( "RectangleShape2D_scs3g" ) position = Vector2(0, -2) shape = SubResource( "SeparationRayShape2D_vby12" ) -[node name="RigidBody2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"] +[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"] position = Vector2(30, 40) collision_mask = 2147483649 physics_material_override = SubResource( "1" ) @@ -83,7 +83,7 @@ contact_monitor = true lock_rotation = true script = ExtResource( "2" ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="ViewportContainer/Viewport/RigidDynamicBody2D"] shape = SubResource( "2" ) [node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="ViewportContainer/Viewport"] diff --git a/2d/physics_tests/tests/functional/test_character_slopes.tscn b/2d/physics_tests/tests/functional/test_character_slopes.tscn index 4c0338ae..8775a680 100644 --- a/2d/physics_tests/tests/functional/test_character_slopes.tscn +++ b/2d/physics_tests/tests/functional/test_character_slopes.tscn @@ -123,7 +123,7 @@ shape = SubResource( "CircleShape2D_llvur" ) position = Vector2(0, -16) shape = SubResource( "RayShape2D_3lv1w" ) -[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."] +[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."] position = Vector2(100, 450) collision_mask = 2147483649 physics_material_override = SubResource( "1" ) @@ -132,7 +132,7 @@ contact_monitor = true lock_rotation = true script = ExtResource( "6" ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"] shape = SubResource( "2" ) [node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="."] diff --git a/2d/physics_tests/tests/functional/test_character_tilemap.tscn b/2d/physics_tests/tests/functional/test_character_tilemap.tscn index 0fb1d785..63b07d1a 100644 --- a/2d/physics_tests/tests/functional/test_character_tilemap.tscn +++ b/2d/physics_tests/tests/functional/test_character_tilemap.tscn @@ -87,7 +87,7 @@ shape = SubResource( "RayShape2D_206f5" ) position = Vector2(12, 8) shape = SubResource( "RayShape2D_206f5" ) -[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."] +[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."] position = Vector2(250, 460) collision_mask = 2147483649 physics_material_override = SubResource( "1" ) @@ -96,7 +96,7 @@ contact_monitor = true lock_rotation = true script = ExtResource( "6" ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"] shape = SubResource( "2" ) [node name="RigidBodyRay2D" type="RigidDynamicBody2D" parent="."] diff --git a/2d/physics_tests/tests/functional/test_one_way_collision.gd b/2d/physics_tests/tests/functional/test_one_way_collision.gd index 4c61a455..f70c78da 100644 --- a/2d/physics_tests/tests/functional/test_one_way_collision.gd +++ b/2d/physics_tests/tests/functional/test_one_way_collision.gd @@ -91,7 +91,7 @@ func _ready(): _target_area.connect(&"body_entered", Callable(self, "_on_target_entered")) $Timer.connect(&"timeout", Callable(self, "_on_timeout")) - _rigid_body_template = $RigidBody2D + _rigid_body_template = $RigidDynamicBody2D remove_child(_rigid_body_template) _character_body_template = $CharacterBody2D @@ -190,7 +190,7 @@ func _update_rigidbody_angle(value, reset = true): _body_angle = value if is_inside_tree(): if Engine.is_editor_hint(): - $RigidBody2D.rotation = deg2rad(value) + $RigidDynamicBody2D.rotation = deg2rad(value) $CharacterBody2D.rotation = deg2rad(value) else: if _moving_body: diff --git a/2d/physics_tests/tests/functional/test_one_way_collision.tscn b/2d/physics_tests/tests/functional/test_one_way_collision.tscn index af3c2727..6293aede 100644 --- a/2d/physics_tests/tests/functional/test_one_way_collision.tscn +++ b/2d/physics_tests/tests/functional/test_one_way_collision.tscn @@ -205,19 +205,19 @@ position = Vector2(512, 300) shape = SubResource( "2" ) one_way_collision = true -[node name="RigidBody2D" type="RigidDynamicBody2D" parent="."] +[node name="RigidDynamicBody2D" type="RigidDynamicBody2D" parent="."] position = Vector2(300, 300) collision_mask = 2147483649 gravity_scale = 0.0 contacts_reported = 1 contact_monitor = true -[node name="Sprite" type="Sprite2D" parent="RigidBody2D"] +[node name="Sprite" type="Sprite2D" parent="RigidDynamicBody2D"] self_modulate = Color(1, 1, 1, 0.501961) scale = Vector2(0.5, 0.5) texture = ExtResource( "2" ) -[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidBody2D"] +[node name="CollisionShape2D" type="CollisionShape2D" parent="RigidDynamicBody2D"] shape = SubResource( "3" ) [node name="CharacterBody2D" type="CharacterBody2D" parent="."] diff --git a/2d/platformer/project.godot b/2d/platformer/project.godot index 5e026a95..5308ac85 100644 --- a/2d/platformer/project.godot +++ b/2d/platformer/project.godot @@ -14,7 +14,7 @@ _global_script_classes=[{ "language": &"GDScript", "path": "res://src/Actors/Actor.gd" }, { -"base": "RigidBody2D", +"base": "RigidDynamicBody2D", "class": &"Bullet", "language": &"GDScript", "path": "res://src/Objects/Bullet.gd" diff --git a/2d/platformer/src/Objects/Bullet.gd b/2d/platformer/src/Objects/Bullet.gd index 7b35e9fe..adbfd078 100644 --- a/2d/platformer/src/Objects/Bullet.gd +++ b/2d/platformer/src/Objects/Bullet.gd @@ -1,5 +1,5 @@ class_name Bullet -extends RigidBody2D +extends RigidDynamicBody2D @onready var animation_player = $AnimationPlayer diff --git a/2d/platformer/src/Objects/Bullet.tscn b/2d/platformer/src/Objects/Bullet.tscn index 15c4937b..bb98800c 100644 --- a/2d/platformer/src/Objects/Bullet.tscn +++ b/2d/platformer/src/Objects/Bullet.tscn @@ -55,7 +55,7 @@ tracks/2/keys = { "values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)] } -[node name="Bullet" type="RigidBody2D"] +[node name="Bullet" type="RigidDynamicBody2D"] material = SubResource( 1 ) collision_layer = 0 collision_mask = 26 diff --git a/3d/ik/fps/simple_bullet.gd b/3d/ik/fps/simple_bullet.gd index 805d36d0..16b50d23 100644 --- a/3d/ik/fps/simple_bullet.gd +++ b/3d/ik/fps/simple_bullet.gd @@ -1,4 +1,4 @@ -extends RigidBody3D +extends RigidDynamicBody3D const DESPAWN_TIME = 5 diff --git a/3d/ik/fps/simple_bullet.tscn b/3d/ik/fps/simple_bullet.tscn index 88e3e9df..e40a833d 100644 --- a/3d/ik/fps/simple_bullet.tscn +++ b/3d/ik/fps/simple_bullet.tscn @@ -18,7 +18,7 @@ emission_on_uv2 = false [sub_resource type="SphereShape3D" id=4] radius = 0.4 -[node name="SimpleBullet" type="RigidBody3D"] +[node name="SimpleBullet" type="RigidDynamicBody3D"] mass = 2.0 physics_material_override = SubResource( 1 ) gravity_scale = 3.0 diff --git a/3d/platformer/enemy/enemy.gd b/3d/platformer/enemy/enemy.gd index de79a7a7..a81834be 100644 --- a/3d/platformer/enemy/enemy.gd +++ b/3d/platformer/enemy/enemy.gd @@ -1,4 +1,4 @@ -extends RigidBody3D +extends RigidDynamicBody3D const ACCEL = 5.0 const DEACCEL = 20.0 diff --git a/3d/platformer/enemy/enemy.tscn b/3d/platformer/enemy/enemy.tscn index fd467375..a2fb715e 100644 --- a/3d/platformer/enemy/enemy.tscn +++ b/3d/platformer/enemy/enemy.tscn @@ -484,7 +484,7 @@ material = SubResource( 15 ) max_value = 3.0 _data = [Vector2(0, 1), 0.0, 0.0, 0, 0, Vector2(0.0349232, 2.1123), 0.0, 0.0, 0, 0, Vector2(0.151192, 0.823242), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0] -[node name="Enemy" type="RigidBody3D"] +[node name="Enemy" type="RigidDynamicBody3D"] mode = 2 physics_material_override = SubResource( 1 ) custom_integrator = true diff --git a/3d/platformer/player/bullet/bullet.gd b/3d/platformer/player/bullet/bullet.gd index fc211e40..8ce60ad9 100644 --- a/3d/platformer/player/bullet/bullet.gd +++ b/3d/platformer/player/bullet/bullet.gd @@ -1,4 +1,4 @@ -extends RigidBody3D +extends RigidDynamicBody3D #warning-ignore:unused_class_variable var enabled = true diff --git a/3d/platformer/player/bullet/bullet.tscn b/3d/platformer/player/bullet/bullet.tscn index f3771ebc..5f5139cf 100644 --- a/3d/platformer/player/bullet/bullet.tscn +++ b/3d/platformer/player/bullet/bullet.tscn @@ -82,7 +82,7 @@ colors = PackedColorArray(1, 1, 1, 1, 1, 1, 1, 0) [sub_resource type="SphereShape3D" id=6] radius = 0.27 -[node name="Bullet" type="RigidBody3D"] +[node name="Bullet" type="RigidDynamicBody3D"] mass = 0.4 script = ExtResource( 1 ) __meta__ = { diff --git a/3d/platformer/player/follow_camera.gd b/3d/platformer/player/follow_camera.gd index 7422164b..cf120f6e 100644 --- a/3d/platformer/player/follow_camera.gd +++ b/3d/platformer/player/follow_camera.gd @@ -15,7 +15,7 @@ func _ready(): # Find collision exceptions for ray. var node = self while node: - if node is RigidBody3D: + if node is RigidDynamicBody3D: collision_exception.append(node.get_rid()) break else: diff --git a/3d/rigidbody_character/cube_rigidbody.tscn b/3d/rigidbody_character/cube_rigidbody.tscn index 608a5778..fc0dcf40 100644 --- a/3d/rigidbody_character/cube_rigidbody.tscn +++ b/3d/rigidbody_character/cube_rigidbody.tscn @@ -15,7 +15,7 @@ roughness = 0.75 material = SubResource( 3 ) size = Vector3(1, 1, 1) -[node name="cube_rigidbody" type="RigidBody3D"] +[node name="cube_rigidbody" type="RigidDynamicBody3D"] [node name="CollisionShape3D" type="CollisionShape3D" parent="."] shape = SubResource( 1 ) diff --git a/3d/rigidbody_character/player/cubio.gd b/3d/rigidbody_character/player/cubio.gd index 17b30064..5502acff 100644 --- a/3d/rigidbody_character/player/cubio.gd +++ b/3d/rigidbody_character/player/cubio.gd @@ -1,4 +1,4 @@ -extends RigidBody3D +extends RigidDynamicBody3D @onready var raycast = $RayCast3D @onready var camera = $Target/Camera3D diff --git a/3d/rigidbody_character/player/cubio.tscn b/3d/rigidbody_character/player/cubio.tscn index b1732b5e..f3e9487f 100644 --- a/3d/rigidbody_character/player/cubio.tscn +++ b/3d/rigidbody_character/player/cubio.tscn @@ -12,7 +12,7 @@ mid_height = 0.7 radius = 0.5 height = 0.7 -[node name="RigidBody3D" type="RigidBody3D"] +[node name="RigidDynamicBody3D" type="RigidDynamicBody3D"] can_sleep = false axis_lock_angular_x = true axis_lock_angular_y = true diff --git a/3d/rigidbody_character/project.godot b/3d/rigidbody_character/project.godot index b6908638..43029675 100644 --- a/3d/rigidbody_character/project.godot +++ b/3d/rigidbody_character/project.godot @@ -10,7 +10,7 @@ config_version=4 [application] -config/name="RigidBody3D Character 3D" +config/name="RigidDynamicBody3D Character 3D" config/description="Rigidbody character demo for 3D using a capsule for the character. " run/main_scene="res://level.tscn" diff --git a/3d/truck_town/follow_camera.gd b/3d/truck_town/follow_camera.gd index 067ec0db..be02792d 100644 --- a/3d/truck_town/follow_camera.gd +++ b/3d/truck_town/follow_camera.gd @@ -11,7 +11,7 @@ func _ready(): # Find collision exceptions for ray. var node = self while(node): - if (node is RigidBody3D): + if (node is RigidDynamicBody3D): collision_exception.append(node.get_rid()) break else: diff --git a/3d/truck_town/tow_truck.tscn b/3d/truck_town/tow_truck.tscn index 105585b2..6fe0a5b0 100644 --- a/3d/truck_town/tow_truck.tscn +++ b/3d/truck_town/tow_truck.tscn @@ -347,7 +347,7 @@ shape = SubResource( 6 ) [node name="AnimationPlayer" type="AnimationPlayer" parent="."] _import_path = NodePath("AnimationPlayer") -[node name="ChainB1" type="RigidBody3D" parent="."] +[node name="ChainB1" type="RigidDynamicBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 1.12554, -1.54623) [node name="Chain1" type="MeshInstance3D" parent="ChainB1"] @@ -361,7 +361,7 @@ surface_material_override/0 = null transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) shape = SubResource( 8 ) -[node name="ChainB2" type="RigidBody3D" parent="."] +[node name="ChainB2" type="RigidDynamicBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.803378, -1.75806) [node name="Chain1" type="MeshInstance3D" parent="ChainB2"] @@ -375,7 +375,7 @@ surface_material_override/0 = null transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) shape = SubResource( 8 ) -[node name="ChainB3" type="RigidBody3D" parent="."] +[node name="ChainB3" type="RigidDynamicBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.846248, -0.53279, 0, 0.53279, 0.846248, 0, 0.490045, -1.96106) [node name="Chain1" type="MeshInstance3D" parent="ChainB3"] @@ -389,7 +389,7 @@ surface_material_override/0 = null transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) shape = SubResource( 8 ) -[node name="ChainB4" type="RigidBody3D" parent="."] +[node name="ChainB4" type="RigidDynamicBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.447167, -0.894451, 0, 0.894451, 0.447167, 0, 0.290326, -2.19413) [node name="Chain1" type="MeshInstance3D" parent="ChainB4"] @@ -403,7 +403,7 @@ surface_material_override/0 = null transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0) shape = SubResource( 8 ) -[node name="ChainB5" type="RigidBody3D" parent="."] +[node name="ChainB5" type="RigidDynamicBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 0.0993884, -0.995049, 0, 0.995049, 0.0993884, 0, 0.205717, -2.50193) [node name="Chain1" type="MeshInstance3D" parent="ChainB5"] diff --git a/mono/dodge_the_creeps/Mob.cs b/mono/dodge_the_creeps/Mob.cs index fbdccaf6..dd41479e 100644 --- a/mono/dodge_the_creeps/Mob.cs +++ b/mono/dodge_the_creeps/Mob.cs @@ -1,6 +1,6 @@ using Godot; -public partial class Mob : RigidBody2D +public partial class Mob : RigidDynamicBody2D { public override void _Ready() { diff --git a/mono/dodge_the_creeps/Mob.tscn b/mono/dodge_the_creeps/Mob.tscn index 4645cdfd..12cf83e0 100644 --- a/mono/dodge_the_creeps/Mob.tscn +++ b/mono/dodge_the_creeps/Mob.tscn @@ -30,7 +30,7 @@ animations = [{ radius = 35.8898 height = 29.3103 -[node name="Mob" type="RigidBody2D" groups=["mobs"]] +[node name="Mob" type="RigidDynamicBody2D" groups=["mobs"]] collision_mask = 0 gravity_scale = 0.0 script = ExtResource( 1 ) From cb528780060c6e1819fc71053cb3ad4ce5324747 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sun, 27 Mar 2022 19:19:09 -0500 Subject: [PATCH 2/2] Use StringName literals with Input methods --- 2d/dodge_the_creeps/Player.gd | 8 ++--- .../player/states/motion/on_ground/move.gd | 2 +- 2d/kinematic_character/player/player.gd | 2 +- 2d/physics_platformer/player/player.gd | 10 +++---- .../functional/test_one_way_collision.gd | 2 +- 2d/physics_tests/tests_menu.gd | 2 +- .../utils/characterbody_controller.gd | 6 ++-- .../utils/rigidbody_controller.gd | 6 ++-- 2d/physics_tests/utils/system.gd | 8 ++--- 2d/skeleton/player/player.gd | 4 +-- 3d/ik/addons/sade/ik_fabrik.gd | 6 ++-- 3d/ik/addons/sade/ik_look_at.gd | 2 +- 3d/ik/fps/example_player.gd | 2 +- 3d/kinematic_character/player/cubio.gd | 6 ++-- 3d/physics_tests/tests_menu.gd | 2 +- 3d/physics_tests/utils/system.gd | 8 ++--- 3d/platformer/player/player.gd | 4 +-- 3d/rigidbody_character/player/cubio.gd | 6 ++-- 3d/truck_town/car_select.gd | 4 +-- 3d/truck_town/vehicle.gd | 4 +-- 3d/voxel/menu/debug.gd | 2 +- 3d/voxel/menu/ingame/pause_menu.gd | 2 +- 3d/voxel/player/player.gd | 14 ++++----- audio/midi_piano/piano.gd | 2 +- misc/2.5d/addons/node25d/node_25d.gd | 12 ++++---- misc/2.5d/assets/cube/cube_math.gd | 6 ++-- misc/2.5d/assets/platform/platform_sprite.gd | 12 ++++---- misc/2.5d/assets/player/player_math_25d.gd | 14 ++++----- misc/2.5d/assets/player/player_sprite.gd | 30 +++++++++---------- misc/2.5d/assets/shadow/shadow_sprite.gd | 12 ++++---- misc/2.5d/assets/ui/control_hints.gd | 2 +- misc/window_management/control.gd | 6 ++-- mono/2.5d/assets/platform/platform_sprite.gd | 12 ++++---- mono/2.5d/assets/shadow/shadow_sprite.gd | 12 ++++---- mono/2.5d/assets/ui/control_hints.gd | 2 +- networking/multiplayer_bomber/player.gd | 10 +++---- viewport/2d_in_3d/pong.gd | 8 ++--- 37 files changed, 126 insertions(+), 126 deletions(-) diff --git a/2d/dodge_the_creeps/Player.gd b/2d/dodge_the_creeps/Player.gd index 2a8998e2..5565c822 100644 --- a/2d/dodge_the_creeps/Player.gd +++ b/2d/dodge_the_creeps/Player.gd @@ -12,13 +12,13 @@ func _ready(): func _process(delta): var velocity = Vector2.ZERO # The player's movement vector. - if Input.is_action_pressed("move_right"): + if Input.is_action_pressed(&"move_right"): velocity.x += 1 - if Input.is_action_pressed("move_left"): + if Input.is_action_pressed(&"move_left"): velocity.x -= 1 - if Input.is_action_pressed("move_down"): + if Input.is_action_pressed(&"move_down"): velocity.y += 1 - if Input.is_action_pressed("move_up"): + if Input.is_action_pressed(&"move_up"): velocity.y -= 1 if velocity.length() > 0: diff --git a/2d/finite_state_machine/player/states/motion/on_ground/move.gd b/2d/finite_state_machine/player/states/motion/on_ground/move.gd index 36ba9482..5bdca0d2 100644 --- a/2d/finite_state_machine/player/states/motion/on_ground/move.gd +++ b/2d/finite_state_machine/player/states/motion/on_ground/move.gd @@ -22,7 +22,7 @@ func update(_delta): emit_signal("finished", "idle") update_look_direction(input_direction) - if Input.is_action_pressed("run"): + if Input.is_action_pressed(&"run"): speed = max_run_speed else: speed = max_walk_speed diff --git a/2d/kinematic_character/player/player.gd b/2d/kinematic_character/player/player.gd index aa1dc950..b9869ead 100644 --- a/2d/kinematic_character/player/player.gd +++ b/2d/kinematic_character/player/player.gd @@ -30,5 +30,5 @@ func _physics_process(delta): move_and_slide() # Check for jumping. is_on_floor() must be called after movement code. - if is_on_floor() and Input.is_action_just_pressed("jump"): + if is_on_floor() and Input.is_action_just_pressed(&"jump"): velocity.y = -JUMP_SPEED diff --git a/2d/physics_platformer/player/player.gd b/2d/physics_platformer/player/player.gd index 9dcac2fb..14abc8b1 100644 --- a/2d/physics_platformer/player/player.gd +++ b/2d/physics_platformer/player/player.gd @@ -62,11 +62,11 @@ func _integrate_forces(s): var new_siding_left = siding_left # Get player input. - var move_left = Input.is_action_pressed("move_left") - var move_right = Input.is_action_pressed("move_right") - var jump = Input.is_action_pressed("jump") - var shoot = Input.is_action_pressed("shoot") - var spawn = Input.is_action_pressed("spawn") + var move_left = Input.is_action_pressed(&"move_left") + var move_right = Input.is_action_pressed(&"move_right") + var jump = Input.is_action_pressed(&"jump") + var shoot = Input.is_action_pressed(&"shoot") + var spawn = Input.is_action_pressed(&"spawn") if spawn: call_deferred("_spawn_enemy_above") diff --git a/2d/physics_tests/tests/functional/test_one_way_collision.gd b/2d/physics_tests/tests/functional/test_one_way_collision.gd index f70c78da..4a108759 100644 --- a/2d/physics_tests/tests/functional/test_one_way_collision.gd +++ b/2d/physics_tests/tests/functional/test_one_way_collision.gd @@ -105,7 +105,7 @@ func _ready(): func _process(_delta): if not Engine.is_editor_hint(): - if Input.is_action_just_pressed("ui_accept"): + if Input.is_action_just_pressed(&"ui_accept"): await _reset_test(false) diff --git a/2d/physics_tests/tests_menu.gd b/2d/physics_tests/tests_menu.gd index 958d1847..a428c253 100644 --- a/2d/physics_tests/tests_menu.gd +++ b/2d/physics_tests/tests_menu.gd @@ -17,7 +17,7 @@ func _ready(): func _process(_delta): - if Input.is_action_just_pressed("restart_test"): + if Input.is_action_just_pressed(&"restart_test"): if _current_test: _start_test(_current_test) diff --git a/2d/physics_tests/utils/characterbody_controller.gd b/2d/physics_tests/utils/characterbody_controller.gd index d4f5dc1f..60c3fd87 100644 --- a/2d/physics_tests/utils/characterbody_controller.gd +++ b/2d/physics_tests/utils/characterbody_controller.gd @@ -27,12 +27,12 @@ func _physics_process(_delta): _velocity.x = 0.0 # Handle horizontal controls. - if Input.is_action_pressed("character_left"): + if Input.is_action_pressed(&"character_left"): if position.x > 0.0: _velocity.x = -_motion_speed _keep_velocity = false _constant_velocity = Vector2.ZERO - elif Input.is_action_pressed("character_right"): + elif Input.is_action_pressed(&"character_right"): if position.x < 1024.0: _velocity.x = _motion_speed _keep_velocity = false @@ -40,7 +40,7 @@ func _physics_process(_delta): # Handle jump controls and gravity. if is_on_floor(): - if not _jumping and Input.is_action_just_pressed("character_jump"): + if not _jumping and Input.is_action_just_pressed(&"character_jump"): # Start jumping. _jumping = true _velocity.y = -_jump_force diff --git a/2d/physics_tests/utils/rigidbody_controller.gd b/2d/physics_tests/utils/rigidbody_controller.gd index 4e3fa97f..1616686c 100644 --- a/2d/physics_tests/utils/rigidbody_controller.gd +++ b/2d/physics_tests/utils/rigidbody_controller.gd @@ -27,12 +27,12 @@ func _physics_process(_delta): _velocity.x = 0.0 # Handle horizontal controls. - if Input.is_action_pressed("character_left"): + if Input.is_action_pressed(&"character_left"): if position.x > 0.0: _velocity.x = -_motion_speed _keep_velocity = false _constant_velocity = Vector2.ZERO - elif Input.is_action_pressed("character_right"): + elif Input.is_action_pressed(&"character_right"): if position.x < 1024.0: _velocity.x = _motion_speed _keep_velocity = false @@ -40,7 +40,7 @@ func _physics_process(_delta): # Handle jump controls and gravity. if is_on_floor(): - if not _jumping and Input.is_action_just_pressed("character_jump"): + if not _jumping and Input.is_action_just_pressed(&"character_jump"): # Start jumping. _jumping = true _velocity.y = -_jump_force diff --git a/2d/physics_tests/utils/system.gd b/2d/physics_tests/utils/system.gd index 3ec03167..c443332b 100644 --- a/2d/physics_tests/utils/system.gd +++ b/2d/physics_tests/utils/system.gd @@ -25,13 +25,13 @@ func _enter_tree(): func _process(_delta): - if Input.is_action_just_pressed("toggle_full_screen"): + if Input.is_action_just_pressed(&"toggle_full_screen"): if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) else: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) - if Input.is_action_just_pressed("toggle_debug_collision"): + if Input.is_action_just_pressed(&"toggle_debug_collision"): var debug_collision_enabled = not _is_debug_collision_enabled() _set_debug_collision_enabled(debug_collision_enabled) if debug_collision_enabled: @@ -39,10 +39,10 @@ func _process(_delta): else: Log.print_log("Debug Collision OFF") - if Input.is_action_just_pressed("toggle_pause"): + if Input.is_action_just_pressed(&"toggle_pause"): get_tree().paused = not get_tree().paused - if Input.is_action_just_pressed("exit"): + if Input.is_action_just_pressed(&"exit"): get_tree().quit() diff --git a/2d/skeleton/player/player.gd b/2d/skeleton/player/player.gd index 3b091573..adf0ef4a 100644 --- a/2d/skeleton/player/player.gd +++ b/2d/skeleton/player/player.gd @@ -33,7 +33,7 @@ func _physics_process(delta): no_move_horizontal_time -= delta else: velocity.x = (Input.get_axis(&"move_left", &"move_right")) * speed.x - if Input.is_action_pressed("walk"): + if Input.is_action_pressed(&"walk"): velocity.x *= 0.2 #warning-ignore:return_value_discarded # TODO: This information should be set to the CharacterBody properties instead of arguments: , Vector2.UP @@ -58,7 +58,7 @@ func _physics_process(delta): elif falling_slow: $AnimationTree["parameters/land/active"] = true falling_slow = false - if Input.is_action_just_pressed("jump"): + if Input.is_action_just_pressed(&"jump"): $AnimationTree["parameters/jump/active"] = true velocity.y = -speed.y if abs(velocity.x) > 50: diff --git a/3d/ik/addons/sade/ik_fabrik.gd b/3d/ik/addons/sade/ik_fabrik.gd index 87959dd9..f6756610 100644 --- a/3d/ik/addons/sade/ik_fabrik.gd +++ b/3d/ik/addons/sade/ik_fabrik.gd @@ -71,7 +71,7 @@ func _ready(): if get_tree().edited_scene_root != null: target.set_owner(get_tree().edited_scene_root) - target.name = "Target" + target.name = &"Target" else: target = $Target @@ -89,7 +89,7 @@ func _ready(): if get_tree().edited_scene_root != null: middle_joint_target.set_owner(get_tree().edited_scene_root) - middle_joint_target.name = "MiddleJoint" + middle_joint_target.name = &"MiddleJoint" else: middle_joint_target = get_node(^"MiddleJoint") @@ -366,7 +366,7 @@ func _make_editor_sphere_at_node(node, color): # Add it as our child, and name it var indicator = MeshInstance3D.new() node.add_child(indicator) - indicator.name = "(EditorOnly) Visual indicator" + indicator.name = &"(EditorOnly) Visual indicator" # We need to make a mesh for the mesh instance. # The code below makes a small sphere mesh diff --git a/3d/ik/addons/sade/ik_look_at.gd b/3d/ik/addons/sade/ik_look_at.gd index 343c180a..f316cfc0 100644 --- a/3d/ik/addons/sade/ik_look_at.gd +++ b/3d/ik/addons/sade/ik_look_at.gd @@ -142,7 +142,7 @@ func _setup_for_editor(): # add it as a child of this node, and name it. _editor_indicator = MeshInstance3D.new() add_child(_editor_indicator) - _editor_indicator.name = "(EditorOnly) Visual indicator" + _editor_indicator.name = &"(EditorOnly) Visual indicator" # Make a sphere mesh for the MeshInstance3D var indicator_mesh = SphereMesh.new() diff --git a/3d/ik/fps/example_player.gd b/3d/ik/fps/example_player.gd index 68660d50..b3e74338 100644 --- a/3d/ik/fps/example_player.gd +++ b/3d/ik/fps/example_player.gd @@ -87,7 +87,7 @@ func process_input(delta): if Input.is_key_pressed(KEY_RIGHT) or Input.is_key_pressed(KEY_D): dir += cam_xform.basis[0] - if Input.is_action_just_pressed("ui_cancel"): + if Input.is_action_just_pressed(&"ui_cancel"): if Input.get_mouse_mode() == Input.MOUSE_MODE_VISIBLE: Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED) else: diff --git a/3d/kinematic_character/player/cubio.gd b/3d/kinematic_character/player/cubio.gd index d247e274..dc37adb8 100644 --- a/3d/kinematic_character/player/cubio.gd +++ b/3d/kinematic_character/player/cubio.gd @@ -11,9 +11,9 @@ const DECELERATION = 4 var velocity: Vector3 func _physics_process(delta): - if Input.is_action_just_pressed("exit"): + if Input.is_action_just_pressed(&"exit"): get_tree().quit() - if Input.is_action_just_pressed("reset_position"): + if Input.is_action_just_pressed(&"reset_position"): position = start_position var dir = Vector3() @@ -55,7 +55,7 @@ func _physics_process(delta): # TODO: This information should be set to the CharacterBody properties instead of arguments. # Jumping code. is_on_floor() must come after move_and_slide(). - if is_on_floor() and Input.is_action_pressed("jump"): + if is_on_floor() and Input.is_action_pressed(&"jump"): velocity.y = JUMP_SPEED diff --git a/3d/physics_tests/tests_menu.gd b/3d/physics_tests/tests_menu.gd index 16290d7c..7e71c916 100644 --- a/3d/physics_tests/tests_menu.gd +++ b/3d/physics_tests/tests_menu.gd @@ -17,7 +17,7 @@ func _ready(): func _process(_delta): - if Input.is_action_just_pressed("restart_test"): + if Input.is_action_just_pressed(&"restart_test"): if _current_test: _start_test(_current_test) diff --git a/3d/physics_tests/utils/system.gd b/3d/physics_tests/utils/system.gd index 70e7704b..e74b5c8c 100644 --- a/3d/physics_tests/utils/system.gd +++ b/3d/physics_tests/utils/system.gd @@ -28,13 +28,13 @@ func _enter_tree(): func _process(_delta): - if Input.is_action_just_pressed("toggle_full_screen"): + if Input.is_action_just_pressed(&"toggle_full_screen"): if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_FULLSCREEN: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED) else: DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN) - if Input.is_action_just_pressed("toggle_debug_collision"): + if Input.is_action_just_pressed(&"toggle_debug_collision"): var debug_collision_enabled = not _is_debug_collision_enabled() _set_debug_collision_enabled(debug_collision_enabled) if debug_collision_enabled: @@ -42,10 +42,10 @@ func _process(_delta): else: Log.print_log("Debug Collision OFF") - if Input.is_action_just_pressed("toggle_pause"): + if Input.is_action_just_pressed(&"toggle_pause"): get_tree().paused = not get_tree().paused - if Input.is_action_just_pressed("exit"): + if Input.is_action_just_pressed(&"exit"): get_tree().quit() diff --git a/3d/platformer/player/player.gd b/3d/platformer/player/player.gd index 32121a71..89406d96 100644 --- a/3d/platformer/player/player.gd +++ b/3d/platformer/player/player.gd @@ -49,8 +49,8 @@ func _physics_process(delta): dir.y = 0 dir = dir.normalized() - var jump_attempt = Input.is_action_pressed("jump") - var shoot_attempt = Input.is_action_pressed("shoot") + var jump_attempt = Input.is_action_pressed(&"jump") + var shoot_attempt = Input.is_action_pressed(&"shoot") if is_on_floor(): var sharp_turn = hspeed > 0.1 and rad2deg(acos(dir.dot(hdir))) > SHARP_TURN_THRESHOLD diff --git a/3d/rigidbody_character/player/cubio.gd b/3d/rigidbody_character/player/cubio.gd index 5502acff..014ddc88 100644 --- a/3d/rigidbody_character/player/cubio.gd +++ b/3d/rigidbody_character/player/cubio.gd @@ -5,9 +5,9 @@ extends RigidDynamicBody3D @onready var start_position = position func _physics_process(_delta): - if Input.is_action_just_pressed("exit"): + if Input.is_action_just_pressed(&"exit"): get_tree().quit() - if Input.is_action_just_pressed("reset_position"): + if Input.is_action_just_pressed(&"reset_position"): position = start_position return @@ -24,7 +24,7 @@ func _physics_process(_delta): apply_central_impulse(dir.normalized() / 10) # Jumping code. - if on_ground() and Input.is_action_pressed("jump"): + if on_ground() and Input.is_action_pressed(&"jump"): apply_central_impulse(Vector3.UP) diff --git a/3d/truck_town/car_select.gd b/3d/truck_town/car_select.gd index 6af7f53f..68fb4af0 100644 --- a/3d/truck_town/car_select.gd +++ b/3d/truck_town/car_select.gd @@ -3,13 +3,13 @@ extends Control var town = null func _process(_delta): - if Input.is_action_just_pressed("back"): + if Input.is_action_just_pressed(&"back"): _on_Back_pressed() func _load_scene(car): var tt = load(car).instantiate() - tt.set_name("car") + tt.name = &"car" town = load("res://town_scene.tscn").instantiate() town.get_node(^"InstancePos").add_child(tt) town.get_node(^"Back").connect(&"pressed", self._on_Back_pressed) diff --git a/3d/truck_town/vehicle.gd b/3d/truck_town/vehicle.gd index 0b6f8bee..07e9cd81 100644 --- a/3d/truck_town/vehicle.gd +++ b/3d/truck_town/vehicle.gd @@ -13,7 +13,7 @@ func _physics_process(delta): steer_target = Input.get_axis(&"turn_right", &"turn_left") steer_target *= STEER_LIMIT - if Input.is_action_pressed("accelerate"): + if Input.is_action_pressed(&"accelerate"): # Increase engine force at low speeds to make the initial acceleration faster. var speed = linear_velocity.length() if speed < 5 and speed != 0: @@ -23,7 +23,7 @@ func _physics_process(delta): else: engine_force = 0 - if Input.is_action_pressed("reverse"): + if Input.is_action_pressed(&"reverse"): # Increase engine force at low speeds to make the initial acceleration faster. if fwd_mps >= -1: var speed = linear_velocity.length() diff --git a/3d/voxel/menu/debug.gd b/3d/voxel/menu/debug.gd index a0a3f7ef..22cb6a0f 100644 --- a/3d/voxel/menu/debug.gd +++ b/3d/voxel/menu/debug.gd @@ -6,7 +6,7 @@ extends Label func _process(_delta): - if Input.is_action_just_pressed("debug"): + if Input.is_action_just_pressed(&"debug"): visible = not visible text = "Position: " + _vector_to_string_appropriate_digits(player.transform.origin) diff --git a/3d/voxel/menu/ingame/pause_menu.gd b/3d/voxel/menu/ingame/pause_menu.gd index 8d886e4c..f4e6c566 100644 --- a/3d/voxel/menu/ingame/pause_menu.gd +++ b/3d/voxel/menu/ingame/pause_menu.gd @@ -9,7 +9,7 @@ extends Control func _process(_delta): - if Input.is_action_just_pressed("pause"): + if Input.is_action_just_pressed(&"pause"): pause.visible = crosshair.visible crosshair.visible = not crosshair.visible options.visible = false diff --git a/3d/voxel/player/player.gd b/3d/voxel/player/player.gd index c64d45f2..07e39c9c 100644 --- a/3d/voxel/player/player.gd +++ b/3d/voxel/player/player.gd @@ -26,15 +26,15 @@ func _process(_delta): # Block selection. var ray_position = raycast.get_collision_point() var ray_normal = raycast.get_collision_normal() - if Input.is_action_just_pressed("pick_block"): + if Input.is_action_just_pressed(&"pick_block"): # Block picking. var block_global_position = Vector3i((ray_position - ray_normal / 2).floor()) _selected_block = voxel_world.get_block_global_position(block_global_position) else: # Block prev/next keys. - if Input.is_action_just_pressed("prev_block"): + if Input.is_action_just_pressed(&"prev_block"): _selected_block -= 1 - if Input.is_action_just_pressed("next_block"): + if Input.is_action_just_pressed(&"next_block"): _selected_block += 1 _selected_block = wrapi(_selected_block, 1, 30) # Set the appropriate texture. @@ -43,8 +43,8 @@ func _process(_delta): # Block breaking/placing. if crosshair.visible and raycast.is_colliding(): - var breaking = Input.is_action_just_pressed("break") - var placing = Input.is_action_just_pressed("place") + var breaking = Input.is_action_just_pressed(&"break") + var placing = Input.is_action_just_pressed(&"place") # Either both buttons were pressed or neither are, so stop. if breaking == placing: return @@ -62,7 +62,7 @@ func _physics_process(delta): camera_effects.dof_blur_far_distance = Settings.fog_distance * 1.5 camera_effects.dof_blur_far_transition = Settings.fog_distance / 8 # Crouching. - var crouching = Input.is_action_pressed("crouch") + var crouching = Input.is_action_pressed(&"crouch") if crouching: head.transform.origin = Vector3(0, 1.2, 0) else: @@ -82,7 +82,7 @@ func _physics_process(delta): move_and_slide() # Jumping, applied next frame. - if is_on_floor() and Input.is_action_pressed("jump"): + if is_on_floor() and Input.is_action_pressed(&"jump"): velocity.y = 5 diff --git a/audio/midi_piano/piano.gd b/audio/midi_piano/piano.gd index 9b1d00ed..6cbbc963 100644 --- a/audio/midi_piano/piano.gd +++ b/audio/midi_piano/piano.gd @@ -51,7 +51,7 @@ func _add_placeholder_key(container): var placeholder = Control.new() placeholder.size_flags_horizontal = SIZE_EXPAND_FILL placeholder.mouse_filter = Control.MOUSE_FILTER_IGNORE - placeholder.name = "Placeholder" + placeholder.name = &"Placeholder" container.add_child(placeholder) diff --git a/misc/2.5d/addons/node25d/node_25d.gd b/misc/2.5d/addons/node25d/node_25d.gd index 9861bead..df51dead 100644 --- a/misc/2.5d/addons/node25d/node_25d.gd +++ b/misc/2.5d/addons/node25d/node_25d.gd @@ -113,17 +113,17 @@ func set_view_mode(view_mode_index): # This can be changed or removed in actual games where you only need one view mode. func _check_view_mode(): if not Engine.editor_hint: - if Input.is_action_just_pressed("forty_five_mode"): + if Input.is_action_just_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_just_pressed("isometric_mode"): + elif Input.is_action_just_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_just_pressed("top_down_mode"): + elif Input.is_action_just_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_just_pressed("front_side_mode"): + elif Input.is_action_just_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_just_pressed("oblique_y_mode"): + elif Input.is_action_just_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_just_pressed("oblique_z_mode"): + elif Input.is_action_just_pressed(&"oblique_z_mode"): set_view_mode(5) diff --git a/misc/2.5d/assets/cube/cube_math.gd b/misc/2.5d/assets/cube/cube_math.gd index 624ecbef..207281d4 100644 --- a/misc/2.5d/assets/cube/cube_math.gd +++ b/misc/2.5d/assets/cube/cube_math.gd @@ -24,16 +24,16 @@ func _ready(): func _process(delta): - if Input.is_action_pressed("exit"): + if Input.is_action_pressed(&"exit"): get_tree().quit() - if Input.is_action_just_pressed("view_cube_demo"): + if Input.is_action_just_pressed(&"view_cube_demo"): # warning-ignore:return_value_discarded get_tree().change_scene("res://assets/demo_scene.tscn") return if _is_parent_ready: - if Input.is_action_just_pressed("reset_position"): + if Input.is_action_just_pressed(&"reset_position"): transform = Transform3D.IDENTITY else: rotate_x(delta * (Input.get_axis(&"move_forward", &"move_back"))) diff --git a/misc/2.5d/assets/platform/platform_sprite.gd b/misc/2.5d/assets/platform/platform_sprite.gd index 630064d1..0326156f 100644 --- a/misc/2.5d/assets/platform/platform_sprite.gd +++ b/misc/2.5d/assets/platform/platform_sprite.gd @@ -10,17 +10,17 @@ extends Sprite2D func _process(_delta): if not Engine.editor_hint: - if Input.is_action_pressed("forty_five_mode"): + if Input.is_action_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_pressed("isometric_mode"): + elif Input.is_action_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_pressed("top_down_mode"): + elif Input.is_action_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_pressed("front_side_mode"): + elif Input.is_action_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_pressed("oblique_y_mode"): + elif Input.is_action_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_pressed("oblique_z_mode"): + elif Input.is_action_pressed(&"oblique_z_mode"): set_view_mode(5) diff --git a/misc/2.5d/assets/player/player_math_25d.gd b/misc/2.5d/assets/player/player_math_25d.gd index 12742b85..8f52f4f0 100644 --- a/misc/2.5d/assets/player/player_math_25d.gd +++ b/misc/2.5d/assets/player/player_math_25d.gd @@ -7,17 +7,17 @@ var isometric_controls := true @onready var _parent_node25d: Node25D = get_parent() func _process(delta): - if Input.is_action_pressed("exit"): + if Input.is_action_pressed(&"exit"): get_tree().quit() - if Input.is_action_just_pressed("view_cube_demo"): + if Input.is_action_just_pressed(&"view_cube_demo"): #warning-ignore:return_value_discarded get_tree().change_scene("res://assets/cube/cube.tscn") return - if Input.is_action_just_pressed("toggle_isometric_controls"): + if Input.is_action_just_pressed(&"toggle_isometric_controls"): isometric_controls = not isometric_controls - if Input.is_action_just_pressed("reset_position"): + if Input.is_action_just_pressed(&"reset_position"): transform = Transform3D(Basis(), Vector3.UP * 10) vertical_speed = 0 else: @@ -35,11 +35,11 @@ func _horizontal_movement(delta): localZ = Vector3(0.70710678118, 0, 0.70710678118) # Gather player input and add directional movement to a Vector3 variable. - var movement_vec2 = Input.get_vector("move_left", "move_right", "move_forward", "move_back") + var movement_vec2 = Input.get_vector(&"move_left", &"move_right", &"move_forward", &"move_back") var move_dir = localX * movement_vec2.x + localZ * movement_vec2.y move_dir = move_dir * delta * 600 - if Input.is_action_pressed("movement_modifier"): + if Input.is_action_pressed(&"movement_modifier"): move_dir /= 2 #warning-ignore:return_value_discarded @@ -49,7 +49,7 @@ func _horizontal_movement(delta): # Checks Jump and applies gravity and vertical speed via move_and_collide. func _vertical_movement(delta): var localY = Vector3.UP - if Input.is_action_just_pressed("jump"): + if Input.is_action_just_pressed(&"jump"): vertical_speed = 1.25 vertical_speed -= delta * 5 # Gravity var k = move_and_collide(localY * vertical_speed) diff --git a/misc/2.5d/assets/player/player_sprite.gd b/misc/2.5d/assets/player/player_sprite.gd index 5a22c73e..949efd16 100644 --- a/misc/2.5d/assets/player/player_sprite.gd +++ b/misc/2.5d/assets/player/player_sprite.gd @@ -30,7 +30,7 @@ func _process(delta): if movement: hframes = 6 texture = _run - if (Input.is_action_pressed("movement_modifier")): + if (Input.is_action_pressed(&"movement_modifier")): delta /= 2 _progress = fmod((_progress + FRAMERATE * delta), 6) frame = _direction * 6 + int(_progress) @@ -72,17 +72,17 @@ func set_view_mode(view_mode_index): # Change the 2D basis of the sprite to try and make it "fit" multiple view modes. func _sprite_basis(): if not Engine.editor_hint: - if Input.is_action_pressed("forty_five_mode"): + if Input.is_action_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_pressed("isometric_mode"): + elif Input.is_action_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_pressed("top_down_mode"): + elif Input.is_action_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_pressed("front_side_mode"): + elif Input.is_action_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_pressed("oblique_y_mode"): + elif Input.is_action_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_pressed("oblique_z_mode"): + elif Input.is_action_pressed(&"oblique_z_mode"): set_view_mode(5) @@ -92,25 +92,25 @@ func _check_movement() -> bool: var x := 0 var z := 0 - if Input.is_action_pressed("move_right"): + if Input.is_action_pressed(&"move_right"): x += 1 - if Input.is_action_pressed("move_left"): + if Input.is_action_pressed(&"move_left"): x -= 1 - if Input.is_action_pressed("move_forward"): + if Input.is_action_pressed(&"move_forward"): z -= 1 - if Input.is_action_pressed("move_back"): + if Input.is_action_pressed(&"move_back"): z += 1 # Check for isometric controls and add more to movement accordingly. # For efficiency, only check the X axis since this X axis value isn't used anywhere else. if not _parent_math.isometric_controls and is_equal_approx(Node25D.SCALE * 0.86602540378, _parent_node25d.get_basis()[0].x): - if Input.is_action_pressed("move_right"): + if Input.is_action_pressed(&"move_right"): z += 1 - if Input.is_action_pressed("move_left"): + if Input.is_action_pressed(&"move_left"): z -= 1 - if Input.is_action_pressed("move_forward"): + if Input.is_action_pressed(&"move_forward"): x += 1 - if Input.is_action_pressed("move_back"): + if Input.is_action_pressed(&"move_back"): x -= 1 # Set the direction based on which inputs were pressed. diff --git a/misc/2.5d/assets/shadow/shadow_sprite.gd b/misc/2.5d/assets/shadow/shadow_sprite.gd index c04a1ddf..4704da8c 100644 --- a/misc/2.5d/assets/shadow/shadow_sprite.gd +++ b/misc/2.5d/assets/shadow/shadow_sprite.gd @@ -10,17 +10,17 @@ extends Sprite2D func _process(_delta): if not Engine.editor_hint: - if Input.is_action_pressed("forty_five_mode"): + if Input.is_action_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_pressed("isometric_mode"): + elif Input.is_action_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_pressed("top_down_mode"): + elif Input.is_action_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_pressed("front_side_mode"): + elif Input.is_action_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_pressed("oblique_y_mode"): + elif Input.is_action_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_pressed("oblique_z_mode"): + elif Input.is_action_pressed(&"oblique_z_mode"): set_view_mode(5) diff --git a/misc/2.5d/assets/ui/control_hints.gd b/misc/2.5d/assets/ui/control_hints.gd index e234cb40..3b71403e 100644 --- a/misc/2.5d/assets/ui/control_hints.gd +++ b/misc/2.5d/assets/ui/control_hints.gd @@ -1,5 +1,5 @@ extends Control func _process(_delta): - if Input.is_action_just_pressed("toggle_control_hints"): + if Input.is_action_just_pressed(&"toggle_control_hints"): visible = not visible diff --git a/misc/window_management/control.gd b/misc/window_management/control.gd index ff087ddd..feaf3ade 100644 --- a/misc/window_management/control.gd +++ b/misc/window_management/control.gd @@ -68,15 +68,15 @@ func _unhandled_input(event): mousepos = event.position if event is InputEventKey: - if Input.is_action_pressed("mouse_mode_visible"): + if Input.is_action_pressed(&"mouse_mode_visible"): observer.state = observer.STATE_MENU _on_Button_MouseModeVisible_pressed() - if Input.is_action_pressed("mouse_mode_hidden"): + if Input.is_action_pressed(&"mouse_mode_hidden"): observer.state = observer.STATE_MENU _on_Button_MouseModeHidden_pressed() - if Input.is_action_pressed("mouse_mode_captured"): + if Input.is_action_pressed(&"mouse_mode_captured"): _on_Button_MouseModeCaptured_pressed() diff --git a/mono/2.5d/assets/platform/platform_sprite.gd b/mono/2.5d/assets/platform/platform_sprite.gd index ce5b8257..9179736b 100644 --- a/mono/2.5d/assets/platform/platform_sprite.gd +++ b/mono/2.5d/assets/platform/platform_sprite.gd @@ -10,17 +10,17 @@ extends Sprite2D func _process(_delta): if not Engine.editor_hint: - if Input.is_action_pressed("forty_five_mode"): + if Input.is_action_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_pressed("isometric_mode"): + elif Input.is_action_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_pressed("top_down_mode"): + elif Input.is_action_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_pressed("front_side_mode"): + elif Input.is_action_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_pressed("oblique_y_mode"): + elif Input.is_action_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_pressed("oblique_z_mode"): + elif Input.is_action_pressed(&"oblique_z_mode"): set_view_mode(5) diff --git a/mono/2.5d/assets/shadow/shadow_sprite.gd b/mono/2.5d/assets/shadow/shadow_sprite.gd index 7d241963..84a65257 100644 --- a/mono/2.5d/assets/shadow/shadow_sprite.gd +++ b/mono/2.5d/assets/shadow/shadow_sprite.gd @@ -10,17 +10,17 @@ extends Sprite2D func _process(_delta): if not Engine.editor_hint: - if Input.is_action_pressed("forty_five_mode"): + if Input.is_action_pressed(&"forty_five_mode"): set_view_mode(0) - elif Input.is_action_pressed("isometric_mode"): + elif Input.is_action_pressed(&"isometric_mode"): set_view_mode(1) - elif Input.is_action_pressed("top_down_mode"): + elif Input.is_action_pressed(&"top_down_mode"): set_view_mode(2) - elif Input.is_action_pressed("front_side_mode"): + elif Input.is_action_pressed(&"front_side_mode"): set_view_mode(3) - elif Input.is_action_pressed("oblique_y_mode"): + elif Input.is_action_pressed(&"oblique_y_mode"): set_view_mode(4) - elif Input.is_action_pressed("oblique_z_mode"): + elif Input.is_action_pressed(&"oblique_z_mode"): set_view_mode(5) diff --git a/mono/2.5d/assets/ui/control_hints.gd b/mono/2.5d/assets/ui/control_hints.gd index e234cb40..3b71403e 100644 --- a/mono/2.5d/assets/ui/control_hints.gd +++ b/mono/2.5d/assets/ui/control_hints.gd @@ -1,5 +1,5 @@ extends Control func _process(_delta): - if Input.is_action_just_pressed("toggle_control_hints"): + if Input.is_action_just_pressed(&"toggle_control_hints"): visible = not visible diff --git a/networking/multiplayer_bomber/player.gd b/networking/multiplayer_bomber/player.gd index 00fc6ed1..1fc13d4f 100644 --- a/networking/multiplayer_bomber/player.gd +++ b/networking/multiplayer_bomber/player.gd @@ -25,16 +25,16 @@ func _physics_process(_delta): var motion = Vector2() if is_network_master(): - if Input.is_action_pressed("move_left"): + if Input.is_action_pressed(&"move_left"): motion += Vector2(-1, 0) - if Input.is_action_pressed("move_right"): + if Input.is_action_pressed(&"move_right"): motion += Vector2(1, 0) - if Input.is_action_pressed("move_up"): + if Input.is_action_pressed(&"move_up"): motion += Vector2(0, -1) - if Input.is_action_pressed("move_down"): + if Input.is_action_pressed(&"move_down"): motion += Vector2(0, 1) - var bombing = Input.is_action_pressed("set_bomb") + var bombing = Input.is_action_pressed(&"set_bomb") if stunned: bombing = false diff --git a/viewport/2d_in_3d/pong.gd b/viewport/2d_in_3d/pong.gd index 219bae85..03561353 100644 --- a/viewport/2d_in_3d/pong.gd +++ b/viewport/2d_in_3d/pong.gd @@ -50,18 +50,18 @@ func _process(delta): # Move left pad. var left_pos = left_paddle.get_position() - if left_pos.y > 0 and Input.is_action_pressed("left_move_up"): + if left_pos.y > 0 and Input.is_action_pressed(&"left_move_up"): left_pos.y += -PAD_SPEED * delta - if left_pos.y < screen_size.y and Input.is_action_pressed("left_move_down"): + if left_pos.y < screen_size.y and Input.is_action_pressed(&"left_move_down"): left_pos.y += PAD_SPEED * delta left_paddle.set_position(left_pos) # Move right pad. var right_pos = right_paddle.get_position() - if right_pos.y > 0 and Input.is_action_pressed("right_move_up"): + if right_pos.y > 0 and Input.is_action_pressed(&"right_move_up"): right_pos.y += -PAD_SPEED * delta - if right_pos.y < screen_size.y and Input.is_action_pressed("right_move_down"): + if right_pos.y < screen_size.y and Input.is_action_pressed(&"right_move_down"): right_pos.y += PAD_SPEED * delta right_paddle.set_position(right_pos)