| @@ -1,3 +1,138 @@ | ||
|
|
||
| kEggBeaconBuildTime = 8 | ||
| kStructureBeaconBuildTime = 8 | ||
|
|
||
| --kPhaseOneTimer = 300 | ||
| --kPhaseTwoTimer = 900 | ||
|
|
||
| kTimeAddPowerBuilt = 2 | ||
| kTimeRemovePowerKilled = 0 | ||
| kArmoryAvoArcAddArmrAmt = 4 --per armor lvl | ||
| kArmoryAvoArcAddArmrAmt = 4 --per armor lvl | ||
|
|
||
|
|
||
| gCreditStructureSentryLimit = 3 | ||
| gCreditStructureCostPerDrifter = 5 | ||
|
|
||
| gCreditStructureWallCost = 15 | ||
| gCreditStructureWallLimit = 2 | ||
|
|
||
| gCreditStructureObservatoryCost = 10 | ||
| gCreditStructureArmoryCost = 10 | ||
| gCreditStructureSentryCost = 5 | ||
| gCreditStructureSentryLimit = 2 | ||
| gCreditStructureBackUpBatteryCost = 10 | ||
| gCreditStructureBackUpBatteryLimit = 1 | ||
|
|
||
| gCreditStructureBackupLightCost = 5 | ||
| gCreditStructureBackupLightLimit = 2 | ||
|
|
||
| gCreditStructurePhaseGateCost = 15 | ||
| gCreditStructurePhaseGateLimit = 2 | ||
| gCreditStructureInfantryPortalCost = 20 | ||
| gCreditStructureInfantryPortalLimit = 3 | ||
|
|
||
| gCreditStructureRoboticsFactoryCost = 10 | ||
| gCreditStructureRoboticsFactoryLimit = 3 | ||
|
|
||
| gCreditStructureMacCost = 5 | ||
| gCreditStructureMacLimit = 3 | ||
|
|
||
| gCreditStructureArcCost = 10 | ||
| gCreditStructureArcLimit = 2 | ||
|
|
||
| gCreditStructureExtractorCost = 2000 | ||
| gCreditStructureExtractorLimit = 1 | ||
|
|
||
|
|
||
|
|
||
| --Classes Credits Cost | ||
| gCreditClassCostJetPack = 15 | ||
|
|
||
| gCreditClassCostRailGunExo = 34 | ||
| gCreditClassCostMiniGunExo = 35 | ||
|
|
||
| gCreditClassCostWelderExo = 25 | ||
| gCreditClassCostFlamerExo = 30 | ||
|
|
||
| gCreditClassDelayJetPack = 10 | ||
| gCreditClassDelayRailGun = 15 | ||
| gCreditClassDelayMiniGun = 15 | ||
|
|
||
| gCreditClassCostSkulk = 1 | ||
| gCreditClassCostGorge = 20 | ||
| gCreditClassCostLerk = 40 | ||
| gCreditClassCostFade = 80 | ||
| gCreditClassCostOnos = 100 | ||
|
|
||
| gCreditClassDelaySkulk = 1 | ||
| gCreditClassDelayGorge = 5 | ||
| gCreditClassDelayLerk = 10 | ||
| gCreditClassDelayFade = 15 | ||
| gCreditClassDelayOnos = 20 | ||
|
|
||
|
|
||
| --Weapons Credits Cost | ||
|
|
||
| gCreditWeaponCostHeavyRifle = kHeavyRifleCost | ||
| gCreditWeaponCostMines = kMineCost | ||
| gCreditWeaponCostWelder = kWelderCost | ||
| gCreditWeaponCostHMG = kHeavyMachineGunCost | ||
| gCreditWeaponCostShotGun = kShotgunCost | ||
| gCreditWeaponCostFlameThrower = kFlamethrowerCost | ||
| gCreditWeaponCostGrenadeLauncher = kGrenadeLauncherCost | ||
| gCreditWeaponCostGrenadeGas = kClusterGrenadeCost | ||
| gCreditWeaponCostGrenadeCluster = kClusterGrenadeCost | ||
| gCreditWeaponCostGrenadePulse = kClusterGrenadeCost | ||
|
|
||
|
|
||
|
|
||
| --Alien Abilities Credits Cost | ||
| gCreditAbilityCostInk = 3 --1.5 | ||
| gCreditAbilityCostNutrientMist = 1 | ||
| gCreditAbilityCostHallucination = 10 | ||
| gCreditAbilityCostEnzymeCloud = 10 | ||
| gCreditAbilityCostMucous = 10 | ||
| gCreditAbilityCostContamination = 5 | ||
|
|
||
|
|
||
| --Alien Abilities Credits Delay | ||
| gCreditAbilityDelayInk = 50 --1.5 | ||
| gCreditAbilityDelayNutrientMist = 0 | ||
| gCreditAbilityDelayHallucination = 10 | ||
| gCreditAbilityDelayEnzymeCloud = 10 | ||
| gCreditAbilityDelayContamination = 10 | ||
|
|
||
|
|
||
| --Alien Structures Credits Cost | ||
| gCreditStructureCostHydra = 6 | ||
| gCreditStructureCostSaltyEgg = 5 | ||
| gCreditStructureLimitSaltyEgg = 4 | ||
| gCreditStructureCostShade = 13 | ||
| gCreditStructureCostCrag = 13 | ||
| gCreditStructureCostWhip = 13 | ||
| gCreditStructureCostShift = 13 | ||
| gCreditStructureCostTunnelToHive = 10 | ||
| gCreditStructureCostHarvesterExtractor = 200 | ||
| gCreditStructureLimitHarvesterExtractor = 1 | ||
| --gCreditStructureCost = | ||
|
|
||
| --Alien Structures Credits Delay After Purchasing | ||
| gCreditStructureDelayHydra = 1 | ||
| gCreditStructureDelaySaltyEgg = 10 | ||
| gCreditStructureDelayShade = 5 | ||
| gCreditStructureDelayCrag = 5 | ||
| gCreditStructureDelayWhip = 5 | ||
| gCreditStructureDelayShift = 8 | ||
| gCreditStructureDelayTunnelToHive = 10 | ||
| gCreditStructureDelay = 5 | ||
| gCreditStructureDelayHarvesterExtractor = 15 | ||
| --gCreditStructureDelay = | ||
|
|
||
| --Credit Mariners Tech | ||
|
|
||
|
|
||
| gCreditAbilityCostScan = 3 | ||
| gCreditAbilityDelayScan = 4 | ||
|
|
||
| gCreditAbilityCostMedpack = 2 | ||
| gCreditAbilityDelayMedpack = 4 |
| @@ -0,0 +1,34 @@ | ||
| CreditMixin = CreateMixin( CreditMixin ) | ||
| CreditMixin.type = "Credit" | ||
|
|
||
| CreditMixin.networkVars = | ||
| { | ||
| isacreditstructure = "boolean", | ||
|
|
||
| } | ||
|
|
||
| function CreditMixin:__initmixin() | ||
| -- Print("%s initmiin avoca mixin", self:GetClassName()) | ||
| self.isacreditstructure = false | ||
|
|
||
| -- Print("%s isacreditstructure is %s", self:GetClassName(), self.isacreditstructure) | ||
|
|
||
| end | ||
| function CreditMixin:SetIsACreditStructure(boolean) | ||
|
|
||
| self.isacreditstructure = boolean | ||
| -- Print("CreditMixin SetIsACreditStructure %s isacreditstructure is %s", self:GetClassName(), self.isacreditstructure) | ||
| end | ||
| function CreditMixin:GetCanStick() | ||
| local canstick = false --not GetSetupConcluded() | ||
| --Print("Canstick = %s", canstick) | ||
| return canstick and self:GetIsACreditStructure() | ||
| end | ||
|
|
||
| function CreditMixin:GetIsACreditStructure() | ||
|
|
||
| -- Print("CreditMixin GetIsACreditStructure %s isacreditstructure is %s", self:GetClassName(), self.isacreditstructure) | ||
| return self.isacreditstructure | ||
|
|
||
|
|
||
| end |
| @@ -0,0 +1,123 @@ | ||
| --Kyle 'Avoca' Abent | ||
| //Well I am copying everything, you know. But I like my name cause it's a good one. | ||
| local networkVars = {lastswitch = "private time", nextangle = "private integer (0 to 8)", lockedId = "entityid"} | ||
| class 'AvocaSpectator' (Spectator) | ||
| AvocaSpectator.kMapName = "Spectator" | ||
| --AvocaSpectator.kModelName = PrecacheAsset("models/alien/fade/fade.model") | ||
| function AvocaSpectator:OnInitialized() | ||
| Spectator.OnInitialized(self) | ||
| end | ||
| function AvocaSpectator:GetControllerPhysicsGroup() | ||
| return PhysicsGroup.BigPlayerControllersGroup | ||
| end | ||
| function AvocaSpectator:OnCreate() | ||
| Spectator.OnCreate(self) | ||
| self.lastswitch = Shared.GetTime() | ||
| if Server then | ||
| self:AddTimedCallback( AvocaSpectator.UpdateCamera, 1 ) | ||
| end | ||
| self.nextangle = math.random(4,8) | ||
| self.lockedId = Entity.invalidI | ||
| end | ||
| function AvocaSpectator:SetLockOnTarget(userid) | ||
| self.lockedId = userid | ||
| end | ||
| function AvocaSpectator:BreakChains() | ||
| self.lockedId = Entity.invalidI | ||
| end | ||
| function AvocaSpectator:LockAngles() | ||
| local playerOfLock = Shared.GetEntity( self.lockedId ) | ||
| if playerOfLock ~= nil then | ||
| if (playerOfLock.GetIsAlive and playerOfLock:GetIsAlive()) then | ||
| local dir = GetNormalizedVector(playerOfLock:GetOrigin() - self:GetOrigin()) | ||
| local angles = Angles(GetPitchFromVector(dir), GetYawFromVector(dir), 0) | ||
| self:SetOffsetAngles(angles) | ||
| end | ||
| end | ||
| end | ||
| function AvocaSpectator:ChangeView(self, untilNext, betweenLast) | ||
| --Shine | ||
| end | ||
| function AvocaSpectator:LockAnglesTarget(who) | ||
| end | ||
| function AvocaSpectator:UnlockAngles() | ||
| end | ||
| function AvocaSpectator:OnEntityChange(oldId) | ||
| if self.lockedId == oldId then | ||
| self.lockedId = Entity.invalidId | ||
| self.lastswitch = Shared.GetTime() | ||
| self.nextangle = math.random(4,8) | ||
| self:ChangeView(self, self.nextangle, self.lastswitch ) | ||
| end | ||
| end | ||
| local function GetCDistance(target) | ||
| local dist = 5 | ||
| if target:isa("CommandStructure") then | ||
| dist = 8 | ||
| elseif target:isa("Contamination") then | ||
| dist = 3 | ||
| elseif target:isa("Marine") then | ||
| dist = 4 | ||
| elseif target:isa("Whip") then | ||
| dist = 5 | ||
| elseif target:isa("Shift") then | ||
| dist = 5 | ||
| end | ||
| return dist | ||
| end | ||
| function AvocaSpectator:OverrideInput(input) | ||
| ClampInputPitch(input) | ||
| //Attempts of Zooming in when outside radius | ||
| if self.lockedId ~= Entity.invalidI then | ||
| local target = Shared.GetEntity( self.lockedId ) | ||
| if target and ( target.GetIsAlive and target:GetIsAlive() ) then | ||
| if target:isa("Contamination") then input.move.x = input.move.x + 0.15 end | ||
| local distance = self:GetDistance(target) | ||
| if distance >= GetCDistance(target) then | ||
| // Print("Distance %s lastzoom %s", distance, self.lastzoom) //debug my ass | ||
| input.move.z = input.move.z + 0.5 | ||
| local ymove = 0 | ||
| local myY = self:GetOrigin().y | ||
| local urY = target:GetOrigin().y | ||
| local difference = urY - myY | ||
| if difference == 0 then | ||
| ymove = difference | ||
| elseif difference <= -1 then | ||
| ymove = -1 | ||
| elseif difference >= 1 then | ||
| ymove = 1 | ||
| end | ||
| input.move.y = input.move.y + (ymove) | ||
| elseif distance <= 1.8 then | ||
| input.move.z = input.move.z - 1 | ||
| // Print(" new distance is %s, new lastzoom is %s", distance, self.lastzoom) | ||
| end | ||
| end | ||
| end | ||
| return input | ||
| end | ||
| function AvocaSpectator:UpdateCamera() | ||
| self:LockAngles() | ||
| if GetIsTimeUp(self.lastswitch, self.nextangle ) then | ||
| -- Print("AvocaSpectator ChangeView") | ||
| self.nextangle = math.random(4,8) | ||
| self.lastswitch = Shared.GetTime() | ||
| self:ChangeView(self, self.nextangle, self.lastswitch ) | ||
| end | ||
| return true | ||
| end | ||
| Shared.LinkClassToMap("AvocaSpectator", AvocaSpectator.kMapName, networkVars) |
| @@ -0,0 +1,283 @@ | ||
| --Kyle 'Avoca' Abent | ||
| Script.Load("lua/Mixins/ClientModelMixin.lua") | ||
| Script.Load("lua/LiveMixin.lua") | ||
| Script.Load("lua/PointGiverMixin.lua") | ||
| Script.Load("lua/AchievementGiverMixin.lua") | ||
| Script.Load("lua/GameEffectsMixin.lua") | ||
| Script.Load("lua/SelectableMixin.lua") | ||
| Script.Load("lua/FlinchMixin.lua") | ||
| Script.Load("lua/CloakableMixin.lua") | ||
| Script.Load("lua/LOSMixin.lua") | ||
| Script.Load("lua/DetectableMixin.lua") | ||
| Script.Load("lua/InfestationTrackerMixin.lua") | ||
| Script.Load("lua/TeamMixin.lua") | ||
| Script.Load("lua/EntityChangeMixin.lua") | ||
| Script.Load("lua/ConstructMixin.lua") | ||
| Script.Load("lua/ResearchMixin.lua") | ||
| Script.Load("lua/ScriptActor.lua") | ||
| Script.Load("lua/ObstacleMixin.lua") | ||
| Script.Load("lua/FireMixin.lua") | ||
| Script.Load("lua/SleeperMixin.lua") | ||
| Script.Load("lua/CatalystMixin.lua") | ||
| Script.Load("lua/TeleportMixin.lua") | ||
| Script.Load("lua/UnitStatusMixin.lua") | ||
| Script.Load("lua/UmbraMixin.lua") | ||
| Script.Load("lua/DissolveMixin.lua") | ||
| Script.Load("lua/MaturityMixin.lua") | ||
| Script.Load("lua/MapBlipMixin.lua") | ||
| Script.Load("lua/HiveVisionMixin.lua") | ||
| Script.Load("lua/CombatMixin.lua") | ||
| Script.Load("lua/CommanderGlowMixin.lua") | ||
|
|
||
| class 'AlienBeacon' (ScriptActor) | ||
|
|
||
| AlienBeacon.kMapName = "alienbeacon" | ||
|
|
||
| AlienBeacon.kModelName = PrecacheAsset("models/alien/shell/shell.model") | ||
|
|
||
| AlienBeacon.kAnimationGraph = PrecacheAsset("models/alien/shell/shell.animation_graph") | ||
|
|
||
| local networkVars = { } | ||
|
|
||
| AddMixinNetworkVars(BaseModelMixin, networkVars) | ||
| AddMixinNetworkVars(ClientModelMixin, networkVars) | ||
| AddMixinNetworkVars(LiveMixin, networkVars) | ||
| AddMixinNetworkVars(GameEffectsMixin, networkVars) | ||
| AddMixinNetworkVars(FlinchMixin, networkVars) | ||
| AddMixinNetworkVars(TeamMixin, networkVars) | ||
| AddMixinNetworkVars(CloakableMixin, networkVars) | ||
| AddMixinNetworkVars(LOSMixin, networkVars) | ||
| AddMixinNetworkVars(DetectableMixin, networkVars) | ||
| AddMixinNetworkVars(ConstructMixin, networkVars) | ||
| AddMixinNetworkVars(ResearchMixin, networkVars) | ||
| AddMixinNetworkVars(ObstacleMixin, networkVars) | ||
| AddMixinNetworkVars(CatalystMixin, networkVars) | ||
| AddMixinNetworkVars(TeleportMixin, networkVars) | ||
| AddMixinNetworkVars(UmbraMixin, networkVars) | ||
| AddMixinNetworkVars(DissolveMixin, networkVars) | ||
| AddMixinNetworkVars(FireMixin, networkVars) | ||
| AddMixinNetworkVars(CombatMixin, networkVars) | ||
| AddMixinNetworkVars(SelectableMixin, networkVars) | ||
| AddMixinNetworkVars(MaturityMixin, networkVars) | ||
|
|
||
| function AlienBeacon:OnCreate() | ||
|
|
||
| ScriptActor.OnCreate(self) | ||
|
|
||
| InitMixin(self, BaseModelMixin) | ||
| InitMixin(self, ClientModelMixin) | ||
| InitMixin(self, LiveMixin) | ||
| InitMixin(self, GameEffectsMixin) | ||
| InitMixin(self, FlinchMixin) | ||
| InitMixin(self, TeamMixin) | ||
| InitMixin(self, PointGiverMixin) | ||
| InitMixin(self, AchievementGiverMixin) | ||
| InitMixin(self, SelectableMixin) | ||
| InitMixin(self, EntityChangeMixin) | ||
| InitMixin(self, CloakableMixin) | ||
| InitMixin(self, LOSMixin) | ||
| InitMixin(self, DetectableMixin) | ||
| InitMixin(self, ConstructMixin) | ||
| InitMixin(self, ResearchMixin) | ||
| InitMixin(self, ObstacleMixin) | ||
| InitMixin(self, FireMixin) | ||
| InitMixin(self, CatalystMixin) | ||
| InitMixin(self, TeleportMixin) | ||
| InitMixin(self, UmbraMixin) | ||
| InitMixin(self, DissolveMixin) | ||
| InitMixin(self, CombatMixin) | ||
| InitMixin(self, MaturityMixin) | ||
|
|
||
| if Server then | ||
| InitMixin(self, InfestationTrackerMixin) | ||
| elseif Client then | ||
| InitMixin(self, CommanderGlowMixin) | ||
| end | ||
|
|
||
| self:SetLagCompensated(false) | ||
| self:SetPhysicsType(PhysicsType.Kinematic) | ||
| self:SetPhysicsGroup(PhysicsGroup.MediumStructuresGroup) | ||
|
|
||
| end | ||
|
|
||
| function AlienBeacon:OnInitialized() | ||
|
|
||
| ScriptActor.OnInitialized(self) | ||
|
|
||
| self:SetModel(AlienBeacon.kModelName, AlienBeacon.kAnimationGraph) | ||
|
|
||
| if Server then | ||
|
|
||
| InitMixin(self, StaticTargetMixin) | ||
| InitMixin(self, SleeperMixin) | ||
|
|
||
| -- This Mixin must be inited inside this OnInitialized() function. | ||
| if not HasMixin(self, "MapBlip") then | ||
| InitMixin(self, MapBlipMixin) | ||
| end | ||
|
|
||
| elseif Client then | ||
|
|
||
| InitMixin(self, UnitStatusMixin) | ||
| InitMixin(self, HiveVisionMixin) | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| function AlienBeacon:OnGetMapBlipInfo() | ||
| local success = false | ||
| local blipType = kMinimapBlipType.Undefined | ||
| local blipTeam = -1 | ||
| local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat() | ||
| blipType = kMinimapBlipType.Shell | ||
| blipTeam = self:GetTeamNumber() | ||
| if blipType ~= 0 then | ||
| success = true | ||
| end | ||
|
|
||
| return success, blipType, blipTeam, isAttacked, false --isParasited | ||
| end | ||
|
|
||
| function AlienBeacon:GetCanSleep() | ||
| return true | ||
| end | ||
|
|
||
| function AlienBeacon:GetIsWallWalkingAllowed() | ||
| return false | ||
| end | ||
| function AlienBeacon:GetMaturityRate() | ||
| return kCragMaturationTime | ||
| end | ||
|
|
||
| function AlienBeacon:GetMatureMaxHealth() | ||
| return kEggBeaconMaxHealth | ||
| end | ||
|
|
||
| function AlienBeacon:GetMatureMaxArmor() | ||
| return kEggBeaconMaxArmor | ||
| end | ||
| function AlienBeacon:GetReceivesStructuralDamage() | ||
| return true | ||
| end | ||
| function AlienBeacon:GetIsSmallTarget() | ||
| return true | ||
| end | ||
| function AlienBeacon:GetHealthbarOffset() | ||
| return 0.45 | ||
| end | ||
|
|
||
|
|
||
| Shared.LinkClassToMap("AlienBeacon", AlienBeacon.kMapName, networkVars) | ||
|
|
||
|
|
||
|
|
||
|
|
||
| class 'EggBeacon' (AlienBeacon) | ||
|
|
||
| EggBeacon.kMapName = "eggbeacon" | ||
|
|
||
|
|
||
| EggBeacon.kModelName = PrecacheAsset("models/alien/shell/shell.model") | ||
| local kAnimationGraph = PrecacheAsset("models/alien/shell/shell.animation_graph") | ||
|
|
||
| function EggBeacon:OnInitialized() | ||
| AlienBeacon.OnInitialized(self) | ||
| self:SetModel(EggBeacon.kModelName, kAnimationGraph) | ||
| end | ||
|
|
||
|
|
||
| local kLifeSpan = 8 | ||
|
|
||
| local networkVars = { } | ||
|
|
||
| local function TimeUp(self) | ||
|
|
||
| self:Kill() | ||
| return false | ||
|
|
||
| end | ||
|
|
||
| function EggBeacon:OnGetMapBlipInfo() | ||
| local success = false | ||
| local blipType = kMinimapBlipType.Undefined | ||
| local blipTeam = -1 | ||
| local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat() | ||
| blipType = kMinimapBlipType.Shell | ||
| blipTeam = self:GetTeamNumber() | ||
| if blipType ~= 0 then | ||
| success = true | ||
| end | ||
|
|
||
| return success, blipType, blipTeam, isAttacked, false --isParasited | ||
| end | ||
| if Server then | ||
| function EggBeacon:OnKill(attacker, doer, point, direction) | ||
|
|
||
| ScriptActor.OnKill(self, attacker, doer, point, direction) | ||
| self:TriggerEffects("death") | ||
| DestroyEntity(self) | ||
| end | ||
|
|
||
| function EggBeacon:OnDestroy() | ||
| ScriptActor.OnDestroy(self) | ||
| end | ||
| function EggBeacon:GetTotalConstructionTime() | ||
| local value = kEggBeaconBuildTime | ||
| return value | ||
| end | ||
|
|
||
|
|
||
| function EggBeacon:OnConstructionComplete() | ||
| self:AddTimedCallback(TimeUp, kLifeSpan) | ||
| self:DoYourBusiness() | ||
| self:AddTimedCallback(EggBeacon.DoYourBusiness, 1) | ||
|
|
||
| end | ||
| function EggBeacon:DoYourBusiness() | ||
| -- Print("DoYourBusiness") | ||
| if not self:GetIsAlive() then return false end | ||
| local egg = GetEntitiesForTeam( "Egg", 2 ) | ||
| local count = table.count(egg) or 0 | ||
| for i = 1, #egg do | ||
| local actualegg = egg[i] | ||
| local distance = self:GetDistance(actualegg) | ||
| if distance >=8 then | ||
| if HasMixin(actualegg, "Obstacle") then actualegg:RemoveFromMesh()end | ||
| actualegg:SetOrigin(FindFreeSpace(self:GetOrigin(), 1, 8)) | ||
| actualegg:SetHive(self) | ||
| if HasMixin(actualegg, "Obstacle") then | ||
| if actualegg.obstacleId == -1 then actualegg:AddToMesh() end | ||
| end | ||
|
|
||
| return self:GetIsAlive() | ||
| end | ||
|
|
||
| end | ||
| local spawnpoint = FindFreeSpace(self:GetOrigin(), .5, 7) | ||
| if spawnpoint and count < 16 then | ||
| local eggy = CreateEntity(Egg.kMapName, spawnpoint, 2) | ||
| -- egg:AddTimedCallback(function() DestroyEntity(egg) end, 30) | ||
| eggy:SetHive(self) | ||
| end | ||
|
|
||
| return self:GetIsAlive() | ||
| end | ||
|
|
||
| end //ofserver | ||
|
|
||
|
|
||
| function EggBeacon:GetCanBeUsed(player, useSuccessTable) | ||
| useSuccessTable.useSuccess = false | ||
| end | ||
|
|
||
| function EggBeacon:OverrideHintString(hintString) | ||
|
|
||
| if self:GetIsUpgrading() then | ||
| return "COMM_SEL_UPGRADING" | ||
| end | ||
|
|
||
| return hintString | ||
|
|
||
| end | ||
| Shared.LinkClassToMap("EggBeacon", EggBeacon.kMapName, networkVars) |
| @@ -0,0 +1,339 @@ | ||
| -- ======= Copyright (c) 2003-2011, Unknown Worlds Entertainment, Inc. All rights reserved. ======= | ||
| -- | ||
| -- lua\Weapons\Flamethrower_Client.lua | ||
| -- | ||
| -- Created by: Charlie Cleveland (charlie@unknownworlds.com) | ||
| -- | ||
| -- ========= For more information, visit us at http:--www.unknownworlds.com ===================== | ||
|
|
||
| local kTrailLength = 9.5 | ||
| local kImpactEffectRate = 0.3 | ||
| local kSmokeEffectRate = 1.5 | ||
| local kPilotEffectRate = 0.3 | ||
|
|
||
| local kFlameImpactCinematic = PrecacheAsset("cinematics/marine/flamethrower/flame_impact3.cinematic") | ||
| local kFlameSmokeCinematic = PrecacheAsset("cinematics/marine/flamethrower/flame_trail_light.cinematic") | ||
| local kPilotCinematicName = PrecacheAsset("cinematics/marine/flamethrower/pilot.cinematic") | ||
|
|
||
| local kFirstPersonTrailCinematics = | ||
| { | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part1.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part3.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_1p_part3.cinematic"), | ||
| } | ||
|
|
||
| local kTrailCinematics = | ||
| { | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part1.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part3.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_trail_part3.cinematic"), | ||
| } | ||
|
|
||
| local kFadeOutCinematicNames = | ||
| { | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part1.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part2.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part3.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part3.cinematic"), | ||
| PrecacheAsset("cinematics/marine/flamethrower/flame_residue_1p_part3.cinematic"), | ||
| } | ||
|
|
||
| local function UpdateSound(self) | ||
|
|
||
| -- Only update when held in inventory | ||
| if self.loopingSoundEntId ~= Entity.invalidId and self:GetParent() ~= nil then | ||
|
|
||
| local player = Client.GetLocalPlayer() | ||
| local viewAngles = player:GetViewAngles() | ||
| local yaw = viewAngles.yaw | ||
|
|
||
| local soundEnt = Shared.GetEntity(self.loopingSoundEntId) | ||
| if soundEnt then | ||
|
|
||
| if soundEnt:GetIsPlaying() and self.lastYaw ~= nil then | ||
|
|
||
| -- 180 degree rotation = param of 1 | ||
| local rotateParam = math.abs((yaw - self.lastYaw) / math.pi) | ||
|
|
||
| -- Use the maximum rotation we've set in the past short interval | ||
| if not self.maxRotate or (rotateParam > self.maxRotate) then | ||
|
|
||
| self.maxRotate = rotateParam | ||
| self.timeOfMaxRotate = Shared.GetTime() | ||
|
|
||
| end | ||
|
|
||
| if self.timeOfMaxRotate ~= nil and Shared.GetTime() > self.timeOfMaxRotate + .75 then | ||
|
|
||
| self.maxRotate = nil | ||
| self.timeOfMaxRotate = nil | ||
|
|
||
| end | ||
|
|
||
| if self.maxRotate ~= nil then | ||
| rotateParam = math.max(rotateParam, self.maxRotate) | ||
| end | ||
|
|
||
| soundEnt:SetParameter("rotate", rotateParam, 1) | ||
|
|
||
| end | ||
|
|
||
| else | ||
| //Print("Flamethrower:OnUpdate(): Couldn't find sound ent on client") | ||
| end | ||
|
|
||
| self.lastYaw = yaw | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| function ExoFlamer:OnUpdate(deltaTime) | ||
|
|
||
| Entity.OnUpdate(self, deltaTime) | ||
|
|
||
| UpdateSound(self) | ||
|
|
||
| end | ||
|
|
||
| function ExoFlamer:ProcessMoveOnWeapon(input) | ||
|
|
||
| Entity.ProcessMoveOnWeapon(self, input) | ||
|
|
||
| UpdateSound(self) | ||
|
|
||
| end | ||
|
|
||
| function ExoFlamer:OnProcessSpectate(deltaTime) | ||
|
|
||
| Entity.OnProcessSpectate(self, deltaTime) | ||
|
|
||
| UpdateSound(self) | ||
|
|
||
| end | ||
|
|
||
| function UpdatePilotEffect(self, visible) | ||
|
|
||
| if visible then | ||
|
|
||
| if not self.pilotCinematic then | ||
|
|
||
| self.pilotCinematic = Client.CreateCinematic(RenderScene.Zone_ViewModel) | ||
| self.pilotCinematic:SetCinematic(kPilotCinematicName) | ||
| self.pilotCinematic:SetRepeatStyle(Cinematic.Repeat_Endless) | ||
|
|
||
| end | ||
|
|
||
| local viewModelEnt = self:GetParent():GetViewModelEntity() | ||
| local renderModel = viewModelEnt and viewModelEnt:GetRenderModel() | ||
|
|
||
| if renderModel then | ||
|
|
||
| local attachPointIndex = viewModelEnt:GetAttachPointIndex("fxnode_rrailgunmuzzle") | ||
|
|
||
| if attachPointIndex >= 0 then | ||
|
|
||
| local attachCoords = viewModelEnt:GetAttachPointCoords("fxnode_rrailgunmuzzle") | ||
| self.pilotCinematic:SetCoords(attachCoords) | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| else | ||
|
|
||
| if self.pilotCinematic then | ||
| Client.DestroyCinematic(self.pilotCinematic) | ||
| self.pilotCinematic = nil | ||
| end | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
|
|
||
| local kEffectType = enum({'FirstPerson', 'ThirdPerson', 'None'}) | ||
|
|
||
| function ExoFlamer:OnUpdateRender() | ||
| -- Entity.OnUpdateRender(self) | ||
| local parent = self:GetParent() | ||
| local localPlayer = Client.GetLocalPlayer() | ||
|
|
||
| if parent and parent:GetIsLocalPlayer() then | ||
| local viewModel = parent:GetViewModelEntity() | ||
| if viewModel and viewModel:GetRenderModel() then | ||
| viewModel:InstanceMaterials() | ||
| viewModel:GetRenderModel():SetMaterialParameter("heatAmount" .. self:GetExoWeaponSlotName(), self.heatAmount) | ||
| end | ||
| local heatDisplayUI = self.heatDisplayUI | ||
| if not heatDisplayUI then | ||
| heatDisplayUI = Client.CreateGUIView(242, 720) | ||
| heatDisplayUI:Load("lua/ModularExo_GUI" .. self:GetExoWeaponSlotName():gsub("^%l", string.upper) .. "FlamerDisplay.lua") | ||
| heatDisplayUI:SetTargetTexture("*exo_railgun_" .. self:GetExoWeaponSlotName()) | ||
| self.heatDisplayUI = heatDisplayUI | ||
| end | ||
| heatDisplayUI:SetGlobal("heatAmount" .. self:GetExoWeaponSlotName(), self.heatAmount) | ||
| else | ||
| if self.heatDisplayUI then | ||
| Client.DestroyGUIView(self.heatDisplayUI) | ||
| self.heatDisplayUI = nil | ||
| end | ||
| end | ||
|
|
||
| local effectToLoad = (parent ~= nil and localPlayer ~= nil and parent == localPlayer and localPlayer:GetIsFirstPerson()) and kEffectType.FirstPerson or kEffectType.ThirdPerson | ||
| if self.effectLoaded ~= effectToLoad then | ||
| if self.trailCinematic then | ||
| Client.DestroyTrailCinematic(self.trailCinematic) | ||
| self.trailCinematic = nil | ||
| end | ||
| if effectToLoad ~= kEffectType.None then | ||
| self:InitTrailCinematic(effectToLoad, parent) | ||
| end | ||
| self.effectLoaded = effectToLoad | ||
| end | ||
| if self.trailCinematic then | ||
| self.trailCinematic:SetIsVisible(self.createParticleEffects == true) | ||
| if self.createParticleEffects then | ||
| self:CreateImpactEffect(self:GetParent()) | ||
| end | ||
| end | ||
| -- UpdatePilotEffect(self, effectToLoad == kEffectType.FirstPerson and self.clip > 0 and self:GetIsActive()) | ||
| end | ||
|
|
||
| function ExoFlamer:InitTrailCinematic(effectType, player) | ||
|
|
||
| self.trailCinematic = Client.CreateTrailCinematic(RenderScene.Zone_Default) | ||
|
|
||
| local minHardeningValue = 0.5 | ||
| local numFlameSegments = 30 | ||
|
|
||
| if effectType == kEffectType.FirstPerson then | ||
|
|
||
| self.trailCinematic:SetCinematicNames(kFirstPersonTrailCinematics) | ||
| -- set an attach function which returns the player view coords if we are the local player | ||
|
|
||
| if self:GetIsRightSlot() then | ||
| self.trailCinematic:AttachToFunc(self, TRAIL_ALIGN_Z, Vector(-0.85, -0.19, 0.9), | ||
| function (attachedEntity, deltaTime) | ||
| local player = attachedEntity:GetParent() | ||
| return player ~= nil and player:GetViewCoords() | ||
| end | ||
| ) | ||
|
|
||
| elseif self:GetIsLeftSlot() then | ||
| self.trailCinematic:AttachToFunc(self, TRAIL_ALIGN_Z, Vector(0.85, -0.19, 0.9), | ||
| function (attachedEntity, deltaTime) | ||
| local player = attachedEntity:GetParent() | ||
| return player ~= nil and player:GetViewCoords() | ||
| end | ||
| ) | ||
| end | ||
|
|
||
| elseif effectType == kEffectType.ThirdPerson then | ||
|
|
||
| self.trailCinematic:SetCinematicNames(kTrailCinematics) | ||
|
|
||
| if self:GetIsLeftSlot() then | ||
|
|
||
| -- attach to third person fx node otherwise with an X offset since we align it along the X-Axis (the attackpoint is oriented in the model like that) | ||
| self.trailCinematic:AttachTo(player, TRAIL_ALIGN_X, Vector(0.8, 0, 0), player:GetAttachPointIndex("fxnode_lrailgunmuzzle")) | ||
| minHardeningValue = 0.1 | ||
| numFlameSegments = 8 | ||
|
|
||
| elseif self:GetIsRightSlot() then | ||
|
|
||
| -- attach to third person fx node otherwise with an X offset since we align it along the X-Axis (the attackpoint is oriented in the model like that) | ||
| self.trailCinematic:AttachTo(player, TRAIL_ALIGN_X, Vector(0.8, 0, 0), player:GetAttachPointIndex("fxnode_rrailgunmuzzle")) | ||
| minHardeningValue = 0.1 | ||
| numFlameSegments = 8 | ||
| end | ||
|
|
||
| end | ||
|
|
||
| self.trailCinematic:SetFadeOutCinematicNames(kFadeOutCinematicNames) | ||
| self.trailCinematic:SetIsVisible(false) | ||
| self.trailCinematic:SetRepeatStyle(Cinematic.Repeat_Endless) | ||
| self.trailCinematic:SetOptions( { | ||
| numSegments = numFlameSegments, | ||
| collidesWithWorld = true, | ||
| visibilityChangeDuration = 0.2, | ||
| fadeOutCinematics = true, | ||
| stretchTrail = false, | ||
| trailLength = kTrailLength, | ||
| minHardening = minHardeningValue, | ||
| maxHardening = 2, | ||
| hardeningModifier = 0.8, | ||
| trailWeight = 0.2 | ||
| } ) | ||
|
|
||
| end | ||
|
|
||
| function ExoFlamer:CreateImpactEffect(player) | ||
|
|
||
| if (not self.timeLastImpactEffect or self.timeLastImpactEffect + kImpactEffectRate < Shared.GetTime()) and player then | ||
|
|
||
| self.timeLastImpactEffect = Shared.GetTime() | ||
|
|
||
| local viewAngles = player:GetViewAngles() | ||
| local viewCoords = viewAngles:GetCoords() | ||
|
|
||
| viewCoords.origin = self:GetBarrelPoint(player) + viewCoords.zAxis * (-0.4) + viewCoords.xAxis * (-0.2) | ||
| local endPoint = self:GetBarrelPoint(player) + viewCoords.xAxis * (-0.2) + viewCoords.yAxis * (-0.3) + viewCoords.zAxis * self:GetRange() | ||
|
|
||
| local trace = Shared.TraceRay(viewCoords.origin, endPoint, CollisionRep.Default, PhysicsMask.Flame, EntityFilterAll()) | ||
|
|
||
| local range = (trace.endPoint - viewCoords.origin):GetLength() | ||
| if range < 0 then | ||
| range = range * (-1) | ||
| end | ||
|
|
||
| if trace.endPoint ~= endPoint and trace.entity == nil then | ||
|
|
||
| local angles = Angles(0,0,0) | ||
| angles.yaw = GetYawFromVector(trace.normal) | ||
| angles.pitch = GetPitchFromVector(trace.normal) + (math.pi/2) | ||
|
|
||
| local normalCoords = angles:GetCoords() | ||
| normalCoords.origin = trace.endPoint | ||
|
|
||
| Shared.CreateEffect(nil, kFlameImpactCinematic, nil, normalCoords) | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| end | ||
|
|
||
| --[[ disabled, causes bad performance | ||
| function ExoFlamer:CreateSmokeEffect(player) | ||
| if not self.timeLastLightningEffect or self.timeLastLightningEffect + kSmokeEffectRate < Shared.GetTime() then | ||
| self.timeLastLightningEffect = Shared.GetTime() | ||
| local viewAngles = player:GetViewAngles() | ||
| local viewCoords = viewAngles:GetCoords() | ||
| viewCoords.origin = self:GetBarrelPoint(player) + viewCoords.zAxis * 1 + viewCoords.xAxis * (-0.4) + viewCoords.yAxis * (-0.3) | ||
| local cinematic = kFlameSmokeCinematic | ||
| local effect = Client.CreateCinematic(RenderScene.Zone_Default) | ||
| effect:SetCinematic(cinematic) | ||
| effect:SetCoords(viewCoords) | ||
| end | ||
| end | ||
| ]] | ||
|
|
||
|
|
| @@ -0,0 +1,65 @@ | ||
| --Kyle 'Avoca' Abent | ||
| LevelsMixin = CreateMixin(LevelsMixin) | ||
| LevelsMixin.type = "Levels" | ||
|
|
||
|
|
||
| LevelsMixin.networkVars = | ||
| { | ||
| level = "float (0 to " .. 100 .. " by .1)", | ||
| } | ||
|
|
||
| LevelsMixin.expectedMixins = | ||
| { | ||
| } | ||
|
|
||
| LevelsMixin.expectedCallbacks = | ||
| { | ||
| GetMaxLevel = "", | ||
| GetAddXPAmount = "", | ||
| } | ||
| function LevelsMixin:__initmixin() | ||
|
|
||
| self.level = 0 | ||
|
|
||
| end | ||
| function LevelsMixin:GetMaxLevel() | ||
| return 50 | ||
| end | ||
| function LevelsMixin:GetAddXPAmount() | ||
| return 0.25 | ||
| end | ||
|
|
||
| function LevelsMixin:GetUnitNameOverride(viewer) | ||
| local unitName = GetDisplayName(self) | ||
| unitName = string.format(Locale.ResolveString("%s (%s)"),self:GetClassName(), self:GetLevel()) | ||
| return unitName | ||
| end | ||
|
|
||
| function LevelsMixin:OnHealSpray(gorge) | ||
| local oldlevel = self.level | ||
| self:AddXP(self:GetAddXPAmount()) --missing score for player | ||
| if oldlevel ~= self.level then gorge:AddScore(0.05) end --hm? | ||
| end | ||
|
|
||
| function LevelsMixin:AddXP(amount) | ||
| --Print("add xp triggered") | ||
| if self.OnAddXp then self:OnAddXp(amount) end | ||
| if self.GetIsBuilt and not self:GetIsBuilt() then return end | ||
| local xpReward = 0 | ||
| xpReward = math.min(amount, self:GetMaxLevel() - self.level) | ||
| self.level = self.level + xpReward | ||
|
|
||
| if self:GetTeamNumber() == 1 then | ||
| if Server then | ||
| local defaultarmor = LookupTechData(self:GetTechId(), kTechDataMaxArmor) or 200 | ||
| self:AdjustMaxArmor(defaultarmor * (self.level/100) + defaultarmor) | ||
| end | ||
| end | ||
|
|
||
| return xpReward | ||
|
|
||
| end | ||
| function LevelsMixin:GetLevel() | ||
| return Round(self.level, 2) | ||
| end | ||
|
|
| @@ -0,0 +1,99 @@ | ||
| --Kyle 'Avoca' Abent | ||
|
|
||
| class 'StructureBeacon' (AlienBeacon) | ||
|
|
||
| StructureBeacon.kModelName = PrecacheAsset("models/alien/spur/spur.model") | ||
| local kAnimationGraph = PrecacheAsset("models/alien/spur/spur.animation_graph") | ||
|
|
||
| StructureBeacon.kMapName = "structurebeacon" | ||
|
|
||
| function StructureBeacon:OnInitialized() | ||
| AlienBeacon.OnInitialized(self) | ||
| self:SetModel(StructureBeacon.kModelName, kAnimationGraph) | ||
| end | ||
| local kLifeSpan = 8 | ||
|
|
||
| local networkVars = { } | ||
|
|
||
| local function TimeUp(self) | ||
|
|
||
| --self:Kill() | ||
| DestroyEntity(self) | ||
| return false | ||
|
|
||
| end | ||
| local function GetIsACreditStructure(who) | ||
| local boolean = HasMixin(who, "Avoca") and who:GetIsACreditStructure() or false | ||
| --Print("isacredit structure is %s", boolean) | ||
| return boolean | ||
|
|
||
| end | ||
| function StructureBeacon:GetTotalConstructionTime() | ||
| local value = kStructureBeaconBuildTime | ||
| return value | ||
| end | ||
| function StructureBeacon:OnGetMapBlipInfo() | ||
| local success = false | ||
| local blipType = kMinimapBlipType.Undefined | ||
| local blipTeam = -1 | ||
| local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat() | ||
| blipType = kMinimapBlipType.Spur | ||
| blipTeam = self:GetTeamNumber() | ||
| if blipType ~= 0 then | ||
| success = true | ||
| end | ||
|
|
||
| return success, blipType, blipTeam, isAttacked, false --isParasited | ||
| end | ||
| local function GetIsStructureSiegeWall(self, structure) | ||
| if structure:isa("Whip") then return false end | ||
| local hives = GetEntitiesWithinRange("Hive", structure:GetOrigin(), 17) | ||
|
|
||
| if #hives >=1 then return true end | ||
| return false | ||
|
|
||
| end | ||
| if Server then | ||
|
|
||
| function StructureBeacon:OnConstructionComplete() | ||
| if math.random(1,100) >= 85 then | ||
| if Server then CreateEntity(Contamination.kMapName, FindFreeSpace(self:GetOrigin()), 2) end | ||
| end | ||
| self:AddTimedCallback(TimeUp, kLifeSpan ) | ||
| self:Magnetize() | ||
| self:AddTimedCallback(StructureBeacon.Magnetize, 1) | ||
| end | ||
| function StructureBeacon:Magnetize() | ||
| local eligable = {} | ||
| local entity = GetEntitiesWithMixinForTeam( "Supply", 2 ) | ||
|
|
||
| for i = 1, #entity do | ||
| local structure = entity[i] | ||
| local distance = self:GetDistance(structure) | ||
| local restrictions = distance >= 8 and not structure:isa("Shell") and not structure:isa("Veil") and not structure:isa("Spur") and not structure:isa("Drifter") and not structure:isa("DrifterEgg") and not ( structure.GetIsMoving and structure:GetIsMoving() ) and not GetIsACreditStructure(structure) and structure:GetIsBuilt() and not GetIsStructureSiegeWall(self, structure) | ||
| if restrictions and self:GetIsAlive() then | ||
|
|
||
| local success = false | ||
| if distance >= 16 then | ||
| if HasMixin(entity, "Obstacle") then entity:RemoveFromMesh()end | ||
| success = structure:SetOrigin( FindFreeSpace(self:GetOrigin(), .5, 7 ) ) | ||
| if HasMixin(structure, "Obstacle") then | ||
| if structure.obstacleId == -1 then structure:AddToMesh() end | ||
| end | ||
| if success then return self:GetIsAlive() end | ||
| end | ||
|
|
||
| -- structure:ClearOrders() | ||
| -- success = structure:GiveOrder(kTechId.Move, self:GetId(), FindFreeSpace(self:GetOrigin(), .5, 7), nil, true, true) | ||
| -- if success then return self:GetIsAlive() end | ||
|
|
||
| end | ||
| end | ||
| return self:GetIsAlive() | ||
| end | ||
|
|
||
| function StructureBeacon:OnDestroy() | ||
| ScriptActor.OnDestroy(self) | ||
| end | ||
| end // | ||
| Shared.LinkClassToMap("StructureBeacon", StructureBeacon.kMapName, networkVars) |
| @@ -0,0 +1,50 @@ | ||
| local kLifeSpan = 4 | ||
|
|
||
| class 'StunWall' (BoneWall) | ||
| StunWall.kMapName = "stunwall" | ||
|
|
||
| function StunWall:OnInitialized() | ||
| BoneWall.OnInitialized(self) | ||
|
|
||
| local function GetLifeSpan(self) | ||
| return kBonewallLifeSpan | ||
| end | ||
| local function TimeUp(self) | ||
| self:Kill() | ||
| return false | ||
| end | ||
| if Server then | ||
| self:AddTimedCallback( TimeUp, GetLifeSpan(self) ) | ||
| self:AdjustMaxHealth(self:GetMaxHealth() / 2) | ||
| end | ||
|
|
||
| end | ||
|
|
||
| function StunWall:GetLifeSpan() | ||
| return kLifeSpan | ||
| end | ||
| function StunWall:OnAdjustModelCoords(modelCoords) | ||
| local coords = modelCoords | ||
| local scale = .5 | ||
| local y = 0.7 | ||
| coords.xAxis = coords.xAxis * scale | ||
| coords.yAxis = coords.yAxis * y | ||
| coords.zAxis = coords.zAxis * scale | ||
| return coords | ||
| end | ||
|
|
||
| function StunWall:OnGetMapBlipInfo() | ||
| local success = false | ||
| local blipType = kMinimapBlipType.Undefined | ||
| local blipTeam = -1 | ||
| local isAttacked = HasMixin(self, "Combat") and self:GetIsInCombat() | ||
| blipType = kMinimapBlipType.BoneWall | ||
| blipTeam = self:GetTeamNumber() | ||
| if blipType ~= 0 then | ||
| success = true | ||
| end | ||
|
|
||
| return success, blipType, blipTeam, isAttacked, false --isParasited | ||
| end | ||
|
|
||
| Shared.LinkClassToMap("StunWall", StunWall.kMapName, networkVars) |
| @@ -0,0 +1,286 @@ | ||
|
|
||
| local orig_Alien_OnCreate = Alien.OnCreate | ||
| function Alien:OnCreate() | ||
| orig_Alien_OnCreate(self) | ||
|
|
||
| if Server then | ||
| self:AddTimedCallback(function() UpdateAvocaAvailability(self, self:GetTierOneTechId(), self:GetTierTwoTechId(), self:GetTierThreeTechId()) end, .8) | ||
| end | ||
|
|
||
| end | ||
|
|
||
| if Server then | ||
|
|
||
|
|
||
| function Alien:CreditBuy(techId) | ||
| local cost = LookupTechData(techId, kTechDataCostKey, 0) | ||
| self:AddResources(cost) | ||
| local upgradetable = {} | ||
| local upgrades = Player.lastUpgradeList | ||
| if upgrades and #upgrades > 0 then | ||
| table.insert(upgradetable, upgrades) | ||
| end | ||
|
|
||
| table.insert(upgradetable, techId) | ||
| self:ProcessBuyAction(upgradetable, true) | ||
| self:AddResources(cost) | ||
| end | ||
|
|
||
|
|
||
|
|
||
|
|
||
| function Alien:HiveCompleteSoRefreshTechsManually() | ||
| UpdateAvocaAvailability(self, self:GetTierOneTechId(), self:GetTierTwoTechId(), self:GetTierThreeTechId()) | ||
| end | ||
|
|
||
|
|
||
| end | ||
|
|
||
| function Alien:GetHasLayStructure() | ||
| local weapon = self:GetWeaponInHUDSlot(5) | ||
| local builder = false | ||
| if (weapon) then | ||
| builder = true | ||
| end | ||
|
|
||
| return builder | ||
| end | ||
| function Alien:GiveLayStructure(techid, mapname) | ||
| -- if not self:GetHasLayStructure() then | ||
| local laystructure = self:GiveItem(LayStructures.kMapName) | ||
| self:SetActiveWeapon(LayStructures.kMapName) | ||
| laystructure:SetTechId(techid) | ||
| laystructure:SetMapName(mapname) | ||
| -- else | ||
| -- self:TellMarine(self) | ||
| -- end | ||
| end | ||
|
|
||
|
|
||
|
|
||
| function Alien:TriggerXenocide() | ||
|
|
||
| local weapon = skulk:GetActiveWeapon() | ||
| local xeno = self:GetWeaponInHUDSlot(3) | ||
|
|
||
| if not xeno then | ||
| self:GiveItem(XenocideLeap.kMapName) | ||
| end | ||
|
|
||
| if not weapon:isa("XenocideLeap") then | ||
| skulk:SetActiveWeapon(XenocideLeap.kMapName) | ||
| end | ||
|
|
||
| weapon = skulk:GetActiveWeapon() | ||
| if weapon:isa("XenocideLeap") then | ||
| weapon.xenociding = true | ||
| self.xenocideTimeLeft = 0 | ||
| end | ||
|
|
||
|
|
||
|
|
||
| /* | ||
| local player = self | ||
|
|
||
| player:TriggerEffects("xenocide", {effecthostcoords = Coords.GetTranslation(player:GetOrigin())}) | ||
|
|
||
| local hitEntities = GetEntitiesWithMixinWithinRange("Live", player:GetOrigin(), kXenocideRange) | ||
| RadiusDamage(hitEntities, player:GetOrigin(), kXenocideRange, kXenocideDamage, self) -- May error | ||
|
|
||
| player.spawnReductionTime = 4 | ||
|
|
||
| player:SetBypassRagdoll(true) | ||
|
|
||
| player:Kill() | ||
|
|
||
| if self.XenocideSoundName then | ||
| self.XenocideSoundName:Stop() | ||
| self.XenocideSoundName = nil | ||
| end | ||
|
|
||
| */ | ||
| end | ||
|
|
||
| local function GetRelocationHive(usedhive, origin, teamnumber) | ||
| local hives = GetEntitiesForTeam("Hive", teamnumber) | ||
| local selectedhive | ||
|
|
||
| for i, hive in ipairs(hives) do | ||
| selectedhive = hive | ||
| end | ||
| return selectedhive | ||
| end | ||
|
|
||
| function Alien:TeleportToHive(usedhive) | ||
| local selectedhive = GetRelocationHive(usedhive, self:GetOrigin(), self:GetTeamNumber()) | ||
| local success = false | ||
| if selectedhive then | ||
| local position = table.random(selectedhive.eggSpawnPoints) | ||
| SpawnPlayerAtPoint(self, position) | ||
| // Shared.Message("LOG - %s SuccessFully Redeemed", self:GetClient():GetControllingPlayer():GetUserId() ) | ||
| success = true | ||
| end | ||
|
|
||
| end | ||
|
|
||
| function Alien:TriggerRebirth() | ||
|
|
||
|
|
||
| local position = self:GetOrigin() | ||
| local trace = Shared.TraceRay(position, position + Vector(0, -0.5, 0), CollisionRep.Move, PhysicsMask.AllButPCs, EntityFilterOne(self)) | ||
|
|
||
| // Check for room | ||
| local eggExtents = LookupTechData(kTechId.Embryo, kTechDataMaxExtents) | ||
| local newLifeFormTechId = self:GetTechId() /// :P | ||
| local upgradeManager = AlienUpgradeManager() | ||
| upgradeManager:Populate(self) | ||
| upgradeManager:AddUpgrade(lifeFormTechId) | ||
| local newAlienExtents = LookupTechData(newLifeFormTechId, kTechDataMaxExtents) | ||
| local physicsMask = PhysicsMask.Evolve | ||
|
|
||
| -- Add a bit to the extents when looking for a clear space to spawn. | ||
| local spawnBufferExtents = Vector(0.1, 0.1, 0.1) | ||
|
|
||
| local evolveAllowed = self:GetIsOnGround() and GetHasRoomForCapsule(eggExtents + spawnBufferExtents, position + Vector(0, eggExtents.y + Embryo.kEvolveSpawnOffset, 0), CollisionRep.Default, physicsMask, self) | ||
|
|
||
| local roomAfter | ||
| local spawnPoint | ||
|
|
||
| // If not on the ground for the buy action, attempt to automatically | ||
| // put the player on the ground in an area with enough room for the new Alien. | ||
| if not evolveAllowed then | ||
|
|
||
| for index = 1, 100 do | ||
|
|
||
| spawnPoint = GetRandomSpawnForCapsule(eggExtents.y, math.max(eggExtents.x, eggExtents.z), self:GetModelOrigin(), 0.5, 5, EntityFilterOne(self)) | ||
|
|
||
| if spawnPoint then | ||
| self:SetOrigin(spawnPoint) | ||
| position = spawnPoint | ||
| break | ||
| end | ||
|
|
||
| end | ||
| end | ||
|
|
||
| if not GetHasRoomForCapsule(newAlienExtents + spawnBufferExtents, self:GetOrigin() + Vector(0, newAlienExtents.y + Embryo.kEvolveSpawnOffset, 0), CollisionRep.Default, PhysicsMask.AllButPCsAndRagdolls, nil, EntityFilterOne(self)) then | ||
|
|
||
| for index = 1, 100 do | ||
|
|
||
| roomAfter = GetRandomSpawnForCapsule(newAlienExtents.y, math.max(newAlienExtents.x, newAlienExtents.z), self:GetModelOrigin(), 0.5, 5, EntityFilterOne(self)) | ||
|
|
||
| if roomAfter then | ||
| evolveAllowed = true | ||
| break | ||
| end | ||
|
|
||
| end | ||
|
|
||
| else | ||
| roomAfter = position | ||
| evolveAllowed = true | ||
| end | ||
|
|
||
| if evolveAllowed and roomAfter ~= nil then | ||
|
|
||
| local newPlayer = self:Replace(Embryo.kMapName) | ||
| position.y = position.y + Embryo.kEvolveSpawnOffset | ||
| newPlayer:SetOrigin(position) | ||
| // Clear angles, in case we were wall-walking or doing some crazy alien thing | ||
| local angles = Angles(self:GetViewAngles()) | ||
| angles.roll = 0.0 | ||
| angles.pitch = 0.0 | ||
| newPlayer:SetOriginalAngles(angles) | ||
| newPlayer:SetValidSpawnPoint(roomAfter) | ||
|
|
||
| // Eliminate velocity so that we don't slide or jump as an egg | ||
| newPlayer:SetVelocity(Vector(0, 0, 0)) | ||
| newPlayer:DropToFloor() | ||
| newPlayer:TriggerRebirthCountDown(newPlayer:GetClient():GetControllingPlayer()) | ||
| newPlayer:SetGestationData(upgradeManager:GetUpgrades(), newLifeFormTechId, 10, 10) //Skulk to X | ||
| newPlayer.gestationTime = self:GetRebirthLength() | ||
| newPlayer.lastrebirthtime = Shared.GetTime() | ||
| newPlayer.triggeredrebirth = true | ||
| //Spawn protective boneshield | ||
| success = true | ||
| else | ||
| self:TeleportToHive() | ||
| end | ||
| end | ||
| if Client then | ||
| local orig_Alien_UpdateClientEffects = Alien.UpdateClientEffects | ||
| function Alien:UpdateClientEffects(deltaTime, isLocal) | ||
| orig_Alien_UpdateClientEffects(self, deltaTime, isLocal) | ||
| self:UpdateGhostModel() | ||
| end | ||
| --local orig_Alien_UpdateGhostModel = Alien.UpdateGhostModel | ||
| function Alien:UpdateGhostModel() | ||
| --orig_Alien_UpdateGhostModel(self) | ||
| self.currentTechId = nil | ||
| self.ghostStructureCoords = nil | ||
| self.ghostStructureValid = false | ||
| self.showGhostModel = false | ||
| local weapon = self:GetActiveWeapon() | ||
| if weapon then | ||
| if weapon:isa("LayStructures") then | ||
| self.currentTechId = weapon:GetDropStructureId() | ||
| self.ghostStructureCoords = weapon:GetGhostModelCoords() | ||
| self.ghostStructureValid = weapon:GetIsPlacementValid() | ||
| self.showGhostModel = weapon:GetShowGhostModel() | ||
| end | ||
| end | ||
| end --function | ||
| function Alien:GetShowGhostModel() | ||
| return self.showGhostModel | ||
| end | ||
| function Alien:GetGhostModelTechId() | ||
| return self.currentTechId | ||
| end | ||
| function Alien:GetGhostModelCoords() | ||
| return self.ghostStructureCoords | ||
| end | ||
| function Alien:GetIsPlacementValid() | ||
| return self.ghostStructureValid | ||
| end | ||
| function Alien:AddGhostGuide(origin, radius) | ||
| return | ||
| end | ||
| end //client |