This file was deleted.

@@ -1,4 +1,5 @@
local function GetBuiltStructureCount(className, teamNum, locationId)
--Kyle 'Avoca' Abent
local function GetBuiltStructureCount(className, teamNum, locationId)
local count = 0
for _, structure in ipairs(GetEntitiesForTeam(className, teamNum)) do
if structure:GetIsBuilt() and structure:GetIsAlive() then
@@ -96,6 +97,9 @@ local function DamagePowerPoint(hive)
end
return false
end
local function GetCanSpawnAlienEntity(trescount)
return GetGamerules().team2:GetTeamResources() >= trescount
end
function Conductor:HiveDefenseMain(hive, shifts, crags, hivecrags, shades)
-- local tres = kStructureDropCost
DamagePowerPoint(hive)
@@ -126,20 +130,22 @@ function Conductor:HiveDefenseMain(hive, shifts, crags, hivecrags, shades)


if #shifts <= math.random(1,3) then
-- if self:GetCanSpawnAlienEntity(tres, 0) then
-- self.team2:SetTeamResources(self.team2:GetTeamResources() - tres)
local tres = 0 --kShiftCost
if GetCanSpawnAlienEntity(tres) then
local shift = CreateEntity(Shift.kMapName, FindFreeSpace(origin), 2)
shift:GetTeam():SetTeamResources(shift:GetTeam():GetTeamResources() - tres)
shift:SetConstructionComplete()
-- end
end
end

if crags <= math.random(1,3) then
if not spawned then
-- if self:GetCanSpawnAlienEntity(tres, 0) then
-- self.team2:SetTeamResources(self.team2:GetTeamResources() - tres)
local tres = 0 --kCragCost
if GetCanSpawnAlienEntity(tres) then
local crag = CreateEntity(Crag.kMapName, FindFreeSpace(origin ), 2)
crag:GetTeam():SetTeamResources(crag:GetTeam():GetTeamResources() - tres)
crag:SetConstructionComplete()
-- end
end
end
end

@@ -154,12 +160,13 @@ function Conductor:HiveDefenseMain(hive, shifts, crags, hivecrags, shades)
end

if #shades <= math.random(1,3) then
local tres = 0 --kShadeCost
if not spawned then
-- if self:GetCanSpawnAlienEntity(tres, 0) then
-- self.team2:SetTeamResources(self.team2:GetTeamResources() - tres)
if GetCanSpawnAlienEntity(tres) then
local shade = CreateEntity(Shade.kMapName, FindFreeSpace(origin), 2)
shade:GetTeam():SetTeamResources(shade:GetTeam():GetTeamResources() - tres)
shade:SetConstructionComplete()
-- end
end
end
end

@@ -16,7 +16,21 @@ function Imaginator:OnCreate()
if Server then
--self:AddTimedCallback(Imaginator.PickMainRoom, 16)
self:AddTimedCallback(Imaginator.Automations, 8)
self:AddTimedCallback(Imaginator.Imaginations, 4)
end
end
local function GetDisabledPowerPoints()
local nodes = {}

for _, powerpoint in ientitylist(Shared.GetEntitiesWithClassname("PowerPoint")) do
if powerpoint and powerpoint:GetIsDisabled() then
table.insert(nodes, powerpoint)
end

end

return nodes

end
local function PowerPointStuff(who)
local team = 0
@@ -41,6 +55,9 @@ local function Touch(who, where, what, number)
local tower = CreateEntityForTeam(what, where, number, nil)
if tower then
who:SetAttached(tower)
if number == 1 then
tower:SetConstructionComplete()
end
return tower
end
end
@@ -55,12 +72,16 @@ local function AutoDrop(self,who)
local which = WhoIsQualified(who)
if which ~= 0 then Envision(who, which) end
end
function Imaginator:Automations() --Does not use tres *yet* ..??
self:CystRooms()
self:AutoBuildConstructs()
function Imaginator:Automations()
self:AutoBuildResTowers()
return true
end
function Imaginator:Imaginations() --Tres spending WIP
self:MarineConstructs()
self:AlienConstructs(false)
self:AlienConstructs(true)
return true
end
local function FindRandomPerson(airlock, powerpoint)

local ents = airlock:GetEntitiesInTrigger()
@@ -78,24 +99,92 @@ local function GetRange(who, where)
local ArcFormula = (where - who:GetOrigin()):GetLengthXZ()
return ArcFormula
end
function Imaginator:AutoBuildConstructs()
local function TresCheck(cost)
return GetGamerules().team1:GetTeamResources() >= cost
end
local function GetSentryMinRangeReq(where)
local count = 0
local ents = GetEntitiesForTeamWithinRange("SentryAvoca", 1, where, 16)
for index, ent in ipairs(ents) do
count = count + 1
end

count = Clamp(count, 1, 4)

return count*8

end
local function GetWhipMinRangeReq(where)
local count = 0
local ents = GetEntitiesForTeamWithinRange("WhipAvoca", 1, where, 16)
for index, ent in ipairs(ents) do
count = count + 1
end

count = Clamp(count, 1, 4)

return count*16

end
local function GetMarineSpawnList()

Print("AutoBuildConstructs")
local randomspawn = nil
local airlocks = {}
local tospawn = {}
table.insert(tospawn, Armory.kMapName)
table.insert(tospawn, Observatory.kMapName)
table.insert(tospawn, Scan.kMapName)
table.insert(tospawn, PhaseGate.kMapName)
table.insert(tospawn, RoboticsFactory.kMapName)
table.insert(tospawn, SentryAvoca.kMapName)
table.insert(tospawn, PrototypeLab.kMapName)
--table.insert(tospawn, SentryBattery.kMapName) --BackupBattery

local tospawn = table.random(tospawn)

for _, airlock in ientitylist(Shared.GetEntitiesWithClassname("AirLock")) do

if TresCheck(kPhaseGateCost) then
table.insert(tospawn, PhaseGate.kMapName)
end

if TresCheck(kArmoryCost) then
table.insert(tospawn, Armory.kMapName)
end

if TresCheck(kObservatoryCost) then
table.insert(tospawn, Observatory.kMapName)
end

if TresCheck(3) then
table.insert(tospawn, Scan.kMapName)
end

if TresCheck(kRoboticsFactoryCost) then
table.insert(tospawn, RoboticsFactory.kMapName)
end


if TresCheck(8) then
table.insert(tospawn, SentryAvoca.kMapName)
end

if TresCheck(kPrototypeLabCost) then
table.insert(tospawn, PrototypeLab.kMapName)
end

--if TresCheck(4) then
--table.insert(tospawn, SentryBattery.kMapName)
-- end



return table.random(tospawn)
end
function Imaginator:MarineConstructs()
for i = 1, 8 do
local success = self:ActualFormulaMarine()
if success == true then break end
end

return true
end
function Imaginator:ActualFormulaMarine()

