Skip to content

Commit edee89f

Browse files
committed
creature stats comparison window done
1 parent 223fe96 commit edee89f

File tree

5 files changed

+58
-24
lines changed

5 files changed

+58
-24
lines changed

Autoload/Version.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
extends Node
22

3-
var major_minor = "0.47"
3+
var major_minor = "0.48"
44
var patch = "0000"
55
var full = ""
66
var unearth_map_format_version:float = 1.05

Scenes/CfgLoader.gd

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ func load_objects_data(path):
6666
Things.DATA_OBJECT[id] = [newName, newSprite, newEditorTab]
6767

6868
func load_terrain_data(path):
69+
return #!!!!!!!
70+
6971
var terrain_cfg = Utils.read_dkcfg_file(path)
7072
for section in terrain_cfg:
7173
if section.begins_with("slab"):

Scenes/CompareCreatureStats.gd

+29-15
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,28 @@ extends WindowDialog
22
onready var oGame = Nodelist.list["oGame"]
33
onready var oSortCreaStatsGrid = Nodelist.list["oSortCreaStatsGrid"]
44
onready var oStatsOptionButton = Nodelist.list["oStatsOptionButton"]
5+
onready var oMessage = Nodelist.list["oMessage"]
56

7+
var name_type = 0
68

79
var all_creature_data = {}
810

911
var selected_labels = []
12+
func _on_SortCreatureStats_visibility_changed():
13+
if visible == true:
14+
start()
1015

11-
func _ready():
12-
for i in 10:
13-
yield(get_tree(),'idle_frame')
14-
15-
var CODETIME_START = OS.get_ticks_msec()
16+
func start():
1617
var listOfCfgs = Utils.get_filetype_in_directory(oGame.GAME_DIRECTORY.plus_file("creatrs"), "CFG")
1718
for path in listOfCfgs:
1819
var aaa = Utils.read_dkcfg_file(path)
1920
all_creature_data[path.get_file()] = aaa
2021

21-
print('Codetime: ' + str(OS.get_ticks_msec() - CODETIME_START) + 'ms')
22-
2322
populate_optionbutton()
2423

25-
2624
# Default selection
2725
oStatsOptionButton.select(2)
2826
_on_StatsOptionButton_item_selected(2)
29-
30-
Utils.popup_centered(self)
3127

3228
func _on_StatsOptionButton_item_selected(optionButtonIndex):
3329
update_list(optionButtonIndex)
@@ -41,7 +37,8 @@ func update_list(optionButtonIndex):
4137
var optionButtonMeta = oStatsOptionButton.get_item_metadata(optionButtonIndex)
4238

4339
for file in all_creature_data:
44-
var getName = all_creature_data[file].get("attributes").get("Name")
40+
var getName = figure_out_name(all_creature_data[file].get("attributes").get("Name"), file)
41+
4542
for section in all_creature_data[file]:
4643
if section == optionButtonMeta[0]:
4744

@@ -56,6 +53,16 @@ func update_list(optionButtonIndex):
5653
col = Color(1.0,1.0,1.0)
5754
add_entry(i[0], i[1], col)
5855

56+
func figure_out_name(NAME_ID, file):
57+
match name_type:
58+
0:
59+
var subtype = Things.find_subtype_by_name(Things.TYPE.CREATURE, NAME_ID)
60+
return Things.fetch_name(Things.TYPE.CREATURE, subtype)
61+
1:
62+
return NAME_ID
63+
2:
64+
return file
65+
5966

6067
func sort_list(a, b):
6168

@@ -134,10 +141,9 @@ func _on_label_gui_input(event, l1, l2):
134141

135142
func _on_NameStatsButton_pressed():
136143
selected_labels.clear()
137-
138-
139-
140-
144+
name_type += 1
145+
if name_type >= 3: name_type = 0
146+
update_list(oStatsOptionButton.selected)
141147

142148

143149
func _on_RightStatsButton_pressed():
@@ -174,3 +180,11 @@ func populate_optionbutton():
174180
oStatsOptionButton.add_item(key)
175181
oStatsOptionButton.set_item_metadata(idx, [section, key])
176182
oStatsOptionButton.add_separator()
183+
184+
185+
func _on_CCStatsHelpButton_pressed():
186+
var helptxt = ""
187+
helptxt += "These files are currently only loaded from the main /creatrs/ directory, not from anywhere else."
188+
oMessage.big("Help",helptxt)
189+
190+

