@@ -154,48 +154,17 @@ local function FindMarineDefense(where)
end
return nil
end
/*
local function SendTheMarineOrdersHere(who, where, which)
local offense = nil
local defense = nil
local move = nil

offense = FindMarineOffense(where)
if offense ~= nil then
who:GiveOrder(kTechId.Attack, offense:GetId(), offense:GetOrigin(), nil, true, true)
return
end
defense = FindMarineDefense(where)
if defense ~= nil then
who:GiveOrder(kTechId.Defend, defense:GetId(), defense:GetOrigin(), nil, true, true)
return
end

move = FindMarineMove(where, which)
if move ~= nil then
who:GiveOrder(kTechId.Move, nil, move, nil, true, true)
return
end

end
*/
local function DefendPayLoad(player, where, which)
local payload = GetNearest(where, "ARC", 1)
local function DefendPayLoad(player, where)
local payload = GetNearest(where, "ARC", 1, function(ent) return not ent:isa("BigArc") end)
if payload then
local range = 0
range = player:GetDistance(payload)
--Print("player to payload distance is %s", range)
if range <= 32 and ( payload.deployMode ~= ARC.kDeployMode.Deployed and not payload:InRadius() ) then
player:GiveOrder(kTechId.Defend, payload:GetId(), payload:GetOrigin(), nil, true, true)
return
end
end
--SendTheMarineOrdersHere(player,where, which)
end
local function ForAllMarinesSendWP(where, which)
local function ForAllMarinesDefendArc(where)
for _, player in ipairs(GetEntitiesWithinRange("Marine", where, 999)) do
if player:GetIsAlive() and not player:isa("Commander") then
DefendPayLoad(player, where, which)
DefendPayLoad(player, player:GetOrigin())
end
end
end
@@ -240,10 +209,47 @@ local function BuildAllNodes(self)
powerpoint:SetConstructionComplete()
end

end
local function PlaceExtraRes(self)
local locations = {}
for _, location in ientitylist(Shared.GetEntitiesWithClassname("Location")) do
local locationName = location and location:GetName() or ""
table.insertunique(locations,locationName)
end

for _, resnode in ientitylist(Shared.GetEntitiesWithClassname("ResourcePoint")) do
local location = GetLocationForPoint(resnode:GetOrigin())
local locationName = location and location:GetName() or ""
if table.find(locations, locationName) then table.removevalue(locations,locationName) end
end

if #locations == 0 then return end

for i = 1, #locations do
local location = locations[i]
local powerpoint = GetPowerPointForLocation(location)
if powerpoint then
local ResourcePoint = CreateEntity(ResourcePoint.kPointMapName, FindFreeSpace(powerpoint:GetOrigin(), 4, 16))
end
end


end

local function SetupBaseDefense(self)

for _, location in ientitylist(Shared.GetEntitiesWithClassname("Location")) do
if GetIsPointInMarineBase(location:GetOrigin()) then
location:InitiateDefense()
end
end

end
function Conductor:OnRoundStart()
if Server then
BuildAllNodes(self)
PlaceExtraRes(self)
SetupBaseDefense(self)
self:SpawnInitialStructures()
self:AutoBioMass()
local CreateImagination = CreateEntity(Imaginator.kMapName)
@@ -277,9 +283,10 @@ function Conductor:PickMainRoom()
return true
end
function Conductor:SetMainRoom(where, which)
if Server then MoveArcs(where) end
CoordinateWithPowerNode(which.name)
if not self:GetCanVape() then CreateAlienMarker(where) end
ForAllMarinesSendWP(where, which)
CreateAlienMarker(where)
ForAllMarinesDefendArc(where)
FindOrCreateKingCyst(where, which)
end
local function SuddenDeathConditionsCheck(self)
@@ -289,11 +296,6 @@ local function SuddenDeathConditionsCheck(self)

return false
end
local function RanOutOfWeed()
for _, vaporizer in ientitylist(Shared.GetEntitiesWithClassname("Vaporizer")) do
if vaporizer then DestroyEntity(vaporizer) end
end
end
function Conductor:GetCanVape()
local gamestarttime = GetGamerules():GetGameStartTime()
local gameLength = Shared.GetTime() - gamestarttime
@@ -324,7 +326,6 @@ function Conductor:PayloadTimer()
boolean = true
if not SuddenDeathConditionsCheck(self) then
--GetGamerules():SetGameState(kGameState.Team2Won)
RanOutOfWeed()
else
AddPayLoadTime(8)
end
@@ -1 +1,3 @@
kAddTimer = 300
kAddTimer = 300
kWelderPowerRepairRate = 880
kBuilderPowerRepairRate = 880
@@ -28,7 +28,8 @@ local function GetDefenseEntsInRange(who)
local crags = GetCragsCount(who:GetOrigin())
local hivecrags = GetEntitiesWithinRange("HiveCrag", who:GetOrigin(), 24)
local shades = GetEntitiesForTeamWithinRange("Shade", 2, who:GetOrigin(), 24)
return shifts, crags, hivecrags, shades
local drifters = GetEntitiesForTeamWithinRange("DrifterAvoca", 2, who:GetOrigin(), 9999)
return shifts, crags, hivecrags, shades, drifters
end
local function UpdateTypeOfHive(who)
local hasshade = false
@@ -85,67 +86,68 @@ function Conductor:MaintainHiveDefense()

return true
end
local function DamagePowerPoint(hive)
local where = hive:GetOrigin()
local location = GetLocationForPoint(where)
local locationName = location and location.name or ""
local powerpoint = GetPowerPointForLocation(locationName)
if powerpoint then
if powerpoint:GetIsBuilt() and not powerpoint:GetIsDisabled() then
powerpoint:DeductHealth(powerpoint:GetMaxHealth() * 0.10)
end
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)
local spawned = false
local origin = hive:GetOrigin()
local veils = Clamp(GetBuiltStructureCount("Veil", 2), 0, 3)
local function SpawnUpgChamber(origin)
local spawned = false
local veils = Clamp(GetBuiltStructureCount("Veil", 2), 0, 3)
local spurs = Clamp(GetBuiltStructureCount("Spur", 2), 0, 3)
local shells = Clamp(GetBuiltStructureCount("Shell", 2), 0, 3)
local spawnedupg = false