--Print("AutoBuildConstructs")
local randomspawn = nil
local tospawn = GetMarineSpawnList()
local airlocks = EntityListToTable(Shared.GetEntitiesWithClassname("AirLock"))
local airlock = nil
local success = false
if airlocks then
airlock = table.random(airlocks)
if airlock then
local powerpoint = GetPowerPointForLocation(airlock.name)
if powerpoint then
@@ -104,29 +193,99 @@ local tospawn = table.random(tospawn)
local nearestof = GetNearestMixin(randomspawn, "Construct", 1, function(ent) return ent:GetMapName() == tospawn end)
if nearestof then
local range = GetRange(nearestof, randomspawn) --6.28 -- improved formula?
Print("range is %s", range)
Print("tospawn is %s, location is %s, range between is %s", tospawn, GetLocationForPoint(randomspawn).name, range)
local minrange = 12
if tospawn == PhaseGate.kMapName then minrange = 72 end
if tospawn == Observatory.kMapName then minrange = 32 end
if tospawn == RoboticsFactory.kMapName then minrange = 52 end
if tospawn == SentryAvoca.kMapName then minrange = 24 end
if tospawn == PrototypeLab.kMapName then minrange = 52 end
if range >= minrange then
if tospawn == Armory.kMapName then minrange = 12 end
if tospawn == PhaseGate.kMapName then minrange = 42 end
if tospawn == Observatory.kMapName then minrange = kScanRadius end
if tospawn == RoboticsFactory.kMapName then minrange = 52 end
if tospawn == SentryAvoca.kMapName then minrange = GetSentryMinRangeReq(randomspawn) end
if tospawn == PrototypeLab.kMapName then minrange = 52 end
if tospawn == Scan.kMapName then minrange = kScanRadius cost = 3 end
if tospawn == SentryBattery.kMapName then minrange = 16 end
if range >= minrange then
local entity = CreateEntity(tospawn, randomspawn, 1)
if entity:isa("Cyst") then
entity:SetImmuneToRedeploymentTime(999)
end
end
entity:GetTeam():SetTeamResources(entity:GetTeam():GetTeamResources() - cost)
success = true
end --
else -- it tonly takes 1!
CreateEntity(tospawn, randomspawn, 1)
success = true
end
end
end
end
end

return true
return success

end
local function GetAlienSpawnList(cystonly)

local tospawn = {}

if cystonly then
table.insert(tospawn, AutoCyst.kMapName)
end

if TresCheck(kShiftCost) then
table.insert(tospawn, Shade.kMapName)
end
if TresCheck(kShadeCost) then
table.insert(tospawn, Shift.kMapName)
end
if TresCheck(kWhipCost) then
table.insert(tospawn, Whip.kMapName)
end

return table.random(tospawn)
end
function Imaginator:AlienConstructs(cystonly)

for i = 1, 8 do
local success = self:ActualAlienFormula(cystonly)
if success == true then break end
end

return true

end

function Imaginator:ActualAlienFormula(cystonly)
--Print("AutoBuildConstructs")
local randomspawn = nil
local powerPoints = GetDisabledPowerPoints()
local tospawn = GetAlienSpawnList(cystonly)
local success = false
if powerPoints then
local powerpoint = table.random(powerPoints)
if powerpoint and powerpoint:GetIsDisabled() then
local randomspawn = FindFreeSpace(FindRandomPerson(GetLocationForPoint(powerpoint:GetOrigin()), powerpoint))
if randomspawn then
local nearestof = GetNearestMixin(randomspawn, "Construct", 2, function(ent) return ent:GetMapName() == tospawn end)
if nearestof then
local range = GetRange(nearestof, randomspawn) --6.28 -- improved formula?
Print("tospawn is %s, location is %s, range between is %s", tospawn, GetLocationForPoint(randomspawn).name, range)
local minrange = 12
if tospawn == Cyst.kMapName then minrange = kCystRedeployRange end
if tospawn == Shade.kMapName then minrange = 17 end
if tospawn == Shift.kMapName then minrange = kEnergizeRange end
if tospawn == Whip.kMapName then minrange = GetWhipMinRangeReq(randomspawn) end
if range >= minrange then
CreateEntity(tospawn, randomspawn, 2)
end
success = true
else -- it tonly takes 1!
local entity = CreateEntity(tospawn, randomspawn, 2)
entity:GetTeam():SetTeamResources(entity:GetTeam():GetTeamResources() - cost)
success = true
end
end
end
end

return success
end
function Imaginator:AutoBuildResTowers()
for _, respoint in ientitylist(Shared.GetEntitiesWithClassname("ResourcePoint")) do
if respoint:GetAttached() == nil then AutoDrop(self, respoint) end
@@ -0,0 +1,74 @@
class 'PanicAttack' (Hydra)
PanicAttack.kMapName = "panicattack"


function PanicAttack:OnCreate()
Hydra.OnCreate(self)
self:AdjustMaxHealth(self:GetMaxHealth())
self:AdjustMaxArmor(self:GetMaxArmor())
end

function PanicAttack:GetSendDeathMessageOverride()
return false
end
function PanicAttack:GetMaxHealth()
return kHydraHealth * 4
end
function PanicAttack:GetMaxArmor()
return kHydrayArmor * 4
end
function PanicAttack:OnInitialized()
Hydra.OnInitialized(self)
if Server then
self.targetSelector = TargetSelector():Init(
self,
Hydra.kRange * (math.random(1,100)/100) + Hydra.kRange,
true,
{ kAlienStaticTargets, kAlienMobileTargets }, { self.FilterTarget(self) } )
end

end

function PanicAttack:OnGetMapBlipInfo()
local success = false
local blipType = kMinimapBlipType.Undefined
local blipTeam = -1
local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat()
blipType = kMinimapBlipType.Whip
blipTeam = self:GetTeamNumber()
if blipType ~= 0 then
success = true
end

return success, blipType, blipTeam, isAttacked, false --isParasited
end
function PanicAttack:OnAdjustModelCoords(modelCoords)
local coords = modelCoords
coords.xAxis = coords.xAxis * 2
coords.yAxis = coords.yAxis * 2
coords.zAxis = coords.zAxis * 2
return coords
end
function PanicAttack:ActivateSelfDestruct()
self:AddTimedCallback(PanicAttack.Killme, 16)
end
function PanicAttack:Killme()
self:DeductHealth(90)
return true
end
function PanicAttack:FilterTarget()

local attacker = self
return function (target, targetPosition) return attacker:GetCanFireAtTargetActual(target, targetPosition) end

end
function PanicAttack:GetCanFireAtTargetActual(target, targetPoint)

if target:isa("AvocaArc") and not target:GetInAttackMode() then
return false
end

return target:isa("ARC") and target.health ~= 0

end
Shared.LinkClassToMap("PanicAttack", PanicAttack.kMapName, networkVars)
@@ -2,11 +2,21 @@ class 'PanicAttack' (Hydra)
PanicAttack.kMapName = "panicattack"


