Resolve Lua language server diagnosed problems.
This commit is contained in:
committed by
abcdefg30
parent
3d0efa1cbe
commit
378f66a1ff
@@ -84,11 +84,11 @@ SendAttackGroup = function()
|
||||
end
|
||||
|
||||
ProduceInfantry = function()
|
||||
if USSRRax.IsDead or USSRRax.Owner ~= ussr then
|
||||
if USSRRax.IsDead or USSRRax.Owner ~= USSR then
|
||||
return
|
||||
end
|
||||
|
||||
ussr.Build({ Utils.Random(SovietInfantry) }, function(units)
|
||||
USSR.Build({ Utils.Random(SovietInfantry) }, function(units)
|
||||
table.insert(AttackGroup, units[1])
|
||||
SendAttackGroup()
|
||||
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceInfantry)
|
||||
@@ -96,11 +96,11 @@ ProduceInfantry = function()
|
||||
end
|
||||
|
||||
ProduceVehicles = function()
|
||||
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= ussr then
|
||||
if USSRWarFactory.IsDead or USSRWarFactory.Owner ~= USSR then
|
||||
return
|
||||
end
|
||||
|
||||
ussr.Build({ Utils.Random(SovietVehicles) }, function(units)
|
||||
USSR.Build({ Utils.Random(SovietVehicles) }, function(units)
|
||||
table.insert(AttackGroup, units[1])
|
||||
SendAttackGroup()
|
||||
Trigger.AfterDelay(ProductionInterval[Difficulty], ProduceVehicles)
|
||||
@@ -108,11 +108,11 @@ ProduceVehicles = function()
|
||||
end
|
||||
|
||||
ProduceAircraft = function()
|
||||
if (Airfield1.IsDead or Airfield1.Owner ~= ussr) and (Airfield2.IsDead or Airfield2.Owner ~= ussr) then
|
||||
if (Airfield1.IsDead or Airfield1.Owner ~= USSR) and (Airfield2.IsDead or Airfield2.Owner ~= USSR) then
|
||||
return
|
||||
end
|
||||
|
||||
ussr.Build(SovietAircraftType, function(units)
|
||||
USSR.Build(SovietAircraftType, function(units)
|
||||
local mig = units[1]
|
||||
Migs[#Migs + 1] = mig
|
||||
|
||||
@@ -123,13 +123,13 @@ ProduceAircraft = function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(ProductionInterval[Difficulty] / 2), ProduceAircraft)
|
||||
end
|
||||
|
||||
InitializeAttackAircraft(mig, greece)
|
||||
InitializeAttackAircraft(mig, Greece)
|
||||
end)
|
||||
end
|
||||
|
||||
GroundWaves = function()
|
||||
local path = Utils.Random(GroundAttackPaths)
|
||||
local units = Reinforcements.Reinforce(ussr, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] })
|
||||
local units = Reinforcements.Reinforce(USSR, Utils.Random(GroundAttackUnits[GroundAttackUnitType]), { path[1] })
|
||||
local lastWaypoint = path[#path]
|
||||
Utils.Do(units, function(unit)
|
||||
Trigger.OnAddedToWorld(unit, function()
|
||||
@@ -146,7 +146,7 @@ end
|
||||
WTransWaves = function()
|
||||
local way = Utils.Random(WTransWays)
|
||||
local units = Utils.Random(WTransUnits)
|
||||
local attackUnits = Reinforcements.ReinforceWithTransport(ussr, "lst", units , way, { way[2], way[1] })[2]
|
||||
local attackUnits = Reinforcements.ReinforceWithTransport(USSR, "lst", units , way, { way[2], way[1] })[2]
|
||||
Utils.Do(attackUnits, function(a)
|
||||
Trigger.OnAddedToWorld(a, function()
|
||||
a.AttackMove(AttackChrono.Location)
|
||||
@@ -169,15 +169,15 @@ end
|
||||
|
||||
SendParabombs = function()
|
||||
local airfield = Airfield1
|
||||
if Airfield1.IsDead or Airfield1.Owner ~= ussr then
|
||||
if Airfield2.IsDead or Airfield2.Owner ~= ussr then
|
||||
if Airfield1.IsDead or Airfield1.Owner ~= USSR then
|
||||
if Airfield2.IsDead or Airfield2.Owner ~= USSR then
|
||||
return
|
||||
end
|
||||
|
||||
airfield = Airfield2
|
||||
end
|
||||
|
||||
local targets = Utils.Where(greece.GetActors(), function(actor)
|
||||
local targets = Utils.Where(Greece.GetActors(), function(actor)
|
||||
return
|
||||
actor.HasProperty("Sell") and
|
||||
actor.Type ~= "brik" and
|
||||
@@ -199,10 +199,10 @@ ActivateAI = function()
|
||||
ParadropDelays = ParadropDelays[Difficulty]
|
||||
BombDelays = BombDelays[Difficulty]
|
||||
|
||||
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == ussr and self.HasProperty("StartBuildingRepairs") end)
|
||||
local buildings = Utils.Where(Map.ActorsInWorld, function(self) return self.Owner == USSR and self.HasProperty("StartBuildingRepairs") end)
|
||||
Utils.Do(buildings, function(actor)
|
||||
Trigger.OnDamaged(actor, function(building)
|
||||
if building.Owner == ussr and building.Health < building.MaxHealth * 3/4 then
|
||||
if building.Owner == USSR and building.Health < building.MaxHealth * 3/4 then
|
||||
building.StartBuildingRepairs()
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -15,33 +15,33 @@ ScientistEvacuationFootprint = { CPos.New(29, 60), CPos.New(29, 61), CPos.New(29
|
||||
|
||||
InitialAlliedReinforcements = function()
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function()
|
||||
Media.PlaySpeechNotification(greece, "ReinforcementsArrived")
|
||||
Reinforcements.Reinforce(greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location })
|
||||
Reinforcements.Reinforce(greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location })
|
||||
Media.PlaySpeechNotification(Greece, "ReinforcementsArrived")
|
||||
Reinforcements.Reinforce(Greece, { "mcv" }, { MCVEntry.Location, MCVStop.Location })
|
||||
Reinforcements.Reinforce(Greece, AlliedBoatReinforcements, { DDEntry.Location, DDStop.Location })
|
||||
end)
|
||||
end
|
||||
|
||||
CreateScientists = function()
|
||||
scientists = Reinforcements.Reinforce(greece, ScientistTypes, { ScientistsExit.Location })
|
||||
local scientists = Reinforcements.Reinforce(Greece, ScientistTypes, { ScientistsExit.Location })
|
||||
Utils.Do(scientists, function(s)
|
||||
s.Move(s.Location + CVec.New(0, 1))
|
||||
s.Scatter()
|
||||
end)
|
||||
|
||||
local flare = Actor.Create("flare", true, { Owner = greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) })
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(player, "SignalFlareNorth") end)
|
||||
local flare = Actor.Create("flare", true, { Owner = Greece, Location = DefaultCameraPosition.Location + CVec.New(-1, 0) })
|
||||
Trigger.AfterDelay(DateTime.Seconds(2), function() Media.PlaySpeechNotification(Greece, "SignalFlareNorth") end)
|
||||
|
||||
Trigger.OnAnyKilled(scientists, function()
|
||||
Media.PlaySpeechNotification(greece, "ObjectiveNotMet")
|
||||
greece.MarkFailedObjective(EvacuateScientists)
|
||||
Media.PlaySpeechNotification(Greece, "ObjectiveNotMet")
|
||||
Greece.MarkFailedObjective(EvacuateScientists)
|
||||
end)
|
||||
|
||||
-- Add the footprint trigger in a frame end task (delay 0) to avoid crashes
|
||||
local left = #scientists
|
||||
Trigger.AfterDelay(0, function()
|
||||
local changeOwnerTrigger = Trigger.OnEnteredFootprint(ScientistEvacuationFootprint, function(a, id)
|
||||
if a.Owner == greece and a.Type == "chan" then
|
||||
a.Owner = germany
|
||||
if a.Owner == Greece and a.Type == "chan" then
|
||||
a.Owner = Germany
|
||||
a.Stop()
|
||||
a.Move(MCVEntry.Location)
|
||||
|
||||
@@ -54,7 +54,7 @@ CreateScientists = function()
|
||||
|
||||
-- Use a cell trigger to destroy the scientists preventing the player from causing glitchs by blocking the path
|
||||
Trigger.OnEnteredFootprint({ MCVEntry.Location }, function(a, id)
|
||||
if a.Owner == germany then
|
||||
if a.Owner == Germany then
|
||||
a.Stop()
|
||||
a.Destroy()
|
||||
|
||||
@@ -64,9 +64,9 @@ CreateScientists = function()
|
||||
Trigger.RemoveFootprintTrigger(changeOwnerTrigger)
|
||||
flare.Destroy()
|
||||
|
||||
if not greece.IsObjectiveCompleted(EvacuateScientists) and not greece.IsObjectiveFailed(EvacuateScientists) then
|
||||
Media.PlaySpeechNotification(greece, "ObjectiveMet")
|
||||
greece.MarkCompletedObjective(EvacuateScientists)
|
||||
if not Greece.IsObjectiveCompleted(EvacuateScientists) and not Greece.IsObjectiveFailed(EvacuateScientists) then
|
||||
Media.PlaySpeechNotification(Greece, "ObjectiveMet")
|
||||
Greece.MarkCompletedObjective(EvacuateScientists)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -78,84 +78,84 @@ DefendChronosphereCompleted = function()
|
||||
local cells = Utils.ExpandFootprint({ ChronoshiftLocation.Location }, false)
|
||||
local units = { }
|
||||
for i = 1, #cells do
|
||||
local unit = Actor.Create("2tnk", true, { Owner = greece, Facing = Angle.North })
|
||||
local unit = Actor.Create("2tnk", true, { Owner = Greece, Facing = Angle.North })
|
||||
units[unit] = cells[i]
|
||||
end
|
||||
Chronosphere.Chronoshift(units)
|
||||
UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), greece.Color)
|
||||
UserInterface.SetMissionText(UserInterface.Translate("experiment-successful"), Greece.Color)
|
||||
|
||||
Trigger.AfterDelay(DateTime.Seconds(3), function()
|
||||
greece.MarkCompletedObjective(DefendChronosphere)
|
||||
greece.MarkCompletedObjective(KeepBasePowered)
|
||||
Greece.MarkCompletedObjective(DefendChronosphere)
|
||||
Greece.MarkCompletedObjective(KeepBasePowered)
|
||||
end)
|
||||
end
|
||||
|
||||
ticked = TimerTicks
|
||||
Ticked = TimerTicks
|
||||
Tick = function()
|
||||
ussr.Cash = 5000
|
||||
USSR.Cash = 5000
|
||||
|
||||
if ussr.HasNoRequiredUnits() then
|
||||
greece.MarkCompletedObjective(DefendChronosphere)
|
||||
greece.MarkCompletedObjective(KeepBasePowered)
|
||||
if USSR.HasNoRequiredUnits() then
|
||||
Greece.MarkCompletedObjective(DefendChronosphere)
|
||||
Greece.MarkCompletedObjective(KeepBasePowered)
|
||||
end
|
||||
|
||||
if greece.HasNoRequiredUnits() then
|
||||
ussr.MarkCompletedObjective(BeatAllies)
|
||||
if Greece.HasNoRequiredUnits() then
|
||||
USSR.MarkCompletedObjective(BeatAllies)
|
||||
end
|
||||
|
||||
if ticked > 0 then
|
||||
if (ticked % DateTime.Seconds(1)) == 0 then
|
||||
Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(ticked) })
|
||||
if Ticked > 0 then
|
||||
if (Ticked % DateTime.Seconds(1)) == 0 then
|
||||
Timer = UserInterface.Translate("chronosphere-experiments-completes-in", { ["time"] = Utils.FormatTime(Ticked) })
|
||||
UserInterface.SetMissionText(Timer, TimerColor)
|
||||
end
|
||||
ticked = ticked - 1
|
||||
elseif ticked == 0 and (greece.PowerState ~= "Normal") then
|
||||
greece.MarkFailedObjective(KeepBasePowered)
|
||||
elseif ticked == 0 then
|
||||
Ticked = Ticked - 1
|
||||
elseif Ticked == 0 and (Greece.PowerState ~= "Normal") then
|
||||
Greece.MarkFailedObjective(KeepBasePowered)
|
||||
elseif Ticked == 0 then
|
||||
DefendChronosphereCompleted()
|
||||
ticked = ticked - 1
|
||||
Ticked = Ticked - 1
|
||||
end
|
||||
end
|
||||
|
||||
WorldLoaded = function()
|
||||
greece = Player.GetPlayer("Greece")
|
||||
ussr = Player.GetPlayer("USSR")
|
||||
germany = Player.GetPlayer("Germany")
|
||||
Greece = Player.GetPlayer("Greece")
|
||||
USSR = Player.GetPlayer("USSR")
|
||||
Germany = Player.GetPlayer("Germany")
|
||||
|
||||
InitObjectives(greece)
|
||||
DefendChronosphere = AddPrimaryObjective(greece, "defend-chronosphere-tech-center")
|
||||
KeepBasePowered = AddPrimaryObjective(greece, "chronosphere-needs-power")
|
||||
EvacuateScientists = AddSecondaryObjective(greece, "evacuate-scientists-from-island")
|
||||
BeatAllies = AddPrimaryObjective(ussr, "")
|
||||
InitObjectives(Greece)
|
||||
DefendChronosphere = AddPrimaryObjective(Greece, "defend-chronosphere-tech-center")
|
||||
KeepBasePowered = AddPrimaryObjective(Greece, "chronosphere-needs-power")
|
||||
EvacuateScientists = AddSecondaryObjective(Greece, "evacuate-scientists-from-island")
|
||||
BeatAllies = AddPrimaryObjective(USSR, "")
|
||||
|
||||
Trigger.AfterDelay(DateTime.Minutes(1), function()
|
||||
Media.PlaySpeechNotification(greece, "TwentyMinutesRemaining")
|
||||
Media.PlaySpeechNotification(Greece, "TwentyMinutesRemaining")
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(11), function()
|
||||
Media.PlaySpeechNotification(greece, "TenMinutesRemaining")
|
||||
Media.PlaySpeechNotification(Greece, "TenMinutesRemaining")
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(16), function()
|
||||
Media.PlaySpeechNotification(greece, "WarningFiveMinutesRemaining")
|
||||
Media.PlaySpeechNotification(Greece, "WarningFiveMinutesRemaining")
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(18), function()
|
||||
Media.PlaySpeechNotification(greece, "WarningThreeMinutesRemaining")
|
||||
Media.PlaySpeechNotification(Greece, "WarningThreeMinutesRemaining")
|
||||
end)
|
||||
Trigger.AfterDelay(DateTime.Minutes(20), function()
|
||||
Media.PlaySpeechNotification(greece, "WarningOneMinuteRemaining")
|
||||
Media.PlaySpeechNotification(Greece, "WarningOneMinuteRemaining")
|
||||
end)
|
||||
|
||||
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = ussr })
|
||||
PowerProxy = Actor.Create("powerproxy.paratroopers", false, { Owner = USSR })
|
||||
|
||||
Camera.Position = DefaultCameraPosition.CenterPosition
|
||||
TimerColor = greece.Color
|
||||
TimerColor = Greece.Color
|
||||
|
||||
Trigger.OnAnyKilled(ObjectiveBuildings, function()
|
||||
greece.MarkFailedObjective(DefendChronosphere)
|
||||
Greece.MarkFailedObjective(DefendChronosphere)
|
||||
end)
|
||||
|
||||
Trigger.OnEnteredFootprint(ScientistDiscoveryFootprint, function(a, id)
|
||||
if a.Owner == greece and not scientistsTriggered then
|
||||
scientistsTriggered = true
|
||||
if a.Owner == Greece and not ScientistsTriggered then
|
||||
ScientistsTriggered = true
|
||||
Trigger.RemoveFootprintTrigger(id)
|
||||
CreateScientists()
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user