Compare commits

..

No commits in common. "f3e630849be7c72ffce87a2f057686d6dc59922f" and "e72698ffcdca67b9e163c3ae9d786cb37aeee78c" have entirely different histories.

17 changed files with 50 additions and 218 deletions

BIN
editor.scn (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
[remap]
importer="image"
type="Image"
uid="uid://drok88h02tdre"
path="res://.godot/imported/brush_hard_circle_mask.png-e647df7b970f00cdf2f3f2ac38ad8257.image"
[deps]
source_file="res://editor/brush_hard_circle_mask.png"
dest_files=["res://.godot/imported/brush_hard_circle_mask.png-e647df7b970f00cdf2f3f2ac38ad8257.image"]
[params]

View File

@ -0,0 +1,14 @@
[remap]
importer="image"
type="Image"
uid="uid://bbdh4btpg08do"
path="res://.godot/imported/brush_soft_circle_mask.png-5af527bedd556c2d7ed38b029e34527e.image"
[deps]
source_file="res://editor/brush_soft_circle_mask.png"
dest_files=["res://.godot/imported/brush_soft_circle_mask.png-5af527bedd556c2d7ed38b029e34527e.image"]
[params]

BIN
editor/menus_theme.res (Stored with Git LFS) Normal file

Binary file not shown.

BIN
map_editor.scn (Stored with Git LFS)

Binary file not shown.

View File

@ -1,12 +0,0 @@
shader_type spatial;
render_mode shadows_disabled, unshaded, cull_disabled;
void fragment() {
if (FRONT_FACING) {
ALBEDO = vec3(1.0, 0.0, 0.0);
ALPHA = 0.5;
} else {
ALBEDO = vec3(0.0, 1.0, 0.0);
ALPHA = 0.1;
}
}

View File

@ -1,14 +0,0 @@
[remap]
importer="image"
type="Image"
uid="uid://drok88h02tdre"
path="res://.godot/imported/brush_hard_circle_mask.png-b5b7b3c7aa50923306e69fd4680a2d65.image"
[deps]
source_file="res://map_editor/brush_hard_circle_mask.png"
dest_files=["res://.godot/imported/brush_hard_circle_mask.png-b5b7b3c7aa50923306e69fd4680a2d65.image"]
[params]

View File

@ -1,14 +0,0 @@
[remap]
importer="image"
type="Image"
uid="uid://bbdh4btpg08do"
path="res://.godot/imported/brush_soft_circle_mask.png-f4362d74cca7ee83b36212049a3b11fb.image"
[deps]
source_file="res://map_editor/brush_soft_circle_mask.png"
dest_files=["res://.godot/imported/brush_soft_circle_mask.png-f4362d74cca7ee83b36212049a3b11fb.image"]
[params]

BIN
map_editor/camera_boundary_mesh.res (Stored with Git LFS)

Binary file not shown.

View File

@ -1,143 +0,0 @@
class_name MapEditorController extends Node
##
## Default elevation height for terrain.
##
const DEFAULT_ELEVATION := 0.5
var _brush_selected := 0
@export
var _registered_brushes: Array[Image] = []
@export
var _registered_paints: Array[TerrainPaint] = []
var _paint_selected_erase := 0
var _paint_selected_blue := 0
var _paint_selected_green := 0
var _paint_selected_red := 0
##
##
##
var smooth_elevation := DEFAULT_ELEVATION
##
##
##
func disable_controls() -> void:
set_process(false)
##
##
##
func enable_controls() -> void:
set_process(true)
##
##
##
func get_registered_brushes() -> Array[Image]:
return _registered_brushes
##
##
##
func get_registered_paints() -> Array[TerrainPaint]:
return _registered_paints
##
##
##
func get_selected_brush() -> int:
return _brush_selected
##
##
##
func get_selected_paint_blue() -> int:
return _paint_selected_blue
##
##
##
func get_selected_paint_erase() -> int:
return _paint_selected_erase
##
##
##
func get_selected_paint_green() -> int:
return _paint_selected_green
##
##
##
func get_selected_paint_red() -> int:
return _paint_selected_red
##
## Registers [code]brush_mask[/code] as a usable brush option in the editor.
##
func register_brush(brush_mask: Image) -> void:
_registered_brushes.append(brush_mask)
##
## Registers [code]terrain_paint[/code] as a usable paint option in the editor.
##
func register_paint(terrain_paint: TerrainPaint) -> void:
_registered_paints.append(terrain_paint)
##
## Resets the editor settings to their initial values.
##
func reset() -> void:
select_brush(0)
select_paint_erase(0)
select_paint_red(0)
select_paint_green(0)
select_paint_blue(0)
##
##
##
func select_brush(selected_index: int) -> void:
assert((selected_index >= 0) or (selected_index < _registered_brushes.size()))
_brush_selected = selected_index
##
##
##
func select_paint_blue(selected_index: int) -> void:
assert((selected_index >= 0) or (selected_index < _registered_paints.size()))
_paint_selected_blue = selected_index
##
##
##
func select_paint_erase(selected_index: int) -> void:
assert((selected_index >= 0) or (selected_index < _registered_paints.size()))
_paint_selected_erase = selected_index
##
##
##
func select_paint_green(selected_index: int) -> void:
assert((selected_index >= 0) or (selected_index < _registered_paints.size()))
_paint_selected_green = selected_index
##
##
##
func select_paint_red(selected_index: int) -> void:
assert((selected_index >= 0) or (selected_index < _registered_paints.size()))
_paint_selected_red = selected_index

BIN
map_editor/menus_theme.res (Stored with Git LFS)

Binary file not shown.

View File

@ -98,7 +98,9 @@ func _input(event: InputEvent) -> void:
if (event is InputEventMouseMotion) and self._is_drag_panning:
var global_basis := self.global_transform.basis
var camera_settings := GameSettings.camera_settings
var dampened_speed := camera_settings.movement_speed_modifier * _DRAG_SPEED_BASE_MODIFIER
var dampened_speed :=\
camera_settings.movement_speed_modifier * _DRAG_SPEED_BASE_MODIFIER
self._target_position += dampened_speed.y * (-global_basis.z) *\
event.relative.y * (-1.0 if camera_settings.is_y_inverted else 1.0)
@ -159,12 +161,6 @@ func _ready() -> void:
self.select_mode_changed.emit(SelectMode.NONE))
##
##
##
func in_select_area() -> bool:
return self._select_mode != SelectMode.NONE
##
## Returns [code]true[/code] if the player controller is currently selecting a location on the
## screen, otherwise [code]false[/code].
@ -185,6 +181,17 @@ func is_selecting() -> bool:
func get_cursor_point() -> Vector2:
return self._cursor_point
##
## Returns the current [enum SelectMode] being used for selections.
##
## The general use-case for this function is to peek through the player controller abstraction and
## see what supported hardware interface is currently being used to select in the world. This is
## useful for handling input-specific behaviors, such as showing a mouse cursor when a mouse input
## device is being used.
##
func get_select_mode() -> int:
return self._select_mode
##
## Attempts to convert the screen coordinates in [code]screen_point[/code] into 2D worldspace
## coordinate relative to an infinite ground plane at y offset [code]0.0[/code].

