Skip to content

Commit bf53fd4

Browse files
committed
[ISSUE-9451] Loadout Management
* Provide default "Default" title fallback when copying config sets with nil title * Provide default "Default" title fallback when copying item sets with nil title * Set newly created loadout as active immediately after creation in Build.lua
1 parent 08ba01e commit bf53fd4

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

spec/System/TestLoadouts_spec.lua

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ describe("TestLoadouts", function()
6868
local loadoutName = "Loadout Name"
6969
build:NewLoadout(loadoutName)
7070
build.itemsTab:DeleteItemSet(build.itemsTab.itemSetOrderList[2], 2)
71+
build.itemsTab:SetActiveItemSet(build.itemsTab.itemSetOrderList[1], true)
7172
build:SyncLoadouts()
7273
assert.are.equals(1, #build.itemsTab.itemSetOrderList)
7374

@@ -83,6 +84,7 @@ describe("TestLoadouts", function()
8384
local loadoutName = "Loadout Name"
8485
build:NewLoadout(loadoutName)
8586
build.skillsTab:DeleteSkillSet(build.skillsTab.skillSetOrderList[2], 2)
87+
build.skillsTab:SetActiveSkillSet(build.skillsTab.skillSetOrderList[1], true)
8688
build:SyncLoadouts()
8789
assert.are.equals(1, #build.skillsTab.skillSetOrderList)
8890

@@ -100,6 +102,7 @@ describe("TestLoadouts", function()
100102
local loadoutName = "Loadout Name"
101103
build:NewLoadout(loadoutName)
102104
build.configTab:DeleteConfigSet(build.configTab.configSetOrderList[2], 2)
105+
build.configTab:SetActiveConfigSet(build.configTab.configSetOrderList[1], true)
103106
build:SyncLoadouts()
104107
assert.are.equals(1, #build.configTab.configSetOrderList)
105108

src/Classes/ConfigSetListControl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function ConfigSetListClass:CopyConfigSet(selValue)
5454
local configSet = self.configTab.configSets[selValue]
5555
local controls = {}
5656
controls.label = new("LabelControl", nil, { 0, 20, 0, 16 }, "^7Enter name for this config set:")
57-
controls.edit = new("EditControl", nil, { 0, 40, 350, 20 }, configSet.title, nil, nil, 100, function(buf)
57+
controls.edit = new("EditControl", nil, { 0, 40, 350, 20 }, configSet.title or "Default", nil, nil, 100, function(buf)
5858
controls.save.enabled = buf:match("%S")
5959
end)
6060
controls.save = new("ButtonControl", nil, { -45, 70, 80, 20 }, "Save", function()

src/Classes/ItemSetListControl.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function ItemSetListClass:CopyItemSet(selValue)
5353
local itemSet = self.itemsTab.itemSets[selValue]
5454
local controls = {}
5555
controls.label = new("LabelControl", nil, { 0, 20, 0, 16 }, "^7Enter name for this item set:")
56-
controls.edit = new("EditControl", nil, { 0, 40, 350, 20 }, itemSet.title, nil, nil, 100, function(buf)
56+
controls.edit = new("EditControl", nil, { 0, 40, 350, 20 }, itemSet.title or "Default", nil, nil, 100, function(buf)
5757
controls.save.enabled = buf:match("%S")
5858
end)
5959
controls.save = new("ButtonControl", nil, { -45, 70, 80, 20 }, "Save", function()

src/Modules/Build.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,6 +801,7 @@ function buildMode:NewLoadout(loadoutName)
801801

802802
newSpec.title = loadoutName
803803
t_insert(self.treeTab.specList, newSpec)
804+
self:SetActiveLoadout(self:GetLoadoutByName(loadoutName))
804805

805806
self.modFlag = true
806807
end

0 commit comments

Comments
 (0)