function PanicAttack:OnCreate()
Hydra.OnCreate(self)
self:AdjustMaxHealth(self:GetMaxHealth())
self:AdjustMaxArmor(self:GetMaxArmor())
end

function PanicAttack:GetSendDeathMessageOverride()
return false
end

function PanicAttack:GetMaxHealth()
return kHydraHealth * 4
end
function PanicAttack:GetMaxArmor()
return kHydraArmor * 4
end
function PanicAttack:OnInitialized()
Hydra.OnInitialized(self)
if Server then
@@ -0,0 +1,29 @@
class 'WhipAvoca' (Whip)
WhipAvoca.kMapName = "whipavoca"


function WhipAvoca:GetSendDeathMessageOverride()
return false
end

function WhipAvoca:OnGetMapBlipInfo()
local success = false
local blipType = kMinimapBlipType.Undefined
local blipTeam = -1
local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat()
blipType = kMinimapBlipType.Whip
blipTeam = self:GetTeamNumber()
if blipType ~= 0 then
success = true
end

return success, blipType, blipTeam, isAttacked, false --isParasited
end
function WhipAvoca:ActivateSelfDestruct()
self:AddTimedCallback(WhipAvoca.Killme, 16)
end
function WhipAvoca:Killme()
self:DeductHealth(100)
return true
end
Shared.LinkClassToMap("WhipAvoca", WhipAvoca.kMapName, networkVars)
@@ -296,6 +296,16 @@ local function GetPayloadTime()
end
return 600
end
local function GetPCTime()
local entityList = Shared.GetEntitiesWithClassname("Conductor")
if entityList:GetSize() > 0 then
local conductor = entityList:GetEntityAtIndex(0)
local length = conductor:GetTimeLeftTillPC()
--Print("length is %s", length)
return length
end
return 600
end
function GUIInsight_TopBar:Update(deltaTime)

PROFILE("GUIInsight_TopBar:Update")
@@ -329,12 +339,12 @@ function GUIInsight_TopBar:Update(deltaTime)
local hours = math.floor(minutes / 60)
minutes = minutes - hours * 60
seconds = seconds - minutes * 60 - hours * 3600
payloadTimetext = string.format("payLoadtime: %d:%02d", minutes, seconds)
payloadTimetext = string.format("ChairDefense: %d:%02d", minutes, seconds)
else
payloadTimetext = string.format("payLoadtime: %s", GetPayloadTime())
payloadTimetext = string.format("Chair(s) Vulnerable!", GetPayloadTime())
end
if GetPayloadTime() ~= 0 then
local timerlength = GetPayloadTime()
if startTime ~= 0 and GetPCTime() ~= 0 then
local timerlength = GetPCTime()
local NowToSiege = timerlength - (Shared.GetTime() - PlayerUI_GetGameStartTime())
local SiegeLength = math.ceil( Shared.GetTime() + NowToSiege - Shared.GetTime() )
siegeTime = SiegeLength
@@ -343,9 +353,9 @@ end
local hours = math.floor(minutes / 60)
minutes = minutes - hours * 60
seconds = seconds - minutes * 60 - hours * 3600
siegeTimeText = string.format("TBD: %d:%02d", minutes, seconds)
siegeTimeText = string.format("PowerDrainers: %d:%02d", minutes, seconds)
else
siegeTimeText = string.format("tbd: derp")
siegeTimeText = string.format("SHOTS FIRED")
end
gameTime:SetText(gameTimeText)
payLoadtime:SetText(siegeTimeText)
@@ -1,3 +1,10 @@
local function TresCheck(cost)
return GetGamerules().team1:GetTeamResources() >= cost
end
local function DeductTres(cost)
local alienteam = GetGamerules().team2
alienteam:SetTeamResources(alienteam:GetTeamResources() - cost)
end
function Conductor:AutoBioMass()
for _, hive in ientitylist(Shared.GetEntitiesWithClassname("Hive")) do
hive:AddTimedCallback(Hive.UpdateManually, 15)
@@ -23,11 +30,8 @@ function Hive:UpdatePassive()

local techid = nil

if self.bioMassLevel <= 1 then
techid = kTechId.ResearchBioMassOne
elseif self.bioMassLevel <= 2 then
techid =kTechId.ResearchBioMassTwo --Prolly easier to just read techtree and their requirements no?
elseif teambioMass >= 2 and not GetHasTech(self, kTechId.Charge) then

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
@@ -49,12 +53,21 @@ function Hive:UpdatePassive()
techid = kTechId.Stomp
elseif teambioMass >= 9 and not GetHasTech(self, kTechId.Xenocide) then
techid = kTechId.Xenocide
else
return false
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)
local techNode = self:GetTeam():GetTechTree():GetTechNode( techid )
self:SetResearching(techNode, self)
end


end
@@ -70,7 +83,7 @@ function Hive:UpdateResearch(deltaTime)
if researchNode then
if researchNode:GetTechId() == kTechId.ResearchBioMassOne then
elseif researchNode:GetTechId() == kTechId.ResearchBioMassTwo then
researchDuration = 200 -- 10 mins == biomass 9 == onos eggs avail and stomp avail == scale to difficulty as per flavor of personality
researchDuration = 300
defaultresearch = true
end--
if researchNode:GetTechId() == kTechId.BileBomb then
@@ -34,11 +34,11 @@ local function MacQualifications(self)
end
local function GetMacMapName()
local macavoca,basemac, playermac,bigmac, total = GetMacsAmount()
if macavoca <= 2 then
if macavoca <= 3 then
return MacAvoca.kMapName
elseif basemac<= 2 then
elseif basemac<= 3 then
return BaseMac.kMapName
elseif playermac <=2 then
elseif playermac <=5 then
return PlayerMac.kMapName
elseif bigmac == 0 then
return BigMac.kMapName
@@ -81,7 +81,7 @@ end
local function ArcQualifications(self)
local boolean = false
if (GetArcsAmount() <= 7 or not HasPayLoad(self:GetOrigin()) ) and
-- self:GetTeam():GetTeamResources() >= kARCCost and
self:GetTeam():GetTeamResources() >= kARCCost and
-- ( kMaxSupply - GetSupplyUsedByTeam(1) >= LookupTechData(kTechId.ARC, kTechDataSupply, 0)) and
self.deployed and
GetIsUnitActive(self) and
@@ -133,8 +133,9 @@ end
if Server then
function RoboticsFactory:OnUpdate()
if self.timeOfLastMacCheck == nil or Shared.GetTime() > self.timeOfLastMacCheck + 8 then
if ArcQualifications(self) then
if self:GetTechId() == kTechId.ARCRoboticsFactory and ArcQualifications(self) then
self:OverrideCreateManufactureEntity(kTechId.ARC)
self:GetTeam():SetTeamResources(self:GetTeam():GetTeamResources() - cost)
end

self.timeOfLastMacCheck = Shared.GetTime()
@@ -73,6 +73,19 @@ end
local function PlayersNearby(who)