Scenes/Main.tscn

+23-8
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ custom_colors/font_color_hover = Color( 1, 0.65098, 0.556863, 1 )
16991699
custom_colors/font_color_pressed = Color( 0.333333, 0.607843, 1, 1 )
17001700
text = "View"
17011701
align = 0
1702-
items = [ "Map folder", null, 0, false, false, 0, 0, null, "", false, "Script file", null, 0, false, false, 1, 0, null, "", false, "Log file", null, 0, false, false, 2, 0, null, "", false, "", null, 0, false, true, -1, 0, null, "", true, "3D: 1st person", null, 0, false, false, 3, 0, null, "", false, "", null, 0, false, true, -1, 0, null, "", true, "Action points", null, 0, false, false, 4, 0, null, "", false, "Grid data", null, 0, false, false, 5, 0, null, "", false ]
1702+
items = [ "Map folder", null, 0, false, false, 0, 0, null, "", false, "Script file", null, 0, false, false, 1, 0, null, "", false, "Log file", null, 0, false, false, 2, 0, null, "", false, "", null, 0, false, true, -1, 0, null, "", true, "3D: 1st person", null, 0, false, false, 3, 0, null, "", false, "", null, 0, false, true, -1, 0, null, "", true, "Action points", null, 0, false, false, 4, 0, null, "", false, "Grid data", null, 0, false, false, 5, 0, null, "", false, "Creature Stats", null, 0, false, false, 6, 0, null, "", false ]
17031703
switch_on_hover = true
17041704
__meta__ = {
17051705
"_edit_use_anchors_": false
@@ -6809,7 +6809,7 @@ margin_right = 2053.0
68096809
margin_bottom = -886.0
68106810
rect_min_size = Vector2( 281, 296 )
68116811
mouse_filter = 1
6812-
window_title = "Compare Creature Stats"
6812+
window_title = "Creature Stat Comparison"
68136813
resizable = true
68146814
script = ExtResource( 170 )
68156815

@@ -6859,31 +6859,44 @@ size_flags_horizontal = 0
68596859
text = ">"
68606860

68616861
[node name="ScrollContainer" type="ScrollContainer" parent="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer"]
6862-
anchor_right = 1.0
6863-
anchor_bottom = 1.0
6862+
margin_top = 31.0
6863+
margin_right = 309.0
6864+
margin_bottom = 870.0
68646865
size_flags_horizontal = 3
68656866
size_flags_vertical = 3
68666867

68676868
[node name="SortCreaStatsGrid" type="GridContainer" parent="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/ScrollContainer"]
6868-
anchor_right = 1.0
6869-
anchor_bottom = 1.0
6869+
margin_right = 309.0
6870+
margin_bottom = 839.0
68706871
size_flags_horizontal = 3
68716872
size_flags_vertical = 3
68726873
custom_constants/hseparation = 20
68736874
columns = 2
68746875

68756876
[node name="HBoxContainer2" type="HBoxContainer" parent="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer"]
6876-
margin_top = 879.0
6877+
margin_top = 874.0
68776878
margin_right = 309.0
68786879
margin_bottom = 906.0
68796880

68806881
[node name="NameStatsButton" type="Button" parent="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer2"]
68816882
margin_right = 100.0
6882-
margin_bottom = 27.0
6883+
margin_bottom = 32.0
68836884
rect_min_size = Vector2( 100, 0 )
68846885
size_flags_horizontal = 2
68856886
text = "Name"
68866887

6888+
[node name="CCStatsHelpButton" type="TextureButton" parent="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer2"]
6889+
margin_left = 277.0
6890+
margin_right = 309.0
6891+
margin_bottom = 32.0
6892+
rect_min_size = Vector2( 32, 32 )
6893+
size_flags_horizontal = 8
6894+
texture_normal = ExtResource( 156 )
6895+
texture_pressed = ExtResource( 66 )
6896+
texture_hover = ExtResource( 128 )
6897+
expand = true
6898+
stretch_mode = 4
6899+
68876900
[node name="MapCoordinatesWindow" type="WindowDialog" parent="Ui/UiSystem"]
68886901
visible = true
68896902
margin_left = -1480.0
@@ -7640,10 +7653,12 @@ script = SubResource( 20 )
76407653
[connection signal="pressed" from="Ui/UiSystem/ResizeCurrentMapSize/MarginContainer/VBoxContainer/ResizeApplyButton" to="Ui/UiSystem/ResizeCurrentMapSize" method="_on_ResizeApplyButton_pressed"]
76417654
[connection signal="visibility_changed" from="Ui/UiSystem/GridDataWindow" to="Game2D/AnalyzeGrids" method="_on_GridDataWindow_visibility_changed"]
76427655
[connection signal="visibility_changed" from="Ui/UiSystem/ActionPointListWindow" to="Ui/UiSystem/ActionPointListWindow/MarginContainer/VBoxContainer/ScrollContainer/ActionPointList" method="_on_ActionPointListWindow_visibility_changed"]
7656+
[connection signal="visibility_changed" from="Ui/UiSystem/SortCreatureStats" to="Ui/UiSystem/SortCreatureStats" method="_on_SortCreatureStats_visibility_changed"]
76437657
[connection signal="item_selected" from="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer/StatsOptionButton" to="Ui/UiSystem/SortCreatureStats" method="_on_StatsOptionButton_item_selected"]
76447658
[connection signal="pressed" from="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer/LeftStatsButton" to="Ui/UiSystem/SortCreatureStats" method="_on_LeftStatsButton_pressed"]
76457659
[connection signal="pressed" from="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer/RightStatsButton" to="Ui/UiSystem/SortCreatureStats" method="_on_RightStatsButton_pressed"]
76467660
[connection signal="pressed" from="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer2/NameStatsButton" to="Ui/UiSystem/SortCreatureStats" method="_on_NameStatsButton_pressed"]
7661+
[connection signal="pressed" from="Ui/UiSystem/SortCreatureStats/MarginContainer/VBoxContainer/HBoxContainer2/CCStatsHelpButton" to="Ui/UiSystem/SortCreatureStats" method="_on_CCStatsHelpButton_pressed"]
76477662
[connection signal="visibility_changed" from="Ui/UiSystem/MapCoordinatesWindow" to="Ui/UiSystem/MapCoordinatesWindow" method="_on_MapCoordinatesWindow_visibility_changed"]
76487663
[connection signal="gui_input" from="Ui/UiSystem/MapCoordinatesWindow/MarginContainer/VBoxContainer/LandviewAspectRatioContainer/LandviewImage" to="Ui/UiSystem/MapCoordinatesWindow" method="_on_LandviewImage_gui_input"]
76497664
[connection signal="resized" from="Ui/UiSystem/MapCoordinatesWindow/MarginContainer/VBoxContainer/LandviewAspectRatioContainer/LandviewImage" to="Ui/UiSystem/MapCoordinatesWindow" method="_on_LandviewImage_resized"]

Scenes/Menu.gd

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ onready var oGridDataWindow = Nodelist.list["oGridDataWindow"]
4141
onready var oCamera2D = Nodelist.list["oCamera2D"]
4242
onready var oActionPointListWindow = Nodelist.list["oActionPointListWindow"]
4343
onready var oUndoStates = Nodelist.list["oUndoStates"]
44+
onready var oSortCreatureStats = Nodelist.list["oSortCreatureStats"]
4445

4546
var recentlyOpened = []
4647
var recentlyOpenedPopupMenu = PopupMenu.new()
@@ -290,6 +291,8 @@ func _on_ViewSubmenu_Pressed(pressedID):
290291
Utils.popup_centered(oActionPointListWindow)
291292
5:
292293
Utils.popup_centered(oGridDataWindow)
294+
6:
295+
Utils.popup_centered(oSortCreatureStats)
293296
# 4:
294297
# if oEditor.currentView == oEditor.VIEW_2D:
295298
# oEditor.set_view_3d()

0 commit comments

Comments
 (0)