Skip to content

Commit

Permalink
Fix gdlint errors
Browse files Browse the repository at this point in the history
- IMPORTANT: 'arcade_hoops_ctrl.gd' line 96 had a 'tween.kill' that does not call 'tween.kill()' it has been removed to preserve identical functionality while removing a gdlint error. Unknown if this needed to be called but was missing.
- Reorder variables
- Lessen lines over 100
- Remove trailing whitespace
- Prepend "_" to unused function parameters
  • Loading branch information
squidt committed Dec 27, 2024
1 parent f9701c5 commit c3be759
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 32 deletions.
25 changes: 15 additions & 10 deletions assets/3dmodelscc0/models/scenes/scope_display.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
@tool
extends Node3D


@export var player_camera : Camera3D


@export_range(1.0, 10.0, 0.1) var fov : float = 10.0:
set(value):
fov = value
if is_inside_tree():
_update_fov()

@export_range(0.005, 1.000, 0.005) var radius : float = 0.025:
set(value):
radius = value
if is_inside_tree():
_update_radius()

@export_range(0.001, 0.500, 0.001) var offset : float = 0.35:
set(value):
offset = value
if is_inside_tree():
_update_offset()


func _update_radius():
var mesh : QuadMesh = $DisplayMesh.mesh
if mesh:
Expand All @@ -19,11 +34,6 @@ func _update_radius():
if material:
material.set_shader_parameter("radius", radius)

@export_range(0.001, 0.500, 0.001) var offset : float = 0.35:
set(value):
offset = value
if is_inside_tree():
_update_offset()

func _update_offset():
$ScopeAnchor.position.z = -offset
Expand All @@ -35,11 +45,6 @@ func _update_offset():
if material:
material.set_shader_parameter("depth", offset)

@export_range(1.0, 10.0, 0.1) var fov : float = 10.0:
set(value):
fov = value
if is_inside_tree():
_update_fov()

func _update_fov():
$SubViewport/Camera3D.fov = fov
Expand Down
7 changes: 4 additions & 3 deletions assets/3dmodelscc0/models/sniper_rifle/firearm_trigger.gd
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ extends Node

@export var handle_grabpoints : Array[XRToolsGrabPoint]

@onready var _parent : XRToolsPickable = get_parent()
var triggered : bool = false

# Current controller holding this object
var _current_controller : XRController3D

var triggered : bool = false
@onready var _parent : XRToolsPickable = get_parent()


# Add support for is_xr_class on XRTools classes
Expand All @@ -30,7 +30,8 @@ func _ready() -> void:
for handle_grabpoint in handle_grabpoints:
handle_grabpoint.enabled = false

func _physics_process(delta):

func _physics_process(_delta):
if is_instance_valid(_parent):
# toggle handle grabpoints if parent got grabbed/released
if _parent.get_picked_up_by():
Expand Down
2 changes: 1 addition & 1 deletion assets/meshes/control_pad/control_pad_display.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func _on_body_scale_slider_value_changed(value : float) -> void:
# Kill any current tween
if _tween:
_tween.kill()

# Tween the world scale over the next 1/2 second
_tween = get_tree().create_tween()
_tween.tween_method(
Expand Down
5 changes: 3 additions & 2 deletions assets/meshes/teleport/teleport.gd
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,10 @@ func _set_inactive_beam_visible(value):


func _update_teleport():
var mat = $teleport/Cylinder.get_surface_override_material(0)
if active:
$teleport/Cylinder.get_surface_override_material(0).set_shader_parameter("beam_color", active_beam_color)
mat.set_shader_parameter("beam_color", active_beam_color)
$teleport/Cylinder.visible = true
else:
$teleport/Cylinder.get_surface_override_material(0).set_shader_parameter("beam_color", inactive_beam_color)
mat.set_shader_parameter("beam_color", inactive_beam_color)
$teleport/Cylinder.visible = inactive_beam_visible
33 changes: 18 additions & 15 deletions scenes/audio_demo/objects/arcade_hoops_ctrl.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
extends Node3D


## Signal indicating a target has been passed through
signal target_passed()
signal count_down(number)


## Optional audio stream to play when the player jumps on this surface
@export var start_sound : AudioStream
Expand All @@ -20,9 +24,20 @@ extends Node3D
@export var start_text : String = ""
@export var game_over_text : String = ""
@export var scored_text : String= ""

var ejected_token = preload ("res://scenes/audio_demo/objects/token.tscn")
var score
var tween
var _count

# Flag indicating when ball is inside the area
var _ball_inside := false

# Flag indicating if timer is running
var _running := false

## Audio streams to play when the player walks on this surface
@onready var player := $AudioStreamPlayer3D

@onready var score_label := $Score_Text
@onready var timer := $Timer
@onready var timer_label := $Timer_Text
Expand All @@ -31,19 +46,8 @@ extends Node3D
@onready var info_label := $Start_Text
@onready var zone : XRToolsSnapZone = $SnapZone
@onready var holder : Node3D = $TokenHolder
var ejected_token = preload ("res://scenes/audio_demo/objects/token.tscn")
var _count
var score
var tween

# Flag indicating when ball is inside the area
var _ball_inside := false

# Flag indicating if timer is running
var _running := false
## Signal indicating a target has been passed through
signal target_passed()
signal count_down(number)



Expand All @@ -59,7 +63,7 @@ func _ready() -> void:
zone.has_picked_up.connect(_on_token_insert)


func _process(delta):
func _process(_delta):
if !_running:
zone.enabled = true
else:
Expand Down Expand Up @@ -93,11 +97,10 @@ func _on_token_insert(_what : Node3D) -> void:
zone.enabled = false
tween = get_tree().create_tween()
tween.tween_callback(_what.queue_free).set_delay(0.15)
tween.kill


func _on_token_eject(_button) -> void:
var token_to_eject = ejected_token.instantiate()
var token_to_eject = ejected_token.instantiate()
if token > 0:
holder.add_child(token_to_eject)
token -= 1
Expand Down
2 changes: 1 addition & 1 deletion scenes/main_menu/main_menu_level.gd
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,5 @@ func _on_Demos_child_exiting_tree(_node):
_update_demo_positions()


func _on_settings_ui_player_height_changed(new_height):
func _on_settings_ui_player_height_changed(_new_height):
$XROrigin3D/PlayerBody.calibrate_player_height()

0 comments on commit c3be759

Please sign in to comment.