-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Variant Improvements #5680
base: dev
Are you sure you want to change the base?
Variant Improvements #5680
Conversation
local variantRange1, variantRange2 | ||
for i in specVal:gmatch("%d+") do | ||
if variantRange1 then | ||
variantRange2 = tonumber(i) | ||
else | ||
variantRange1 = tonumber(i) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local variantRange1, variantRange2 | |
for i in specVal:gmatch("%d+") do | |
if variantRange1 then | |
variantRange2 = tonumber(i) | |
else | |
variantRange1 = tonumber(i) | |
end | |
end | |
local variantRange1, variantRange2 = line:match("%((%d+),(%d+)%)") |
This should work as well afaik
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had this originally but ran into some issues, do not remember what they were but i can take a look at setting it back to this
if variantRange1 <= variantRange2 then | ||
self.variantList[variantName].range = {variantRange1, variantRange2} | ||
self.variantList[variantName].list = {} | ||
local i = variantRange1 | ||
while i <= variantRange2 and self.variantNameList do | ||
t_insert(self.variantList[variantName].list, self.variantNameList[i]) | ||
i = i + 1 | ||
end | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if variantRange1 <= variantRange2 then | |
self.variantList[variantName].range = {variantRange1, variantRange2} | |
self.variantList[variantName].list = {} | |
local i = variantRange1 | |
while i <= variantRange2 and self.variantNameList do | |
t_insert(self.variantList[variantName].list, self.variantNameList[i]) | |
i = i + 1 | |
end | |
end | |
end | |
if variantRange1 <= variantRange2 and self.variantNameList then | |
self.variantList[variantName].range = {variantRange1, variantRange2} | |
self.variantList[variantName].list = {} | |
for i = variantRange1, variantRange2 do | |
t_insert(self.variantList[variantName].list, self.variantNameList[i]) | |
end | |
end | |
end |
Bit cleaner
self.variantList = { } | ||
if not self.variantNameList then | ||
self.variantNameList = { } | ||
self.variantList = self.variantList or { Base = { } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.variantList = self.variantList or { Base = { } } | |
self.variantList = self.variantList or { base = { } } |
Fields seem to typical start with lowercase in this project needs changing elsewhere.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to match the other default names of "Two" "Three" "Four" etc which start with a capital, but I am indifferent and can change it
local variantName = specName == "Has Alt Variant" and "One" or specName:gsub("Has Alt Variant ","") | ||
self.variantList = self.variantList or { Base = { } } | ||
self.variantList[variantName] = {} | ||
if specVal:match("%(%d+,%d+%)") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if specVal:match("%(%d+,%d+%)") then | |
if specVal:match("%(%d+%-%d+%)") then |
Ranges typically use (x-y) notations might be a better format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was incase I wanted to mess with ranges to make it "min, max, step", but ended up not needing it at the time so can change it to use "-" if I dont need step
local i = 1 | ||
while i <= lowestRange - 1 do | ||
t_insert(self.variantList.Base.list, self.variantNameList[i]) | ||
i = i + 1 | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local i = 1 | |
while i <= lowestRange - 1 do | |
t_insert(self.variantList.Base.list, self.variantNameList[i]) | |
i = i + 1 | |
end | |
for i = 1, lowestRange - 1 do | |
t_insert(self.variantList.Base.list, self.variantNameList[i]) | |
end |
This modifies Variants a lot, so testing needs to be setup, though I could not find issues with my limited testing
Alt Variant names can now be almost arbitrary and you can have arbitrarily as many as you want
![image](https://user-images.githubusercontent.com/49933620/218449916-6d765e94-7926-4e67-af10-628831f7bf35.png)
eg
This also lets you set a range for variants
![image](https://user-images.githubusercontent.com/49933620/218450073-c41836cc-8f64-4903-8bec-21f7cbd26c55.png)
eg precursor
only lets you pick the base for the first dropdown, and does not let you pick base for any other dropdown
paradoxica has one dropdown for prefixes, and one for suffixes
Cane of Kulemak has one for either prefix or suffix, one for only prefixes and one for only suffixes
Militant faith has one for selecting keystone and 2 for other mods
and a few others have been modified as well
I will likely add more modifications to this, some planned modifications are;
possibly) variant variants (eg for watchers eye, if you pick a variant that enables a legacy mod then it activates a new variant dropdown to let you select between the current and any legacy variants of said mod)