1
Fork 0
mirror of https://github.com/Steffo99/pineapple-surf.git synced 2024-11-21 23:34:21 +00:00

Fix another warning

This commit is contained in:
Steffo 2023-01-09 01:54:54 +01:00
parent 566ebc118d
commit 5373665f85
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -5,7 +5,7 @@ const FIRE_RATE := 0.15
var last_fired := 0 var last_fired := 0
var remaining := 10 var remaining := 10
@onready var ray = $RayCast3D @onready var raycast = $RayCast3D
@onready var audio_player: AudioStreamPlayer = $ShootSound @onready var audio_player: AudioStreamPlayer = $ShootSound
# FIXME: use singleton class here as well # FIXME: use singleton class here as well
@onready var croptiles_container: Node3D = get_tree().root.find_child("CropTiles", true, false) @onready var croptiles_container: Node3D = get_tree().root.find_child("CropTiles", true, false)
@ -38,11 +38,11 @@ func shoot() -> void:
# $AnimationPlayer.seek(0) # $AnimationPlayer.seek(0)
# $AnimationPlayer.play("shoot") # $AnimationPlayer.play("shoot")
if ray.is_colliding(): if raycast.is_colliding():
var _normal = ray.get_collision_normal() as Vector3 var _normal = raycast.get_collision_normal() as Vector3
var _point = ray.get_collision_point() as Vector3 var _point = raycast.get_collision_point() as Vector3
var _object = ray.get_collider() as Node3D var _object = raycast.get_collider() as Node3D
try_placing_seed(ray) try_placing_seed()
# decalInstance.position = point # decalInstance.position = point
# object.add_child(decalInstance) # object.add_child(decalInstance)
else: else:
@ -52,10 +52,10 @@ func shoot() -> void:
remaining -= 1 remaining -= 1
func try_placing_seed(ray: RayCast3D) -> bool: func try_placing_seed() -> bool:
var point = ray.get_collision_point() as Vector3 var point = raycast.get_collision_point() as Vector3
var normal = ray.get_collision_normal() as Vector3 var normal = raycast.get_collision_normal() as Vector3
var coll = ray.get_collider() as CollisionObject3D var coll = raycast.get_collider() as CollisionObject3D
var similarity = normal.dot(Vector3.UP) var similarity = normal.dot(Vector3.UP)
if similarity < 0.95: if similarity < 0.95: