From ed9ee9860ec588402945cb1a6e32906744a55a2c Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Sun, 8 Jan 2023 13:13:09 +0100 Subject: [PATCH] Fix some playercontroller warnings --- player/Head.gd | 7 ------- player/OnHand.gd | 10 +++------- player/Player.gd | 3 --- player/onhand/PeaShooter.gd | 8 ++++---- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/player/Head.gd b/player/Head.gd index 31c78fb..a6a6d4c 100644 --- a/player/Head.gd +++ b/player/Head.gd @@ -19,13 +19,6 @@ func _ready() -> void: xNoise.seed = 0 yNoise.seed = 1 -# Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - pass - -func _physics_process(delta: float) -> void: - pass - func _input(event: InputEvent) -> void: if event is InputEventMouseMotion: diff --git a/player/OnHand.gd b/player/OnHand.gd index 5ce2111..4b79a54 100644 --- a/player/OnHand.gd +++ b/player/OnHand.gd @@ -29,16 +29,12 @@ func _ready() -> void: self._switch_weapon(BaseWeapon.WeaponSlot.ONE) -func _process(delta: float) -> void: - pass - - func _on_player_set(player: Player) -> void: for weapon in weapons: weapon.player = player -func _input(event: InputEvent) -> void: +func _input(_event: InputEvent) -> void: if Input.is_action_just_pressed("slot1"): _switch_weapon(BaseWeapon.WeaponSlot.ONE) # elif Input.is_action_just_pressed("slot2"): @@ -54,12 +50,12 @@ func _switch_weapon(slot: BaseWeapon.WeaponSlot): if weapon.weaponSlot == slot: # Remove active weapon if active_weapon: - await active_weapon.on_switch_out() + active_weapon.on_switch_out() remove_child(active_weapon) # Add new weapon add_child(weapon) active_weapon = weapon - await active_weapon.on_switch_in() + active_weapon.on_switch_in() emit_signal("weapon_switched", weapon) break diff --git a/player/Player.gd b/player/Player.gd index 5893971..3afecb0 100644 --- a/player/Player.gd +++ b/player/Player.gd @@ -45,9 +45,6 @@ func _ready(): OnHand.player = self vport.size = viewport_resolution -func _process(delta): - pass - func _physics_process(delta): last_frame_input_data = input_data input_data = PlayerInputData.new() diff --git a/player/onhand/PeaShooter.gd b/player/onhand/PeaShooter.gd index 5a5f021..7523d67 100644 --- a/player/onhand/PeaShooter.gd +++ b/player/onhand/PeaShooter.gd @@ -22,7 +22,7 @@ func _ready() -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: +func _process(_delta: float) -> void: var current_time = Time.get_ticks_msec() if Input.is_action_just_pressed("fire") and current_time > (last_fired + FIRE_RATE*1000): @@ -37,9 +37,9 @@ func shoot() -> void: # $AnimationPlayer.play("shoot") if ray.is_colliding(): - var normal = ray.get_collision_normal() as Vector3 - var point = ray.get_collision_point() as Vector3 - var object = ray.get_collider() as Node3D + var _normal = ray.get_collision_normal() as Vector3 + var _point = ray.get_collision_point() as Vector3 + var _object = ray.get_collider() as Node3D try_placing_seed(ray) # decalInstance.position = point # object.add_child(decalInstance)