Skip to content

Commit a8459d7

Browse files
committed
Removed custom slabset slabs
1 parent 3435ed3 commit a8459d7

File tree

4 files changed

+58
-120
lines changed

4 files changed

+58
-120
lines changed

Scenes/AddCustomSlabWindow.gd

+18-42
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ onready var oColumnEditorControls = Nodelist.list["oColumnEditorControls"]
1818
onready var oSlabsetWindow = Nodelist.list["oSlabsetWindow"]
1919
onready var oDataClmPos = Nodelist.list["oDataClmPos"]
2020
onready var oColumnEditor = Nodelist.list["oColumnEditor"]
21-
onready var oFakeSlabCheckBox = Nodelist.list["oFakeSlabCheckBox"]
2221
onready var oFakeCustomColumnsPanelContainer = Nodelist.list["oFakeCustomColumnsPanelContainer"]
2322
onready var oSlabBitmaskOptionButton = Nodelist.list["oSlabBitmaskOptionButton"]
2423
onready var oSlabIsSolidOptionButton = Nodelist.list["oSlabIsSolidOptionButton"]
@@ -44,6 +43,7 @@ func _ready():
4443
spinbox.value = 1
4544
spinbox.connect("value_changed",oCustomSlabVoxelView,"_on_CustomSlabSpinBox_value_changed")
4645
customSlabArrayOfSpinbox.append(spinbox)
46+
id.size_flags_vertical = Control.SIZE_EXPAND_FILL
4747
oGridContainerCustomColumns3x3.add_child(id)
4848

4949
_on_CustomSlabID_value_changed(oCustomSlabID.value)
@@ -77,36 +77,23 @@ func _on_CustomSlabID_value_changed(value):
7777

7878

7979
func _on_AddCustomSlabButton_pressed():
80-
var is_fake = oFakeSlabCheckBox.pressed
81-
var newID
82-
if is_fake:
83-
newID = 1000 # We'll say fake slabs are ID 1000 and up
84-
# Find an unused ID within the fake data dictionary
85-
while Slabs.data.has(newID):
86-
newID += 1
87-
88-
else:
89-
newID = int(oCustomSlabID.value) # For slabset, use the value from the UI
90-
if Slabs.data.has(newID):
91-
oMessage.big("Error", "For Slabset slabs you must use a unique ID. You may need to first delete the existing one.")
92-
return
93-
94-
95-
80+
var newID = 1000 # We'll say fake slabs are ID 1000 and up
81+
# Find an unused ID within the fake data dictionary
82+
while Slabs.data.has(newID):
83+
newID += 1
9684

9785
var slabCubeData = []
9886
var slabFloorData = []
99-
if is_fake: # For fake slabs, gather cube and floor data from the UI elements
100-
for id in oGridContainerCustomColumns3x3.get_children():
101-
var spinbox = id.get_node("CustomSpinBox")
102-
var clmIndex = spinbox.value
103-
slabCubeData.append(oDataClm.cubes[clmIndex])
104-
slabFloorData.append(oDataClm.floorTexture[clmIndex])
105-
106-
if oDataClm.floorTexture[clmIndex] == 0 and oDataClm.cubes[clmIndex] == [0,0,0,0, 0,0,0,0]:
107-
oMessage.quick("You should not use blank columns")
108-
# Blank columns get indexed by other columns after a while
109-
return
87+
for id in oGridContainerCustomColumns3x3.get_children():
88+
var spinbox = id.get_node("CustomSpinBox")
89+
var clmIndex = spinbox.value
90+
slabCubeData.append(oDataClm.cubes[clmIndex])
91+
slabFloorData.append(oDataClm.floorTexture[clmIndex])
92+
93+
if oDataClm.floorTexture[clmIndex] == 0 and oDataClm.cubes[clmIndex] == [0,0,0,0, 0,0,0,0]:
94+
oMessage.quick("You should not use blank columns")
95+
# Blank columns get indexed by other columns after a while
96+
return
11097

