Adding new upgrades is a bit harder, but it is still very easy thanks to the modular system.
Go to voidfactions/lua/voidfactions/modules/upgrades
and add a new Lua file.
See all the methods in voidfactions/lua/voidfactions/features/upgrades/sh_upgrades.lua
.
Use this template:
local UPGRADE = VoidFactions.Upgrades:NewUpgrade()
UPGRADE:Name("My new Upgrade") -- The name of the upgrade
UPGRADE:Icon("ihR4cHk") -- The default Imgur icon of the upgrade
UPGRADE:Description("This will give you a lot of money!") -- The description of the upgrade (for normal players0
UPGRADE:ValueDescription("Admins will see this") -- Description for admins
-- This function formats the value. It is not needed.
UPGRADE:FormatValue(function (val)
return "+" .. val .. "$"
end)
-- This is not really needed. You can keep this as-is.
UPGRADE:OnReset(function (ply)
if (!SERVER) then return end
end)
UPGRADE:OnRespawn(function (ply, val)
if (!SERVER) then return end
local member = ply:GetVFMember()
if (member and member.faction) then
local moneyToGive = faction:SumOfUpgradeValues("My new Upgrade") -- Pass the upgrade name, this functions returns the sum of all the purchased upgrades with this name. That means, if you buy 5 of these upgrades, you will get 5x the money. If none purchased, it returns zero.
ply:addMoney(moneyToGive)
end
end)
VoidFactions.Upgrades:AddUpgrade(UPGRADE)```