Permalink
Browse files

Fix AI resource modifier to use percentages base 100 because spads ch…

…okes on decimal places
  • Loading branch information...
ForbodingAngel committed Nov 6, 2018
1 parent 98bf910 commit 297acb1ec2fe09047b81983c836d7e8bf4b69b49
Showing with 7 additions and 7 deletions.
  1. +3 −3 LuaRules/Gadgets/ai_resource_multiplier.lua
  2. +4 −4 ModOptions.lua
@@ -18,7 +18,7 @@ if (not gadgetHandler:IsSyncedCode()) then
return -- No Unsynced
end
local aiResourceMultiplier = tonumber(Spring.GetModOptions().ai_incomemultiplier) or 1
local aiResourceMultiplier = tonumber(Spring.GetModOptions().ai_incomemultiplier) * 0.01 or 1
if timedResBonusMultiplier == 0 and aiResourceMultiplier == 1 then
return
@@ -58,7 +58,7 @@ function gadget:UnitFinished(uID, uDefID, uTeam, builderID)
aiTeams[uTeam].winds = aiTeams[uTeam].winds + 1
end
if mexUnitDefs[uDefID] then
newMexes[uID] = {Spring.GetGameFrame() + 30, uTeam} -- unfortunately mex produces nothing yet so we have to scedule it
newMexes[uID] = {Spring.GetGameFrame() + 30, uTeam} -- unfortunately mex produces nothing yet so we have to schedule it
end
if energyUnitDefs[uDefID] then
aiTeams[uTeam].energy = aiTeams[uTeam].energy + energyUnitDefs[uDefID]
@@ -145,7 +145,7 @@ end
function gadget:GameFrame(n)
if n % 30 == 1 then
-- a just finished mex doesnt produce metal yet so we sceduled it
-- a just finished mex doesn't produce metal yet so we schedule it
for uID,params in pairs(newMexes) do
if n > params[1] then
aiTeams[params[2]].mexes[uID] = select(1,spGetUnitResources(uID))
View
@@ -51,13 +51,13 @@ local options= {
},
{
key = 'ai_incomemultiplier',
name = 'AI Income Multiplier',
desc = 'Multiplies AI resource income',
name = 'AI Income Percentage',
desc = 'Percentage of AI resource income compared to the default (100 = 100%, I.E. Normal. 200 = 200%, which would mean that the AI income would be double the player income)',
type = 'number',
section= 'aioptions',
def = 1,
def = 100,
min = 1,
max = 10,
max = 1000,
step = 1,
},

0 comments on commit 297acb1

Please sign in to comment.