@@ -1,14 +1,84 @@
--Kyle 'Avoca Abent'
--But messy but whatevs. Maybe easier to pull the techids from TechButtons and tier them that way.
kMarineResearchDelay = 5

local function TresCheck(cost)
return GetGamerules().team1:GetTeamResources() >= cost
end
local function DeductTres(cost)
local function DeductTres(cost,teamnum)
if teamnum == 1 then
local marineteam = GetGamerules().team1
marineteam:SetTeamResources(marineteam:GetTeamResources() - cost)
else
local alienteam = GetGamerules().team2
alienteam:SetTeamResources(alienteam:GetTeamResources() - cost)
end
end
function Conductor:AutoBioMass()
for _, hive in ientitylist(Shared.GetEntitiesWithClassname("Hive")) do
hive:AddTimedCallback(Hive.UpdateManually, 15)
end
end
function Hive:UpdateManually()
if Server then
self:UpdatePassive()
end
return true
end

local function GetBioMassLevel()
local teamInfo = GetTeamInfoEntity(2)
local bioMass = (teamInfo and teamInfo.GetBioMassLevel) and teamInfo:GetBioMassLevel() or 0
return math.round(bioMass / 4, 1, 3)
end
function Hive:UpdatePassive()
if GetHasTech(self, kTechId.Xenocide) or not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end

local teamInfo = GetTeamInfoEntity(2)
local teambioMass = (teamInfo and teamInfo.GetBioMassLevel) and teamInfo:GetBioMassLevel() or 0

local techid = nil


if teambioMass >= 2 and not GetHasTech(self, kTechId.Charge) then
techid = kTechId.Charge
elseif teambioMass >= 3 and not GetHasTech(self, kTechId.BileBomb) then
techid = kTechId.BileBomb
elseif teambioMass >= 3 and not GetHasTech(self, kTechId.MetabolizeEnergy) then
techid = kTechId.MetabolizeEnergy
elseif teambioMass >= 4 and not GetHasTech(self, kTechId.Leap) then
techid = kTechId.Leap
elseif teambioMass >= 4 and not GetHasTech(self, kTechId.Spores) then
techid = kTechId.Spores
elseif teambioMass >= 5 and not GetHasTech(self, kTechId.Umbra) then
techid = kTechId.Umbra
elseif teambioMass >= 5 and not GetHasTech(self, kTechId.MetabolizeHealth) then
techid = kTechId.MetabolizeHealth
elseif teambioMass >= 6 and not GetHasTech(self, kTechId.BoneShield) then
techid = kTechId.BoneShield
elseif teambioMass >= 7 and not GetHasTech(self, kTechId.Stab) then
techid = kTechId.Stab
elseif teambioMass >= 8 and not GetHasTech(self, kTechId.Stomp) then
techid = kTechId.Stomp
elseif teambioMass >= 9 and not GetHasTech(self, kTechId.Xenocide) then
techid = kTechId.Xenocide
end

if techid == nil and self.bioMassLevel <= 1 then
techid = kTechId.ResearchBioMassOne
elseif techid == nil and self.bioMassLevel <= 2 then
techid =kTechId.ResearchBioMassTwo --Prolly easier to just read techtree and their requirements no?
end

if techid == nil then return true end
local cost = LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost, 2)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
end


end

function RoboticsFactory:OnConstructionComplete()
self:AddTimedCallback(RoboticsFactory.UpdateManually, 4)
self.deployed = true
@@ -70,7 +140,7 @@ function RoboticsFactory:UpdatePassive()

local cost = 1 --LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost)
DeductTres(cost, 1)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
else return true
@@ -80,7 +150,7 @@ end
function PrototypeLab:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
if GetHasTech(self, kTechId.ExosuitTech) then return false end
if not GetHasTech(self, kTechId.AdvancedWeaponry) and not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end
if not GetHasTech(self, kTechId.AdvancedWeaponry) or not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end

local techid = nil

@@ -94,53 +164,13 @@ function PrototypeLab:UpdatePassive()

local cost = 1 --LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost)
DeductTres(cost, 1)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
else return true
end

end
function PrototypeLab:UpdateResearch(deltaTime)
if not self.timeLastUpdateCheck or self.timeLastUpdateCheck + 15 < Shared.GetTime() then
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
local researchNode = self:GetTeam():GetTechTree():GetTechNode(self.researchingId)
if researchNode then
local gameRules = GetGamerules()
local projectedminutemarktounlock = 60
local currentroundlength = ( Shared.GetTime() - gameRules:GetGameStartTime() )
if researchNode:GetTechId() == kTechId.JetpackTech then
projectedminutemarktounlock = math.random(300, 420)
elseif researchNode:GetTechId() == kTechId.ExosuitTech then
projectedminutemarktounlock = math.random(300, 420)
end --

local progress = Clamp(currentroundlength / projectedminutemarktounlock, 0, 1)
//Print("%s", progress)

if progress ~= self.researchProgress then

self.researchProgress = progress
researchNode:SetResearchProgress(self.researchProgress)

local techTree = self:GetTeam():GetTechTree()
techTree:SetTechNodeChanged(researchNode, string.format("researchProgress = %.2f", self.researchProgress))

// Update research progress
if self.researchProgress == 1 then
// Mark this tech node as researched
researchNode:SetResearched(true)

techTree:QueueOnResearchComplete(self.researchingId, self)

end --

end --

