From 4963f7b355f377ae0b184b370b97c6c43edfc975 Mon Sep 17 00:00:00 2001 From: kayomn Date: Fri, 27 Jan 2023 19:36:54 +0000 Subject: [PATCH] Add basic functionality for plotting meshes of interiors --- local_player.scn | 4 ++-- map_editor.scn | 4 ++-- map_editor/map_editor_menu.gd | 7 ++++--- map_editor/menus_theme.res | 4 ++-- map_editor/tile_selector_button_group.res | 3 +++ mesh_grid.gd | 10 +++++----- project.godot | 6 ++++++ 7 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 map_editor/tile_selector_button_group.res diff --git a/local_player.scn b/local_player.scn index d169f96..876b659 100644 --- a/local_player.scn +++ b/local_player.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:6a4fe7961f0b6694c50311a199915c2acf0b1297a8bb1cb460dbab0e0c375cd2 -size 668 +oid sha256:4361765e205d45ccecaeb578065b3eec5aefab8f9a2484631bbd7004fa9eddf4 +size 679 diff --git a/map_editor.scn b/map_editor.scn index 951424f..a257138 100644 --- a/map_editor.scn +++ b/map_editor.scn @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b55b5cb6575b2283a305f610469f143d0fabe700b8a88f4e60e18615a872928c -size 9302 +oid sha256:8fe669ee1b4a2d2d023be4203cd3b694fcdad8be388ff4d97309cf5fa377918b +size 10446 diff --git a/map_editor/map_editor_menu.gd b/map_editor/map_editor_menu.gd index c84d4ae..f4c15ca 100644 --- a/map_editor/map_editor_menu.gd +++ b/map_editor/map_editor_menu.gd @@ -1,18 +1,19 @@ class_name MapEditorMenu extends VBoxContainer ## -## +## [code]edit_action[/code] has been activated for use when the player interacts with the map +## editor. ## signal edit_activated(edit_action: Callable) ## -## +## Emits [signal edit_activated]. ## func activate_editor(edit_action: Callable) -> void: edit_activated.emit(edit_action) ## -## +## Resets the state of the menu. ## func reset() -> void: pass diff --git a/map_editor/menus_theme.res b/map_editor/menus_theme.res index d240659..57edacb 100644 --- a/map_editor/menus_theme.res +++ b/map_editor/menus_theme.res @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:16a64c4d989cb97515aeb631c435db2c29388fb701e9e513d26692d3bba10f65 -size 847 +oid sha256:313a4fd4690a9521a50eda4bb8e1776031c27d1a0ee411c31185c9ea6f84aedc +size 886 diff --git a/map_editor/tile_selector_button_group.res b/map_editor/tile_selector_button_group.res new file mode 100644 index 0000000..15ec28f --- /dev/null +++ b/map_editor/tile_selector_button_group.res @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ac378ba65f50a7aef2a17925716d12bc0d5074d063f6e6a42de46e8a1c36a846 +size 209 diff --git a/mesh_grid.gd b/mesh_grid.gd index de70774..06b1c3e 100644 --- a/mesh_grid.gd +++ b/mesh_grid.gd @@ -112,9 +112,6 @@ var size: Vector2i: _chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil()) size = value -func _get_area() -> Rect2i: - return Rect2i(Vector2i.ZERO, size) - func _get_chunk(chunk_coordinate: Vector2i) -> Chunk: return _chunks[(_chunks_size.x * chunk_coordinate.y) + chunk_coordinate.x] @@ -157,7 +154,7 @@ func clear_mesh(mesh: Mesh) -> void: ## For clearing the whole of the mesh grid, see [method clear_mesh]. ## func fill_mesh(area: Rect2i, mesh: Mesh) -> void: - assert(_get_area().encloses(area), "area must be within grid") + assert(get_area().encloses(area), "area must be within grid") var filled_chunks := BitMap.new() @@ -178,6 +175,9 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: _get_chunk(chunk_coordinate).invalidate(self, chunk_coordinate) +func get_area() -> Rect2i: + return Rect2i(Vector2i.ZERO, size) + ## ## Plots a single mesh at [code]coordinates[/code] to be [code]mesh[/code], overwriting whatever it ## previously contained. @@ -191,7 +191,7 @@ func fill_mesh(area: Rect2i, mesh: Mesh) -> void: ## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh]. ## func plot_mesh(coordinates: Vector2i, mesh: Mesh) -> void: - assert(_get_area().has_point(coordinates), "coordinate must be within grid") + assert(get_area().has_point(coordinates), "coordinate must be within grid") var chunk_coordinates := coordinates / _CHUNK_SIZE var chunk := _get_chunk(chunk_coordinates) diff --git a/project.godot b/project.godot index c52661e..230da9b 100644 --- a/project.godot +++ b/project.godot @@ -14,6 +14,7 @@ config/name="Protectorate" run/main_scene="res://map_editor.scn" config/use_custom_user_dir=true config/features=PackedStringArray("4.0", "Forward Plus") +boot_splash/show_image=false config/icon="res://icon.png" [autoload] @@ -81,6 +82,11 @@ editor_paint={ ] } +[layer_names] + +3d_render/layer_1="Physical" +3d_render/layer_2="Interface" + [physics] common/physics_ticks_per_second=30