local spawnedupg = false
local workaround = nil
--messy archaic primitive spawn formula because it simply works - built from ground up - improved over time etc
if veils <= 2 then
local veil = CreateEntity(Veil.kMapName, FindFreeSpace(origin), 2)
veil:SetConstructionComplete()
workaround = veil
spawnedupg = true
end

if spurs <= 2 and not spawnedupg then
if spurs <= 2 and not spawnedupg then
local spur = CreateEntity(Spur.kMapName, FindFreeSpace(origin), 2)
spur:SetConstructionComplete()
workaround = spur
spawnedupg = true
end

if shells <= 2 and not spawnedupg then
if shells <= 2 and not spawnedupg then
local shell = CreateEntity(Shell.kMapName, FindFreeSpace(origin), 2)
shell:SetConstructionComplete()
workaround = shell
spawnedupg = true
end


if spawnedupg == true then
workaround:GetTeam():SetTeamResources(workaround:GetTeam():GetTeamResources() - 0)
end

end
function Conductor:HiveDefenseMain(hive, shifts, crags, hivecrags, shades, drifters)
-- local tres = kStructureDropCost
if not hive:GetIsAlive() then return end
local origin = hive:GetOrigin()
local canafford = GetCanSpawnAlienEntity(0)
if canafford then SpawnUpgChamber(origin) end


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

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

@@ -162,14 +164,23 @@ function Conductor:HiveDefenseMain(hive, shifts, crags, hivecrags, shades)
if #shades <= math.random(1,3) then
local tres = 0 --kShadeCost
if not spawned then
if GetCanSpawnAlienEntity(tres) then
-- if GetCanSpawnAlienEntity(tres) then
local shade = CreateEntity(Shade.kMapName, FindFreeSpace(origin), 2)
shade:GetTeam():SetTeamResources(shade:GetTeam():GetTeamResources() - tres)
-- shade:GetTeam():SetTeamResources(shade:GetTeam():GetTeamResources() - tres)
shade:SetConstructionComplete()
end
-- end
end
end

if #drifters <= 2 then
local tres = 0 --kShadeCost
if not spawned then
-- if GetCanSpawnAlienEntity(tres) then
local drifter = CreateEntity(DrifterAvoca.kMapName, FindFreeSpace(origin), 2)
-- drifter:GetTeam():SetTeamResources(drifter:GetTeam():GetTeamResources() - tres)
--end
end
end



@@ -103,8 +103,13 @@ local function GetRange(who, where)
local ArcFormula = (where - who:GetOrigin()):GetLengthXZ()
return ArcFormula
end
local function TresCheck(cost)
local function TresCheck(team, cost)
if team == 1 then
return GetGamerules().team1:GetTeamResources() >= cost
elseif team == 2 then
return GetGamerules().team2:GetTeamResources() >= cost
end

end
local function GetSentryMinRangeReq(where)
local count = 0
@@ -134,32 +139,32 @@ local function GetMarineSpawnList()

local tospawn = {}

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

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

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

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

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


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

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

@@ -199,23 +204,34 @@ local function GetTechId(mapname)
end
return nil
end
local function GetActiveAirLock()
local airlocks = {}
for _, location in ientitylist(Shared.GetEntitiesWithClassname("Location")) do
if location:GetIsAirLock(true) then table.insert(airlocks,location) end
end
return table.random(airlocks)
end
local function GetScanMinRangeReq(where)

local obs = #GetEntitiesForTeamWithinRange("Observatory", 1, where, kScanRadius)

for i = 1, obs do
if GetIsUnitActive(obs) then return 999 end
end

return kScanRadius

end
local function BuildNotificationMessage(where, self, mapname)
local techId = GetTechId(mapname)
local location = GetLocationForPoint(where)
local locationName = location and location:GetName() or ""
self:TriggerNotification(Shared.GetStringIndex(locationName), techId)
end
function Imaginator:ActualFormulaMarine()

--Print("AutoBuildConstructs")
local randomspawn = nil
local tospawn = GetMarineSpawnList()
local airlocks = EntityListToTable(Shared.GetEntitiesWithClassname("AirLock"))
local airlock = nil
local airlock = GetActiveAirLock()
local success = false
if airlocks then
airlock = table.random(airlocks)
if airlock then
if airlock and tospawn then
local powerpoint = GetPowerPointForLocation(airlock.name)
if powerpoint then
local randomspawn = FindFreeSpace(FindRandomPerson(airlock, powerpoint))
@@ -231,7 +247,7 @@ local success = false
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 == Scan.kMapName then minrange = GetScanMinRangeReq(randomspawn) cost = 3 end
if tospawn == SentryBattery.kMapName then minrange = 16 end
if range >= minrange then
local entity = CreateEntity(tospawn, randomspawn, 1)
@@ -244,13 +260,17 @@ local success = false
success = true
end
end
end
end
end

return success

end
/*
local function HasThreeUpgFor()
GetGamerules().team2
end
*/
local function GetAlienSpawnList(cystonly)

local tospawn = {}
@@ -259,13 +279,13 @@ local tospawn = {}
return AutoCyst.kMapName
end

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

@@ -288,7 +308,7 @@ local randomspawn = nil
local powerPoints = GetDisabledPowerPoints()
local tospawn = GetAlienSpawnList(cystonly)
local success = false
if powerPoints then
if powerPoints and tospawn then
local powerpoint = table.random(powerPoints)
if powerpoint and powerpoint:GetIsDisabled() then
local randomspawn = FindFreeSpace(FindRandomPerson(GetLocationForPoint(powerpoint:GetOrigin()), powerpoint))
@@ -4,19 +4,11 @@ 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 kMatureHydraHealth * 2
end
function PanicAttack:GetMaxArmor()
return kMatureHydraArmor * 2
end
function PanicAttack:OnInitialized()
Hydra.OnInitialized(self)
if Server then
@@ -49,13 +41,6 @@ function PanicAttack:OnAdjustModelCoords(modelCoords)
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

This file was deleted.

@@ -339,7 +339,7 @@ function GUIInsight_TopBar:Update(deltaTime)
local hours = math.floor(minutes / 60)
minutes = minutes - hours * 60
seconds = seconds - minutes * 60 - hours * 3600
payloadTimetext = string.format("ChairDefense: %d:%02d", minutes, seconds)
payloadTimetext = string.format("payLoadTimer: %d:%02d", minutes, seconds)
else
payloadTimetext = string.format("Chair(s) Vulnerable!", GetPayloadTime())
end
@@ -1,15 +1,4 @@
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)
end
end


