Skip to content

Commit

Permalink
Update some GDScript files for Godot 4.3 (#1129)
Browse files Browse the repository at this point in the history
  • Loading branch information
dalexeev authored Nov 4, 2024
1 parent 7ed5b1c commit c492e5f
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 51 deletions.
4 changes: 2 additions & 2 deletions 2d/dynamic_tilemap_layers/level/tile_map.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func _tile_data_runtime_update(_layer: int, _coords: Vector2i, tile_data: TileDa


func _on_secret_detector_body_entered(body: Node2D) -> void:
if not body is CharacterBody2D:
if body is not CharacterBody2D:
# Detect the player only.
return

Expand All @@ -51,7 +51,7 @@ func _on_secret_detector_body_entered(body: Node2D) -> void:


func _on_secret_detector_body_exited(body: Node2D) -> void:
if not body is CharacterBody2D:
if body is not CharacterBody2D:
return

player_in_secret = false
Expand Down
16 changes: 8 additions & 8 deletions 2d/dynamic_tilemap_layers/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ CharacterBody2D. The character moves around, is affected by moving
platforms, can jump through one-way collision platforms, etc."
config/tags=PackedStringArray("2d", "demo", "official", "tilemap")
run/main_scene="res://world.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.png"

[debug]
Expand All @@ -37,25 +37,25 @@ jump={
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":0,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.2,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.2,
"events": [Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}

Expand Down
2 changes: 0 additions & 2 deletions 2d/dynamic_tilemap_layers/world.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_vnjib"]
texture = ExtResource("2")
0:0/0 = 0
0:0/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:0/0/physics_layer_0/angular_velocity = 0.0
0:0/0/physics_layer_0/polygon_0/points = PackedVector2Array(-8, -8, 8, -8, 8, 8, -8, 8)

[sub_resource type="TileSet" id="TileSet_xqlka"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
extends "../motion.gd"

# warning-ignore-all:unused_class_variable
var speed := 0.0
var velocity := Vector2()

Expand Down
2 changes: 1 addition & 1 deletion 2d/finite_state_machine/state_machine/state.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ extends Node
# but forces us to pass the right arguments to the methods below
# and makes sure every State object had all of these methods.

# warning-ignore:unused_signal
@warning_ignore("unused_signal")
signal finished(next_state_name: String)

# Initialize the state. E.g. change the animation.
Expand Down
2 changes: 0 additions & 2 deletions 2d/isometric/player/goblin.gd
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ func _physics_process(_delta):
motion.y = Input.get_action_strength("move_down") - Input.get_action_strength("move_up")
motion.y /= 2
motion = motion.normalized() * MOTION_SPEED
#warning-ignore:return_value_discarded
set_velocity(motion)
move_and_slide()
var dir = velocity
Expand All @@ -48,7 +47,6 @@ func _physics_process(_delta):


func update_animation(anim_set):

var angle = rad_to_deg(last_direction.angle()) + 22.5
var slice_dir = floor(angle / 45)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ func _update_platform_size(value: float, reset: bool = true) -> void:
var platform_collision := _platform_template.get_child(0)
platform_collision.shape.size.x = value
if _platform_body:
# Bug: need to re-add when changing shape.
# BUG: Need to re-add when changing shape.
var child_index := _platform_body.get_index()
remove_child(_platform_body)
add_child(_platform_body)
Expand Down
3 changes: 2 additions & 1 deletion 2d/role_playing_game/combat/combat.gd
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ func clear_combat() -> void:


func finish_combat(winner: Combatant, loser: Combatant) -> void:
# FIXME: Error calling from signal 'combat_finished' to callable: 'Node(game.gd)::_on_combat_finished': Cannot convert argument 1 from Object to Object.
# FIXME: Error calling from signal 'combat_finished' to callable:
# 'Node(game.gd)::_on_combat_finished': Cannot convert argument 1 from Object to Object.
combat_finished.emit(winner, loser)


Expand Down
2 changes: 1 addition & 1 deletion 2d/role_playing_game/combat/turn_queue.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func remove(combatant: Combatant) -> void:
func set_queue(new_queue: Array[Node]) -> void:
queue.clear()
for node in new_queue:
if not node is Combatant:
if node is not Combatant:
continue
queue.append(node)
node.active = false
Expand Down
18 changes: 9 additions & 9 deletions 2d/role_playing_game/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ and GDScript. It also includes a simple JRPG-style dialogue and
battle system on top of it."
config/tags=PackedStringArray("2d", "demo", "gui", "official", "tilemap")
run/main_scene="res://game.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.svg"

[debug]
Expand All @@ -38,32 +38,32 @@ import/blender/enabled=false

move_up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":122,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":122,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":11,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":-1.0,"script":null)
]
}
move_down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
]
}
move_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":113,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":113,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":-1.0,"script":null)
]
}
move_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":0,"axis_value":1.0,"script":null)
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/montserrat_extra_bold.otf-d2f398ef6213b24fc13
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
1 change: 0 additions & 1 deletion 3d/squash_the_creeps/Main.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ func _ready():