local players = GetEntitiesForTeamWithinRange("Player", 1, who:GetOrigin(), 4)

if #players >= 1 then
for i = 1, #players do
local player = players[i]
if ( player:GetIsAlive() and player.GetIsNanoShielded and not player:GetIsNanoShielded()) then player:ActivateNanoShield() end
if ( player:GetHealth() == player:GetMaxHealth() ) then
local addarmoramount = 3 * player:GetArmorLevel()
player:AddHealth(addarmoramount, false, not true, nil, nil, true)
else
player:AddHealth(Armory.kHealAmount, false, false, nil, nil, true)
end
end
end
return #players or 0
end
function AvocaArc:SpecificRules()
@@ -166,7 +179,9 @@ function AvocaArc:GetCanFireAtTargetActual(target, targetPoint)
end
function AvocaArc:ModifyDamageTaken(damageTable, attacker, doer, damageType)
local damage = self:GetInAttackMode() and 0.25 or 0
if doer:isa("PanicAttack") then damage = damage * 4 end
damageTable.damage = damageTable.damage * damage

end
function AvocaArc:GetDamageType()
return kDamageType.StructuresOnly
@@ -237,7 +252,7 @@ end

if Server then
function AvocaArc:PreOnKill(attacker, doer, point, direction)
AddPayLoadTime(120)
AddPayLoadTime(90)
end
function AvocaArc:UpdateMoveOrder(deltaTime)

@@ -329,6 +344,87 @@ function AvocaArc:OnUse(player, elapsedTime, useSuccessTable)

end

local function PerformAttack(self)

if self.targetPosition then

self:TriggerEffects("arc_firing")
-- Play big hit sound at origin

-- don't pass triggering entity so the sound / cinematic will always be relevant for everyone
GetEffectManager():TriggerEffects("arc_hit_primary", {effecthostcoords = Coords.GetTranslation(self.targetPosition)})

local hitEntities = GetEntitiesWithMixinWithinRange("Live", self.targetPosition, ARC.kSplashRadius)

-- Do damage to every target in range
RadiusDamage(hitEntities, self.targetPosition, ARC.kSplashRadius, 1350, self, true)

-- Play hit effect on each
for index, target in ipairs(hitEntities) do

if HasMixin(target, "Effects") then
target:TriggerEffects("arc_hit_secondary")
end

end

end

-- reset target position and acquire new target
self.targetPosition = nil
self.targetedEntity = Entity.invalidId

end

--all this just to modify damage -.-

function AvocaArc:OnTag(tagName)

PROFILE("ARC:OnTag")

if tagName == "fire_start" then
PerformAttack(self)
elseif tagName == "target_start" then
self:TriggerEffects("arc_charge")
elseif tagName == "attack_end" then
self:SetMode(ARC.kMode.Targeting)
elseif tagName == "deploy_start" then
self:TriggerEffects("arc_deploying")
elseif tagName == "undeploy_start" then
self:TriggerEffects("arc_stop_charge")
elseif tagName == "deploy_end" then

-- Clear orders when deployed so new ARC attack order will be used
self.deployMode = ARC.kDeployMode.Deployed
self:ClearOrders()
-- notify the target selector that we have moved.
self.targetSelector:AttackerMoved()

self:AdjustMaxHealth(kARCDeployedHealth)

local currentArmor = self:GetArmor()
if currentArmor ~= 0 then
self.undeployedArmor = currentArmor
end

self:SetMaxArmor(kARCDeployedArmor)
self:SetArmor(self.deployedArmor)

elseif tagName == "undeploy_end" then

self.deployMode = ARC.kDeployMode.Undeployed

self:AdjustMaxHealth(kARCHealth)
self.deployedArmor = self:GetArmor()
self:SetMaxArmor(kARCArmor)
self:SetArmor(self.undeployedArmor)

end

end

end



Shared.LinkClassToMap("AvocaArc", AvocaArc.kMapName, networkVars)
@@ -0,0 +1,102 @@
class 'AvocaChair' (CommandStation)
AvocaChair.kMapName = "avocachair"

Script.Load("lua/DamageMixin.lua")


function CommandStation:GetRequiresPower()
return true
end
function CommandStation:OhNoYouDidnt()

for _, powerconsumer in ipairs(GetEntitiesWithMixinForTeamWithinRange("PowerConsumer", 1, self:GetOrigin(), 24)) do
if powerconsumer ~= self and (powerconsumer:GetRequiresPower() and not powerconsumer:GetIsPowered()) then
powerconsumer:SetPowerSurgeDuration(8)
powerconsumer:TriggerEffects("arc_hit_secondary")
end
end

self:TriggerEffects("arc_hit_primary")
return not self:GetIsPowered()
end
function CommandStation:OnPowerOff()
self:AddTimedCallback(CommandStation.OhNoYouDidnt, 8)
end
function AvocaChair:OnCreate()
CommandStation.OnCreate(self)
InitMixin(self, DamageMixin)
if Server then
self:AddTimedCallback(AvocaChair.SelfDefense, 8)
end

end
function AvocaChair:GetDamageType()
return kDamageType.StructuresOnly
end

function AvocaChair:GetRequiresPower()
return false
end

function AvocaChair:OnGetMapBlipInfo()
local success = false
local blipType = kMinimapBlipType.Undefined
local blipTeam = -1
local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat()
blipType = kMinimapBlipType.CommandStation
blipTeam = self:GetTeamNumber()
if blipType ~= 0 then
success = true
end

return success, blipType, blipTeam, isAttacked, false --isParasited
end

if Server then

function AvocaChair:OnConstructionComplete()
self:TriggerEffects("deploy")
self:AddTimedCallback(AvocaChair.BaseThisBitchUp, math.random(4,8))
end