function Hive:UpdateManually()
if Server then
@@ -70,69 +59,4 @@ function Hive:UpdatePassive()
end


end
function Hive: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 gameRules = GetGamerules()
local currentroundlength = ( Shared.GetTime() - gameRules:GetGameStartTime() )
local researchDuration = 4
if researchNode then
if researchNode:GetTechId() == kTechId.ResearchBioMassOne then
elseif researchNode:GetTechId() == kTechId.ResearchBioMassTwo then
researchDuration = 300
defaultresearch = true
end--
if researchNode:GetTechId() == kTechId.BileBomb then
projectedminutemarktounlock = math.random(180,240)
elseif researchNode:GetTechId() == kTechId.MetabolizeEnergy then
projectedminutemarktounlock = math.random(180, 240)
elseif researchNode:GetTechId() == kTechId.Leap then
projectedminutemarktounlock = math.random(180, 240)
elseif researchNode:GetTechId() == kTechId.Spores then
projectedminutemarktounlock = math.random(280, 300)
elseif researchNode:GetTechId() == kTechId.Umbra then
projectedminutemarktounlock = math.random(320, 360)
elseif researchNode:GetTechId() == kTechId.MetabolizeHealth then
projectedminutemarktounlock = math.random(320, 360)
elseif researchNode:GetTechId() == kTechId.BoneShield then
projectedminutemarktounlock = math.random(360, 420)
elseif researchNode:GetTechId() == kTechId.Stab then
projectedminutemarktounlock = math.random(360, 420)
elseif researchNode:GetTechId() == kTechId.Stomp then
projectedminutemarktounlock = math.random(420, 480)
elseif researchNode:GetTechId() == kTechId.Xenocide then
projectedminutemarktounlock = math.random(420, 500)

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 --
self.timeLastUpdateCheck = Shared.GetTime()
end
@@ -2,28 +2,22 @@
if Server then

local function GetMacsAmount()
local macavoca = 0
local basemac = 0
local playermac = 0
local bigmac = 0
local total = 0
for index, mac in ientitylist(Shared.GetEntitiesWithClassname("MAC")) do
if mac:isa("BaseMac") then
basemac = basemac + 1
elseif mac:isa("PlayerMac") then
playermac = playermac + 1
elseif mac:isa("BigMac") then
basemac = basemac + 1
elseif mac:isa("MacAvoca") then
macavoca = macavoca + 1
end

end
total = macavoca + basemac + playermac + bigmac
return macavoca, basemac, playermac, bigmac, total
total = basemac + bigmac
return basemac, bigmac, total
end
local function MacQualifications(self)
local macavoca,basemac, playermac,bigmac, total = GetMacsAmount()
local basemac,bigmac, total = GetMacsAmount()
local boolean = false
if total <= 7 then
boolean = true
@@ -33,14 +27,10 @@ local function MacQualifications(self)

end
local function GetMacMapName()
local macavoca,basemac, playermac,bigmac, total = GetMacsAmount()
if macavoca <= 3 then
return MacAvoca.kMapName
elseif basemac<= 3 then
local basemac,bigmac, total = GetMacsAmount()
if basemac<= 7 then
return BaseMac.kMapName
elseif playermac <=5 then
return PlayerMac.kMapName
elseif bigmac == 0 then
elseif bigmac <= 3 then
return BigMac.kMapName
end

@@ -73,16 +63,16 @@ local function GetArcsAmount()
end
local function HasPayLoad(where)

for _, avocaarc in ipairs(GetEntitiesWithinRange("AvocaArc", where, 999)) do
if avocaarc then return true end
end
return false
local arcs = #GetEntitiesWithinRange("AvocaArc", where, 999)
local ccs = #GetEntitiesWithinRange("CommandStation", where, 999)


if not arcs or ccs>arcs then return false else return true end

end
local function ArcQualifications(self)
local boolean = false
if (GetArcsAmount() <= 7 or not HasPayLoad(self:GetOrigin()) ) and
self:GetTeam():GetTeamResources() >= kARCCost and
-- ( kMaxSupply - GetSupplyUsedByTeam(1) >= LookupTechData(kTechId.ARC, kTechDataSupply, 0)) and
if (GetArcsAmount() <= 7 and self:GetTeam():GetTeamResources() >= kARCCost) or not HasPayLoad(self:GetOrigin()) and
self.deployed and
GetIsUnitActive(self) and
self:GetResearchProgress() == 0 and
@@ -72,7 +72,7 @@ local function GiveUnDeploy(who)
end
local function PlayersNearby(who)

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

if #players >= 1 then
for i = 1, #players do
@@ -180,7 +180,10 @@ 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
if doer and doer:isa("PanicAttack") then
damage = damage * 8
damage = damage * Clamp(doer:GetHealthScalar(), 0.25, 1)
end
damageTable.damage = damageTable.damage * damage

end
@@ -220,11 +223,11 @@ if Client then
end //up render
end -- client
function AvocaArc:BeginTimer()
self:AddTimedCallback(AvocaArc.Instruct, 4)
self:AddTimedCallback(AvocaArc.Instruct, 2.5)
end
function AvocaArc:OnAdjustModelCoords(coords)

local scale = 1.5
local scale = 1.37
coords.xAxis = coords.xAxis * scale
coords.yAxis = coords.yAxis * scale
coords.zAxis = coords.zAxis * scale
@@ -253,16 +256,17 @@ end

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

local currentOrder = self:GetCurrentOrder()
ASSERT(currentOrder)

self:SetMode(ARC.kMode.Moving)

