Skip to content
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

Fix resistance penalty none not saving #6292

Merged

Conversation

Paliak
Copy link
Contributor

@Paliak Paliak commented Aug 2, 2023

Fixes #6281 .

Description of the problem being solved:

Due to the act10 penalty value being nil self.defaultState[var] == nil failing the if statement causing the function to return 0 since the val type is "number".

0 is also the value of the none settings causing it to not be saved.

function ConfigTabClass:GetDefaultState(var, varType)
if self.placeholder[var] ~= nil then
return self.placeholder[var]
end
if self.defaultState[var] ~= nil then
return self.defaultState[var]
end
if varType == "number" then
return 0
elseif varType == "boolean" then
return false
elseif varType == "string" then
return ""
else
return nil
end
end

{ var = "resistancePenalty", type = "list", label = "Resistance penalty:", list = {{val=0,label="None"},{val=-30,label="Act 5 (-30%)"},{val=nil,label="Act 10 (-60%)"}}, defaultIndex = 3 },

function ConfigTabClass:Save(xml)
for k, v in pairs(self.input) do
if v ~= self:GetDefaultState(k, type(v)) then

@QuickStick123 QuickStick123 added the bug Something isn't working label Aug 4, 2023
@LocalIdentity LocalIdentity merged commit 4eb1e47 into PathOfBuildingCommunity:dev Aug 13, 2023
2 checks passed
@Paliak Paliak deleted the saveReistancePenatlty branch January 20, 2024 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resistance penalty: None
3 participants