View File

@ -19,11 +19,6 @@ _global_script_classes=[{
"language": &"GDScript",
"path": "res://user_interface/button_selection.gd"
}, {
"base": "Node",
"class": &"MapEditorController",
"language": &"GDScript",
"path": "res://map_editor/map_editor_controller.gd"
}, {
"base": "Node3D",
"class": &"PlayerController",
"language": &"GDScript",
@ -47,7 +42,6 @@ _global_script_classes=[{
_global_script_class_icons={
"DynamicTerrainInstance3D": "",
"ItemSelection": "",
"MapEditorController": "",
"PlayerController": "",
"Settings": "",
"TerrainInstance3D": "",
@ -57,7 +51,7 @@ _global_script_class_icons={
[application]
config/name="Protectorate"
run/main_scene="res://map_editor.scn"
run/main_scene="res://editor.scn"
config/use_custom_user_dir=true
config/features=PackedStringArray("4.0", "Forward Plus")
config/icon="res://icon.png"

View File

@ -16,18 +16,7 @@ var item_count: int:
return _button_group.get_buttons().size()
func _get_configuration_warnings() -> PackedStringArray:
var warnings := PackedStringArray()
var children := get_children()
if not(children.is_empty()):
var self_class_name := get_class()
for child in get_children():
warnings.append(
"{0} can only have Button children, but {1} is of type {2}".format(
[self_class_name, child.name, child.get_class()]))
return warnings
return PackedStringArray()
##
## Adds a new item with no text and only [code]icon[/code] as the icon to the selection.