local moveSpeed = ( self:GetIsInCombat() or self:GetGameEffectMask(kGameEffect.OnInfestation) ) and ARC.kCombatMoveSpeed or ARC.kMoveSpeed
local slowspeed = ARC.kCombatMoveSpeed
local normalspeed = ARC.kMoveSpeed * 1.25
local moveSpeed = ( self:GetIsInCombat() or self:GetGameEffectMask(kGameEffect.OnInfestation) ) and slowspeed or normalspeed
-- local marines = GetEntitiesWithinRange("Marine", self:GetOrigin(), 4)
-- if #marines >= 2 then
-- moveSpeed = moveSpeed * Clamp(#marines/4, 1.1, 4)
@@ -358,7 +362,7 @@ local function PerformAttack(self)
local hitEntities = GetEntitiesWithMixinWithinRange("Live", self.targetPosition, ARC.kSplashRadius)

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

-- Play hit effect on each
for index, target in ipairs(hitEntities) do
@@ -401,7 +405,7 @@ function AvocaArc:OnTag(tagName)
-- notify the target selector that we have moved.
self.targetSelector:AttackerMoved()

self:AdjustMaxHealth(kARCDeployedHealth)
self:AdjustMaxHealth(kARCDeployedHealth * 2.5)

local currentArmor = self:GetArmor()
if currentArmor ~= 0 then
@@ -415,9 +419,9 @@ function AvocaArc:OnTag(tagName)

self.deployMode = ARC.kDeployMode.Undeployed

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

end
@@ -1,102 +1,42 @@
class 'AvocaChair' (CommandStation)
AvocaChair.kMapName = "avocachair"

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


function CommandStation:GetRequiresPower()
return true
local function GetTechPoint(where)
for _, techpoint in ipairs(GetEntitiesWithinRange("TechPoint", where, 8)) do
if techpoint then return techpoint end
end
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
local function BuildAlienHive(who)
who:AddTimedCallback(function()
local hive = who:SpawnCommandStructure(2)

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
local nearestPower = GetNearest(who:GetOrigin(), "PowerPoint", 1)
if nearestPower and not nearestPower:GetIsDisabled() then
nearestPower:Kill()
end

end, 8)
end

function AvocaChair:GetRequiresPower()
return false
function CommandStation:OnKill(attacker, doer, point, direction)
local child = GetTechPoint(self:GetOrigin())
BuildAlienHive(child)
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()
function CommandStation: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(Armory.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(ArmsLab.kMapName, FindFreeSpace(techPointOrigin,8), 1)
CreateEntity(PrototypeLab.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)
CreateEntity(PhaseAvoca.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)
@@ -0,0 +1,259 @@
--Kyle 'Avoca' Abent
class 'BigArc' (ARC)
BigArc.kMapName = "bigarc"
local kNanoshieldMaterial = PrecacheAsset("cinematics/vfx_materials/nanoshield.material")
local kPhaseSound = PrecacheAsset("sound/NS2.fev/marine/structures/phase_gate_teleport")

local kMoveParam = "move_speed"
local kMuzzleNode = "fxnode_arcmuzzle"


local function SoTheGameCanEnd(self, who) --Although HiveDefense prolongs it
local arc = GetEntitiesWithinRange("ARC", who:GetOrigin(), ARC.kFireRange)
if #arc >= 1 then CreateEntity(Scan.kMapName, who:GetOrigin(), 1) end
end
local function CheckHivesForScan()
local hives = {}
for _, hiveent in ientitylist(Shared.GetEntitiesWithClassname("Hive")) do
table.insert(hives, hiveent)
end
if #hives == 0 then return end
--Scan hive if arc in range, only 1 check per hive.. not per arc.. or whatever.
for i = 1, #hives do
local ent = hives[i]
SoTheGameCanEnd(self, ent)
end
end
function BigArc:GiveDeploy()
self:GiveOrder(kTechId.ARCDeploy, self:GetId(), self:GetOrigin(), nil, true, true)
end
local function MoveToHives(who) --Closest hive from origin
local where = who:GetOrigin()
local hive = GetNearest(where, "Hive", 2, function(ent) return not ent:GetIsDestroyed() end)


if hive then
local origin = hive:GetOrigin() -- The arc should auto deploy beforehand
who:GiveOrder(kTechId.Move, nil, origin, nil, true, true)
return
end
-- Print("No closest hive????")
end
local function GetTechPoint(where)
for _, techpoint in ipairs(GetEntitiesWithinRange("TechPoint", where, 8)) do
if techpoint then return techpoint end
end
end
local function BuildAlienHive(who)
who:AddTimedCallback(function()
local hive = who:SpawnCommandStructure(2)

local nearestPower = GetNearest(who:GetOrigin(), "PowerPoint", 1)
if nearestPower and not nearestPower:GetIsDisabled() then
nearestPower:Kill()
end

end, 8)
end
function BigArc:OnKill(attacker, doer, point, direction)
local child = GetTechPoint(self:GetOrigin())
if Server then AddPayLoadTime(45) end
BuildAlienHive(child)
end
local function CheckForAndActAccordingly(who)
local stopanddeploy = false
for _, enemy in ipairs(GetEntitiesWithMixinForTeamWithinRange("Live", 2, who:GetOrigin(), kARCRange)) do
if who:GetCanFireAtTargetActual(enemy, enemy:GetOrigin()) then
stopanddeploy = true
break
end
end
--Print("stopanddeploy is %s", stopanddeploy)
return stopanddeploy
end
local function FindNewParent(who)
local where = who:GetOrigin()
local player = GetNearest(where, "Player", 1, function(ent) return ent:GetIsAlive() end)
if player then
who:SetOwner(player)
end
end
local function GiveDeploy(who)
--Print("GiveDeploy")
who:GiveOrder(kTechId.ARCDeploy, who:GetId(), who:GetOrigin(), nil, true, true)
end
local function GiveUnDeploy(who)
--Print("GiveUnDeploy")
who:CompletedCurrentOrder()
who:SetMode(ARC.kMode.Stationary)
who.deployMode = ARC.kDeployMode.Undeploying
who:TriggerEffects("arc_stop_charge")
who:TriggerEffects("arc_undeploying")
end
function BigArc:GetUnitNameOverride(viewer)
local unitName = GetDisplayName(self)
unitName = string.format(Locale.ResolveString("BigArc") )
return unitName
end
function BigArc:GetDeathIconIndex()
return kDeathMessageIcon.ARC
end
if Client then

function BigArc:OnUpdateRender()
local showMaterial = not self:GetInAttackMode()

local model = self:GetRenderModel()
if model then

model:SetMaterialParameter("glowIntensity", 4)

if showMaterial then

if not self.hallucinationMaterial then
self.hallucinationMaterial = AddMaterial(model, kNanoshieldMaterial)
end

self:SetOpacity(0.5, "hallucination")

else

if self.hallucinationMaterial then
RemoveMaterial(model, self.hallucinationMaterial)
self.hallucinationMaterial = nil
end//

self:SetOpacity(1, "hallucination")

end //showma

end//omodel
end //up render
end -- client
function BigArc:OnAdjustModelCoords(coords)

local scale = 4
coords.xAxis = coords.xAxis * scale
coords.yAxis = coords.yAxis * scale
coords.zAxis = coords.zAxis * scale

return coords

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

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

if Server then
local function GetEntitiesInSameLocation(where)
local ents = {}

local wherelocation = GetLocationForPoint(where)
wherelocation = wherelocation and wherelocation:GetName() or ""

for _, eligable in ipairs(GetEntitiesWithMixinForTeamWithinRange("Construct", 2, where, 72)) do

local location = spawnPoint and GetLocationForPoint(spawnPoint)
local locationName = location and location:GetName() or ""
local sameLocation = locationName == wherelocation
table.insert(ents, eligable)
end

return ents


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 = GetEntitiesInSameLocation(self:GetOrigin()) or GetEntitiesWithMixinWithinRange("Live", self.targetPosition, ARC.kSplashRadius)

-- Do damage to every target in range
RadiusDamage(hitEntities, self.targetPosition, ARC.kSplashRadius, 2000, 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 * 2)

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 * 2)
self.deployedArmor = self:GetArmor()
self:SetMaxArmor(kARCArmor * 2)
self:SetArmor(self.undeployedArmor)

end

end

end



Shared.LinkClassToMap("BigArc", BigArc.kMapName, networkVars)

Large diffs are not rendered by default.

@@ -17,17 +17,10 @@ function CystAvoca:OnCreate()
InitMixin(self, PathingMixin)
InitMixin(self, OrdersMixin, { kMoveOrderCompleteDistance = kAIMoveOrderCompleteDistance })
InitMixin(self, AlienStructureMoveMixin, { kAlienStructureMoveSound = Whip.kWalkingSound })
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(2,4)
self:AddHealth(gain, false, false, false)
return self:GetIsAlive() and not self:GetIsDestroyed()
end
function CystAvoca:GetCystParentRange()
return 999
end
@@ -114,7 +107,17 @@ function CystAvoca:SpawnWhipsAtKing(whips, crags, cyst, origin)
-- local tres = kWhipCost / 2
-- if GetCanSpawnAlienEntity(tres) then
local whip = CreateEntity(WhipAvoca.kMapName, FindFreeSpace(origin), 2)
local random = math.random(1,4)

if random == 4 then
whip:SetConstructionComplete()
end

local randomagain = whip:GetIsBuilt() and math.random(1,4)
if randomagain == 4 then
whip:SetMature()
end

-- whip:GetTeam():SetTeamResources(whip:GetTeam():GetTeamResources() - tres)
-- end
--end, 4)
@@ -152,11 +155,26 @@ function CystAvoca:SpawnWhipsAtKing(whips, crags, cyst, origin)
-- end

