Interior Maps #13

Merged
kayomn merged 30 commits from interior-maps into main 2023-02-01 01:16:16 +01:00
6 changed files with 41 additions and 31 deletions
Showing only changes of commit 821c1ac8c4 - Show all commits

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 {
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
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].
##
kayomn marked this conversation as resolved Outdated

Doc comment does not mention purpose of orientation.

Doc comment does not mention purpose of `orientation`.
@ -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.
kayomn marked this conversation as resolved Outdated

Missing doc comment.

Missing doc comment.
##
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 {
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
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
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
## See [enum Kind].
##
## Interior tiles of different kinds will not conflict when placing them.
##
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
@export
var kind := Kind.FLOOR
##
##
## Used to visualize the interior tile.
##
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
@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
kayomn marked this conversation as resolved Outdated

Missing doc comment.

Missing doc comment.
## to the secondary selection action.
##
enum SelectAction {
PRIMARY,
@ -22,7 +25,10 @@ enum SelectMode {
signal select_mode_changed(mode: SelectMode)
##
kayomn marked this conversation as resolved Outdated

Purpose of select_action is not explained in doc comment.

Purpose of `select_action` is not explained in doc comment.
## 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].
kayomn marked this conversation as resolved Outdated

Missing doc comment.

Missing doc comment.
##
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()
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
##
## The prompt has been started.
##
signal prompted()
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
@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())
##
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
## 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()
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
##
## The item at index [code]selected_item[/code] has been selected in the prompt.
##
signal prompt_selected(selected_item: int)
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.

View File

@ -1,31 +1,33 @@
class_name WorkerPrompt extends Control
##
##
## The work being performed by the prompt has ended.
##
signal prompt_completed()
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
##
## The prompt has been started.
##
signal prompted()
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
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
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
##
## Used to display the progress of the prompt or [code]null[/code] to not display anything.
##
@export
var progress: Range = null
kayomn marked this conversation as resolved
Review

Missing doc comment.

Missing doc comment.
##
## Starts the prompt, emitting [signal prompted].
##
## [signal prompt_completed] is emitted when the work being performed by the prompt has ended.
kayomn marked this conversation as resolved Outdated

Missing doc comment.

Missing doc comment.
##
func prompt(display_message: String, steps: Array) -> void:
LocalPlayer.override_controls(hidden)