Skip to content

Commit

Permalink
Standardize attributes to 100 max value
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgrist committed Mar 8, 2020
1 parent 7ff422b commit 8d17d9f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions gamemode/config/sh_config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ ix.config.Add("genericFont", "Roboto", "The font used to display generic texts."
end
end, {category = "appearance"})

ix.config.Add("maxAttributes", 30, "The total maximum amount of attribute points allowed.", nil, {
data = {min = 0, max = 250},
ix.config.Add("maxAttributes", 100, "The maximum amount each attribute can be.", nil, {
data = {min = 0, max = 100},
category = "characters"
})
ix.config.Add("chatAutoFormat", true, "Whether or not to automatically capitalize and punctuate in-character text.", nil, {
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/derma/cl_information.lua
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ function PANEL:Init()
bar:SetValue(value)
end

local maximum = v.maxValue or ix.config.Get("maxAttributes", 30)
local maximum = v.maxValue or ix.config.Get("maxAttributes", 100)
bar:SetMax(maximum)
bar:SetReadOnly()
bar:SetText(Format("%s [%.1f/%.1f] (%.1f%%)", L(v.name), value, maximum, value / maximum * 100))
Expand Down
2 changes: 1 addition & 1 deletion gamemode/core/libs/sh_attribs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ do
if (attribute) then
local attrib = self:GetAttributes()

attrib[key] = math.min((attrib[key] or 0) + value, attribute.maxValue or ix.config.Get("maxAttributes", 30))
attrib[key] = math.min((attrib[key] or 0) + value, attribute.maxValue or ix.config.Get("maxAttributes", 100))

if (IsValid(client)) then
net.Start("ixAttributeUpdate")
Expand Down
4 changes: 2 additions & 2 deletions gamemode/core/libs/sh_character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ do
category = "attributes",
isLocal = true,
OnDisplay = function(self, container, payload)
local maximum = hook.Run("GetDefaultAttributePoints", LocalPlayer(), payload) or ix.config.Get("maxAttributes", 30)
local maximum = hook.Run("GetDefaultAttributePoints", LocalPlayer(), payload) or 10

if (maximum < 1) then
return
Expand Down Expand Up @@ -658,7 +658,7 @@ do
count = count + v
end

if (count > (hook.Run("GetDefaultAttributePoints", client, count) or ix.config.Get("maxAttributes", 30))) then
if (count > (hook.Run("GetDefaultAttributePoints", client, count) or 10)) then
return false, "unknownError"
end
else
Expand Down
4 changes: 2 additions & 2 deletions plugins/stamina/sh_plugin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ local function CalcStaminaChange(client)
end

local walkSpeed = ix.config.Get("walkSpeed")
local maxAttributes = ix.config.Get("maxAttributes", 30)
local maxAttributes = ix.config.Get("maxAttributes", 100)
local offset

if (client:KeyDown(IN_SPEED) and client:GetVelocity():LengthSqr() >= (walkSpeed * walkSpeed)) then
-- characters could have attribute values greater than max if the config was changed
offset = -ix.config.Get("staminaDrain", 1) + math.min(character:GetAttribute("end", 0), maxAttributes) / maxAttributes
offset = -ix.config.Get("staminaDrain", 1) + math.min(character:GetAttribute("end", 0), maxAttributes) / 100
else
offset = client:Crouching() and ix.config.Get("staminaCrouchRegeneration", 2) or ix.config.Get("staminaRegeneration", 1.75)
end
Expand Down

0 comments on commit 8d17d9f

Please sign in to comment.