Skip to content

Commit

Permalink
You can no longer use blank columns in fake slabs, this prevents an i…
Browse files Browse the repository at this point in the history
…ssue where new columns get indexed onto the blank columns being used by the fake slab
  • Loading branch information
rainlizard committed Apr 27, 2024
1 parent 46d94cb commit b43f89d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
10 changes: 10 additions & 0 deletions Scenes/AddCustomSlabWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ func _ready():
var shortcut = id.get_node("ButtonShortcut")
shortcut.connect("pressed",self,"shortcut_pressed",[id])
spinbox.max_value = 2047
spinbox.value = 1
spinbox.connect("value_changed",oCustomSlabVoxelView,"_on_CustomSlabSpinBox_value_changed")
customSlabArrayOfSpinbox.append(spinbox)
oGridContainerCustomColumns3x3.add_child(id)
Expand Down Expand Up @@ -83,12 +84,16 @@ func _on_AddCustomSlabButton_pressed():
# Find an unused ID within the fake data dictionary
while Slabs.data.has(newID):
newID += 1

else:
newID = int(oCustomSlabID.value) # For slabset, use the value from the UI
if Slabs.data.has(newID):
oMessage.big("Error", "For Slabset slabs you must use a unique ID. You may need to first delete the existing one.")
return




var slabCubeData = []
var slabFloorData = []
if is_fake: # For fake slabs, gather cube and floor data from the UI elements
Expand All @@ -97,6 +102,11 @@ func _on_AddCustomSlabButton_pressed():
var clmIndex = spinbox.value
slabCubeData.append(oDataClm.cubes[clmIndex])
slabFloorData.append(oDataClm.floorTexture[clmIndex])

if oDataClm.floorTexture[clmIndex] == 0 and oDataClm.cubes[clmIndex] == [0,0,0,0, 0,0,0,0]:
oMessage.quick("You should not use blank columns")
# Blank columns get indexed by other columns after a while
return

var slab_dict = {
"header_id": newID,
Expand Down
6 changes: 3 additions & 3 deletions Scenes/UndoStates.gd
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,15 @@ func attempt_to_save_new_undo_state(): # called by oEditor

func on_undo_state_saved(new_state):
if undo_history.size() >= 1 and are_states_equal(new_state, undo_history[0]):
oMessage.quick("Didn't add undo state as it is the same as the previous undo-state")
#oMessage.quick("Didn't add undo state as it is the same as the previous undo-state")
is_saving_state = false
return
if undo_history.size() >= max_undo_states:
undo_history.pop_back()
undo_history.push_front(new_state)
oMenu.update_undo_availability()

oMessage.quick("Undo history size: " + str(undo_history.size()) + " (test)")
#oMessage.quick("Undo history size: " + str(undo_history.size()) + " (test)")


is_saving_state = false
Expand Down Expand Up @@ -86,7 +86,7 @@ func perform_undo():
oOpenMap.continue_load(oCurrentMap.path)
undo_history.pop_front()
oMenu.update_undo_availability()
oMessage.quick("Undo performed")
#oMessage.quick("Undo performed")

if oEditor.mapHasBeenEdited == false:
oEditor.mapHasBeenEdited = oEditor.SET_EDITED_WITHOUT_SAVING_STATE
Expand Down

0 comments on commit b43f89d

Please sign in to comment.