11198
var slab_dict = {
11299
"header_id": newID,
@@ -171,12 +158,8 @@ func get_column_indexes_on_tile(cursorTile):
171158

172159

173160
func update_type():
174-
if oFakeSlabCheckBox.pressed == true:
175-
oFakeCustomColumnsPanelContainer.visible = true
176-
oCustomSlabVoxelView.modulate.a = 1
177-
else:
178-
oFakeCustomColumnsPanelContainer.visible = false
179-
oCustomSlabVoxelView.modulate.a = 0
161+
oFakeCustomColumnsPanelContainer.visible = true
162+
oCustomSlabVoxelView.modulate.a = 1
180163

181164

182165
func _on_SlabsetSlabCheckBox_pressed():
@@ -195,20 +178,13 @@ func _on_FakeSlabHelpButton_pressed():
195178
helptext += "Right click on the map while the Fake slab menu is open to copy column index numbers into the window."
196179
oMessage.big("Help",helptext)
197180

198-
func _on_SlabsetSlabHelpButton_pressed():
199-
var helptext = ""
200-
helptext += "Go to Edit->Slabset to define what this Slabset slab looks like and then select the same ID. \n"
201-
helptext += "Slabset Slabs require the slabset.toml (or columnset.toml) file to be saved to the correct directory for the game to recognize it. \n"
202-
helptext += "A mappack/campaign can be set up to have its own personal config files."
203-
oMessage.big("Help",helptext)
204181

205182
func _on_HelpCustomSlabsButton_pressed():
206183
var helptext = ""
207-
helptext += "After adding a custom slab, right click on its portrait within the slab selection window to remove it from the editor."
184+
helptext += "After adding a fake slab, right click on its portrait within the slab selection window to remove it from the editor."
208185
oMessage.big("Help",helptext)
209186

210187

211-
212188
func _on_SlabBitmaskOptionButton_item_selected(index):
213189
if index == Slabs.BITMASK_DOOR1:
214190
oSlabIsSolidOptionButton.selected = 0 # Empty

Scenes/CustomSlabSystem.gd

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func load_file():
5959

6060
func add_custom_slab(slab_dict):
6161
var head_id = slab_dict["header_id"]
62+
63+
if head_id < 1000: return
64+
6265
var section = 'slab'+str(head_id)
6366
if head_id >= 1000:
6467
Slabs.fake_extra_data[head_id] = [

Scenes/Main.tscn

+36-77
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[gd_scene load_steps=191 format=2]
1+
[gd_scene load_steps=190 format=2]
22

33
[ext_resource path="res://Scenes/SlabStyle.gd" type="Script" id=1]
44
[ext_resource path="res://Scenes/SlabPlacement.gd" type="Script" id=2]
@@ -46,7 +46,6 @@
4646
[ext_resource path="res://Scenes/DataLif.gd" type="Script" id=44]
4747
[ext_resource path="res://Scenes/PickThingWindow.gd" type="Script" id=45]
4848
[ext_resource path="res://Scenes/CurrentTextures.gd" type="Script" id=46]
49-
[ext_resource path="res://Theme/ButtonGroupSlabType.tres" type="ButtonGroup" id=47]
5049
[ext_resource path="res://Scenes/Player.gd" type="Script" id=48]
5150
[ext_resource path="res://Scenes/GenerateTerrain.gd" type="Script" id=49]
5251
[ext_resource path="res://Scenes/View3D.gd" type="Script" id=50]
@@ -5254,8 +5253,8 @@ visible = true
52545253
margin_left = -1595.0
52555254
margin_top = -2377.0
52565255
margin_right = -890.0
5257-
margin_bottom = -1799.0
5258-
window_title = "Add custom slab"
5256+
margin_bottom = -1852.0
5257+
window_title = "Add fake slab"
52595258
resizable = true
52605259
script = ExtResource( 157 )
52615260

@@ -5271,85 +5270,33 @@ custom_constants/margin_bottom = 10
52715270
margin_left = 10.0
52725271
margin_top = 10.0
52735272
margin_right = 695.0
5274-
margin_bottom = 568.0
5273+
margin_bottom = 515.0
52755274

52765275
[node name="CustomSlabVoxelView" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer" instance=ExtResource( 19 )]
52775276
margin_right = 334.0
5278-
margin_bottom = 558.0
5277+
margin_bottom = 505.0
52795278

52805279
[node name="VBoxContainer2" type="VBoxContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer"]
52815280
margin_left = 338.0
52825281
margin_right = 685.0
5283-
margin_bottom = 558.0
5284-
5285-
[node name="PanelContainer2" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"]
5286-
margin_right = 347.0
5287-
margin_bottom = 86.0
5288-
5289-
[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2"]
5290-
margin_left = 9.0
5291-
margin_top = 9.0
5292-
margin_right = 338.0
5293-
margin_bottom = 77.0
5294-
columns = 2
5295-
5296-
[node name="SlabsetSlabCheckBox" type="CheckBox" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer"]
5297-
margin_right = 137.0
5298-
margin_bottom = 32.0
5299-
pressed = true
5300-
group = ExtResource( 47 )
5301-
text = "Slabset slab"
5302-
5303-
[node name="SlabsetSlabHelpButton" type="TextureButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer"]
5304-
margin_left = 297.0
5305-
margin_right = 329.0
5306-
margin_bottom = 32.0
5307-
rect_min_size = Vector2( 32, 32 )
5308-
size_flags_horizontal = 10
5309-
size_flags_vertical = 4
5310-
texture_normal = ExtResource( 156 )
5311-
texture_pressed = ExtResource( 66 )
5312-
texture_hover = ExtResource( 128 )
5313-
expand = true
5314-
stretch_mode = 4
5315-
5316-
[node name="FakeSlabCheckBox" type="CheckBox" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer"]
5317-
margin_top = 36.0
5318-
margin_right = 137.0
5319-
margin_bottom = 68.0
5320-
group = ExtResource( 47 )
5321-
text = "Fake slab"
5322-
5323-
[node name="FakeSlabHelpButton" type="TextureButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer"]
5324-
margin_left = 297.0
5325-
margin_top = 36.0
5326-
margin_right = 329.0
5327-
margin_bottom = 68.0
5328-
rect_min_size = Vector2( 32, 32 )
5329-
size_flags_horizontal = 10
5330-
size_flags_vertical = 4
5331-
texture_normal = ExtResource( 156 )
5332-
texture_pressed = ExtResource( 66 )
5333-
texture_hover = ExtResource( 128 )
5334-
expand = true
5335-
stretch_mode = 4
5282+
margin_bottom = 505.0
53365283

53375284
[node name="PanelContainer" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"]
5338-
margin_top = 90.0
53395285
margin_right = 347.0
5340-
margin_bottom = 414.0
5286+
margin_bottom = 360.0
53415287
size_flags_horizontal = 3
5288+
size_flags_vertical = 3
53425289

53435290
[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer"]
53445291
margin_left = 9.0
53455292
margin_top = 9.0
53465293
margin_right = 338.0
5347-
margin_bottom = 315.0
5294+
margin_bottom = 351.0
53485295
size_flags_horizontal = 3
53495296

53505297
[node name="GridContainer" type="GridContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer"]
53515298
margin_right = 329.0
5352-
margin_bottom = 306.0
5299+
margin_bottom = 342.0
53535300
size_flags_horizontal = 3
53545301
columns = 2
53555302
__meta__ = {
@@ -5576,16 +5523,32 @@ __meta__ = {
55765523
"_edit_use_anchors_": false
55775524
}
55785525

5526+
[node name="FakeSlabHelpButton" type="TextureButton" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer"]
5527+
margin_left = 143.0
5528+
margin_top = 310.0
5529+
margin_right = 175.0
5530+
margin_bottom = 342.0
5531+
rect_min_size = Vector2( 32, 32 )
5532+
size_flags_horizontal = 10
5533+
size_flags_vertical = 4
5534+
texture_normal = ExtResource( 156 )
5535+
texture_pressed = ExtResource( 66 )
5536+
texture_hover = ExtResource( 128 )
5537+
expand = true
5538+
stretch_mode = 4
5539+
55795540
[node name="FakeCustomColumnsPanelContainer" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"]
5580-
margin_top = 418.0
5541+
margin_top = 364.0
55815542
margin_right = 347.0
5582-
margin_bottom = 461.0
5543+
margin_bottom = 451.0
5544+
size_flags_vertical = 3
55835545

55845546
[node name="VBoxContainer" type="VBoxContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/FakeCustomColumnsPanelContainer"]
55855547
margin_left = 9.0
55865548
margin_top = 9.0
55875549
margin_right = 338.0
5588-
margin_bottom = 34.0
5550+
margin_bottom = 78.0
5551+
size_flags_vertical = 3
55895552

55905553
[node name="Label" type="Label" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/FakeCustomColumnsPanelContainer/VBoxContainer"]
55915554
margin_left = 105.0
@@ -5596,18 +5559,17 @@ text = "Map columns"
55965559
align = 1
55975560

55985561
[node name="GridContainerCustomColumns3x3" type="GridContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/FakeCustomColumnsPanelContainer/VBoxContainer"]
5599-
margin_left = 164.0
56005562
margin_top = 25.0
5601-
margin_right = 164.0
5602-
margin_bottom = 25.0
5603-
size_flags_horizontal = 6
5604-
size_flags_vertical = 4
5563+
margin_right = 329.0
5564+
margin_bottom = 69.0
5565+
size_flags_horizontal = 3
5566+
size_flags_vertical = 3
56055567
columns = 3
56065568

56075569
[node name="PanelContainer3" type="PanelContainer" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2"]
5608-
margin_top = 465.0
5570+
margin_top = 455.0
56095571
margin_right = 347.0
5610-
margin_bottom = 515.0
5572+
margin_bottom = 505.0
56115573

56125574
[node name="AddCustomSlabButton" type="Button" parent="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3"]
56135575
margin_left = 150.0
@@ -7590,14 +7552,11 @@ script = SubResource( 20 )
75907552
[connection signal="pressed" from="Ui/UiSystem/ColumnEditor/MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer2/ColumnEditorSortButton" to="Ui/UiSystem/ColumnEditor" method="_on_ColumnEditorSortButton_pressed"]
75917553
[connection signal="pressed" from="Ui/UiSystem/ColumnEditor/MarginContainer/HBoxContainer/VBoxContainer2/HBoxContainer2/ColumnEditorHelpButton" to="Ui/UiSystem/ColumnEditor" method="_on_ColumnEditorHelpButton_pressed"]
75927554
[connection signal="visibility_changed" from="Ui/UiSystem/AddCustomSlabWindow" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_AddCustomSlabWindow_visibility_changed"]
7593-
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer/SlabsetSlabCheckBox" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabsetSlabCheckBox_pressed"]
7594-
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer/SlabsetSlabHelpButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabsetSlabHelpButton_pressed"]
7595-
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer/FakeSlabCheckBox" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_FakeSlabCheckBox_pressed"]
7596-
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer2/GridContainer/FakeSlabHelpButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_FakeSlabHelpButton_pressed"]
75977555
[connection signal="value_changed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/CustomSlabID" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_CustomSlabID_value_changed"]
75987556
[connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabBitmaskOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabBitmaskOptionButton_item_selected"]
75997557
[connection signal="value_changed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/CustomDoorThing" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_CustomDoorThing_value_changed"]
76007558
[connection signal="item_selected" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/SlabWibbleOptionButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_SlabWibbleOptionButton_item_selected"]
7559+
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer/VBoxContainer/GridContainer/FakeSlabHelpButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_FakeSlabHelpButton_pressed"]
76017560
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3/AddCustomSlabButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_AddCustomSlabButton_pressed"]
76027561
[connection signal="pressed" from="Ui/UiSystem/AddCustomSlabWindow/MarginContainer/HBoxContainer/VBoxContainer2/PanelContainer3/HelpCustomSlabsButton" to="Ui/UiSystem/AddCustomSlabWindow" method="_on_HelpCustomSlabsButton_pressed"]
76037562
[connection signal="visibility_changed" from="Ui/UiSystem/SlabsetWindow" to="Ui/UiSystem/SlabsetWindow" method="_on_SlabsetWindow_visibility_changed"]

Scenes/PickSlabWindow.gd

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func _ready():
5858

5959
# Window's minimum size
6060
rect_min_size = Vector2((grid_item_size.x*grid_window_scale)+11, (grid_item_size.y*grid_window_scale)+11)
61-
oSlabTabs.initialize(["Main", "Other", "Custom", "Style", "Ownership"])
61+
oSlabTabs.initialize(["Main", "Other", "Fake slabs", "Style", "Ownership"])
6262

6363
func _process(delta): # It's necessary to use _process to update selection, because ScrollContainer won't fire a signal while you're scrolling.
6464
update_selection_position()

0 commit comments

Comments
 (0)