end --
self.timeLastUpdateCheck = Shared.GetTime()
end
end
function ArmsLab:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
if GetHasTech(self, kTechId.Armor3) then return false end
@@ -170,67 +200,12 @@ function ArmsLab:UpdatePassive()
end
local cost = 1 --LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost)
DeductTres(cost, 1)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
else return true
end
end

function ArmsLab:UpdateResearch(deltaTime)
if not self.timeLastUpdateCheck or self.timeLastUpdateCheck + 15 < Shared.GetTime() then
//Kyle Abent Siege 10.25.15 morning writing twtich.tv/kyleabent
//11.10 updating to improve - Add in the adition of dynamic timers rather than set static timers
//11.10 updating to improve - Performance via adding 15 seconds delay between reseearch updates rather than 25x per second.
local researchNode = self:GetTeam():GetTechTree():GetTechNode(self.researchingId)
if researchNode then
local gameRules = GetGamerules()
local projectedminutemarktounlock = 60
local currentroundlength = ( Shared.GetTime() - gameRules:GetGameStartTime() )
local percentageofround = 1
if researchNode:GetTechId() == kTechId.Weapons1 then
secondmark = math.random(45, 90)
elseif researchNode:GetTechId() == kTechId.Weapons2 then
projectedminutemarktounlock = math.random(90, 180)
elseif researchNode:GetTechId() == kTechId.Weapons3 then
projectedminutemarktounlock = math.random(300, 380)
elseif researchNode:GetTechId() == kTechId.Armor1 then
projectedminutemarktounlock = math.random(45, 180)
elseif researchNode:GetTechId() == kTechId.Armor2 then
projectedminutemarktounlock = math.random(180,240)
elseif researchNode:GetTechId() == kTechId.Armor3 then
projectedminutemarktounlock = math.random(420, 480)
end --


local progress = Clamp(currentroundlength / projectedminutemarktounlock, 0, 1)
//Print("%s", progress)

if progress ~= self.researchProgress then

self.researchProgress = progress

researchNode:SetResearchProgress(self.researchProgress)

local techTree = self:GetTeam():GetTechTree()
techTree:SetTechNodeChanged(researchNode, string.format("researchProgress = %.2f", self.researchProgress))

// Update research progress
if self.researchProgress == 1 then

// Mark this tech node as researched
researchNode:SetResearched(true)

techTree:QueueOnResearchComplete(self.researchingId, self)

end --

end --

end --
end
self.timeLastUpdateCheck = Shared.GetTime()
end
function Armory:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
local researchNode = self:GetTeam():GetTechTree():GetTechNode(self.researchingId)
@@ -255,66 +230,11 @@ function Armory:UpdatePassive()
end
local cost = 1 --LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost)
DeductTres(cost, 1)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
else return true
end
end
function Armory:UpdateResearch(deltaTime)
if not self.timeLastUpdateCheck or self.timeLastUpdateCheck + 15 < Shared.GetTime() then
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
local researchNode = self:GetTeam():GetTechTree():GetTechNode(self.researchingId)
local defaultresearch = false
local projectedminutemarktounlock = 60
local researchDuration = 4
local gameRules = GetGamerules()
local currentroundlength = ( Shared.GetTime() - gameRules:GetGameStartTime() )
if researchNode then

if researchNode:GetTechId() == kTechId.AdvancedArmoryUpgrade then
researchDuration = LookupTechData(researchNode:GetTechId(), kTechDataResearchTimeKey, 0.01)
defaultresearch = true
end
if not defaultresearch then
if researchNode:GetTechId() == kTechId.MinesTech then
projectedminutemarktounlock = math.random(30, 90)
elseif researchNode:GetTechId() == kTechId.GrenadeTech then
projectedminutemarktounlock = math.random(30, 60)
elseif researchNode:GetTechId() == kTechId.ShotgunTech then
projectedminutemarktounlock = math.random(60, 120)
elseif researchNode:GetTechId() == kTechId.HeavyMachineGunTech then
projectedminutemarktounlock = math.random(180, 300)
end
end
local modified = Clamp(currentroundlength / projectedminutemarktounlock, 0, 1)
local default = self.researchProgress + deltaTime / researchDuration
local progress = not defaultresearch and modified or default
//Print("%s", progress)
if progress ~= self.researchProgress then

self.researchProgress = progress
researchNode:SetResearchProgress(self.researchProgress)

local techTree = self:GetTeam():GetTechTree()
techTree:SetTechNodeChanged(researchNode, string.format("researchProgress = %.2f", self.researchProgress))

// Update research progress
if self.researchProgress == 1 then
// Mark this tech node as researched
researchNode:SetResearched(true)

techTree:QueueOnResearchComplete(self.researchingId, self)

end --

end --

end --
end
self.timeLastUpdateCheck = Shared.GetTime()

end



@@ -13,4 +13,12 @@ kCragCost = 10
kWhipCost = 10

kPlayerResPerInterval = 0.5
Spectator.kKillCamEnabled = false
Spectator.kKillCamEnabled = false

kSpikeMinDamage = 4 -- Temp nerf for bots without overcomplicating thigns

kDrifterSelfOrderRange = 999 --mapwide eh

kWelderPowerRepairRate = 880
kBuilderPowerRepairRate = 880
kWelderSentryRepairRate = 150 * 4
@@ -27,7 +27,7 @@ function Plugin:MapPostLoad()
end
function Plugin:CommLoginPlayer( Building, Player )

Player:Eject()
return


end