Skip to content

Commit 085e8f4

Browse files
committed
coding style more fixes
1 parent cf370a8 commit 085e8f4

11 files changed

Lines changed: 32 additions & 27 deletions

File tree

Assets/UI/InfoWidgets/FinanceAndResourceOverlay.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ func on_context_changed(context: BaseContext) -> void:
2222
building = building_context.building_to_build
2323
else: # if the context is not the building context disconnect the update signal
2424
var remembered_building_context := self.current_context as BuildingContext
25-
if remembered_building_context != null and remembered_building_context.building_changed.is_connected(self.on_building_changed) == true:
25+
if remembered_building_context != null and remembered_building_context.building_changed.is_connected(self.on_building_changed):
2626
remembered_building_context.building_changed.disconnect(self.on_building_changed)
2727

2828
if building != &"":

Assets/World/Components/Collectors/Collector.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,8 @@ func get_jobs_for_lumberjack_collector() -> Array[Job]:
402402
var cell_data: TileData = self.built_tilemap.get_cell_tile_data(cell)
403403
if cell_data == null:
404404
continue
405-
if cell_data.get_custom_data(self.built_tilemap.is_tree) == true:
405+
var is_tree: bool = cell_data.get_custom_data(self.built_tilemap.is_tree)
406+
if is_tree:
406407
if cell in self.built_tilemap.trees_getting_choped:
407408
continue
408409
var path_to_start: Array[Vector2i] = self.get_cell_path(collector_map_position, cell) # to cell

Assets/World/Components/CommandableComponent/CommandableComponent.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func set_components(new_components: Array[BaseComponent]) -> void:
2626

2727
func handle_context_input(event: InputEvent):
2828
if event is InputEventMouseButton:
29-
if event.pressed == true:
29+
if event.pressed:
3030
if event.button_index == MOUSE_BUTTON_RIGHT:
3131
self.add_checkpoint() # fire and forget
3232

Assets/World/Components/ProductionLine/ProductionLineComponent.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,16 +151,16 @@ func update_resource_storage_tooltips(has_enough_resources: bool, has_output_spa
151151
if self.inventory_full_tooltip.visible == false:
152152
self.inventory_full_tooltip.visible = true
153153
self.inventory_full_tooltip.play("inventory_full")
154-
elif self.inventory_full_tooltip.visible == true:
154+
elif self.inventory_full_tooltip.visible:
155155
self.inventory_full_tooltip.visible = false
156156
self.inventory_full_tooltip.stop()
157157

158158
if self.show_resource_deficit_tooltip:
159-
if has_enough_resources == false and has_output_space == true: # show resource deficit
159+
if has_enough_resources == false and has_output_space: # show resource deficit
160160
if self.resource_deficit_tooltip.visible == false:
161161
self.resource_deficit_tooltip.visible = true
162162
self.resource_deficit_tooltip.play("resource_deficit")
163-
elif self.resource_deficit_tooltip.visible == true:
163+
elif self.resource_deficit_tooltip.visible:
164164
self.resource_deficit_tooltip.visible = false
165165
self.resource_deficit_tooltip.stop()
166166

Assets/World/Context/BuildingContext.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func _unhandled_input(event: InputEvent) -> void:
8787
self.update_building_highlight()
8888

8989
var mouseButtonEvent := event as InputEventMouseButton
90-
if mouseButtonEvent != null and mouseButtonEvent.pressed == true:
90+
if mouseButtonEvent != null and mouseButtonEvent.pressed:
9191
if mouseButtonEvent.button_index == MOUSE_BUTTON_LEFT:
9292
self.build(self.building_to_build, self.building_instance)
9393
return

Assets/World/Context/BuildingRoadContext.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,10 @@ func _unhandled_input(event):
3939
self.game_context_manager.current_context = self
4040

4141
if self.is_active:
42-
if event is InputEventMouseButton:
43-
if event.pressed == true:
44-
if event.button_index == MOUSE_BUTTON_LEFT:
42+
var mouseButtonEvent := event as InputEventMouseButton
43+
if mouseButtonEvent != null:
44+
if mouseButtonEvent.pressed:
45+
if mouseButtonEvent.button_index == MOUSE_BUTTON_LEFT:
4546
respond_to_left_click()
4647

4748
if event.is_action_pressed("cancel"):

Assets/World/Context/DemolitionContext.gd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ func _unhandled_input(event: InputEvent) -> void:
2525

2626
if self.is_active:
2727
var mouse_cell := self.built_tilemap.local_to_map(self.built_tilemap.get_global_mouse_position())
28-
if event is InputEventMouseButton:
29-
if event.button_index == MOUSE_BUTTON_LEFT and event.pressed == true:
28+
var mouseButtonEvent := event as InputEventMouseButton
29+
if mouseButtonEvent != null:
30+
if mouseButtonEvent.button_index == MOUSE_BUTTON_LEFT and mouseButtonEvent.pressed:
3031
self.demolish(mouse_cell)
3132

3233
if event.is_action_pressed("cancel"):

Assets/World/Context/SelectionBox.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ var sel_pos_start := Vector2(0,0) # first click position
77
@export var line_color: Color = Color(1, 1, 1, 0.5)
88

99
func _unhandled_input(event):
10-
if event is InputEventMouseButton:
11-
if event.button_index == MOUSE_BUTTON_LEFT:
12-
if event.pressed == true:
10+
var mouseButtonEvent := event as InputEventMouseButton
11+
if mouseButtonEvent != null:
12+
if mouseButtonEvent.button_index == MOUSE_BUTTON_LEFT:
13+
if mouseButtonEvent.pressed:
1314
sel_pos_start = get_viewport().get_mouse_position()
1415

1516
func _process(_delta: float) -> void:

Assets/World/Context/SelectionContext.gd

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,10 @@ func context_entered() -> void:
1717

1818
func _unhandled_input(event):
1919
if self.is_active or object_selected_context.is_active:
20-
if event is InputEventMouseButton:
21-
if event.button_index == MOUSE_BUTTON_LEFT:
22-
if event.pressed == true:
20+
var mouseButtonEvent := event as InputEventMouseButton
21+
if mouseButtonEvent != null:
22+
if mouseButtonEvent.button_index == MOUSE_BUTTON_LEFT:
23+
if mouseButtonEvent.pressed:
2324
# print(built_tilemap.get_global_mouse_position())
2425
selection_rect.position = built_tilemap.get_global_mouse_position()
2526
selection_box.visible = true

DevTools/AnimationTemplate.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ animations = [{
4040
},
4141
{%- endfor %}
4242
{% endfor %}
43-
]
43+
]

0 commit comments

Comments
 (0)