function AvocaChair:BaseThisBitchUp()
local techPointOrigin = self:GetOrigin()
CreateEntity(InfantryPortal.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(InfantryPortal.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(Armory.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(ArmsLab.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(PrototypeLab.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(PhaseGate.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(Observatory.kMapName, FindFreeSpace(techPointOrigin,8), 1)
return false
end

function AvocaChair:SelfDefense()
local hitEntities = {}

for _, target in ipairs(GetEntitiesWithMixinForTeamWithinRange("Construct", 2, self:GetOrigin(), 24)) do
table.insert(hitEntities,target)
end

if table.count(hitEntities) >=1 then
RadiusDamage(hitEntities, self:GetOrigin(), 24, 800, self,true)
self:TriggerEffects("arc_hit_primary")

for index, target in ipairs(hitEntities) do
if HasMixin(target, "Effects") then
target:TriggerEffects("arc_hit_secondary")
end
end


end

return true

end


end

Shared.LinkClassToMap("AvocaChair", AvocaChair.kMapName, networkVars)
@@ -93,7 +93,7 @@ function BaseSentry:FireBullets()

end


/*
function BaseSentry:OnAdjustModelCoords(modelCoords)
local coords = modelCoords
local scale = 1.8
@@ -103,7 +103,7 @@ function BaseSentry:FireBullets()

return coords
end

*/
if Server then

function BaseSentry:OnUpdate(deltaTime)
@@ -1,9 +1,10 @@
/*
function ResourceTower:OnUpdate(deltaTime)

return

end

*/

function PowerPoint:CanBeCompletedByScriptActor(player)
return true
@@ -3,14 +3,14 @@ CystAvoca.kMapName = "cystavoca"

function CystAvoca:OnCreate()
Cyst.OnCreate(self)
self:AddTimedCallback(CystAvoca.Heal, 4)
self:AddTimedCallback(CystAvoca.Heal, 8)
end
function CystAvoca:GetCystParentRange()
return 999
end
function CystAvoca:Heal()
if self:GetHealth() == self:GetMatureMaxHealth() then return true end
local gain = math.min(self:GetMatureMaxHealth() - self:GetHealth()) / math.random(4,8)
local gain = math.min(self:GetMatureMaxHealth() - self:GetHealth()) / math.random(2,4)
self:AddHealth(gain, false, false, false)
return self:GetIsAlive() and not self:GetIsDestroyed()
end
@@ -53,14 +53,29 @@ function CystAvoca:EnergizeInRange()

return self:GetIsAlive()
end

local function GetCanSpawnAlienEntity(trescount)
return GetGamerules().team2:GetTeamResources() >= trescount
end
function CystAvoca:KillWhipAvoca()
local whips = GetEntitiesForTeamWithinRange("WhipAvoca", 2, self:GetOrigin(), 999999)

if #whips == 0 then return end

for i = 1, #whips do
local whip = whip[i]
whip:ActivateSelfDestruct()
end
end
function CystAvoca:PreOnKill(attacker, doer, point, direction)
self:KillWhipAvoca()
end
function CystAvoca:SpawnWhipsAtKing(whips, crags, cyst, origin)
--local spawned = false
-- local tres = not self.doorsopened and kStructureDropCost * .5 or kStructureDropCost
-- self.alienteamcanupgeggs = ConditionalValue(self.team2:GetTeamResources()>= 100, true,false)
-- if self:GetCanSpawnAlienEntity(tres, nil, cyst:GetIsInCombat()) then
local maxwhips = 50
local currentwhips = Clamp(#whips, 0, 50)
local maxwhips = 8
local currentwhips = Clamp(#whips, 0, maxwhips)
Print("Currentwhips is %s", currentwhips)
local whipstospawn = math.abs(maxwhips - currentwhips)
Print("whipstospawn is %s", whipstospawn)
@@ -70,12 +85,15 @@ function CystAvoca:SpawnWhipsAtKing(whips, crags, cyst, origin)
if whipstospawn >= 1 then

for i = 1, whipstospawn do
-- self:AddTimedCallback(function()
local tres = kWhipCost / 2
if GetCanSpawnAlienEntity(tres) then
local autoconstructspawnchance = math.random(1,2)
local whip = CreateEntity(Whip.kMapName, FindFreeSpace(origin), 2)
local whip = CreateEntity(WhipAvoca.kMapName, FindFreeSpace(origin), 2)
if autoconstructspawnchance == 1 then
whip:SetConstructionComplete()
end
whip:GetTeam():SetTeamResources(whip:GetTeam():GetTeamResources() - tres)
end
--end, 4)

end
@@ -111,6 +129,13 @@ function CystAvoca:SpawnWhipsAtKing(whips, crags, cyst, origin)
-- end

end
local function ChanceMist(where)
local chance = math.random(1,100)

if chance <= 30 then
if Server then CreateEntity(NutrientMist.kMapName, FindFreeSpace(where), 2) end
end
end
local function MoveEggs(self)
for index, egg in ipairs(GetEntitiesForTeam("Egg", 2)) do
if self:GetDistance(egg) >= 16 and egg:GetIsFree() then
@@ -119,6 +144,7 @@ local function MoveEggs(self)
toplace = GetGroundAtPosition(toplace, nil, PhysicsMask.AllButPCs, extents)
if toplace then
egg:SetOrigin(toplace)
ChanceMist(toplace)
end
end
end
@@ -135,7 +161,7 @@ end
function CystAvoca:Synchronize()
if not self:GetIsMature() then return true end
MoveEggs(self)
local whips = GetEntitiesForTeamWithinRange("Whip", 2, self:GetOrigin(), 999999)
local whips = GetEntitiesForTeamWithinRange("WhipAvoca", 2, self:GetOrigin(), 999999)
local crags = GetCragsCount()
self:SpawnWhipsAtKing(whips, crags, self, self:GetOrigin())
local cysts, tableof = GetCystsInLocation(GetLocationForPoint(self:GetOrigin()))
@@ -146,9 +172,9 @@ function CystAvoca:Synchronize()
return true
end
function AttractWhipsCrags(who)
local crags = #GetEntitiesWithinRange("Crag", who:GetOrigin(), 4)
local whips = #GetEntitiesWithinRange("Whip", who:GetOrigin(), 4)
if not whips and not crags or (whips + crags <= 7) then
local crags = #GetEntitiesWithinRange("Crag", who:GetOrigin(), 8)
local whips = #GetEntitiesWithinRange("WhipAvoca", who:GetOrigin(), 8)
if not whips and not crags or (whips + crags <= 3) then
MagnetizeStructures(who)
end
end
@@ -161,8 +187,8 @@ function MagnetizeStructures(who)
if success then break end
end
end
for index, whip in ipairs(GetEntitiesForTeam("Whip", 2)) do
if not whip:isa("PowerDrainer") and not whip:isa("PanicWhip") and whip:GetIsBuilt() and who:GetDistance(whip) >= 16 and not (whip:GetHasOrder() or whip.moving) then
for index, whip in ipairs(GetEntitiesForTeam("WhipAvoca", 2)) do
if not whip:isa("PowerDrainer") and whip:GetIsBuilt() and who:GetDistance(whip) >= 8 and not whip.moving then
local success = whip:GiveOrder(kTechId.Move, who:GetId(), who:GetOrigin(), nil, true, true)
if success then break end
end
@@ -172,20 +198,20 @@ end

end
function CystAvoca:GetMatureMaxHealth()
return (math.max(kMatureCystHealth * self.healthScalar or 0, kMinMatureCystHealth)) * 4
return (math.max(kMatureCystHealth * self.healthScalar or 0, kMinMatureCystHealth)) * 8
end

function CystAvoca:GetMatureMaxArmor()
return kMatureCystArmor * 4
return kMatureCystArmor * 8
end
function CystAvoca:GetInfestationRadius()
return 0
end
/*
function CystAvoca:GetMaturityRate()

function CystAvoca:GetMaturityRate()
return 60 * 1.3
end
*/

function CystAvoca:OnAdjustModelCoords(modelCoords)
local coords = modelCoords
local matureamt = not self:GetIsMature() and self:GetMaturityFraction() or 1
@@ -19,6 +19,22 @@ local function AlreadySpawned(self, origin)
if ents and #ents >= 4 then return true else return false end

end
/*
if Server then
local function SiegeThisBitchUp(where, teamnum)


if teamnum == 2 then
for i = 1, 4 do
local resNodeSpawned = CreateEntity(ResourcePoint.kMapName, FindFreeSpace(where,8))
end
else

end

end
end
*/
function Conductor:SpawnBaseEntities()
//messy and mir-air. But whatever. Requires GetGroundPosition
local techPointOrigin = nil
@@ -29,9 +45,9 @@ local techPointOrigin = nil

CreateEntity(InfantryPortal.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(InfantryPortal.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(Armory.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(Armory.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(ArmsLab.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(RoboticsFactory.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(RoboticsFactory.kMapName, FindFreeSpace(techPointOrigin,4), 1)

CreateEntity(MacAvoca.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(MacAvoca.kMapName, FindFreeSpace(techPointOrigin,4), 1)
@@ -44,9 +60,9 @@ local techPointOrigin = nil

CreateEntity(BigMac.kMapName, FindFreeSpace(techPointOrigin,4), 1)

CreateEntity(PrototypeLab.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(PhaseGate.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(Observatory.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(PrototypeLab.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(PhaseGate.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(Observatory.kMapName, FindFreeSpace(techPointOrigin,4), 1)
for i = 1, 4 do
CreateEntity(BaseSentry.kMapName, FindFreeSpace(techPointOrigin,4), 1)
end
@@ -111,6 +127,7 @@ local tech = nil
if tech:GetAttached() == nil then
local hive = tech:SpawnCommandStructure(2)
hive:SetConstructionComplete()
--SiegeThisBitchUp(hive:GetOrigin(), 2)
local location = GetLocationForPoint(tech:GetOrigin())
location = location and location.name or nil
local powerpoint = GetPowerPointForLocation(location)
@@ -1,9 +1,15 @@
local function BreachAirLock(where, which)
local airlock = CreateEntity(AirLock.kMapName, where)
airlock.scale = which.scale
airlock.name = which.name
airlock:SetBox(airlock.scale) -- Rather than trigger init?
-- Print("Airlock @ %s", which.name)
local function BreachAirLock(where, which)

for _, location in ientitylist(Shared.GetEntitiesWithClassname("Location")) do
if location.name == which.name then
local airlock = CreateEntity(AirLock.kMapName, location:GetOrigin())
airlock.scale = location.scale
airlock.name = which.name
airlock:SetBox(airlock.scale)
end
end


end
function SealAirLock(nameofwhich)

@@ -12,7 +12,7 @@ Script.Load("lua/Modifications/MainRoomArc.lua")
Script.Load("lua/Modifications/HiveCrag.lua")
Script.Load("lua/Modifications/SentryAvoca.lua")
Script.Load("lua/Modifications/BaseSentry.lua")

Script.Load("lua/Modifications/AvocaChair.lua")

--Macs
Script.Load("lua/Modifications/Macs/MacAvoca.lua")
@@ -30,15 +30,18 @@ Script.Load("lua/Modifications/AutoMacsArcs.lua")


if Server then
Script.Load("lua/Modifications/ArmoryArmor.lua")
Script.Load("lua/Modifications/LightSwitch.lua")
Script.Load("lua/Modifications/ArmoryArmor.lua")





end




--Thanks for the trick, modular exo


@@ -91,9 +94,39 @@ function Alien:OnCreate()
end
end

function Hive:GetBioMassLevel()
return self.bioMassLevel
end

function Hive:OnConstructionComplete()
--biomass 0
-- Play special tech point animation at same time so it appears that we bash through it.
local attachedTechPoint = self:GetAttached()
if attachedTechPoint then
attachedTechPoint:SetIsSmashed(true)
else
Print("Hive not attached to tech point")
end

local team = self:GetTeam()

if team then
team:OnHiveConstructed(self)
end

if self.hiveType == 1 then
self:OnResearchComplete(kTechId.UpgradeToCragHive)
elseif self.hiveType == 2 then
self:OnResearchComplete(kTechId.UpgradeToShadeHive)
elseif self.hiveType == 3 then
self:OnResearchComplete(kTechId.UpgradeToShiftHive)
end


local cysts = GetEntitiesForTeamWithinRange( "Cyst", self:GetTeamNumber(), self:GetOrigin(), self:GetCystParentRange())
for _, cyst in ipairs(cysts) do
cyst:ChangeParent(self)
end
end
function GhostStructureMixin:__initmixin()

-- init the entity in ghost structure mode
@@ -188,20 +221,21 @@ end

local function GetDestinationGate(self)
local phaseGates = {}

for index, payload in ipairs( GetEntitiesForTeam("AvocaArc", self:GetTeamNumber()) ) do
if GetIsUnitActive(payload) then
table.insert(phaseGates, payload)
end
end


-- Find next phase gate to teleport to

for index, phaseGate in ipairs( GetEntitiesForTeam("PhaseGate", self:GetTeamNumber()) ) do
if GetIsUnitActive(phaseGate) then
table.insert(phaseGates, phaseGate)
end
end
end

for index, payload in ipairs( GetEntitiesForTeam("AvocaArc", self:GetTeamNumber()) ) do
if GetIsUnitActive(payload) then
table.insert(phaseGates, payload)
end
end

if table.count(phaseGates) < 2 then
return nil
@@ -287,18 +321,36 @@ function GameInfo:SetStartTime(startTime)
end
end
*/
local function LocationsMatch(who,whom)

local whoname = GetLocationForPoint(who:GetOrigin())
local whomname = GetLocationForPoint(whom:GetOrigin())
return whoname == whomname
end
local orig_PowerPoint_OnConstructionComplete = PowerPoint.OnConstructionComplete
function PowerPoint:OnConstructionComplete()
orig_PowerPoint_OnConstructionComplete(self)
local nearestHarvester = GetNearest(self:GetOrigin(), "Harvester", 2, function(ent) return LocationsMatch(self,ent) end)
if nearestHarvester then
nearestHarvester:Kill()
end
end
local orig_PowerPoint_OnKill = PowerPoint.OnKill
function PowerPoint:OnKill(attacker, doer, point, direction)
orig_PowerPoint_OnKill(self)
local nearestExtractor = GetNearest(self:GetOrigin(), "Extractor", 1, function(ent) return GetLocationForPoint(ent:GetOrigin()) == GetLocationForPoint(self:GetOrigin()) end)
local nearestExtractor = GetNearest(self:GetOrigin(), "Extractor", 1, function(ent) return LocationsMatch(self,ent) end)
if nearestExtractor then
nearestExtractor:Kill()
end
local location = GetLocationForPoint(self:GetOrigin())
location = location and location.name
SealAirLock(location, self:GetOrigin())

end
local function ToSpawnFormula(self,panicstospawn, where)
for i = 1, panicstospawn do
local bitch = GetPayLoadArc()
if bitch then
if bitch and GetIsPointWithinHiveRadius(bitch:GetOrigin()) then
local spawnpoint = FindFreeSpace(bitch:GetOrigin(), 4, 8)
if spawnpoint then
local panicattack = CreateEntity(PanicAttack.kMapName, spawnpoint, 2)
@@ -309,11 +361,10 @@ local function ToSpawnFormula(self,panicstospawn, where)

end
local function SendAnxietyAttack(self, where, who)
who = table.count(who)
for i = 1, who do
for i = 1, #who do
local panicattack = who[i]
local bitch = GetPayLoadArc()
if bitch then
if bitch and GetIsPointWithinHiveRadius(bitch:GetOrigin()) then
local spawnpoint = FindFreeSpace(bitch:GetOrigin(), 4, 8)
if spawnpoint then
panicattack:SetOrigin(spawnpoint)
@@ -330,16 +381,17 @@ local panicattacks = {}
end
end

local countofpanic = Clamp(table.count(panicwhips), 0, 8)
local maxpanic = 8
local countofpanic = Clamp(table.count(panicattacks), 0, 8)
local maxpanic = 4
local panicstospawn = math.abs(maxpanic - countofpanic)
panicstospawn = Clamp(panicstospawn, 0, 4)
panicstospawn = Clamp(panicstospawn, 1, 2)

if panicstospawn >= 1 then ToSpawnFormula(self,panicstospawn, where) end

/*
if countofpanic >= 1 then
SendAnxietyAttack(self, where, panicattacks) -- not sure
end
*/
end

local orig_Hive_OnTakeDamage = Hive.OnTakeDamage
@@ -348,25 +400,190 @@ function Hive:OnTakeDamage(damage, attacker, doer, point)
if doer and doer:isa("ARC") then
Print("PanicAttack Initiated")
PanicInitiate(self,self:GetOrigin())
AddPayLoadTime(8)
if self:GetIsBuilt() then AddPayLoadTime(8) end
end

return orig_Hive_OnTakeDamage(self,damage, attacker, doer, point)
end
----
local function GetTechPoint(where)
for _, techpoint in ipairs(GetEntitiesWithinRange("TechPoint", where, 8)) do
if techpoint then return techpoint end
end
end
local function GetIsVaporizing(where)
for _, vape in ipairs(GetEntitiesWithinRange("Vaporizer", where, 8)) do
if vape then return true end
end
end
local function BuildAlienHive(who)
who:AddTimedCallback(function()
local hive = who:SpawnCommandStructure(2)
end, 8)
end
local function SmokeWeedEveryDay(who)
--messy
for _, conductor in ientitylist(Shared.GetEntitiesWithClassname("Conductor")) do
if conductor and conductor:GetCanVape() then
local vaporizer = CreateEntity(Vaporizer.kMapName, who:GetOrigin(), 1)
end
end
end
local function BuildMarineChair(who)
who:AddTimedCallback(function()
local avocachair = CreateEntity(AvocaChair.kMapName, who:GetOrigin(), 1)
avocachair:SetConstructionComplete()
SmokeWeedEveryDay(avocachair)
end, 8)
end
function CommandStation:OnKill(attacker, doer, point, direction)
local child = GetTechPoint(self:GetOrigin())
BuildAlienHive(child)
end
function SentryBattery:GetUnitNameOverride(viewer)
local unitName = GetDisplayName(self)
unitName = string.format(Locale.ResolveString("BackupPower") )
return unitName
end
local orig_Hive_OnKill = Hive.OnKill
function Hive:OnKill(attacker, doer, point, direction)
AddPayLoadTime(180)
if self:GetIsBuilt() then AddPayLoadTime(180) end
local child = GetTechPoint(self:GetOrigin())
BuildMarineChair(child)
return orig_Hive_OnKill(self,attacker, doer, point, direction)
end

function Whip:OnKill(attacker, doer, point, direction)
--if attacker and attacker:isa("ARC") then AddPayLoadTime(1) end
end

function PowerPoint:PreOnKill(attacker, doer, point, direction)
local location = GetLocationForPoint(self:GetOrigin())
SealAirLock(location.name)
end


function CommandStation:ModifyDamageTaken(damageTable, attacker, doer, damageType, hitPoint)

if hitPoint ~= nil and GetIsVaporizing(self:GetOrigin()) then

damageTable.damage = 0 --I already know whips and hydras are still gonna try to attack. Gotta filter that elsewhere.

end

end
/*
function InfantryPortal:GetRequiresPower()
return true --why have this off if this is pretty much only way marines can lose with bots
end
function ArmsLab:GetRequiresPower()
return false
end
*/
function InfantryPortal:ModifyDamageTaken(damageTable, attacker, doer, damageType, hitPoint)

if hitPoint ~= nil then

damageTable.damage = 0 --I already know whips and hydras are still gonna try to attack. Gotta filter that elsewhere.

end

end
function ArmsLab:ModifyDamageTaken(damageTable, attacker, doer, damageType, hitPoint)

if hitPoint ~= nil then

damageTable.damage = 0 --I already know whips and hydras are still gonna try to attack. Gotta filter that elsewhere.

end

end
-- Find team start with team 0 or for specified team. Remove it from the list so other teams don't start there. Return nil if there are none.
function NS2Gamerules:ChooseTechPoint(techPoints, teamNumber)

local validTechPoints = { }
local totalTechPointWeight = 0

-- Build list of valid starts (marked as "neutral" or for this team in map)
for _, currentTechPoint in pairs(techPoints) do

-- Always include tech points with team 0 and never include team 3 into random selection process
-- local teamNum = currentTechPoint:GetTeamNumberAllowed()
-- if (teamNum == 0 or teamNum == teamNumber) and teamNum ~= 3 then

table.insert(validTechPoints, currentTechPoint)
totalTechPointWeight = totalTechPointWeight + currentTechPoint:GetChooseWeight()

-- end

end

local chosenTechPointWeight = self.techPointRandomizer:random(0, totalTechPointWeight)
local chosenTechPoint = nil
local currentWeight = 0
for _, currentTechPoint in pairs(validTechPoints) do

currentWeight = currentWeight + currentTechPoint:GetChooseWeight()
if chosenTechPointWeight - currentWeight <= 0 then

chosenTechPoint = currentTechPoint
break

end

end

-- Remove it from the list so it isn't chosen by other team
if chosenTechPoint ~= nil then
table.removevalue(techPoints, chosenTechPoint)
else
assert(false, "ChooseTechPoint couldn't find a tech point for team " .. teamNumber)
end

return chosenTechPoint

end
function Exo:PerformEjectOnPree()

if self:GetIsAlive() then

local reuseWeapons = self.storedWeaponsIds ~= nil

local marine = self:Replace(self.prevPlayerMapName or Marine.kMapName, self:GetTeamNumber(), false, self:GetOrigin() + Vector(0, 0.2, 0))
local health = Clamp(self.prevPlayerHealth or kMarineHealth-30, 1, 70)
marine:SetHealth(health)
marine:SetMaxArmor(self.prevPlayerMaxArmor or kMarineArmor)
marine:SetArmor(self.prevPlayerArmor or kMarineArmor)

--exosuit:SetOwner(marine)

marine.onGround = false
local initialVelocity = self:GetViewCoords().zAxis
initialVelocity:Scale(4)
initialVelocity.y = 9
marine:SetVelocity(initialVelocity)

if reuseWeapons then

for _, weaponId in ipairs(self.storedWeaponsIds) do

local weapon = Shared.GetEntity(weaponId)
if weapon then
marine:AddWeapon(weapon)
end

end

end

marine:SetHUDSlotActive(1)

if marine:isa("JetpackMarine") then
marine:SetFuel(0)
end

end

return false

end
function Exo:PreOnKill(attacker, doer, point, direction)
self:PerformEjectOnPree()
end

end--server
@@ -2,8 +2,17 @@
class 'SentryAvoca' (Sentry) --Because I dont want to spawn it other than when conductor is active and that file is already full.
SentryAvoca.kMapName = "sentryavoca"



function SentryAvoca:OnCreate()
Sentry.OnCreate(self)
self:AdjustMaxHealth(self:GetMaxHealth())
self:AdjustMaxArmor(self:GetMaxArmor())
end
function SentryAvoca:GetMaxHealth()
return kSentryHealth * 2
end
function SentryAvoca:GetMaxArmor()
return kSentryArmor * 2
end
function SentryAvoca:OnGetMapBlipInfo()
local success = false
local blipType = kMinimapBlipType.Undefined
@@ -2,8 +2,29 @@
--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 marineteam = GetGamerules().team1
marineteam:SetTeamResources(marineteam:GetTeamResources() - cost)
end
function RoboticsFactory:OnConstructionComplete()
self:AddTimedCallback(RoboticsFactory.UpdateManually, 4)
self.deployed = true
end
function RoboticsFactory:UpdateManually()
if Server then
self:UpdatePassive()
end
return true
end
function ArmsLab:UpdateManually()
if Server then
self:UpdatePassive()
end
return true
end
function ArmsLab:OnConstructionComplete()
self:AddTimedCallback(ArmsLab.UpdateManually, kMarineResearchDelay)
end
@@ -32,10 +53,34 @@ function Armory:UpdateManually()
return true
end


function RoboticsFactory:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
if self:GetTechId() == kTechId.ARCRoboticsFactory then
return false
end
if not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end

local techid = nil

if self:GetTechId() ~= kTechId.ARCRoboticsFactory then
techid = kTechId.UpgradeRoboticsFactory
else
return
end

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

end
function PrototypeLab:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
if GetHasTech(self, kTechId.ExosuitTech) or not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end
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

local techid = nil

@@ -47,9 +92,13 @@ function PrototypeLab:UpdatePassive()
return
end

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

else return true
end

end
function PrototypeLab:UpdateResearch(deltaTime)
@@ -94,6 +143,7 @@ function PrototypeLab:UpdateResearch(deltaTime)
end
function ArmsLab:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
if GetHasTech(self, kTechId.Armor3) then return false end
if not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return false end
local techid = nil

@@ -118,10 +168,13 @@ function ArmsLab:UpdatePassive()
else
return false
end

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

else return true
end
end

function ArmsLab:UpdateResearch(deltaTime)
@@ -181,7 +234,8 @@ function ArmsLab:UpdateResearch(deltaTime)
function Armory:UpdatePassive()
//Kyle Abent Siege 10.24.15 morning writing twtich.tv/kyleabent
local researchNode = self:GetTeam():GetTechTree():GetTechNode(self.researchingId)
if (self:isa("AdvancedArmory") and GetHasTech(self, kTechId.HeavyMachineGunTech) ) or not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end
if (self:isa("AdvancedArmory") and GetHasTech(self, kTechId.HeavyMachineGunTech) ) then return false end
if not GetGamerules():GetGameStarted() or not self:GetIsBuilt() or self:GetIsResearching() then return true end


local techid = nil
@@ -199,9 +253,13 @@ function Armory:UpdatePassive()
else
return
end

local cost = 1 --LookupTechData(techid, kTechDataCostKey, 0)
if TresCheck(cost) then
DeductTres(cost)
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
@@ -1,3 +1,13 @@
kARCDamage = 1350
--kARCDamage = 1350
kAlienEggsPerHive = 8
kHiveBiomass = 0
--kHiveBiomass = 0.1
kAlienStructureMoveSpeed = 3.5 --crags move as fast as whips

kLerkCost = 30
kFadeCost = 60
kOnosCost = 80

kShiftCost = 10
kShadeCost = 10
kCragCost = 10
kWhipCost = 10
@@ -43,6 +43,26 @@ end
--Control Point based marine construction based on player amount inside?

if Server then

--Whips do less damage with less health (slap atleast)

function Whip:SlapTarget(target)
self:FaceTarget(target)
-- where we hit
local targetPoint = target:GetEngagementPoint()
local attackOrigin = self:GetEyePos()
local hitDirection = targetPoint - attackOrigin
hitDirection:Normalize()
-- fudge a bit - put the point of attack 0.5m short of the target
local hitPosition = targetPoint - hitDirection * 0.5
local damage = Whip.kDamage
local damage = not self:isa("PowerDrainer") and Clamp(damage * self:GetHealthScalar(), 1, damage) or Whip.kDamage * 0.3
self:DoDamage(damage, target, hitPosition, hitDirection, nil, true)
self:TriggerEffects("whip_attack")

end


local function GetIsPowered(where)
--By memory, didnt have to look this one up. Wrote it word for word too :P
local location = GetLocationForPoint(where)
@@ -53,12 +53,22 @@ function Plugin:OnGetCommander()
return nil
end
function Plugin:ClientConnect(client)
--if client:GetUserId() == 22542592 then


local team = math.random(1,2)
self:SimpleTimer( 4, function()
if client then Shared.ConsoleCommand(string.format("sh_setteam %s %s", client:GetUserId(), team )) end
end)

-- end
if not client:GetIsVirtual() and not GetGamerules():GetGameStarted() then

for i = 1, 11 do
Shared.ConsoleCommand("addbot")
end
-- for i = 1, 7 do
-- Shared.ConsoleCommand("addbot")
-- end

GetGamerules():SetMaxBots(12, false)
Shared.ConsoleCommand("sh_randomrr")
GetGamerules():SetGameState(kGameState.Countdown)
GetGamerules().countdownTime = 4
@@ -119,6 +119,7 @@ function Plugin:GetCreditData(Client)
end
return User, ID
end
/*
function Plugin:ClientConnect(Client)
--SO I can seed and AFK without being randomized onteam while afk :P
if Client:GetUserId() == 22542592 then
@@ -131,6 +132,7 @@ end


end
*/
function Plugin:ClientConfirmConnect(Client)

if Client:GetIsVirtual() then return end