end
local function SlowMarinesNearMist(where)
local marines = GetEntitiesForTeamWithinRange("Player", 1, where, 10)

if #marines == 0 then return end

for i = 1, #marines do
local ent = marines[i]
if ent:GetIsAlive() and ent.SetWebbed then ent:SetWebbed(8) end
end

end

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

if chance <= 30 then
if Server then CreateEntity(NutrientMist.kMapName, FindFreeSpace(where), 2) end
if chance == 4 then
if Server then
CreateEntity(NutrientMist.kMapName, FindFreeSpace(where), 2)
SlowMarinesNearMist(where)
end
end
end
local function MoveEggs(self)
@@ -193,7 +211,14 @@ end
function Cyst:ModifyDamageTaken(damageTable, attacker, doer, damageType, hitPoint)

if doer ~= nil and doer:isa("ARC") then
damageTable.damage = 0
damageTable.damage = 10
end

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

if doer ~= nil and doer:isa("ARC") then
damageTable.damage = 100
end

end
@@ -204,7 +229,9 @@ function CystAvoca:Synchronize()
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()))
local location = GetLocationForPoint(self:GetOrigin()) or GetNearest(self:GetOrigin(), "Location") or nil
if location == nil then return true end
local cysts, tableof = GetCystsInLocation(location)
for i = 1, #tableof do
local autocyst = tableof[i]
if autocyst and autocyst:GetIsAlive() and autocyst:GetIsBuilt() then AttractCrags(autocyst) end
@@ -0,0 +1,168 @@
class 'DrifterAvoca' (Drifter)
DrifterAvoca.kMapName = "drifteravoca"

local kDrifterConstructSound = PrecacheAsset("sound/NS2.fev/alien/drifter/drift")

local kDetectInterval = 0.5
local kDetectRange = 1.5
local function IsBeingGrown(self, target)

if target.hasDrifterEnzyme then
return true
end

for _, drifter in ipairs(GetEntitiesForTeam("Drifter", target:GetTeamNumber())) do

if self ~= drifter then

local order = drifter:GetCurrentOrder()
if order and order:GetType() == kTechId.Grow then

local growTarget = Shared.GetEntity(order:GetParam())
if growTarget == target then
return true
end

end

end

end

return false

end
local function FindTask(self)
local eligable = GetNearestMixin(self:GetOrigin(), "Construct", 2, function(ent) return not ent:GetIsBuilt() and not IsBeingGrown(self, ent) and (not ent.GetCanAutoBuild or ent:GetCanAutoBuild()) end)
if eligable then
self:GiveOrder(kTechId.Grow, eligable:GetId(), eligable:GetOrigin(), nil, false, false)
return

end
end

local function UpdateTasks(self, deltaTime)

if not self:GetIsAlive() then
return
end

local currentOrder = self:GetCurrentOrder()
if currentOrder ~= nil then

local maxSpeedTable = { maxSpeed = Drifter.kMoveSpeed }
self:ModifyMaxSpeed(maxSpeedTable)
local drifterMoveSpeed = maxSpeedTable.maxSpeed

local currentOrigin = Vector(self:GetOrigin())

