Skip to content

Commit

Permalink
Merge pull request #39 from snipercup/update-terraintile-editor
Browse files Browse the repository at this point in the history
Add the rest of the terrain tiles
  • Loading branch information
snipercup authored Mar 5, 2024
2 parents 4904c2a + 486853d commit 18d5f28
Show file tree
Hide file tree
Showing 23 changed files with 1,091 additions and 281 deletions.
1,020 changes: 1,020 additions & 0 deletions Mods/Core/Tiles/Tiles.json

Large diffs are not rendered by default.

Binary file removed Mods/Core/Tiles/forestunderbrush.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/forestunderbrush.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/forestunderbrush1.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/forestunderbrush1.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/forestunderbrush2.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/forestunderbrush2.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/forestunderbrush3.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/forestunderbrush3.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/forestunderbrush4.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/forestunderbrush4.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/grasseastdirt.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/grasseastdirt.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/grasssouthdirt.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/grasssouthdirt.png.import

This file was deleted.

Binary file removed Mods/Core/Tiles/grasswestdirt.png
Binary file not shown.
34 changes: 0 additions & 34 deletions Mods/Core/Tiles/grasswestdirt.png.import

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ extends Control
# The content editor has connected this signal to Gamedata already
signal data_changed()

var control_elements: Array = []
# The data that represents this tile
# The data is selected from the Gamedata.data.tiles.data array
# based on the ID that the user has selected in the content editor
Expand All @@ -28,6 +29,30 @@ var contentData: Dictionary = {}:
load_tile_data()
tileSelector.sprites_collection = Gamedata.data.tiles.sprites


func _ready():
control_elements = [
tileImageDisplay,
NameTextEdit,
DescriptionTextEdit,
CategoriesList,
cubeShapeCheckbox,
slopeShapeCheckbox
]

func _input(event):
if event.is_action_pressed("ui_focus_next"):
for myControl in control_elements:
if myControl.has_focus():
if Input.is_key_pressed(KEY_SHIFT): # Check if Shift key
if !myControl.focus_previous.is_empty():
myControl.get_node(myControl.focus_previous).grab_focus()
else:
if !myControl.focus_next.is_empty():
myControl.get_node(myControl.focus_next).grab_focus()
break
get_viewport().set_input_as_handled()

# This function updates the form based on the contentData that has been loaded
func load_tile_data():
if tileImageDisplay != null and contentData.has("sprite"):
Expand All @@ -54,7 +79,7 @@ func load_tile_data():
#TODO: Check for unsaved changes
func _on_close_button_button_up():
queue_free()

# This function takes all data fro the form elements stores them in the contentData
# Since contentData is a reference to an item in Gamedata.data.tiles.data
# the central array for tiledata is updated with the changes as well
Expand Down
6 changes: 6 additions & 0 deletions Scenes/ContentManager/Custom_Editors/TerrainTileEditor.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ custom_minimum_size = Vector2(128, 128)
layout_mode = 2
size_flags_horizontal = 0
size_flags_stretch_ratio = 0.4
tooltip_text = "Select a sprite that will be used to visualize this terrain. You can add sprites by putting the image in /mods/core/Tiles."
texture = ExtResource("2_x7b0a")
expand_mode = 3

Expand Down Expand Up @@ -85,6 +86,7 @@ custom_minimum_size = Vector2(0, 30)
layout_mode = 2
size_flags_horizontal = 3
size_flags_stretch_ratio = 0.1
tooltip_text = "Give a descriptive name that best describes this terrain"
focus_next = NodePath("../DescriptionTextEdit")
focus_previous = NodePath("../TileImageDisplay")

Expand All @@ -97,6 +99,7 @@ layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 0.9
tooltip_text = "This description helps users understand how this terrain is used"
focus_next = NodePath("../Editable_Item_List")
focus_previous = NodePath("../NameTextEdit")

Expand All @@ -108,6 +111,7 @@ text = "Categories:"
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "Categories used in the map editor to separate this terrain from terrain in other categories. For example Floor and Urban"
header = "Categories"

[node name="ShapeLabel" type="Label" parent="VBoxContainer/FormGrid"]
Expand All @@ -119,11 +123,13 @@ layout_mode = 2

[node name="CubeShapeCheckBox" type="CheckBox" parent="VBoxContainer/FormGrid/ShapeButtonContainer"]
layout_mode = 2
tooltip_text = "Select this if this terrain is represented by a cube. This allows for it to be either a wall or a floor. This is the default value"
button_pressed = true
text = "Cube"

[node name="SlopeShapeCheckBox" type="CheckBox" parent="VBoxContainer/FormGrid/ShapeButtonContainer"]
layout_mode = 2
tooltip_text = "Select this if this terrain should be represented by a slope. Tipically ised for stairs or ramps. The player can go one level up if approached from the right angle."
text = "Slope"

[node name="Sprite_selector" parent="." instance=ExtResource("5_5ngda")]
Expand Down
Loading

0 comments on commit 18d5f28

Please sign in to comment.