Skip to content

Commit

Permalink
ADF-8 | Fixed the rest of the linter problems, except for params in g…
Browse files Browse the repository at this point in the history
…ame.gd (#20)
  • Loading branch information
mielifica authored Jul 13, 2024
1 parent b3d7460 commit 13352c1
Show file tree
Hide file tree
Showing 37 changed files with 101 additions and 102 deletions.
2 changes: 1 addition & 1 deletion resources/game_data/cost_function/identity/identity.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name CostFunction
extends Resource


func get_cost(base_cost: int, _level: int) -> int:
Expand Down
2 changes: 1 addition & 1 deletion resources/game_data/enemy_data/enemy_data.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name EnemyData
extends Resource

@export var order: int = 0
@export var id: String
Expand Down
2 changes: 1 addition & 1 deletion resources/game_data/event_data/event_data.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name EventData
extends Resource

@export var id: String
@export var vars: Array = []
Expand Down
2 changes: 1 addition & 1 deletion resources/game_data/npc_event/npc_event.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name NpcEvent
extends Resource

@export var sort_value: int = 0
@export var npc_id: String
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name ResourceGenerator
extends Resource

@export var color: Color = Color.BLACK
@export var sort_value: int = 0
Expand Down
2 changes: 1 addition & 1 deletion resources/game_data/tab_data/tab_data.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name TabData
extends Resource

@export var id: String
@export var sort_value: int = 0
Expand Down
2 changes: 1 addition & 1 deletion resources/game_data/worker_role/worker_role.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Resource
class_name WorkerRole
extends Resource

@export var order: int = 0
@export var sort_value: int = 0
Expand Down
4 changes: 2 additions & 2 deletions scenes/autostart/save_file_picker/save_file_picker.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extends Node

@export var main_scene: PackedScene

@onready var ui: Control = %UI
@onready var save_file_tracker: SaveFileTracker = %SaveFileTracker

@export var main_scene: PackedScene

###############
## overrides ##
###############
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
extends Node2D
class_name LabelEffect
extends Node2D

signal task_finished(text: String)

var finished: bool = true
var task: String

@onready var sub_viewport: SubViewport = $SubViewport
@onready var label: Label = %Label
@onready var gpu_particles_2d: GPUParticles2D = $GPUParticles2D

var finished: bool = true
var task: String


func _process(_delta: float) -> void:
if !is_visible_in_tree():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
extends Node2D
class_name LabelEffectQueue

@onready var queue: Node2D = %Queue
@onready var timer: Timer = $Timer
extends Node2D

@export var label_effect_scene: PackedScene
@export var delay: float = 0.5
Expand All @@ -14,6 +11,9 @@ var _particle_id: String
var _tasks: Array[String] = []
var _last_task: String = ""

@onready var queue: Node2D = %Queue
@onready var timer: Timer = $Timer


func _ready() -> void:
set_delay(delay)
Expand Down
2 changes: 1 addition & 1 deletion scenes/component/effect/line_effect/line_effect.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Line2D
class_name LineEffect
extends Line2D

@export var max_alpha: float = 1.0
@export var duration: float = 1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends TextureRect
class_name TexturePixelExplosion

@onready var simple_tween: SimpleTween = %SimpleTween
extends TextureRect

## tween params
var death_animation_duration: float = 1.0
var death_animation_end_delay: float = 0.3
var death_animation_duration_fast: float = 0.8
var death_animation_end_delay_fast: float = 0.2

@onready var simple_tween: SimpleTween = %SimpleTween

###############
## overrides ##
###############
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends TextureRect
class_name TextureRgbOffset

@onready var simple_tween: SimpleTween = %SimpleTween
extends TextureRect

## tween params
var shader_simple_tween_duration: float = 0.5
var rl_max: float = 6
var rx_max: float = rl_max
var ry_max: float = rl_max

@onready var simple_tween: SimpleTween = %SimpleTween

###############
## overrides ##
###############
Expand All @@ -30,7 +30,7 @@ func get_simple_tween() -> SimpleTween:
func play_animation(duration: float = shader_simple_tween_duration) -> void:
if simple_tween.is_finished():
_randomize_shader_simple_tween_direction()
simple_tween.play_animation_(duration)
simple_tween.play_animation_during(duration)


func _randomize_shader_simple_tween_direction() -> void:
Expand Down
6 changes: 3 additions & 3 deletions scenes/component/tween/simple_tween/simple_tween.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name SimpleTween
extends Node

signal animation_end
signal animation_finished
Expand Down Expand Up @@ -33,10 +33,10 @@ func is_finished() -> bool:


func play_animation(reverse: bool = false) -> void:
play_animation_(0, reverse)
play_animation_during(0, reverse)


func play_animation_(override_duration: float, reverse: bool = false) -> void:
func play_animation_during(override_duration: float, reverse: bool = false) -> void:
_reversed_flag = reverse
finished = false
if _tween != null:
Expand Down
2 changes: 1 addition & 1 deletion scenes/controller/event_controller/event_controller.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name EventController
extends Node

###############
## overrides ##
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name ExperienceController
extends Node

###############
## overrides ##
Expand Down
2 changes: 1 addition & 1 deletion scenes/controller/npc_controller/npc_controller.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name NpcController
extends Node

###############
## overrides ##
Expand Down
2 changes: 1 addition & 1 deletion scenes/manager/enemy_manager/enemy_manager.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name EnemyManager
extends Node

###############
## overrides ##
Expand Down
2 changes: 1 addition & 1 deletion scenes/manager/event_manager/event_manager.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name EventManager
extends Node

###############
## overrides ##
Expand Down
2 changes: 1 addition & 1 deletion scenes/manager/npc_manager/npc_manager.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name NpcManager
extends Node

###############
## overrides ##
Expand Down
10 changes: 6 additions & 4 deletions scenes/manager/resource_manager/resource_manager.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name ResourceManager
extends Node

###############
## overrides ##
Expand All @@ -26,7 +26,7 @@ func _handle_on_resource_generated(id: String, amount: int, source_id: String) -

SaveFile.resources[id] = SaveFile.resources.get(id, 0) + amount
if amount < 0:
var spent_id: String = ResourceManager._spent_id(id)
var spent_id: String = ResourceManager.make_spent_id(id)
SaveFile.resources[spent_id] = SaveFile.resources.get(spent_id, 0) - amount
SignalBus.resource_updated.emit(id, SaveFile.resources.get(id, 0), amount, source_id)

Expand Down Expand Up @@ -63,8 +63,10 @@ static func is_max_amount_reached(id: String) -> bool:


static func get_total_generated(id: String) -> int:
return SaveFile.resources.get(id, 0) + SaveFile.resources.get(ResourceManager._spent_id(id), 0)
return (
SaveFile.resources.get(id, 0) + SaveFile.resources.get(ResourceManager.make_spent_id(id), 0)
)


static func _spent_id(id: String) -> String:
static func make_spent_id(id: String) -> String:
return "spent_" + id
2 changes: 1 addition & 1 deletion scenes/manager/worker_manager/worker_manager.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends Node
class_name WorkerManager
extends Node

###############
## overrides ##
Expand Down
2 changes: 1 addition & 1 deletion scenes/ui/enemy/enemy_progress_bar/enemy_progress_bar.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends MarginContainer
class_name EnemyProgressBar
extends MarginContainer

@onready var progress_bar_left: ProgressBar = %ProgressBarLeft
@onready var progress_bar_right: ProgressBar = %ProgressBarRight
Expand Down
14 changes: 7 additions & 7 deletions scenes/ui/event_tracker/event_tracker.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends MarginContainer

@onready var event_v_box_container: VBoxContainer = %EventVBoxContainer
@onready var scroll_container: ScrollContainer = %ScrollContainer

@onready var title_label: Label = %TitleLabel
@export var event_item_scene: PackedScene
@export var PAGE_SIZE: int = 20
@export var page_size: int = 20

var _total_lines: int = 0

@onready var event_v_box_container: VBoxContainer = %EventVBoxContainer
@onready var scroll_container: ScrollContainer = %ScrollContainer
@onready var title_label: Label = %TitleLabel

###############
## overrides ##
###############
Expand Down Expand Up @@ -38,7 +38,7 @@ func _load_from_save_file() -> void:
var next_index: int = SaveFile.event_log.size()
var load_range: int = next_index
if Game.params["debug_no_scrollbar"]:
load_range = min(PAGE_SIZE, next_index)
load_range = min(page_size, next_index)
for index: int in range(load_range):
var event_log_index: int = index + 1
var event_log: Dictionary = SaveFile.event_log[str(event_log_index)]
Expand All @@ -53,7 +53,7 @@ func _add_event(event_data: EventData, vals: Array, index: int, new: bool) -> vo
event_item.set_content(event_data, vals, index, new)
_total_lines += 1
if Game.params["debug_no_scrollbar"]:
while _total_lines > PAGE_SIZE:
while _total_lines > page_size:
NodeUtils.remove_oldest(event_v_box_container)
_total_lines -= 1

Expand Down
10 changes: 5 additions & 5 deletions scenes/ui/event_tracker/event_tracker_item/event_tracker_item.gd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
extends MarginContainer
class_name EventTrackerItem

@onready var line_label: Label = %LineLabel
@onready var event_label: Label = %EventLabel
@onready var typing_text_tween: Node = %TypingTextTween
extends MarginContainer

var _event_data: EventData
var _vals: Array
var _index: int

@onready var line_label: Label = %LineLabel
@onready var event_label: Label = %EventLabel
@onready var typing_text_tween: Node = %TypingTextTween


func _ready() -> void:
pass
Expand Down
4 changes: 2 additions & 2 deletions scenes/ui/experience_tracker/experience_tracker.gd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extends MarginContainer
class_name ExperienceTracker
extends MarginContainer

@onready var experience_label: Label = %ExperienceLabel
@onready var updated_simple_tween: SimpleTween = %UpdatedSimpleTween
Expand Down Expand Up @@ -48,6 +48,6 @@ func _connect_signals() -> void:
############


func __updated_simple_tween_method(animation_percent: float) -> void:
func _updated_simple_tween_method(animation_percent: float) -> void:
self.modulate.r = animation_percent
self.modulate.g = animation_percent
2 changes: 1 addition & 1 deletion scenes/ui/experience_tracker/experience_tracker.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ text = "Experience: 123"
unique_name_in_owner = true
target = NodePath("../..")
duration = 0.5
call_method = "__updated_simple_tween_method"
call_method = "_updated_simple_tween_method"
6 changes: 3 additions & 3 deletions scenes/ui/info_container/info_container.gd
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
extends MarginContainer

@onready var title_label: Label = %TitleLabel
@onready var info_label: Label = %InfoLabel

var info_id: String
var info_type: String

@onready var title_label: Label = %TitleLabel
@onready var info_label: Label = %InfoLabel

###############
## overrides ##
###############
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extends MarginContainer
class_name ScaleButton
extends MarginContainer

@onready var button: Button = %Button
2 changes: 1 addition & 1 deletion scenes/ui/progress_button/progress_button.gd
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ func _on_progress_button_paid(resource_generator: ResourceGenerator) -> void:
return

if get_id() == resource_generator.id:
progress_bar_simple_tween.play_animation_(_resource_generator.get_cooldown())
progress_bar_simple_tween.play_animation_during(_resource_generator.get_cooldown())

if _resource_generator.sfx_button_success:
Audio.play_sfx(_resource_generator.id, _resource_generator.sfx_button_success)
Expand Down
7 changes: 3 additions & 4 deletions scenes/ui/resource_tracker/resource_tracker.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
extends MarginContainer
class_name ResourceTracker
extends MarginContainer

@onready var resource_v_box_container: VBoxContainer = %ResourceVBoxContainer
@export var resource_item_scene: PackedScene

@onready var resource_v_box_container: VBoxContainer = %ResourceVBoxContainer
@onready var title_label: Label = %TitleLabel
@export var resource_item_scene: PackedScene

###############
## overrides ##
Expand All @@ -17,7 +17,6 @@ func _ready() -> void:
_load_from_save_file()



#############
## helpers ##
#############
Expand Down
Loading

0 comments on commit 13352c1

Please sign in to comment.