if currentOrder:GetType() == kTechId.Move or currentOrder:GetType() == kTechId.Patrol then
self:ProcessMoveOrder(drifterMoveSpeed, deltaTime)
elseif currentOrder:GetType() == kTechId.Follow then
self:ProcessFollowOrder(drifterMoveSpeed, deltaTime)
elseif currentOrder:GetType() == kTechId.EnzymeCloud or currentOrder:GetType() == kTechId.Hallucinate or currentOrder:GetType() == kTechId.MucousMembrane or currentOrder:GetType() == kTechId.Storm then
self:ProcessEnzymeOrder(drifterMoveSpeed, deltaTime)
elseif currentOrder:GetType() == kTechId.Grow then
self:ProcessGrowOrder(drifterMoveSpeed, deltaTime)
end

-- Check difference in location to set moveSpeed
local distanceMoved = (self:GetOrigin() - currentOrigin):GetLength()

self.moveSpeed = (distanceMoved / drifterMoveSpeed) / deltaTime

else

if not self.timeLastTaskCheck or self.timeLastTaskCheck + 2 < Shared.GetTime() then

FindTask(self)
self.timeLastTaskCheck = Shared.GetTime()

end

end

end
local function ScanForNearbyEnemy(self)

-- Check for nearby enemy units. Uncloak if we find any.
self.lastDetectedTime = self.lastDetectedTime or 0
if self.lastDetectedTime + kDetectInterval < Shared.GetTime() then

if #GetEntitiesForTeamWithinRange("Player", GetEnemyTeamNumber(self:GetTeamNumber()), self:GetOrigin(), kDetectRange) > 0 then

self:TriggerUncloak()

end
self.lastDetectedTime = Shared.GetTime()

end

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

return success, blipType, blipTeam, isAttacked, false --isParasited
end
function DrifterAvoca:OnUpdate(deltaTime)

ScriptActor.OnUpdate(self, deltaTime)

-- Blend smoothly towards target value
self.moveSpeedParam = Clamp(Slerp(self.moveSpeedParam, self.moveSpeed, deltaTime), 0, 1)
--UpdateMoveYaw(self, deltaTime)

if Server then

self.constructing = false
UpdateTasks(self, deltaTime)

ScanForNearbyEnemy(self)

self.camouflaged = (not self:GetHasOrder() or self:GetCurrentOrder():GetType() == kTechId.HoldPosition ) and not self:GetIsInCombat()
--[[
self.hasCamouflage = GetHasTech(self, kTechId.ShadeHive) == true
self.hasCelerity = GetHasTech(self, kTechId.ShiftHive) == true
self.hasRegeneration = GetHasTech(self, kTechId.CragHive) == true
--]]
if self.hasRegeneration then

if self:GetIsHealable() and ( not self.timeLastAlienAutoHeal or self.timeLastAlienAutoHeal + kAlienRegenerationTime <= Shared.GetTime() ) then

self:AddHealth(0.06 * self:GetMaxHealth())
self.timeLastAlienAutoHeal = Shared.GetTime()

end

end

self.canUseAbilities = self.timeAbilityUsed + kDrifterAbilityCooldown < Shared.GetTime()

elseif Client then

self.trailCinematic:SetIsVisible(self:GetIsMoving() and self:GetIsVisible())

if self.constructing and not self.playingConstructSound then

Shared.PlaySound(self, kDrifterConstructSound)
self.playingConstructSound = true

elseif not self.constructing and self.playingConstructSound then

Shared.StopSound(self, kDrifterConstructSound)
self.playingConstructSound = false

end

end

