Amend code review comments

This commit is contained in:
kayomn 2023-02-01 00:05:48 +00:00
parent 3af575298d
commit 821c1ac8c4
6 changed files with 41 additions and 31 deletions

View File

@ -5,7 +5,7 @@ const _CHUNK_SIZE := 32
const _GRID_ORIGIN := Vector2(0.5, 0.5)
##
##
## Cardinal orientation referencing the direction of a tile.
##
enum Orientation {
NORTH,
@ -176,7 +176,8 @@ func _notification(what: int) -> void:
multimesh_instance.set_offset_transform(global_transform)
##
## Clears the entirety of the tile grid to only contain [code]tile[/code].
## Clears the entirety of the tile grid to only contain tiles of instance [code]tile[/code] pointing
## in the orientation of [code]orientation[/code].
##
## For clearing a specific region of the mesh grid, see [method fill_mesh].
##
@ -218,7 +219,8 @@ func clear_tiles(orientation: Orientation, tile: InteriorTile) -> void:
_get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate)
##
## Clears the region of the tile grid at [code]area[/code] to only contain [code]tile[/code].
## Clears the region of the tile grid at [code]area[/code] to only contain instances of
## [code]tile[/code] pointing in the orientation of [code]orientation[/code].
##
## *Note* that [code]area[/code] *must* be within the area of the of the mesh grid, where
## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom-
@ -282,14 +284,14 @@ func fill_tiles(area: Rect2i, orientation: Orientation, tile: InteriorTile) -> v
_get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate)
##
##
## Returns the area of the interior map based on its current size.
##
func get_area() -> Rect2i:
return Rect2i(Vector2i.ZERO, size)
##
## Plots a single tile at [code]coordinates[/code] to be [code]tile[/code], overwriting whatever it
## previously contained.
## Plots a single tile at [code]coordinates[/code] to be an instance of [code]tile[/code] pointing
## in the orientation of [code]orientation[/code], overwriting whatever it previously contained.
##
## *Note* that [code]coordinates[/code] *must* be within the area of the of the mesh grid, where
## [code]Vector2i.ZERO[/code] is the top-left and [member size] [code]- 1[/code] is the bottom-
@ -324,9 +326,3 @@ func plot_tile(coordinates: Vector2i, orientation: Orientation, tile: InteriorTi
InteriorTile.Kind.WALL:
chunk.set_wall_mesh(coordinates % _CHUNK_SIZE, orientation, mesh)
chunk.invalidate(self, chunk_coordinates)
##
##
##
func world_to_grid(world_position: Vector2) -> Vector2i:
return Vector2i((world_position + (Vector2(size) * _GRID_ORIGIN)).round())

View File

@ -1,7 +1,7 @@
class_name InteriorTile extends Resource
##
##
## Identifier for the kind of interior tile.
##
enum Kind {
FLOOR,
@ -9,19 +9,21 @@ enum Kind {
}
##
##
## Flag for determining if the tile is affected by orientations specified in an [InteriorMap].
##
@export
var fixed_orientation := false
##
## See [enum Kind].
##
## Interior tiles of different kinds will not conflict when placing them.
##
@export
var kind := Kind.FLOOR
##
##
## Used to visualize the interior tile.
##
@export
var mesh: Mesh = null

View File

@ -1,7 +1,10 @@
class_name PlayerController extends Node3D
##
## Selection action performed.
##
## [code]PRIMARY[/code] refers to the default selection action, while [code]SECONDARY[/code] refers
## to the secondary selection action.
##
enum SelectAction {
PRIMARY,
@ -22,7 +25,10 @@ enum SelectMode {
signal select_mode_changed(mode: SelectMode)
##
## Selection of a point on screenspace has started happening.
## Selection of a point on the screen space has started happening, with [code]select_action[/code]
## as selection action performed.
##
## See [enum SelectAction] for more details.
##
signal selection_started(select_action: SelectAction)
@ -179,19 +185,18 @@ func get_plane_cursor() -> Vector2:
return Vector2.ZERO
##
## Returns [code]true[/code] if the player controller is currently frozen, otherwise
## [code]false[/code].
##
func is_frozen() -> bool:
assert(_control_override_count > -1, "control override count cannot be less than 0")
return _control_override_count != 0
##
##
##
func in_select_area() -> bool:
return _select_mode != SelectMode.NONE
##
##
## Overrides the controls of the player controller. When [code]unlock_signal[/code] is emitted, the
## override is released.
##
func override_controls(unlock_signal: Signal) -> void:
assert(_control_override_count > -1, "control override count cannot be less than 0")

View File

@ -2,18 +2,21 @@
class_name ActionPrompt extends Control
##
##
## The prompt accept button has been pressed.
##
signal prompt_accepted()
##
##
## The prompt has been started.
##
signal prompted()
@export
var _accept_button: BaseButton = null
##
## The initial control focused on when it is prompted or [code]null[/code] for no default.
##
@export
var initial_focus: Control = null
@ -33,7 +36,9 @@ func _ready() -> void:
hide())
##
## Starts the prompt, emitting [signal prompted].
##
## [signal prompt_accepted] is emitted when the accept button in the action prompt is pressed.
##
func prompt() -> void:
LocalPlayer.override_controls(hidden)

View File

@ -2,12 +2,12 @@
class_name SelectionPrompt extends Control
##
##
## The prompt has been started.
##
signal prompted()
##
##
## The item at index [code]selected_item[/code] has been selected in the prompt.
##
signal prompt_selected(selected_item: int)

View File

@ -1,31 +1,33 @@
class_name WorkerPrompt extends Control
##
##
## The work being performed by the prompt has ended.
##
signal prompt_completed()
##
##
## The prompt has been started.
##
signal prompted()
var _worker_thread := Thread.new()
##
##
## Used to display a message from the prompt or [code]null[/code] to not display anything.
##
@export
var label: Label = null
##
##
## Used to display the progress of the prompt or [code]null[/code] to not display anything.
##
@export
var progress: Range = null
##
## Starts the prompt, emitting [signal prompted].
##
## [signal prompt_completed] is emitted when the work being performed by the prompt has ended.
##
func prompt(display_message: String, steps: Array) -> void:
LocalPlayer.override_controls(hidden)