Skip to content

Commit

Permalink
'OnlyOwnership' icons update
Browse files Browse the repository at this point in the history
  • Loading branch information
rainlizard committed May 1, 2024
1 parent f37a8cb commit 5cda671
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
13 changes: 12 additions & 1 deletion Scenes/OnlyOwnership.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ extends PanelContainer
onready var oSelection = Nodelist.list["oSelection"]
onready var oPickSlabWindow = Nodelist.list["oPickSlabWindow"]
onready var oCurrentFormat = Nodelist.list["oCurrentFormat"]
onready var oSlabTabs = Nodelist.list["oSlabTabs"]

var scnOwnerButton = preload("res://Scenes/OnlyOwnershipButton.tscn")
onready var oSelectedRect = get_node("../../../../Clippy/SelectedRect")

func initialize_grid_items():
func update_grid_items():
var oGridContainer = current_grid_container()

for i in oGridContainer.get_children():
i.free()

var owner_order
if oCurrentFormat.selected == 0: # Classic format
owner_order = [0,1,2,3,4,5]
Expand Down Expand Up @@ -45,6 +49,13 @@ func initialize_grid_items():
8: keeperColourIconPic.texture = preload("res://edited_images/plyrsym_32/symbol_player_orange_std.png")

oGridContainer.add_child(id)

# Refresh tab by switching away then back
if oSlabTabs.get_current_tab_control().name == "OnlyOwnership":
var ontab = oSlabTabs.current_tab
oSlabTabs.current_tab = ontab-1
yield(get_tree(),'idle_frame')
oSlabTabs.current_tab = ontab

func _on_OwnerButtonPressed(id):

Expand Down
2 changes: 2 additions & 0 deletions Scenes/OpenMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ onready var oGuidelines = Nodelist.list["oGuidelines"]
onready var oResizeCurrentMapSize = Nodelist.list["oResizeCurrentMapSize"]
onready var oOwnerSelection = Nodelist.list["oOwnerSelection"]
onready var oScriptGenerator = Nodelist.list["oScriptGenerator"]
onready var oOnlyOwnership = Nodelist.list["oOnlyOwnership"]

var TOTAL_TIME_TO_OPEN_MAP

Expand Down Expand Up @@ -251,6 +252,7 @@ func continue_load_openmap(map):
oOwnerSelection.update_ownership_head_icons()
oScriptGenerator.update_options_based_on_mapformat()
oPickSlabWindow.add_slabs()
oOnlyOwnership.update_grid_items()
oDynamicMapTree.highlight_current_map()
oCurrentMap.set_path_and_title(map)
oCamera2D.reset_camera(M.xSize, M.ySize)
Expand Down
1 change: 0 additions & 1 deletion Scenes/PickSlabWindow.gd
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ func update_selection_position():
func add_slabs():
var CODETIME_START = OS.get_ticks_msec()
clear_grid()
oOnlyOwnership.initialize_grid_items()
oSlabStyle.initialize_grid_items()

var allSlabIDs = []
Expand Down
2 changes: 2 additions & 0 deletions Scenes/Properties.gd
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ onready var oHBoxOptions = Nodelist.list["oHBoxOptions"]
onready var oHBoxLandView = Nodelist.list["oHBoxLandView"]
onready var oHBoxNameID = Nodelist.list["oHBoxNameID"]
onready var oScriptGenerator = Nodelist.list["oScriptGenerator"]
onready var oOnlyOwnership = Nodelist.list["oOnlyOwnership"]

const kind_options = {
"Solo" : "FREE",
Expand Down Expand Up @@ -114,6 +115,7 @@ func set_format_selection(setFormat):
oPlacingSettings.update_placing_tab()
oInspector.deselect()
oOwnerSelection.update_ownership_head_icons()
oOnlyOwnership.update_grid_items()
oScriptGenerator.update_options_based_on_mapformat()

func refresh_dungeon_style_options():
Expand Down

0 comments on commit 5cda671

Please sign in to comment.