Add basic functionality for plotting meshes of interiors
This commit is contained in:
parent
f6e3408d0e
commit
4963f7b355
BIN
local_player.scn (Stored with Git LFS)
BIN
local_player.scn (Stored with Git LFS)
Binary file not shown.
BIN
map_editor.scn (Stored with Git LFS)
BIN
map_editor.scn (Stored with Git LFS)
Binary file not shown.
|
@ -1,18 +1,19 @@
|
||||||
class_name MapEditorMenu extends VBoxContainer
|
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)
|
signal edit_activated(edit_action: Callable)
|
||||||
|
|
||||||
##
|
##
|
||||||
##
|
## Emits [signal edit_activated].
|
||||||
##
|
##
|
||||||
func activate_editor(edit_action: Callable) -> void:
|
func activate_editor(edit_action: Callable) -> void:
|
||||||
edit_activated.emit(edit_action)
|
edit_activated.emit(edit_action)
|
||||||
|
|
||||||
##
|
##
|
||||||
##
|
## Resets the state of the menu.
|
||||||
##
|
##
|
||||||
func reset() -> void:
|
func reset() -> void:
|
||||||
pass
|
pass
|
||||||
|
|
BIN
map_editor/menus_theme.res (Stored with Git LFS)
BIN
map_editor/menus_theme.res (Stored with Git LFS)
Binary file not shown.
Binary file not shown.
10
mesh_grid.gd
10
mesh_grid.gd
|
@ -112,9 +112,6 @@ var size: Vector2i:
|
||||||
_chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil())
|
_chunks_size = Vector2i((value / float(_CHUNK_SIZE)).ceil())
|
||||||
size = value
|
size = value
|
||||||
|
|
||||||
func _get_area() -> Rect2i:
|
|
||||||
return Rect2i(Vector2i.ZERO, size)
|
|
||||||
|
|
||||||
func _get_chunk(chunk_coordinate: Vector2i) -> Chunk:
|
func _get_chunk(chunk_coordinate: Vector2i) -> Chunk:
|
||||||
return _chunks[(_chunks_size.x * chunk_coordinate.y) + chunk_coordinate.x]
|
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].
|
## For clearing the whole of the mesh grid, see [method clear_mesh].
|
||||||
##
|
##
|
||||||
func fill_mesh(area: Rect2i, mesh: Mesh) -> void:
|
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()
|
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)
|
_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
|
## Plots a single mesh at [code]coordinates[/code] to be [code]mesh[/code], overwriting whatever it
|
||||||
## previously contained.
|
## 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].
|
## For bulk-setting many meshes at once, see [method fill_mesh] and [method clear_mesh].
|
||||||
##
|
##
|
||||||
func plot_mesh(coordinates: Vector2i, mesh: Mesh) -> void:
|
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_coordinates := coordinates / _CHUNK_SIZE
|
||||||
var chunk := _get_chunk(chunk_coordinates)
|
var chunk := _get_chunk(chunk_coordinates)
|
||||||
|
|
|
@ -14,6 +14,7 @@ config/name="Protectorate"
|
||||||
run/main_scene="res://map_editor.scn"
|
run/main_scene="res://map_editor.scn"
|
||||||
config/use_custom_user_dir=true
|
config/use_custom_user_dir=true
|
||||||
config/features=PackedStringArray("4.0", "Forward Plus")
|
config/features=PackedStringArray("4.0", "Forward Plus")
|
||||||
|
boot_splash/show_image=false
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
@ -81,6 +82,11 @@ editor_paint={
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[layer_names]
|
||||||
|
|
||||||
|
3d_render/layer_1="Physical"
|
||||||
|
3d_render/layer_2="Interface"
|
||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
common/physics_ticks_per_second=30
|
common/physics_ticks_per_second=30
|
||||||
|
|
Loading…
Reference in New Issue