func _unhandled_input(event):
if event.is_action_pressed("ui_accept") and $UserInterface/Retry.visible:
# warning-ignore:return_value_discarded
get_tree().reload_current_scene()


Expand Down
2 changes: 1 addition & 1 deletion audio/midi_piano/piano.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func _ready() -> void:


func _input(input_event: InputEvent) -> void:
if not input_event is InputEventMIDI:
if input_event is not InputEventMIDI:
return

var midi_event: InputEventMIDI = input_event
Expand Down
2 changes: 1 addition & 1 deletion audio/midi_piano/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ config_version=5
config/name="MIDI Piano Demo"
config/tags=PackedStringArray("audio", "demo", "official")
run/main_scene="res://piano.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
config/icon="res://icon.webp"

[debug]
Expand Down
3 changes: 1 addition & 2 deletions gui/gd_paint/paint_control.gd
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ func undo_stroke() -> void:
# Figure out how many elements/brushes we've added in the last stroke.
var elements_to_remove := brush_data_list.size() - undo_element_list_num
# Remove all of the elements we've added this in the last stroke.
#warning-ignore:unused_variable
for elment_num in elements_to_remove:
for _elment_num in elements_to_remove:
brush_data_list.pop_back()

# Now that we've undone a stoke, we cannot undo again until another stoke is added.
Expand Down
2 changes: 1 addition & 1 deletion misc/2.5d/addons/node25d/.broken-gdscripts/Basis25D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# https://github.com/godotengine/godot-proposals/issues/279

# Basis25D structure for performing 2.5D transform math.
# Note: All code assumes that Y is UP in 3D, and DOWN in 2D.
# NOTE: All code assumes that Y is UP in 3D, and DOWN in 2D.
# Meaning, a top-down view has a Y axis component of (0, 0), with a Z axis component of (0, 1).
# For a front side view, Y is (0, -1) and Z is (0, 0).
# Remember that Godot's 2D mode has the Y axis pointing DOWN on the screen.
Expand Down
2 changes: 1 addition & 1 deletion misc/2.5d/addons/node25d/y_sort_25d.gd
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@tool
@icon("res://addons/node25d/icons/y_sort_25d_icon.png")
class_name YSort25D
extends Node # NOTE: NOT Node2D, Node25D, or Node2D
extends Node # NOTE: NOT Node2D or Node25D.


# Whether or not to automatically call sort() in _process().
Expand Down
3 changes: 2 additions & 1 deletion misc/2.5d/assets/player/player_sprite.gd
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ func _sprite_basis() -> void:

# This method returns a bool but if true it also outputs to the direction variable.
func _check_movement() -> bool:
# Gather player input and store movement to these int variables. Note: These indeed have to be integers.
# Gather player input and store movement to these int variables.
# NOTE: These indeed have to be integers.
var x := 0
var z := 0

Expand Down
2 changes: 1 addition & 1 deletion misc/joypads/project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ config/name="Joypads"
config/description="A tool for testing joypad input."
config/tags=PackedStringArray("demo", "gui", "input", "official")
run/main_scene="res://joypads.tscn"
config/features=PackedStringArray("4.2")
config/features=PackedStringArray("4.3")
run/low_processor_mode=true
config/icon="res://icon.webp"

Expand Down
2 changes: 1 addition & 1 deletion misc/joypads/remap/remap_wizard.gd
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func _input(event: InputEvent) -> void:
return

# Ignore events not related to gamepads.
if not (event is InputEventJoypadButton or event is InputEventJoypadMotion):
if event is not InputEventJoypadButton and event is not InputEventJoypadMotion:
return

# Ignore devices other than the one being remapped. Handles accidental input and analog drift.
Expand Down
2 changes: 1 addition & 1 deletion networking/multiplayer_bomber/bomb.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func explode() -> void:
var query := PhysicsRayQueryParameters2D.create(position, p.position)
query.hit_from_inside = true
var result: Dictionary = world_state.intersect_ray(query)
if not result.collider is TileMap:
if result.collider is not TileMap:
# Exploded can only be called by the authority, but will also be called locally.
p.exploded.rpc(from_player)

Expand Down
1 change: 1 addition & 0 deletions networking/multiplayer_bomber/montserrat.otf.import
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dest_files=["res://.godot/imported/montserrat.otf-0d875bde8933edfaf65407b0d9da84
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
Expand Down
Loading

0 comments on commit c492e5f

Please sign in to comment.