end
Shared.LinkClassToMap("DrifterAvoca", DrifterAvoca.kMapName, networkVars)
@@ -47,21 +47,16 @@ local techPointOrigin = nil
CreateEntity(InfantryPortal.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(MacAvoca.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(MacAvoca.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(RoboticsFactory.kMapName, FindFreeSpace(techPointOrigin,4), 1)

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

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

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

--CreateEntity(PrototypeLab.kMapName, FindFreeSpace(techPointOrigin,4), 1)
--CreateEntity(PhaseGate.kMapName, FindFreeSpace(techPointOrigin,4), 1)
CreateEntity(PhaseAvoca.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)
@@ -109,12 +104,6 @@ local function TrySomethingElse(self)
end
*/

local ccs = GetEntitiesForTeam("CommandStation", 1)
for i = 1, #ccs do
local chair = ccs[i]
local vaporizer = CreateEntity(Vaporizer.kMapName, chair:GetOrigin(), 1)
end



--self:SpawnBaseEntities(self, cc)
@@ -127,11 +116,6 @@ 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)
if powerpoint and not powerpoint:GetIsDisabled() then powerpoint:Kill() end
end
end

This file was deleted.

@@ -7,8 +7,11 @@ function BaseMac:OnCreate()
MAC.OnCreate(self)
self:AdjustMaxHealth(kMACHealth * 0.5)
self:AdjustMaxArmor(kMACArmor * 0.5)
self:SetPhysicsGroup(PhysicsGroup.PlayerControllersGroup)
end

local kNanoshieldMaterial = PrecacheAsset("cinematics/vfx_materials/nanoshield.material")

local function GetAutomaticOrder(self)

local target = nil
@@ -31,15 +34,15 @@ local function GetAutomaticOrder(self)

-- If there's a friendly entity nearby that needs constructing, constuct it.

local constructable = GetNearestMixin(self:GetOrigin(), "Construct", 1, function(ent) return GetIsPointInMarineBase(ent:GetOrigin()) and not ent:GetIsBuilt() and ent:GetCanConstruct(self) and self:CheckTarget(ent:GetOrigin()) end)
local constructable = GetNearestMixin(self:GetOrigin(), "Construct", 1, function(ent) return not ent:GetIsBuilt() and ent:GetCanConstruct(self) and self:CheckTarget(ent:GetOrigin()) end)
if constructable then
target = constructable
orderType = kTechId.Construct
end

if not target then

local weldable = GetNearestMixin(self:GetOrigin(), "Weldable", 1, function(ent) return GetIsPointInMarineBase(ent:GetOrigin()) and not ent:isa("Player") and ent:GetCanBeWelded(self) and ent:GetWeldPercentage() < 1 end)
local weldable = GetNearestMixin(self:GetOrigin(), "Weldable", 1, function(ent) return not ent:isa("Player") and ent:GetCanBeWelded(self) and ent:GetWeldPercentage() < 1 end)
if weldable then
target = weldable
orderType = kTechId.AutoWeld
@@ -183,4 +186,36 @@ function BaseMac:OnGetMapBlipInfo()

return success, blipType, blipTeam, isAttacked, false --isParasited
end
if Client then

function BaseMac:OnUpdateRender()
local showMaterial = not GetAreEnemies(self, Client.GetLocalPlayer())

local model = self:GetRenderModel()
if model then

model:SetMaterialParameter("glowIntensity", 4)

if showMaterial then

if not self.hallucinationMaterial then
self.hallucinationMaterial = AddMaterial(model, kNanoshieldMaterial)
end

self:SetOpacity(0, "hallucination")

else

if self.hallucinationMaterial then
RemoveMaterial(model, self.hallucinationMaterial)
self.hallucinationMaterial = nil
end//

self:SetOpacity(1, "hallucination")

end //showma

end//omodel
end //up render
end -- client
Shared.LinkClassToMap("BaseMac", BaseMac.kMapName, networkVars)
@@ -7,7 +7,10 @@ function BigMac:OnCreate()
MAC.OnCreate(self)
self:AdjustMaxHealth(kMACHealth * 4)
self:AdjustMaxArmor(kMACArmor * 4)
self:SetPhysicsGroup(PhysicsGroup.PlayerControllersGroup)
end


local function GetAutomaticOrder(self)

local target = nil
@@ -38,7 +41,7 @@ local function GetAutomaticOrder(self)

if not target then

local weldable = GetNearestMixin(self:GetOrigin(), "Weldable", 1, function(ent) return not GetIsPointInMarineBase(ent:GetOrigin()) and not ent:isa("Player") and ent:GetCanBeWelded(self) and ent:GetWeldPercentage() < 1 end)
local weldable = GetNearestMixin(self:GetOrigin(), "Weldable", 1, function(ent) return not GetIsPointInMarineBase(ent:GetOrigin()) and not ent:isa("Player") and ent:GetCanBeWelded(self) and ent:GetWeldPercentage() < 1 and self:CheckTarget(ent:GetOrigin()) end)
if weldable then
target = constructable
orderType = kTechId.AutoWeld
@@ -350,4 +353,5 @@ function BigMac:ProcessWeldOrder(deltaTime, orderTarget, orderLocation, autoWeld
return orderStatus

end

Shared.LinkClassToMap("BigMac", BigMac.kMapName, networkVars)

This file was deleted.

This file was deleted.

@@ -3,19 +3,15 @@ Script.Load("lua/Modifications/Remixes.lua")
Script.Load("lua/Modifications/Criticisms.lua")
Script.Load("lua/Modifications/AvocaRules.lua")
Script.Load("lua/Modifications/CystAvoca.lua")
Script.Load("lua/Modifications/PowerPointAvoca.lua")
Script.Load("lua/Modifications/AutoBioMass.lua")
Script.Load("lua/Modifications/AvocaArc.lua")
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")
Script.Load("lua/Modifications/BigArc.lua")

--Macs
Script.Load("lua/Modifications/Macs/MacAvoca.lua")
Script.Load("lua/Modifications/Macs/BaseMac.lua")
Script.Load("lua/Modifications/Macs/PlayerMac.lua")
Script.Load("lua/Modifications/Macs/BigMac.lua")
--

@@ -24,11 +20,13 @@ Script.Load("lua/Modifications/GameStart.lua")
Script.Load("lua/Modifications/AutoMacsArcs.lua")


Script.Load("lua/Modifications/DrifterAvoca.lua")
Script.Load("lua/Modifications/WhipAvoca.lua")

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


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


@@ -63,7 +61,7 @@ function Whip:FilterTarget()
end
function Whip:GetCanFireAtTargetActual(target, targetPoint)

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

@@ -217,84 +215,6 @@ end
end
*/

local function GetDestinationGate(self)
local phaseGates = {}


-- Find next phase gate to teleport to

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

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



if table.count(phaseGates) < 2 then
return nil
end

-- Find our index and add 1
local index = table.find(phaseGates, self)
if (index ~= nil) then

local nextIndex = ConditionalValue(index == table.count(phaseGates), 1, index + 1)
ASSERT(nextIndex >= 1)
ASSERT(nextIndex <= table.count(phaseGates))
return phaseGates[nextIndex]

end

return nil



end

--So that we can teleport to the payload without having to run to it all the time :P
local function ComputeDestinationLocationId(self, destGate)

local destLocationId = Entity.invalidId
if destGate then

local location = GetLocationForPoint(destGate:GetOrigin())
if location then
destLocationId = location:GetId()
end

end

return destLocationId

end
function PhaseGate:Update()

self.phase = (self.timeOfLastPhase ~= nil) and (Shared.GetTime() < (self.timeOfLastPhase + 0.3))

local destinationPhaseGate = GetDestinationGate(self)
if destinationPhaseGate ~= nil and GetIsUnitActive(self) and self.deployed and (destinationPhaseGate.deployed or destinationPhaseGate:isa("ARC") ) then

self.destinationEndpoint = destinationPhaseGate:GetOrigin()
self.linked = true
self.targetYaw = destinationPhaseGate:GetAngles().yaw
self.destLocationId = ComputeDestinationLocationId(self, destinationPhaseGate)

else
self.linked = false
self.targetYaw = 0
self.destLocationId = Entity.invalidId
end

return true

end



@@ -325,7 +245,7 @@ local function LocationsMatch(who,whom)

local whoname = GetLocationForPoint(who:GetOrigin())
local whomname = GetLocationForPoint(whom:GetOrigin())
return whoname == whomname
return true --whoname == whomname
end
local orig_PowerPoint_OnConstructionComplete = PowerPoint.OnConstructionComplete
function PowerPoint:OnConstructionComplete()
@@ -344,7 +264,7 @@ local orig_PowerPoint_OnKill = PowerPoint.OnKill
end
local location = GetLocationForPoint(self:GetOrigin())
location = location and location.name
SealAirLock(location, self:GetOrigin())
if Client then location:HideDank() end

end
local function ToSpawnFormula(self,panicstospawn, where)
@@ -355,16 +275,21 @@ local function ToSpawnFormula(self,panicstospawn, where)
if spawnpoint then
local panicattack = CreateEntity(PanicAttack.kMapName, spawnpoint, 2)
panicattack:SetConstructionComplete()
panicattack:SetMature()
end
end
end

end
local function GetRange(who, where)
local ArcFormula = (where - who:GetOrigin()):GetLengthXZ()
return ArcFormula
end
local function SendAnxietyAttack(self, where, who)
for i = 1, #who do
local panicattack = who[i]
local bitch = GetPayLoadArc()
if bitch and GetIsPointWithinHiveRadius(bitch:GetOrigin()) then
if bitch and GetIsPointWithinHiveRadius(bitch:GetOrigin()) and GetRange(panicattack,bitch:GetOrigin()) >= 16 then
local spawnpoint = FindFreeSpace(bitch:GetOrigin(), 4, 8)
if spawnpoint then
panicattack:SetOrigin(spawnpoint)
@@ -387,11 +312,11 @@ local panicattacks = {}
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
@@ -406,50 +331,42 @@ function Hive:OnTakeDamage(damage, attacker, doer, point)
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)

local kAuxPowerBackupSound = PrecacheAsset("sound/NS2.fev/marine/power_node/backup")

local function BuildRoomPower(who)

local nearestPower = GetNearest(who:GetOrigin(), "PowerPoint", 1, function(ent) return LocationsMatch(who,ent) end)
if nearestPower and nearestPower:GetIsDisabled() then
local cheaptrick = CreateEntity(PowerPoint.kMapName, nearestPower:GetOrigin(), 1)
cheaptrick:SetConstructionComplete()
DestroyEntity(nearestPower)
end


who:AddTimedCallback(function()
local avocachair = CreateEntity(AvocaChair.kMapName, who:GetOrigin(), 1)
avocachair:SetConstructionComplete()
SmokeWeedEveryDay(avocachair)
local bigarc = CreateEntity(BigArc.kMapName, who:GetOrigin(), 1)
bigarc:GiveDeploy()
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 function GetTechPoint(where)
for _, techpoint in ipairs(GetEntitiesWithinRange("TechPoint", where, 8)) do
if techpoint then return techpoint end
end
end
local orig_Hive_OnKill = Hive.OnKill
function Hive:OnKill(attacker, doer, point, direction)
if self:GetIsBuilt() then AddPayLoadTime(180) end
local child = GetTechPoint(self:GetOrigin())
BuildMarineChair(child)
BuildRoomPower(child)
child:SetIsVisible(false)
return orig_Hive_OnKill(self,attacker, doer, point, direction)
end
function Whip:OnKill(attacker, doer, point, direction)
@@ -458,15 +375,6 @@ 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
@@ -585,5 +493,117 @@ end
function Exo:PreOnKill(attacker, doer, point, direction)
self:PerformEjectOnPree()
end
local function GetDestinationGate(self)
local phaseGates = {}
-- Find next phase gate to teleport to

if self:isa("PhaseAvoca") then

for index, payload in ipairs( GetEntitiesForTeam("AvocaArc", self:GetTeamNumber()) ) do
if GetIsUnitActive(payload) then
return payload
end
end

end

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



if table.count(phaseGates) < 2 then
return nil
end
-- Find our index and add 1
local index = table.find(phaseGates, self)
if (index ~= nil) then

local nextIndex = ConditionalValue(index == table.count(phaseGates), 1, index + 1)
ASSERT(nextIndex >= 1)
ASSERT(nextIndex <= table.count(phaseGates))
return phaseGates[nextIndex]

end

return nil
end

--So that we can teleport to the payload without having to run to it all the time :P
local function ComputeDestinationLocationId(self, destGate)

local destLocationId = Entity.invalidId
if destGate then

local location = GetLocationForPoint(destGate:GetOrigin())
if location then
destLocationId = location:GetId()
end

end

return destLocationId

end
function PhaseGate:Update()

self.phase = (self.timeOfLastPhase ~= nil) and (Shared.GetTime() < (self.timeOfLastPhase + 0.3))

local destinationPhaseGate = GetDestinationGate(self)
if destinationPhaseGate ~= nil and GetIsUnitActive(self) and self.deployed and (destinationPhaseGate.deployed or destinationPhaseGate:isa("ARC") ) then

self.destinationEndpoint = destinationPhaseGate:GetOrigin()
self.linked = true
self.targetYaw = destinationPhaseGate:GetAngles().yaw
self.destLocationId = ComputeDestinationLocationId(self, destinationPhaseGate)

else
self.linked = false
self.targetYaw = 0
self.destLocationId = Entity.invalidId
end

return true

end
function InfantryPortal: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(16)
powerconsumer:TriggerEffects("arc_hit_secondary")
end
end

self:TriggerEffects("arc_hit_primary")

return not self:GetIsPowered()

end

local orig_InfantryPortal_OnPowerOff = InfantryPortal.OnPowerOff
function InfantryPortal:OnPowerOff()
orig_InfantryPortal_OnPowerOff(self)
self:AddTimedCallback(InfantryPortal.OhNoYouDidnt, 8)
end


end--server



if Client then
/*
local orig_ActionFinder_OnProcessMove = MarineActionFinderMixin.OnProcessMove
function MarineActionFinderMixin:OnProcessMove(input )
orig_ActionFinder_OnProcessMove(self)
end
*/
function MarineActionFinderMixin:OnProcessMove(input)
return
end

end
@@ -0,0 +1,29 @@
class 'PhaseAvoca' (PhaseGate)
PhaseAvoca.kMapName = "phaseavoca"

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

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



function PhaseAvoca: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
Shared.LinkClassToMap("PhaseAvoca", PhaseAvoca.kMapName, networkVars)
Empty file.
@@ -22,6 +22,22 @@ end
function WhipAvoca:ActivateSelfDestruct()
self:AddTimedCallback(WhipAvoca.Killme, 16)
end
function WhipAvoca:UpdateRootState()

local infested = true --self:GetGameEffectMask(kGameEffect.OnInfestation)
local moveOrdered = self:GetCurrentOrder() and self:GetCurrentOrder():GetType() == kTechId.Move
-- unroot if we have a move order or infestation recedes
if self.rooted and (moveOrdered or not infested) then
self:Unroot()
end

-- root if on infestation and not moving/teleporting
if not self.rooted and infested and not (moveOrdered or self:GetIsTeleporting()) then
self:Root()
end

end

function WhipAvoca:Killme()
self:DeductHealth(100)
return true