this is what it took to get the MCM values sorted
This commit is contained in:
parent
5d4753e85d
commit
16c7651e06
4 changed files with 43 additions and 27 deletions
|
@ -8,25 +8,31 @@ this.modInfo = "No longer can you swim in heavy plate; now your armour, equipmen
|
||||||
this.version = "1.2.1"
|
this.version = "1.2.1"
|
||||||
this.configString = string.gsub(this.modName, "%s+", "")
|
this.configString = string.gsub(this.modName, "%s+", "")
|
||||||
this.modes = {
|
this.modes = {
|
||||||
equippedArmour = {
|
{
|
||||||
|
mode = "equippedArmour",
|
||||||
value = 0,
|
value = 0,
|
||||||
description = "Actors are pulled down by their combined armour class (Light = 1, Medium = 2, Heavy = 3) multiplied by a tenth of " ..
|
description = "Actors are pulled down by their combined armour class (Light = 1, Medium = 2, Heavy = 3) multiplied by a tenth of " ..
|
||||||
"the down-pull multiplier. Default of 100 makes it impossible to surface in all heavy armour for all but the most Athletic.",
|
"the down-pull multiplier. Default of 100 makes it impossible to surface in all heavy armour for all but the most Athletic.",
|
||||||
},
|
},
|
||||||
allEquipment = {
|
{
|
||||||
|
mode = "allEquipment",
|
||||||
value = 1,
|
value = 1,
|
||||||
description = "Actors are pulled down by double the weight of all equipped gear multiplied by a hundredth of the down-pull multiplier.",
|
description = "Actors are pulled down by double the weight of all equipped gear multiplied by a hundredth of the down-pull multiplier.",
|
||||||
},
|
},
|
||||||
encumbrancePercentage = {
|
-- keeping these in this order but with the values unchanged is terrible and I don't care
|
||||||
value = 2,
|
{
|
||||||
description = "Actors are pulled down by their encumbrance percentage multiplied by triple the down-pull multiplier.",
|
mode = "allEquipmentNecroEdit",
|
||||||
},
|
|
||||||
allEquipmentNecroEdit = {
|
|
||||||
value = 3,
|
value = 3,
|
||||||
description = "Actors are pulled down by double the weight of all equipped gear multiplied by a hundredth of the down-pull multiplier, " ..
|
description = "Actors are pulled down by double the weight of all equipped gear multiplied by a hundredth of the down-pull multiplier, " ..
|
||||||
"except any weight above 135 only counts 10%. Lessens the gap between the lightest and heaviest heavy armours.",
|
"except any weight above 135 only counts 10%. Lessens the gap between the lightest and heaviest heavy armours.",
|
||||||
},
|
},
|
||||||
worstCaseScenario = {
|
{
|
||||||
|
mode = "encumbrancePercentage",
|
||||||
|
value = 2,
|
||||||
|
description = "Actors are pulled down by their encumbrance percentage multiplied by triple the down-pull multiplier.",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
mode = "worstCaseScenario",
|
||||||
value = 4,
|
value = 4,
|
||||||
description = "Calculates results from all formulas, and uses the highest value.",
|
description = "Calculates results from all formulas, and uses the highest value.",
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ this.defaultConfig = {
|
||||||
allEquipment = 100,
|
allEquipment = 100,
|
||||||
encumbrancePercentage = 100
|
encumbrancePercentage = 100
|
||||||
},
|
},
|
||||||
mode = common.modes.equippedArmour.value,
|
mode = common.modes[1].value,
|
||||||
allEquipmentWorstCaseNecroMode = true
|
allEquipmentWorstCaseNecroMode = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ end
|
||||||
-- Formula functions
|
-- Formula functions
|
||||||
local formulas = {}
|
local formulas = {}
|
||||||
|
|
||||||
formulas.equippedArmour = function(actor, ref)
|
formulas.equippedArmour = function(actor, mobile, ref)
|
||||||
local armourClass = getTotalArmourClass(actor)
|
local armourClass = getTotalArmourClass(actor)
|
||||||
local downPull = (config.multipliers.equippedArmour / 10) * armourClass
|
local downPull = (config.multipliers.equippedArmour / 10) * armourClass
|
||||||
local debugStr = string.format("Pulling %s down by %s using equipped armour mode (%s total armour class)",
|
local debugStr = string.format("Pulling %s down by %s using equipped armour mode (%s total armour class)",
|
||||||
|
@ -43,7 +43,7 @@ formulas.equippedArmour = function(actor, ref)
|
||||||
return downPull, debugStr
|
return downPull, debugStr
|
||||||
end
|
end
|
||||||
|
|
||||||
formulas.allEquipment = function(actor, ref)
|
formulas.allEquipment = function(actor, mobile, ref)
|
||||||
local totalWeight = getTotalEquipmentWeight(actor)
|
local totalWeight = getTotalEquipmentWeight(actor)
|
||||||
-- doubling this keeps this formula somewhat uniform with armour class @ multiplier 100
|
-- doubling this keeps this formula somewhat uniform with armour class @ multiplier 100
|
||||||
local downPull = ((config.multipliers.allEquipment / 100) * totalWeight) * 2
|
local downPull = ((config.multipliers.allEquipment / 100) * totalWeight) * 2
|
||||||
|
@ -52,7 +52,7 @@ formulas.allEquipment = function(actor, ref)
|
||||||
return downPull, debugStr
|
return downPull, debugStr
|
||||||
end
|
end
|
||||||
|
|
||||||
formulas.allEquipmentNecroEdit = function(actor, ref)
|
formulas.allEquipmentNecroEdit = function(actor, mobile, ref)
|
||||||
local totalWeight = getTotalEquipmentWeight(actor)
|
local totalWeight = getTotalEquipmentWeight(actor)
|
||||||
-- Thanks Necrolesian for this formula
|
-- Thanks Necrolesian for this formula
|
||||||
-- https://forums.nexusmods.com/index.php?/topic/10349253-a-sinking-feeling/page-2#entry97870268
|
-- https://forums.nexusmods.com/index.php?/topic/10349253-a-sinking-feeling/page-2#entry97870268
|
||||||
|
@ -64,7 +64,7 @@ formulas.allEquipmentNecroEdit = function(actor, ref)
|
||||||
return downPull, debugStr
|
return downPull, debugStr
|
||||||
end
|
end
|
||||||
|
|
||||||
formulas.encumbrancePercentage = function(mobile, ref)
|
formulas.encumbrancePercentage = function(actor, mobile, ref)
|
||||||
local encumbrance = mobile.encumbrance
|
local encumbrance = mobile.encumbrance
|
||||||
-- tripling this keeps this formula somewhat uniform with armour class @ multiplier 100
|
-- tripling this keeps this formula somewhat uniform with armour class @ multiplier 100
|
||||||
local downPull = (config.multipliers.encumbrancePercentage * encumbrance.normalized) * 3
|
local downPull = (config.multipliers.encumbrancePercentage * encumbrance.normalized) * 3
|
||||||
|
@ -77,14 +77,15 @@ formulas.worstCaseScenario = function(actor, mobile, ref)
|
||||||
local downPull = 0
|
local downPull = 0
|
||||||
|
|
||||||
local results = {}
|
local results = {}
|
||||||
-- todo: maybe loop over formulas to calculate each instead of this
|
for mode, func in pairs(formulas) do
|
||||||
-- different formulas needing different actor/mobile might make it too unwieldy though
|
-- don't go recursive
|
||||||
results.equippedArmour = formulas.equippedArmour(actor, ref)
|
if mode ~= "worstCaseScenario" then
|
||||||
results.encumbrancePercentage = formulas.encumbrancePercentage(mobile, ref)
|
-- sometimes I really wish lua had continue -_-
|
||||||
if config.allEquipmentWorstCaseNecroMode then
|
if (config.allEquipmentWorstCaseNecroMode and mode ~= "allEquipment") or
|
||||||
results.allEquipmentNecroEdit = formulas.allEquipmentNecroEdit(actor, ref)
|
(not config.allEquipmentWorstCaseNecroMode and mode ~= "allEquipmentNecroEdit") then
|
||||||
else
|
results[mode] = func(actor, mobile, ref)
|
||||||
results.allEquipment = formulas.allEquipment(actor, ref)
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local largest = common.keyOfLargestValue(results)
|
local largest = common.keyOfLargestValue(results)
|
||||||
|
@ -117,6 +118,14 @@ local function sinkInWater(e)
|
||||||
if not config.enabled then
|
if not config.enabled then
|
||||||
downPull = 0
|
downPull = 0
|
||||||
-- calculate the down-pull with the configured formula
|
-- calculate the down-pull with the configured formula
|
||||||
|
else
|
||||||
|
for _, t in ipairs(common.modes) do
|
||||||
|
if t.value == config.mode then
|
||||||
|
downPull, debugStr = formulas[t.mode](actor, mobile, ref)
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--[[
|
||||||
elseif config.mode == common.modes.equippedArmour.value then
|
elseif config.mode == common.modes.equippedArmour.value then
|
||||||
downPull, debugStr = formulas.equippedArmour(actor, ref)
|
downPull, debugStr = formulas.equippedArmour(actor, ref)
|
||||||
elseif config.mode == common.modes.allEquipment.value then
|
elseif config.mode == common.modes.allEquipment.value then
|
||||||
|
@ -127,6 +136,7 @@ local function sinkInWater(e)
|
||||||
downPull, debugStr = formulas.encumbrancePercentage(mobile, ref)
|
downPull, debugStr = formulas.encumbrancePercentage(mobile, ref)
|
||||||
elseif config.mode == common.modes.worstCaseScenario.value then
|
elseif config.mode == common.modes.worstCaseScenario.value then
|
||||||
downPull, debugStr = formulas.worstCaseScenario(actor, mobile, ref)
|
downPull, debugStr = formulas.worstCaseScenario(actor, mobile, ref)
|
||||||
|
--]]
|
||||||
end
|
end
|
||||||
|
|
||||||
-- reset if levitating
|
-- reset if levitating
|
||||||
|
|
|
@ -9,8 +9,8 @@ local function createDescriptions()
|
||||||
local options = ""
|
local options = ""
|
||||||
|
|
||||||
-- list all current modes
|
-- list all current modes
|
||||||
for mode, _ in pairs(common.modes) do
|
for _, t in ipairs(common.modes) do
|
||||||
options = options .. common.camelCaseToWords(mode) .. ", "
|
options = options .. common.camelCaseToWords(t.mode) .. ", "
|
||||||
end
|
end
|
||||||
|
|
||||||
-- strip off ending ", "
|
-- strip off ending ", "
|
||||||
|
@ -20,8 +20,8 @@ local function createDescriptions()
|
||||||
description = description .. options
|
description = description .. options
|
||||||
|
|
||||||
-- add descriptions to description
|
-- add descriptions to description
|
||||||
for mode, t in pairs(common.modes) do
|
for _, t in ipairs(common.modes) do
|
||||||
description = description .. "\n\n" .. common.camelCaseToWords(mode) .. ": " .. t.description
|
description = description .. "\n\n" .. common.camelCaseToWords(t.mode) .. ": " .. t.description
|
||||||
end
|
end
|
||||||
|
|
||||||
return description
|
return description
|
||||||
|
@ -30,8 +30,8 @@ end
|
||||||
local function createOptions()
|
local function createOptions()
|
||||||
local options = {}
|
local options = {}
|
||||||
|
|
||||||
for mode, t in pairs(common.modes) do
|
for _, t in ipairs(common.modes) do
|
||||||
options[#options+1] = {label = common.camelCaseToWords(mode), value = t.value}
|
options[#options+1] = {label = common.camelCaseToWords(t.mode), value = t.value}
|
||||||
end
|
end
|
||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
Loading…
Add table
Reference in a new issue